@uwdata/mosaic-spec 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +47 -0
- package/dist/mosaic-schema.json +120 -33
- package/dist/mosaic-spec.js +7306 -15932
- package/dist/mosaic-spec.min.js +33 -42
- package/dist/types/ast/ASTNode.d.ts +2 -2
- package/dist/types/ast/DataNode.d.ts +3 -3
- package/dist/types/ast/ParamNode.d.ts +1 -2
- package/dist/types/ast/ParamRefNode.d.ts +1 -1
- package/dist/types/ast/SelectionNode.d.ts +15 -3
- package/dist/types/ast/TransformNode.d.ts +9 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/parse-spec.d.ts +34 -9
- package/dist/types/spec/Input.d.ts +5 -0
- package/dist/types/spec/Param.d.ts +12 -0
- package/dist/types/spec/PlotAttribute.d.ts +6 -0
- package/dist/types/spec/Transform.d.ts +33 -13
- package/dist/types/util.d.ts +3 -3
- package/package.json +8 -8
- package/src/ast/ParamNode.js +3 -4
- package/src/ast/ParamRefNode.js +1 -1
- package/src/ast/SelectionNode.js +46 -10
- package/src/ast/TransformNode.js +44 -10
- package/src/constants.js +1 -0
- package/src/parse-spec.js +53 -16
- package/src/spec/Input.ts +5 -0
- package/src/spec/Param.ts +14 -0
- package/src/spec/PlotAttribute.ts +7 -0
- package/src/spec/Spec.ts +1 -1
- package/src/spec/Transform.ts +44 -15
package/dist/mosaic-spec.min.js
CHANGED
|
@@ -1,62 +1,53 @@
|
|
|
1
|
-
var Hz=Object.create;var X_=Object.defineProperty;var Zz=Object.getOwnPropertyDescriptor;var Jz=Object.getOwnPropertyNames;var Qz=Object.getPrototypeOf,Kz=Object.prototype.hasOwnProperty;var uO=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Tr=(e,t)=>{for(var n in t)X_(e,n,{get:t[n],enumerable:!0})},tq=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jz(t))!Kz.call(e,i)&&i!==n&&X_(e,i,{get:()=>t[i],enumerable:!(r=Zz(t,i))||r.enumerable});return e};var eq=(e,t,n)=>(n=e!=null?Hz(Qz(e)):{},tq(t||!e||!e.__esModule?X_(n,"default",{value:e,enumerable:!0}):n,e));var HP=uO((rUt,WP)=>{"use strict";function rnt(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 int(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 ont(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 snt(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 ant(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 Wy(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)}WP.exports={ge:function(e,t,n,r,i){return Wy(e,t,n,r,i,rnt)},gt:function(e,t,n,r,i){return Wy(e,t,n,r,i,int)},lt:function(e,t,n,r,i){return Wy(e,t,n,r,i,ont)},le:function(e,t,n,r,i){return Wy(e,t,n,r,i,snt)},eq:function(e,t,n,r,i){return Wy(e,t,n,r,i,ant)}}});var rU=uO((iUt,nU)=>{"use strict";var Vv=HP(),bh=0,Gl=1,jv=2;nU.exports=lnt;function n6(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 Hy=n6.prototype;function t6(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 QP(e,t){var n=wh(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 ZP(e,t){var n=e.intervals([]);n.push(t),QP(e,n)}function JP(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?bh:(n.splice(r,1),QP(e,n),Gl)}Hy.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Hy.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)?ZP(this,e):this.left.insert(e):this.left=wh([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?ZP(this,e):this.right.insert(e):this.right=wh([e]);else{var n=Vv.ge(this.leftPoints,e,r6),r=Vv.ge(this.rightPoints,e,i6);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Hy.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return bh;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return JP(this,e);var r=this.left.remove(e);return r===jv?(this.left=null,this.count-=1,Gl):(r===Gl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return bh;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return JP(this,e);var r=this.right.remove(e);return r===jv?(this.right=null,this.count-=1,Gl):(r===Gl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?jv:bh;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}t6(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?t6(this,this.left):t6(this,this.right);return Gl}for(var a=Vv.ge(this.leftPoints,e,r6);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=Vv.ge(this.rightPoints,e,i6);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Gl}return bh}};function KP(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 tU(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 eU(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Hy.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return KP(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return tU(this.rightPoints,e,t)}else return eU(this.leftPoints,t)};Hy.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?KP(this.leftPoints,t,n):e>this.mid?tU(this.rightPoints,e,n):eU(this.leftPoints,n)};function cnt(e,t){return e-t}function r6(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function i6(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function wh(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(cnt);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(r6),l.sort(i6),new n6(r,wh(i),wh(o),c,l)}function e6(e){this.root=e}var vh=e6.prototype;vh.insert=function(e){this.root?this.root.insert(e):this.root=new n6(e[0],null,null,[e],[e])};vh.remove=function(e){if(this.root){var t=this.root.remove(e);return t===jv&&(this.root=null),t!==bh}return!1};vh.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};vh.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(vh,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(vh,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function lnt(e){return!e||e.length===0?new e6(null):new e6(wh(e))}});var fO={};function Ph(e,t=!1){let n,r,i=fO;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=fO,a(u)}),i=l}return t?c:a}var hr=class{constructor(t){this._filterBy=t,this._requestUpdate=Ph(()=>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(t){return this}query(t){return null}queryPending(){return this}queryResult(t){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 dO(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 J(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 hO(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function Er(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(h){r[h]&&(i[h]=function(d){return new Promise(function(p,m){o.push([h,d,p,m])>1||a(h,d)})})}function a(h,d){try{c(r[h](d))}catch(p){f(o[0][3],p)}}function c(h){h.value instanceof Ft?Promise.resolve(h.value.v).then(l,u):f(o[0][2],h)}function l(h){a("next",h)}function u(h){a("throw",h)}function f(h,d){h(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function iu(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Ft(e[i](s)),done:!1}:o?o(s):s}:o}}function Ii(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof hO=="function"?hO(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 Q_={};Tr(Q_,{compareArrayLike:()=>J_,joinUint8Arrays:()=>Nr,memcpy:()=>qh,rebaseValueOffsets:()=>Fg,toArrayBufferView:()=>Ut,toArrayBufferViewAsyncIterator:()=>Ai,toArrayBufferViewIterator:()=>to,toBigInt64Array:()=>Rg,toBigUint64Array:()=>uq,toFloat32Array:()=>fq,toFloat32ArrayAsyncIterator:()=>Tq,toFloat32ArrayIterator:()=>bq,toFloat64Array:()=>hq,toFloat64ArrayAsyncIterator:()=>Eq,toFloat64ArrayIterator:()=>wq,toInt16Array:()=>aq,toInt16ArrayAsyncIterator:()=>Sq,toInt16ArrayIterator:()=>mq,toInt32Array:()=>Ic,toInt32ArrayAsyncIterator:()=>Iq,toInt32ArrayIterator:()=>yq,toInt8Array:()=>sq,toInt8ArrayAsyncIterator:()=>_q,toInt8ArrayIterator:()=>pq,toUint16Array:()=>cq,toUint16ArrayAsyncIterator:()=>Mq,toUint16ArrayIterator:()=>gq,toUint32Array:()=>lq,toUint32ArrayAsyncIterator:()=>Aq,toUint32ArrayIterator:()=>xq,toUint8Array:()=>_t,toUint8ArrayAsyncIterator:()=>Z_,toUint8ArrayIterator:()=>H_,toUint8ClampedArray:()=>dq,toUint8ClampedArrayAsyncIterator:()=>Dq,toUint8ClampedArrayIterator:()=>vq});var nq=new TextDecoder("utf-8"),Uh=e=>nq.decode(e),rq=new TextEncoder,Ki=e=>rq.encode(e);var iq=e=>typeof e=="number",pO=e=>typeof e=="boolean",rn=e=>typeof e=="function",Gn=e=>e!=null&&Object(e)===e,Dr=e=>Gn(e)&&rn(e.then);var Mi=e=>Gn(e)&&rn(e[Symbol.iterator]),Hr=e=>Gn(e)&&rn(e[Symbol.asyncIterator]),Ng=e=>Gn(e)&&Gn(e.schema);var Og=e=>Gn(e)&&"done"in e&&"value"in e;var Lg=e=>Gn(e)&&rn(e.stat)&&iq(e.fd);var Bg=e=>Gn(e)&&zh(e.body),Cg=e=>"_getDOMStream"in e&&"_getNodeStream"in e,mO=e=>Gn(e)&&rn(e.abort)&&rn(e.getWriter)&&!Cg(e),zh=e=>Gn(e)&&rn(e.cancel)&&rn(e.getReader)&&!Cg(e),yO=e=>Gn(e)&&rn(e.end)&&rn(e.write)&&pO(e.writable)&&!Cg(e),kg=e=>Gn(e)&&rn(e.read)&&rn(e.pipe)&&pO(e.readable)&&!Cg(e),gO=e=>Gn(e)&&rn(e.clear)&&rn(e.bytes)&&rn(e.position)&&rn(e.setPosition)&&rn(e.capacity)&&rn(e.getBufferIdentifier)&&rn(e.createLong);var W_=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function oq(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 qh(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 Nr(e,t){let n=oq(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?qh(s,o,a):s=o;break}qh(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Ut(e,t){let n=Og(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Ki(n)),n instanceof ArrayBuffer?new e(n):n instanceof W_?new e(n):gO(n)?Ut(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 sq=e=>Ut(Int8Array,e),aq=e=>Ut(Int16Array,e),Ic=e=>Ut(Int32Array,e),Rg=e=>Ut(BigInt64Array,e),_t=e=>Ut(Uint8Array,e),cq=e=>Ut(Uint16Array,e),lq=e=>Ut(Uint32Array,e),uq=e=>Ut(BigUint64Array,e),fq=e=>Ut(Float32Array,e),hq=e=>Ut(Float64Array,e),dq=e=>Ut(Uint8ClampedArray,e),G_=e=>(e.next(),e);function*to(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof W_?n(t):Mi(t)?t:n(t);return yield*G_(function*(i){let o=null;do o=i.next(yield Ut(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var pq=e=>to(Int8Array,e),mq=e=>to(Int16Array,e),yq=e=>to(Int32Array,e),H_=e=>to(Uint8Array,e),gq=e=>to(Uint16Array,e),xq=e=>to(Uint32Array,e),bq=e=>to(Float32Array,e),wq=e=>to(Float64Array,e),vq=e=>to(Uint8ClampedArray,e);function Ai(e,t){return Er(this,arguments,function*(){if(Dr(t))return yield Ft(yield Ft(yield*iu(Ii(Ai(e,yield Ft(t))))));let r=function(s){return Er(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return Er(this,arguments,function*(){yield Ft(yield*iu(Ii(G_(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):Mi(t)?i(t):Hr(t)?t:r(t);return yield Ft(yield*iu(Ii(G_(function(s){return Er(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(Ut(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var _q=e=>Ai(Int8Array,e),Sq=e=>Ai(Int16Array,e),Iq=e=>Ai(Int32Array,e),Z_=e=>Ai(Uint8Array,e),Mq=e=>Ai(Uint16Array,e),Aq=e=>Ai(Uint32Array,e),Tq=e=>Ai(Float32Array,e),Eq=e=>Ai(Float64Array,e),Dq=e=>Ai(Uint8ClampedArray,e);function Fg(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 J_(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 _n={fromIterable(e){return $g(Nq(e))},fromAsyncIterable(e){return $g(Oq(e))},fromDOMStream(e){return $g(Lq(e))},fromNodeStream(e){return $g(Bq(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')}},$g=e=>(e.next(),e);function*Nq(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Nr(r,s)[0]:([i,r,a]=Nr(r,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=H_(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 Oq(e){return Er(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Nr(i,a)[0]:([o,i,c]=Nr(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=Z_(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.next()):yield Ft(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ft(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ft(u.return(new Uint8Array(0))))}return yield Ft(null)})}function Lq(e){return Er(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Nr(i,a)[0]:([o,i,c]=Nr(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=new t2(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.read()):yield Ft(u.read(a-c)),!n&&o.byteLength>0&&(i.push(_t(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ft(u.cancel(f)))}finally{r===!1?yield Ft(u.cancel()):e.locked&&u.releaseLock()}return yield Ft(null)})}var t2=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 J(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 J(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=_t(n)),n})}},K_=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Bq(e){return Er(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Nr(l,a)[0]:([u,l,c]=Nr(l,a),u)}if({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=K_(e,"end"),n[1]=K_(e,"error");do{if(n[2]=K_(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(d=>d[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=_t(e.read(a-c)),u.byteLength<a-c&&(u=_t(e.read()))):u=_t(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ft(f()));while(a<c)}while(!i)}finally{yield Ft(h(n,r==="error"?o:null))}return yield Ft(null);function h(d,p){return u=l=null,new Promise((m,y)=>{for(let[g,x]of d)e.off(g,x);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var le;(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"})(le||(le={}));var xe;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(xe||(xe={}));var pe;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(pe||(pe={}));var Ye;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Ye||(Ye={}));var ct;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ct||(ct={}));var un;(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"})(un||(un={}));var eo=new Int32Array(2),Pg=new Float32Array(eo.buffer),Ug=new Float64Array(eo.buffer),ou=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var jh;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(jh||(jh={}));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 eo[0]=this.readInt32(t),Pg[0]}readFloat64(t){return eo[ou?0:1]=this.readInt32(t),eo[ou?1:0]=this.readInt32(t+4),Ug[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){Pg[0]=n,this.writeInt32(t,eo[0])}writeFloat64(t,n){Ug[0]=n,this.writeInt32(t,eo[ou?0:1]),this.writeInt32(t+4,eo[ou?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===jh.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 Mc=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 Vh;(function(e){e[e.BUFFER=0]="BUFFER"})(Vh||(Vh={}));var Yh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Yh||(Yh={}));var qg=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):Yh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Vh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Yh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Vh.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 su=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 au=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 Lr=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 au).__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 su).__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 qg).__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 ss=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 Lr).__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 pa;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(pa||(pa={}));var Xh;(function(e){e[e.DenseArray=0]="DenseArray"})(Xh||(Xh={}));var Ei=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 no=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 Ei).__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):Xh.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,Xh.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var on=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 Gh=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 Wh=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 ma=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):Ye.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ye.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var ro=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 ya=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):ct.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ct.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};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 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 xa=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 ba=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):pe.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,pe.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var wa=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):un.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,un.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Hh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}};var Zh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}};var Jh=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 va=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 Qh=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 Kh=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):ct.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,ct.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):ct.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,ct.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 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):xe.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,xe.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 td=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 me;(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"})(me||(me={}));var kn=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):me.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 no).__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 on).__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,me.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 dr=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):pa.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new kn).__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 on).__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,pa.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 jt;(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"})(jt||(jt={}));var B;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(B||(B={}));var Ni;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Ni||(Ni={}));var b2={};Tr(b2,{clampIndex:()=>wj,clampRange:()=>pd,createElementComparator:()=>Ia});var e2={};Tr(e2,{valueToString:()=>Oi});function Oi(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=>Oi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var r2={};Tr(r2,{BN:()=>nd,bigNumToBigInt:()=>wO,bigNumToString:()=>uu,isArrowBigNumSymbol:()=>xO});var xO=Symbol.for("isArrowBigNum");function Li(e,...t){return t.length===0?Object.setPrototypeOf(Ut(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Li.prototype[xO]=!0;Li.prototype.toJSON=function(){return`"${uu(this)}"`};Li.prototype.valueOf=function(){return bO(this)};Li.prototype.toString=function(){return uu(this)};Li.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return bO(this);case"string":return uu(this);case"default":return wO(this)}return uu(this)};function cu(...e){return Li.apply(this,e)}function lu(...e){return Li.apply(this,e)}function ed(...e){return Li.apply(this,e)}Object.setPrototypeOf(cu.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(lu.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ed.prototype,Object.create(Uint32Array.prototype));Object.assign(cu.prototype,Li.prototype,{constructor:cu,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(lu.prototype,Li.prototype,{constructor:lu,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ed.prototype,Li.prototype,{constructor:ed,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function bO(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 uu=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return n2(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return n2(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`-${n2(t)}`},wO=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:uu(e);function n2(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 nd=class e{static new(t,n){switch(n){case!0:return new cu(t);case!1:return new lu(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new cu(t)}return t.byteLength===16?new ed(t):new lu(t)}static signed(t){return new cu(t)}static unsigned(t){return new lu(t)}static decimal(t){return new ed(t)}constructor(t,n){return e.new(t,n)}};function Ne(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 vO,_O,SO,IO,MO,AO,TO,EO,DO,NO,OO,LO,BO,CO,kO,RO,FO,$O,PO,UO,zO,qO,H=class e{static isNull(t){return t?.typeId===B.Null}static isInt(t){return t?.typeId===B.Int}static isFloat(t){return t?.typeId===B.Float}static isBinary(t){return t?.typeId===B.Binary}static isLargeBinary(t){return t?.typeId===B.LargeBinary}static isUtf8(t){return t?.typeId===B.Utf8}static isLargeUtf8(t){return t?.typeId===B.LargeUtf8}static isBool(t){return t?.typeId===B.Bool}static isDecimal(t){return t?.typeId===B.Decimal}static isDate(t){return t?.typeId===B.Date}static isTime(t){return t?.typeId===B.Time}static isTimestamp(t){return t?.typeId===B.Timestamp}static isInterval(t){return t?.typeId===B.Interval}static isDuration(t){return t?.typeId===B.Duration}static isList(t){return t?.typeId===B.List}static isStruct(t){return t?.typeId===B.Struct}static isUnion(t){return t?.typeId===B.Union}static isFixedSizeBinary(t){return t?.typeId===B.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===B.FixedSizeList}static isMap(t){return t?.typeId===B.Map}static isDictionary(t){return t?.typeId===B.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===xe.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===xe.Sparse}constructor(t){this.typeId=t}};vO=Symbol.toStringTag;H[vO]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(H.prototype);var Rn=class extends H{constructor(){super(B.Null)}toString(){return"Null"}};_O=Symbol.toStringTag;Rn[_O]=(e=>e[Symbol.toStringTag]="Null")(Rn.prototype);var ke=class extends H{constructor(t,n){super(B.Int),this.isSigned=t,this.bitWidth=n}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}`}};SO=Symbol.toStringTag;ke[SO]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(ke.prototype);var rd=class extends ke{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},id=class extends ke{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Bi=class extends ke{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},od=class extends ke{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},sd=class extends ke{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ad=class extends ke{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},cd=class extends ke{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ld=class extends ke{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(rd.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(id.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Bi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(od.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(sd.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ad.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(cd.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(ld.prototype,"ArrayType",{value:BigUint64Array});var Wn=class extends H{constructor(t){super(B.Float),this.precision=t}get ArrayType(){switch(this.precision){case pe.HALF:return Uint16Array;case pe.SINGLE:return Float32Array;case pe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};IO=Symbol.toStringTag;Wn[IO]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Wn.prototype);var ud=class extends Wn{constructor(){super(pe.HALF)}},fd=class extends Wn{constructor(){super(pe.SINGLE)}},hd=class extends Wn{constructor(){super(pe.DOUBLE)}};Object.defineProperty(ud.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(fd.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(hd.prototype,"ArrayType",{value:Float64Array});var io=class extends H{constructor(){super(B.Binary)}toString(){return"Binary"}};MO=Symbol.toStringTag;io[MO]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(io.prototype);var oo=class extends H{constructor(){super(B.LargeBinary)}toString(){return"LargeBinary"}};AO=Symbol.toStringTag;oo[AO]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(oo.prototype);var so=class extends H{constructor(){super(B.Utf8)}toString(){return"Utf8"}};TO=Symbol.toStringTag;so[TO]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(so.prototype);var ao=class extends H{constructor(){super(B.LargeUtf8)}toString(){return"LargeUtf8"}};EO=Symbol.toStringTag;ao[EO]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(ao.prototype);var co=class extends H{constructor(){super(B.Bool)}toString(){return"Bool"}};DO=Symbol.toStringTag;co[DO]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(co.prototype);var lo=class extends H{constructor(t,n,r=128){super(B.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};NO=Symbol.toStringTag;lo[NO]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(lo.prototype);var uo=class extends H{constructor(t){super(B.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Ye[this.unit]}>`}};OO=Symbol.toStringTag;uo[OO]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(uo.prototype);var Jr=class extends H{constructor(t,n){super(B.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${ct[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};LO=Symbol.toStringTag;Jr[LO]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Jr.prototype);var fo=class extends H{constructor(t,n){super(B.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${ct[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};BO=Symbol.toStringTag;fo[BO]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(fo.prototype);var ho=class extends H{constructor(t){super(B.Interval),this.unit=t}toString(){return`Interval<${un[this.unit]}>`}};CO=Symbol.toStringTag;ho[CO]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(ho.prototype);var po=class extends H{constructor(t){super(B.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};kO=Symbol.toStringTag;po[kO]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(po.prototype);var Qr=class extends H{constructor(t){super(B.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};RO=Symbol.toStringTag;Qr[RO]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Qr.prototype);var be=class extends H{constructor(t){super(B.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};FO=Symbol.toStringTag;be[FO]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(be.prototype);var Kr=class extends H{constructor(t,n,r){super(B.Union),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))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};$O=Symbol.toStringTag;Kr[$O]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Kr.prototype);var mo=class extends H{constructor(t){super(B.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};PO=Symbol.toStringTag;mo[PO]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(mo.prototype);var ti=class extends H{constructor(t,n){super(B.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}};UO=Symbol.toStringTag;ti[UO]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(ti.prototype);var ei=class extends H{constructor(t,n=!1){var r,i,o;if(super(B.Map),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 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(", ")}}>`}};zO=Symbol.toStringTag;ei[zO]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(ei.prototype);var Cq=(e=>()=>++e)(-1),pr=class extends H{constructor(t,n,r,i){super(B.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Cq():Ne(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};qO=Symbol.toStringTag;pr[qO]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(pr.prototype);function Br(e){let t=e;switch(e.typeId){case B.Decimal:return e.bitWidth/32;case B.Timestamp:return 2;case B.Date:return 1+t.unit;case B.Interval:return 1+t.unit;case B.FixedSizeList:return t.listSize;case B.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=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 kq(this,t,n)}getVisitFnByTypeId(t,n=!0){return fu(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}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(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 kq(e,t,n=!0){return typeof t=="number"?fu(e,t,n):typeof t=="string"&&t in B?fu(e,B[t],n):t&&t instanceof H?fu(e,jO(t),n):t?.type&&t.type instanceof H?fu(e,jO(t.type),n):fu(e,B.NONE,n)}function fu(e,t,n=!0){let r=null;switch(t){case B.Null:r=e.visitNull;break;case B.Bool:r=e.visitBool;break;case B.Int:r=e.visitInt;break;case B.Int8:r=e.visitInt8||e.visitInt;break;case B.Int16:r=e.visitInt16||e.visitInt;break;case B.Int32:r=e.visitInt32||e.visitInt;break;case B.Int64:r=e.visitInt64||e.visitInt;break;case B.Uint8:r=e.visitUint8||e.visitInt;break;case B.Uint16:r=e.visitUint16||e.visitInt;break;case B.Uint32:r=e.visitUint32||e.visitInt;break;case B.Uint64:r=e.visitUint64||e.visitInt;break;case B.Float:r=e.visitFloat;break;case B.Float16:r=e.visitFloat16||e.visitFloat;break;case B.Float32:r=e.visitFloat32||e.visitFloat;break;case B.Float64:r=e.visitFloat64||e.visitFloat;break;case B.Utf8:r=e.visitUtf8;break;case B.LargeUtf8:r=e.visitLargeUtf8;break;case B.Binary:r=e.visitBinary;break;case B.LargeBinary:r=e.visitLargeBinary;break;case B.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case B.Date:r=e.visitDate;break;case B.DateDay:r=e.visitDateDay||e.visitDate;break;case B.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case B.Timestamp:r=e.visitTimestamp;break;case B.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case B.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case B.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case B.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case B.Time:r=e.visitTime;break;case B.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case B.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case B.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case B.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case B.Decimal:r=e.visitDecimal;break;case B.List:r=e.visitList;break;case B.Struct:r=e.visitStruct;break;case B.Union:r=e.visitUnion;break;case B.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case B.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case B.Dictionary:r=e.visitDictionary;break;case B.Interval:r=e.visitInterval;break;case B.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case B.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case B.Duration:r=e.visitDuration;break;case B.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case B.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case B.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case B.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case B.FixedSizeList:r=e.visitFixedSizeList;break;case B.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${B[t]}'`)}function jO(e){switch(e.typeId){case B.Null:return B.Null;case B.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?B.Int8:B.Uint8;case 16:return n?B.Int16:B.Uint16;case 32:return n?B.Int32:B.Uint32;case 64:return n?B.Int64:B.Uint64}return B.Int}case B.Float:switch(e.precision){case pe.HALF:return B.Float16;case pe.SINGLE:return B.Float32;case pe.DOUBLE:return B.Float64}return B.Float;case B.Binary:return B.Binary;case B.LargeBinary:return B.LargeBinary;case B.Utf8:return B.Utf8;case B.LargeUtf8:return B.LargeUtf8;case B.Bool:return B.Bool;case B.Decimal:return B.Decimal;case B.Time:switch(e.unit){case ct.SECOND:return B.TimeSecond;case ct.MILLISECOND:return B.TimeMillisecond;case ct.MICROSECOND:return B.TimeMicrosecond;case ct.NANOSECOND:return B.TimeNanosecond}return B.Time;case B.Timestamp:switch(e.unit){case ct.SECOND:return B.TimestampSecond;case ct.MILLISECOND:return B.TimestampMillisecond;case ct.MICROSECOND:return B.TimestampMicrosecond;case ct.NANOSECOND:return B.TimestampNanosecond}return B.Timestamp;case B.Date:switch(e.unit){case Ye.DAY:return B.DateDay;case Ye.MILLISECOND:return B.DateMillisecond}return B.Date;case B.Interval:switch(e.unit){case un.DAY_TIME:return B.IntervalDayTime;case un.YEAR_MONTH:return B.IntervalYearMonth}return B.Interval;case B.Duration:switch(e.unit){case ct.SECOND:return B.DurationSecond;case ct.MILLISECOND:return B.DurationMillisecond;case ct.MICROSECOND:return B.DurationMicrosecond;case ct.NANOSECOND:return B.DurationNanosecond}return B.Duration;case B.Map:return B.Map;case B.List:return B.List;case B.Struct:return B.Struct;case B.Union:switch(e.mode){case xe.Dense:return B.DenseUnion;case xe.Sparse:return B.SparseUnion}return B.Union;case B.FixedSizeBinary:return B.FixedSizeBinary;case B.FixedSizeList:return B.FixedSizeList;case B.Dictionary:return B.Dictionary}throw new Error(`Unrecognized type '${B[e.typeId]}'`)}mt.prototype.visitInt8=null;mt.prototype.visitInt16=null;mt.prototype.visitInt32=null;mt.prototype.visitInt64=null;mt.prototype.visitUint8=null;mt.prototype.visitUint16=null;mt.prototype.visitUint32=null;mt.prototype.visitUint64=null;mt.prototype.visitFloat16=null;mt.prototype.visitFloat32=null;mt.prototype.visitFloat64=null;mt.prototype.visitDateDay=null;mt.prototype.visitDateMillisecond=null;mt.prototype.visitTimestampSecond=null;mt.prototype.visitTimestampMillisecond=null;mt.prototype.visitTimestampMicrosecond=null;mt.prototype.visitTimestampNanosecond=null;mt.prototype.visitTimeSecond=null;mt.prototype.visitTimeMillisecond=null;mt.prototype.visitTimeMicrosecond=null;mt.prototype.visitTimeNanosecond=null;mt.prototype.visitDenseUnion=null;mt.prototype.visitSparseUnion=null;mt.prototype.visitIntervalDayTime=null;mt.prototype.visitIntervalYearMonth=null;mt.prototype.visitDuration=null;mt.prototype.visitDurationSecond=null;mt.prototype.visitDurationMillisecond=null;mt.prototype.visitDurationMicrosecond=null;mt.prototype.visitDurationNanosecond=null;var i2={};Tr(i2,{float64ToUint16:()=>dd,uint16ToFloat64:()=>jg});var VO=new Float64Array(1),hu=new Uint32Array(VO.buffer);function jg(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 dd(e){if(e!==e)return 32256;VO[0]=e;let t=(hu[1]&2147483648)>>16&65535,n=hu[1]&2146435072,r=0;return n>=1089470464?hu[0]>0?n=31744:(n=(n&2080374784)>>16,r=(hu[1]&1048575)>>10):n<=1056964608?(r=1048576+(hu[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(hu[1]&1048575)+512>>10),t|n|r&65535}var vt=class extends mt{};function Tt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Rq=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},o2=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Fq=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},$q=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},YO=(e,t,n,r)=>{if(n+1<t.length){let i=Ne(t[n]),o=Ne(t[n+1]);e.set(r.subarray(0,o-i),i)}},Pq=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},ls=({values:e},t,n)=>{e[t]=n},s2=({values:e},t,n)=>{e[t]=n},XO=({values:e},t,n)=>{e[t]=dd(n)},Uq=(e,t,n)=>{switch(e.type.precision){case pe.HALF:return XO(e,t,n);case pe.SINGLE:case pe.DOUBLE:return s2(e,t,n)}},Vg=({values:e},t,n)=>{Rq(e,t,n.valueOf())},Yg=({values:e},t,n)=>{o2(e,t*2,n.valueOf())},a2=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},GO=({values:e,valueOffsets:t},n,r)=>YO(e,t,n,r),WO=({values:e,valueOffsets:t},n,r)=>YO(e,t,n,Ki(r)),c2=(e,t,n)=>{e.type.unit===Ye.DAY?Vg(e,t,n):Yg(e,t,n)},Xg=({values:e},t,n)=>o2(e,t*2,n/1e3),Gg=({values:e},t,n)=>o2(e,t*2,n),Wg=({values:e},t,n)=>Fq(e,t*2,n),Hg=({values:e},t,n)=>$q(e,t*2,n),l2=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Xg(e,t,n);case ct.MILLISECOND:return Gg(e,t,n);case ct.MICROSECOND:return Wg(e,t,n);case ct.NANOSECOND:return Hg(e,t,n)}},Zg=({values:e},t,n)=>{e[t]=n},Jg=({values:e},t,n)=>{e[t]=n},Qg=({values:e},t,n)=>{e[t]=n},Kg=({values:e},t,n)=>{e[t]=n},u2=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Zg(e,t,n);case ct.MILLISECOND:return Jg(e,t,n);case ct.MICROSECOND:return Qg(e,t,n);case ct.NANOSECOND:return Kg(e,t,n)}},f2=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},zq=(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))},qq=(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},jq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),Vq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),Yq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),Xq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),Gq=(e,t,n)=>{let r=e.type.children.map(o=>Sn.getVisitFn(o.type)),i=n instanceof Map?Yq(t,n):n instanceof Gt?Vq(t,n):Array.isArray(n)?jq(t,n):Xq(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},Wq=(e,t,n)=>{e.type.mode===xe.Dense?HO(e,t,n):ZO(e,t,n)},HO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Sn.visit(i,e.valueOffsets[t],n)},ZO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Sn.visit(i,t,n)},Hq=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},h2=(e,t,n)=>{e.type.unit===un.DAY_TIME?t0(e,t,n):e0(e,t,n)},t0=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},e0=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},n0=({values:e},t,n)=>{e[t]=n},r0=({values:e},t,n)=>{e[t]=n},i0=({values:e},t,n)=>{e[t]=n},o0=({values:e},t,n)=>{e[t]=n},d2=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return n0(e,t,n);case ct.MILLISECOND:return r0(e,t,n);case ct.MICROSECOND:return i0(e,t,n);case ct.NANOSECOND:return o0(e,t,n)}},Zq=(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))};vt.prototype.visitBool=Tt(Pq);vt.prototype.visitInt=Tt(ls);vt.prototype.visitInt8=Tt(ls);vt.prototype.visitInt16=Tt(ls);vt.prototype.visitInt32=Tt(ls);vt.prototype.visitInt64=Tt(ls);vt.prototype.visitUint8=Tt(ls);vt.prototype.visitUint16=Tt(ls);vt.prototype.visitUint32=Tt(ls);vt.prototype.visitUint64=Tt(ls);vt.prototype.visitFloat=Tt(Uq);vt.prototype.visitFloat16=Tt(XO);vt.prototype.visitFloat32=Tt(s2);vt.prototype.visitFloat64=Tt(s2);vt.prototype.visitUtf8=Tt(WO);vt.prototype.visitLargeUtf8=Tt(WO);vt.prototype.visitBinary=Tt(GO);vt.prototype.visitLargeBinary=Tt(GO);vt.prototype.visitFixedSizeBinary=Tt(a2);vt.prototype.visitDate=Tt(c2);vt.prototype.visitDateDay=Tt(Vg);vt.prototype.visitDateMillisecond=Tt(Yg);vt.prototype.visitTimestamp=Tt(l2);vt.prototype.visitTimestampSecond=Tt(Xg);vt.prototype.visitTimestampMillisecond=Tt(Gg);vt.prototype.visitTimestampMicrosecond=Tt(Wg);vt.prototype.visitTimestampNanosecond=Tt(Hg);vt.prototype.visitTime=Tt(u2);vt.prototype.visitTimeSecond=Tt(Zg);vt.prototype.visitTimeMillisecond=Tt(Jg);vt.prototype.visitTimeMicrosecond=Tt(Qg);vt.prototype.visitTimeNanosecond=Tt(Kg);vt.prototype.visitDecimal=Tt(f2);vt.prototype.visitList=Tt(zq);vt.prototype.visitStruct=Tt(Gq);vt.prototype.visitUnion=Tt(Wq);vt.prototype.visitDenseUnion=Tt(HO);vt.prototype.visitSparseUnion=Tt(ZO);vt.prototype.visitDictionary=Tt(Hq);vt.prototype.visitInterval=Tt(h2);vt.prototype.visitIntervalDayTime=Tt(t0);vt.prototype.visitIntervalYearMonth=Tt(e0);vt.prototype.visitDuration=Tt(d2);vt.prototype.visitDurationSecond=Tt(n0);vt.prototype.visitDurationMillisecond=Tt(r0);vt.prototype.visitDurationMicrosecond=Tt(i0);vt.prototype.visitDurationNanosecond=Tt(o0);vt.prototype.visitFixedSizeList=Tt(Zq);vt.prototype.visitMap=Tt(qq);var Sn=new vt;var Ci=Symbol.for("parent"),du=Symbol.for("rowIndex"),_a=class{constructor(t,n){return this[Ci]=t,this[du]=n,new Proxy(this,new m2)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[du],n=this[Ci],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Xe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Oi(t)}: ${Oi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new p2(this[Ci],this[du])}},p2=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,Xe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(_a.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ci]:{writable:!0,enumerable:!1,configurable:!1,value:null},[du]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var m2=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ci].type.children.map(n=>n.name)}has(t,n){return t[Ci].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Ci].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[Ci].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Xe.visit(t[Ci].children[r],t[du]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Ci].type.children.findIndex(o=>o.name===n);return i!==-1?(Sn.visit(t[Ci].children[i],t[du],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var yt=class extends mt{};function It(e){return(t,n)=>t.getValid(n)?e(t,n):null}var Jq=(e,t)=>864e5*e[t],y2=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Qq=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Kq=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,JO=e=>new Date(e),tj=(e,t)=>JO(Jq(e,t)),ej=(e,t)=>JO(y2(e,t)),nj=(e,t)=>null,QO=(e,t,n)=>{if(n+1>=t.length)return null;let r=Ne(t[n]),i=Ne(t[n+1]);return e.subarray(r,i)},rj=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},KO=({values:e},t)=>tj(e,t),t5=({values:e},t)=>ej(e,t*2),Sa=({stride:e,values:t},n)=>t[e*n],ij=({stride:e,values:t},n)=>jg(t[e*n]),e5=({values:e},t)=>e[t],oj=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),n5=({values:e,valueOffsets:t},n)=>QO(e,t,n),r5=({values:e,valueOffsets:t},n)=>{let r=QO(e,t,n);return r!==null?Uh(r):null},sj=({values:e},t)=>e[t],aj=({type:e,values:t},n)=>e.precision!==pe.HALF?t[n]:jg(t[n]),cj=(e,t)=>e.type.unit===Ye.DAY?KO(e,t):t5(e,t),i5=({values:e},t)=>1e3*y2(e,t*2),o5=({values:e},t)=>y2(e,t*2),s5=({values:e},t)=>Qq(e,t*2),a5=({values:e},t)=>Kq(e,t*2),lj=(e,t)=>{switch(e.type.unit){case ct.SECOND:return i5(e,t);case ct.MILLISECOND:return o5(e,t);case ct.MICROSECOND:return s5(e,t);case ct.NANOSECOND:return a5(e,t)}},c5=({values:e},t)=>e[t],l5=({values:e},t)=>e[t],u5=({values:e},t)=>e[t],f5=({values:e},t)=>e[t],uj=(e,t)=>{switch(e.type.unit){case ct.SECOND:return c5(e,t);case ct.MILLISECOND:return l5(e,t);case ct.MICROSECOND:return u5(e,t);case ct.NANOSECOND:return f5(e,t)}},fj=({values:e,stride:t},n)=>nd.decimal(e.subarray(t*n,t*(n+1))),hj=(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 Gt([c])},dj=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new yo(s.slice(i,o-i))},pj=(e,t)=>new _a(e,t),mj=(e,t)=>e.type.mode===xe.Dense?h5(e,t):d5(e,t),h5=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Xe.visit(r,e.valueOffsets[t])},d5=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Xe.visit(r,t)},yj=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},gj=(e,t)=>e.type.unit===un.DAY_TIME?p5(e,t):m5(e,t),p5=({values:e},t)=>e.subarray(2*t,2*(t+1)),m5=({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},y5=({values:e},t)=>e[t],g5=({values:e},t)=>e[t],x5=({values:e},t)=>e[t],b5=({values:e},t)=>e[t],xj=(e,t)=>{switch(e.type.unit){case ct.SECOND:return y5(e,t);case ct.MILLISECOND:return g5(e,t);case ct.MICROSECOND:return x5(e,t);case ct.NANOSECOND:return b5(e,t)}},bj=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Gt([o])};yt.prototype.visitNull=It(nj);yt.prototype.visitBool=It(rj);yt.prototype.visitInt=It(sj);yt.prototype.visitInt8=It(Sa);yt.prototype.visitInt16=It(Sa);yt.prototype.visitInt32=It(Sa);yt.prototype.visitInt64=It(e5);yt.prototype.visitUint8=It(Sa);yt.prototype.visitUint16=It(Sa);yt.prototype.visitUint32=It(Sa);yt.prototype.visitUint64=It(e5);yt.prototype.visitFloat=It(aj);yt.prototype.visitFloat16=It(ij);yt.prototype.visitFloat32=It(Sa);yt.prototype.visitFloat64=It(Sa);yt.prototype.visitUtf8=It(r5);yt.prototype.visitLargeUtf8=It(r5);yt.prototype.visitBinary=It(n5);yt.prototype.visitLargeBinary=It(n5);yt.prototype.visitFixedSizeBinary=It(oj);yt.prototype.visitDate=It(cj);yt.prototype.visitDateDay=It(KO);yt.prototype.visitDateMillisecond=It(t5);yt.prototype.visitTimestamp=It(lj);yt.prototype.visitTimestampSecond=It(i5);yt.prototype.visitTimestampMillisecond=It(o5);yt.prototype.visitTimestampMicrosecond=It(s5);yt.prototype.visitTimestampNanosecond=It(a5);yt.prototype.visitTime=It(uj);yt.prototype.visitTimeSecond=It(c5);yt.prototype.visitTimeMillisecond=It(l5);yt.prototype.visitTimeMicrosecond=It(u5);yt.prototype.visitTimeNanosecond=It(f5);yt.prototype.visitDecimal=It(fj);yt.prototype.visitList=It(hj);yt.prototype.visitStruct=It(pj);yt.prototype.visitUnion=It(mj);yt.prototype.visitDenseUnion=It(h5);yt.prototype.visitSparseUnion=It(d5);yt.prototype.visitDictionary=It(yj);yt.prototype.visitInterval=It(gj);yt.prototype.visitIntervalDayTime=It(p5);yt.prototype.visitIntervalYearMonth=It(m5);yt.prototype.visitDuration=It(xj);yt.prototype.visitDurationSecond=It(y5);yt.prototype.visitDurationMillisecond=It(g5);yt.prototype.visitDurationMicrosecond=It(x5);yt.prototype.visitDurationNanosecond=It(b5);yt.prototype.visitFixedSizeList=It(bj);yt.prototype.visitMap=It(dj);var Xe=new yt;var ni=Symbol.for("keys"),pu=Symbol.for("vals"),yo=class{constructor(t){return this[ni]=new Gt([t.children[0]]).memoize(),this[pu]=t.children[1],new Proxy(this,new x2)}[Symbol.iterator](){return new g2(this[ni],this[pu])}get size(){return this[ni].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ni],n=this[pu],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Xe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Oi(t)}: ${Oi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},g2=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),Xe.visit(this.vals,t)]})}},x2=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ni].toArray().map(String)}has(t,n){return t[ni].includes(n)}getOwnPropertyDescriptor(t,n){if(t[ni].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[ni].indexOf(n);if(r!==-1){let i=Xe.visit(Reflect.get(t,pu),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[ni].indexOf(n);return i!==-1?(Sn.visit(Reflect.get(t,pu),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(yo.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ni]:{writable:!0,enumerable:!1,configurable:!1,value:null},[pu]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function wj(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var w5;function pd(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&&(w5=o,o=s,s=w5),s>i&&(s=i),r?r(e,o,s):[o,s]}var v5=e=>e!==e;function Ia(e){if(typeof e!=="object"||e===null)return v5(e)?v5: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?J_(e,n):!1:e instanceof Map?_j(e):Array.isArray(e)?vj(e):e instanceof Gt?Sj(e):Ij(e,!0)}function vj(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Ia(e[n]);return s0(t)}function _j(e){let t=-1,n=[];for(let r of e.values())n[++t]=Ia(r);return s0(n)}function Sj(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Ia(e.get(n));return s0(t)}function Ij(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 s0(r,n)}function s0(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return Mj(e,n);case Map:return _5(e,n,n.keys());case yo:case _a:case Object:case void 0:return _5(e,n,t||Object.keys(n))}return n instanceof Gt?Aj(e,n):!1}}function Mj(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 Aj(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 _5(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 w2={};Tr(w2,{BitIterator:()=>Ac,getBit:()=>S5,getBool:()=>c0,packBools:()=>Ec,popcnt_array:()=>I5,popcnt_bit_range:()=>md,popcnt_uint32:()=>a0,setBool:()=>Tj,truncateBitmap:()=>Tc});function c0(e,t,n,r){return(n&1<<r)!==0}function S5(e,t,n,r){return(n&1<<r)>>r}function Tj(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Tc(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):Ec(new Ac(n,e,t,null,c0)).subarray(0,r)),i}return n}function Ec(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 Ac=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 md(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new Ac(e,t,n-t,e,S5))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return md(e,t,i)+md(e,r,n)+I5(e,i>>3,r-i>>3)}function I5(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+=a0(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=a0(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=a0(o.getUint8(i)),i+=1;return r}function a0(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 Ej=-1,ee=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 H.isSparseUnion(t)?this.children.some(n=>n.nullable):H.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(H.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=Ej&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-md(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=Br(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(H.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===xe.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(H.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===xe.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(Tc(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===B.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(Tc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Ni.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[Ni.TYPE])&&(s[Ni.TYPE]=o.subarray(t,t+n)),(o=s[Ni.OFFSET])&&(s[Ni.OFFSET]=o.subarray(t,t+n+1))||(o=s[Ni.DATA])&&(s[Ni.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};ee.prototype.children=Object.freeze([]);var v2=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new ee(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=Ic(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=Rg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=Ic(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=Rg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=_t(t.nullBitmap),s=Ic(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=_t(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ut(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(H.isSparseUnion(n))return new ee(n,r,s,a,[void 0,void 0,void 0,o],i);let c=Ic(t.valueOffsets);return new ee(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.indices.ArrayType,t.data),{["dictionary"]:s=new Gt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(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=_t(t.nullBitmap),{["length"]:s=i.length/Br(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ee(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=_t(t.nullBitmap),s=Ic(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ee(n,r,a,c,[s,void 0,o],[i])}},Dj=new v2;function Dt(e){return Dj.visit(e)}var yd=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 M5(e){return e.some(t=>t.nullable)}function l0(e){return e.reduce((t,n)=>t+n.nullCount,0)}function u0(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function f0(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 _2(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 gd(e,t){return e.getValid(t)}function mu(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return _2(r,this._offsets,n,t)}}function h0(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=_2(o,this._offsets,r,n);return t=void 0,s}}function d0(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):_2(o,this._offsets,i,n);return t=void 0,s}}var gt=class extends mt{};function Nj(e,t){return t===null&&e.length>0?0:-1}function Oj(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new Ac(n,e.offset+(t||0),e.length,n,c0)){if(!i)return r;++r}return-1}function Nt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case B.Union:break;case B.Dictionary:break;default:return Oj(e,n)}let r=Xe.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 A5(e,t,n){let r=Xe.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}gt.prototype.visitNull=Nj;gt.prototype.visitBool=Nt;gt.prototype.visitInt=Nt;gt.prototype.visitInt8=Nt;gt.prototype.visitInt16=Nt;gt.prototype.visitInt32=Nt;gt.prototype.visitInt64=Nt;gt.prototype.visitUint8=Nt;gt.prototype.visitUint16=Nt;gt.prototype.visitUint32=Nt;gt.prototype.visitUint64=Nt;gt.prototype.visitFloat=Nt;gt.prototype.visitFloat16=Nt;gt.prototype.visitFloat32=Nt;gt.prototype.visitFloat64=Nt;gt.prototype.visitUtf8=Nt;gt.prototype.visitLargeUtf8=Nt;gt.prototype.visitBinary=Nt;gt.prototype.visitLargeBinary=Nt;gt.prototype.visitFixedSizeBinary=Nt;gt.prototype.visitDate=Nt;gt.prototype.visitDateDay=Nt;gt.prototype.visitDateMillisecond=Nt;gt.prototype.visitTimestamp=Nt;gt.prototype.visitTimestampSecond=Nt;gt.prototype.visitTimestampMillisecond=Nt;gt.prototype.visitTimestampMicrosecond=Nt;gt.prototype.visitTimestampNanosecond=Nt;gt.prototype.visitTime=Nt;gt.prototype.visitTimeSecond=Nt;gt.prototype.visitTimeMillisecond=Nt;gt.prototype.visitTimeMicrosecond=Nt;gt.prototype.visitTimeNanosecond=Nt;gt.prototype.visitDecimal=Nt;gt.prototype.visitList=Nt;gt.prototype.visitStruct=Nt;gt.prototype.visitUnion=Nt;gt.prototype.visitDenseUnion=A5;gt.prototype.visitSparseUnion=A5;gt.prototype.visitDictionary=Nt;gt.prototype.visitInterval=Nt;gt.prototype.visitIntervalDayTime=Nt;gt.prototype.visitIntervalYearMonth=Nt;gt.prototype.visitDuration=Nt;gt.prototype.visitDurationSecond=Nt;gt.prototype.visitDurationMillisecond=Nt;gt.prototype.visitDurationMicrosecond=Nt;gt.prototype.visitDurationNanosecond=Nt;gt.prototype.visitFixedSizeList=Nt;gt.prototype.visitMap=Nt;var Dc=new gt;var xt=class extends mt{};function Mt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===B.Timestamp||t instanceof ke&&t.bitWidth!==64||t instanceof Jr&&t.bitWidth!==64||t instanceof Wn&&t.precision!==pe.HALF))return new yd(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new yd(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new S2(s)})}var S2=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=Mt;xt.prototype.visitBool=Mt;xt.prototype.visitInt=Mt;xt.prototype.visitInt8=Mt;xt.prototype.visitInt16=Mt;xt.prototype.visitInt32=Mt;xt.prototype.visitInt64=Mt;xt.prototype.visitUint8=Mt;xt.prototype.visitUint16=Mt;xt.prototype.visitUint32=Mt;xt.prototype.visitUint64=Mt;xt.prototype.visitFloat=Mt;xt.prototype.visitFloat16=Mt;xt.prototype.visitFloat32=Mt;xt.prototype.visitFloat64=Mt;xt.prototype.visitUtf8=Mt;xt.prototype.visitLargeUtf8=Mt;xt.prototype.visitBinary=Mt;xt.prototype.visitLargeBinary=Mt;xt.prototype.visitFixedSizeBinary=Mt;xt.prototype.visitDate=Mt;xt.prototype.visitDateDay=Mt;xt.prototype.visitDateMillisecond=Mt;xt.prototype.visitTimestamp=Mt;xt.prototype.visitTimestampSecond=Mt;xt.prototype.visitTimestampMillisecond=Mt;xt.prototype.visitTimestampMicrosecond=Mt;xt.prototype.visitTimestampNanosecond=Mt;xt.prototype.visitTime=Mt;xt.prototype.visitTimeSecond=Mt;xt.prototype.visitTimeMillisecond=Mt;xt.prototype.visitTimeMicrosecond=Mt;xt.prototype.visitTimeNanosecond=Mt;xt.prototype.visitDecimal=Mt;xt.prototype.visitList=Mt;xt.prototype.visitStruct=Mt;xt.prototype.visitUnion=Mt;xt.prototype.visitDenseUnion=Mt;xt.prototype.visitSparseUnion=Mt;xt.prototype.visitDictionary=Mt;xt.prototype.visitInterval=Mt;xt.prototype.visitIntervalDayTime=Mt;xt.prototype.visitIntervalYearMonth=Mt;xt.prototype.visitDuration=Mt;xt.prototype.visitDurationSecond=Mt;xt.prototype.visitDurationMillisecond=Mt;xt.prototype.visitDurationMicrosecond=Mt;xt.prototype.visitDurationNanosecond=Mt;xt.prototype.visitFixedSizeList=Mt;xt.prototype.visitMap=Mt;var yu=new xt;var T5,E5={},D5={},Gt=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 ee)))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}=E5[s.typeId],u=o[0];this.isValid=f=>gd(u,f),this.get=f=>a(u,f),this.set=(f,h)=>c(u,f,h),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,D5[s.typeId]),this._offsets=u0(o);break}this.data=o,this.type=s,this.stride=Br(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 nullable(){return M5(this.data)}get nullCount(){return l0(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${B[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}[Symbol.iterator](){return yu.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(pd(this,t,n,({data:r,_offsets:i},o,s)=>f0(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case B.Int:case B.Float:case B.Decimal:case B.Time:case B.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 H.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(H.isDictionary(this.type)){let t=new p0(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new p0(this)}unmemoize(){if(H.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}};T5=Symbol.toStringTag;Gt[T5]=(e=>{e.type=H.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(B).map(n=>B[n]).filter(n=>typeof n=="number"&&n!==B.NONE);for(let n of t){let r=Xe.getVisitFnByTypeId(n),i=Sn.getVisitFnByTypeId(n),o=Dc.getVisitFnByTypeId(n);E5[n]={get:r,set:i,indexOf:o},D5[n]=Object.create(e,{isValid:{value:mu(gd)},get:{value:mu(Xe.getVisitFnByTypeId(n))},set:{value:h0(Sn.getVisitFnByTypeId(n))},indexOf:{value:d0(Dc.getVisitFnByTypeId(n))}})}return"Vector"})(Gt.prototype);var p0=class e extends Gt{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 Gt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function N5(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
|
|
2
|
-
switch (x) {${n.map(r=>`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
${t}`),new Function("x",`${t}
|
|
7
|
-
return true;`)}function Lj(e){return typeof e!="bigint"?Oi(e):`${Oi(e)}n`}function I2(e,t){let n=Math.ceil(e)*t-1;return(n-n%64+64||64)/t}function O5(e,t=0){return e.length>=t?e.subarray(0,t):qh(new e.constructor(t),e,0)}var ki=class{constructor(t,n=0,r=1){this.length=Math.ceil(n/r),this.buffer=new t(this.length),this.stride=r,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,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?I2(r*1,this.BYTES_PER_ELEMENT):I2(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=I2(t*this.stride,this.BYTES_PER_ELEMENT);let n=O5(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=O5(this.buffer,t)}},us=class extends ki{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}},gu=class extends us{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,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()}},xu=class extends us{constructor(t){super(t.OffsetArrayType,1,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++&&r>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):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=Br(t),this._nulls=new gu,n&&n.length>0&&(this._isValid=N5(n))}toVector(){return new Gt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let h=this.children.map(d=>d.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:h,child:h[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};_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 Ge=class extends _e{constructor(t){super(t),this._values=new us(this.ArrayType,0,this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},mr=class extends _e{constructor(t){super(t),this._pendingLength=0,this._offsets=new xu(t.type)}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof yo?n[ni].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var Nc=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var Cr=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):le.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new dr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Nc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new Nc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new on).__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,le.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 se=class e{constructor(t=[],n,r,i=le.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=M2(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=m0(m0(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:m0(m0(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=M2(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};se.prototype.fields=null;se.prototype.metadata=null;se.prototype.dictionaries=null;var qt=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)}};qt.prototype.type=null;qt.prototype.name=null;qt.prototype.nullable=null;qt.prototype.metadata=null;function m0(e,t){return new Map([...e||new Map,...t||new Map])}function M2(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(H.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&&M2(o.children,t)}return t}var Bj=Mc,Cj=Or,fs=class{static decode(t){t=new Cj(_t(t));let n=Cr.getRootAsFooter(t),r=se.decode(n.schema(),new Map,n.version());return new A2(r,n)}static encode(t){let n=new Bj,r=se.encode(n,t.schema);Cr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())hs.encode(n,s);let i=n.endVector();Cr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())hs.encode(n,s);let o=n.endVector();return Cr.startFooter(n),Cr.addSchema(n,r),Cr.addVersion(n,le.V5),Cr.addRecordBatches(n,i),Cr.addDictionaries(n,o),Cr.finishFooterBuffer(n,Cr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=le.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 A2=class extends fs{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 hs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return hs.decode(n)}return null}},hs=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return Nc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=Ne(r),this.bodyLength=Ne(n)}};var ve=Object.freeze({done:!0,value:void 0}),xd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Oc=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())}},y0=class extends Oc{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return J(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(ve);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return _n.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return _n.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return J(this,void 0,void 0,function*(){return yield this.abort(t),ve})}return(t){return J(this,void 0,void 0,function*(){return yield this.close(),ve})}read(t){return J(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return J(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(ve)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var go=class extends y0{write(t){if((t=_t(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Uh(this.toUint8Array(!0)):this.toUint8Array(!1).then(Uh)}toUint8Array(t=!1){return t?Nr(this._values)[0]:J(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=Ii(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return Nr(s,a)[0]})}},xo=class{constructor(t){t&&(this.source=new T2(_n.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)}},ri=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof go?this.source=new ds(_n.fromAsyncIterable(t)):kg(t)?this.source=new ds(_n.fromNodeStream(t)):zh(t)?this.source=new ds(_n.fromDOMStream(t)):Bg(t)?this.source=new ds(_n.fromDOMStream(t.body)):Mi(t)?this.source=new ds(_n.fromIterable(t)):Dr(t)?this.source=new ds(_n.fromAsyncIterable(t)):Hr(t)&&(this.source=new ds(_n.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)}},T2=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)||ve)}return(t){return Object.create(this.source.return&&this.source.return(t)||ve)}},ds=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return J(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return J(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return J(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return J(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return J(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||ve;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return J(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||ve;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var bd=class extends xo{constructor(t,n){super(),this.position=0,this.buffer=_t(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}}},Ma=class extends ri{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=J(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return J(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 J(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 J(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 J(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 J(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return J(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return J(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var D2={};Tr(D2,{BaseInt64:()=>wd,Int128:()=>vd,Int64:()=>ps,Uint64:()=>Oe});function bu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var wu=8,E2=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],wd=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`${bu(this.buffer[1])} ${bu(this.buffer[0])}`}},Oe=class e extends wd{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=wu<r-o?wu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([E2[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)}},ps=class e extends wd{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=wu<i-s?wu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([E2[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 ps(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ps(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 Oe(new Uint32Array([this.buffer[3],0])),r=new Oe(new Uint32Array([this.buffer[2],0])),i=new Oe(new Uint32Array([this.buffer[1],0])),o=new Oe(new Uint32Array([this.buffer[0],0])),s=new Oe(new Uint32Array([t.buffer[3],0])),a=new Oe(new Uint32Array([t.buffer[2],0])),c=new Oe(new Uint32Array([t.buffer[1],0])),l=new Oe(new Uint32Array([t.buffer[0],0])),u=Oe.multiply(o,l);this.buffer[0]=u.low();let f=new Oe(new Uint32Array([u.high(),0]));return u=Oe.multiply(i,l),f.plus(u),u=Oe.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 Oe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Oe.multiply(r,l)).plus(Oe.multiply(i,c)).plus(Oe.multiply(o,a)),this.buffer[3]+=Oe.multiply(n,l).plus(Oe.multiply(r,c)).plus(Oe.multiply(i,a)).plus(Oe.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`${bu(this.buffer[3])} ${bu(this.buffer[2])} ${bu(this.buffer[1])} ${bu(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=wu<i-s?wu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([E2[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 _d=class extends mt{constructor(t,n,r,i,o=le.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 qt?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)})}visitLargeUtf8(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)})}visitLargeBinary(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<le.V5&&this.readNullBitmap(t,r),t.mode===xe.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)}},g0=class extends _d{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):Ec(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Ut(Uint8Array,Ut(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Ut(Uint8Array,Ut(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return H.isTimestamp(t)?Ut(Uint8Array,ps.convertArray(r[n])):(H.isInt(t)||H.isTime(t))&&t.bitWidth===64||H.isDuration(t)?Ut(Uint8Array,ps.convertArray(r[n])):H.isDate(t)&&t.unit===Ye.MILLISECOND?Ut(Uint8Array,ps.convertArray(r[n])):H.isDecimal(t)?Ut(Uint8Array,vd.convertArray(r[n])):H.isBinary(t)||H.isLargeBinary(t)||H.isFixedSizeBinary(t)?kj(r[n]):H.isBool(t)?Ec(r[n]):H.isUtf8(t)||H.isLargeUtf8(t)?Ki(r[n].join("")):Ut(Uint8Array,Ut(t.ArrayType,r[n].map(i=>+i)))}};function kj(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 vu=class extends mr{constructor(t){super(t),this._values=new ki(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,_t(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 _u=class extends mr{constructor(t){super(t),this._values=new ki(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,_t(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,BigInt(0));else{let c=a.length;i.set(a,o),r.set(s,BigInt(c)),o+=c}}};var x0=class extends _e{constructor(t){super(t),this._values=new gu}setValue(t,n){this._values.set(t,+n)}};var Lc=class extends Ge{};Lc.prototype._setValue=c2;var Sd=class extends Lc{};Sd.prototype._setValue=Vg;var Id=class extends Lc{};Id.prototype._setValue=Yg;var Md=class extends Ge{};Md.prototype._setValue=f2;var b0=class extends _e{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new pr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Bc({type:this.type.indices,nullValues:n}),this.dictionary=Bc({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 Ad=class extends Ge{};Ad.prototype._setValue=a2;var w0=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 ti(this.type.listSize,new qt(n,t.type,!0)),r}};var Cc=class extends Ge{setValue(t,n){this._values.set(t,n)}},v0=class extends Cc{setValue(t,n){super.setValue(t,dd(n))}},_0=class extends Cc{},S0=class extends Cc{};var kc=class extends Ge{};kc.prototype._setValue=h2;var Td=class extends kc{};Td.prototype._setValue=t0;var Ed=class extends kc{};Ed.prototype._setValue=e0;var ms=class extends Ge{};ms.prototype._setValue=d2;var Dd=class extends ms{};Dd.prototype._setValue=n0;var Nd=class extends ms{};Nd.prototype._setValue=r0;var Od=class extends ms{};Od.prototype._setValue=i0;var Ld=class extends ms{};Ld.prototype._setValue=o0;var ii=class extends Ge{setValue(t,n){this._values.set(t,n)}},I0=class extends ii{},M0=class extends ii{},A0=class extends ii{},T0=class extends ii{},E0=class extends ii{},D0=class extends ii{},N0=class extends ii{},O0=class extends ii{};var L0=class extends mr{constructor(t){super(t),this._offsets=new xu(t.type)}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 Qr(new qt(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 B0=class extends mr{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 ei(new qt(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 C0=class extends _e{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var k0=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 be([...this.type.children,new qt(n,t.type,!0)]),r}};var ys=class extends Ge{};ys.prototype._setValue=l2;var Bd=class extends ys{};Bd.prototype._setValue=Xg;var Cd=class extends ys{};Cd.prototype._setValue=Gg;var kd=class extends ys{};kd.prototype._setValue=Wg;var Rd=class extends ys{};Rd.prototype._setValue=Hg;var gs=class extends Ge{};gs.prototype._setValue=u2;var Fd=class extends gs{};Fd.prototype._setValue=Zg;var $d=class extends gs{};$d.prototype._setValue=Jg;var Pd=class extends gs{};Pd.prototype._setValue=Qg;var Ud=class extends gs{};Ud.prototype._setValue=Kg;var Su=class extends _e{constructor(t){super(t),this._typeIds=new us(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 qt(n,t.type)];return this.type=new Kr(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.")}},R0=class extends Su{},F0=class extends Su{constructor(t){super(t),this._offsets=new us(Int32Array)}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 zd=class extends mr{constructor(t){super(t),this._values=new ki(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Ki(n))}_flushPending(t,n){}};zd.prototype._flushPending=vu.prototype._flushPending;var qd=class extends mr{constructor(t){super(t),this._values=new ki(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Ki(n))}_flushPending(t,n){}};qd.prototype._flushPending=_u.prototype._flushPending;var N2=class extends mt{visitNull(){return C0}visitBool(){return x0}visitInt(){return ii}visitInt8(){return I0}visitInt16(){return M0}visitInt32(){return A0}visitInt64(){return T0}visitUint8(){return E0}visitUint16(){return D0}visitUint32(){return N0}visitUint64(){return O0}visitFloat(){return Cc}visitFloat16(){return v0}visitFloat32(){return _0}visitFloat64(){return S0}visitUtf8(){return zd}visitLargeUtf8(){return qd}visitBinary(){return vu}visitLargeBinary(){return _u}visitFixedSizeBinary(){return Ad}visitDate(){return Lc}visitDateDay(){return Sd}visitDateMillisecond(){return Id}visitTimestamp(){return ys}visitTimestampSecond(){return Bd}visitTimestampMillisecond(){return Cd}visitTimestampMicrosecond(){return kd}visitTimestampNanosecond(){return Rd}visitTime(){return gs}visitTimeSecond(){return Fd}visitTimeMillisecond(){return $d}visitTimeMicrosecond(){return Pd}visitTimeNanosecond(){return Ud}visitDecimal(){return Md}visitList(){return L0}visitStruct(){return k0}visitUnion(){return Su}visitDenseUnion(){return F0}visitSparseUnion(){return R0}visitDictionary(){return b0}visitInterval(){return kc}visitIntervalDayTime(){return Td}visitIntervalYearMonth(){return Ed}visitDuration(){return ms}visitDurationSecond(){return Dd}visitDurationMillisecond(){return Nd}visitDurationMicrosecond(){return Od}visitDurationNanosecond(){return Ld}visitFixedSizeList(){return w0}visitMap(){return B0}},L5=new N2;var bt=class extends mt{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 Hn(e,t){return t instanceof e.constructor}function Rc(e,t){return e===t||Hn(e,t)}function xs(e,t){return e===t||Hn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function $0(e,t){return e===t||Hn(e,t)&&e.precision===t.precision}function Rj(e,t){return e===t||Hn(e,t)&&e.byteWidth===t.byteWidth}function O2(e,t){return e===t||Hn(e,t)&&e.unit===t.unit}function jd(e,t){return e===t||Hn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Vd(e,t){return e===t||Hn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Fj(e,t){return e===t||Hn(e,t)&&e.children.length===t.children.length&&bo.compareManyFields(e.children,t.children)}function $j(e,t){return e===t||Hn(e,t)&&e.children.length===t.children.length&&bo.compareManyFields(e.children,t.children)}function L2(e,t){return e===t||Hn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&bo.compareManyFields(e.children,t.children)}function Pj(e,t){return e===t||Hn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&bo.visit(e.indices,t.indices)&&bo.visit(e.dictionary,t.dictionary)}function B2(e,t){return e===t||Hn(e,t)&&e.unit===t.unit}function Yd(e,t){return e===t||Hn(e,t)&&e.unit===t.unit}function Uj(e,t){return e===t||Hn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&bo.compareManyFields(e.children,t.children)}function zj(e,t){return e===t||Hn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&bo.compareManyFields(e.children,t.children)}bt.prototype.visitNull=Rc;bt.prototype.visitBool=Rc;bt.prototype.visitInt=xs;bt.prototype.visitInt8=xs;bt.prototype.visitInt16=xs;bt.prototype.visitInt32=xs;bt.prototype.visitInt64=xs;bt.prototype.visitUint8=xs;bt.prototype.visitUint16=xs;bt.prototype.visitUint32=xs;bt.prototype.visitUint64=xs;bt.prototype.visitFloat=$0;bt.prototype.visitFloat16=$0;bt.prototype.visitFloat32=$0;bt.prototype.visitFloat64=$0;bt.prototype.visitUtf8=Rc;bt.prototype.visitLargeUtf8=Rc;bt.prototype.visitBinary=Rc;bt.prototype.visitLargeBinary=Rc;bt.prototype.visitFixedSizeBinary=Rj;bt.prototype.visitDate=O2;bt.prototype.visitDateDay=O2;bt.prototype.visitDateMillisecond=O2;bt.prototype.visitTimestamp=jd;bt.prototype.visitTimestampSecond=jd;bt.prototype.visitTimestampMillisecond=jd;bt.prototype.visitTimestampMicrosecond=jd;bt.prototype.visitTimestampNanosecond=jd;bt.prototype.visitTime=Vd;bt.prototype.visitTimeSecond=Vd;bt.prototype.visitTimeMillisecond=Vd;bt.prototype.visitTimeMicrosecond=Vd;bt.prototype.visitTimeNanosecond=Vd;bt.prototype.visitDecimal=Rc;bt.prototype.visitList=Fj;bt.prototype.visitStruct=$j;bt.prototype.visitUnion=L2;bt.prototype.visitDenseUnion=L2;bt.prototype.visitSparseUnion=L2;bt.prototype.visitDictionary=Pj;bt.prototype.visitInterval=B2;bt.prototype.visitIntervalDayTime=B2;bt.prototype.visitIntervalYearMonth=B2;bt.prototype.visitDuration=Yd;bt.prototype.visitDurationSecond=Yd;bt.prototype.visitDurationMillisecond=Yd;bt.prototype.visitDurationMicrosecond=Yd;bt.prototype.visitDurationNanosecond=Yd;bt.prototype.visitFixedSizeList=Uj;bt.prototype.visitMap=zj;var bo=new bt;function Fc(e,t){return bo.compareSchemas(e,t)}function B5(e,t){return bo.compareFields(e,t)}function C5(e,t){return bo.visit(e,t)}function Bc(e){let t=e.type,n=new(L5.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(Bc(Object.assign(Object.assign({},l),{type:c})))}}return n}function P0(e,t){return qj(e,t.map(n=>n.data.concat()))}function qj(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=jj(n,s,u,t,i),s>0&&(r[o++]=Dt({type:new be(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Re(e,f))]}function jj(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 k5,yr=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new se([]),this._offsets=[0],this;let i,o;t[0]instanceof se&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Re)return[c];if(c instanceof e)return c.batches;if(c instanceof ee){if(c.type instanceof be)return[new Re(new se(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(d=>new Gt([c[d]])),f=i??new se(l.map((d,p)=>new qt(String(d),u[p].type,u[p].nullable))),[,h]=P0(f,u);return h.length===0?[new Re(c)]:h}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new se([]),!(i instanceof se))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Fc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??u0(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=l0(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?yu.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
8
|
-
${this.toArray().join(`,
|
|
9
|
-
`)}
|
|
10
|
-
]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new Re(n,i)))}slice(t,n){let r=this.schema;[t,n]=pd({length:this.numRows},t,n);let i=f0(this.data,this._offsets,t,n);return new e(r,i.map(o=>new Re(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 Gt(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 Gt([Dt({type:new Rn,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]=P0(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,h=n.findIndex(d=>d.name===c.name);return~h?f[h]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...P0(o,s))}};k5=Symbol.toStringTag;yr[k5]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=mu(gd),e.get=mu(Xe.getVisitFn(B.Struct)),e.set=h0(Sn.getVisitFn(B.Struct)),e.indexOf=d0(Dc.getVisitFn(B.Struct)),"Table"))(yr.prototype);var F5,Re=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new be(this.schema.fields),children:this.schema.fields.map(n=>Dt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof ee))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=R5(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]=qt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new se(r),a=Dt({type:new be(r),length:o,children:i,nullCount:0});[this.schema,this.data]=R5(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=$5(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 Xe.visit(this.data,t)}set(t,n){return Sn.visit(this.data,t,n)}indexOf(t,n){return Dc.visit(this.data,t,n)}[Symbol.iterator](){return yu.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new yr(this.schema,[this,...t])}slice(t,n){let[r]=new Gt([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 Gt([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 Gt([Dt({type:new Rn,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 se(o,new Map(this.schema.metadata)),i=Dt({type:new be(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new be(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 be(n.fields),length:this.numRows,children:r});return new e(n,i)}};F5=Symbol.toStringTag;Re[F5]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Re.prototype);function R5(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 be(i),length:n,children:o})]}function $5(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)||[]])$5(a.children,l?.children,n);if(H.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 $c=class extends Re{constructor(t){let n=t.fields.map(i=>Dt({type:i.type})),r=Dt({type:new be(t.fields),nullCount:0,children:n});super(t,r)}};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 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):le.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):jt.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 on).__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,le.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,jt.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 C2=class extends mt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Qh.startNull(n),Qh.endNull(n)}visitInt(t,n){return Ei.startInt(n),Ei.addBitWidth(n,t.bitWidth),Ei.addIsSigned(n,t.isSigned),Ei.endInt(n)}visitFloat(t,n){return ba.startFloatingPoint(n),ba.addPrecision(n,t.precision),ba.endFloatingPoint(n)}visitBinary(t,n){return Gh.startBinary(n),Gh.endBinary(n)}visitLargeBinary(t,n){return Hh.startLargeBinary(n),Hh.endLargeBinary(n)}visitBool(t,n){return Wh.startBool(n),Wh.endBool(n)}visitUtf8(t,n){return td.startUtf8(n),td.endUtf8(n)}visitLargeUtf8(t,n){return Zh.startLargeUtf8(n),Zh.endLargeUtf8(n)}visitDecimal(t,n){return ro.startDecimal(n),ro.addScale(n,t.scale),ro.addPrecision(n,t.precision),ro.addBitWidth(n,t.bitWidth),ro.endDecimal(n)}visitDate(t,n){return ma.startDate(n),ma.addUnit(n,t.unit),ma.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 wa.startInterval(n),wa.addUnit(n,t.unit),wa.endInterval(n)}visitDuration(t,n){return ya.startDuration(n),ya.addUnit(n,t.unit),ya.endDuration(n)}visitList(t,n){return Jh.startList(n),Jh.endList(n)}visitStruct(t,n){return Kh.startStruct_(n),Kh.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 no.startDictionaryEncoding(n),no.addId(n,BigInt(t.id)),no.addIsOrdered(n,t.isOrdered),r!==void 0&&no.addIndexType(n,r),no.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ga.startFixedSizeBinary(n),ga.addByteWidth(n,t.byteWidth),ga.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return xa.startFixedSizeList(n),xa.addListSize(n,t.listSize),xa.endFixedSizeList(n)}visitMap(t,n){return va.startMap(n),va.addKeysSorted(n,t.keysSorted),va.endMap(n)}},U0=new C2;function q5(e,t=new Map){return new se(Yj(e,t),z0(e.metadata),t)}function k2(e){return new In(e.count,V5(e.columns),Y5(e.columns))}function j5(e){return new xr(k2(e.data),e.id,e.isDelta)}function Yj(e,t){return(e.fields||[]).filter(Boolean).map(n=>qt.fromJSON(n,t))}function P5(e,t){return(e.children||[]).filter(Boolean).map(n=>qt.fromJSON(n,t))}function V5(e){return(e||[]).reduce((t,n)=>[...t,new oi(n.count,Xj(n.VALIDITY)),...V5(n.children)],[])}function Y5(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new gr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new gr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new gr(t.length,i.OFFSET.length)),i.DATA&&t.push(new gr(t.length,i.DATA.length)),t=Y5(i.children,t)}return t}function Xj(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function X5(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=z5(e,P5(e,t)),i=new qt(e.name,s,e.nullable,z0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?U5(r):new Bi,a=new pr(t.get(n),r,n,o.isOrdered),i=new qt(e.name,a,e.nullable,z0(e.metadata))):(r=(r=o.indexType)?U5(r):new Bi,t.set(n,s=z5(e,P5(e,t))),a=new pr(s,r,n,o.isOrdered),i=new qt(e.name,a,e.nullable,z0(e.metadata))),i||null}function z0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function U5(e){return new ke(e.isSigned,e.bitWidth)}function z5(e,t){let n=e.type.name;switch(n){case"NONE":return new Rn;case"null":return new Rn;case"binary":return new io;case"largebinary":return new oo;case"utf8":return new so;case"largeutf8":return new ao;case"bool":return new co;case"list":return new Qr((t||[])[0]);case"struct":return new be(t||[]);case"struct_":return new be(t||[])}switch(n){case"int":{let r=e.type;return new ke(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new Wn(pe[r.precision])}case"decimal":{let r=e.type;return new lo(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new uo(Ye[r.unit])}case"time":{let r=e.type;return new Jr(ct[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new fo(ct[r.unit],r.timezone)}case"interval":{let r=e.type;return new ho(un[r.unit])}case"duration":{let r=e.type;return new po(ct[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Kr(xe[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new mo(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new ti(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new ei((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Gj=Mc,Wj=Or,br=class e{static fromJSON(t,n){let r=new e(0,le.V5,n);return r._createHeader=Hj(t,n),r}static decode(t){t=new Wj(_t(t));let n=Ri.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=Zj(n,o),s}static encode(t){let n=new Gj,r=-1;return t.isSchema()?r=se.encode(n,t.header()):t.isRecordBatch()?r=In.encode(n,t.header()):t.isDictionaryBatch()&&(r=xr.encode(n,t.header())),Ri.startMessage(n),Ri.addVersion(n,le.V5),Ri.addHeader(n,r),Ri.addHeaderType(n,t.headerType),Ri.addBodyLength(n,BigInt(t.bodyLength)),Ri.finishMessageBuffer(n,Ri.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof se)return new e(0,le.V5,jt.Schema,t);if(t instanceof In)return new e(n,le.V5,jt.RecordBatch,t);if(t instanceof xr)return new e(n,le.V5,jt.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===jt.Schema}isRecordBatch(){return this.headerType===jt.RecordBatch}isDictionaryBatch(){return this.headerType===jt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Ne(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=Ne(t)}},xr=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=Ne(n)}},gr=class{constructor(t,n){this.offset=Ne(t),this.length=Ne(n)}},oi=class{constructor(t,n){this.length=Ne(t),this.nullCount=Ne(n)}};function Hj(e,t){return()=>{switch(t){case jt.Schema:return se.fromJSON(e);case jt.RecordBatch:return In.fromJSON(e);case jt.DictionaryBatch:return xr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${jt[t]}, type: ${t} }`)}}function Zj(e,t){return()=>{switch(t){case jt.Schema:return se.decode(e.header(new dr),new Map,e.version());case jt.RecordBatch:return In.decode(e.header(new Lr),e.version());case jt.DictionaryBatch:return xr.decode(e.header(new ss),e.version())}throw new Error(`Unrecognized Message type: { name: ${jt[t]}, type: ${t} }`)}}qt.encode=aV;qt.decode=oV;qt.fromJSON=X5;se.encode=sV;se.decode=Jj;se.fromJSON=q5;In.encode=cV;In.decode=Qj;In.fromJSON=k2;xr.encode=lV;xr.decode=Kj;xr.fromJSON=j5;oi.encode=uV;oi.decode=eV;gr.encode=fV;gr.decode=tV;function Jj(e,t=new Map,n=le.V5){let r=iV(e,t);return new se(r,q0(e),t,n)}function Qj(e,t=le.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new In(e.length(),nV(e),rV(e,t))}function Kj(e,t=le.V5){return new xr(In.decode(e.data(),t),e.id(),e.isDelta())}function tV(e){return new gr(e.offset(),e.length())}function eV(e){return new oi(e.length(),e.nullCount())}function nV(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=oi.decode(n));return t}function rV(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<le.V4&&(r.bb_pos+=8*(i+1)),n[++o]=gr.decode(r));return n}function iV(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=qt.decode(r,t));return n}function G5(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=qt.decode(r,t));return n}function oV(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=H5(e,G5(e,t)),r=new qt(e.name(),i,e.nullable(),q0(e))):t.has(n=Ne(a.id()))?(o=(o=a.indexType())?W5(o):new Bi,s=new pr(t.get(n),o,n,a.isOrdered()),r=new qt(e.name(),s,e.nullable(),q0(e))):(o=(o=a.indexType())?W5(o):new Bi,t.set(n,i=H5(e,G5(e,t))),s=new pr(i,o,n,a.isOrdered()),r=new qt(e.name(),s,e.nullable(),q0(e))),r||null}function q0(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 W5(e){return new ke(e.isSigned(),e.bitWidth())}function H5(e,t){let n=e.typeType();switch(n){case me.NONE:return new Rn;case me.Null:return new Rn;case me.Binary:return new io;case me.LargeBinary:return new oo;case me.Utf8:return new so;case me.LargeUtf8:return new ao;case me.Bool:return new co;case me.List:return new Qr((t||[])[0]);case me.Struct_:return new be(t||[])}switch(n){case me.Int:{let r=e.type(new Ei);return new ke(r.isSigned(),r.bitWidth())}case me.FloatingPoint:{let r=e.type(new ba);return new Wn(r.precision())}case me.Decimal:{let r=e.type(new ro);return new lo(r.scale(),r.precision(),r.bitWidth())}case me.Date:{let r=e.type(new ma);return new uo(r.unit())}case me.Time:{let r=e.type(new as);return new Jr(r.unit(),r.bitWidth())}case me.Timestamp:{let r=e.type(new cs);return new fo(r.unit(),r.timezone())}case me.Interval:{let r=e.type(new wa);return new ho(r.unit())}case me.Duration:{let r=e.type(new ya);return new po(r.unit())}case me.Union:{let r=e.type(new Di);return new Kr(r.mode(),r.typeIdsArray()||[],t||[])}case me.FixedSizeBinary:{let r=e.type(new ga);return new mo(r.byteWidth())}case me.FixedSizeList:{let r=e.type(new xa);return new ti(r.listSize(),(t||[])[0])}case me.Map:{let r=e.type(new va);return new ei((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${me[n]}" (${n})`)}function sV(e,t){let n=t.fields.map(o=>qt.encode(e,o));dr.startFieldsVector(e,n.length);let r=dr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?dr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return on.startKeyValue(e),on.addKey(e,a),on.addValue(e,c),on.endKeyValue(e)})):-1;return dr.startSchema(e),dr.addFields(e,r),dr.addEndianness(e,hV?pa.Little:pa.Big),i!==-1&&dr.addCustomMetadata(e,i),dr.endSchema(e)}function aV(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;H.isDictionary(o)?(s=o.dictionary.typeId,i=U0.visit(o,e),r=U0.visit(o.dictionary,e)):r=U0.visit(o,e);let a=(o.children||[]).map(u=>qt.encode(e,u)),c=kn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?kn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let h=e.createString(`${u}`),d=e.createString(`${f}`);return on.startKeyValue(e),on.addKey(e,h),on.addValue(e,d),on.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),kn.startField(e),kn.addType(e,r),kn.addTypeType(e,s),kn.addChildren(e,c),kn.addNullable(e,!!t.nullable),n!==-1&&kn.addName(e,n),i!==-1&&kn.addDictionary(e,i),l!==-1&&kn.addCustomMetadata(e,l),kn.endField(e)}function cV(e,t){let n=t.nodes||[],r=t.buffers||[];Lr.startNodesVector(e,n.length);for(let s of n.slice().reverse())oi.encode(e,s);let i=e.endVector();Lr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())gr.encode(e,s);let o=e.endVector();return Lr.startRecordBatch(e),Lr.addLength(e,BigInt(t.length)),Lr.addNodes(e,i),Lr.addBuffers(e,o),Lr.endRecordBatch(e)}function lV(e,t){let n=In.encode(e,t.data);return ss.startDictionaryBatch(e),ss.addId(e,BigInt(t.id)),ss.addIsDelta(e,t.isDelta),ss.addData(e,n),ss.endDictionaryBatch(e)}function uV(e,t){return au.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function fV(e,t){return su.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var hV=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var F2=e=>`Expected ${jt[e]} Message in stream, but was null or length 0.`,$2=e=>`Header pointer of flatbuffer-encoded ${jt[e]} Message is null or length 0.`,Z5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,J5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Iu=class{constructor(t){this.source=t instanceof xo?t:new xo(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ve:t.value===-1&&(t=this.readMetadataLength()).done?ve:(t=this.readMetadata(t.value)).done?ve: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(F2(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=_t(this.source.read(t));if(n.byteLength<t)throw new Error(J5(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=jt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error($2(n));return i}readMetadataLength(){let t=this.source.read(j0),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 ve;if(n.byteLength<t)throw new Error(Z5(t,n.byteLength));return{done:!1,value:br.decode(n)}}},Xd=class{constructor(t,n){this.source=t instanceof ri?t:Lg(t)?new Ma(t,n):new ri(t)}[Symbol.asyncIterator](){return this}next(){return J(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ve:t.value===-1&&(t=yield this.readMetadataLength()).done?ve:(t=yield this.readMetadata(t.value)).done?ve:t})}throw(t){return J(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return J(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return J(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(F2(t));return n.value})}readMessageBody(t){return J(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=_t(yield this.source.read(t));if(n.byteLength<t)throw new Error(J5(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return J(this,void 0,void 0,function*(){let n=jt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error($2(n));return i})}readMetadataLength(){return J(this,void 0,void 0,function*(){let t=yield this.source.read(j0),n=t&&new Or(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return J(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return ve;if(n.byteLength<t)throw new Error(Z5(t,n.byteLength));return{done:!1,value:br.decode(n)}})}},Gd=class extends Iu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof xd?t:new xd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:br.fromJSON(t.schema,jt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:br.fromJSON(n,jt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:br.fromJSON(n,jt.RecordBatch)}}return this._body=[],ve}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(F2(t));return n.value}readSchema(){let t=jt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error($2(t));return r}},j0=4,R2="ARROW1",Mu=new Uint8Array(R2.length);for(let e=0;e<R2.length;e+=1)Mu[e]=R2.codePointAt(e);function V0(e,t=0){for(let n=-1,r=Mu.length;++n<r;)if(Mu[n]!==e[t+n])return!1;return!0}var Au=Mu.length,P2=Au+j0,Q5=Au*2+j0;var kr=class e extends Oc{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 Dr(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 _n.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return _n.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:Ng(t)?pV(t):Lg(t)?gV(t):Dr(t)?J(this,void 0,void 0,function*(){return yield e.from(yield t)}):Bg(t)||zh(t)||kg(t)||Hr(t)?yV(new ri(t)):mV(new xo(t))}static readAll(t){return t instanceof e?t.isSync()?K5(t):tL(t):Ng(t)||ArrayBuffer.isView(t)||Mi(t)||Og(t)?K5(t):tL(t)}},bs=class extends kr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Er(this,arguments,function*(){yield Ft(yield*iu(Ii(this[Symbol.iterator]())))})}},Pc=class extends kr{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return J(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=Ii(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Uc=class extends bs{constructor(t){super(t),this._impl=t}},Y0=class extends Pc{constructor(t){super(t),this._impl=t}},X0=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 be(this.schema.fields),length:t.length,children:r});return new Re(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 Gt(l)):new Gt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new _d(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},Tu=class extends X0{constructor(t,n){super(n),this._reader=Ng(t)?new Gd(this._handle=t):new Iu(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=eL(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):ve}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ve}next(){if(this.closed)return ve;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 $c(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Eu=class extends X0{constructor(t,n){super(n),this._reader=new Xd(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return J(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 J(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=eL(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return J(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ve})}return(t){return J(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ve})}next(){return J(this,void 0,void 0,function*(){if(this.closed)return ve;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 $c(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return J(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},G0=class extends Tu{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 bd?t:new bd(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(jt.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(jt.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-P2,r=t.readInt32(n),i=t.readAt(n-r,r);return fs.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}},U2=class extends Eu{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 Ma?t:new Ma(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return J(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 J(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(jt.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 J(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(jt.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 J(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-P2,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return fs.decode(i)})}_readNextMessageAndValidate(t){return J(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})}},z2=class extends Tu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new g0(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function eL(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*K5(e){let t=kr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function tL(e){return Er(this,arguments,function*(){let n=yield Ft(kr.from(e));try{if(!(yield Ft(n.open({autoDestroy:!1}))).closed)do yield yield Ft(n);while(!(yield Ft(n.reset().open())).closed)}finally{yield Ft(n.cancel())}})}function pV(e){return new bs(new z2(e))}function mV(e){let t=e.peek(Au+7&-8);return t&&t.byteLength>=4?V0(t)?new Uc(new G0(e.read())):new bs(new Tu(e)):new bs(new Tu(function*(){}()))}function yV(e){return J(this,void 0,void 0,function*(){let t=yield e.peek(Au+7&-8);return t&&t.byteLength>=4?V0(t)?new Uc(new G0(yield e.read())):new Pc(new Eu(e)):new Pc(new Eu(function(){return Er(this,arguments,function*(){})}()))})}function gV(e){return J(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Ma(e,t);return t>=Q5&&V0(yield n.readAt(0,Au+7&-8))?new Y0(new U2(n)):new Pc(new Eu(n))})}var Ae=class e extends mt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Re?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 Gt)return this.visitMany(t.data),this;let{type:n}=t;if(!H.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(H.isUnion(n))this.nodes.push(new oi(r,0));else{let{nullCount:i}=t;H.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):Tc(t.offset,r,t.nullBitmap)),this.nodes.push(new oi(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 gr(this._byteLength,t)),this._byteLength+=t,this}function xV(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===xe.Sparse)return q2.call(this,e);if(n.mode===xe.Dense){if(e.offset<=0)return Fi.call(this,o),q2.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],h=a[f],d=c[f];return l.slice(h,Math.min(r,d))}))}}return this}function bV(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,Tc(e.offset,e.length,t)):Fi.call(this,Ec(e.values))}function ws(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function W0(e){let{length:t,values:n,valueOffsets:r}=e,i=Ne(r[0]),o=Ne(r[t]),s=Math.min(o-i,n.byteLength-i);return Fi.call(this,Fg(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function j2(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,Fg(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function q2(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Ae.prototype.visitBool=bV;Ae.prototype.visitInt=ws;Ae.prototype.visitFloat=ws;Ae.prototype.visitUtf8=W0;Ae.prototype.visitLargeUtf8=W0;Ae.prototype.visitBinary=W0;Ae.prototype.visitLargeBinary=W0;Ae.prototype.visitFixedSizeBinary=ws;Ae.prototype.visitDate=ws;Ae.prototype.visitTimestamp=ws;Ae.prototype.visitTime=ws;Ae.prototype.visitDecimal=ws;Ae.prototype.visitList=j2;Ae.prototype.visitStruct=q2;Ae.prototype.visitUnion=xV;Ae.prototype.visitInterval=ws;Ae.prototype.visitDuration=ws;Ae.prototype.visitFixedSizeList=j2;Ae.prototype.visitMap=j2;var zc=class extends Oc{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 go,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Gn(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 Dr(t)?t.then(n=>this.writeAll(n)):Hr(t)?Y2(this,t):V2(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 go?this._sink=t:(this._sink=new go,t&&mO(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&yO(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||!Fc(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 yr&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Re&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Fc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Re?t instanceof $c||this._writeRecordBatch(t):t instanceof yr?this.writeAll(t.batches):Mi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=br.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===jt.RecordBatch?this._recordBatchBlocks.push(new hs(a,t.bodyLength,this._position)):t.headerType===jt.DictionaryBatch&&this._dictionaryBlocks.push(new hs(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=_t(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(br.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Mu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Ae.assemble(t),s=new In(t.numRows,r,i),a=br.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}=Ae.assemble(new Gt([t])),c=new In(t.length,o,s),l=new xr(c,n,r),u=br.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}},Wd=class e extends zc{static writeAll(t,n){let r=new e(n);return Dr(t)?t.then(i=>r.writeAll(i)):Hr(t)?Y2(r,t):V2(r,t)}},Hd=class e extends zc{static writeAll(t){let n=new e;return Dr(t)?t.then(r=>n.writeAll(r)):Hr(t)?Y2(n,t):V2(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=fs.encode(new fs(t,le.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function V2(e,t){let n=t;t instanceof yr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function Y2(e,t){var n,r,i,o,s,a,c;return J(this,void 0,void 0,function*(){try{for(n=!0,r=Ii(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function nL(e,t){if(Hr(e))return vV(e,t);if(Mi(e))return wV(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function wV(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=_t(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 vV(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 J(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return J(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return J(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 J(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=_t(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 oL(e){return new X2(e)}var X2=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=dO(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Bc(o),this._getSize=i!=="bytes"?rL:iL;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"?rL:iL}),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)}},rL=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},iL=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function H0(e,t){let n=new go,r=null,i=new ReadableStream({cancel(){return J(this,void 0,void 0,function*(){yield n.close()})},start(a){return J(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return J(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 J(this,void 0,void 0,function*(){return yield(yield kr.from(n)).open(t)})}function s(a,c){return J(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 Z0(e,t){let n=new this(e),r=new ri(n),i=new ReadableStream({cancel(){return J(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return J(this,void 0,void 0,function*(){yield o(s)})},start(s){return J(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 J(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 Zd(e){let t=kr.from(e);return Dr(t)?t.then(n=>Zd(n)):t.isAsync()?t.readAll().then(n=>new yr(n)):new yr(t.readAll())}var zV=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r2),D2),w2),i2),Q_),b2),e2),{compareSchemas:Fc,compareFields:B5,compareTypes:C5});_n.toDOMStream=nL;_e.throughDOM=oL;kr.throughDOM=H0;Uc.throughDOM=H0;bs.throughDOM=H0;zc.throughDOM=Z0;Hd.throughDOM=Z0;Wd.throughDOM=Z0;function J0(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:h}=r;if(r=null,c(),typeof l=="string"){let d=JSON.parse(l);d.error?h(d.error):f(d)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Zd(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 wr=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?`${sL(t)}.`:""}${r}`}else return t?sL(t):"NULL"}};function sL(e){return e.split(".").map(n=>`"${n}"`).join(".")}function aL(e,t){return e instanceof wr&&e.column===t}function zt(e){return typeof e=="string"?Aa(e):e}function qc(e){return typeof e=="string"?cL(e):e}function cL(e){return new wr(e)}function Aa(e,t=null){return arguments.length===1&&(t=e,e=null),new wr(e,t)}function wo(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e.replace("'","''")}'`;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 vs=e=>typeof e?.addEventListener=="function";function Q0(e){return e instanceof _s}var _s=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>vs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>qV(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=>vs(t)&&!Q0(t)?wo(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 qV(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function G2(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];vs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:wo(a));let c=e[++o];vs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function j(e,...t){let{spans:n,cols:r}=G2(e,t);return new _s(n,r)}function W2(e){let t=zt(e);return j`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var jc=e=>({value:e,toString:()=>wo(e)});function Jd(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function lL(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:Jd})}var vr=(...e)=>lL("AND",e.flat()),Vc=(...e)=>lL("OR",e.flat()),jV=e=>t=>j`(${e} ${zt(t)})`.annotate({op:e,a:t,visit:Jd}),H2=jV("NOT"),uL=e=>t=>j`(${zt(t)} ${e})`.annotate({op:e,a:t,visit:Jd}),Yc=uL("IS NULL"),Ss=uL("IS NOT NULL"),Ta=e=>(t,n)=>j`(${zt(t)} ${e} ${zt(n)})`.annotate({op:e,a:t,b:n,visit:Jd}),Z2=Ta("="),Xc=Ta("<>"),Is=Ta("<"),Qd=Ta(">"),Ms=Ta("<="),J2=Ta(">="),Q2=Ta("IS DISTINCT FROM"),Du=Ta("IS NOT DISTINCT FROM");function fL(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:Jd,field:t,range:n})}var We=(e,t,n)=>fL("BETWEEN",e,t,n),K2=(e,t,n)=>fL("NOT BETWEEN",e,t,n);function Gc(e,t){return Array.from({length:e},()=>t)}function Mn(e,t){return(...n)=>{let r=n.map(zt),i=t?`::${t}`:"";return(r.length?j([`${e}(`,...Gc(r.length-1,", "),`)${i}`],...r):j`${e}()${i}`).annotate({func:e,args:r})}}var tS=Mn("REGEXP_MATCHES"),eS=Mn("CONTAINS"),nS=Mn("PREFIX"),rS=Mn("SUFFIX"),VV=Mn("LOWER"),YV=Mn("UPPER"),XV=Mn("LENGTH"),GV=Mn("ISNAN"),WV=Mn("ISFINITE"),HV=Mn("ISINF");var Kd=class e extends _s{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 h=o&&s?" ":"",d=(o||s)&&a?" ":"";c=j`${n} OVER (${i?`"${i}" `:""}${o}${h}${s}${d}${a})`}r&&(c=j`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f),this.window=t,this.func=n,this.type=r,this.name=i,this.group=o,this.order=s,this.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 ",Gc(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 ",Gc(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=hL("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=hL("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 hL(e,t){if(vs(t)){let n=j`${t}`;return n.toString=()=>`${e} ${dL(t.value)}`,n}return`${e} ${dL(t)}`}function dL(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 $i(e,t){return(...n)=>{let r=Mn(e)(...n);return new Kd(e,r,t)}}var iS=$i("ROW_NUMBER","INTEGER"),oS=$i("RANK","INTEGER"),sS=$i("DENSE_RANK","INTEGER"),aS=$i("PERCENT_RANK"),cS=$i("CUME_DIST"),lS=$i("NTILE"),uS=$i("LAG"),fS=$i("LEAD"),hS=$i("FIRST_VALUE"),dS=$i("LAST_VALUE"),pS=$i("NTH_VALUE");function Vt(e,...t){return j(e,...t).annotate({aggregate:!0})}var mS=class e extends _s{constructor(t,n,r,i,o){n=(n||[]).map(zt);let{strings:s,exprs:a}=ZV(t,n,r,i,o),{spans:c,cols:l}=G2(s,a);super(c,l),this.aggregate=t,this.args=n,this.type=r,this.isDistinct=i,this.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(JV).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 Kd(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t){return this.window().rows(t)}range(t){return this.window().range(t)}};function ZV(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...Gc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function JV(e){let t=wo(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Zt(e,t){return(...n)=>new mS(e,n,t)}var Zn=Zt("COUNT","INTEGER"),tp=Zt("AVG"),QV=Zt("AVG"),yS=Zt("MAD"),si=Zt("MAX"),ai=Zt("MIN"),Rr=Zt("SUM","DOUBLE"),gS=Zt("PRODUCT"),xS=Zt("MEDIAN"),bS=Zt("QUANTILE"),wS=Zt("MODE"),vS=Zt("VARIANCE"),ep=Zt("STDDEV"),_S=Zt("SKEWNESS"),SS=Zt("KURTOSIS"),IS=Zt("ENTROPY"),MS=Zt("VAR_POP"),AS=Zt("STDDEV_POP"),TS=Zt("CORR"),ES=Zt("COVAR_SAMP"),DS=Zt("COVAR_POP"),NS=Zt("REGR_INTERCEPT"),OS=Zt("REGR_SLOPE"),LS=Zt("REGR_COUNT"),KV=Zt("REGR_R2"),BS=Zt("REGR_SYY"),CS=Zt("REGR_SXX"),tY=Zt("REGR_SXY"),kS=Zt("REGR_AVGX"),eY=Zt("REGR_AVGY"),RS=Zt("FIRST"),FS=Zt("LAST"),Nu=Zt("ARG_MIN"),Ou=Zt("ARG_MAX"),$S=Zt("STRING_AGG"),PS=Zt("ARRAY_AGG");function np(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 Lu=e=>np(e,"DOUBLE"),US=e=>np(e,"INTEGER");var zS=e=>j`epoch_ms(${zt(e)})`,qS=e=>{let t=zt(e);return j`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},jS=e=>{let t=zt(e);return j`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},VS=e=>{let t=zt(e);return j`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var rp=Mn("ST_AsGeoJSON"),pL=Mn("ST_X"),mL=Mn("ST_Y"),ip=Mn("ST_CENTROID"),YS=e=>pL(ip(e)),XS=e=>mL(ip(e));var dt=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 Wc("UNION",t.flat())}static unionAll(...t){return new Wc("UNION ALL",t.flat())}static intersect(...t){return new Wc("INTERSECT",t.flat())}static except(...t){return new Wc("EXCEPT",t.flat())}static describe(t){let n=t.clone(),{clone:r,toString:i}=n;return Object.assign(n,{describe:!0,clone:()=>e.describe(r.call(n)),toString:()=>`DESCRIBE ${i.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}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 o of t.flat())if(o!=null)if(typeof o=="string")r.push({as:o,expr:zt(o)});else if(o instanceof wr)r.push({as:o.column,expr:o});else if(Array.isArray(o))r.push({as:o[0],expr:o[1]});else for(let s in o)r.push({as:K0(s),expr:zt(o[s])});let i=new Set(r.map(o=>o.as));return n.select=n.select.filter(o=>!i.has(o.as)).concat(r.filter(o=>o.expr)),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:qc(i)});else if(i instanceof wr)r.push({as:i.table,from:i});else if(op(i)||Q0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:K0(i[0]),from:qc(i[1])});else for(let o in i)r.push({as:K0(o),from:qc(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:K0(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(op(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{with:t,select:n,distinct:r,from:i,sample:o,where:s,groupby:a,having:c,window:l,qualify:u,orderby:f,limit:h,offset:d}=this.query,p=[];if(t.length){let y=t.map(({as:g,query:x})=>`"${g}" AS (${x})`);p.push(`WITH ${y.join(", ")}`)}let m=n.map(({as:y,expr:g})=>aL(g,y)&&!g.table?`${g}`:`${g} AS "${y}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),i.length){let y=i.map(({as:g,from:x})=>{let b=op(x)?`(${x})`:`${x}`;return!g||g===x.table?b:`${b} AS "${g}"`});p.push(`FROM ${y.join(", ")}`)}if(s.length){let y=s.map(String).filter(g=>g).join(" AND ");y&&p.push(`WHERE ${y}`)}if(o){let{rows:y,perc:g,method:x,seed:b}=o,w=y?`${y} ROWS`:`${g} PERCENT`,_=x?` (${x}${b!=null?`, ${b}`:""})`:"";p.push(`USING SAMPLE ${w}${_}`)}if(a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let y=c.map(String).filter(g=>g).join(" AND ");y&&p.push(`HAVING ${y}`)}if(l.length){let y=l.map(({as:g,expr:x})=>`"${g}" AS (${x})`);p.push(`WINDOW ${y.join(", ")}`)}if(u.length){let y=u.map(String).filter(g=>g).join(" AND ");y&&p.push(`QUALIFY ${y}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(h)&&p.push(`LIMIT ${h}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},Wc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}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 op(e){return e instanceof dt||e instanceof Wc}function GS(e){return op(e)&&e.describe}function K0(e){return nY(e)?e.slice(1,-1):e}function nY(e){return e[0]==='"'&&e[e.length-1]==='"'}var tx=e=>e;function yL(){return{apply:tx,invert:tx,sqlApply:zt,sqlInvert:tx}}function rY({base:e=null}={}){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 iY({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 oY(){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 sY({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 gL(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:zS(zt(e)),sqlInvert:tx}}var aY={identity:yL,linear:yL,log:rY,symlog:iY,sqrt:oY,pow:sY,time:gL,utc:gL};function sp(e){let t=aY[e.type];return t?{...e,...t(e)}:null}function vo(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 ap(e){return`INSTALL ${e}; LOAD ${e}`}function xL(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=>`${wo(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function ex(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=cY({...i,...u}),h=`${e}('${n}'${f?", "+f:""})`,d=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${h}${d}`;return vo(t,p,{view:a,temp:c,replace:l})}function HS(e,t,n){return ex("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function ZS(e,t,n){return ex("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function JS(e,t,n){return ex("read_parquet",e,t,n)}function QS(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(", ");Object.assign(i,{open_options:o.toUpperCase()})}return ex("st_read",e,t,i)}function KS(e,t,n={}){let{select:r=["*"],...i}=n,o=xL(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return vo(e,s,i)}function cY(e){return Object.entries(e).map(([t,n])=>`${t}=${WS(n)}`).join(", ")}function WS(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=>WS(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${WS(n)}`).join(", ")+"}";default:return e}}function wL(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=bL(t^o>>8)),t=bL(t^i&255)}return lY(t)}function bL(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function lY(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var vL={from:NaN};function rI(e){if(!e.filterIndexable)return vL;let t=e.query(),n=tI(t);if(typeof n!="string"||!t.groupby)return vL;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s={};for(let a of t.select()){let{as:c,expr:{aggregate:l,args:u}}=a,f=l?.toUpperCase?.();switch(f){case"COUNT":case"SUM":i.push({[c]:Vt`SUM("${c}")::DOUBLE`});break;case"AVG":i.push({[c]:fY(s,c,u[0])});break;case"ARG_MAX":i.push({[c]:hY(s,c,u)});break;case"ARG_MIN":i.push({[c]:dY(s,c,u)});break;case"VARIANCE":case"VAR_SAMP":s[c]=null,i.push({[c]:nx(s,u[0],n)});break;case"VAR_POP":s[c]=null,i.push({[c]:nx(s,u[0],n,!1)});break;case"STDDEV":case"STDDEV_SAMP":s[c]=null,i.push({[c]:Vt`SQRT(${nx(s,u[0],n)})`});break;case"STDDEV_POP":s[c]=null,i.push({[c]:Vt`SQRT(${nx(s,u[0],n,!1)})`});break;case"COVAR_SAMP":s[c]=null,i.push({[c]:rx(s,u,n)});break;case"COVAR_POP":s[c]=null,i.push({[c]:rx(s,u,n,!1)});break;case"CORR":s[c]=null,i.push({[c]:_L(s,u,n)});break;case"REGR_COUNT":s[c]=null,i.push({[c]:Vt`${Bu(s,u)}::DOUBLE`});break;case"REGR_AVGX":s[c]=null,i.push({[c]:ML(s,u)});break;case"REGR_AVGY":s[c]=null,i.push({[c]:AL(s,u)});break;case"REGR_SYY":s[c]=null,i.push({[c]:nI(s,0,u,n)});break;case"REGR_SXX":s[c]=null,i.push({[c]:nI(s,1,u,n)});break;case"REGR_SXY":s[c]=null,i.push({[c]:rx(s,u,n,null)});break;case"REGR_SLOPE":s[c]=null,i.push({[c]:TL(s,u,n)});break;case"REGR_INTERCEPT":s[c]=null,i.push({[c]:pY(s,u,n)});break;case"REGR_R2":s[c]=null,i.push({[c]:Vt`(${_L(s,u,n)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":i.push({[c]:Vt`${f}("${c}")`});break;default:if(r.has(c))o.push(c);else return null}}return{from:n,dims:o,aggr:i,aux:s}}function Pi(e,...t){let n=t.length?"_"+t.map(uY).join("_"):"";return`__${e}${n}__`}function uY(e){return`${e}`.replaceAll('"',"").replaceAll(" ","_")}function tI(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=tI(t[0]);for(let r=1;r<t.length;++r){let i=tI(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function SL(e,t){let n=Pi("count",t);return e[n]=Vt`COUNT(${t})`,Vt`SUM(${n})`.annotate({name:n})}function fY(e,t,n){let r=SL(e,n);return Vt`(SUM("${t}" * ${r.name}) / ${r})`}function cp(e,t){return j`(SELECT AVG(${e}) FROM "${t}")`}function hY(e,t,[,n]){let r=Pi("max",n);return e[r]=Vt`MAX(${n})`,Vt`ARG_MAX("${t}", ${r})`}function dY(e,t,[,n]){let r=Pi("min",n);return e[r]=Vt`MIN(${n})`,Vt`ARG_MIN("${t}", ${r})`}function nx(e,t,n,r=!0){let i=SL(e,t),o=Pi("rssq",t),s=Pi("rsum",t),a=j`${t} - ${cp(t,n)}`;return e[o]=Vt`SUM((${a}) ** 2)`,e[s]=Vt`SUM(${a})`,Vt`(SUM(${o}) - (SUM(${s}) ** 2 / ${i})) / (${i}${r?" - 1":""})`}function rx(e,t,n,r=!0){let i=Bu(e,t),o=IL(e,t,n),s=lp(e,1,t,n),a=lp(e,0,t,n),c=r===null?"":r?` / (${i} - 1)`:` / ${i}`;return Vt`(${o} - ${s} * ${a} / ${i})${c}`}function _L(e,t,n){let r=Bu(e,t),i=IL(e,t,n),o=eI(e,1,t,n),s=eI(e,0,t,n),a=lp(e,1,t,n),c=lp(e,0,t,n),l=Vt`(${o} - (${a} ** 2) / ${r})`,u=Vt`(${s} - (${c} ** 2) / ${r})`;return Vt`(${i} - ${a} * ${c} / ${r}) / SQRT(${l} * ${u})`}function Bu(e,[t,n]){let r=Pi("count",t,n);return e[r]=Vt`REGR_COUNT(${t}, ${n})`,Vt`SUM(${r})`.annotate({name:r})}function lp(e,t,n,r){let i=n[t],o=n[1-t],s=Pi("rs",i);return e[s]=Vt`SUM(${i} - ${cp(i,r)}) FILTER (${o} IS NOT NULL)`,Vt`SUM(${s})`}function eI(e,t,n,r){let i=n[t],o=n[1-t],s=Pi("rss",i);return e[s]=Vt`SUM((${i} - ${cp(i,r)}) ** 2) FILTER (${o} IS NOT NULL)`,Vt`SUM(${s})`}function IL(e,t,n){let[r,i]=t,o=Pi("sxy",r,i);return e[o]=Vt`SUM((${i} - ${cp(i,n)}) * (${r} - ${cp(r,n)}))`,Vt`SUM(${o})`}function ML(e,t){let[n,r]=t,i=Bu(e,t),o=Pi("avg",r,n);return e[o]=Vt`REGR_AVGX(${n}, ${r})`,Vt`(SUM(${o} * ${i.name}) / ${i})`}function AL(e,t){let[n,r]=t,i=Bu(e,t),o=Pi("avg",n,r);return e[o]=Vt`REGR_AVGY(${n}, ${r})`,Vt`(SUM(${o} * ${i.name}) / ${i})`}function nI(e,t,n,r){let i=Bu(e,n),o=lp(e,t,n,r),s=eI(e,t,n,r);return Vt`(${s} - (${o} ** 2 / ${i}))`}function TL(e,t,n){let r=rx(e,t,n,null),i=nI(e,1,t,n);return Vt`(${r}) / ${i}`}function pY(e,t,n){let r=ML(e,t),i=AL(e,t),o=TL(e,t,n);return Vt`${i} - (${o}) * ${r}`}var ix=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.active=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 u=Array.from(t,rI).filter(h=>h),f=u[0]?.from;this.enabled=u.length&&u.every(h=>h.from===f),this.clients=t,this.active=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.active?.source)return!0;if(this.clear(),!r)return!1;let i=this.active=mY(n);if(!i)return!1;let o=this.mc.logger();o.warn("DATA CUBE INDEX CONSTRUCTION");let s=this.selection.remove(r),a=this.indices=new Map,{mc:c,temp:l}=this;for(let u of t){if(s.skip(u,n)){a.set(u,null);continue}let f=rI(u);if(!f)continue;let h=u.query(s.predicate(u)).select({...i.columns,...f.aux}).groupby(Object.keys(i.columns)),[d]=h.subqueries;if(d){let b=Object.values(i.columns).flatMap(w=>w.columns);xY(d,b)}let p=h.orderby();h.query.orderby=[];let m=h.toString(),g=`cube_index_${(wL(m)>>>0).toString(16)}`,x=c.exec(vo(g,m,{temp:l}));x.catch(b=>o.error(b)),a.set(u,{table:g,result:x,order:p,...f})}return!0}async update(){let{clients:t,selection:n,active: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{mc:r,indices:i,selection:o}=this;if(!i.has(t))return n=o.predicate(t),r.updateClient(t,t.query(n));let s=this.indices.get(t);if(!s)return;let{table:a,dims:c,aggr:l,order:u=[]}=s,f=dt.select(c,l).from(a).groupby(c).where(n).orderby(u);return r.updateClient(t,f)}};function mY(e){let{source:t,meta:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,bin:s,pixelSize:a=1}=n,c;if(i==="interval"&&o){let l=o.map(u=>gY(u,a,s));if(l.some(u=>u==null))return null;l.length===1?(c=u=>u?We("active0",u.range.map(l[0])):[],r={active0:l[0](e.predicate.field)}):(c=u=>u?vr(u.children.map(({range:f},h)=>We(`active${h}`,f.map(l[h])))):[],r=Object.fromEntries(e.predicate.children.map((u,f)=>[`active${f}`,l[f](u.field)])))}else if(i==="point")c=l=>l,r=Object.fromEntries(r.map(l=>[`${l}`,zt(l)]));else return null;return{source:t,columns:r,predicate:c}}var yY={ceil:"CEIL",round:"ROUND"};function gY(e,t,n){let{type:r,domain:i,range:o,apply:s,sqlApply:a}=sp(e);if(!s)return;let c=yY[`${n}`.toLowerCase()]||"FLOOR",l=s(Math.min(...i)),u=s(Math.max(...i)),f=r==="identity"?1:Math.abs(o[1]-o[0])/(u-l),h=f/t===1?"":`${f/t}::DOUBLE * `,d=l===0?"":` - ${l}::DOUBLE`;return p=>j`${c}(${h}(${a(p)}${d}))::INTEGER`}function xY(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 ox=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new iI}),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(t,n){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=Array.from(o,c=>c(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},iI=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 up(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?bY(e,t):!0}function bY(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 Ea}var Ea=class e extends ox{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 up(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function Fr(e){return e instanceof As}var As=class e extends Ea{static intersect({cross:t=!1}={}){return new e(new Hc({cross:t}))}static union({cross:t=!1}={}){return new e(new Hc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new Hc({cross:t,single:!0}))}static crossfilter(){return new e(new Hc({cross:!0}))}constructor(t=new Hc){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 resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(n=>n.source===t)?.value}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)}},Hc=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?Vc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}return null}};var sx=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=null,this.index(r);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)}index(t){let{selection:n}=this,{resolver:r}=n;this.indexer=t&&(r.single||!r.union)?new ix(this.mc,{...t,selection:n}):null}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():wY(t,r,i)}};function wY(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 ax(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return Object.assign(n,{fulfill:r=>(e(r),n),reject:r=>(t(r),n)})}function vY(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function EL(e,t,n){let r=[],i=0;function o(){let s=_Y(r,t);r=[],i=0;for(let a of s)IY(a,e,n),TY(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||vY(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function _Y(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=SY(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function SY(e,t){let n=`${e}`;if(e instanceof dt&&!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 wr&&o[s.column]||s))}return`${r}`}else return n}function IY(e,t,n){if(MY(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=AY(e,n)},result:e.result=ax()});else for(let{entry:r,priority:i}of e)t(r,i)}function MY(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 AY(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[h]=r.get(f);c.push([h,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof wr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function TY(e,t){let{maps:n,query:r,result:i}=e;if(!n)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=GS(r);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=n[c],h=s&&f?DY(o,f):f?EY(o,f):o;l.cache&&t.set(String(l.query),h),u.fulfill(h)})}function EY(e,t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}function DY(e,t){let n=new Map(t),r=[];for(let i of e)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}var NY=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,DL=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function NL({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&&NY(r),o},clear(){n=new Map}}}function OL(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 _o={High:0,Normal:1,Low:2},cx=class{constructor(){this.queue=OL(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:t,result:n}=this.queue.next();this.pending=this.submit(t,n),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(t,n=_o.Normal){this.queue.insert(t,n),this.next()}recordQuery(t){this.recorders.length&&t&&this.recorders.forEach(n=>n.add(t))}async submit(t,n){try{let{query:r,type:i,cache:o=!1,record:s=!0,options:a}=t,c=r?`${r}`:null;if(s&&this.recordQuery(c),o){let f=this.clientCache.get(c);if(f){this._logger.debug("Cache"),n.fulfill(f);return}}let l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:c,...a});let u=await this.db.query({type:i,sql:c,...a});o&&this.clientCache.set(c,u),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),n.fulfill(u)}catch(r){n.reject(r)}}cache(t){return t!==void 0?this.clientCache=t===!0?NL():t||DL():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=EL(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!t&&this._consolidate&&(this._consolidate=null)}request(t,n=_o.Normal){let r=ax(),i={request:t,result:r};return this._consolidate?this._consolidate.add(i,n):this.enqueue(i,n),r}cancel(t){let n=new Set(t);this.queue.remove(({result:r})=>n.has(r))}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0))}record(){let t=[],n={add(r){t.push(r)},reset(){t=[]},snapshot(){return t.slice()},stop(){return this.recorders=this.recorders.filter(r=>r!==n),t}};return this.recorders.push(n),n}};function oI(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}function sI(e){return typeof e?.getChild=="function"}function aI(e){if(H.isTimestamp(e))return t=>t==null?t:new Date(t);if(H.isInt(e)&&e.bitWidth>=64)return t=>t==null?t:Number(t);if(H.isDecimal(e)){let t=1/Math.pow(10,e.scale);return n=>n==null?n:BL(n,t)}return t=>t}function cI(e){let{type:t}=e;if(H.isTimestamp(t)){let n=e.length,r=new Array(n);for(let i=0;i<n;++i){let o=e.get(i);r[i]=o==null?null:new Date(o)}return r}if(H.isInt(t)&&t.bitWidth>=64){let n=e.length,r=e.nullCount?new Array(n):new Float64Array(n);for(let i=0;i<n;++i){let o=e.get(i);r[i]=o==null?null:Number(o)}return r}if(H.isDecimal(t)){let n=1/Math.pow(10,t.scale),r=e.length,i=e.nullCount?new Array(r):new Float64Array(r);for(let o=0;o<r;++o){let s=e.get(o);i[o]=s==null?null:BL(s,n)}return i}return e.nullCount?Array.from(e):e.toArray()}var LL=Array.from({length:8},(e,t)=>Math.pow(2,t*32));function BL(e,t){let n=e.length,r=0;if(e.signed&&(e[n-1]|0)<0){for(let i=0;i<n;++i)r+=~e[i]*LL[i];r=-(r+1)}else for(let i=0;i<n;++i)r+=e[i]*LL[i];return r*t}var OY="count",LY="nulls",BY="max",CY="min",kY="distinct";var RY={[OY]:Zn,[kY]:e=>Zn(e).distinct(),[BY]:si,[CY]:ai,[LY]:e=>Zn().where(Yc(e))};function FY(e,t,n){return dt.from(e).select(Array.from(n,r=>[r,RY[r](t)]))}async function CL(e,t){return t.length===1&&`${t[0].column}`=="*"?PY(e,t[0].table):(await Promise.all(t.map(n=>$Y(e,n)))).filter(n=>n)}async function $Y(e,{table:t,column:n,stats:r}){let i=dt.from({source:t}).select({column:n}).groupby(n.aggregate?j`ALL`:[]),[o]=Array.from(await e.query(dt.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:oI(o.column_type),nullable:o.null==="YES"};if(!(r?.length||r?.size))return s;let a=await e.query(FY(t,n,r),{persist:!0});for(let c=0;c<a.numCols;++c){let{name:l}=a.schema.fields[c],u=a.getChildAt(c),f=aI(u.type);s[l]=f(u.get(0))}return s}async function PY(e,t){let n=await e.query(`DESCRIBE ${qc(t)}`);return Array.from(n).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:oI(r.column_type),nullable:r.null==="YES"}))}function kL(){return{debug(){},info(){},log(){},warn(){},error(){}}}var lx;function ci(e){return e?lx=e:lx==null&&(lx=new fp),lx}var fp=class{constructor(t=J0(),n={}){let{logger:r=console,manager:i=new cx}=n;this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||kL(),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}={}){this.manager.clear(),t&&(this.clients?.forEach(r=>this.disconnect(r)),this.filterGroups?.forEach(r=>r.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=_o.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=_o.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:_o.Low})}createBundle(t,n,r=_o.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=_o.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=_o.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{clients:n,filterGroups:r,indexes:i}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this;let o=t.fields();o?.length&&t.fieldInfo(await CL(this,o));let s=t.filterBy;if(s)if(r.has(s))r.get(s).add(t);else{let a=new sx(this,s,i);r.set(s,a.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)}};function hp(e,t,{source:n,clients:r=void 0}){let i=t!==void 0?Du(e,jc(t)):null;return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function dp(e,t,{source:n,clients:r=void 0}){let i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Du(e[l],jc(c)));return a.length>1?vr(a):a[0]});i=o.length>1?Vc(o):o[0]}return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function Zc(e,t,{source:n,clients:r,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?We(e,t):null;return{meta:{type:"interval",scales:[o],bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}function lI(e,t,{source:n,clients:r,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?vr(e.map((l,u)=>We(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}var UY={contains:eS,prefix:nS,suffix:rS,regexp:tS};function uI(e,t,{source:n,clients:r=void 0,method:i="contains"}){let o=UY[i],s=t?o(e,jc(t)):null;return{meta:{type:"match",method:i},source:n,clients:r,value:t,predicate:s}}function fI(){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 QN={};Tr(QN,{Fixed:()=>So,Param:()=>Ea,Query:()=>dt,Selection:()=>As,agg:()=>Vt,align:()=>F6,and:()=>vr,area:()=>_D,areaX:()=>SD,areaY:()=>ID,argmax:()=>Ou,argmin:()=>Nu,arrayAgg:()=>PS,arrow:()=>gN,aspectRatio:()=>$6,avg:()=>tp,axis:()=>P6,axisFx:()=>_N,axisFy:()=>SN,axisX:()=>wN,axisY:()=>vN,barX:()=>ED,barY:()=>DD,bin:()=>s_,cast:()=>np,castDouble:()=>Lu,castInteger:()=>US,cell:()=>ND,cellX:()=>OD,cellY:()=>LD,centroid:()=>ip,centroidX:()=>YS,centroidY:()=>XS,circle:()=>PD,colorBase:()=>AE,colorClamp:()=>pE,colorConstant:()=>EE,colorDomain:()=>hE,colorExponent:()=>TE,colorInterpolate:()=>xE,colorLabel:()=>vE,colorLegend:()=>HN,colorN:()=>mE,colorNice:()=>yE,colorPercent:()=>_E,colorPivot:()=>bE,colorRange:()=>dE,colorReverse:()=>SE,colorScale:()=>fE,colorScheme:()=>gE,colorSymmetric:()=>wE,colorTickFormat:()=>ME,colorZero:()=>IE,column:()=>Aa,contour:()=>rN,coordinator:()=>ci,corr:()=>TS,count:()=>Zn,covarPop:()=>DS,covariance:()=>ES,create:()=>vo,cume_dist:()=>cS,dateDay:()=>VS,dateMonth:()=>qS,dateMonthDay:()=>jS,delaunayLink:()=>pN,delaunayMesh:()=>mN,denseLine:()=>nN,dense_rank:()=>sS,density:()=>eN,densityX:()=>KD,densityY:()=>tN,dot:()=>RD,dotX:()=>FD,dotY:()=>$D,entropy:()=>IS,eq:()=>Z2,errorbarX:()=>uN,errorbarY:()=>fN,facetGrid:()=>f8,facetLabel:()=>h8,facetMargin:()=>s8,facetMarginBottom:()=>c8,facetMarginLeft:()=>l8,facetMarginRight:()=>u8,facetMarginTop:()=>a8,first:()=>RS,first_value:()=>hS,frame:()=>bN,from:()=>nz,fxAlign:()=>b8,fxAriaDescription:()=>F8,fxAriaLabel:()=>R8,fxAxis:()=>S8,fxDomain:()=>d8,fxFontVariant:()=>k8,fxGrid:()=>N8,fxInset:()=>m8,fxInsetLeft:()=>y8,fxInsetRight:()=>g8,fxLabel:()=>L8,fxLabelAnchor:()=>B8,fxLabelOffset:()=>C8,fxLine:()=>O8,fxPadding:()=>w8,fxPaddingInner:()=>v8,fxPaddingOuter:()=>_8,fxRange:()=>p8,fxReverse:()=>$8,fxRound:()=>x8,fxTickFormat:()=>E8,fxTickPadding:()=>T8,fxTickRotate:()=>D8,fxTickSize:()=>M8,fxTickSpacing:()=>A8,fxTicks:()=>I8,fyAlign:()=>Y8,fyAriaDescription:()=>lE,fyAriaLabel:()=>cE,fyAxis:()=>H8,fyDomain:()=>P8,fyFontVariant:()=>aE,fyGrid:()=>nE,fyInset:()=>z8,fyInsetBottom:()=>j8,fyInsetTop:()=>q8,fyLabel:()=>iE,fyLabelAnchor:()=>oE,fyLabelOffset:()=>sE,fyLine:()=>rE,fyPadding:()=>X8,fyPaddingInner:()=>G8,fyPaddingOuter:()=>W8,fyRange:()=>U8,fyReverse:()=>uE,fyRound:()=>V8,fyTickFormat:()=>tE,fyTickPadding:()=>K8,fyTickRotate:()=>eE,fyTickSize:()=>J8,fyTickSpacing:()=>Q8,fyTicks:()=>Z8,geo:()=>EN,geojson:()=>rp,graticule:()=>NN,grid:()=>z6,gridFx:()=>AN,gridFy:()=>TN,gridX:()=>IN,gridY:()=>MN,gt:()=>Qd,gte:()=>J2,hconcat:()=>ZU,heatmap:()=>iN,height:()=>L6,hexagon:()=>UD,hexbin:()=>aN,hexgrid:()=>cN,highlight:()=>ON,hspace:()=>KU,hull:()=>yN,image:()=>QD,inset:()=>U6,intervalX:()=>PN,intervalXY:()=>zN,intervalY:()=>UN,isBetween:()=>We,isDistinct:()=>Q2,isNotBetween:()=>K2,isNotDistinct:()=>Du,isNotNull:()=>Ss,isNull:()=>Yc,kurtosis:()=>SS,label:()=>q6,lag:()=>uS,last:()=>FS,last_value:()=>dS,lead:()=>fS,lengthBase:()=>cD,lengthClamp:()=>iD,lengthConstant:()=>uD,lengthDomain:()=>nD,lengthExponent:()=>lD,lengthNice:()=>oD,lengthPercent:()=>sD,lengthRange:()=>rD,lengthScale:()=>eD,lengthZero:()=>aD,line:()=>MD,lineX:()=>AD,lineY:()=>TD,link:()=>xN,literal:()=>jc,loadCSV:()=>HS,loadExtension:()=>ap,loadJSON:()=>ZS,loadObjects:()=>KS,loadParquet:()=>JS,loadSpatial:()=>QS,lt:()=>Is,lte:()=>Ms,mad:()=>yS,margin:()=>E6,marginBottom:()=>R6,marginLeft:()=>B6,marginRight:()=>C6,marginTop:()=>k6,margins:()=>T6,max:()=>si,median:()=>xS,menu:()=>VU,min:()=>ai,mode:()=>wS,name:()=>M6,nearest:()=>RN,nearestX:()=>FN,nearestY:()=>$N,neq:()=>Xc,not:()=>H2,nth_value:()=>pS,ntile:()=>lS,opacityBase:()=>PE,opacityClamp:()=>LE,opacityConstant:()=>zE,opacityDomain:()=>NE,opacityExponent:()=>UE,opacityLabel:()=>CE,opacityLegend:()=>ZN,opacityNice:()=>BE,opacityPercent:()=>kE,opacityRange:()=>OE,opacityReverse:()=>RE,opacityScale:()=>DE,opacityTickFormat:()=>$E,opacityZero:()=>FE,or:()=>Vc,padding:()=>j6,pan:()=>qN,panX:()=>jN,panY:()=>VN,panZoom:()=>YN,panZoomX:()=>XN,panZoomY:()=>GN,percent_rank:()=>aS,plot:()=>rz,product:()=>gS,projectionClip:()=>vD,projectionDomain:()=>mD,projectionInset:()=>yD,projectionInsetBottom:()=>wD,projectionInsetLeft:()=>gD,projectionInsetRight:()=>xD,projectionInsetTop:()=>bD,projectionParallels:()=>hD,projectionPrecision:()=>dD,projectionRotate:()=>pD,projectionType:()=>fD,quantile:()=>bS,rBase:()=>QE,rClamp:()=>WE,rConstant:()=>tD,rDomain:()=>XE,rExponent:()=>KE,rNice:()=>HE,rPercent:()=>ZE,rRange:()=>GE,rScale:()=>YE,rZero:()=>JE,rank:()=>oS,raster:()=>oN,rasterTile:()=>sN,rect:()=>BD,rectX:()=>CD,rectY:()=>kD,regressionY:()=>lN,row_number:()=>iS,ruleX:()=>VD,ruleY:()=>YD,search:()=>YU,skewness:()=>_S,slider:()=>XU,sphere:()=>DN,spike:()=>JD,sql:()=>j,stddev:()=>ep,stddevPop:()=>AS,stringAgg:()=>$S,style:()=>N6,sum:()=>Rr,symbolDomain:()=>jE,symbolLegend:()=>JN,symbolRange:()=>VE,symbolScale:()=>qE,table:()=>GU,text:()=>zD,textX:()=>qD,textY:()=>jD,tickX:()=>XD,tickY:()=>GD,toggle:()=>Jl,toggleColor:()=>kN,toggleX:()=>LN,toggleY:()=>BN,toggleZ:()=>CN,varPop:()=>MS,variance:()=>vS,vconcat:()=>HU,vector:()=>WD,vectorX:()=>HD,vectorY:()=>ZD,voronoi:()=>hN,voronoiMesh:()=>dN,vspace:()=>QU,width:()=>O6,xAlign:()=>K6,xAriaDescription:()=>x4,xAriaLabel:()=>g4,xAxis:()=>r4,xBase:()=>_4,xClamp:()=>J6,xConstant:()=>I4,xDomain:()=>Y6,xExponent:()=>S4,xFontVariant:()=>y4,xGrid:()=>u4,xInset:()=>W6,xInsetLeft:()=>H6,xInsetRight:()=>Z6,xLabel:()=>h4,xLabelAnchor:()=>d4,xLabelArrow:()=>p4,xLabelOffset:()=>m4,xLine:()=>f4,xNice:()=>G6,xPadding:()=>t4,xPaddingInner:()=>e4,xPaddingOuter:()=>n4,xPercent:()=>b4,xRange:()=>X6,xReverse:()=>w4,xRound:()=>Q6,xScale:()=>V6,xTickFormat:()=>c4,xTickPadding:()=>a4,xTickRotate:()=>l4,xTickSize:()=>o4,xTickSpacing:()=>s4,xTicks:()=>i4,xZero:()=>v4,xyDomain:()=>D6,yAlign:()=>C4,yAriaDescription:()=>K4,yAriaLabel:()=>Q4,yAxis:()=>$4,yBase:()=>r8,yClamp:()=>L4,yConstant:()=>o8,yDomain:()=>A4,yExponent:()=>i8,yFontVariant:()=>J4,yGrid:()=>Y4,yInset:()=>D4,yInsetBottom:()=>O4,yInsetTop:()=>N4,yLabel:()=>G4,yLabelAnchor:()=>W4,yLabelArrow:()=>H4,yLabelOffset:()=>Z4,yLine:()=>X4,yNice:()=>E4,yPadding:()=>k4,yPaddingInner:()=>R4,yPaddingOuter:()=>F4,yPercent:()=>t8,yRange:()=>T4,yReverse:()=>e8,yRound:()=>B4,yScale:()=>M4,yTickFormat:()=>j4,yTickPadding:()=>q4,yTickRotate:()=>V4,yTickSize:()=>U4,yTickSpacing:()=>z4,yTicks:()=>P4,yZero:()=>n8});var So=Symbol("Fixed"),An=Symbol("Transient"),pp=Symbol("Transform");var a6={};Tr(a6,{Area:()=>zl,Arrow:()=>Ay,BarX:()=>Ty,BarY:()=>Ey,Cell:()=>ql,Contour:()=>Uy,Density:()=>jy,Dot:()=>jl,Frame:()=>xy,Geo:()=>Vy,Hexgrid:()=>Yy,Image:()=>Xy,Line:()=>Vl,Link:()=>Iy,Mark:()=>St,Raster:()=>Ry,Rect:()=>Xl,RuleX:()=>dy,RuleY:()=>py,Text:()=>$l,TickX:()=>Ly,TickY:()=>By,Tip:()=>by,Vector:()=>Ul,area:()=>Sy,areaX:()=>hc,areaY:()=>la,arrow:()=>N9,auto:()=>z9,autoSpec:()=>BT,axisFx:()=>hv,axisFy:()=>fv,axisX:()=>yy,axisY:()=>my,barX:()=>Ko,barY:()=>ts,bin:()=>ca,binX:()=>Jo,binY:()=>Qo,bollinger:()=>yc,bollingerX:()=>G9,bollingerY:()=>W9,boxX:()=>H9,boxY:()=>Z9,cell:()=>dc,cellX:()=>L9,cellY:()=>B9,centroid:()=>XP,circle:()=>R9,cluster:()=>YP,column:()=>xn,contour:()=>oP,crosshair:()=>cP,crosshairX:()=>lP,crosshairY:()=>uP,delaunayLink:()=>dP,delaunayMesh:()=>pP,density:()=>bP,differenceY:()=>_P,dodgeX:()=>sU,dodgeY:()=>aU,dot:()=>_i,dotX:()=>C9,dotY:()=>k9,filter:()=>jF,find:()=>QF,formatIsoDate:()=>eT,formatMonth:()=>K7,formatWeekday:()=>t$,frame:()=>Kf,geo:()=>Rv,geoCentroid:()=>GP,graticule:()=>IP,gridFx:()=>yv,gridFy:()=>pv,gridX:()=>mv,gridY:()=>dv,group:()=>oy,groupX:()=>ec,groupY:()=>nc,groupZ:()=>iy,hexagon:()=>F9,hexbin:()=>MP,hexgrid:()=>AP,hull:()=>mP,identity:()=>G,image:()=>EP,indexOf:()=>Ee,initializer:()=>Me,interpolateNearest:()=>$y,interpolateNone:()=>kv,interpolatorBarycentric:()=>Fy,interpolatorRandomWalk:()=>Py,legend:()=>Q$,line:()=>Yl,lineX:()=>pc,lineY:()=>mc,linearRegressionX:()=>OP,linearRegressionY:()=>LP,link:()=>Av,map:()=>Ir,mapX:()=>hh,mapY:()=>dh,marks:()=>nn,normalize:()=>Yv,normalizeX:()=>fU,normalizeY:()=>hU,plot:()=>vy,pointer:()=>ac,pointerX:()=>cc,pointerY:()=>sa,raster:()=>eP,rect:()=>Ny,rectX:()=>lh,rectY:()=>uh,reverse:()=>VF,ruleX:()=>Xr,ruleY:()=>Gr,scale:()=>oc,select:()=>pU,selectFirst:()=>Zy,selectLast:()=>Jy,selectMaxX:()=>Hv,selectMaxY:()=>Zv,selectMinX:()=>Gv,selectMinY:()=>Wv,shiftX:()=>dU,shuffle:()=>YF,sort:()=>Nw,sphere:()=>SP,spike:()=>L$,stackX:()=>NT,stackX1:()=>v9,stackX2:()=>_9,stackY:()=>OT,stackY1:()=>S9,stackY2:()=>I9,text:()=>Zo,textX:()=>iv,textY:()=>ov,tickX:()=>Lv,tickY:()=>Bv,tip:()=>bv,transform:()=>bn,tree:()=>KT,treeLink:()=>zv,treeNode:()=>Gy,valueof:()=>wt,vector:()=>bT,vectorX:()=>cv,vectorY:()=>lv,voronoi:()=>yP,voronoiMesh:()=>gP,window:()=>ph,windowX:()=>q9,windowY:()=>j9});function Ot(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Jn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ts(e){let t,n,r;e.length!==2?(t=Ot,n=(a,c)=>Ot(e(a),c),r=(a,c)=>e(a)-c):(t=e===Ot||e===Jn?e:jY,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 jY(){return 0}function mp(e){return e===null?NaN:+e}function*RL(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 FL=Ts(Ot),$L=FL.right,VY=FL.left,YY=Ts(mp).center,Es=$L;var yp=PL(UL),hI=PL(XY);function PL(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?(Cu(a,l,i,o,s),Cu(a,i,l,o,s),Cu(a,l,i,o,s),ku(c,i,l,o,s),ku(c,l,i,o,s),ku(c,i,l,o,s)):a?(Cu(a,i,l,o,s),Cu(a,l,i,o,s),Cu(a,i,l,o,s)):c&&(ku(c,i,l,o,s),ku(c,l,i,o,s),ku(c,i,l,o,s)),t}}function Cu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function ku(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function XY(e){let t=UL(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 UL(e){let t=Math.floor(e);if(t===e)return GY(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let h=s,d=s+u;h<d;h+=c)l+=o[Math.min(a,h)];for(let h=s,d=a;h<=d;h+=c)l+=o[Math.min(a,h+u)],i[h]=(l+n*(o[Math.max(s,h-f)]+o[Math.min(a,h+f)]))/r,l-=o[Math.max(s,h-u)]}}function GY(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 Io(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 WY(e){return e.length|0}function HY(e){return!(e>0)}function ZY(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function JY(e){return t=>e(...t)}function ux(...e){let t=typeof e[e.length-1]=="function"&&JY(e.pop());e=e.map(ZY);let n=e.map(WY),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(HY))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 fx(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 Da(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 li(e,t){let n=Da(e,t);return n&&Math.sqrt(n)}function ue(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 Tn=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 Qn=class extends Map{constructor(t,n=jL){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(dI(this,t))}has(t){return super.has(dI(this,t))}set(t,n){return super.set(zL(this,t),n)}delete(t){return super.delete(qL(this,t))}},Kn=class extends Set{constructor(t,n=jL){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(dI(this,t))}add(t){return super.add(zL(this,t))}delete(t){return super.delete(qL(this,t))}};function dI({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function zL({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function qL({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function jL(e){return e!==null&&typeof e=="object"?e.valueOf():e}function gp(e){return e}function fn(e,...t){return mI(e,gp,gp,t)}function Ui(e,t,...n){return mI(e,gp,t,n)}function pI(e,t,...n){return mI(e,Array.from,t,n)}function mI(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Qn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),h=a.get(f);h?h.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function yI(e,t){return Array.from(t,n=>e[n])}function Ds(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]))),yI(e,r)}return e.sort(xp(n))}function xp(e=Ot){if(e===Ot)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 Ru(e,t,n){return(t.length!==2?Ds(Ui(e,t,n),([r,i],[o,s])=>Ot(i,s)||Ot(r,o)):Ds(fn(e,n),([r,i],[o,s])=>t(i,s)||Ot(r,o))).map(([r])=>r)}var QY=Math.sqrt(50),KY=Math.sqrt(10),tX=Math.sqrt(2);function hx(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>=QY?10:o>=KY?5:o>=tX?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?hx(e,t,n*2):[a,c,l]}function En(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?hx(t,e,n):hx(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 Ns(e,t,n){return t=+t,e=+e,n=+n,hx(e,t,n)[2]}function Fu(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Ns(t,e,n):Ns(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function $u(e,t,n){let r;for(;;){let i=Ns(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(Io(e))/Math.LN2)+1)}function Jt(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 dx(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 fe(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 px(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 mx(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:xp(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),d=Math.max(n,Math.floor(t-l*f/c+h)),p=Math.min(r,Math.floor(t+(c-l)*f/c+h));mx(e,t,d,p,i)}let o=e[t],s=n,a=r;for(bp(e,n,t),i(e[r],o)>0&&bp(e,n,r);s<a;){for(bp(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?bp(e,n,a):(++a,bp(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function bp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Qc(e,t=Ot){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Ot(s,i)>0:Ot(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 tr(e,t,n){if(e=Float64Array.from(RL(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return fe(e);if(t>=1)return Jt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Jt(mx(e,o).subarray(0,o+1)),a=fe(e.subarray(o+1));return s+(a-s)*(i-o)}}function gI(e,t,n=mp){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 yx(e,t,n){let r=Io(e),i=tr(e,.75)-tr(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function wp(e,t,n){let r=Io(e),i=li(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Os(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 tr(e,.5,t)}function*nX(e){for(let t of e)yield*t}function Pu(e){return Array.from(nX(e))}function Uu(e,t){let n=new Qn;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 gx(e,t=rX){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function rX(e,t){return[e,t]}function Ue(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 vp(e,t=Ot){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=Ot);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Ot?(a,c)=>Jc(n[a],n[c]):xp(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 xx(e,t=Ot){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Ot(s,i)<0:Ot(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 Dn(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 Oa(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function VL(e){return e}var xI=1,bI=2,wI=3,bx=4,YL=1e-6;function iX(e){return"translate("+e+",0)"}function oX(e){return"translate(0,"+e+")"}function sX(e){return t=>+e(t)}function aX(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function cX(){return!this.__axis}function lX(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===xI||e===bx?-1:1,u=e===bx||e===bI?"x":"y",f=e===xI||e===wI?iX:oX;function h(d){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):VL),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,w=(t.bandwidth?aX:sX)(t.copy(),c),_=d.selection?d.selection():d,v=_.selectAll(".domain").data([null]),I=_.selectAll(".tick").data(p,t).order(),E=I.exit(),M=I.enter().append("g").attr("class","tick"),N=I.select("line"),A=I.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(M),N=N.merge(M.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),A=A.merge(M.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===xI?"0em":e===wI?"0.71em":"0.32em")),d!==_&&(v=v.transition(d),I=I.transition(d),N=N.transition(d),A=A.transition(d),E=E.transition(d).attr("opacity",YL).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),M.attr("opacity",YL).attr("transform",function(O){var C=this.parentNode.__axis;return f((C&&isFinite(C=C(O))?C:w(O))+c)})),E.remove(),v.attr("d",e===bx||e===bI?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),I.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),N.attr(u+"2",l*o),A.attr(u,l*y).text(m),_.filter(cX).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===bI?"start":e===bx?"end":"middle"),_.each(function(){this.__axis=w})}return h.scale=function(d){return arguments.length?(t=d,h):t},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),h):n.slice()},h.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),h):r&&r.slice()},h.tickFormat=function(d){return arguments.length?(i=d,h):i},h.tickSize=function(d){return arguments.length?(o=s=+d,h):o},h.tickSizeInner=function(d){return arguments.length?(o=+d,h):o},h.tickSizeOuter=function(d){return arguments.length?(s=+d,h):s},h.tickPadding=function(d){return arguments.length?(a=+d,h):a},h.offset=function(d){return arguments.length?(c=+d,h):c},h}function vI(e){return lX(wI,e)}var uX={value:()=>{}};function GL(){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 wx(n)}function wx(e){this._=e}function fX(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}})}wx.prototype=GL.prototype={constructor:wx,on:function(e,t){var n=this._,r=fX(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=hX(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]=XL(n[i],e.name,t);else if(t==null)for(i in n)n[i]=XL(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 wx(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 hX(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function XL(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=uX,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Kc=GL;var vx="http://www.w3.org/1999/xhtml",ui={svg:"http://www.w3.org/2000/svg",xhtml:vx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ls(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ui.hasOwnProperty(t)?{space:ui[t],local:e}:e}function dX(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===vx&&t.documentElement.namespaceURI===vx?t.createElement(e):t.createElementNS(n,e)}}function pX(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bs(e){var t=Ls(e);return(t.local?pX:dX)(t)}function mX(){}function tl(e){return e==null?mX:function(){return this.querySelector(e)}}function WL(e){typeof e!="function"&&(e=tl(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 _I(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function yX(){return[]}function _p(e){return e==null?yX:function(){return this.querySelectorAll(e)}}function gX(e){return function(){return _I(e.apply(this,arguments))}}function HL(e){typeof e=="function"?e=gX(e):e=_p(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 Sp(e){return function(){return this.matches(e)}}function _x(e){return function(t){return t.matches(e)}}var xX=Array.prototype.find;function bX(e){return function(){return xX.call(this.children,e)}}function wX(){return this.firstElementChild}function ZL(e){return this.select(e==null?wX:bX(typeof e=="function"?e:_x(e)))}var vX=Array.prototype.filter;function _X(){return Array.from(this.children)}function SX(e){return function(){return vX.call(this.children,e)}}function JL(e){return this.selectAll(e==null?_X:SX(typeof e=="function"?e:_x(e)))}function QL(e){typeof e!="function"&&(e=Sp(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 Sx(e){return new Array(e.length)}function KL(){return new Fe(this._enter||this._groups.map(Sx),this._parents)}function Ip(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ip.prototype={constructor:Ip,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 tB(e){return function(){return e}}function IX(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 Ip(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function MX(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,h=new Array(u),d;for(a=0;a<u;++a)(c=t[a])&&(h[a]=d=s.call(c,c.__data__,a,t)+"",l.has(d)?i[a]=c:l.set(d,c));for(a=0;a<f;++a)d=s.call(e,o[a],a,o)+"",(c=l.get(d))?(r[a]=c,c.__data__=o[a],l.delete(d)):n[a]=new Ip(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(h[a])===c&&(i[a]=c)}function AX(e){return e.__data__}function eB(e,t){if(!arguments.length)return Array.from(this,AX);var n=t?MX:IX,r=this._parents,i=this._groups;typeof e!="function"&&(e=tB(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],h=f.length,d=TX(e.call(u,u&&u.__data__,l,r)),p=d.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(h);n(u,f,m,y,g,d,t);for(var x=0,b=0,w,_;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(_=y[b])&&++b<p;);w._next=_||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function TX(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function nB(){return new Fe(this._exit||this._groups.map(Sx),this._parents)}function rB(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 iB(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,h=a[c]=new Array(f),d,p=0;p<f;++p)(d=l[p]||u[p])&&(h[p]=d);for(;c<i;++c)a[c]=n[c];return new Fe(a,this._parents)}function oB(){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 sB(e){e||(e=EX);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Fe(i,this._parents).order()}function EX(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function aB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function cB(){return Array.from(this)}function lB(){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 uB(){let e=0;for(let t of this)++e;return e}function fB(){return!this.node()}function hB(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 DX(e){return function(){this.removeAttribute(e)}}function NX(e){return function(){this.removeAttributeNS(e.space,e.local)}}function OX(e,t){return function(){this.setAttribute(e,t)}}function LX(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function BX(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function CX(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 dB(e,t){var n=Ls(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?NX:DX:typeof t=="function"?n.local?CX:BX:n.local?LX:OX)(n,t))}function Ix(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kX(e){return function(){this.style.removeProperty(e)}}function RX(e,t,n){return function(){this.style.setProperty(e,t,n)}}function FX(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function pB(e,t,n){return arguments.length>1?this.each((t==null?kX:typeof t=="function"?FX:RX)(e,t,n??"")):La(this.node(),e)}function La(e,t){return e.style.getPropertyValue(t)||Ix(e).getComputedStyle(e,null).getPropertyValue(t)}function $X(e){return function(){delete this[e]}}function PX(e,t){return function(){this[e]=t}}function UX(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mB(e,t){return arguments.length>1?this.each((t==null?$X:typeof t=="function"?UX:PX)(e,t)):this.node()[e]}function yB(e){return e.trim().split(/^|\s+/)}function SI(e){return e.classList||new gB(e)}function gB(e){this._node=e,this._names=yB(e.getAttribute("class")||"")}gB.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 xB(e,t){for(var n=SI(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function bB(e,t){for(var n=SI(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function zX(e){return function(){xB(this,e)}}function qX(e){return function(){bB(this,e)}}function jX(e,t){return function(){(t.apply(this,arguments)?xB:bB)(this,e)}}function wB(e,t){var n=yB(e+"");if(arguments.length<2){for(var r=SI(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?jX:t?zX:qX)(n,t))}function VX(){this.textContent=""}function YX(e){return function(){this.textContent=e}}function XX(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function vB(e){return arguments.length?this.each(e==null?VX:(typeof e=="function"?XX:YX)(e)):this.node().textContent}function GX(){this.innerHTML=""}function WX(e){return function(){this.innerHTML=e}}function HX(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _B(e){return arguments.length?this.each(e==null?GX:(typeof e=="function"?HX:WX)(e)):this.node().innerHTML}function ZX(){this.nextSibling&&this.parentNode.appendChild(this)}function SB(){return this.each(ZX)}function JX(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function IB(){return this.each(JX)}function MB(e){var t=typeof e=="function"?e:Bs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function QX(){return null}function AB(e,t){var n=typeof e=="function"?e:Bs(e),r=t==null?QX:typeof t=="function"?t:tl(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function KX(){var e=this.parentNode;e&&e.removeChild(this)}function TB(){return this.each(KX)}function tG(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function eG(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function EB(e){return this.select(e?eG:tG)}function DB(e){return arguments.length?this.property("__data__",e):this.node().__data__}function nG(e){return function(t){e.call(this,t,this.__data__)}}function rG(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 iG(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 oG(e,t,n){return function(){var r=this.__on,i,o=nG(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 NB(e,t,n){var r=rG(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?oG:iG,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function OB(e,t,n){var r=Ix(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 sG(e,t){return function(){return OB(this,e,t)}}function aG(e,t){return function(){return OB(this,e,t.apply(this,arguments))}}function LB(e,t){return this.each((typeof t=="function"?aG:sG)(e,t))}function*BB(){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 II=[null];function Fe(e,t){this._groups=e,this._parents=t}function CB(){return new Fe([[document.documentElement]],II)}function cG(){return this}Fe.prototype=CB.prototype={constructor:Fe,select:WL,selectAll:HL,selectChild:ZL,selectChildren:JL,filter:QL,data:eB,enter:KL,exit:nB,join:rB,merge:iB,selection:cG,order:oB,sort:sB,call:aB,nodes:cB,node:lB,size:uB,empty:fB,each:hB,attr:dB,style:pB,property:mB,classed:wB,text:vB,html:_B,raise:SB,lower:IB,append:MB,insert:AB,remove:TB,clone:EB,datum:DB,on:NB,dispatch:LB,[Symbol.iterator]:BB};var Cs=CB;function Yt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],II)}function kB(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fn(e,t){if(e=kB(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 Mx={capture:!0,passive:!1};function Ax(e){e.preventDefault(),e.stopImmediatePropagation()}function Mp(e){var t=e.document.documentElement,n=Yt(e).on("dragstart.drag",Ax,Mx);"onselectstart"in t?n.on("selectstart.drag",Ax,Mx):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ap(e,t){var n=e.document.documentElement,r=Yt(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ax,Mx),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 ks(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ba(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ao(){}var Ca=.7,rl=1/Ca,zu="\\s*([+-]?\\d+)\\s*",Tp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lG=/^#([0-9a-f]{3,8})$/,uG=new RegExp(`^rgb\\(${zu},${zu},${zu}\\)$`),fG=new RegExp(`^rgb\\(${Mo},${Mo},${Mo}\\)$`),hG=new RegExp(`^rgba\\(${zu},${zu},${zu},${Tp}\\)$`),dG=new RegExp(`^rgba\\(${Mo},${Mo},${Mo},${Tp}\\)$`),pG=new RegExp(`^hsl\\(${Tp},${Mo},${Mo}\\)$`),mG=new RegExp(`^hsla\\(${Tp},${Mo},${Mo},${Tp}\\)$`),RB={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};ks(Ao,$r,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:FB,formatHex:FB,formatHex8:yG,formatHsl:gG,formatRgb:$B,toString:$B});function FB(){return this.rgb().formatHex()}function yG(){return this.rgb().formatHex8()}function gG(){return VB(this).formatHsl()}function $B(){return this.rgb().formatRgb()}function $r(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=lG.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?PB(t):n===3?new He(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tx(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tx(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=uG.exec(e))?new He(t[1],t[2],t[3],1):(t=fG.exec(e))?new He(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hG.exec(e))?Tx(t[1],t[2],t[3],t[4]):(t=dG.exec(e))?Tx(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pG.exec(e))?qB(t[1],t[2]/100,t[3]/100,1):(t=mG.exec(e))?qB(t[1],t[2]/100,t[3]/100,t[4]):RB.hasOwnProperty(e)?PB(RB[e]):e==="transparent"?new He(NaN,NaN,NaN,0):null}function PB(e){return new He(e>>16&255,e>>8&255,e&255,1)}function Tx(e,t,n,r){return r<=0&&(e=t=n=NaN),new He(e,t,n,r)}function Ep(e){return e instanceof Ao||(e=$r(e)),e?(e=e.rgb(),new He(e.r,e.g,e.b,e.opacity)):new He}function sn(e,t,n,r){return arguments.length===1?Ep(e):new He(e,t,n,r??1)}function He(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ks(He,sn,Ba(Ao,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new He(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ca:Math.pow(Ca,e),new He(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new He(nl(this.r),nl(this.g),nl(this.b),Dx(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:UB,formatHex:UB,formatHex8:xG,formatRgb:zB,toString:zB}));function UB(){return`#${el(this.r)}${el(this.g)}${el(this.b)}`}function xG(){return`#${el(this.r)}${el(this.g)}${el(this.b)}${el((isNaN(this.opacity)?1:this.opacity)*255)}`}function zB(){let e=Dx(this.opacity);return`${e===1?"rgb(":"rgba("}${nl(this.r)}, ${nl(this.g)}, ${nl(this.b)}${e===1?")":`, ${e})`}`}function Dx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function el(e){return e=nl(e),(e<16?"0":"")+e.toString(16)}function qB(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new qi(e,t,n,r)}function VB(e){if(e instanceof qi)return new qi(e.h,e.s,e.l,e.opacity);if(e instanceof Ao||(e=$r(e)),!e)return new qi;if(e instanceof qi)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 qi(s,a,c,e.opacity)}function Dp(e,t,n,r){return arguments.length===1?VB(e):new qi(e,t,n,r??1)}function qi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ks(qi,Dp,Ba(Ao,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new qi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ca:Math.pow(Ca,e),new qi(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 He(MI(e>=240?e-240:e+120,i,r),MI(e,i,r),MI(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new qi(jB(this.h),Ex(this.s),Ex(this.l),Dx(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=Dx(this.opacity);return`${e===1?"hsl(":"hsla("}${jB(this.h)}, ${Ex(this.s)*100}%, ${Ex(this.l)*100}%${e===1?")":`, ${e})`}`}}));function jB(e){return e=(e||0)%360,e<0?e+360:e}function Ex(e){return Math.max(0,Math.min(1,e||0))}function MI(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 Nx=Math.PI/180,Ox=180/Math.PI;var Lx=18,YB=.96422,XB=1,GB=.82521,WB=4/29,qu=6/29,HB=3*qu*qu,bG=qu*qu*qu;function ZB(e){if(e instanceof To)return new To(e.l,e.a,e.b,e.opacity);if(e instanceof Rs)return JB(e);e instanceof He||(e=Ep(e));var t=DI(e.r),n=DI(e.g),r=DI(e.b),i=AI((.2225045*t+.7168786*n+.0606169*r)/XB),o,s;return t===n&&n===r?o=s=i:(o=AI((.4360747*t+.3850649*n+.1430804*r)/YB),s=AI((.0139322*t+.0971045*n+.7141733*r)/GB)),new To(116*i-16,500*(o-i),200*(i-s),e.opacity)}function ju(e,t,n,r){return arguments.length===1?ZB(e):new To(e,t,n,r??1)}function To(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}ks(To,ju,Ba(Ao,{brighter(e){return new To(this.l+Lx*(e??1),this.a,this.b,this.opacity)},darker(e){return new To(this.l-Lx*(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=YB*TI(t),e=XB*TI(e),n=GB*TI(n),new He(EI(3.1338561*t-1.6168667*e-.4906146*n),EI(-.9787684*t+1.9161415*e+.033454*n),EI(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function AI(e){return e>bG?Math.pow(e,1/3):e/HB+WB}function TI(e){return e>qu?e*e*e:HB*(e-WB)}function EI(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function DI(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function wG(e){if(e instanceof Rs)return new Rs(e.h,e.c,e.l,e.opacity);if(e instanceof To||(e=ZB(e)),e.a===0&&e.b===0)return new Rs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Ox;return new Rs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Np(e,t,n,r){return arguments.length===1?wG(e):new Rs(e,t,n,r??1)}function Rs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function JB(e){if(isNaN(e.h))return new To(e.l,0,0,e.opacity);var t=e.h*Nx;return new To(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}ks(Rs,Np,Ba(Ao,{brighter(e){return new Rs(this.h,this.c,this.l+Lx*(e??1),this.opacity)},darker(e){return new Rs(this.h,this.c,this.l-Lx*(e??1),this.opacity)},rgb(){return JB(this).rgb()}}));var eC=-.14861,NI=1.78277,OI=-.29227,Bx=-.90649,Op=1.97294,QB=Op*Bx,KB=Op*NI,tC=NI*OI-Bx*eC;function vG(e){if(e instanceof il)return new il(e.h,e.s,e.l,e.opacity);e instanceof He||(e=Ep(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(tC*r+QB*t-KB*n)/(tC+QB-KB),o=r-i,s=(Op*(n-i)-OI*o)/Bx,a=Math.sqrt(s*s+o*o)/(Op*i*(1-i)),c=a?Math.atan2(s,o)*Ox-120:NaN;return new il(c<0?c+360:c,a,i,e.opacity)}function er(e,t,n,r){return arguments.length===1?vG(e):new il(e,t,n,r??1)}function il(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ks(il,er,Ba(Ao,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new il(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ca:Math.pow(Ca,e),new il(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Nx,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new He(255*(t+n*(eC*r+NI*i)),255*(t+n*(OI*r+Bx*i)),255*(t+n*(Op*r)),this.opacity)}}));function LI(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 nC(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 LI((n-r/t)*t,s,i,o,a)}}function rC(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 LI((n-r/t)*t,i,o,s,a)}}var Vu=e=>()=>e;function iC(e,t){return function(n){return e+n*t}}function _G(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 Yu(e,t){var n=t-e;return n?iC(e,n>180||n<-180?n-360*Math.round(n/360):n):Vu(isNaN(e)?t:e)}function oC(e){return(e=+e)==1?Te:function(t,n){return n-t?_G(t,n,e):Vu(isNaN(t)?n:t)}}function Te(e,t){var n=t-e;return n?iC(e,n):Vu(isNaN(e)?t:e)}var fi=function e(t){var n=oC(t);function r(i,o){var s=n((i=sn(i)).r,(o=sn(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Te(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 sC(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=sn(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 BI=sC(nC),SG=sC(rC);function aC(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 cC(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function lC(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 uC(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Se(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function fC(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 kI=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,CI=new RegExp(kI.source,"g");function IG(e){return function(){return e}}function MG(e){return function(t){return e(t)+""}}function Lp(e,t){var n=kI.lastIndex=CI.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=kI.exec(e))&&(i=CI.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:Se(r,i)})),n=CI.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?MG(c[0].x):IG(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"?Vu(t):(n==="number"?Se:n==="string"?(r=$r(t))?(t=r,fi):Lp:t instanceof $r?fi:t instanceof Date?uC:cC(t)?aC:Array.isArray(t)?lC:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?fC:Se)(e,t)}function ol(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var hC=180/Math.PI,Cx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function RI(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)*hC,skewX:Math.atan(c)*hC,scaleX:s,scaleY:a}}var kx;function dC(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Cx:RI(t.a,t.b,t.c,t.d,t.e,t.f)}function pC(e){return e==null?Cx:(kx||(kx=document.createElementNS("http://www.w3.org/2000/svg","g")),kx.setAttribute("transform",e),(e=kx.transform.baseVal.consolidate())?(e=e.matrix,RI(e.a,e.b,e.c,e.d,e.e,e.f)):Cx)}function mC(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,h,d,p){if(l!==f||u!==h){var m=d.push("translate(",null,t,null,n);p.push({i:m-4,x:Se(l,f)},{i:m-2,x:Se(u,h)})}else(f||h)&&d.push("translate("+f+t+h+n)}function s(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Se(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,h){l!==u?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Se(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,h,d,p){if(l!==f||u!==h){var m=d.push(i(d)+"scale(",null,",",null,")");p.push({i:m-4,x:Se(l,f)},{i:m-2,x:Se(u,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,h),s(l.rotate,u.rotate,f,h),a(l.skewX,u.skewX,f,h),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(d){for(var p=-1,m=h.length,y;++p<m;)f[(y=h[p]).i]=y.x(d);return f.join("")}}}var FI=mC(dC,"px, ","px)","deg)"),$I=mC(pC,", ",")",")");var AG=1e-12;function yC(e){return((e=Math.exp(e))+1/e)/2}function TG(e){return((e=Math.exp(e))-1/e)/2}function EG(e){return((e=Math.exp(2*e))-1)/(e+1)}var PI=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],h=s[2],d=u-a,p=f-c,m=d*d+p*p,y,g;if(m<AG)g=Math.log(h/l)/t,y=function(I){return[a+I*d,c+I*p,l*Math.exp(t*I*g)]};else{var x=Math.sqrt(m),b=(h*h-l*l+r*m)/(2*l*n*x),w=(h*h-l*l-r*m)/(2*h*n*x),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);g=(v-_)/t,y=function(I){var E=I*g,M=yC(_),N=l/(n*x)*(M*EG(t*E+_)-TG(_));return[a+N*d,c+N*p,l*M/yC(t*E+_)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function gC(e){return function(t,n){var r=e((t=Dp(t)).h,(n=Dp(n)).h),i=Te(t.s,n.s),o=Te(t.l,n.l),s=Te(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 UI=gC(Yu),DG=gC(Te);function Rx(e,t){var n=Te((e=ju(e)).l,(t=ju(t)).l),r=Te(e.a,t.a),i=Te(e.b,t.b),o=Te(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 xC(e){return function(t,n){var r=e((t=Np(t)).h,(n=Np(n)).h),i=Te(t.c,n.c),o=Te(t.l,n.l),s=Te(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 zI=xC(Yu),NG=xC(Te);function bC(e){return function t(n){n=+n;function r(i,o){var s=e((i=er(i)).h,(o=er(o)).h),a=Te(i.s,o.s),c=Te(i.l,o.l),l=Te(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 OG=bC(Yu),Xu=bC(Te);function Eo(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 $n(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Gu=0,Cp=0,Bp=0,vC=1e3,Fx,kp,$x=0,sl=0,Px=0,Rp=typeof performance=="object"&&performance.now?performance:Date,_C=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $p(){return sl||(_C(LG),sl=Rp.now()+Px)}function LG(){sl=0}function Fp(){this._call=this._time=this._next=null}Fp.prototype=Ux.prototype={constructor:Fp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?$p():+n)+(t==null?0:+t),!this._next&&kp!==this&&(kp?kp._next=this:Fx=this,kp=this),this._call=e,this._time=n,qI()},stop:function(){this._call&&(this._call=null,this._time=1/0,qI())}};function Ux(e,t,n){var r=new Fp;return r.restart(e,t,n),r}function SC(){$p(),++Gu;for(var e=Fx,t;e;)(t=sl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gu}function wC(){sl=($x=Rp.now())+Px,Gu=Cp=0;try{SC()}finally{Gu=0,CG(),sl=0}}function BG(){var e=Rp.now(),t=e-$x;t>vC&&(Px-=t,$x=e)}function CG(){for(var e,t=Fx,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:Fx=n);kp=e,qI(r)}function qI(e){if(!Gu){Cp&&(Cp=clearTimeout(Cp));var t=e-sl;t>24?(e<1/0&&(Cp=setTimeout(wC,e-Rp.now()-Px)),Bp&&(Bp=clearInterval(Bp))):(Bp||($x=Rp.now(),Bp=setInterval(BG,vC)),Gu=1,_C(wC))}}function zx(e,t,n){var r=new Fp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var kG=Kc("start","end","cancel","interrupt"),RG=[],AC=0,IC=1,jx=2,qx=3,MC=4,Vx=5,Pp=6;function ka(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;FG(e,n,{name:t,index:r,group:i,on:kG,tween:RG,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:AC})}function Up(e,t){var n=an(e,t);if(n.state>AC)throw new Error("too late; already scheduled");return n}function Nn(e,t){var n=an(e,t);if(n.state>qx)throw new Error("too late; already running");return n}function an(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function FG(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Ux(o,0,n.time);function o(l){n.state=IC,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,h,d;if(n.state!==IC)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===qx)return zx(s);d.state===MC?(d.state=Pp,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+u<t&&(d.state=Pp,d.timer.stop(),d.on.call("cancel",e,e.__data__,d.index,d.group),delete r[u])}if(zx(function(){n.state===qx&&(n.state=MC,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=jx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===jx){for(n.state=qx,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(d=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=d);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Vx,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===Vx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Pp,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Do(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>jx&&r.state<Vx,r.state=Pp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function TC(e){return this.each(function(){Do(this,e)})}function $G(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 PG(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 EC(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=an(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?$G:PG)(n,e,t))}function Wu(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 an(i,r).value[t]}}function Yx(e,t){var n;return(typeof t=="number"?Se:t instanceof $r?fi:(n=$r(t))?(t=n,fi):Lp)(e,t)}function UG(e){return function(){this.removeAttribute(e)}}function zG(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qG(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 jG(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 VG(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 YG(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 DC(e,t){var n=Ls(e),r=n==="transform"?$I:Yx;return this.attrTween(e,typeof t=="function"?(n.local?YG:VG)(n,r,Wu(this,"attr."+e,t)):t==null?(n.local?zG:UG)(n):(n.local?jG:qG)(n,r,t))}function XG(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function GG(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function WG(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&GG(e,o)),n}return i._value=t,i}function HG(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&XG(e,o)),n}return i._value=t,i}function NC(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=Ls(e);return this.tween(n,(r.local?WG:HG)(r,t))}function ZG(e,t){return function(){Up(this,e).delay=+t.apply(this,arguments)}}function JG(e,t){return t=+t,function(){Up(this,e).delay=t}}function OC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ZG:JG)(t,e)):an(this.node(),t).delay}function QG(e,t){return function(){Nn(this,e).duration=+t.apply(this,arguments)}}function KG(e,t){return t=+t,function(){Nn(this,e).duration=t}}function LC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?QG:KG)(t,e)):an(this.node(),t).duration}function tW(e,t){if(typeof t!="function")throw new Error;return function(){Nn(this,e).ease=t}}function BC(e){var t=this._id;return arguments.length?this.each(tW(t,e)):an(this.node(),t).ease}function eW(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Nn(this,e).ease=n}}function CC(e){if(typeof e!="function")throw new Error;return this.each(eW(this._id,e))}function kC(e){typeof e!="function"&&(e=Sp(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 nr(r,this._parents,this._name,this._id)}function RC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),h,d=0;d<u;++d)(h=c[d]||l[d])&&(f[d]=h);for(;a<r;++a)s[a]=t[a];return new nr(s,this._parents,this._name,this._id)}function nW(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 rW(e,t,n){var r,i,o=nW(t)?Up:Nn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function FC(e,t){var n=this._id;return arguments.length<2?an(this.node(),n).on.on(e):this.each(rW(n,e,t))}function iW(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $C(){return this.on("end.remove",iW(this._id))}function PC(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tl(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,h=0;h<c;++h)(u=a[h])&&(f=e.call(u,u.__data__,h,a))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,ka(l[h],t,n,h,l,an(u,n)));return new nr(o,this._parents,t,n)}function UC(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_p(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),d,p=an(u,n),m=0,y=h.length;m<y;++m)(d=h[m])&&ka(d,t,n,m,h,p);o.push(h),s.push(u)}return new nr(o,s,t,n)}var oW=Cs.prototype.constructor;function zC(){return new oW(this._groups,this._parents)}function sW(e,t){var n,r,i;return function(){var o=La(this,e),s=(this.style.removeProperty(e),La(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function qC(e){return function(){this.style.removeProperty(e)}}function aW(e,t,n){var r,i=n+"",o;return function(){var s=La(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function cW(e,t,n){var r,i,o;return function(){var s=La(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),La(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function lW(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=qC(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function jC(e,t,n){var r=(e+="")=="transform"?FI:Yx;return t==null?this.styleTween(e,sW(e,r)).on("end.style."+e,qC(e)):typeof t=="function"?this.styleTween(e,cW(e,r,Wu(this,"style."+e,t))).each(lW(this._id,e)):this.styleTween(e,aW(e,r,t),n).on("end.style."+e,null)}function uW(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function fW(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&uW(e,s,n)),r}return o._value=t,o}function VC(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,fW(e,t,n??""))}function hW(e){return function(){this.textContent=e}}function dW(e){return function(){var t=e(this);this.textContent=t??""}}function YC(e){return this.tween("text",typeof e=="function"?dW(Wu(this,"text",e)):hW(e==null?"":e+""))}function pW(e){return function(t){this.textContent=e.call(this,t)}}function mW(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&pW(i)),t}return r._value=e,r}function XC(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,mW(e))}function GC(){for(var e=this._name,t=this._id,n=Xx(),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=an(c,t);ka(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new nr(r,this._parents,e,n)}function WC(){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 yW=0;function nr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function HC(e){return Cs().transition(e)}function Xx(){return++yW}var Fs=Cs.prototype;nr.prototype=HC.prototype={constructor:nr,select:PC,selectAll:UC,selectChild:Fs.selectChild,selectChildren:Fs.selectChildren,filter:kC,merge:RC,selection:zC,transition:GC,call:Fs.call,nodes:Fs.nodes,node:Fs.node,size:Fs.size,empty:Fs.empty,each:Fs.each,on:FC,attr:DC,attrTween:NC,style:jC,styleTween:VC,text:YC,textTween:XC,remove:$C,tween:EC,delay:OC,duration:LC,ease:BC,easeVarying:CC,end:WC,[Symbol.iterator]:Fs[Symbol.iterator]};function Gx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gW={time:null,delay:0,duration:250,ease:Gx};function xW(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 ZC(e){var t,n;e instanceof nr?(t=e._id,e=e._name):(t=Xx(),(n=gW).time=$p(),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])&&ka(c,e,t,l,s,n||xW(c,t));return new nr(r,this._parents,e,t)}Cs.prototype.interrupt=TC;Cs.prototype.transition=ZC;var Wx=e=>()=>e;function jI(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 JC(e){e.stopImmediatePropagation()}function Hx(e){e.preventDefault(),e.stopImmediatePropagation()}var QC={name:"drag"},VI={name:"space"},Hu={name:"handle"},Zu={name:"center"},{abs:KC,max:Pn,min:Un}=Math;function tk(e){return[+e[0],+e[1]]}function XI(e){return[tk(e[0]),tk(e[1])]}var Zx={name:"x",handles:["w","e"].map(zp),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]]}},Jx={name:"y",handles:["n","s"].map(zp),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]]}},bW={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(zp),input:function(e){return e==null?null:XI(e)},output:function(e){return e}},$s={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"},ek={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},nk={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},wW={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},vW={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function zp(e){return{type:e}}function _W(e){return!e.ctrlKey&&!e.button}function SW(){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 IW(){return navigator.maxTouchPoints||"ontouchstart"in this}function YI(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function MW(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function GI(){return ZI(Zx)}function WI(){return ZI(Jx)}function HI(){return ZI(bW)}function ZI(e){var t=SW,n=_W,r=IW,i=!0,o=Kc("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([zp("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",$s.overlay).merge(g).each(function(){var b=YI(this).extent;Yt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),y.selectAll(".selection").data([zp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",$s.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return $s[b.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,x){y.tween?y.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,_=u(b,arguments),v=w.selection,I=e.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),E=Pr(v,I);function M(N){w.selection=N===1&&I===null?null:E(N),l.call(b),_.brush()}return v!==null&&I!==null?M:M(1)}):y.each(function(){var b=this,w=arguments,_=b.__brush,v=e.input(typeof g=="function"?g.apply(b,w):g,_.extent),I=u(b,w).beforestart();Do(b),_.selection=v===null?null:v,l.call(b),I.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Yt(this),g=YI(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,x){var b=y.__brush.emitter;return b&&(!x||!b.clean)?b:new f(y,g,x)}function f(y,g,x){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,x){var b=Yt(this.that).datum();o.call(y,this.that,new jI(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function h(y){if(a&&!y.touches||!n.apply(this,arguments))return;var g=this,x=y.target.__data__.type,b=(i&&y.metaKey?x="overlay":x)==="selection"?QC:i&&y.altKey?Zu:Hu,w=e===Jx?null:wW[x],_=e===Zx?null:vW[x],v=YI(g),I=v.extent,E=v.selection,M=I[0][0],N,A,O=I[0][1],C,S,T=I[1][0],D,R,F=I[1][1],k,$,P=0,U=0,W,nt=w&&_&&i&&y.shiftKey,ot,at,Y=Array.from(y.touches||[y],tt=>{let ce=tt.identifier;return tt=Fn(tt,g),tt.point0=tt.slice(),tt.identifier=ce,tt});Do(g);var st=u(g,arguments,!0).beforestart();if(x==="overlay"){E&&(W=!0);let tt=[Y[0],Y[1]||Y[0]];v.selection=E=[[N=e===Jx?M:Un(tt[0][0],tt[1][0]),C=e===Zx?O:Un(tt[0][1],tt[1][1])],[D=e===Jx?T:Pn(tt[0][0],tt[1][0]),k=e===Zx?F:Pn(tt[0][1],tt[1][1])]],Y.length>1&&Rt(y)}else N=E[0][0],C=E[0][1],D=E[1][0],k=E[1][1];A=N,S=C,R=D,$=k;var q=Yt(g).attr("pointer-events","none"),Z=q.selectAll(".overlay").attr("cursor",$s[x]);if(y.touches)st.moved=z,st.ended=ht;else{var rt=Yt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&rt.on("keydown.brush",Ht,!0).on("keyup.brush",Qt,!0),Mp(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ce of tt.changedTouches||[tt])for(let Ar of Y)Ar.identifier===ce.identifier&&(Ar.cur=Fn(ce,g));if(nt&&!ot&&!at&&Y.length===1){let ce=Y[0];KC(ce.cur[0]-ce[0])>KC(ce.cur[1]-ce[1])?at=!0:ot=!0}for(let ce of Y)ce.cur&&(ce[0]=ce.cur[0],ce[1]=ce.cur[1]);W=!0,Hx(tt),Rt(tt)}function Rt(tt){let ce=Y[0],Ar=ce.point0;var Ji;switch(P=ce[0]-Ar[0],U=ce[1]-Ar[1],b){case VI:case QC:{w&&(P=Pn(M-N,Un(T-D,P)),A=N+P,R=D+P),_&&(U=Pn(O-C,Un(F-k,U)),S=C+U,$=k+U);break}case Hu:{Y[1]?(w&&(A=Pn(M,Un(T,Y[0][0])),R=Pn(M,Un(T,Y[1][0])),w=1),_&&(S=Pn(O,Un(F,Y[0][1])),$=Pn(O,Un(F,Y[1][1])),_=1)):(w<0?(P=Pn(M-N,Un(T-N,P)),A=N+P,R=D):w>0&&(P=Pn(M-D,Un(T-D,P)),A=N,R=D+P),_<0?(U=Pn(O-C,Un(F-C,U)),S=C+U,$=k):_>0&&(U=Pn(O-k,Un(F-k,U)),S=C,$=k+U));break}case Zu:{w&&(A=Pn(M,Un(T,N-P*w)),R=Pn(M,Un(T,D+P*w))),_&&(S=Pn(O,Un(F,C-U*_)),$=Pn(O,Un(F,k+U*_)));break}}R<A&&(w*=-1,Ji=N,N=D,D=Ji,Ji=A,A=R,R=Ji,x in ek&&Z.attr("cursor",$s[x=ek[x]])),$<S&&(_*=-1,Ji=C,C=k,k=Ji,Ji=S,S=$,$=Ji,x in nk&&Z.attr("cursor",$s[x=nk[x]])),v.selection&&(E=v.selection),ot&&(A=E[0][0],R=E[1][0]),at&&(S=E[0][1],$=E[1][1]),(E[0][0]!==A||E[0][1]!==S||E[1][0]!==R||E[1][1]!==$)&&(v.selection=[[A,S],[R,$]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(JC(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Ap(tt.view,W),rt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),Z.attr("cursor",$s.overlay),v.selection&&(E=v.selection),MW(E)&&(v.selection=null,l.call(g)),st.end(tt,b.name)}function Ht(tt){switch(tt.keyCode){case 16:{nt=w&&_;break}case 18:{b===Hu&&(w&&(D=R-P*w,N=A+P*w),_&&(k=$-U*_,C=S+U*_),b=Zu,Rt(tt));break}case 32:{(b===Hu||b===Zu)&&(w<0?D=R-P:w>0&&(N=A-P),_<0?k=$-U:_>0&&(C=S-U),b=VI,Z.attr("cursor",$s.selection),Rt(tt));break}default:return}Hx(tt)}function Qt(tt){switch(tt.keyCode){case 16:{nt&&(ot=at=nt=!1,Rt(tt));break}case 18:{b===Zu&&(w<0?D=R:w>0&&(N=A),_<0?k=$:_>0&&(C=S),b=Hu,Rt(tt));break}case 32:{b===VI&&(tt.altKey?(w&&(D=R-P*w,N=A+P*w),_&&(k=$-U*_,C=S+U*_),b=Zu):(w<0?D=R:w>0&&(N=A),_<0?k=$:_>0&&(C=S),b=Hu),Z.attr("cursor",$s[x]),Rt(tt));break}default:return}Hx(tt)}}function d(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=XI(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Wx(XI(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:Wx(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Wx(!!y),c):r},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var JI=Math.PI,QI=2*JI,al=1e-6,AW=QI-al;function rk(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function TW(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return rk;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 Ra=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?rk:TW(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,h=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>al)if(!(Math.abs(f*c-l*u)>al)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let d=r-s,p=i-a,m=c*c+l*l,y=d*d+p*p,g=Math.sqrt(m),x=Math.sqrt(h),b=o*Math.tan((JI-Math.acos((m+h-y)/(2*g*x)))/2),w=b/x,_=b/g;Math.abs(w-1)>al&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*d>u*p)},${this._x1=t+_*c},${this._y1=n+_*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>al||Math.abs(this._y1-u)>al)&&this._append`L${l},${u}`,r&&(h<0&&(h=h%QI+QI),h>AW?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:h>al&&this._append`A${r},${r},0,${+(h>=JI)},${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 ik(){return new Ra}ik.prototype=Ra.prototype;function rr(e=3){return new Ra(+e)}var EW=Array.prototype,Qx=EW.slice;function ok(e,t){return e-t}function sk(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var No=e=>()=>e;function ak(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=DW(e,t[n]))return i;return 0}function DW(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],h=f[0],d=f[1];if(NW(c,f,t))return 0;u>r!=d>r&&n<(h-l)*(r-u)/(d-u)+l&&(i=-i)}return i}function NW(e,t,n){var r;return OW(e,t,n)&&LW(e[r=+(e[0]===t[0])],n[r],t[r])}function OW(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function LW(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function ck(){}var Ps=[[],[[[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 Fa(){var e=1,t=1,n=Na,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(ok);else{let f=ue(l,BW);for(u=En(...$u(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var h=[],d=[];return s(l,f,function(p){r(p,l,f),sk(p)>0?h.push([p]):d.push(p)}),d.forEach(function(p){for(var m=0,y=h.length,g;m<y;++m)if(ak((g=h[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:h}}function s(l,u,f){var h=new Array,d=new Array,p,m,y,g,x,b;for(p=m=-1,g=cl(l[0],u),Ps[g<<1].forEach(w);++p<e-1;)y=g,g=cl(l[p+1],u),Ps[y|g<<1].forEach(w);for(Ps[g<<0].forEach(w);++m<t-1;){for(p=-1,g=cl(l[m*e+e],u),x=cl(l[m*e],u),Ps[g<<1|x<<2].forEach(w);++p<e-1;)y=g,g=cl(l[m*e+e+p+1],u),b=x,x=cl(l[m*e+p+1],u),Ps[y|g<<1|x<<2|b<<3].forEach(w);Ps[g|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,Ps[x<<2].forEach(w);++p<e-1;)b=x,x=cl(l[m*e+p+1],u),Ps[x<<2|b<<3].forEach(w);Ps[x<<3].forEach(w);function w(_){var v=[_[0][0]+p,_[0][1]+m],I=[_[1][0]+p,_[1][1]+m],E=a(v),M=a(I),N,A;(N=d[E])?(A=h[M])?(delete d[N.end],delete h[A.start],N===A?(N.ring.push(I),f(N.ring)):h[N.start]=d[A.end]={start:N.start,end:A.end,ring:N.ring.concat(A.ring)}):(delete d[N.end],N.ring.push(I),d[N.end=M]=N):(N=h[M])?(A=d[E])?(delete h[N.start],delete d[A.end],N===A?(N.ring.push(I),f(N.ring)):h[A.start]=d[N.end]={start:A.start,end:N.end,ring:A.ring.concat(N.ring)}):(delete h[N.start],N.ring.unshift(v),h[N.start=E]=N):h[E]=d[M]={start:E,end:M,ring:[v,I]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(h){var d=h[0],p=h[1],m=d|0,y=p|0,g=KI(u[y*e+m]);d>0&&d<e&&m===d&&(h[0]=lk(d,KI(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(h[1]=lk(p,KI(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?No(Qx.call(l)):No(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:ck,i):r===c},i}function BW(e){return isFinite(e)?e:NaN}function cl(e,t){return e==null?!1:+e>=t}function KI(e){return e==null||isNaN(e=+e)?-1/0:e}function lk(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 CW(e){return e[0]}function kW(e){return e[1]}function RW(){return 1}function tM(){var e=CW,t=kW,n=RW,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=No(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),_=-1;for(let C of x){var v=(e(C,++_,x)+a)*w,I=(t(C,_,x)+a)*w,E=+n(C,_,x);if(E&&v>=0&&v<c&&I>=0&&I<l){var M=Math.floor(v),N=Math.floor(I),A=v-M-.5,O=I-N-.5;b[M+N*c]+=(1-A)*(1-O)*E,b[M+1+N*c]+=A*(1-O)*E,b[M+1+(N+1)*c]+=A*O*E,b[M+(N+1)*c]+=(1-A)*O*E}}return yp({data:b,width:c,height:l},o*w),b}function h(x){var b=f(x),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=En(Number.MIN_VALUE,Jt(b)/_,w)),Fa().size([c,l]).thresholds(w.map(v=>v*_))(b).map((v,I)=>(v.value=+w[I],d(v)))}h.contours=function(x){var b=f(x),w=Fa().size([c,l]),_=Math.pow(2,2*s),v=I=>{I=+I;var E=d(w.contour(b,I*_));return E.value=I,E};return Object.defineProperty(v,"max",{get:()=>Jt(b)/_}),v};function d(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,h}return h.x=function(x){return arguments.length?(e=typeof x=="function"?x:No(+x),h):e},h.y=function(x){return arguments.length?(t=typeof x=="function"?x:No(+x),h):t},h.weight=function(x){return arguments.length?(n=typeof x=="function"?x:No(+x),h):n},h.size=function(x){if(!arguments.length)return[r,i];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,i=w,g()},h.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),g()},h.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?No(Qx.call(x)):No(x),h):u},h.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,g()},h}var te=11102230246251565e-32,Ze=134217729,qp=(3+8*te)*te;function ll(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,h=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++h]);let d=0;if(f<e&&h<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++h]),o=s,a!==0&&(i[d++]=a);f<e&&h<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++h]),o=s,a!==0&&(i[d++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[d++]=a);for(;h<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++h],o=s,a!==0&&(i[d++]=a);return(o!==0||d===0)&&(i[d++]=o),d}function jp(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 FW=(3+16*te)*te,$W=(2+12*te)*te,PW=(9+64*te)*te*te,Ju=V(4),uk=V(8),fk=V(12),hk=V(16),ir=V(4);function UW(e,t,n,r,i,o,s){let a,c,l,u,f,h,d,p,m,y,g,x,b,w,_,v,I,E,M=e-i,N=n-i,A=t-o,O=r-o;w=M*O,h=Ze*M,d=h-(h-M),p=M-d,h=Ze*O,m=h-(h-O),y=O-m,_=p*y-(w-d*m-p*m-d*y),v=A*N,h=Ze*A,d=h-(h-A),p=A-d,h=Ze*N,m=h-(h-N),y=N-m,I=p*y-(v-d*m-p*m-d*y),g=_-I,f=_-g,Ju[0]=_-(g+f)+(f-I),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-v,f=b-g,Ju[1]=b-(g+f)+(f-v),E=x+g,f=E-x,Ju[2]=x-(E-f)+(g-f),Ju[3]=E;let C=jp(4,Ju),S=$W*s;if(C>=S||-C>=S||(f=e-M,a=e-(M+f)+(f-i),f=n-N,l=n-(N+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=PW*s+qp*Math.abs(C),C+=M*u+O*a-(A*l+N*c),C>=S||-C>=S))return C;w=a*O,h=Ze*a,d=h-(h-a),p=a-d,h=Ze*O,m=h-(h-O),y=O-m,_=p*y-(w-d*m-p*m-d*y),v=c*N,h=Ze*c,d=h-(h-c),p=c-d,h=Ze*N,m=h-(h-N),y=N-m,I=p*y-(v-d*m-p*m-d*y),g=_-I,f=_-g,ir[0]=_-(g+f)+(f-I),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-v,f=b-g,ir[1]=b-(g+f)+(f-v),E=x+g,f=E-x,ir[2]=x-(E-f)+(g-f),ir[3]=E;let T=ll(4,Ju,4,ir,uk);w=M*u,h=Ze*M,d=h-(h-M),p=M-d,h=Ze*u,m=h-(h-u),y=u-m,_=p*y-(w-d*m-p*m-d*y),v=A*l,h=Ze*A,d=h-(h-A),p=A-d,h=Ze*l,m=h-(h-l),y=l-m,I=p*y-(v-d*m-p*m-d*y),g=_-I,f=_-g,ir[0]=_-(g+f)+(f-I),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-v,f=b-g,ir[1]=b-(g+f)+(f-v),E=x+g,f=E-x,ir[2]=x-(E-f)+(g-f),ir[3]=E;let D=ll(T,uk,4,ir,fk);w=a*u,h=Ze*a,d=h-(h-a),p=a-d,h=Ze*u,m=h-(h-u),y=u-m,_=p*y-(w-d*m-p*m-d*y),v=c*l,h=Ze*c,d=h-(h-c),p=c-d,h=Ze*l,m=h-(h-l),y=l-m,I=p*y-(v-d*m-p*m-d*y),g=_-I,f=_-g,ir[0]=_-(g+f)+(f-I),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-v,f=b-g,ir[1]=b-(g+f)+(f-v),E=x+g,f=E-x,ir[2]=x-(E-f)+(g-f),ir[3]=E;let R=ll(D,fk,4,ir,hk);return hk[R-1]}function Qu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=FW*l?c:-UW(e,t,n,r,i,o,l)}var h2t=(7+56*te)*te,d2t=(3+28*te)*te,p2t=(26+288*te)*te*te,m2t=V(4),y2t=V(4),g2t=V(4),x2t=V(4),b2t=V(4),w2t=V(4),v2t=V(4),_2t=V(4),S2t=V(4),I2t=V(8),M2t=V(8),A2t=V(8),T2t=V(4),E2t=V(8),D2t=V(8),N2t=V(8),O2t=V(12),L2t=V(192),B2t=V(192);var R2t=(10+96*te)*te,F2t=(4+48*te)*te,$2t=(44+576*te)*te*te,P2t=V(4),U2t=V(4),z2t=V(4),q2t=V(4),j2t=V(4),V2t=V(4),Y2t=V(4),X2t=V(4),G2t=V(8),W2t=V(8),H2t=V(8),Z2t=V(8),J2t=V(8),Q2t=V(8),K2t=V(8),tSt=V(8),eSt=V(8),nSt=V(4),rSt=V(4),iSt=V(4),oSt=V(8),sSt=V(16),aSt=V(16),cSt=V(16),lSt=V(32),uSt=V(32),fSt=V(48),hSt=V(64),dSt=V(1152),pSt=V(1152);var xSt=(16+224*te)*te,bSt=(5+72*te)*te,wSt=(71+1408*te)*te*te,vSt=V(4),_St=V(4),SSt=V(4),ISt=V(4),MSt=V(4),ASt=V(4),TSt=V(4),ESt=V(4),DSt=V(4),NSt=V(4),OSt=V(24),LSt=V(24),BSt=V(24),CSt=V(24),kSt=V(24),RSt=V(24),FSt=V(24),$St=V(24),PSt=V(24),USt=V(24),zSt=V(1152),qSt=V(1152),jSt=V(1152),VSt=V(1152),YSt=V(1152),XSt=V(2304),GSt=V(2304),WSt=V(3456),HSt=V(5760),ZSt=V(8),JSt=V(8),QSt=V(8),KSt=V(16),tIt=V(24),eIt=V(48),nIt=V(48),rIt=V(96),iIt=V(192),oIt=V(384),sIt=V(384),aIt=V(384),cIt=V(768);var lIt=V(96),uIt=V(96),fIt=V(96),hIt=V(1152);var pk=Math.pow(2,-52),Kx=new Uint32Array(512),tf=class e{static from(t,n=XW,r=GW){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),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 M=0;M<s;M++){let N=t[2*M],A=t[2*M+1];N<a&&(a=N),A<c&&(c=A),N>l&&(l=N),A>u&&(u=A),this._ids[M]=M}let f=(a+l)/2,h=(c+u)/2,d,p,m;for(let M=0,N=1/0;M<s;M++){let A=eM(f,h,t[2*M],t[2*M+1]);A<N&&(d=M,N=A)}let y=t[2*d],g=t[2*d+1];for(let M=0,N=1/0;M<s;M++){if(M===d)continue;let A=eM(y,g,t[2*M],t[2*M+1]);A<N&&A>0&&(p=M,N=A)}let x=t[2*p],b=t[2*p+1],w=1/0;for(let M=0;M<s;M++){if(M===d||M===p)continue;let N=VW(y,g,x,b,t[2*M],t[2*M+1]);N<w&&(m=M,w=N)}let _=t[2*m],v=t[2*m+1];if(w===1/0){for(let A=0;A<s;A++)this._dists[A]=t[2*A]-t[0]||t[2*A+1]-t[1];Ku(this._ids,this._dists,0,s-1);let M=new Uint32Array(s),N=0;for(let A=0,O=-1/0;A<s;A++){let C=this._ids[A],S=this._dists[C];S>O&&(M[N++]=C,O=S)}this.hull=M.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Qu(y,g,x,b,_,v)<0){let M=p,N=x,A=b;p=m,x=_,b=v,m=M,_=N,v=A}let I=YW(y,g,x,b,_,v);this._cx=I.x,this._cy=I.y;for(let M=0;M<s;M++)this._dists[M]=eM(t[2*M],t[2*M+1],I.x,I.y);Ku(this._ids,this._dists,0,s-1),this._hullStart=d;let E=3;r[d]=n[m]=p,r[p]=n[d]=m,r[m]=n[p]=d,i[d]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=d,o[this._hashKey(x,b)]=p,o[this._hashKey(_,v)]=m,this.trianglesLen=0,this._addTriangle(d,p,m,-1,-1,-1);for(let M=0,N,A;M<this._ids.length;M++){let O=this._ids[M],C=t[2*O],S=t[2*O+1];if(M>0&&Math.abs(C-N)<=pk&&Math.abs(S-A)<=pk||(N=C,A=S,O===d||O===p||O===m))continue;let T=0;for(let $=0,P=this._hashKey(C,S);$<this._hashSize&&(T=o[(P+$)%this._hashSize],!(T!==-1&&T!==r[T]));$++);T=n[T];let D=T,R;for(;R=r[D],Qu(C,S,t[2*D],t[2*D+1],t[2*R],t[2*R+1])>=0;)if(D=R,D===T){D=-1;break}if(D===-1)continue;let F=this._addTriangle(D,O,r[D],-1,-1,i[D]);i[O]=this._legalize(F+2),i[D]=F,E++;let k=r[D];for(;R=r[k],Qu(C,S,t[2*k],t[2*k+1],t[2*R],t[2*R+1])<0;)F=this._addTriangle(k,O,R,i[O],-1,i[k]),i[O]=this._legalize(F+2),r[k]=k,E--,k=R;if(D===T)for(;R=n[D],Qu(C,S,t[2*R],t[2*R+1],t[2*D],t[2*D+1])<0;)F=this._addTriangle(R,O,D,-1,i[D],i[R]),this._legalize(F+2),i[R]=F,r[D]=D,E--,D=R;this._hullStart=n[O]=D,r[D]=n[k]=O,r[O]=k,o[this._hashKey(C,S)]=O,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(E);for(let M=0,N=this._hullStart;M<E;M++)this.hull[M]=N,N=r[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(qW(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=Kx[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,h=n[s],d=n[t],p=n[u],m=n[f];if(jW(i[2*h],i[2*h+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=h;let g=r[f];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,g),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<Kx.length&&(Kx[o++]=x)}else{if(o===0)break;t=Kx[--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 qW(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function eM(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function jW(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,h=i-s,d=o-a,p=c*c+l*l,m=u*u+f*f,y=h*h+d*d;return c*(f*y-m*d)-l*(u*y-m*h)+p*(u*d-f*h)<0}function VW(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,h=.5/(s*l-a*c),d=(l*u-a*f)*h,p=(s*f-c*u)*h;return d*d+p*p}function YW(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,h=.5/(s*l-a*c),d=e+(l*u-a*f)*h,p=t+(s*f-c*u)*h;return{x:d,y:p}}function Ku(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;Vp(e,i,o),t[e[n]]>t[e[r]]&&Vp(e,n,r),t[e[o]]>t[e[r]]&&Vp(e,o,r),t[e[n]]>t[e[o]]&&Vp(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;Vp(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Ku(e,t,o,r),Ku(e,t,n,s-1)):(Ku(e,t,n,s-1),Ku(e,t,o,r))}}function Vp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function XW(e){return e[0]}function GW(e){return e[1]}var hi=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 $a=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 Yp=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,y=0,g=r.length,x,b;m<g;m+=3,y+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,I=t[w],E=t[w+1],M=t[_],N=t[_+1],A=t[v],O=t[v+1],C=M-I,S=N-E,T=A-I,D=O-E,R=(C*D-S*T)*2;if(Math.abs(R)<1e-9){if(o===void 0){o=s=0;for(let k of n)o+=t[k*2],s+=t[k*2+1];o/=n.length,s/=n.length}let F=1e9*Math.sign((o-I)*D-(s-E)*T);x=(I+A)/2-F*D,b=(E+O)/2+F*T}else{let F=1/R,k=C*C+S*S,$=T*T+D*D;x=I+(D*k-S*$)*F,b=E+(C*$-T*k)*F}a[y]=x,a[y+1]=b}let c=n[n.length-1],l,u=c*4,f,h=t[2*c],d,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=h,d=p,u=c*4,h=t[2*c],p=t[2*c+1],i[l+2]=i[u]=d-p,i[l+3]=i[u+1]=h-f}render(t){let n=t==null?t=new hi:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let h=r[u];if(h<u)continue;let d=Math.floor(u/3)*2,p=Math.floor(h/3)*2,m=s[d],y=s[d+1],g=s[p],x=s[p+1];this._renderSegment(m,y,g,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,h=s[f],d=s[f+1],p=c*4,m=this._project(h,d,a[p+2],a[p+3]);m&&this._renderSegment(h,d,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new hi: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 hi: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 $a;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,h=0;for(let d=0;d<r;d+=2)if(o=a,s=c,a=n[d],c=n[d+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=h,h=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,x,m,y]=p,f=h,h=this._edgecode(m,y),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(m,y):i=[m,y]}f=h,h=this._edgecode(g,x),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(g,x):i=[g,x]}if(i)f=h,h=this._edgecode(i[0],i[1]),f&&h&&this._edge(t,f,h,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,h=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=h,h=this._edgecode(a[l],a[l+1]),f&&h&&(l=this._edge(t,f,h,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var WW=2*Math.PI,ef=Math.pow;function HW(e){return e[0]}function ZW(e){return e[1]}function JW(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 QW(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var di=class e{static from(t,n=HW,r=ZW,i){return new e("length"in t?KW(t,n,r,i):Float64Array.from(tH(t,n,r,i)))}constructor(t){this._delaunator=new tf(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&&JW(t)){this.collinear=Int32Array.from({length:n.length/2},(h,d)=>d).sort((h,d)=>n[2*h]-n[2*d]||n[2*h+1]-n[2*d+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let h=0,d=n.length/2;h<d;++h){let p=QW(n[2*h],n[2*h+1],f);n[2*h]=p[0],n[2*h+1]=p[1]}this._delaunator=new tf(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 Yp(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=ef(n-l[t*2],2)+ef(r-l[t*2+1],2),h=i[t],d=h;do{let p=c[d],m=ef(n-l[p*2],2)+ef(r-l[p*2+1],2);if(m<f&&(f=m,u=p),d=d%3===2?d-2:d+1,c[d]!==t)break;if(d=a[d],d===-1){if(d=o[(s[t]+1)%o.length],d!==p&&ef(n-l[d*2],2)+ef(r-l[d*2+1],2)<f)return d;break}}while(d!==h);return u}render(t){let n=t==null?t=new hi: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 hi: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,WW)}return r&&r.value()}renderHull(t){let n=t==null?t=new hi: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 $a;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new hi: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 $a;return this.renderTriangle(t,n),n.value()}};function KW(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*tH(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 mk(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ul(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 Oo(e){return e=ul(Math.abs(e)),e?e[1]:NaN}function yk(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 gk(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var eH=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Lo(e){if(!(t=eH.exec(e)))throw new Error("invalid format: "+e);var t;return new tb({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]})}Lo.prototype=tb.prototype;function tb(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+""}tb.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 xk(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 nM;function bk(e,t){var n=ul(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(nM=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")+ul(e,Math.max(0,t+o-1))[0]}function rM(e,t){var n=ul(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 iM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:mk,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)=>rM(e*100,t),r:rM,s:bk,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function oM(e){return e}var wk=Array.prototype.map,vk=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function _k(e){var t=e.grouping===void 0||e.thousands===void 0?oM:yk(wk.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?oM:gk(wk.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=Lo(f);var h=f.fill,d=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,x=f.comma,b=f.precision,w=f.trim,_=f.type;_==="n"?(x=!0,_="g"):iM[_]||(b===void 0&&(b=12),w=!0,_="g"),(y||h==="0"&&d==="=")&&(y=!0,h="0",d="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",I=m==="$"?r:/[%p]/.test(_)?s:"",E=iM[_],M=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function N(A){var O=v,C=I,S,T,D;if(_==="c")C=E(A)+C,A="";else{A=+A;var R=A<0||1/A<0;if(A=isNaN(A)?c:E(Math.abs(A),b),w&&(A=xk(A)),R&&+A==0&&p!=="+"&&(R=!1),O=(R?p==="("?p:a:p==="-"||p==="("?"":p)+O,C=(_==="s"?vk[8+nM/3]:"")+C+(R&&p==="("?")":""),M){for(S=-1,T=A.length;++S<T;)if(D=A.charCodeAt(S),48>D||D>57){C=(D===46?i+A.slice(S+1):A.slice(S))+C,A=A.slice(0,S);break}}}x&&!y&&(A=t(A,1/0));var F=O.length+A.length+C.length,k=F<g?new Array(g-F+1).join(h):"";switch(x&&y&&(A=t(k+A,k.length?g-C.length:1/0),k=""),d){case"<":A=O+A+C+k;break;case"=":A=O+k+A+C;break;case"^":A=k.slice(0,F=k.length>>1)+O+A+C+k.slice(F);break;default:A=k+O+A+C;break}return o(A)}return N.toString=function(){return f+""},N}function u(f,h){var d=l((f=Lo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Oo(h)/3)))*3,m=Math.pow(10,-p),y=vk[8+p/3];return function(g){return d(m*g)+y}}return{format:l,formatPrefix:u}}var eb,pi,nb;sM({thousands:",",grouping:[3],currency:["$",""]});function sM(e){return eb=_k(e),pi=eb.format,nb=eb.formatPrefix,eb}function aM(e){return Math.max(0,-Oo(Math.abs(e)))}function cM(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Oo(t)/3)))*3-Oo(Math.abs(e)))}function lM(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Oo(t)-Oo(e))+1}var et=1e-6,fl=1e-12,Lt=Math.PI,ye=Lt/2,uM=Lt/4,hn=Lt*2,$e=180/Lt,Xt=Lt/180,$t=Math.abs,mi=Math.atan,Je=Math.atan2,K=Math.cos,Xp=Math.ceil,rb=Math.exp;var ib=Math.hypot,hl=Math.log,ob=Math.pow,Q=Math.sin,zn=Math.sign||function(e){return e>0?1:e<0?-1:0},ge=Math.sqrt,nf=Math.tan;function sb(e){return e>1?0:e<-1?Lt:Math.acos(e)}function Ie(e){return e>1?ye:e<-1?-ye:Math.asin(e)}function Qe(){}function ab(e,t){e&&Ik.hasOwnProperty(e.type)&&Ik[e.type](e,t)}var Sk={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)}},Ik={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){fM(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)fM(n[r],t,0)},Polygon:function(e,t){Mk(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)Mk(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)ab(n[r],t)}};function fM(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 Mk(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)fM(e[n],t,1);t.polygonEnd()}function Ur(e,t){e&&Sk.hasOwnProperty(e.type)?Sk[e.type](e,t):ab(e,t)}function Gp(e){return[Je(e[1],e[0]),Ie(e[2])]}function Bo(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Q(t),Q(n)]}function Wp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function rf(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 cb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Hp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Zp(e){var t=ge(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Jp,lb,ub,fb,hb,db,pb,mb,hM,dM,pM,Ek,Dk,or,sr,ar,ji={sphere:Qe,point:mM,lineStart:Ak,lineEnd:Tk,polygonStart:function(){ji.lineStart=iH,ji.lineEnd=oH},polygonEnd:function(){ji.lineStart=Ak,ji.lineEnd=Tk}};function mM(e,t){e*=Xt,t*=Xt;var n=K(t);Qp(n*K(e),n*Q(e),Q(t))}function Qp(e,t,n){++Jp,ub+=(e-ub)/Jp,fb+=(t-fb)/Jp,hb+=(n-hb)/Jp}function Ak(){ji.point=nH}function nH(e,t){e*=Xt,t*=Xt;var n=K(t);or=n*K(e),sr=n*Q(e),ar=Q(t),ji.point=rH,Qp(or,sr,ar)}function rH(e,t){e*=Xt,t*=Xt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=Je(ge((s=sr*o-ar*i)*s+(s=ar*r-or*o)*s+(s=or*i-sr*r)*s),or*r+sr*i+ar*o);lb+=s,db+=s*(or+(or=r)),pb+=s*(sr+(sr=i)),mb+=s*(ar+(ar=o)),Qp(or,sr,ar)}function Tk(){ji.point=mM}function iH(){ji.point=sH}function oH(){Nk(Ek,Dk),ji.point=mM}function sH(e,t){Ek=e,Dk=t,e*=Xt,t*=Xt,ji.point=Nk;var n=K(t);or=n*K(e),sr=n*Q(e),ar=Q(t),Qp(or,sr,ar)}function Nk(e,t){e*=Xt,t*=Xt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=sr*o-ar*i,a=ar*r-or*o,c=or*i-sr*r,l=ib(s,a,c),u=Ie(l),f=l&&-u/l;hM.add(f*s),dM.add(f*a),pM.add(f*c),lb+=u,db+=u*(or+(or=r)),pb+=u*(sr+(sr=i)),mb+=u*(ar+(ar=o)),Qp(or,sr,ar)}function yM(e){Jp=lb=ub=fb=hb=db=pb=mb=0,hM=new Tn,dM=new Tn,pM=new Tn,Ur(e,ji);var t=+hM,n=+dM,r=+pM,i=ib(t,n,r);return i<fl&&(t=db,n=pb,r=mb,lb<et&&(t=ub,n=fb,r=hb),i=ib(t,n,r),i<fl)?[NaN,NaN]:[Je(n,t)*$e,Ie(r/i)*$e]}function Kp(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 gM(e,t){return $t(e)>Lt&&(e-=Math.round(e/hn)*hn),[e,t]}gM.invert=gM;function xM(e,t,n){return(e%=hn)?t||n?Kp(Lk(e),Bk(t,n)):Lk(e):t||n?Bk(t,n):gM}function Ok(e){return function(t,n){return t+=e,$t(t)>Lt&&(t-=Math.round(t/hn)*hn),[t,n]}}function Lk(e){var t=Ok(e);return t.invert=Ok(-e),t}function Bk(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,h=Q(c),d=h*n+u*r;return[Je(f*i-d*o,u*n-h*r),Ie(d*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,h=Q(c),d=h*i-f*o;return[Je(f*i+h*o,u*n+d*r),Ie(d*n-u*r)]},s}function Ck(e){e=xM(e[0]*Xt,e[1]*Xt,e.length>2?e[2]*Xt:0);function t(n){return n=e(n[0]*Xt,n[1]*Xt),n[0]*=$e,n[1]*=$e,n}return t.invert=function(n){return n=e.invert(n[0]*Xt,n[1]*Xt),n[0]*=$e,n[1]*=$e,n},t}function Rk(e,t,n,r,i,o){if(n){var s=K(t),a=Q(t),c=r*n;i==null?(i=t+r*hn,o=t-c/2):(i=kk(s,i),o=kk(s,o),(r>0?i<o:i>o)&&(i+=r*hn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Gp([s,-a*K(u),-a*Q(u)]),e.point(l[0],l[1])}}function kk(e,t){t=Bo(t),t[0]-=e,Zp(t);var n=sb(-t[1]);return((-t[2]<0?-n:n)+hn-et)%hn}function yb(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Qe,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function of(e,t){return $t(e[0]-t[0])<et&&$t(e[1]-t[1])<et}function gb(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 xb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],x;if(of(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*et}o.push(x=new gb(y,p,null,!0)),s.push(x.o=new gb(y,null,x,!1)),o.push(x=new gb(g,p,null,!1)),s.push(x.o=new gb(g,null,x,!0))}}),!!o.length){for(s.sort(t),Fk(o),Fk(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;u=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(u=h.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,u=h.z,d=!d}while(!h.v);i.lineEnd()}}}function Fk(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 bM(e){return $t(e[0])<=Lt?e[0]:zn(e[0])*(($t(e[0])+Lt)%hn-Lt)}function $k(e,t){var n=bM(t),r=t[1],i=Q(r),o=[Q(n),-K(n),0],s=0,a=0,c=new Tn;i===1?r=ye+et:i===-1&&(r=-ye-et);for(var l=0,u=e.length;l<u;++l)if(h=(f=e[l]).length)for(var f,h,d=f[h-1],p=bM(d),m=d[1]/2+uM,y=Q(m),g=K(m),x=0;x<h;++x,p=w,y=v,g=I,d=b){var b=f[x],w=bM(b),_=b[1]/2+uM,v=Q(_),I=K(_),E=w-p,M=E>=0?1:-1,N=M*E,A=N>Lt,O=y*v;if(c.add(Je(O*M*Q(N),g*I+O*K(N))),s+=A?E+M*hn:E,A^p>=n^w>=n){var C=rf(Bo(d),Bo(b));Zp(C);var S=rf(o,C);Zp(S);var T=(A^E>=0?-1:1)*Ie(S[2]);(r>T||r===T&&(C[0]||C[1]))&&(a+=A^E>=0?1:-1)}}return(s<-et||s<et&&c<-fl)^a&1}function bb(e,t,n,r){return function(i){var o=t(i),s=yb(),a=t(s),c=!1,l,u,f,h={point:d,lineStart:m,lineEnd:y,polygonStart:function(){h.point=g,h.lineStart=x,h.lineEnd=b,u=[],l=[]},polygonEnd:function(){h.point=d,h.lineStart=m,h.lineEnd=y,u=Pu(u);var w=$k(l,r);u.length?(c||(i.polygonStart(),c=!0),xb(u,cH,w,n,i)):w&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(w,_){e(w,_)&&i.point(w,_)}function p(w,_){o.point(w,_)}function m(){h.point=p,o.lineStart()}function y(){h.point=d,o.lineEnd()}function g(w,_){f.push([w,_]),a.point(w,_)}function x(){a.lineStart(),f=[]}function b(){g(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,I=_.length,E,M,N;if(f.pop(),l.push(f),f=null,!!I){if(w&1){if(M=_[0],(E=M.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),v=0;v<E;++v)i.point((N=M[v])[0],N[1]);i.lineEnd()}return}I>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(aH))}}return h}}function aH(e){return e.length>1}function cH(e,t){return((e=e.x)[0]<0?e[1]-ye-et:ye-e[1])-((t=t.x)[0]<0?t[1]-ye-et:ye-t[1])}var wM=bb(function(){return!0},lH,fH,[-Lt,-ye]);function lH(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Lt:-Lt,c=$t(o-t);$t(c-Lt)<et?(e.point(t,n=(n+s)/2>0?ye:-ye),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Lt&&($t(t-r)<et&&(t-=r*et),$t(o-a)<et&&(o-=a*et),n=uH(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 uH(e,t,n,r){var i,o,s=Q(e-n);return $t(s)>et?mi((Q(t)*(o=K(r))*Q(n)-Q(r)*(i=K(t))*Q(e))/(i*o*s)):(t+r)/2}function fH(e,t,n,r){var i;if(e==null)i=n*ye,r.point(-Lt,i),r.point(0,i),r.point(Lt,i),r.point(Lt,0),r.point(Lt,-i),r.point(0,-i),r.point(-Lt,-i),r.point(-Lt,0),r.point(-Lt,i);else if($t(e[0]-t[0])>et){var o=e[0]<t[0]?Lt:-Lt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function Pk(e){var t=K(e),n=6*Xt,r=t>0,i=$t(t)>et;function o(u,f,h,d){Rk(d,e,n,h,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,h,d,p,m;return{lineStart:function(){p=d=!1,m=1},point:function(y,g){var x=[y,g],b,w=s(y,g),_=r?w?0:l(y,g):w?l(y+(y<0?Lt:-Lt),g):0;if(!f&&(p=d=w)&&u.lineStart(),w!==d&&(b=c(f,x),(!b||of(f,b)||of(x,b))&&(x[2]=1)),w!==d)m=0,w?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&r^w){var v;!(_&h)&&(v=c(x,f,!0))&&(m=0,r?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1],3)))}w&&(!f||!of(f,x))&&u.point(x[0],x[1]),f=x,d=w,h=_},lineEnd:function(){d&&u.lineEnd(),f=null},clean:function(){return m|(p&&d)<<1}}}function c(u,f,h){var d=Bo(u),p=Bo(f),m=[1,0,0],y=rf(d,p),g=Wp(y,y),x=y[0],b=g-x*x;if(!b)return!h&&u;var w=t*g/b,_=-t*x/b,v=rf(m,y),I=Hp(m,w),E=Hp(y,_);cb(I,E);var M=v,N=Wp(I,M),A=Wp(M,M),O=N*N-A*(Wp(I,I)-1);if(!(O<0)){var C=ge(O),S=Hp(M,(-N-C)/A);if(cb(S,I),S=Gp(S),!h)return S;var T=u[0],D=f[0],R=u[1],F=f[1],k;D<T&&(k=T,T=D,D=k);var $=D-T,P=$t($-Lt)<et,U=P||$<et;if(!P&&F<R&&(k=R,R=F,F=k),U?P?R+F>0^S[1]<($t(S[0]-T)<et?R:F):R<=S[1]&&S[1]<=F:$>Lt^(T<=S[0]&&S[0]<=D)){var W=Hp(M,(-N+C)/A);return cb(W,I),[S,Gp(W)]}}}function l(u,f){var h=r?e:Lt-e,d=0;return u<-h?d|=1:u>h&&(d|=2),f<-h?d|=4:f>h&&(d|=8),d}return bb(s,a,o,r?[0,-e]:[-Lt,e-Lt])}function Uk(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,h=c-s,d=l-a,p;if(p=n-s,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*h,e[1]=a+u*d),f<1&&(t[0]=s+f*h,t[1]=a+f*d),!0}}}}}var tm=1e9,wb=-tm;function sf(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,h){var d=0,p=0;if(l==null||(d=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do h.point(d===0||d===3?e:n,d>1?r:t);while((d=(d+f+4)%4)!==p);else h.point(u[0],u[1])}function s(l,u){return $t(l[0]-e)<et?u>0?0:3:$t(l[0]-n)<et?u>0?2:1:$t(l[1]-t)<et?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),h=s(u,1);return f!==h?f-h:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=yb(),h,d,p,m,y,g,x,b,w,_,v,I={point:E,lineStart:O,lineEnd:C,polygonStart:N,polygonEnd:A};function E(T,D){i(T,D)&&u.point(T,D)}function M(){for(var T=0,D=0,R=d.length;D<R;++D)for(var F=d[D],k=1,$=F.length,P=F[0],U,W,nt=P[0],ot=P[1];k<$;++k)U=nt,W=ot,P=F[k],nt=P[0],ot=P[1],W<=r?ot>r&&(nt-U)*(r-W)>(ot-W)*(e-U)&&++T:ot<=r&&(nt-U)*(r-W)<(ot-W)*(e-U)&&--T;return T}function N(){u=f,h=[],d=[],v=!0}function A(){var T=M(),D=v&&T,R=(h=Pu(h)).length;(D||R)&&(l.polygonStart(),D&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),R&&xb(h,a,T,o,l),l.polygonEnd()),u=l,h=d=p=null}function O(){I.point=S,d&&d.push(p=[]),_=!0,w=!1,x=b=NaN}function C(){h&&(S(m,y),g&&w&&f.rejoin(),h.push(f.result())),I.point=E,w&&u.lineEnd()}function S(T,D){var R=i(T,D);if(d&&p.push([T,D]),_)m=T,y=D,g=R,_=!1,R&&(u.lineStart(),u.point(T,D));else if(R&&w)u.point(T,D);else{var F=[x=Math.max(wb,Math.min(tm,x)),b=Math.max(wb,Math.min(tm,b))],k=[T=Math.max(wb,Math.min(tm,T)),D=Math.max(wb,Math.min(tm,D))];Uk(F,k,e,t,n,r)?(w||(u.lineStart(),u.point(F[0],F[1])),u.point(k[0],k[1]),R||u.lineEnd(),v=!1):R&&(u.lineStart(),u.point(T,D),v=!1)}x=T,b=D,w=R}return I}}function zk(e,t,n){var r=Ue(e,t-et,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function qk(e,t,n){var r=Ue(e,t-et,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function vM(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,h,d,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:x()}}function x(){return Ue(Xp(r/u)*u,n,u).map(p).concat(Ue(Xp(a/f)*f,s,f).map(m)).concat(Ue(Xp(t/c)*c,e,c).filter(function(b){return $t(b%u)>et}).map(h)).concat(Ue(Xp(o/l)*l,i,l).filter(function(b){return $t(b%f)>et}).map(d))}return g.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),g.precision(y)):[[r,a],[n,s]]},g.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),g.precision(y)):[[t,o],[e,i]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],g):[u,f]},g.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],g):[c,l]},g.precision=function(b){return arguments.length?(y=+b,h=zk(o,i,90),d=qk(t,e,y),p=zk(a,s,90),m=qk(r,n,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function _M(){return vM()()}var em=e=>e;var SM=new Tn,IM=new Tn,jk,Vk,MM,AM,Pa={point:Qe,lineStart:Qe,lineEnd:Qe,polygonStart:function(){Pa.lineStart=hH,Pa.lineEnd=pH},polygonEnd:function(){Pa.lineStart=Pa.lineEnd=Pa.point=Qe,SM.add($t(IM)),IM=new Tn},result:function(){var e=SM/2;return SM=new Tn,e}};function hH(){Pa.point=dH}function dH(e,t){Pa.point=Yk,jk=MM=e,Vk=AM=t}function Yk(e,t){IM.add(AM*e-MM*t),MM=e,AM=t}function pH(){Yk(jk,Vk)}var TM=Pa;var af=1/0,vb=af,nm=-af,_b=nm,mH={point:yH,lineStart:Qe,lineEnd:Qe,polygonStart:Qe,polygonEnd:Qe,result:function(){var e=[[af,vb],[nm,_b]];return nm=_b=-(vb=af=1/0),e}};function yH(e,t){e<af&&(af=e),e>nm&&(nm=e),t<vb&&(vb=t),t>_b&&(_b=t)}var cf=mH;var EM=0,DM=0,rm=0,Sb=0,Ib=0,lf=0,NM=0,OM=0,im=0,Wk,Hk,Co,ko,Vi={point:dl,lineStart:Xk,lineEnd:Gk,polygonStart:function(){Vi.lineStart=bH,Vi.lineEnd=wH},polygonEnd:function(){Vi.point=dl,Vi.lineStart=Xk,Vi.lineEnd=Gk},result:function(){var e=im?[NM/im,OM/im]:lf?[Sb/lf,Ib/lf]:rm?[EM/rm,DM/rm]:[NaN,NaN];return EM=DM=rm=Sb=Ib=lf=NM=OM=im=0,e}};function dl(e,t){EM+=e,DM+=t,++rm}function Xk(){Vi.point=gH}function gH(e,t){Vi.point=xH,dl(Co=e,ko=t)}function xH(e,t){var n=e-Co,r=t-ko,i=ge(n*n+r*r);Sb+=i*(Co+e)/2,Ib+=i*(ko+t)/2,lf+=i,dl(Co=e,ko=t)}function Gk(){Vi.point=dl}function bH(){Vi.point=vH}function wH(){Zk(Wk,Hk)}function vH(e,t){Vi.point=Zk,dl(Wk=Co=e,Hk=ko=t)}function Zk(e,t){var n=e-Co,r=t-ko,i=ge(n*n+r*r);Sb+=i*(Co+e)/2,Ib+=i*(ko+t)/2,lf+=i,i=ko*e-Co*t,NM+=i*(Co+e),OM+=i*(ko+t),im+=i*3,dl(Co=e,ko=t)}var LM=Vi;function Mb(e){this._context=e}Mb.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,hn);break}}},result:Qe};var CM=new Tn,BM,Jk,Qk,om,sm,Ab={point:Qe,lineStart:function(){Ab.point=_H},lineEnd:function(){BM&&Kk(Jk,Qk),Ab.point=Qe},polygonStart:function(){BM=!0},polygonEnd:function(){BM=null},result:function(){var e=+CM;return CM=new Tn,e}};function _H(e,t){Ab.point=Kk,Jk=om=e,Qk=sm=t}function Kk(e,t){om-=e,sm-=t,CM.add(ge(om*om+sm*sm)),om=e,sm=t}var kM=Ab;var tR,Tb,eR,nR,uf=class{constructor(t){this._append=t==null?rR:SH(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!==eR||this._append!==Tb){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`,eR=r,Tb=this._append,nR=this._,this._=i}this._+=nR;break}}}result(){let t=this._;return this._="",t.length?t:null}};function rR(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function SH(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return rR;if(t!==tR){let n=10**t;tR=t,Tb=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 Tb}function On(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Ur(a,i(o))),o.result()}return s.area=function(a){return Ur(a,i(TM)),TM.result()},s.measure=function(a){return Ur(a,i(kM)),kM.result()},s.bounds=function(a){return Ur(a,i(cf)),cf.result()},s.centroid=function(a){return Ur(a,i(LM)),LM.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,em):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new uf(n)):new Mb(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 uf(n)),s},s.projection(e).digits(n).context(t)}function pl(e){return{stream:ff(e)}}function ff(e){return function(t){var n=new RM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function RM(){}RM.prototype={constructor:RM,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 FM(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ur(n,e.stream(cf)),t(cf.result()),r!=null&&e.clipExtent(r),e}function am(e,t,n){return FM(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 Eb(e,t,n){return am(e,[[0,0],t],n)}function Db(e,t,n){return FM(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 Nb(e,t,n){return FM(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 iR=16,IH=K(30*Xt);function $M(e,t){return+t?AH(e,t):MH(e)}function MH(e){return ff({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function AH(e,t){function n(r,i,o,s,a,c,l,u,f,h,d,p,m,y){var g=l-r,x=u-i,b=g*g+x*x;if(b>4*t&&m--){var w=s+h,_=a+d,v=c+p,I=ge(w*w+_*_+v*v),E=Ie(v/=I),M=$t($t(v)-1)<et||$t(o-f)<et?(o+f)/2:Je(_,w),N=e(M,E),A=N[0],O=N[1],C=A-r,S=O-i,T=x*C-g*S;(T*T/b>t||$t((g*C+x*S)/b-.5)>.3||s*h+a*d+c*p<IH)&&(n(r,i,o,s,a,c,A,O,M,w/=I,_/=I,v,m,y),y.point(A,O),n(A,O,M,w,_,v,l,u,f,h,d,p,m,y))}}return function(r){var i,o,s,a,c,l,u,f,h,d,p,m,y={point:g,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),y.lineStart=_},polygonEnd:function(){r.polygonEnd(),y.lineStart=x}};function g(E,M){E=e(E,M),r.point(E[0],E[1])}function x(){f=NaN,y.point=b,r.lineStart()}function b(E,M){var N=Bo([E,M]),A=e(E,M);n(f,h,u,d,p,m,f=A[0],h=A[1],u=E,d=N[0],p=N[1],m=N[2],iR,r),r.point(f,h)}function w(){y.point=g,r.lineEnd()}function _(){x(),y.point=v,y.lineEnd=I}function v(E,M){b(i=E,M),o=f,s=h,a=d,c=p,l=m,y.point=b}function I(){n(f,h,u,d,p,m,o,s,i,a,c,l,iR,r),y.lineEnd=w,w()}return y}}var TH=ff({point:function(e,t){this.stream.point(e*Xt,t*Xt)}});function EH(e){return ff({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function DH(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 oR(e,t,n,r,i,o){if(!o)return DH(e,t,n,r,i);var s=K(o),a=Q(o),c=s*e,l=a*e,u=s/e,f=a/e,h=(a*n-s*t)/e,d=(a*t+s*n)/e;function p(m,y){return m*=r,y*=i,[c*m-l*y+t,n-l*m-c*y]}return p.invert=function(m,y){return[r*(u*m-f*y+h),i*(d-f*m-u*y)]},p}function Ln(e){return PM(function(){return e})()}function PM(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,h=1,d=1,p=null,m=wM,y=null,g,x,b,w=em,_=.5,v,I,E,M,N;function A(T){return E(T[0]*Xt,T[1]*Xt)}function O(T){return T=E.invert(T[0],T[1]),T&&[T[0]*$e,T[1]*$e]}A.stream=function(T){return M&&N===T?M:M=TH(EH(u)(m(v(w(N=T)))))},A.preclip=function(T){return arguments.length?(m=T,p=void 0,S()):m},A.postclip=function(T){return arguments.length?(w=T,y=g=x=b=null,S()):w},A.clipAngle=function(T){return arguments.length?(m=+T?Pk(p=T*Xt):(p=null,wM),S()):p*$e},A.clipExtent=function(T){return arguments.length?(w=T==null?(y=g=x=b=null,em):sf(y=+T[0][0],g=+T[0][1],x=+T[1][0],b=+T[1][1]),S()):y==null?null:[[y,g],[x,b]]},A.scale=function(T){return arguments.length?(n=+T,C()):n},A.translate=function(T){return arguments.length?(r=+T[0],i=+T[1],C()):[r,i]},A.center=function(T){return arguments.length?(o=T[0]%360*Xt,s=T[1]%360*Xt,C()):[o*$e,s*$e]},A.rotate=function(T){return arguments.length?(a=T[0]%360*Xt,c=T[1]%360*Xt,l=T.length>2?T[2]%360*Xt:0,C()):[a*$e,c*$e,l*$e]},A.angle=function(T){return arguments.length?(f=T%360*Xt,C()):f*$e},A.reflectX=function(T){return arguments.length?(h=T?-1:1,C()):h<0},A.reflectY=function(T){return arguments.length?(d=T?-1:1,C()):d<0},A.precision=function(T){return arguments.length?(v=$M(I,_=T*T),S()):ge(_)},A.fitExtent=function(T,D){return am(A,T,D)},A.fitSize=function(T,D){return Eb(A,T,D)},A.fitWidth=function(T,D){return Db(A,T,D)},A.fitHeight=function(T,D){return Nb(A,T,D)};function C(){var T=oR(n,0,0,h,d,f).apply(null,t(o,s)),D=oR(n,r-T[0],i-T[1],h,d,f);return u=xM(a,c,l),I=Kp(t,D),E=Kp(u,I),v=$M(I,_),S()}function S(){return M=N=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&O,C()}}function hf(e){var t=0,n=Lt/3,r=PM(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*Xt,n=o[1]*Xt):[t*$e,n*$e]},i}function sR(e){var t=K(e);function n(r,i){return[r*t,Q(i)/t]}return n.invert=function(r,i){return[r/t,Ie(i*t)]},n}function aR(e,t){var n=Q(e),r=(n+Q(t))/2;if($t(r)<et)return sR(e);var i=1+n*(2*r-n),o=ge(i)/r;function s(a,c){var l=ge(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=Je(a,$t(l))*zn(l);return l*r<0&&(u-=Lt*zn(a)*zn(l)),[u/r,Ie((i-(a*a+l*l)*r*r)/(2*r))]},s}function Ua(){return hf(aR).scale(155.424).center([0,33.6442])}function cm(){return Ua().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function NH(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 UM(){var e,t,n=cm(),r,i=Ua().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Ua().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(h,d){c=[h,d]}};function u(h){var d=h[0],p=h[1];return c=null,r.point(d,p),c||(o.point(d,p),c)||(a.point(d,p),c)}u.invert=function(h){var d=n.scale(),p=n.translate(),m=(h[0]-p[0])/d,y=(h[1]-p[1])/d;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=NH([n.stream(t=h),i.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),i.precision(h),s.precision(h),f()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),i.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var d=n.scale(),p=+h[0],m=+h[1];return r=n.translate(h).clipExtent([[p-.455*d,m-.238*d],[p+.455*d,m+.238*d]]).stream(l),o=i.translate([p-.307*d,m+.201*d]).clipExtent([[p-.425*d+et,m+.12*d+et],[p-.214*d-et,m+.234*d-et]]).stream(l),a=s.translate([p-.205*d,m+.212*d]).clipExtent([[p-.214*d+et,m+.166*d+et],[p-.115*d-et,m+.234*d-et]]).stream(l),f()},u.fitExtent=function(h,d){return am(u,h,d)},u.fitSize=function(h,d){return Eb(u,h,d)},u.fitWidth=function(h,d){return Db(u,h,d)},u.fitHeight=function(h,d){return Nb(u,h,d)};function f(){return e=t=null,u}return u.scale(1070)}function Ob(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 Ro(e){return function(t,n){var r=ge(t*t+n*n),i=e(r),o=Q(i),s=K(i);return[Je(t*o,r*s),Ie(r&&n*o/r)]}}var zM=Ob(function(e){return ge(2/(1+e))});zM.invert=Ro(function(e){return 2*Ie(e/2)});function qM(){return Ln(zM).scale(124.75).clipAngle(180-.001)}var jM=Ob(function(e){return(e=sb(e))&&e/Q(e)});jM.invert=Ro(function(e){return e});function VM(){return Ln(jM).scale(79.4188).clipAngle(180-.001)}function df(e,t){return[e,hl(nf((ye+t)/2))]}df.invert=function(e,t){return[e,2*mi(rb(t))-ye]};function YM(){return XM(df).scale(961/hn)}function XM(e){var t=Ln(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=Lt*r(),h=t(Ck(t.rotate()).invert([0,0]));return o(s==null?[[h[0]-f,h[1]-f],[h[0]+f,h[1]+f]]:e===df?[[Math.max(h[0]-f,s),a],[Math.min(h[0]+f,c),l]]:[[s,Math.max(h[1]-f,a)],[c,Math.min(h[1]+f,l)]])}return u()}function Lb(e){return nf((ye+e)/2)}function cR(e,t){var n=K(e),r=e===t?Q(e):hl(n/K(t))/hl(Lb(t)/Lb(e)),i=n*ob(Lb(e),r)/r;if(!r)return df;function o(s,a){i>0?a<-ye+et&&(a=-ye+et):a>ye-et&&(a=ye-et);var c=i/ob(Lb(a),r);return[c*Q(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=zn(r)*ge(s*s+c*c),u=Je(s,$t(c))*zn(c);return c*r<0&&(u-=Lt*zn(s)*zn(c)),[u/r,2*mi(ob(i/l,1/r))-ye]},o}function GM(){return hf(cR).scale(109.5).parallels([30,30])}function pf(e,t){return[e,t]}pf.invert=pf;function WM(){return Ln(pf).scale(152.63)}function lR(e,t){var n=K(e),r=e===t?Q(e):(n-K(t))/(t-e),i=n/r+e;if($t(r)<et)return pf;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=Je(s,$t(c))*zn(c);return c*r<0&&(l-=Lt*zn(s)*zn(c)),[l/r,i-zn(r)*ge(s*s+c*c)]},o}function HM(){return hf(lR).scale(131.154).center([0,13.9389])}var lm=1.340264,um=-.081106,fm=893e-6,hm=.003796,Bb=ge(3)/2,OH=12;function ZM(e,t){var n=Ie(Bb*Q(t)),r=n*n,i=r*r*r;return[e*K(n)/(Bb*(lm+3*um*r+i*(7*fm+9*hm*r))),n*(lm+um*r+i*(fm+hm*r))]}ZM.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<OH&&(a=n*(lm+um*r+i*(fm+hm*r))-t,c=lm+3*um*r+i*(7*fm+9*hm*r),n-=s=a/c,r=n*n,i=r*r*r,!($t(s)<fl));++o);return[Bb*e*(lm+3*um*r+i*(7*fm+9*hm*r))/K(n),Ie(Q(n)/Bb)]};function JM(){return Ln(ZM).scale(177.158)}function QM(e,t){var n=K(t),r=K(e)*n;return[n*Q(e)/r,Q(t)/r]}QM.invert=Ro(mi);function KM(){return Ln(QM).scale(144.049).clipAngle(60)}function tA(e,t){return[K(t)*Q(e),Q(t)]}tA.invert=Ro(Ie);function eA(){return Ln(tA).scale(249.5).clipAngle(90+et)}function nA(e,t){var n=K(t),r=1+K(e)*n;return[n*Q(e)/r,Q(t)/r]}nA.invert=Ro(function(e){return 2*mi(e)});function rA(){return Ln(nA).scale(250).clipAngle(142)}function iA(e,t){return[hl(nf((ye+t)/2)),-e]}iA.invert=function(e,t){return[-t,2*mi(rb(e))-ye]};function oA(){var e=XM(iA),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 LH(e,t){return e.parent===t.parent?1:2}function BH(e){return e.reduce(CH,0)/e.length}function CH(e,t){return e+t.x}function kH(e){return 1+e.reduce(RH,0)}function RH(e,t){return Math.max(e,t.y)}function FH(e){for(var t;t=e.children;)e=t[0];return e}function $H(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Cb(){var e=LH,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(h){var d=h.children;d?(h.x=BH(d),h.y=kH(d)):(h.x=s?a+=e(h,s):0,h.y=0,s=h)});var c=FH(o),l=$H(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(h){h.x=(h.x-o.x)*t,h.y=(o.y-h.y)*n}:function(h){h.x=(h.x-u)/(f-u)*t,h.y=(1-(o.y?h.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function PH(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 uR(){return this.eachAfter(PH)}function fR(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function hR(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 dR(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 pR(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function mR(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 yR(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function gR(e){for(var t=this,n=UH(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 UH(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 xR(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function bR(){return Array.from(this)}function wR(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function vR(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*_R(){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 sA(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=jH)):t===void 0&&(t=qH);for(var n=new za(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 za(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(aA)}function zH(){return sA(this).eachBefore(VH)}function qH(e){return e.children}function jH(e){return Array.isArray(e)?e[1]:null}function VH(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function aA(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function za(e){this.data=e,this.depth=this.height=0,this.parent=null}za.prototype=sA.prototype={constructor:za,count:uR,each:fR,eachAfter:dR,eachBefore:hR,find:pR,sum:mR,sort:yR,path:gR,ancestors:xR,descendants:bR,leaves:wR,links:vR,copy:zH,[Symbol.iterator]:_R};function kb(e){return e==null?null:YH(e)}function YH(e){if(typeof e!="function")throw new Error;return e}var XH={depth:-1},SR={},cA={};function GH(e){return e.id}function WH(e){return e.parentId}function Rb(){var e=GH,t=WH,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,h,d,p,m,y=new Map;if(n!=null){let g=o.map((w,_)=>HH(n(w,_,i))),x=g.map(IR),b=new Set(g).add("");for(let w of x)b.has(w)||(b.add(w),g.push(w),x.push(IR(w)),o.push(cA));s=(w,_)=>g[_],a=(w,_)=>x[_]}for(u=0,c=o.length;u<c;++u)l=o[u],d=o[u]=new za(l),(p=s(l,u,i))!=null&&(p+="")&&(m=d.id=p,y.set(m,y.has(m)?SR:d)),(p=a(l,u,i))!=null&&(p+="")&&(d.parent=p);for(u=0;u<c;++u)if(d=o[u],p=d.parent){if(h=y.get(p),!h)throw new Error("missing: "+p);if(h===SR)throw new Error("ambiguous: "+p);h.children?h.children.push(d):h.children=[d],d.parent=h}else{if(f)throw new Error("multiple roots");f=d}if(!f)throw new Error("no root");if(n!=null){for(;f.data===cA&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(d=o[g],d.data===cA);--g)d.data=null}if(f.parent=XH,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(aA),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=kb(i),r):e},r.parentId=function(i){return arguments.length?(t=kb(i),r):t},r.path=function(i){return arguments.length?(n=kb(i),r):n},r}function HH(e){e=`${e}`;let t=e.length;return lA(e,t-1)&&!lA(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function IR(e){let t=e.length;if(t<2)return"";for(;--t>1&&!lA(e,t););return e.slice(0,t)}function lA(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function ZH(e,t){return e.parent===t.parent?1:2}function uA(e){var t=e.children;return t?t[0]:e.t}function fA(e){var t=e.children;return t?t[t.length-1]:e.t}function JH(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 QH(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 KH(e,t,n){return e.a.parent===t.parent?e.a:n}function Fb(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}Fb.prototype=Object.create(za.prototype);function tZ(e){for(var t=new Fb(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 Fb(o[s],s)),i.parent=n;return(t.parent=new Fb(null,0)).children=[t],t}function ml(){var e=ZH,t=1,n=1,r=null;function i(l){var u=tZ(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,h=l,d=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>h.x&&(h=x),x.depth>d.depth&&(d=x)});var p=f===h?1:e(f,h)/2,m=p-f.x,y=t/(h.x+p+m),g=n/(d.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*y,x.y=x.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,h=l.i?f[l.i-1]:null;if(u){QH(l);var d=(u[0].z+u[u.length-1].z)/2;h?(l.z=h.z+e(l._,h._),l.m=l.z-d):l.z=d}else h&&(l.z=h.z+e(l._,h._));l.parent.A=a(l,h,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var h=l,d=l,p=u,m=h.parent.children[0],y=h.m,g=d.m,x=p.m,b=m.m,w;p=fA(p),h=uA(h),p&&h;)m=uA(m),d=fA(d),d.a=l,w=p.z+x-h.z-y+e(p._,h._),w>0&&(JH(KH(p,l,f),l,w),y+=w,g+=w),x+=p.m,y+=h.m,b+=m.m,g+=d.m;p&&!fA(d)&&(d.t=p,d.m+=x-g),h&&!uA(m)&&(m.t=h,m.m+=y-b,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 MR=23283064365386963e-26;function yl(e=Math.random()){let t=(0<=e&&e<1?e/MR:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,MR*(t>>>0))}function Ke(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function dm(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 pm=Symbol("implicit");function gl(){var e=new Qn,t=[],n=[],r=pm;function i(o){let s=e.get(o);if(s===void 0){if(r!==pm)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 Qn;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 gl(t,n).unknown(r)},Ke.apply(i,arguments),i}function qa(){var e=gl().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var h=t().length,d=i<r,p=d?i:r,m=d?r:i;o=(m-p)/Math.max(1,h-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(h-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=Ue(h).map(function(g){return p+o*g});return n(d?y.reverse():y)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([r,i]=h,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(h){return[r,i]=h,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(h){return arguments.length?(a=!!h,f()):a},e.padding=function(h){return arguments.length?(c=Math.min(1,l=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(l=+h,f()):l},e.align=function(h){return arguments.length?(u=Math.max(0,Math.min(1,h)),f()):u},e.copy=function(){return qa(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Ke.apply(f(),arguments)}function AR(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return AR(t())},e}function hA(){return AR(qa.apply(null,arguments).paddingInner(1))}function dA(e){return function(){return e}}function mf(e){return+e}var TR=[0,1];function Sr(e){return e}function pA(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:dA(isNaN(t)?NaN:.5)}function eZ(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function nZ(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=pA(i,r),o=n(s,o)):(r=pA(r,i),o=n(o,s)),function(a){return o(r(a))}}function rZ(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]=pA(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Es(e,a,1,r)-1;return o[c](i[c](a))}}function Fo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function xl(){var e=TR,t=TR,n=Pr,r,i,o,s=Sr,a,c,l;function u(){var h=Math.min(e.length,t.length);return s!==Sr&&(s=eZ(e[0],e[h-1])),a=h>2?rZ:nZ,c=l=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=a(e.map(r),t,n)))(r(s(h)))}return f.invert=function(h){return s(i((l||(l=a(t,e.map(r),Se)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,mf),u()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),u()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=ol,u()},f.clamp=function(h){return arguments.length?(s=h?!0:Sr,u()):s!==Sr},f.interpolate=function(h){return arguments.length?(n=h,u()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,d){return r=h,i=d,u()}}function mm(){return xl()(Sr,Sr)}function mA(e,t,n,r){var i=Fu(e,t,n),o;switch(r=Lo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=cM(i,s))&&(r.precision=o),nb(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=lM(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=aM(i))&&(r.precision=o-(r.type==="%")*2);break}}return pi(r)}function Us(e){var t=e.domain;return e.ticks=function(n){var r=t();return En(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return mA(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=Ns(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 zs(){var e=mm();return e.copy=function(){return Fo(e,zs())},Ke.apply(e,arguments),Us(e)}function ym(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,mf),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return ym(e).unknown(t)},e=arguments.length?Array.from(e,mf):[0,1],Us(n)}function gm(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 ER(e){return Math.log(e)}function DR(e){return Math.exp(e)}function iZ(e){return-Math.log(-e)}function oZ(e){return-Math.exp(-e)}function sZ(e){return isFinite(e)?+("1e"+e):e<0?0:e}function aZ(e){return e===10?sZ:e===Math.E?Math.exp:t=>Math.pow(e,t)}function cZ(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 NR(e){return(t,n)=>-e(-t,n)}function yA(e){let t=e(ER,DR),n=t.domain,r=10,i,o;function s(){return i=cZ(r),o=aZ(r),n()[0]<0?(i=NR(i),o=NR(o),e(iZ,oZ)):e(ER,DR),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let h=i(l),d=i(u),p,m,y=a==null?10:+a,g=[];if(!(r%1)&&d-h<y){if(h=Math.floor(h),d=Math.ceil(d),l>0){for(;h<=d;++h)for(p=1;p<r;++p)if(m=h<0?p/o(-h):p*o(h),!(m<l)){if(m>u)break;g.push(m)}}else for(;h<=d;++h)for(p=r-1;p>=1;--p)if(m=h>0?p/o(-h):p*o(h),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=En(l,u,y))}else g=En(h,d,Math.min(d-h,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Lo(c)).precision==null&&(c.trim=!0),c=pi(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(gm(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function xm(){let e=yA(xl()).domain([1,10]);return e.copy=()=>Fo(e,xm()).base(e.base()),Ke.apply(e,arguments),e}function OR(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function LR(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function gA(e){var t=1,n=e(OR(t),LR(t));return n.constant=function(r){return arguments.length?e(OR(t=+r),LR(t)):t},Us(n)}function bm(){var e=gA(xl());return e.copy=function(){return Fo(e,bm()).constant(e.constant())},Ke.apply(e,arguments)}function BR(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function lZ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function uZ(e){return e<0?-e*e:e*e}function xA(e){var t=e(Sr,Sr),n=1;function r(){return n===1?e(Sr,Sr):n===.5?e(lZ,uZ):e(BR(n),BR(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Us(t)}function wm(){var e=xA(xl());return e.copy=function(){return Fo(e,wm()).exponent(e.exponent())},Ke.apply(e,arguments),e}function vm(){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]=gI(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Es(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(Ot),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 vm().domain(e).range(t).unknown(r)},Ke.apply(o,arguments)}function _m(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Es(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 _m().domain(e).range(t).unknown(n)},Ke.apply(i,arguments)}var bA=new Date,wA=new Date;function we(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=>we(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)=>(bA.setTime(+o),wA.setTime(+s),e(bA),e(wA),Math.floor(n(bA,wA))),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 Sm=we(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Sm.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?we(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Sm);var _4t=Sm.range;var dn=we(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),CR=dn.range;var qs=we(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),fZ=qs.range,js=we(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),hZ=js.range;var Vs=we(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()),dZ=Vs.range,Ys=we(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),pZ=Ys.range;var yi=we(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),mZ=yi.range,vl=we(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),yZ=vl.range,_l=we(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),gZ=_l.range;function Sl(e){return we(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 zr=Sl(0),ja=Sl(1),$b=Sl(2),Pb=Sl(3),Po=Sl(4),Ub=Sl(5),zb=Sl(6),RR=zr.range,xZ=ja.range,bZ=$b.range,wZ=Pb.range,vZ=Po.range,_Z=Ub.range,SZ=zb.range;function Il(e){return we(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 qr=Il(0),Va=Il(1),qb=Il(2),jb=Il(3),Uo=Il(4),Vb=Il(5),Yb=Il(6),FR=qr.range,IZ=Va.range,MZ=qb.range,AZ=jb.range,TZ=Uo.range,EZ=Vb.range,DZ=Yb.range;var Xs=we(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()),NZ=Xs.range,Gs=we(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()),OZ=Gs.range;var qn=we(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());qn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:we(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 LZ=qn.range,jn=we(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());jn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:we(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 BZ=jn.range;function PR(e,t,n,r,i,o){let s=[[dn,1,1e3],[dn,5,5*1e3],[dn,15,15*1e3],[dn,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let h=u<l;h&&([l,u]=[u,l]);let d=f&&typeof f.range=="function"?f:c(l,u,f),p=d?d.range(l,+u+1):[];return h?p.reverse():p}function c(l,u,f){let h=Math.abs(u-l)/f,d=Ts(([,,y])=>y).right(s,h);if(d===s.length)return e.every(Fu(l/31536e6,u/31536e6,f));if(d===0)return Sm.every(Math.max(Fu(l,u,f),1));let[p,m]=s[h/s[d-1][2]<s[d][2]/h?d-1:d];return p.every(m)}return[a,c]}var[vA,Mm]=PR(jn,Gs,qr,_l,Ys,js),[_A,SA]=PR(qn,Xs,zr,yi,Vs,qs);function IA(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 MA(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 Am(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function AA(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=Tm(i),u=Em(i),f=Tm(o),h=Em(o),d=Tm(s),p=Em(s),m=Tm(a),y=Em(a),g=Tm(c),x=Em(c),b={a:R,A:F,b:k,B:$,c:null,d:YR,e:YR,f:rJ,g:dJ,G:mJ,H:tJ,I:eJ,j:nJ,L:ZR,m:iJ,M:oJ,p:P,q:U,Q:WR,s:HR,S:sJ,u:aJ,U:cJ,V:lJ,w:uJ,W:fJ,x:null,X:null,y:hJ,Y:pJ,Z:yJ,"%":GR},w={a:W,A:nt,b:ot,B:at,c:null,d:XR,e:XR,f:wJ,g:NJ,G:LJ,H:gJ,I:xJ,j:bJ,L:QR,m:vJ,M:_J,p:Y,q:st,Q:WR,s:HR,S:SJ,u:IJ,U:MJ,V:AJ,w:TJ,W:EJ,x:null,X:null,y:DJ,Y:OJ,Z:BJ,"%":GR},_={a:N,A,b:O,B:C,c:S,d:jR,e:jR,f:ZZ,g:qR,G:zR,H:VR,I:VR,j:XZ,L:HZ,m:YZ,M:GZ,p:M,q:VZ,Q:QZ,s:KZ,S:WZ,u:PZ,U:UZ,V:zZ,w:$Z,W:qZ,x:T,X:D,y:qR,Y:zR,Z:jZ,"%":JZ};b.x=v(n,b),b.X=v(r,b),b.c=v(t,b),w.x=v(n,w),w.X=v(r,w),w.c=v(t,w);function v(q,Z){return function(rt){var z=[],Rt=-1,ht=0,Ht=q.length,Qt,tt,ce;for(rt instanceof Date||(rt=new Date(+rt));++Rt<Ht;)q.charCodeAt(Rt)===37&&(z.push(q.slice(ht,Rt)),(tt=UR[Qt=q.charAt(++Rt)])!=null?Qt=q.charAt(++Rt):tt=Qt==="e"?" ":"0",(ce=Z[Qt])&&(Qt=ce(rt,tt)),z.push(Qt),ht=Rt+1);return z.push(q.slice(ht,Rt)),z.join("")}}function I(q,Z){return function(rt){var z=Am(1900,void 0,1),Rt=E(z,q,rt+="",0),ht,Ht;if(Rt!=rt.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(Z&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(ht=MA(Am(z.y,0,1)),Ht=ht.getUTCDay(),ht=Ht>4||Ht===0?Va.ceil(ht):Va(ht),ht=vl.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=IA(Am(z.y,0,1)),Ht=ht.getDay(),ht=Ht>4||Ht===0?ja.ceil(ht):ja(ht),ht=yi.offset(ht,(z.V-1)*7),z.y=ht.getFullYear(),z.m=ht.getMonth(),z.d=ht.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Ht="Z"in z?MA(Am(z.y,0,1)).getUTCDay():IA(Am(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Ht+5)%7:z.w+z.U*7-(Ht+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,MA(z)):IA(z)}}function E(q,Z,rt,z){for(var Rt=0,ht=Z.length,Ht=rt.length,Qt,tt;Rt<ht;){if(z>=Ht)return-1;if(Qt=Z.charCodeAt(Rt++),Qt===37){if(Qt=Z.charAt(Rt++),tt=_[Qt in UR?Z.charAt(Rt++):Qt],!tt||(z=tt(q,rt,z))<0)return-1}else if(Qt!=rt.charCodeAt(z++))return-1}return z}function M(q,Z,rt){var z=l.exec(Z.slice(rt));return z?(q.p=u.get(z[0].toLowerCase()),rt+z[0].length):-1}function N(q,Z,rt){var z=d.exec(Z.slice(rt));return z?(q.w=p.get(z[0].toLowerCase()),rt+z[0].length):-1}function A(q,Z,rt){var z=f.exec(Z.slice(rt));return z?(q.w=h.get(z[0].toLowerCase()),rt+z[0].length):-1}function O(q,Z,rt){var z=g.exec(Z.slice(rt));return z?(q.m=x.get(z[0].toLowerCase()),rt+z[0].length):-1}function C(q,Z,rt){var z=m.exec(Z.slice(rt));return z?(q.m=y.get(z[0].toLowerCase()),rt+z[0].length):-1}function S(q,Z,rt){return E(q,t,Z,rt)}function T(q,Z,rt){return E(q,n,Z,rt)}function D(q,Z,rt){return E(q,r,Z,rt)}function R(q){return s[q.getDay()]}function F(q){return o[q.getDay()]}function k(q){return c[q.getMonth()]}function $(q){return a[q.getMonth()]}function P(q){return i[+(q.getHours()>=12)]}function U(q){return 1+~~(q.getMonth()/3)}function W(q){return s[q.getUTCDay()]}function nt(q){return o[q.getUTCDay()]}function ot(q){return c[q.getUTCMonth()]}function at(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function st(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var Z=v(q+="",b);return Z.toString=function(){return q},Z},parse:function(q){var Z=I(q+="",!1);return Z.toString=function(){return q},Z},utcFormat:function(q){var Z=v(q+="",w);return Z.toString=function(){return q},Z},utcParse:function(q){var Z=I(q+="",!0);return Z.toString=function(){return q},Z}}}var UR={"-":"",_:" ",0:"0"},pn=/^\s*\d+/,kZ=/^%/,RZ=/[\\^$*+?|[\]().{}]/g;function ne(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 FZ(e){return e.replace(RZ,"\\$&")}function Tm(e){return new RegExp("^(?:"+e.map(FZ).join("|")+")","i")}function Em(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function $Z(e,t,n){var r=pn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function PZ(e,t,n){var r=pn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function UZ(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function zZ(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qZ(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function zR(e,t,n){var r=pn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function qR(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function jZ(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 VZ(e,t,n){var r=pn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function YZ(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function jR(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function XZ(e,t,n){var r=pn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function VR(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function GZ(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function WZ(e,t,n){var r=pn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function HZ(e,t,n){var r=pn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ZZ(e,t,n){var r=pn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function JZ(e,t,n){var r=kZ.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function QZ(e,t,n){var r=pn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function KZ(e,t,n){var r=pn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function YR(e,t){return ne(e.getDate(),t,2)}function tJ(e,t){return ne(e.getHours(),t,2)}function eJ(e,t){return ne(e.getHours()%12||12,t,2)}function nJ(e,t){return ne(1+yi.count(qn(e),e),t,3)}function ZR(e,t){return ne(e.getMilliseconds(),t,3)}function rJ(e,t){return ZR(e,t)+"000"}function iJ(e,t){return ne(e.getMonth()+1,t,2)}function oJ(e,t){return ne(e.getMinutes(),t,2)}function sJ(e,t){return ne(e.getSeconds(),t,2)}function aJ(e){var t=e.getDay();return t===0?7:t}function cJ(e,t){return ne(zr.count(qn(e)-1,e),t,2)}function JR(e){var t=e.getDay();return t>=4||t===0?Po(e):Po.ceil(e)}function lJ(e,t){return e=JR(e),ne(Po.count(qn(e),e)+(qn(e).getDay()===4),t,2)}function uJ(e){return e.getDay()}function fJ(e,t){return ne(ja.count(qn(e)-1,e),t,2)}function hJ(e,t){return ne(e.getFullYear()%100,t,2)}function dJ(e,t){return e=JR(e),ne(e.getFullYear()%100,t,2)}function pJ(e,t){return ne(e.getFullYear()%1e4,t,4)}function mJ(e,t){var n=e.getDay();return e=n>=4||n===0?Po(e):Po.ceil(e),ne(e.getFullYear()%1e4,t,4)}function yJ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ne(t/60|0,"0",2)+ne(t%60,"0",2)}function XR(e,t){return ne(e.getUTCDate(),t,2)}function gJ(e,t){return ne(e.getUTCHours(),t,2)}function xJ(e,t){return ne(e.getUTCHours()%12||12,t,2)}function bJ(e,t){return ne(1+vl.count(jn(e),e),t,3)}function QR(e,t){return ne(e.getUTCMilliseconds(),t,3)}function wJ(e,t){return QR(e,t)+"000"}function vJ(e,t){return ne(e.getUTCMonth()+1,t,2)}function _J(e,t){return ne(e.getUTCMinutes(),t,2)}function SJ(e,t){return ne(e.getUTCSeconds(),t,2)}function IJ(e){var t=e.getUTCDay();return t===0?7:t}function MJ(e,t){return ne(qr.count(jn(e)-1,e),t,2)}function KR(e){var t=e.getUTCDay();return t>=4||t===0?Uo(e):Uo.ceil(e)}function AJ(e,t){return e=KR(e),ne(Uo.count(jn(e),e)+(jn(e).getUTCDay()===4),t,2)}function TJ(e){return e.getUTCDay()}function EJ(e,t){return ne(Va.count(jn(e)-1,e),t,2)}function DJ(e,t){return ne(e.getUTCFullYear()%100,t,2)}function NJ(e,t){return e=KR(e),ne(e.getUTCFullYear()%100,t,2)}function OJ(e,t){return ne(e.getUTCFullYear()%1e4,t,4)}function LJ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Uo(e):Uo.ceil(e),ne(e.getUTCFullYear()%1e4,t,4)}function BJ(){return"+0000"}function GR(){return"%"}function WR(e){return+e}function HR(e){return Math.floor(+e/1e3)}var yf,gf,tF,zo,eF;TA({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 TA(e){return yf=AA(e),gf=yf.format,tF=yf.parse,zo=yf.utcFormat,eF=yf.utcParse,yf}function CJ(e){return new Date(e)}function kJ(e){return e instanceof Date?+e:+new Date(+e)}function Xb(e,t,n,r,i,o,s,a,c,l){var u=mm(),f=u.invert,h=u.domain,d=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function _(v){return(c(v)<v?d:a(v)<v?p:s(v)<v?m:o(v)<v?y:r(v)<v?i(v)<v?g:x:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(f(v))},u.domain=function(v){return arguments.length?h(Array.from(v,kJ)):h().map(CJ)},u.ticks=function(v){var I=h();return e(I[0],I[I.length-1],v??10)},u.tickFormat=function(v,I){return I==null?_:l(I)},u.nice=function(v){var I=h();return(!v||typeof v.range!="function")&&(v=t(I[0],I[I.length-1],v??10)),v?h(gm(I,v)):u},u.copy=function(){return Fo(u,Xb(e,t,n,r,i,o,s,a,c,l))},u}function Gb(){return Ke.apply(Xb(_A,SA,qn,Xs,zr,yi,Vs,qs,dn,gf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Wb(){return Ke.apply(Xb(vA,Mm,jn,Gs,qr,vl,Ys,js,dn,zo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Dm(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Hb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=Sr,u,f=!1,h;function d(m){return isNaN(m=+m)?h:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}d.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,d):[e,t,n]},d.clamp=function(m){return arguments.length?(f=!!m,d):f},d.interpolator=function(m){return arguments.length?(l=m,d):l};function p(m){return function(y){var g,x,b;return arguments.length?([g,x,b]=y,l=Eo(m,[g,x,b]),d):[l(0),l(.5),l(1)]}}return d.range=p(Pr),d.rangeRound=p(ol),d.unknown=function(m){return arguments.length?(h=m,d):h},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,d}}function Nm(){var e=Us(Hb()(Sr));return e.copy=function(){return Dm(e,Nm())},dm.apply(e,arguments)}function Zb(){var e=yA(Hb()).domain([.1,1,10]);return e.copy=function(){return Dm(e,Zb()).base(e.base())},dm.apply(e,arguments)}function Jb(){var e=gA(Hb());return e.copy=function(){return Dm(e,Jb()).constant(e.constant())},dm.apply(e,arguments)}function Qb(){var e=xA(Hb());return e.copy=function(){return Dm(e,Qb()).exponent(e.exponent())},dm.apply(e,arguments)}function X(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 EA=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var DA=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var NA=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var OA=X("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var LA=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var BA=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var CA=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var kA=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var RA=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var FA=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var $A=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>BI(e[e.length-1]);var Kb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),t1=pt(Kb);var e1=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),n1=pt(e1);var r1=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),i1=pt(r1);var o1=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),s1=pt(o1);var Om=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),xf=pt(Om);var a1=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),c1=pt(a1);var Lm=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),bf=pt(Lm);var l1=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),u1=pt(l1);var f1=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),h1=pt(f1);var d1=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),p1=pt(d1);var m1=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),y1=pt(m1);var g1=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),x1=pt(g1);var b1=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),w1=pt(b1);var v1=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),_1=pt(v1);var S1=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),I1=pt(S1);var M1=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),A1=pt(M1);var T1=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),E1=pt(T1);var D1=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),N1=pt(D1);var O1=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),L1=pt(O1);var B1=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),C1=pt(B1);var k1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),R1=pt(k1);var F1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),$1=pt(F1);var P1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),U1=pt(P1);var z1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),q1=pt(z1);var j1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),V1=pt(j1);var Y1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),X1=pt(Y1);var G1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),W1=pt(G1);function H1(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 Z1=Xu(er(300,.5,0),er(-240,.5,1));var Q1=Xu(er(-100,.75,.35),er(80,1.5,.8)),K1=Xu(er(260,.75,.35),er(80,1.5,.8)),J1=er();function tw(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return J1.h=360*e-100,J1.s=1.5-1.5*t,J1.l=.8-.9*t,J1+""}var ew=sn(),RJ=Math.PI/3,FJ=Math.PI*2/3;function nw(e){var t;return e=(.5-e)*Math.PI,ew.r=255*(t=Math.sin(e))*t,ew.g=255*(t=Math.sin(e+RJ))*t,ew.b=255*(t=Math.sin(e+FJ))*t,ew+""}function rw(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 iw(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var ow=iw(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),sw=iw(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),aw=iw(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),cw=iw(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function tn(e){return function(){return e}}var PA=Math.cos;var wf=Math.min,Bm=Math.sin,re=Math.sqrt,UA=1e-12,Ml=Math.PI,GNt=Ml/2,vf=2*Ml;function lw(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 Ra(t)}var JNt=Array.prototype.slice;function uw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function nF(e){this._context=e}nF.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 Ws(e){return new nF(e)}function fw(e){return e[0]}function hw(e){return e[1]}function Cm(e,t){var n=tn(!0),r=null,i=Ws,o=null,s=lw(a);e=typeof e=="function"?e:e===void 0?fw:tn(e),t=typeof t=="function"?t:t===void 0?hw:tn(t);function a(c){var l,u=(c=uw(c)).length,f,h=!1,d;for(r==null&&(o=i(d=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+e(f,l,c),+t(f,l,c));if(d)return o=null,d+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:tn(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:tn(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:tn(!!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 _f(e,t,n){var r=null,i=tn(!0),o=null,s=Ws,a=null,c=lw(l);e=typeof e=="function"?e:e===void 0?fw:tn(+e),t=typeof t=="function"?t:t===void 0?tn(0):tn(+t),n=typeof n=="function"?n:n===void 0?hw:tn(+n);function l(f){var h,d,p,m=(f=uw(f)).length,y,g=!1,x,b=new Array(m),w=new Array(m);for(o==null&&(a=s(x=c())),h=0;h<=m;++h){if(!(h<m&&i(y=f[h],h,f))===g)if(g=!g)d=h,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=h-1;p>=d;--p)a.point(b[p],w[p]);a.lineEnd(),a.areaEnd()}g&&(b[h]=+e(y,h,f),w[h]=+t(y,h,f),a.point(r?+r(y,h,f):b[h],n?+n(y,h,f):w[h]))}if(x)return a=null,x+""||null}function u(){return Cm().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:tn(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:tn(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:tn(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:tn(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:tn(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:tn(+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:tn(!!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 dw=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 zA(e){return new dw(e,!0)}function qA(e){return new dw(e,!1)}var $J=re(3),km={draw(e,t){let n=re(t+wf(t/28,.75))*.59436,r=n/2,i=r*$J;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 Hs={draw(e,t){let n=re(t/Ml);e.moveTo(n,0),e.arc(0,0,n,0,vf)}};var Rm={draw(e,t){let n=re(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 rF=re(1/3),PJ=rF*2,Fm={draw(e,t){let n=re(t/PJ),r=n*rF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var $m={draw(e,t){let n=re(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var Pm={draw(e,t){let n=re(t-wf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var Um={draw(e,t){let n=re(t),r=-n/2;e.rect(r,r,n,n)}};var zm={draw(e,t){let n=re(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var UJ=.8908130915292852,iF=Bm(Ml/10)/Bm(7*Ml/10),zJ=Bm(vf/10)*iF,qJ=-PA(vf/10)*iF,qm={draw(e,t){let n=re(t*UJ),r=zJ*n,i=qJ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=vf*o/5,a=PA(s),c=Bm(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var jA=re(3),jm={draw(e,t){let n=-re(t/(jA*3));e.moveTo(0,n*2),e.lineTo(-jA*n,-n),e.lineTo(jA*n,-n),e.closePath()}};var jJ=re(3),Vm={draw(e,t){let n=re(t)*.6824,r=n/2,i=n*jJ/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var gi=-.5,xi=re(3)/2,VA=1/re(12),VJ=(VA/2+1)*3,Ym={draw(e,t){let n=re(t/VJ),r=n/2,i=n*VA,o=r,s=n*VA+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(gi*r-xi*i,xi*r+gi*i),e.lineTo(gi*o-xi*s,xi*o+gi*s),e.lineTo(gi*a-xi*c,xi*a+gi*c),e.lineTo(gi*r+xi*i,gi*i-xi*r),e.lineTo(gi*o+xi*s,gi*s-xi*o),e.lineTo(gi*a+xi*c,gi*c-xi*a),e.closePath()}};var Sf={draw(e,t){let n=re(t-wf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var pw=[Hs,Rm,Fm,Um,qm,jm,Ym],YA=[Hs,Pm,Sf,Vm,km,zm,$m];function bi(){}function If(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 Xm(e){this._context=e}Xm.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:If(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:If(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XA(e){return new Xm(e)}function oF(e){this._context=e}oF.prototype={areaStart:bi,areaEnd:bi,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:If(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GA(e){return new oF(e)}function sF(e){this._context=e}sF.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:If(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function WA(e){return new sF(e)}function aF(e,t){this._basis=new Xm(e),this._beta=t}aF.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 HA=function e(t){function n(r){return t===1?new Xm(r):new aF(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function Mf(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 mw(e,t){this._context=e,this._k=(1-t)/6}mw.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:Mf(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:Mf(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 ZA=function e(t){function n(r){return new mw(r,t)}return n.tension=function(r){return e(+r)},n}(0);function yw(e,t){this._context=e,this._k=(1-t)/6}yw.prototype={areaStart:bi,areaEnd:bi,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:Mf(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 JA=function e(t){function n(r){return new yw(r,t)}return n.tension=function(r){return e(+r)},n}(0);function gw(e,t){this._context=e,this._k=(1-t)/6}gw.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:Mf(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 QA=function e(t){function n(r){return new gw(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Gm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>UA){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>UA){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 cF(e,t){this._context=e,this._alpha=t}cF.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:Gm(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 KA=function e(t){function n(r){return t?new cF(r,t):new mw(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function lF(e,t){this._context=e,this._alpha=t}lF.prototype={areaStart:bi,areaEnd:bi,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:Gm(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 t3=function e(t){function n(r){return t?new lF(r,t):new yw(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function uF(e,t){this._context=e,this._alpha=t}uF.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:Gm(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 e3=function e(t){function n(r){return t?new uF(r,t):new gw(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function fF(e){this._context=e}fF.prototype={areaStart:bi,areaEnd:bi,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 n3(e){return new fF(e)}function hF(e){return e<0?-1:1}function dF(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(hF(o)+hF(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function pF(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function r3(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 xw(e){this._context=e}xw.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:r3(this,this._t0,pF(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,r3(this,pF(this,n=dF(this,e,t)),n);break;default:r3(this,this._t0,n=dF(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function mF(e){this._context=new yF(e)}(mF.prototype=Object.create(xw.prototype)).point=function(e,t){xw.prototype.point.call(this,t,e)};function yF(e){this._context=e}yF.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 i3(e){return new xw(e)}function o3(e){return new mF(e)}function xF(e){this._context=e}xF.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=gF(e),i=gF(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 gF(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 s3(e){return new xF(e)}function bw(e,t){this._context=e,this._t=t}bw.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 a3(e){return new bw(e,.5)}function c3(e){return new bw(e,0)}function l3(e){return new bw(e,1)}var Wm=e=>()=>e;function u3(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 Hm=new jr(1,0,0);f3.prototype=jr.prototype;function f3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Hm;return e.__zoom}function ww(e){e.stopImmediatePropagation()}function Af(e){e.preventDefault(),e.stopImmediatePropagation()}function YJ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function XJ(){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 bF(){return this.__zoom||Hm}function GJ(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function WJ(){return navigator.maxTouchPoints||"ontouchstart"in this}function HJ(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 h3(){var e=YJ,t=XJ,n=HJ,r=GJ,i=WJ,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=PI,l=Kc("start","zoom","end"),u,f,h,d=500,p=150,m=0,y=10;function g(S){S.property("__zoom",bF).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,T,D,R){var F=S.selection?S.selection():S;F.property("__zoom",bF),S!==F?_(S,T,D,R):F.interrupt().each(function(){v(this,arguments).event(R).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},g.scaleBy=function(S,T,D,R){g.scaleTo(S,function(){var F=this.__zoom.k,k=typeof T=="function"?T.apply(this,arguments):T;return F*k},D,R)},g.scaleTo=function(S,T,D,R){g.transform(S,function(){var F=t.apply(this,arguments),k=this.__zoom,$=D==null?w(F):typeof D=="function"?D.apply(this,arguments):D,P=k.invert($),U=typeof T=="function"?T.apply(this,arguments):T;return n(b(x(k,U),$,P),F,s)},D,R)},g.translateBy=function(S,T,D,R){g.transform(S,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,R)},g.translateTo=function(S,T,D,R,F){g.transform(S,function(){var k=t.apply(this,arguments),$=this.__zoom,P=R==null?w(k):typeof R=="function"?R.apply(this,arguments):R;return n(Hm.translate(P[0],P[1]).scale($.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof D=="function"?-D.apply(this,arguments):-D),k,s)},R,F)};function x(S,T){return T=Math.max(o[0],Math.min(o[1],T)),T===S.k?S:new jr(T,S.x,S.y)}function b(S,T,D){var R=T[0]-D[0]*S.k,F=T[1]-D[1]*S.k;return R===S.x&&F===S.y?S:new jr(S.k,R,F)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,T,D,R){S.on("start.zoom",function(){v(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(R).end()}).tween("zoom",function(){var F=this,k=arguments,$=v(F,k).event(R),P=t.apply(F,k),U=D==null?w(P):typeof D=="function"?D.apply(F,k):D,W=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),nt=F.__zoom,ot=typeof T=="function"?T.apply(F,k):T,at=c(nt.invert(U).concat(W/nt.k),ot.invert(U).concat(W/ot.k));return function(Y){if(Y===1)Y=ot;else{var st=at(Y),q=W/st[2];Y=new jr(q,U[0]-st[0]*q,U[1]-st[1]*q)}$.zoom(null,Y)}})}function v(S,T,D){return!D&&S.__zooming||new I(S,T)}function I(S,T){this.that=S,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,T),this.taps=0}I.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,T){return this.mouse&&S!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var T=Yt(this.that).datum();l.call(S,this.that,new u3(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),T)}};function E(S,...T){if(!e.apply(this,arguments))return;var D=v(this,T).event(S),R=this.__zoom,F=Math.max(o[0],Math.min(o[1],R.k*Math.pow(2,r.apply(this,arguments)))),k=Fn(S);if(D.wheel)(D.mouse[0][0]!==k[0]||D.mouse[0][1]!==k[1])&&(D.mouse[1]=R.invert(D.mouse[0]=k)),clearTimeout(D.wheel);else{if(R.k===F)return;D.mouse=[k,R.invert(k)],Do(this),D.start()}Af(S),D.wheel=setTimeout($,p),D.zoom("mouse",n(b(x(R,F),D.mouse[0],D.mouse[1]),D.extent,s));function $(){D.wheel=null,D.end()}}function M(S,...T){if(h||!e.apply(this,arguments))return;var D=S.currentTarget,R=v(this,T,!0).event(S),F=Yt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",W,!0),k=Fn(S,D),$=S.clientX,P=S.clientY;Mp(S.view),ww(S),R.mouse=[k,this.__zoom.invert(k)],Do(this),R.start();function U(nt){if(Af(nt),!R.moved){var ot=nt.clientX-$,at=nt.clientY-P;R.moved=ot*ot+at*at>m}R.event(nt).zoom("mouse",n(b(R.that.__zoom,R.mouse[0]=Fn(nt,D),R.mouse[1]),R.extent,s))}function W(nt){F.on("mousemove.zoom mouseup.zoom",null),Ap(nt.view,R.moved),Af(nt),R.event(nt).end()}}function N(S,...T){if(e.apply(this,arguments)){var D=this.__zoom,R=Fn(S.changedTouches?S.changedTouches[0]:S,this),F=D.invert(R),k=D.k*(S.shiftKey?.5:2),$=n(b(x(D,k),R,F),t.apply(this,T),s);Af(S),a>0?Yt(this).transition().duration(a).call(_,$,R,S):Yt(this).call(g.transform,$,R,S)}}function A(S,...T){if(e.apply(this,arguments)){var D=S.touches,R=D.length,F=v(this,T,S.changedTouches.length===R).event(S),k,$,P,U;for(ww(S),$=0;$<R;++$)P=D[$],U=Fn(P,this),U=[U,this.__zoom.invert(U),P.identifier],F.touch0?!F.touch1&&F.touch0[2]!==U[2]&&(F.touch1=U,F.taps=0):(F.touch0=U,k=!0,F.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(F.taps<2&&(f=U[0],u=setTimeout(function(){u=null},d)),Do(this),F.start())}}function O(S,...T){if(this.__zooming){var D=v(this,T).event(S),R=S.changedTouches,F=R.length,k,$,P,U;for(Af(S),k=0;k<F;++k)$=R[k],P=Fn($,this),D.touch0&&D.touch0[2]===$.identifier?D.touch0[0]=P:D.touch1&&D.touch1[2]===$.identifier&&(D.touch1[0]=P);if($=D.that.__zoom,D.touch1){var W=D.touch0[0],nt=D.touch0[1],ot=D.touch1[0],at=D.touch1[1],Y=(Y=ot[0]-W[0])*Y+(Y=ot[1]-W[1])*Y,st=(st=at[0]-nt[0])*st+(st=at[1]-nt[1])*st;$=x($,Math.sqrt(Y/st)),P=[(W[0]+ot[0])/2,(W[1]+ot[1])/2],U=[(nt[0]+at[0])/2,(nt[1]+at[1])/2]}else if(D.touch0)P=D.touch0[0],U=D.touch0[1];else return;D.zoom("touch",n(b($,P,U),D.extent,s))}}function C(S,...T){if(this.__zooming){var D=v(this,T).event(S),R=S.changedTouches,F=R.length,k,$;for(ww(S),h&&clearTimeout(h),h=setTimeout(function(){h=null},d),k=0;k<F;++k)$=R[k],D.touch0&&D.touch0[2]===$.identifier?delete D.touch0:D.touch1&&D.touch1[2]===$.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&($=Fn($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<y)){var P=Yt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Wm(+S),g):r},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Wm(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Wm(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Wm([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(n=S,g):n},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function ze(e){return e!=null&&!Number.isNaN(e)}function mn(e,t){return+ze(t)-+ze(e)||Ot(e,t)}function Al(e,t){return+ze(t)-+ze(e)||Jn(e,t)}function Zm(e){return e!=null&&`${e}`!=""}function Tf(e){return isFinite(e)?e:NaN}function cr(e){return e>0&&isFinite(e)?e:NaN}function Ya(e){return e<0&&isFinite(e)?e:NaN}function Ef(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`${ZJ(e.getUTCFullYear(),4)}-${Zs(e.getUTCMonth()+1,2)}-${Zs(e.getUTCDate(),2)}${n||r||i||o?`T${Zs(n,2)}:${Zs(r,2)}${i||o?`:${Zs(i,2)}${o?`.${Zs(o,3)}`:""}`:""}Z`:""}`}function ZJ(e){return e<0?`-${Zs(-e,6)}`:e>9999?`+${Zs(e,6)}`:Zs(e,4)}function Zs(e,t){return`${e}`.padStart(t,"0")}var JJ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Jm(e,t){return JJ.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Js(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Jn(t,n)}var Nf=1e3,Ga=Nf*60,Wa=Ga*60,jo=Wa*24,qo=jo*7,Tl=jo*30,Xa=jo*365,d3=[["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",Nf],["5 seconds",5*Nf],["15 seconds",15*Nf],["30 seconds",30*Nf],["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",jo],["2 days",2*jo],["week",qo],["2 weeks",2*qo],["month",Tl],["3 months",3*Tl],["6 months",6*Tl],["year",Xa],["2 years",2*Xa],["5 years",5*Xa],["10 years",10*Xa],["20 years",20*Xa],["50 years",50*Xa],["100 years",100*Xa]],p3=new Map([["second",Nf],["minute",Ga],["hour",Wa],["day",jo],["monday",qo],["tuesday",qo],["wednesday",qo],["thursday",qo],["friday",qo],["saturday",qo],["sunday",qo],["week",qo],["month",Tl],["year",Xa]]),vF=new Map([["second",dn],["minute",qs],["hour",Vs],["day",yi],["monday",ja],["tuesday",$b],["wednesday",Pb],["thursday",Po],["friday",Ub],["saturday",zb],["sunday",zr],["week",zr],["month",Xs],["year",qn]]),m3=new Map([["second",dn],["minute",js],["hour",Ys],["day",_l],["monday",Va],["tuesday",qb],["wednesday",jb],["thursday",Uo],["friday",Vb],["saturday",Yb],["sunday",qr],["week",qr],["month",Gs],["year",jn]]),Of=Symbol("intervalDuration"),_w=Symbol("intervalType");for(let[e,t]of vF)t[Of]=p3.get(e),t[_w]="time";for(let[e,t]of m3)t[Of]=p3.get(e),t[_w]="utc";var Qm=[["year",jn,"utc"],["month",Gs,"utc"],["day",_l,"utc",6*Tl],["hour",Ys,"utc",3*jo],["minute",js,"utc",6*Wa],["second",dn,"utc",30*Ga]],vw=[["year",qn,"time"],["month",Xs,"time"],["day",yi,"time",6*Tl],["hour",Vs,"time",3*jo],["minute",qs,"time",6*Wa],["second",dn,"time",30*Ga]],QJ=[Qm[0],vw[0],Qm[1],vw[1],Qm[2],vw[2],...Qm.slice(3)];function Sw(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=m3.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 y3(e){return _F(Sw(e),"time")}function Km(e){return _F(Sw(e),"utc")}function _F([e,t],n){let r=(n==="time"?vF:m3).get(e);return t>1&&(r=r.every(t),r[Of]=p3.get(e)*t,r[_w]=n),r}function g3(e,t){if(!(t>1))return;let n=e[Of];if(!d3.some(([,i])=>i===n)||n%jo===0&&jo<n&&n<Tl)return;let[r]=d3[Ts(([,i])=>Math.log(i)).center(d3,Math.log(n*t))];return(e[_w]==="time"?y3:Km)(r)}function wF(e,t,n){let r=t==="time"?gf:zo;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=KJ(n);switch(e){case"millisecond":return Df(r(".%L"),r(":%M:%S"),i);case"second":return Df(r(":%S"),r("%-I:%M"),i);case"minute":return Df(r("%-I:%M"),r("%p"),i);case"hour":return Df(r("%-I %p"),r("%b %-d"),i);case"day":return Df(r("%-d"),r("%b"),i);case"month":return Df(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function KJ(e){return e==="left"||e==="right"?(t,n)=>`
|
|
12
|
-
${t}
|
|
13
|
-
${n}`:e==="top"?(t,n)=>`${n}
|
|
14
|
-
${t}`:(t,n)=>`${t}
|
|
15
|
-
${n}`}function tQ(e){return e==="time"?vw:e==="utc"?Qm:QJ}function SF(e,t,n){let r=Jt(gx(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return wF("millisecond","utc",n);for(let[i,o,s,a]of tQ(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return wF(i,s,n)}}function Df(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 El=Object.getPrototypeOf(Uint8Array),eQ=Object.prototype.toString,x3=Symbol("reindex");function wt(e,t,n){let r=typeof t;return r==="string"?IF(e,b3(t),n):r==="function"?IF(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Wt(e,yn(t),n):typeof t?.transform=="function"?MF(t.transform(e),n):nQ(MF(t,n),e?.[x3])}function nQ(e,t){return t?ey(e,t):e}function IF(e,t,n){return Wt(e,n?.prototype instanceof El?rQ(t):t,n)}function MF(e,t){return t===void 0?je(e):e instanceof t?e:t.prototype instanceof El&&!(e instanceof El)?t.from(e,w3):t.from(e)}function rQ(e){return(t,n)=>w3(e(t,n))}var Ha=[null],b3=e=>t=>t[e],Ee={transform:lr},G={transform:e=>e};var ty=()=>1,AF=()=>!0,qe=e=>e==null?e:`${e}`,Bt=e=>e==null?e:+e;var Dl=e=>e?e[0]:void 0,Za=e=>e?e[1]:void 0,TF=e=>e?e[2]:void 0,yn=e=>()=>e;function Lf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>tr(n,t,r)}function en(e){return e instanceof El?e:Wt(e,w3,Float64Array)}function w3(e){return e==null?NaN:Number(e)}function EF(e){return Wt(e,v3)}function v3(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Jm(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Le(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Ka(e)?[void 0,e]:[e,void 0]}function ae(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function _3(e,t,n){if(e!=null)return cn(e,t,n)}function cn(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 El?e:Array.from(e)}function Wt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Ja(e,t=Array){return e instanceof t?e.slice():t.from(e)}function S3({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function I3({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function Bf(e){return S3(e)||I3(e)||e.interval!==void 0}function gn(e){return e?.toString===eQ}function Vo(e){return gn(e)&&(e.type!==void 0||e.domain!==void 0)}function Vr(e){return gn(e)&&typeof e.transform!="function"}function Yo(e){return Vr(e)&&e.value===void 0&&e.channel===void 0}function M3(e,t,n,r=G){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 Pe(e,t){return e===void 0&&t===void 0?[Dl,Za]:[e,t]}function Vn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Le(t)),e===void 0&&([e]=Le(n)),e}function lr(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function ey(e,t){return Wt(t,n=>e[n],e.constructor)}function Cf(e){return e.length===1?(t,n)=>e(ey(n,t)):e}function Qs(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Ks(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Iw(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 xn(e){let t;return[{transform:()=>t,label:Cn(e)},n=>t=n]}function Bn(e){return e==null?[e]:xn(e)}function Cn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function kf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Be(r)||Be(i)?Wt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Wt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function Nl(e,t){let n=A3(t?.interval,t?.type);return n?Wt(e,n):e}function A3(e,t){let n=Rf(e,t);return n&&(r=>ze(r)?n.floor(r):r)}function Rf(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)=>Ue(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Ue(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?y3:Km)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function Xo(e,t){if(e=Rf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function DF(e,t){if(e=Xo(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function NF(e){return Qa(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Qa(e){return typeof e?.range=="function"}function wi(e){return e===void 0||Vr(e)?e:{value:e}}function OF(e){return e==null?null:{transform:t=>wt(t,e,Float64Array),label:Cn(e)}}function LF(e){if(!ur(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function ur(e){return e&&typeof e[Symbol.iterator]=="function"}function Mw(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function De(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Be(e){for(let t of e)if(t!=null)return t instanceof Date}function BF(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Jm(t)}function CF(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function ta(e){for(let t of e)if(t!=null)return typeof t=="number"}function Aw(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var iQ=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)||iQ.has(e))}function kF(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ie(e){return e==null||ea(e)}function ea(e){return/^\s*none\s*$/i.test(e)}function RF(e){return/^\s*round\s*$/i.test(e)}function Tw(e,t){return _3(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Go(e="middle"){return Tw(e,"frameAnchor")}function FF(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 oQ(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 ny(e){return ur(e)?oQ(e):e}function Ew(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=cn(e,"clip",["frame","sphere"])),e}var vi=Symbol("position"),Yr=Symbol("color"),Ol=Symbol("radius"),Ll=Symbol("length"),Bl=Symbol("opacity"),Ff=Symbol("symbol"),$F=Symbol("projection"),de=new Map([["x",vi],["y",vi],["fx",vi],["fy",vi],["r",Ol],["color",Yr],["opacity",Bl],["symbol",Ff],["length",Ll],["projection",$F]]);function PF(e){return e===vi||e===$F}function UF(e){return e===vi||e===Ol||e===Ll||e===Bl}var T3=Math.sqrt(3),E3=2/T3,sQ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*E3,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()}},D3=new Map([["asterisk",km],["circle",Hs],["cross",Rm],["diamond",Fm],["diamond2",$m],["hexagon",sQ],["plus",Pm],["square",Um],["square2",zm],["star",qm],["times",Sf],["triangle",jm],["triangle2",Vm],["wye",Ym]]);function N3(e){return e&&typeof e.draw=="function"}function zF(e){return N3(e)?!0:typeof e!="string"?!1:D3.has(e.toLowerCase())}function $f(e){if(e==null||N3(e))return e;let t=D3.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function qF(e){if(e==null||N3(e))return[void 0,e];if(typeof e=="string"){let t=D3.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function bn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=B3(e)),t!=null&&!Yo(t)&&(r=O3(r,k3(t))),n&&(r=O3(r,C3))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Yo(t))&&{sort:t},transform:O3(r,s)}}function Me({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=B3(e)),t!=null&&!Yo(t)&&(r=L3(r,k3(t))),n&&(r=L3(r,C3))),{...i,...(t===null||Yo(t))&&{sort:t},initializer:L3(r,o)}}function O3(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 L3(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 Dw(e,t){return(e.initializer!=null?Me:bn)(e,t)}function jF(e,t){return Dw(t,B3(e))}function B3(e){return(t,n)=>{let r=wt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function VF({sort:e,...t}={}){return{...Dw(t,C3),sort:Yo(e)?e:null}}function C3(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function YF({seed:e,sort:t,...n}={}){return{...Dw(n,XF(e==null?Math.random:yl(e))),sort:Yo(t)?t:null}}function Nw(e,{sort:t,...n}={}){return{...(Vr(e)&&e.channel!==void 0?Me:Dw)(n,k3(e)),sort:Yo(t)?t:null}}function k3(e){return(typeof e=="function"&&e.length!==1?aQ:XF)(e)}function aQ(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 XF(e){let t,n;({channel:t,value:e,order:n}={...wi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?Al:mn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=mn;break;case"descending":n=Al;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=wt(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 iy(e,t){return Ow(null,null,e,t)}function ec(e={y:"count"},t={}){let{x:n=G}=t;if(n==null)throw new Error("missing channel: x");return Ow(n,null,e,t)}function nc(e={x:"count"},t={}){let{y:n=G}=t;if(n==null)throw new Error("missing channel: y");return Ow(null,n,e,t)}function oy(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Pe(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return Ow(n,r,e,t)}function Ow(e,t,{data:n=Cw,filter:r,sort:i,reverse:o,...s}={},a={}){s=F3(s,a),n=JF(n,G),i=i==null?void 0:HF("sort",i,a),r=r==null?void 0:ZF("filter",r,a);let[c,l]=Bn(e),[u,f]=Bn(t),{z:h,fill:d,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[w,_]=Bn(h),[v]=Le(d),[I]=Le(p),[E,M]=Bn(v),[N,A]=Bn(I);return{..."z"in a&&{z:w||h},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:N||p},...bn(b,(O,C,S)=>{let T=Nl(wt(O,e),S?.x),D=Nl(wt(O,t),S?.y),R=wt(O,h),F=wt(O,v),k=wt(O,I),$=sy(s,{z:R,fill:F,stroke:k}),P=[],U=[],W=T&&l([]),nt=D&&f([]),ot=R&&_([]),at=F&&M([]),Y=k&&A([]),st=0;for(let q of s)q.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let q of C){let Z=[];for(let rt of s)rt.scope("facet",q);i&&i.scope("facet",q),r&&r.scope("facet",q);for(let[rt,z]of tc(q,$))for(let[Rt,ht]of tc(z,D))for(let[Ht,Qt]of tc(ht,T)){let tt={data:O};if(T&&(tt.x=Ht),D&&(tt.y=Rt),$&&(tt.z=rt),!(r&&!r.reduce(Qt,tt))){Z.push(st++),U.push(n.reduceIndex(Qt,O,tt)),T&&W.push(Ht),D&&nt.push(Rt),R&&ot.push($===R?rt:R[Qt[0]]),F&&at.push($===F?rt:F[Qt[0]]),k&&Y.push($===k?rt:k[Qt[0]]);for(let ce of s)ce.reduce(Qt,tt);i&&i.reduce(Qt,tt)}}P.push(Z)}return $3(P,i,o),{data:U,facets:P}}),...!Wo(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!Wo(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:O,output:C})=>[O,C]))}}function Wo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function R3(e,t,n=Lw){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",dQ]),t.href!=null&&e.href===void 0&&r.push(["href",kw]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?cQ(i):n(i,o,t))}function Lw(e,t,n,r=Bw){let i;gn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=xn(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 cQ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function Bw(e,t,n,r=Pf){let i=Iw(e,n),o=r(t,i),s,a;return{label:Cn(o===ry?null:i,o.label),initialize(c){s=i===void 0?c:wt(c,i),o.scope==="data"&&(a=o.reduceIndex(lr(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 tc(e,t){return t?fn(e,n=>t[n]):[[,e]]}function Pf(e,t,n=lQ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&gn(e))return fQ(e);if(typeof e=="function")return hQ(e);if(/^p\d{2}$/i.test(e))return na(Lf(e));switch(`${e}`.toLowerCase()){case"first":return kw;case"last":return pQ;case"identity":return Cw;case"count":return ry;case"distinct":return mQ;case"sum":return t==null?ry:yQ;case"proportion":return WF(t,"data");case"proportion-facet":return WF(t,"facet");case"deviation":return na(li);case"min":return na(fe);case"min-index":return na(px);case"max":return na(Jt);case"max-index":return na(dx);case"mean":return GF(Os);case"median":return GF(zi);case"variance":return na(Da);case"mode":return na(Uu)}return n(e)}function lQ(e){throw new Error(`invalid reduce: ${e}`)}function F3(e,t){return R3(e,t,HF)}function HF(e,t,n){return Lw(e,t,n,ZF)}function ZF(e,t,n){return Bw(e,t,n,JF)}function JF(e,t){return Pf(e,t,uQ)}function uQ(e){switch(`${e}`.toLowerCase()){case"x":return gQ;case"y":return xQ;case"z":return P3}throw new Error(`invalid group reduce: ${e}`)}function sy(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function $3(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>mn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function fQ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function hQ(e){return{reduceIndex(t,n,r){return e(ey(n,t),r)}}}function na(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function GF(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Be(n)?new Date(r):r}}}var Cw={reduceIndex(e,t){return ey(t,e)}},kw={reduceIndex(e,t){return t[e[0]]}},dQ={reduceIndex(e,t){let r=Ds(Ui(e,o=>o.length,o=>t[o]),Za),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`,Dn(o,Za)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
|
|
16
|
-
`)}},pQ={reduceIndex(e,t){return t[e[e.length-1]]}},ry={label:"Frequency",reduceIndex(e){return e.length}},mQ={label:"Distinct",reduceIndex(e,t){let n=new Kn;for(let r of e)n.add(t[r]);return n.size}},yQ=na(Dn);function WF(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Dn(n,o=>r[o])/i}}var gQ={reduceIndex(e,t,{x:n}){return n}},xQ={reduceIndex(e,t,{y:n}){return n}},P3={reduceIndex(e,t,{z:n}){return n}};function QF(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 Uf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Cn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),z3(a,{scale:t,type:n,value:wt(e,r),label:s,filter:i,hint:o})}function Rw(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Uf(t,r,n)]))}function zf(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:Wt(o,s)]}));return n.channels=e,n}function z3(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&&Aw(r,Ka)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&Aw(r,kF)?null:"opacity";break;case"symbol":n!==!0&&Aw(r,zF)?(t.scale=null,t.value=Wt(r,$f)):t.scale="symbol";break;default:t.scale=de.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!de.has(n))throw new Error(`unknown scale: ${n}`);return t}function t7(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!de.has(l))continue;let{value:u,order:f=o,reverse:h=s,reduce:d=a,limit:p=c}=wi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?n7:e7:vQ(f),d==null||d===!1)continue;let y=l==="fx"||l==="fy"?wQ(t,r[l]):bQ(n,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=ur(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let w=Array.from(new Kn(g));return h&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?KF(n,"y1","y2"):u==="width"?KF(n,"x1","x2"):U3(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=Pf(d===!0?"max":d,w);y.domain=()=>{let v=pI(lr(g),I=>_.reduceIndex(I,w),I=>g[I]);return f&&v.sort(f),h&&v.reverse(),(x!==0||b!==1/0)&&(v=v.slice(x,b)),v.map(Dl)}}}}function bQ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function wQ(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 KF(e,t,n){let r=U3(e,t),i=U3(e,n);return Wt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function U3(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 vQ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return e7;case"descending":return n7}throw new Error(`invalid order: ${e}`)}function e7([e,t],[n,r]){return mn(t,r)||mn(e,n)}function n7([e,t],[n,r]){return Al(t,r)||mn(e,n)}function ay(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function rc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:Ew(n)}}function ut(e,{document:t}){return Yt(Bs(e).call(t.documentElement))}var q3=0,j3;function r7(){let e=q3;return q3=0,j3=void 0,e}function Yn(e){e!==j3&&(j3=e,console.warn(e),++q3)}var o7=Math.PI,ra=2*o7,i7=.618;function s7({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(gn(e)){let _;if({type:e,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:i=_!==void 0?_:i,insetLeft:o=_!==void 0?_:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=a7(e));let{width:u,height:f,marginLeft:h,marginRight:d,marginTop:p,marginBottom:m}=s,y=u-h-d-o-r,g=f-p-m-n-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=_Q(l,h,p,u-d,f-m);let x=h+o,b=p+n,w;if(c!=null){let[[_,v],[I,E]]=On(e).bounds(c),M=Math.min(y/(I-_),g/(E-v));M>0?(x-=(M*(_+I)-y)/2,b-=(M*(v+E)-g)/2,w=pl({point(N,A){this.stream.point(N*M+x,A*M+b)}})):Yn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?c7():pl({point(_,v){this.stream.point(_+x,v+b)}}),{stream:_=>e.stream(w.stream(l(_)))}}function a7(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Yi(UM,.7463,.4673);case"albers":return Fw(cm,.7463,.4673);case"azimuthal-equal-area":return Yi(qM,4,4);case"azimuthal-equidistant":return Yi(VM,ra,ra);case"conic-conformal":return Fw(GM,ra,ra);case"conic-equal-area":return Fw(Ua,6.1702,2.9781);case"conic-equidistant":return Fw(HM,7.312,3.6282);case"equal-earth":return Yi(JM,5.4133,2.6347);case"equirectangular":return Yi(WM,ra,o7);case"gnomonic":return Yi(KM,3.4641,3.4641);case"identity":return{type:c7};case"reflect-y":return{type:SQ};case"mercator":return Yi(YM,ra,ra);case"orthographic":return Yi(eA,2,2);case"stereographic":return Yi(rA,2,2);case"transverse-mercator":return Yi(oA,ra,ra);default:throw new Error(`unknown projection type: ${e}`)}}function _Q(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 sf(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Yi(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 Fw(e,t,n){let{type:r,aspectRatio:i}=Yi(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 c7=yn({stream:e=>e}),SQ=yn(pl({point(e,t){this.stream.point(e,-t)}}));function V3(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,h){a[l]=f,c[l]=h}});for(l=0;l<s;++l)u.point(i[l],o[l])}function l7({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(gn(e)&&(e=e.type),e!=null)}function u7(e){if(typeof e?.stream=="function")return i7;if(gn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=a7(e);if(t)return t}return i7}}function ic(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=zf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&V3("x","y",o,n),r&&(o.x=en(o.x)),i&&(o.y=en(o.y)),o}function f7(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)Ur(s,o);return[r,i]}var y7=new Map([["accent",DA],["category10",EA],["dark2",NA],["observable10",OA],["paired",LA],["pastel1",BA],["pastel2",CA],["set1",kA],["set2",RA],["set3",FA],["tableau10",$A]]);function g7(e){return e!=null&&y7.has(`${e}`.toLowerCase())}var h7=new Map([...y7,["brbg",ia(Kb,t1)],["prgn",ia(e1,n1)],["piyg",ia(r1,i1)],["puor",ia(o1,s1)],["rdbu",ia(Om,xf)],["rdgy",ia(a1,c1)],["rdylbu",ia(Lm,bf)],["rdylgn",ia(l1,u1)],["spectral",ia(f1,h1)],["burd",d7(Om,xf)],["buylrd",d7(Lm,bf)],["blues",wn(F1,$1)],["greens",wn(P1,U1)],["greys",wn(z1,q1)],["oranges",wn(G1,W1)],["purples",wn(j1,V1)],["reds",wn(Y1,X1)],["turbo",oa(rw)],["viridis",oa(ow)],["magma",oa(sw)],["inferno",oa(aw)],["plasma",oa(cw)],["cividis",oa(H1)],["cubehelix",oa(Z1)],["warm",oa(Q1)],["cool",oa(K1)],["bugn",wn(d1,p1)],["bupu",wn(m1,y1)],["gnbu",wn(g1,x1)],["orrd",wn(b1,w1)],["pubu",wn(S1,I1)],["pubugn",wn(v1,_1)],["purd",wn(M1,A1)],["rdpu",wn(T1,E1)],["ylgn",wn(O1,L1)],["ylgnbu",wn(D1,N1)],["ylorbr",wn(B1,C1)],["ylorrd",wn(k1,R1)],["rainbow",p7(tw)],["sinebow",p7(nw)]]);function wn(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?$n(t,n):e[n])}function ia(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?$n(t,n):e[n])}function d7(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?$n(r=>t(1-r),n):e[n].slice().reverse())}function oa(e){return({length:t})=>$n(e,Math.max(2,Math.floor(t)))}function p7(e){return({length:t})=>$n(e,Math.floor(t)+1).slice(0,-1)}function Y3(e){let t=`${e}`.toLowerCase();if(!h7.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return h7.get(t)}function cy(e,t){let n=Y3(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function x7(e,t="greys"){let n=new Set,[r,i]=cy(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 m7=new Map([["brbg",t1],["prgn",n1],["piyg",i1],["puor",s1],["rdbu",xf],["rdgy",c1],["rdylbu",bf],["rdylgn",u1],["spectral",h1],["burd",e=>xf(1-e)],["buylrd",e=>bf(1-e)],["blues",$1],["greens",U1],["greys",q1],["purples",V1],["reds",X1],["oranges",W1],["turbo",rw],["viridis",ow],["magma",sw],["inferno",aw],["plasma",cw],["cividis",H1],["cubehelix",Z1],["warm",Q1],["cool",K1],["bugn",p1],["bupu",y1],["gnbu",x1],["orrd",w1],["pubugn",_1],["pubu",I1],["purd",A1],["rdpu",E1],["ylgnbu",N1],["ylgn",L1],["ylorbr",C1],["ylorrd",R1],["rainbow",tw],["sinebow",nw]]);function qf(e){let t=`${e}`.toLowerCase();if(!m7.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return m7.get(t)}var IQ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function b7(e){return e!=null&&IQ.has(`${e}`.toLowerCase())}var G3=e=>t=>e(1-t),X3=[0,1],w7=new Map([["number",Se],["rgb",fi],["hsl",UI],["hcl",zI],["lab",Rx]]);function W3(e){let t=`${e}`.toLowerCase();if(!w7.has(t))throw new Error(`unknown interpolator: ${t}`);return w7.get(t)}function Vf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=E7(e,n),unknown:c,round:l,scheme:u,interval:f,range:h=de.get(e)===Ol?EQ(n,a):de.get(e)===Ll?DQ(n,a):de.get(e)===Bl?X3:void 0,interpolate:d=de.get(e)===Yr?u==null&&h!==void 0?fi:qf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?ol:Se,reverse:p}){if(f=Xo(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=W3(d)),p=!!p,h!==void 0){let m=(a=je(a)).length,y=(h=je(h)).length;if(m!==y){if(d.length===1)throw new Error("invalid piecewise interpolator");d=Eo(d,h),h=void 0}}if(d.length===1?(p&&(d=G3(d),p=!1),h===void 0&&(h=Float64Array.from(a,(m,y)=>y/(a.length-1)),h.length===2&&(h=X3)),t.interpolate((h===X3?yn:ly)(d))):t.interpolate(d),s){let[m,y]=ue(a);(m>0||y<0)&&(a=Ja(a),Js(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Oa(a)),t.domain(a).unknown(c),i&&(t.nice(MQ(i,r)),a=t.domain()),h!==void 0&&t.range(h),o&&t.clamp(o),{type:r,domain:a,range:h,scale:t,interpolate:d,interval:f}}function MQ(e,t){return e===!0?void 0:typeof e=="number"?e:DF(e,t)}function v7(e,t,n){return Vf(e,zs(),t,n)}function _7(e,t,n){return H3(e,t,{...n,exponent:.5})}function H3(e,t,{exponent:n=1,...r}){return Vf(e,wm().exponent(n),t,{...r,type:"pow"})}function S7(e,t,{base:n=10,domain:r=NQ(t),...i}){return Vf(e,xm().base(n),t,{...i,domain:r})}function I7(e,t,{constant:n=1,...r}){return Vf(e,bm().constant(n),t,r)}function M7(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=OQ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?$n(c,i):de.get(e)===Yr?cy(o,i):void 0),s.length>0&&(s=vm(s,n===void 0?{length:i}:n).quantiles()),$w(e,t,{domain:s,range:n,reverse:l,unknown:a})}function A7(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=E7(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ue(o),f;return n===void 0?(f=En(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?$n(a,r):de.get(e)===Yr?cy(i,r):void 0):(f=$n(Se(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(h=>new Date(h)))),Js(je(o))<0&&f.reverse(),$w(e,t,{domain:f,range:n,reverse:c,unknown:s})}function $w(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?$n(o,n.length+1):de.get(e)===Yr?cy(i,n.length+1):void 0,reverse:a}){n=je(n);let c=Js(n);if(!isNaN(c)&&!AQ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Oa(s)),{type:"threshold",scale:_m(c<0?Oa(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function AQ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Jn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function T7(e){return{type:"identity",scale:UF(de.get(e))?ym():t=>t}}function jf(e,t=Tf){return e.length?[fe(e,({value:n})=>n===void 0?n:fe(n,t)),Jt(e,({value:n})=>n===void 0?n:Jt(n,t))]:[0,1]}function E7(e,t){let n=de.get(e);return(n===Ol||n===Bl||n===Ll?TQ:jf)(t)}function TQ(e){return[0,e.length?Jt(e,({value:t})=>t===void 0?t:Jt(t,Tf)):1]}function EQ(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=tr(e,.5,({value:s})=>s===void 0?NaN:tr(s,.25,cr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Jt(i);return o<1?i.map(s=>s*o):i}function DQ(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/Jt(r);return i<1?r.map(o=>o*i):r}function NQ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return jf(e,cr);if(n<0)return jf(e,Ya)}return[1,10]}function OQ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function ly(e){return(t,n)=>r=>e(t+r*(n-t))}function Pw(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=jf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:h=!0,interpolate:d=de.get(e)===Yr?u==null&&f!==void 0?fi:qf(u!==void 0?u:"rdbu"):Se,reverse:p}){l=+l,a=je(a);let[m,y]=a;if(a.length>2&&Yn(`Warning: the diverging ${e} scale domain contains extra elements.`),Jn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof d!="function"&&(d=W3(d)),f!==void 0&&(d=d.length===1?ly(d)(...f):Eo(d,f)),p&&(d=G3(d)),h){let g=n.apply(l),x=g-n.apply(m),b=n.apply(y)-g;x<b?m=n.invert(g-b):x>b&&(y=n.invert(g+x))}return t.domain([m,l,y]).unknown(c).interpolator(d),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:d,scale:t}}function D7(e,t,n){return Pw(e,Nm(),LQ,t,n)}function N7(e,t,n){return Z3(e,t,{...n,exponent:.5})}function Z3(e,t,{exponent:n=1,...r}){return Pw(e,Qb().exponent(n=+n),kQ(n),t,{...r,type:"diverging-pow"})}function O7(e,t,{base:n=10,pivot:r=1,domain:i=jf(t,r<0?Ya:cr),...o}){return Pw(e,Zb().base(n=+n),BQ,t,{domain:i,pivot:r,...o})}function L7(e,t,{constant:n=1,...r}){return Pw(e,Jb().constant(n=+n),RQ(n),t,r)}var LQ={apply(e){return e},invert(e){return e}},BQ={apply:Math.log,invert:Math.exp},CQ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function kQ(e){return e===.5?CQ:{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 RQ(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 B7(e,t,n,r){return Vf(e,t,n,r)}function C7(e,t,n){return B7(e,Gb(),t,n)}function k7(e,t,n){return B7(e,Wb(),t,n)}var Yf=Symbol("ordinal");function F7(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Xo(i,r),o===void 0&&(o=q7(n,i,e)),(r==="categorical"||r===Yf)&&(r="ordinal"),a&&(o=Oa(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 $7(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Xo(r,n),i===void 0&&(i=q7(t,r,e));let l;if(de.get(e)===Ff)l=FQ(t),o=o===void 0?$Q(l):Wt(o,$f);else if(de.get(e)===Yr&&(o===void 0&&(n==="ordinal"||n===Yf)&&(o=x7(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=qf(s),f=o[0],h=o[1]-o[0];o=({length:d})=>$n(p=>u(f+h*p),d)}else o=Y3(s);if(a===pm)throw new Error(`implicit unknown on ${e} scale is not supported`);return F7(e,gl().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function P7(e,t,{align:n=.5,padding:r=.5,...i}){return z7(hA().align(n).padding(r),t,i,e)}function U7(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return z7(qa().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function z7(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=F7(r,e,t,n),e.round=i,e}function q7(e,t,n){let r=new Kn;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]=ue(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&de.get(n)===vi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Ds(r,mn)}function R7(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 FQ(e){return{fill:R7(e,"fill"),stroke:R7(e,"stroke")}}function $Q(e){return ie(e.fill)?YA:pw}function uy(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:h,projection:d,facet:{label:p=t}={},...m}={}){let y={};for(let[g,x]of e){let b=m[g],w=Z7(g,x,{round:de.get(g)===vi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:h,projection:d,...b});if(w){let{label:_=g==="fx"||g==="fy"?p:t,percent:v,transform:I,inset:E,insetTop:M=E!==void 0?E:g==="y"?r:0,insetRight:N=E!==void 0?E:g==="x"?i:0,insetBottom:A=E!==void 0?E:g==="y"?o:0,insetLeft:O=E!==void 0?E:g==="x"?s:0}=b||{};if(I==null)I=void 0;else if(typeof I!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?PQ(x,w):_,w.transform=I,g==="x"||g==="fx"?(w.insetLeft=+O,w.insetRight=+N):(g==="y"||g==="fy")&&(w.insetTop=+M,w.insetBottom=+A),y[g]=w}}return y}function Q3(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]=Q7(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function G7(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?qw(t):t;i&&j7(i,s),o&&V7(o,s);let a=i||o?K3(e,t):t;n&&j7(n,a),r&&V7(r,a)}function PQ(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!Ho(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function zw(e){return Math.sign(Js(e.domain()))*Math.sign(Js(e.range()))}function qw(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 K3({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=qw(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 j7(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)],Ho(e)||(e.range=H7(e)),e.scale.range(e.range)}W7(e)}function V7(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],Ho(e)?e.range.reverse():e.range=H7(e),e.scale.range(e.range)}W7(e)}function W7(e){e.round===void 0&&qQ(e)&&UQ(e)<=30&&e.scale.round(!0)}function UQ({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 H7(e){let t=e.scale.domain().length+tT(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 jw(e,t,n){return Z7(e,n===void 0?void 0:[{hint:n}],{...t})}function Z7(e,t=[],n={}){let r=zQ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Ho({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Be)?Yn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Xf(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 "${Xf(r)}".`):i.some(BF)?Yn(`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 "${Xf(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 "${Xf(r)}".`):i.some(CF)&&Yn(`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 "${Xf(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 "${Xf(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=Uw(t,n,en);break;case"identity":switch(de.get(e)){case vi:n=Uw(t,n,en);break;case Ff:n=Uw(t,n,jQ);break}break;case"utc":case"time":n=Uw(t,n,EF);break}switch(r){case"diverging":return D7(e,t,n);case"diverging-sqrt":return N7(e,t,n);case"diverging-pow":return Z3(e,t,n);case"diverging-log":return O7(e,t,n);case"diverging-symlog":return L7(e,t,n);case"categorical":case"ordinal":case Yf:return $7(e,t,n);case"cyclical":case"sequential":case"linear":return v7(e,t,n);case"sqrt":return _7(e,t,n);case"threshold":return $w(e,t,n);case"quantile":return M7(e,t,n);case"quantize":return A7(e,t,n);case"pow":return H3(e,t,n);case"log":return S7(e,t,n);case"symlog":return I7(e,t,n);case"utc":return k7(e,t,n);case"time":return C7(e,t,n);case"point":return P7(e,t,n);case"band":return U7(e,t,n);case"identity":return T7(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Xf(e){return typeof e=="symbol"?e.description:e}function Y7(e){return typeof e=="string"?`${e}`.toLowerCase():e}var X7={toString:()=>"projection"};function zQ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=Y7(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=X7);for(let l of t){let u=Y7(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===X7)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=de.get(e);if(c===Ol)return"sqrt";if(c===Bl||c===Ll)return"linear";if(c===Ff)return"ordinal";if((r||i||[]).length>2)return J3(c);if(r!==void 0){if(De(r))return J3(c);if(Be(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(De))return J3(c);if(l.some(Be))return"utc"}if(c===Yr){if(s!=null||b7(o))return"diverging";if(g7(o))return"categorical"}return"linear"}function J3(e){switch(e){case vi:return"point";case Yr:return Yf;default:return"ordinal"}}function Ho({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Yf}function tT({type:e}){return e==="threshold"}function qQ({type:e}){return e==="point"||e==="band"}function fr(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 Uw(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 jQ(e){return Wt(e,$f)}function oc(e={}){let t;for(let n in e)if(de.has(n)&&Vo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Q7(jw(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function J7(e){return t=>{if(!de.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Q7({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:Ja(n),...r!==void 0&&{range:Ja(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 Vw(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var VQ=Vw(e=>new Intl.NumberFormat(e)),YQ=Vw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),XQ=Vw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function GQ(e="en-US"){let t=VQ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function K7(e="en-US",t="short"){let n=YQ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function t$(e="en-US",t="short"){let n=XQ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function eT(e){return Ef(e,"Invalid Date")}function WQ(e="en-US"){let t=GQ(e);return n=>(n instanceof Date?eT:typeof n=="number"?t:qe)(n)}var Xi=WQ();var Ce=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,HQ=0;function Yw(){return`plot-clip-${++HQ}`}function Xw(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:I},{ariaLabel:E,fill:M="currentColor",fillOpacity:N,stroke:A="none",strokeOpacity:O,strokeWidth:C,strokeLinecap:S,strokeLinejoin:T,strokeMiterlimit:D,paintOrder:R}){M===null&&(a=null,c=null),A===null&&(l=null,f=null),ie(M)?!ie(A)&&(!ie(a)||I?.fill)&&(A="none"):ie(A)&&(!ie(l)||I?.stroke)&&(M="none");let[F,k]=Le(a,M),[$,P]=ae(c,N),[U,W]=Le(l,A),[nt,ot]=ae(f,O),[at,Y]=ae(g);ea(W)||(u===void 0&&(u=C),d===void 0&&(d=S),h===void 0&&(h=T),p===void 0&&!RF(h)&&(p=D),!ea(k)&&w===void 0&&(w=R));let[st,q]=ae(u);return M!==null&&(e.fill=he(k,"currentColor"),e.fillOpacity=fy(P,1)),A!==null&&(e.stroke=he(W,"none"),e.strokeWidth=fy(q,1),e.strokeOpacity=fy(ot,1),e.strokeLinejoin=he(h,"miter"),e.strokeLinecap=he(d,"butt"),e.strokeMiterlimit=fy(p,4),e.strokeDasharray=he(m,"none"),e.strokeDashoffset=he(y,"0")),e.target=qe(s),e.ariaLabel=qe(E),e.ariaDescription=qe(i),e.ariaHidden=qe(o),e.opacity=fy(Y,1),e.mixBlendMode=he(x,"normal"),e.imageFilter=he(b,"none"),e.paintOrder=he(w,"normal"),e.pointerEvents=he(_,"auto"),e.shapeRendering=he(v,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:F,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:nt,scale:"auto",optional:!0},strokeWidth:{value:st,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function ZQ(e,t){t&&e.filter(n=>Zm(t[n])).append("title").call(QQ,t)}function JQ(e,t){t&&e.filter(([n])=>Zm(t[n])).append("title").call(KQ,t)}function QQ(e,t){t&&e.text(n=>Xi(t[n]))}function KQ(e,t){t&&e.text(([n])=>Xi(t[n]))}function Kt(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",h=>r[h]),o&&ft(e,"fill",h=>o[h]),s&&ft(e,"fill-opacity",h=>s[h]),a&&ft(e,"stroke",h=>a[h]),c&&ft(e,"stroke-opacity",h=>c[h]),l&&ft(e,"stroke-width",h=>l[h]),u&&ft(e,"opacity",h=>u[h]),f&&e$(e,h=>f[h],t),n||ZQ(e,i)}function Cl(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",([h])=>r[h]),o&&ft(e,"fill",([h])=>o[h]),s&&ft(e,"fill-opacity",([h])=>s[h]),a&&ft(e,"stroke",([h])=>a[h]),c&&ft(e,"stroke-opacity",([h])=>c[h]),l&&ft(e,"stroke-width",([h])=>l[h]),u&&ft(e,"opacity",([h])=>u[h]),f&&e$(e,([h])=>f[h],t),n||JQ(e,i)}function tK({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 hy(e,t,n){let r=fn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Yn("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*Gw(e,t,n,r){let{z:i}=n,{z:o}=r,s=tK(r,n),a=[...t,...s];for(let c of o?hy(e,o,i):[e]){let l,u;t:for(let f of c){for(let h of a)if(!ze(h[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(h=>Ks(h[f])),u=[f];continue}u.push(f);for(let h=0;h<s.length;++h)if(Ks(s[h][f])!==l[h]){yield u,l=s.map(p=>Ks(p[f])),u=[f];continue t}}u&&(yield u)}}function eK(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,h=Yw();i=`url(#${h})`,e=ut("svg:g",r).call(d=>d.append("svg:clipPath").attr("id",h).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=Yw();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",On(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 kt(e,t,n,r){eK(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 Ct(e,t){nK(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function e$(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ui.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ui.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 nK(e,t,n){n!=null&&e.style(t,n)}function Et(e,t,{x:n,y:r},i=Ce,o=Ce){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 he(e,t){if((e=qe(e))!==t)return e}function fy(e,t){if((e=Bt(e))!==t)return e}var rK=/^-?([_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 Gf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!rK.test(e))throw new Error(`invalid class name: ${e}`);return e}function Wf(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 vn({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 r$(e,t,n={}){let r=.5-Ce,i=.5+Ce,o=.5+Ce,s=.5-Ce;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:x}of t)m>r&&(r=m),y>i&&(i=y),g>o&&(o=g),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:h=640,height:d=iK(e,n,{width:h,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;h=+h,d=+d;let p={width:h,height:d,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};y=+y,g=+g,x=+x,b=+b,p.facet={marginTop:y,marginRight:g,marginBottom:x,marginLeft:b}}return p}function iK({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,h=u7(i);if(h){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*h,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let d=t?Ho(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=n$("y",t)/(n$("x",e)*o),m=r?r.scale.bandwidth():1,y=n?n.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||n)*Math.max(1,Math.min(60,d*f))*20+!!r*30+60}function n$(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]=ue(r);return Math.abs(i(s)-i(o))}function o$(e,t){let{fx:n,fy:r}=uy(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?ux(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 s$(e,{x:t,y:n}){return t&&=sT(t),n&&=sT(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 Hw(e,{fx:t,fy:n}){let r=lr(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 a$(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 c$(e){let t=[],n=new Uint32Array(Dn(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 oK=new Map([["top",nT],["right",oT],["bottom",rT],["left",iT],["top-left",Ww(nT,iT)],["top-right",Ww(nT,oT)],["bottom-left",Ww(rT,iT)],["bottom-right",Ww(rT,oT)],["top-empty",aK],["right-empty",uK],["bottom-empty",cK],["left-empty",lK],["empty",fK]]);function l$(e){if(e==null)return null;let t=oK.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var i$=new WeakMap;function sT(e){let t=i$.get(e);return t||i$.set(e,t=new Qn(Wt(e,(n,r)=>[n,r]))),t}function sc(e,t){return sT(e).get(t)}function sK(e,t,n){return t=Ks(t),n=Ks(n),e.find(r=>Object.is(Ks(r.x),t)&&Object.is(Ks(r.y),n))}function Zw(e,t,n){return sK(e,t,n)?.empty}function nT(e,{y:t},{y:n}){return t?sc(t,n)===0:!0}function rT(e,{y:t},{y:n}){return t?sc(t,n)===t.length-1:!0}function iT(e,{x:t},{x:n}){return t?sc(t,n)===0:!0}function oT(e,{x:t},{x:n}){return t?sc(t,n)===t.length-1:!0}function aK(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,r);if(o>0)return Zw(e,n,t[o-1])}function cK(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,r);if(o<t.length-1)return Zw(e,n,t[o+1])}function lK(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,n);if(o>0)return Zw(e,t[o-1],r)}function uK(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,n);if(o<t.length-1)return Zw(e,t[o+1],r)}function fK(e,t,{empty:n}){return n}function Ww(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Jw(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 St=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:h=0,marginTop:d=h,marginRight:p=h,marginBottom:m=h,marginLeft:y=h,clip:g=i?.clip,channels:x,tip:b,render:w}=r;if(this.data=t,this.sort=Yo(l)?l:null,this.initializer=Me(r).initializer,this.transform=this.initializer?r.transform:bn(r).transform,o===null||o===!1?this.facet=null:(this.facet=cn(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Ha&&typeof a=="string"?[a]:a,this.fy=t===Ha&&typeof c=="string"?[c]:c),this.facetAnchor=l$(s),n=ny(n),x!==void 0&&(n={...hK(x),...n}),i!==void 0&&(n={...Xw(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([_,v])=>{if(Vr(v.value)){let{value:I,label:E=v.label,scale:M=v.scale}=v.value;v={...v,label:E,scale:M,value:I}}if(t===Ha&&typeof v.value=="string"){let{value:I}=v;v={...v,value:[I]}}return[_,v]}).filter(([_,{value:v,optional:I}])=>{if(v!=null)return!0;if(I)return!1;throw new Error(`missing channel value: ${_}`)})),this.dx=+u,this.dy=+f,this.marginTop=+d,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=Ew(g),this.tip=dK(b),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let _ in this.channels){let{scale:v}=n[_];if(!(v!=="x"&&v!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=Hf(w,this.render))}initialize(t,n,r){let i=je(this.data);t===void 0&&i!=null&&(t=[lr(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=Rw(this.channels,i);return this.sort!=null&&t7(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=ze}=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"&&V3(i,o,n,r.projection)}}scale(t,n,r){let i=zf(t,n);return r.projection&&this.project(t,i,r),i}};function nn(...e){return e.plot=St.prototype.plot,e}function Hf(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,h)=>t.call(this,c,l,u,f,h,a))}}function hK(e){return Object.fromEntries(Object.entries(ny(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:wi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function dK(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?cn(e,"tip",["x","y","xy"]):e}function Gi(e,t){return e?.tip===!0?{...e,tip:t}:gn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var u$=new WeakMap;function aT(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:Hf(function(u,f,h,d,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=u$.get(y);x||u$.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:_,fx:v,fy:I}=f,E=v?v(u.fx)-d.marginLeft:0,M=I?I(u.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),_?.bandwidth&&(M+=_.bandwidth()/2);let N=u.fi!=null,A;if(N){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),A=Y.get(this),A||Y.set(this,A=new Map)}let[O,C]=vn(this,d),{px:S,py:T}=h,D=S?Y=>S[Y]:cT(h,O),R=T?Y=>T[Y]:lT(h,C),F,k,$,P;function U(Y,st){if(N)if(P&&(P=cancelAnimationFrame(P)),Y==null)A.delete(u.fi);else{A.set(u.fi,st),P=requestAnimationFrame(()=>{P=null;for(let[q,Z]of A)if(Z<st||Z===st&&q<u.fi){Y=null;break}W(Y)});return}W(Y)}function W(Y){if(F===Y&&$===x.sticky)return;F=Y,$=p.pointerSticky=x.sticky;let st=F==null?[]:[F];N&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let q=m(st,f,h,d,p);if(k){if(N){let Z=k.parentNode,rt=k.getAttribute("transform"),z=q.getAttribute("transform");rt?q.setAttribute("transform",rt):q.removeAttribute("transform"),z?Z.setAttribute("transform",z):Z.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}k.replaceWith(q)}return x.roots[b]=k=q,F==null&&A?.size>1||p.dispatchValue(F==null?null:g[F]),q}function nt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[st,q]=Fn(Y);st-=E,q-=M;let Z=st<d.marginLeft||st>d.width-d.marginRight?1:e,rt=q<d.marginTop||q>d.height-d.marginBottom?1:t,z=null,Rt=s*s;for(let ht of u){let Ht=Z*(D(ht)-st),Qt=rt*(R(ht)-q),tt=Ht*Ht+Qt*Qt;tt<=Rt&&(z=ht,Rt=tt)}if(z!=null&&(e!==1||t!==1)){let ht=D(z)-st,Ht=R(z)-q;Rt=ht*ht+Ht*Ht}U(z,Rt)}function ot(Y){Y.pointerType==="mouse"&&F!=null&&(x.sticky&&x.roots.some(st=>st?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(st=>st(null))):(x.sticky=!0,W(F)),Y.stopImmediatePropagation()))}function at(Y){Y.pointerType==="mouse"&&(x.sticky||U(null))}return y.addEventListener("pointerenter",nt),y.addEventListener("pointermove",nt),y.addEventListener("pointerdown",ot),y.addEventListener("pointerleave",at),W(null)},c)}}function ac(e){return aT(1,1,e)}function cc(e){return aT(1,.01,e)}function sa(e){return aT(.01,1,e)}function cT({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function lT({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function Qw(e){return Ho(e)&&e.interval===void 0?void 0:"tabular-nums"}function f$(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:h,fontVariant:d=Qw(e),round:p=!0,opacity:m,className:y}=t,g=rc(t);y=Gf(y),m=ae(m)[1],h===null&&(h=()=>null);let x=ut("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${y}-ramp) {
|
|
1
|
+
var YD=Object.create;var ub=Object.defineProperty;var UD=Object.getOwnPropertyDescriptor;var jD=Object.getOwnPropertyNames;var XD=Object.getPrototypeOf,GD=Object.prototype.hasOwnProperty;var cT=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ec=(t,e)=>{for(var n in e)ub(t,n,{get:e[n],enumerable:!0})},VD=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jD(e))!GD.call(t,o)&&o!==n&&ub(t,o,{get:()=>e[o],enumerable:!(r=UD(e,o))||r.enumerable});return t};var WD=(t,e,n)=>(n=t!=null?YD(XD(t)):{},VD(e||!t||!t.__esModule?ub(n,"default",{value:t,enumerable:!0}):n,t));var OR=cT((G9t,NR)=>{"use strict";function pH(t,e,n,r,o){for(var i=o+1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c>=0?(i=s,o=s-1):r=s+1}return i}function dH(t,e,n,r,o){for(var i=o+1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c>0?(i=s,o=s-1):r=s+1}return i}function hH(t,e,n,r,o){for(var i=r-1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c<0?(i=s,r=s+1):o=s-1}return i}function mH(t,e,n,r,o){for(var i=r-1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c<=0?(i=s,r=s+1):o=s-1}return i}function gH(t,e,n,r,o){for(;r<=o;){var i=r+o>>>1,s=t[i],a=n!==void 0?n(s,e):s-e;if(a===0)return i;a<=0?r=i+1:o=i-1}return-1}function Td(t,e,n,r,o,i){return typeof n=="function"?i(t,e,n,r===void 0?0:r|0,o===void 0?t.length-1:o|0):i(t,e,void 0,n===void 0?0:n|0,r===void 0?t.length-1:r|0)}NR.exports={ge:function(t,e,n,r,o){return Td(t,e,n,r,o,pH)},gt:function(t,e,n,r,o){return Td(t,e,n,r,o,dH)},lt:function(t,e,n,r,o){return Td(t,e,n,r,o,hH)},le:function(t,e,n,r,o){return Td(t,e,n,r,o,mH)},eq:function(t,e,n,r,o){return Td(t,e,n,r,o,gH)}}});var zR=cT((V9t,BR)=>{"use strict";var o1=OR(),Hf=0,Xa=1,r1=2;BR.exports=xH;function Q3(t,e,n,r,o){this.mid=t,this.left=e,this.right=n,this.leftPoints=r,this.rightPoints=o,this.count=(e?e.count:0)+(n?n.count:0)+r.length}var Ed=Q3.prototype;function H3(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function DR(t,e){var n=Zf(e);t.mid=n.mid,t.left=n.left,t.right=n.right,t.leftPoints=n.leftPoints,t.rightPoints=n.rightPoints,t.count=n.count}function RR(t,e){var n=t.intervals([]);n.push(e),DR(t,n)}function LR(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?Hf:(n.splice(r,1),DR(t,n),Xa)}Ed.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t};Ed.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?RR(this,t):this.left.insert(t):this.left=Zf([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?RR(this,t):this.right.insert(t):this.right=Zf([t]);else{var n=o1.ge(this.leftPoints,t,J3),r=o1.ge(this.rightPoints,t,K3);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}};Ed.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return Hf;var n=this.right?this.right.count:0;if(4*n>3*(e-1))return LR(this,t);var r=this.left.remove(t);return r===r1?(this.left=null,this.count-=1,Xa):(r===Xa&&(this.count-=1),r)}else if(t[0]>this.mid){if(!this.right)return Hf;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return LR(this,t);var r=this.right.remove(t);return r===r1?(this.right=null,this.count-=1,Xa):(r===Xa&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===t?r1:Hf;if(this.leftPoints.length===1&&this.leftPoints[0]===t){if(this.left&&this.right){for(var i=this,s=this.left;s.right;)i=s,s=s.right;if(i===this)s.right=this.right;else{var a=this.left,r=this.right;i.count-=s.count,i.right=s.left,s.left=a,s.right=r}H3(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?H3(this,this.left):H3(this,this.right);return Xa}for(var a=o1.ge(this.leftPoints,t,J3);a<this.leftPoints.length&&this.leftPoints[a][0]===t[0];++a)if(this.leftPoints[a]===t){this.count-=1,this.leftPoints.splice(a,1);for(var r=o1.ge(this.rightPoints,t,K3);r<this.rightPoints.length&&this.rightPoints[r][1]===t[1];++r)if(this.rightPoints[r]===t)return this.rightPoints.splice(r,1),Xa}return Hf}};function PR(t,e,n){for(var r=0;r<t.length&&t[r][0]<=e;++r){var o=n(t[r]);if(o)return o}}function FR(t,e,n){for(var r=t.length-1;r>=0&&t[r][1]>=e;--r){var o=n(t[r]);if(o)return o}}function qR(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}Ed.queryPoint=function(t,e){if(t<this.mid){if(this.left){var n=this.left.queryPoint(t,e);if(n)return n}return PR(this.leftPoints,t,e)}else if(t>this.mid){if(this.right){var n=this.right.queryPoint(t,e);if(n)return n}return FR(this.rightPoints,t,e)}else return qR(this.leftPoints,e)};Ed.queryInterval=function(t,e,n){if(t<this.mid&&this.left){var r=this.left.queryInterval(t,e,n);if(r)return r}if(e>this.mid&&this.right){var r=this.right.queryInterval(t,e,n);if(r)return r}return e<this.mid?PR(this.leftPoints,e,n):t>this.mid?FR(this.rightPoints,t,n):qR(this.leftPoints,n)};function yH(t,e){return t-e}function J3(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function K3(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function Zf(t){if(t.length===0)return null;for(var e=[],n=0;n<t.length;++n)e.push(t[n][0],t[n][1]);e.sort(yH);for(var r=e[e.length>>1],o=[],i=[],s=[],n=0;n<t.length;++n){var a=t[n];a[1]<r?o.push(a):r<a[0]?i.push(a):s.push(a)}var c=s,f=s.slice();return c.sort(J3),f.sort(K3),new Q3(r,Zf(o),Zf(i),c,f)}function Z3(t){this.root=t}var Qf=Z3.prototype;Qf.insert=function(t){this.root?this.root.insert(t):this.root=new Q3(t[0],null,null,[t],[t])};Qf.remove=function(t){if(this.root){var e=this.root.remove(t);return e===r1&&(this.root=null),e!==Hf}return!1};Qf.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)};Qf.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)};Object.defineProperty(Qf,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(Qf,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function xH(t){return!t||t.length===0?new Z3(null):new Z3(Zf(t))}});var fT={};function ml(t,e=!1){let n,r,o=fT;function i(f){n=t(f).finally(()=>{if(r){let{value:l}=r;r=null,i(l)}else n=null})}function s(f){r={event:f}}function a(f){n?s(f):i(f)}function c(f){o!==f&&requestAnimationFrame(()=>{let l=o;o=fT,a(l)}),o=f}return e?c:a}var _n=class{constructor(e){this._filterBy=e,this._requestUpdate=ml(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(e){this._coordinator=e}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(e){return this}query(e){return null}queryPending(){return this}queryResult(e){return this}queryError(e){return this}requestQuery(e){let n=e||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var gl=Uint8Array.of(65,82,82,79,87,49),Zn={V1:0,V2:1,V3:2,V4:3,V5:4};var Qn={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},z={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},nc={HALF:0,SINGLE:1,DOUBLE:2},To={DAY:0,MILLISECOND:1},Ae={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},Jn={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},Eo={Sparse:0,Dense:1};var rc=Uint8Array,dh=Uint16Array,hh=Uint32Array,mh=BigUint64Array,yl=Int8Array,lT=Int16Array,Sn=Int32Array,On=BigInt64Array,pb=Float32Array,Mi=Float64Array;function uT(t,e){let n=Math.log2(t)-3;return(e?[yl,lT,Sn,On]:[rc,dh,hh,mh])[n]}var AQ=Object.getPrototypeOf(Int8Array);function oc(t,e){let n=0,r=t.length;if(r<=2147483648)do{let o=n+r>>>1;t[o]<=e?n=o+1:r=o}while(n<r);else do{let o=Math.trunc((n+r)/2);t[o]<=e?n=o+1:r=o}while(n<r);return n}function gh(t,e,n){if(e(t))return t;throw new Error(n(t))}function Mn(t,e,n){return e=Array.isArray(e)?e:Object.values(e),gh(t,r=>e.includes(r),n??(()=>`${t} must be one of ${e}`))}function yh(t,e){for(let[n,r]of Object.entries(t))if(r===e)return n;return"<Unknown>"}var Io=t=>`Unsupported data type: "${yh(z,t)}" (id ${t})`,xl=(t,e,n=!0,r=null)=>({name:t,type:e,nullable:n,metadata:r});function pT(t){return Object.hasOwn(t,"name")&&dT(t.type)}function dT(t){return typeof t?.typeId=="number"}function Ai(t,e="",n=!0){return pT(t)?t:xl(e,gh(t,dT,()=>"Data type expected."),n)}var xh=(t,e,n=!1,r=-1)=>({typeId:z.Dictionary,id:r,dictionary:t,indices:e||ic(),ordered:n});var bh=(t=32,e=!0)=>({typeId:z.Int,bitWidth:Mn(t,[8,16,32,64]),signed:e,values:uT(t,e)});var ic=()=>bh(32);var db=(t=2)=>({typeId:z.Float,precision:Mn(t,nc),values:[dh,pb,Mi][t]});var hb=()=>({typeId:z.Binary,offsets:Sn}),wh=()=>({typeId:z.Utf8,offsets:Sn});var mb=(t,e,n=128)=>({typeId:z.Decimal,precision:t,scale:e,bitWidth:Mn(n,[128,256]),values:mh}),gb=t=>({typeId:z.Date,unit:Mn(t,To),values:t===To.DAY?Sn:On});var yb=(t=Ae.MILLISECOND,e=32)=>({typeId:z.Time,unit:Mn(t,Ae),bitWidth:Mn(e,[32,64]),values:e===32?Sn:On});var vh=(t=Ae.MILLISECOND,e=null)=>({typeId:z.Timestamp,unit:Mn(t,Ae),timezone:e,values:On}),xb=(t=Jn.MONTH_DAY_NANO)=>({typeId:z.Interval,unit:Mn(t,Jn),values:t===Jn.MONTH_DAY_NANO?void 0:Sn}),_h=t=>({typeId:z.List,children:[Ai(t)],offsets:Sn}),Sh=t=>({typeId:z.Struct,children:Array.isArray(t)&&pT(t[0])?t:Object.entries(t).map(([e,n])=>xl(e,n))}),bb=(t,e,n,r)=>(n??=e.map((o,i)=>i),{typeId:z.Union,mode:Mn(t,Eo),typeIds:n,typeMap:n.reduce((o,i,s)=>(o[i]=s,o),{}),children:e.map((o,i)=>Ai(o,`_${i}`)),typeIdForValue:r,offsets:Sn}),wb=t=>({typeId:z.FixedSizeBinary,stride:t}),Mh=(t,e)=>({typeId:z.FixedSizeList,stride:e,children:[Ai(t)]}),hT=(t,e)=>({typeId:z.Map,keysSorted:t,children:[e],offsets:Sn});var vb=(t=Ae.MILLISECOND)=>({typeId:z.Duration,unit:Mn(t,Ae),values:On}),_b=()=>({typeId:z.LargeBinary,offsets:On}),Sb=()=>({typeId:z.LargeUtf8,offsets:On}),Mb=t=>({typeId:z.LargeList,children:[Ai(t)],offsets:On}),Ab=(t,e)=>({typeId:z.RunEndEncoded,children:[gh(Ai(t,"run_ends"),n=>n.type.typeId===z.Int,()=>"Run-ends must have an integer type."),Ai(e,"values")]});var Tb=t=>({typeId:z.ListView,children:[Ai(t,"value")],offsets:Sn}),Eb=t=>({typeId:z.LargeListView,children:[Ai(t,"value")],offsets:On});var HD=new Mi(2),Ah=HD.buffer,RQ=new On(Ah),LQ=new hh(Ah),DQ=new Sn(Ah),PQ=new rc(Ah);function Or(t){if(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${t}`);return Number(t)}function Th(t,e){return Number(t/e)+Number(t%e)/Number(e)}var sc=t=>BigInt.asUintN(64,t);function gT(t,e){let n=e<<1,r;return BigInt.asIntN(64,t[n+1])<0?(r=sc(~t[n])|sc(~t[n+1])<<64n,r=-(r+1n)):r=t[n]|t[n+1]<<64n,r}function yT(t,e){let n=e<<2,r;return BigInt.asIntN(64,t[n+3])<0?(r=sc(~t[n])|sc(~t[n+1])<<64n|sc(~t[n+2])<<128n|sc(~t[n+3])<<192n,r=-(r+1n)):r=t[n]|t[n+1]<<64n|t[n+2]<<128n|t[n+3]<<192n,r}var QD=new TextDecoder("utf-8"),YQ=new TextEncoder;function ac(t){return QD.decode(t)}var ks=4;function Ib(t,e){return(t[e>>3]&1<<e%8)!==0}function We(t,e){let n=e+zt(t,e),r=n-zt(t,n),o=Pe(t,r);return(i,s,a=null)=>{if(i<o){let c=Pe(t,r+i);if(c)return s(t,n+c)}return a}}function yr(t,e){return e}function Ti(t,e){return!!JD(t,e)}function JD(t,e){return bl(t,e)<<24>>24}function bl(t,e){return t[e]}function Pe(t,e){return KD(t,e)<<16>>16}function KD(t,e){return t[e]|t[e+1]<<8}function zt(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function xT(t,e){return zt(t,e)>>>0}function Te(t,e){return Or(BigInt.asIntN(64,BigInt(xT(t,e))+(BigInt(xT(t,e+ks))<<32n)))}function Ns(t,e){let n=e+zt(t,e),r=zt(t,n);return n+=ks,ac(t.subarray(n,n+r))}function Rn(t,e,n,r){if(!e)return[];let o=e+zt(t,e);return Array.from({length:zt(t,o)},(i,s)=>r(t,o+ks+s*n))}var $b=Symbol("rowIndex");function wl(t,e){class n{constructor(i){this[$b]=i}toJSON(){return bT(t,e,this[$b])}}let r=n.prototype;for(let o=0;o<t.length;++o){if(Object.hasOwn(r,t[o]))continue;let i=e[o];Object.defineProperty(r,t[o],{get(){return i.at(this[$b])},enumerable:!0})}return o=>new n(o)}function Eh(t,e){return n=>bT(t,e,n)}function bT(t,e,n){let r={};for(let o=0;o<t.length;++o)r[t[o]]=e[o].at(n);return r}function wT(t){return t instanceof Ei}var Os=class{static ArrayType=null;constructor({length:e,nullCount:n,type:r,validity:o,values:i,offsets:s,sizes:a,children:c}){this.length=e,this.nullCount=n,this.type=r,this.validity=o,this.values=i,this.offsets=s,this.sizes=a,this.children=c,(!n||!this.validity)&&(this.at=f=>this.value(f))}get[Symbol.toStringTag](){return"Batch"}at(e){return this.isValid(e)?this.value(e):null}isValid(e){return Ib(this.validity,e)}value(e){return this.values[e]}slice(e,n){let r=n-e,o=Array(r);for(let i=0;i<r;++i)o[i]=this.at(e+i);return o}*[Symbol.iterator](){for(let e=0;e<this.length;++e)yield this.at(e)}},Ei=class extends Os{constructor(e){super(e);let{length:n,values:r}=this;this.values=r.subarray(0,n)}slice(e,n){return this.nullCount?super.slice(e,n):this.values.subarray(e,n)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},vl=class extends Os{static ArrayType=Mi},te=class extends Os{static ArrayType=Array},_l=class extends te{value(e){return null}},Rr=class extends vl{value(e){return Or(this.values[e])}},Ih=class extends vl{value(e){let n=this.values[e],r=(n&31744)>>10,o=(n&1023)/1024,i=(-1)**((n&32768)>>15);switch(r){case 31:return i*(o?Number.NaN:1/0);case 0:return i*(o?6103515625e-14*o:0)}return i*2**(r-15)*(1+o)}},$h=class extends te{value(e){return Ib(this.values,e)}},Ch=class extends Os{constructor(e){super(e);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?gT:yT,this.scale=10n**BigInt(r)}},kh=class extends Ch{static ArrayType=Mi;value(e){return Th(this.decimal(this.values,e),this.scale)}},Nh=class extends Ch{static ArrayType=Array;value(e){return this.decimal(this.values,e)}},Sl=class extends te{constructor(e){super(e),this.source=e}value(e){return new Date(this.source.value(e))}},Oh=class extends vl{value(e){return 864e5*this.values[e]}},vT=Rr,Rh=class extends Rr{value(e){return super.value(e)*1e3}},_T=Rr,Lh=class extends Rr{value(e){return Th(this.values[e],1000n)}},Dh=class extends Rr{value(e){return Th(this.values[e],1000000n)}},Ph=class extends te{value(e){return this.values.subarray(e<<1,e+1<<1)}},Fh=class extends te{value(e){let n=this.values,r=e<<4;return Float64Array.of(zt(n,r),zt(n,r+4),Te(n,r+8))}},ST=({values:t,offsets:e},n)=>t.subarray(e[n],e[n+1]),MT=({values:t,offsets:e},n)=>t.subarray(Or(e[n]),Or(e[n+1])),qh=class extends te{value(e){return ST(this,e)}},Bh=class extends te{value(e){return MT(this,e)}},zh=class extends te{value(e){return ac(ST(this,e))}},Yh=class extends te{value(e){return ac(MT(this,e))}},Uh=class extends te{value(e){let n=this.offsets;return this.children[0].slice(n[e],n[e+1])}},jh=class extends te{value(e){let n=this.offsets;return this.children[0].slice(Or(n[e]),Or(n[e+1]))}},Xh=class extends te{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(n,r)}},Gh=class extends te{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(Or(n),Or(r))}},Vh=class extends te{constructor(e){super(e),this.stride=this.type.stride}},Wh=class extends Vh{value(e){let{stride:n,values:r}=this;return r.subarray(e*n,(e+1)*n)}},Hh=class extends Vh{value(e){let{children:n,stride:r}=this;return n[0].slice(e*r,(e+1)*r)}};function AT({children:t,offsets:e},n){let[r,o]=t[0].children,i=e[n],s=e[n+1],a=[];for(let c=i;c<s;++c)a.push([r.at(c),o.at(c)]);return a}var Zh=class extends te{value(e){return AT(this,e)}},Qh=class extends te{value(e){return new Map(AT(this,e))}},Ml=class extends te{constructor({typeIds:e,...n}){super(n),this.typeIds=e,this.typeMap=this.type.typeMap}value(e,n=e){let{typeIds:r,children:o,typeMap:i}=this;return o[i[r[e]]].at(n)}},Jh=class extends Ml{value(e){return super.value(e,this.offsets[e])}},Al=class extends te{constructor(e,n=Eh){super(e),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(e){return this.factory(e)}},Kh=class extends Al{constructor(e){super(e,wl)}},tm=class extends te{value(e){let[{values:n},r]=this.children;return r.at(oc(n,e))}},em=class extends te{setDictionary(e){return this.dictionary=e,this.cache=e.cache(),this}value(e){return this.cache[this.key(e)]}key(e){return this.values[e]}},nm=class extends te{constructor({data:e,...n}){super(n),this.data=e}view(e){let{values:n,data:r}=this,o=e<<4,i=o+4,s=n,a=zt(s,o);return a>12&&(i=zt(s,o+12),s=r[zt(s,o+8)]),s.subarray(i,i+a)}},rm=class extends nm{value(e){return this.view(e)}},om=class extends nm{value(e){return ac(this.view(e))}};function Cb(t){let e=[];return{add(n){return e.push(n),this},clear:()=>e=[],done:()=>new Rs(e,t)}}var Rs=class{constructor(e,n=e[0]?.type){this.type=n,this.length=e.reduce((i,s)=>i+s.length,0),this.nullCount=e.reduce((i,s)=>i+s.nullCount,0),this.data=e;let r=e.length,o=new Int32Array(r+1);if(r===1){let[i]=e;o[1]=i.length,this.at=s=>i.at(s)}else for(let i=0,s=0;i<r;++i)o[i+1]=s+=e[i].length;this.offsets=o}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let e=this.data;return e.length===1?e[0][Symbol.iterator]():tP(e)}at(e){let{data:n,offsets:r}=this,o=oc(r,e)-1;return n[o]?.at(e-r[o])}get(e){return this.at(e)}toArray(){let{length:e,nullCount:n,data:r}=this,o=!n&&wT(r[0]),i=r.length;if(o&&i===1)return r[0].values;let s=!i||n>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new s(e);return o?eP(a,r):nP(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*tP(t){for(let e=0;e<t.length;++e){let n=t[e][Symbol.iterator]();for(let r=n.next();!r.done;r=n.next())yield r.value}}function eP(t,e){for(let n=0,r=0;n<e.length;++n){let{values:o}=e[n];t.set(o,r),r+=o.length}return t}function nP(t,e){let n=-1;for(let r=0;r<e.length;++r){let o=e[r];for(let i=0;i<o.length;++i)t[++n]=o.at(i)}return t}var cc=class t{constructor(e,n,r=!1){let o=e.fields.map(s=>s.name);this.schema=e,this.names=o,this.children=n,this.factory=r?wl:Eh;let i=[];this.getFactory=s=>i[s]??(i[s]=this.factory(o,n.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(e){return this.children[e]}getChild(e){let n=this.names.findIndex(r=>r===e);return n>-1?this.children[n]:void 0}selectAt(e,n=[]){let{children:r,factory:o,schema:i}=this,{fields:s}=i;return new t({...i,fields:e.map((a,c)=>rP(s[a],n[c]))},e.map(a=>r[a]),o===wl)}select(e,n){let r=this.names,o=e.map(i=>r.indexOf(i));return this.selectAt(o,n)}toColumns(){let{children:e,names:n}=this,r={};return n.forEach((o,i)=>r[o]=e[i]?.toArray()??[]),r}toArray(){let{children:e,getFactory:n,numRows:r}=this,o=e[0]?.data??[],i=Array(r);for(let s=0,a=-1;s<o.length;++s){let c=n(s);for(let f=0;f<o[s].length;++f)i[++a]=c(f)}return i}*[Symbol.iterator](){let{children:e,getFactory:n}=this,r=e[0]?.data??[];for(let o=0;o<r.length;++o){let i=n(o);for(let s=0;s<r[o].length;++s)yield i(s)}}at(e){let{children:n,getFactory:r,numRows:o}=this;if(e<0||e>=o)return null;let[{offsets:i}]=n,s=oc(i,e)-1;return r(s)(e-i[s])}get(e){return this.at(e)}};function rP(t,e){return e!=null&&e!==t.name?{...t,name:e}:t}function Tl(t,e={}){let{typeId:n,bitWidth:r,precision:o,unit:i}=t,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:f,useProxy:l}=e;switch(n){case z.Null:return _l;case z.Bool:return $h;case z.Int:case z.Time:case z.Duration:return s||r<64?Ei:Rr;case z.Float:return o?Ei:Ih;case z.Date:return TT(i===To.DAY?Oh:vT,a&&Sl);case z.Timestamp:return TT(i===Ae.SECOND?Rh:i===Ae.MILLISECOND?_T:i===Ae.MICROSECOND?Lh:Dh,a&&Sl);case z.Decimal:return c?Nh:kh;case z.Interval:return i===Jn.DAY_TIME?Ph:i===Jn.YEAR_MONTH?Ei:Fh;case z.FixedSizeBinary:return Wh;case z.Utf8:return zh;case z.LargeUtf8:return Yh;case z.Binary:return qh;case z.LargeBinary:return Bh;case z.BinaryView:return rm;case z.Utf8View:return om;case z.List:return Uh;case z.LargeList:return jh;case z.Map:return f?Qh:Zh;case z.ListView:return Xh;case z.LargeListView:return Gh;case z.FixedSizeList:return Hh;case z.Struct:return l?Kh:Al;case z.RunEndEncoded:return tm;case z.Dictionary:return em;case z.Union:return t.mode?Jh:Ml}throw new Error(Io(n))}function TT(t,e){return e?class extends e{constructor(r){super(new t(r))}}:t}function oP(t,e){return{offset:Te(t,e),metadataLength:zt(t,e+8),bodyLength:Te(t,e+16)}}function kb(t,e){return Rn(t,e,24,oP)}function im(t,e,n){let r=We(t,e);if(r(10,yr,0))throw new Error("Record batch compression not implemented");let o=n<Zn.V4?8:0;return{length:r(4,Te,0),nodes:Rn(t,r(6,yr),16,(i,s)=>({length:Te(i,s),nullCount:Te(i,s+8)})),regions:Rn(t,r(8,yr),16+o,(i,s)=>({offset:Te(i,s+o),length:Te(i,s+o+8)})),variadic:Rn(t,r(12,yr),8,Te)}}function ET(t,e,n){let r=We(t,e);return{id:r(4,Te,0),data:r(6,(o,i)=>im(o,i,n)),isDelta:r(8,Ti,!1)}}function Nb(t,e,n,r){Mn(n,z,Io);let o=We(t,e);switch(n){case z.Binary:return hb();case z.Utf8:return wh();case z.LargeBinary:return _b();case z.LargeUtf8:return Sb();case z.List:return _h(r[0]);case z.ListView:return Tb(r[0]);case z.LargeList:return Mb(r[0]);case z.LargeListView:return Eb(r[0]);case z.Struct:return Sh(r);case z.RunEndEncoded:return Ab(r[0],r[1]);case z.Int:return bh(o(4,zt,0),o(6,Ti,!1));case z.Float:return db(o(4,Pe,nc.HALF));case z.Decimal:return mb(o(4,zt,0),o(6,zt,0),o(8,zt,128));case z.Date:return gb(o(4,Pe,To.MILLISECOND));case z.Time:return yb(o(4,Pe,Ae.MILLISECOND),o(6,zt,32));case z.Timestamp:return vh(o(4,Pe,Ae.SECOND),o(6,Ns));case z.Interval:return xb(o(4,Pe,Jn.YEAR_MONTH));case z.Duration:return vb(o(4,Pe,Ae.MILLISECOND));case z.FixedSizeBinary:return wb(o(4,zt,0));case z.FixedSizeList:return Mh(r[0],o(4,zt,0));case z.Map:return hT(o(4,Ti,!1),r[0]);case z.Union:return bb(o(4,Pe,Eo.Sparse),r,Rn(t,o(6,yr),4,zt))}return{typeId:n}}function El(t,e){let n=Rn(t,e,4,(r,o)=>{let i=We(r,o);return[i(4,Ns),i(6,Ns)]});return n.length?new Map(n):null}function sm(t,e,n){let r=We(t,e);return{version:n,endianness:r(4,Pe,0),fields:r(6,iP,[]),metadata:r(8,El)}}function iP(t,e){return Rn(t,e,4,IT)}function IT(t,e){let n=We(t,e),r=n(8,bl,z.NONE),o=n(10,yr,0),i=n(12,aP),s=n(14,(c,f)=>sP(c,f)),a=Nb(t,o,r,s);return i&&(i.dictionary=a,a=i),{name:n(4,Ns),type:a,nullable:n(6,Ti,!1),metadata:n(16,El)}}function sP(t,e){let n=Rn(t,e,4,IT);return n.length?n:null}function aP(t,e){if(!e)return null;let n=We(t,e);return xh(null,n(6,cP,ic()),n(8,Ti,!1),n(4,Te,0))}function cP(t,e){return Nb(t,e,z.Int)}var fP=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,lP=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,uP=t=>`Unsupported message type: ${t} (${yh(Qn,t)})`;function am(t,e){let n=zt(t,e)||0;if(e+=ks,n===-1&&(n=zt(t,e)||0,e+=ks),n===0)return null;let r=t.subarray(e,e+=n);if(r.byteLength<n)throw new Error(fP(n,r.byteLength));let o=We(r,0),i=o(4,Pe,Zn.V1),s=o(6,bl,Qn.NONE),a=o(8,yr,0),c=o(10,Te,0),f;if(a){let l=s===Qn.Schema?sm:s===Qn.DictionaryBatch?ET:s===Qn.RecordBatch?im:null;if(!l)throw new Error(uP(s));if(f=l(r,a,i),c>0){let u=t.subarray(e,e+=c);if(u.byteLength<c)throw new Error(lP(c,u.byteLength));f.body=u}}return{version:i,type:s,index:e,content:f}}function $T(t){let e=t instanceof ArrayBuffer?new Uint8Array(t):t;return e instanceof Uint8Array&&pP(e)?hP(e):dP(e)}function pP(t){if(!t||t.length<4)return!1;for(let e=0;e<6;++e)if(gl[e]!==t[e])return!1;return!0}function dP(t){let e=[t].flat(),n,r=[],o=[];for(let i of e){if(!(i instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=am(i,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case Qn.Schema:n||(n=a.content);break;case Qn.RecordBatch:r.push(a.content);break;case Qn.DictionaryBatch:o.push(a.content);break}}}return{schema:n,dictionaries:o,records:r,metadata:null}}function hP(t){let e=t.byteLength-(gl.length+4),n=zt(t,e),r=We(t,e-n),o=r(4,Pe,Zn.V1),i=r(8,kb,[]),s=r(10,kb,[]);return{schema:r(6,(a,c)=>sm(a,c,o)),dictionaries:i.map(({offset:a})=>am(t,a).content),records:s.map(({offset:a})=>am(t,a).content),metadata:r(12,El)}}function Rb(t,e){return mP($T(t),e)}function mP(t,e={}){let{schema:n={fields:[]},dictionaries:r,records:o}=t,{version:i,fields:s}=n,a=new Map,c=yP(e,i,a),f=new Map;gP(n,p=>{let d=p.type;d.typeId===z.Dictionary&&f.set(d.id,d.dictionary)});let l=new Map;for(let p of r){let{id:d,data:h,isDelta:m,body:g}=p,y=f.get(d),x=Ob(y,c({...h,body:g}));if(l.has(d)){let b=l.get(d);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");l.set(d,Cb(y).add(x))}}l.forEach((p,d)=>a.set(d,p.done()));let u=s.map(p=>Cb(p.type));for(let p of o){let d=c(p);s.forEach((h,m)=>u[m].add(Ob(h.type,d)))}return new cc(n,u.map(p=>p.done()),e.useProxy)}function gP(t,e){t.fields.forEach(function n(r){e(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function yP(t,e,n){let r={version:e,options:t,dictionary:o=>n.get(o)};return o=>{let{length:i,nodes:s,regions:a,variadic:c,body:f}=o,l=-1,u=-1,p=-1;return{...r,length:i,node:()=>s[++l],buffer:d=>{let{length:h,offset:m}=a[++u];return d?new d(f.buffer,f.byteOffset+m,h/d.BYTES_PER_ELEMENT):f.subarray(m,m+h)},variadic:()=>c[++p],visit(d){return d.map(h=>Ob(h.type,this))}}}}function Ob(t,e){let{typeId:n}=t,{length:r,options:o,node:i,buffer:s,variadic:a,version:c}=e,f=Tl(t,o);if(n===z.Null)return new f({length:r,nullCount:r,type:t});let l={...i(),type:t};switch(n){case z.Bool:case z.Int:case z.Time:case z.Duration:case z.Float:case z.Decimal:case z.Date:case z.Timestamp:case z.Interval:case z.FixedSizeBinary:return new f({...l,validity:s(),values:s(t.values)});case z.Utf8:case z.LargeUtf8:case z.Binary:case z.LargeBinary:return new f({...l,validity:s(),offsets:s(t.offsets),values:s()});case z.BinaryView:case z.Utf8View:return new f({...l,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case z.List:case z.LargeList:case z.Map:return new f({...l,validity:s(),offsets:s(t.offsets),children:e.visit(t.children)});case z.ListView:case z.LargeListView:return new f({...l,validity:s(),offsets:s(t.offsets),sizes:s(t.offsets),children:e.visit(t.children)});case z.FixedSizeList:case z.Struct:return new f({...l,validity:s(),children:e.visit(t.children)});case z.RunEndEncoded:return new f({...l,children:e.visit(t.children)});case z.Dictionary:{let{id:u,indices:p}=t;return new f({...l,validity:s(),values:s(p.values)}).setDictionary(e.dictionary(u))}case z.Union:return c<Zn.V5&&s(),new f({...l,typeIds:s(yl),offsets:t.mode===Eo.Sparse?null:s(t.offsets),children:e.visit(t.children)});default:throw new Error(Io(n))}}var yK=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function Il(t){return Rb(t,{useDate:!0})}function cm(t="ws://localhost:3000/"){let e=[],n=!1,r=null,o,i={open(){n=!0,c()},close(){for(n=!1,r=null,o=null;e.length;)e.shift().reject("Socket closed")},error(f){if(r){let{reject:l}=r;r=null,c(),l(f)}else console.error("WebSocket error: ",f)},message({data:f}){if(r){let{query:l,resolve:u,reject:p}=r;if(r=null,c(),typeof f=="string"){let d=JSON.parse(f);d.error?p(d.error):u(d)}else if(l.type==="exec")u();else if(l.type==="arrow")u(Il(f));else throw new Error(`Unexpected socket data: ${f}`)}else console.log("WebSocket message: ",f)}};function s(){o=new WebSocket(t),o.binaryType="arraybuffer";for(let f in i)o.addEventListener(f,i[f])}function a(f,l,u){o==null&&s(),e.push({query:f,resolve:l,reject:u}),n&&!r&&c()}function c(){e.length&&(r=e.shift(),o.send(JSON.stringify(r.query)))}return{get connected(){return n},query(f){return new Promise((l,u)=>a(f,l,u))}}}var An=class{constructor(e,n){e&&(this.table=String(e)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:e,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${e?`${DT(e)}.`:""}${r}`}else return e?DT(e):"NULL"}};function DT(t){return t.split(".").map(n=>`"${n}"`).join(".")}function PT(t,e){return t instanceof An&&t.column===e}function _t(t){return typeof t=="string"?Ii(t):t}function Ds(t){return typeof t=="string"?FT(t):t}function FT(t){return new An(t)}function Ii(t,e=null){return arguments.length===1&&(e=t,t=null),new An(t,e)}function Lr(t){switch(typeof t){case"boolean":return t?"TRUE":"FALSE";case"string":return`'${t.replace("'","''")}'`;case"number":return Number.isFinite(t)?String(t):"NULL";default:if(t==null)return"NULL";if(t instanceof Date){let e=+t;if(Number.isNaN(e))return"NULL";let n=t.getUTCFullYear(),r=t.getUTCMonth(),o=t.getUTCDate();return e===Date.UTC(n,r,o)?`MAKE_DATE(${n}, ${r+1}, ${o})`:`EPOCH_MS(${e})`}else return t instanceof RegExp?`'${t.source}'`:String(t)}}var Co=t=>typeof t?.addEventListener=="function";function fm(t){return t instanceof ko}var ko=class{constructor(e,n,r){this._expr=Array.isArray(e)?e:[e],this._deps=n||[],this.annotate(r);let o=this._expr.filter(i=>Co(i));o.length>0?(this._params=Array.from(new Set(o)),this._params.forEach(i=>{i.addEventListener("value",()=>BP(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:e,_deps:n}=this;if(e){let r=new Set(e.flatMap(o=>{let i=o.value?.columns;return Array.isArray(i)?i:[]}));if(r.size){let o=new Set(n);return r.forEach(i=>o.add(i)),Array.from(o)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...e){return Object.assign(this,...e)}toString(){return this._expr.map(e=>Co(e)&&!fm(e)?Lr(e.value):e).join("")}addEventListener(e,n){let r=this.map||(this.map=new Map);(r.get(e)||(r.set(e,new Set),r.get(e))).add(n)}};function BP(t,e){if(e?.size)return Promise.allSettled(Array.from(e,n=>n(t)))}function Lb(t,e){let n=[t[0]],r=new Set,o=e.length;for(let i=0,s=0;i<o;){let a=e[i];Co(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(f=>r.add(f)),n[s]+=typeof a=="string"?a:Lr(a));let c=t[++i];Co(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function U(t,...e){let{spans:n,cols:r}=Lb(t,e);return new ko(n,r)}function Db(t){let e=_t(t);return U`${e} DESC NULLS LAST`.annotate({label:e?.label,desc:!0})}var Ps=t=>({value:t,toString:()=>Lr(t)});function $l(t){t(this.op,this),this.children?.forEach(e=>e.visit(t))}function qT(t,e){let n=e.filter(o=>o!=null).map(_t),r=n.map((o,i)=>i?` ${t} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),U(r,...n).annotate({op:t,children:n,visit:$l})}var Tn=(...t)=>qT("AND",t.flat()),Fs=(...t)=>qT("OR",t.flat()),zP=t=>e=>U`(${t} ${_t(e)})`.annotate({op:t,a:e,visit:$l}),Pb=zP("NOT"),BT=t=>e=>U`(${_t(e)} ${t})`.annotate({op:t,a:e,visit:$l}),qs=BT("IS NULL"),No=BT("IS NOT NULL"),$i=t=>(e,n)=>U`(${_t(e)} ${t} ${_t(n)})`.annotate({op:t,a:e,b:n,visit:$l}),Fb=$i("="),Bs=$i("<>"),Oo=$i("<"),Cl=$i(">"),Ro=$i("<="),qb=$i(">="),Bb=$i("IS DISTINCT FROM"),fc=$i("IS NOT DISTINCT FROM");function zT(t,e,n,r){e=_t(e);let o=t.startsWith("NOT ")?"NOT ":"";return(n?r?U`${o}(${n[0]} <= ${e} AND ${e} < ${n[1]})`:U`(${e} ${t} ${n[0]} AND ${n[1]})`:U``).annotate({op:t,visit:$l,field:e,range:n})}var ue=(t,e,n)=>zT("BETWEEN",t,e,n),zb=(t,e,n)=>zT("NOT BETWEEN",t,e,n);function zs(t,e){return Array.from({length:t},()=>e)}function Fe(t,e){return(...n)=>{let r=n.map(_t),o=e?`::${e}`:"";return(r.length?U([`${t}(`,...zs(r.length-1,", "),`)${o}`],...r):U`${t}()${o}`).annotate({func:t,args:r})}}var Yb=Fe("REGEXP_MATCHES"),Ub=Fe("CONTAINS"),jb=Fe("PREFIX"),Xb=Fe("SUFFIX"),YP=Fe("LOWER"),UP=Fe("UPPER"),jP=Fe("LENGTH"),XP=Fe("ISNAN"),GP=Fe("ISFINITE"),VP=Fe("ISINF");var kl=class t extends ko{constructor(e,n,r,o,i="",s="",a=""){let c;if(o&&!(i||s||a))c=o?U`${n} OVER "${o}"`:U`${n} OVER ()`;else{let p=i&&s?" ":"",d=(i||s)&&a?" ":"";c=U`${n} OVER (${o?`"${o}" `:""}${i}${p}${s}${d}${a})`}r&&(c=U`(${c})::${r}`);let{_expr:l,_deps:u}=c;super(l,u),this.window=e,this.func=n,this.type=r,this.name=o,this.group=i,this.order=s,this.frame=a}get basis(){return this.column}get label(){let{func:e}=this;return e.label??e.toString()}over(e){let{window:n,func:r,type:o,group:i,order:s,frame:a}=this;return new t(n,r,o,e,i,s,a)}partitionby(...e){let n=e.flat().filter(l=>l).map(_t),r=U(["PARTITION BY ",zs(n.length-1,", "),""],...n),{window:o,func:i,type:s,name:a,order:c,frame:f}=this;return new t(o,i,s,a,r,c,f)}orderby(...e){let n=e.flat().filter(l=>l).map(_t),r=U(["ORDER BY ",zs(n.length-1,", "),""],...n),{window:o,func:i,type:s,name:a,group:c,frame:f}=this;return new t(o,i,s,a,c,r,f)}rows(e){let n=YT("ROWS",e),{window:r,func:o,type:i,name:s,group:a,order:c}=this;return new t(r,o,i,s,a,c,n)}range(e){let n=YT("RANGE",e),{window:r,func:o,type:i,name:s,group:a,order:c}=this;return new t(r,o,i,s,a,c,n)}};function YT(t,e){if(Co(e)){let n=U`${e}`;return n.toString=()=>`${t} ${UT(e.value)}`,n}return`${t} ${UT(e)}`}function UT(t){let[e,n]=t,r=e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} PRECEDING`:"UNBOUNDED PRECEDING",o=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${o}`}function xr(t,e){return(...n)=>{let r=Fe(t)(...n);return new kl(t,r,e)}}var Gb=xr("ROW_NUMBER","INTEGER"),Vb=xr("RANK","INTEGER"),Wb=xr("DENSE_RANK","INTEGER"),Hb=xr("PERCENT_RANK"),Zb=xr("CUME_DIST"),Qb=xr("NTILE"),Jb=xr("LAG"),Kb=xr("LEAD"),t2=xr("FIRST_VALUE"),e2=xr("LAST_VALUE"),n2=xr("NTH_VALUE");function Mt(t,...e){return U(t,...e).annotate({aggregate:!0})}var r2=class t extends ko{constructor(e,n,r,o,i){n=(n||[]).map(_t);let{strings:s,exprs:a}=WP(e,n,r,o,i),{spans:c,cols:f}=Lb(s,a);super(c,f),this.aggregate=e,this.args=n,this.type=r,this.isDistinct=o,this.filter=i}get basis(){return this.column}get label(){let{aggregate:e,args:n,isDistinct:r}=this,o=r?"DISTINCT"+(n.length?" ":""):"",i=n.length?`(${o}${n.map(HP).join(", ")})`:"";return`${e.toLowerCase()}${i}`}distinct(){let{aggregate:e,args:n,type:r,filter:o}=this;return new t(e,n,r,!0,o)}where(e){let{aggregate:n,args:r,type:o,isDistinct:i}=this;return new t(n,r,o,i,e)}window(){let{aggregate:e,args:n,type:r,isDistinct:o}=this,i=new t(e,n,null,o);return new kl(e,i,r)}partitionby(...e){return this.window().partitionby(...e)}orderby(...e){return this.window().orderby(...e)}rows(e){return this.window().rows(e)}range(e){return this.window().range(e)}};function WP(t,e,n,r,o){let i=`)${n?`::${n}`:""}`,s=[`${t}(${r?"DISTINCT ":""}`],a=[];return e.length?(s=s.concat([...zs(e.length-1,", "),`${i}${o?" FILTER (WHERE ":""}`,...o?[")"]:[]]),a=[...e,...o?[o]:[]]):s[0]+="*"+i,{exprs:a,strings:s}}function HP(t){let e=Lr(t);return e&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function $t(t,e){return(...n)=>new r2(t,n,e)}var sn=$t("COUNT","INTEGER"),Nl=$t("AVG"),ZP=$t("AVG"),o2=$t("MAD"),Kn=$t("MAX"),tr=$t("MIN"),Ln=$t("SUM","DOUBLE"),i2=$t("PRODUCT"),s2=$t("MEDIAN"),a2=$t("QUANTILE"),c2=$t("MODE"),f2=$t("VARIANCE"),Ol=$t("STDDEV"),l2=$t("SKEWNESS"),u2=$t("KURTOSIS"),p2=$t("ENTROPY"),d2=$t("VAR_POP"),h2=$t("STDDEV_POP"),m2=$t("CORR"),g2=$t("COVAR_SAMP"),y2=$t("COVAR_POP"),x2=$t("REGR_INTERCEPT"),b2=$t("REGR_SLOPE"),w2=$t("REGR_COUNT"),QP=$t("REGR_R2"),v2=$t("REGR_SYY"),_2=$t("REGR_SXX"),JP=$t("REGR_SXY"),S2=$t("REGR_AVGX"),KP=$t("REGR_AVGY"),M2=$t("FIRST"),A2=$t("LAST"),lc=$t("ARG_MIN"),uc=$t("ARG_MAX"),T2=$t("STRING_AGG"),E2=$t("ARRAY_AGG");function Rl(t,e){let n=_t(t),r=U`CAST(${n} AS ${e})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return t.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return t.aggregate||!1}}),r}var pc=t=>Rl(t,"DOUBLE"),I2=t=>Rl(t,"INTEGER");var $2=t=>U`epoch_ms(${_t(t)})`;function C2(t,e,n=1){let r=`INTERVAL ${n} ${e}`,o=_t(t);return U`TIME_BUCKET(${r}, ${o})`.annotate({label:e})}var k2=t=>{let e=_t(t);return U`MAKE_DATE(2012, MONTH(${e}), 1)`.annotate({label:"month"})},N2=t=>{let e=_t(t);return U`MAKE_DATE(2012, MONTH(${e}), DAY(${e}))`.annotate({label:"date"})},O2=t=>{let e=_t(t);return U`MAKE_DATE(2012, 1, DAY(${e}))`.annotate({label:"date"})};var Ll=Fe("ST_AsGeoJSON"),jT=Fe("ST_X"),XT=Fe("ST_Y"),Dl=Fe("ST_CENTROID"),R2=t=>jT(Dl(t)),L2=t=>XT(Dl(t));var ft=class t{static select(...e){return new t().select(...e)}static from(...e){return new t().from(...e)}static with(...e){return new t().with(...e)}static union(...e){return new Ys("UNION",e.flat())}static unionAll(...e){return new Ys("UNION ALL",e.flat())}static intersect(...e){return new Ys("INTERSECT",e.flat())}static except(...e){return new Ys("EXCEPT",e.flat())}static describe(e){let n=e.clone(),{clone:r,toString:o}=n;return Object.assign(n,{describe:!0,clone:()=>t.describe(r.call(n)),toString:()=>`DESCRIBE ${o.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}clone(){let e=new t;return e.query={...this.query},e}with(...e){let{query:n}=this;if(e.length===0)return n.with;{let r=[],o=(i,s)=>{let a=s.clone();a.cteFor=this,r.push({as:i,query:a})};return e.flat().forEach(i=>{if(i!=null)if(i.as&&i.query)o(i.as,i.query);else for(let s in i)o(s,i[s])}),n.with=n.with.concat(r),this}}select(...e){let{query:n}=this;if(e.length===0)return n.select;{let r=[];for(let i of e.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:_t(i)});else if(i instanceof An)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let s in i)r.push({as:lm(s),expr:_t(i[s])});let o=new Set(r.map(i=>i.as));return n.select=n.select.filter(i=>!o.has(i.as)).concat(r.filter(i=>i.expr)),this}}$select(...e){return this.query.select=[],this.select(...e)}distinct(e=!0){return this.query.distinct=!!e,this}from(...e){let{query:n}=this;if(e.length===0)return n.from;{let r=[];return e.flat().forEach(o=>{if(o!=null)if(typeof o=="string")r.push({as:o,from:Ds(o)});else if(o instanceof An)r.push({as:o.table,from:o});else if(Pl(o)||fm(o))r.push({from:o});else if(Array.isArray(o))r.push({as:lm(o[0]),from:Ds(o[1])});else for(let i in o)r.push({as:lm(i),from:Ds(o[i])})}),n.from=n.from.concat(r),this}}$from(...e){return this.query.from=[],this.from(...e)}sample(e,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let o=e;return typeof e=="number"&&(o=e>0&&e<1?{perc:100*e,method:n}:{rows:Math.round(e),method:n}),r.sample=o,this}}where(...e){let{query:n}=this;return e.length===0?n.where:(n.where=n.where.concat(e.flat().filter(r=>r)),this)}$where(...e){return this.query.where=[],this.where(...e)}groupby(...e){let{query:n}=this;return e.length===0?n.groupby:(n.groupby=n.groupby.concat(e.flat().filter(r=>r).map(_t)),this)}$groupby(...e){return this.query.groupby=[],this.groupby(...e)}having(...e){let{query:n}=this;return e.length===0?n.having:(n.having=n.having.concat(e.flat().filter(r=>r)),this)}window(...e){let{query:n}=this;if(e.length===0)return n.window;{let r=[];return e.flat().forEach(o=>{if(o!=null)for(let i in o)r.push({as:lm(i),expr:o[i]})}),n.window=n.window.concat(r),this}}qualify(...e){let{query:n}=this;return e.length===0?n.qualify:(n.qualify=n.qualify.concat(e.flat().filter(r=>r)),this)}orderby(...e){let{query:n}=this;return e.length===0?n.orderby:(n.orderby=n.orderby.concat(e.flat().filter(r=>r).map(_t)),this)}limit(e){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(e)?e:void 0,this)}offset(e){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(e)?e:void 0,this)}get subqueries(){let{query:e,cteFor:n}=this,o=(n?.query||e).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),i=[];return e.from.forEach(({from:s})=>{if(Pl(s))i.push(s);else if(o[s.table]){let a=o[s.table];i.push(a)}}),i}toString(){let{with:e,select:n,distinct:r,from:o,sample:i,where:s,groupby:a,having:c,window:f,qualify:l,orderby:u,limit:p,offset:d}=this.query,h=[];if(e.length){let g=e.map(({as:y,query:x})=>`"${y}" AS (${x})`);h.push(`WITH ${g.join(", ")}`)}let m=n.map(({as:g,expr:y})=>PT(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(h.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),o.length){let g=o.map(({as:y,from:x})=>{let b=Pl(x)?`(${x})`:`${x}`;return!y||y===x.table?b:`${b} AS "${y}"`});h.push(`FROM ${g.join(", ")}`)}if(s.length){let g=s.map(String).filter(y=>y).join(" AND ");g&&h.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:x,seed:b}=i,w=g?`${g} ROWS`:`${y} PERCENT`,_=x?` (${x}${b!=null?`, ${b}`:""})`:"";h.push(`USING SAMPLE ${w}${_}`)}if(a.length&&h.push(`GROUP BY ${a.join(", ")}`),c.length){let g=c.map(String).filter(y=>y).join(" AND ");g&&h.push(`HAVING ${g}`)}if(f.length){let g=f.map(({as:y,expr:x})=>`"${y}" AS (${x})`);h.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&h.push(`QUALIFY ${g}`)}return u.length&&h.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(p)&&h.push(`LIMIT ${p}`),Number.isFinite(d)&&h.push(`OFFSET ${d}`),h.join(" ")}},Ys=class t{constructor(e,n){this.op=e,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}clone(){let e=new t(this.op,this.queries);return e.query={...this.query},e}orderby(...e){let{query:n}=this;return e.length===0?n.orderby:(n.orderby=n.orderby.concat(e.flat().filter(r=>r).map(_t)),this)}limit(e){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(e)?e:void 0,this)}offset(e){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(e)?e:void 0,this)}get subqueries(){let{queries:e,cteFor:n}=this;return n&&e.forEach(r=>r.cteFor=n),e}toString(){let{op:e,queries:n,query:{orderby:r,limit:o,offset:i}}=this,s=[n.join(` ${e} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(o)&&s.push(`LIMIT ${o}`),Number.isFinite(i)&&s.push(`OFFSET ${i}`),s.join(" ")}};function Pl(t){return t instanceof ft||t instanceof Ys}function D2(t){return Pl(t)&&t.describe}function lm(t){return tF(t)?t.slice(1,-1):t}function tF(t){return t[0]==='"'&&t[t.length-1]==='"'}var um=t=>t;function GT(){return{apply:um,invert:um,sqlApply:_t,sqlInvert:um}}function eF({base:t=null}={}){if(t==null||t===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:e=>U`LN(${_t(e)})`,sqlInvert:e=>U`EXP(${e})`};if(t===10)return{apply:Math.log10,invert:e=>Math.pow(10,e),sqlApply:e=>U`LOG(${_t(e)})`,sqlInvert:e=>U`POW(10, ${e})`};{let e=+t;return{apply:n=>Math.log(n)/Math.log(e),invert:n=>Math.pow(e,n),sqlApply:n=>U`LN(${_t(n)}) / LN(${e})`,sqlInvert:n=>U`POW(${e}, ${n})`}}}function nF({constant:t=1}={}){let e=+t;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-e),sqlApply:n=>(n=_t(n),U`SIGN(${n}) * LN(${e} + ABS(${n}))`),sqlInvert:n=>U`SIGN(${n}) * (EXP(ABS(${n})) - ${e})`}}function rF(){return{apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*t*t,sqlApply:t=>(t=_t(t),U`SIGN(${t}) * SQRT(ABS(${t}))`),sqlInvert:t=>U`SIGN(${t}) * (${t}) ** 2`}}function oF({exponent:t=1}={}){let e=+t;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),e),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/e),sqlApply:n=>(n=_t(n),U`SIGN(${n}) * POW(ABS(${n}), ${e})`),sqlInvert:n=>U`SIGN(${n}) * POW(ABS(${n}), 1/${e})`}}function VT(){return{apply:t=>+t,invert:t=>new Date(t),sqlApply:t=>t instanceof Date?+t:$2(_t(t)),sqlInvert:um}}var iF={identity:GT,linear:GT,log:eF,symlog:nF,sqrt:rF,pow:oF,time:VT,utc:VT};function Fl(t){let e=iF[t.type];return e?{...t,...e(t)}:null}function Dr(t,e,{replace:n=!1,temp:r=!0,view:o=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(o?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+t+" AS "+e}function ql(t){return`INSTALL ${t}; LOAD ${t}`}function WT(t,{columns:e=Object.keys(t?.[0]||{})}={}){let n=[];if(Array.isArray(e)?(n=e,e=n.reduce((o,i)=>(o[i]=i,o),{})):e&&(n=Object.keys(e)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let o of t){let i=n.map(s=>`${Lr(o[s])} AS "${e[s]}"`);r.push(`(SELECT ${i.join(", ")})`)}return r.join(" UNION ALL ")}function pm(t,e,n,r={},o={}){let{select:i=["*"],where:s,view:a,temp:c,replace:f,...l}=r,u=sF({...o,...l}),p=`${t}('${n}'${u?", "+u:""})`,d=s?` WHERE ${s}`:"",h=`SELECT ${i.join(", ")} FROM ${p}${d}`;return Dr(e,h,{view:a,temp:c,replace:f})}function F2(t,e,n){return pm("read_csv",t,e,n,{auto_detect:!0,sample_size:-1})}function q2(t,e,n){return pm("read_json",t,e,n,{auto_detect:!0,json_format:"auto"})}function B2(t,e,n){return pm("read_parquet",t,e,n)}function z2(t,e,n={}){let{options:r,...o}=n;if(r){let i=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(o,{open_options:i.toUpperCase()})}return pm("st_read",t,e,o)}function Y2(t,e,n={}){let{select:r=["*"],...o}=n,i=WT(e),s=r.length===1&&r[0]==="*"?i:`SELECT ${r} FROM ${i}`;return Dr(t,s,o)}function sF(t){return Object.entries(t).map(([e,n])=>`${e}=${P2(n)}`).join(", ")}function P2(t){switch(typeof t){case"boolean":return String(t);case"string":return`'${t}'`;case"undefined":case"object":return t==null?"NULL":Array.isArray(t)?"["+t.map(e=>P2(e)).join(", ")+"]":"{"+Object.entries(t).map(([e,n])=>`'${e}': ${P2(n)}`).join(", ")+"}";default:return t}}function ZT(t){if(!t.filterIndexable)return null;let e=t.query(),n=mm(e,a=>a.from()?.[0].from.table);if(typeof n!="string"||!e.select)return null;let r=[],o=[],i={},s=a=>{let c=a.column;return`(SELECT AVG(${mm(e,l=>l.select().find(u=>u.as===c)?.expr)??a}) FROM "${n}")`};for(let a of e.select()){let{as:c,expr:{aggregate:f,args:l}}=a,u=f?.toUpperCase?.();switch(u){case"COUNT":case"SUM":r.push({[c]:Mt`SUM("${c}")::DOUBLE`});break;case"AVG":r.push({[c]:cF(i,c,l[0])});break;case"ARG_MAX":r.push({[c]:fF(i,c,l)});break;case"ARG_MIN":r.push({[c]:lF(i,c,l)});break;case"VARIANCE":case"VAR_SAMP":i[c]=null,r.push({[c]:dm(i,l[0],s)});break;case"VAR_POP":i[c]=null,r.push({[c]:dm(i,l[0],s,!1)});break;case"STDDEV":case"STDDEV_SAMP":i[c]=null,r.push({[c]:Mt`SQRT(${dm(i,l[0],s)})`});break;case"STDDEV_POP":i[c]=null,r.push({[c]:Mt`SQRT(${dm(i,l[0],s,!1)})`});break;case"COVAR_SAMP":i[c]=null,r.push({[c]:hm(i,l,s)});break;case"COVAR_POP":i[c]=null,r.push({[c]:hm(i,l,s,!1)});break;case"CORR":i[c]=null,r.push({[c]:HT(i,l,s)});break;case"REGR_COUNT":i[c]=null,r.push({[c]:Mt`${dc(i,l)}::DOUBLE`});break;case"REGR_AVGX":i[c]=null,r.push({[c]:KT(i,l)});break;case"REGR_AVGY":i[c]=null,r.push({[c]:tE(i,l)});break;case"REGR_SYY":i[c]=null,r.push({[c]:j2(i,0,l,s)});break;case"REGR_SXX":i[c]=null,r.push({[c]:j2(i,1,l,s)});break;case"REGR_SXY":i[c]=null,r.push({[c]:hm(i,l,s,null)});break;case"REGR_SLOPE":i[c]=null,r.push({[c]:eE(i,l,s)});break;case"REGR_INTERCEPT":i[c]=null,r.push({[c]:uF(i,l,s)});break;case"REGR_R2":i[c]=null,r.push({[c]:Mt`(${HT(i,l,s)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":r.push({[c]:Mt`${u}("${c}")`});break;default:if(!f)o.push(c);else return null}}return r.length?{from:n,dims:o,aggr:r,aux:i}:null}function br(t,...e){let n=e.length?"_"+e.map(aF).join("_"):"";return`__${t}${n}__`}function aF(t){return`${t}`.replaceAll('"',"").replaceAll(" ","_")}function mm(t,e){let n=t.subqueries;if(t.select&&n.length===0)return e(t);let r=mm(n[0],e);for(let o=1;o<n.length;++o){let i=mm(n[o],e);if(i!==void 0&&i!==r)return NaN}return r}function QT(t,e){let n=br("count",e);return t[n]=Mt`COUNT(${e})`,Mt`SUM(${n})`.annotate({name:n})}function cF(t,e,n){let r=QT(t,n);return Mt`(SUM("${e}" * ${r.name}) / ${r})`}function fF(t,e,[,n]){let r=br("max",n);return t[r]=Mt`MAX(${n})`,Mt`ARG_MAX("${e}", ${r})`}function lF(t,e,[,n]){let r=br("min",n);return t[r]=Mt`MIN(${n})`,Mt`ARG_MIN("${e}", ${r})`}function dm(t,e,n,r=!0){let o=QT(t,e),i=br("rssq",e),s=br("rsum",e),a=U`${e} - ${n(e)}`;return t[i]=Mt`SUM((${a}) ** 2)`,t[s]=Mt`SUM(${a})`,Mt`(SUM(${i}) - (SUM(${s}) ** 2 / ${o})) / (${o}${r?" - 1":""})`}function hm(t,e,n,r=!0){let o=dc(t,e),i=JT(t,e,n),s=Bl(t,1,e,n),a=Bl(t,0,e,n),c=r===null?"":r?` / (${o} - 1)`:` / ${o}`;return Mt`(${i} - ${s} * ${a} / ${o})${c}`}function HT(t,e,n){let r=dc(t,e),o=JT(t,e,n),i=U2(t,1,e,n),s=U2(t,0,e,n),a=Bl(t,1,e,n),c=Bl(t,0,e,n),f=Mt`(${i} - (${a} ** 2) / ${r})`,l=Mt`(${s} - (${c} ** 2) / ${r})`;return Mt`(${o} - ${a} * ${c} / ${r}) / SQRT(${f} * ${l})`}function dc(t,[e,n]){let r=br("count",e,n);return t[r]=Mt`REGR_COUNT(${e}, ${n})`,Mt`SUM(${r})`.annotate({name:r})}function Bl(t,e,n,r){let o=n[e],i=n[1-e],s=br("rs",o);return t[s]=Mt`SUM(${o} - ${r(o)}) FILTER (${i} IS NOT NULL)`,Mt`SUM(${s})`}function U2(t,e,n,r){let o=n[e],i=n[1-e],s=br("rss",o);return t[s]=Mt`SUM((${o} - ${r(o)}) ** 2) FILTER (${i} IS NOT NULL)`,Mt`SUM(${s})`}function JT(t,e,n){let[r,o]=e,i=br("sxy",r,o);return t[i]=Mt`SUM((${o} - ${n(o)}) * (${r} - ${n(r)}))`,Mt`SUM(${i})`}function KT(t,e){let[n,r]=e,o=dc(t,e),i=br("avg",r,n);return t[i]=Mt`REGR_AVGX(${n}, ${r})`,Mt`(SUM(${i} * ${o.name}) / ${o})`}function tE(t,e){let[n,r]=e,o=dc(t,e),i=br("avg",n,r);return t[i]=Mt`REGR_AVGY(${n}, ${r})`,Mt`(SUM(${i} * ${o.name}) / ${o})`}function j2(t,e,n,r){let o=dc(t,n),i=Bl(t,e,n,r),s=U2(t,e,n,r);return Mt`(${s} - (${i} ** 2 / ${o}))`}function eE(t,e,n){let r=hm(t,e,n,null),o=j2(t,1,e,n);return Mt`(${r}) / ${o}`}function uF(t,e,n){let r=KT(t,e),o=tE(t,e),i=eE(t,e,n);return Mt`${o} - (${i}) * ${r}`}function rE(t){let e=2166136261;for(let n=0,r=t.length;n<r;++n){let o=t.charCodeAt(n),i=o&65280;i&&(e=nE(e^i>>8)),e=nE(e^o&255)}return pF(e)}function nE(t){return t+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}function pF(t){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,t&4294967295}var dF={skip:!0,result:null},gm=class{constructor(e,{schema:n="mosaic",enabled:r=!0}={}){this.indexes=new Map,this.active=null,this.mc=e,this._schema=n,this._enabled=r}set enabled(e){this._enabled!==e&&(e||this.clear(),this._enabled=e)}get enabled(){return this._enabled}set schema(e){this._schema!==e&&(this.clear(),this._schema=e)}get schema(){return this._schema}dropIndexTables(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.indexes.clear(),this.active=null}index(e,n,r){if(!this.enabled)return null;let{indexes:o,mc:i,schema:s}=this,{source:a}=r;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=hF(r),c.source===null))return null;if(o.has(e))return o.get(e);let f=ZT(e),l;if(!f)l=null;else if(n.skip(e,r))l=dF;else{let u=n.remove(a).predicate(e);l=yF(e.query(u),c,f,s),l.result=i.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,Dr(l.table,l.create,{temp:!1})]),l.result.catch(p=>i.logger().error(p))}return o.set(e,l),l}};function hF(t){let{source:e,meta:n}=t,r=t.predicate,o=r?.columns,i,s;if(!n||!o)return{source:null,columns:s,predicate:i};let{type:a,scales:c,bin:f,pixelSize:l=1}=n;if(a==="point")i=u=>u,s=Object.fromEntries(o.map(u=>[`${u}`,_t(u)]));else if(a==="interval"&&c){let u=c.map(p=>gF(p,l,f));u.some(p=>!p)||(u.length===1?(i=p=>p?ue("active0",p.range.map(u[0])):[],s={active0:u[0](r.field)}):(i=p=>p?Tn(p.children.map(({range:d},h)=>ue(`active${h}`,d.map(u[h])))):[],s=Object.fromEntries(r.children.map((p,d)=>[`active${d}`,u[d](p.field)]))))}return{source:s?e:null,columns:s,predicate:i}}var mF={ceil:"CEIL",round:"ROUND"};function gF(t,e,n){let{type:r,domain:o,range:i,apply:s,sqlApply:a}=Fl(t);if(!s)return;let c=mF[`${n}`.toLowerCase()]||"FLOOR",f=s(Math.min(...o)),l=s(Math.max(...o)),u=r==="identity"?1:Math.abs(i[1]-i[0])/(l-f),p=u/e===1?"":`${u/e}::DOUBLE * `,d=f===0?"":` - ${f}::DOUBLE`;return h=>U`${c}(${p}(${a(h)}${d}))::INTEGER`}function yF(t,e,n,r){let{dims:o,aggr:i,aux:s}=n,{columns:a}=e,c=t.select({...a,...s}).groupby(Object.keys(a)),[f]=c.subqueries;if(f){let m=Object.values(a).flatMap(g=>g.columns);xF(f,m)}let l=c.orderby();c.query.orderby=[];let u=c.toString(),p=(rE(u)>>>0).toString(16),d=`${r}.cube_${p}`,h=ft.select(o,i).from(d).groupby(o).orderby(l);return new X2({id:p,table:d,create:u,active:e,select:h})}function xF(t,e){let n=new Set,r=o=>{n.has(o)||(n.add(o),o.select&&o.from().length&&o.select(e),o.subqueries.forEach(r))};r(t)}var X2=class{constructor({table:e,create:n,active:r,select:o}={}){this.table=e,this.create=n,this.result=null,this.active=r,this.select=o,this.skip=!1}query(e){return this.select.clone().where(this.active.predicate(e))}};var Us=class extends Promise{constructor(){let e,n;super((r,o)=>{e=r,n=o}),this._resolve=e,this._reject=n}fulfill(e){return this._resolve(e),this}reject(e){return this._reject(e),this}};Us.prototype.constructor=Promise;function bF(t){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(t)}function oE(t,e,n){let r=[],o=0;function i(){let s=wF(r,e);r=[],o=0;for(let a of s)_F(a,t,n),AF(a,e)}return{add(s,a){s.request.type==="arrow"?(o=o||bF(()=>i()),r.push({entry:s,priority:a,index:r.length})):t(s,a)}}}function wF(t,e){let n=[],r=new Map;for(let o of t){let{entry:{request:i}}=o,s=vF(i.query,e);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(o)}return n}function vF(t,e){let n=`${t}`;if(t instanceof ft&&!e.get(n)){if(t.orderby().length||t.where().length||t.qualify().length||t.having().length)return n;let r=t.clone().$select("*"),o=t.groupby();if(o.length){let i={};t.select().forEach(({as:s,expr:a})=>i[s]=a),r.$groupby(o.map(s=>s instanceof An&&i[s.column]||s))}else t.select().some(({expr:i})=>i.aggregate)&&r.$groupby("ALL");return`${r}`}else return n}function _F(t,e,n){if(SF(t))e({request:{type:"arrow",cache:!1,record:!1,query:t.query=MF(t,n)},result:t.result=new Us});else for(let{entry:r,priority:o}of t)e(r,o)}function SF(t){if(t.length>1){let e=`${t[0].entry.request.query}`;for(let n=1;n<t.length;++n)if(e!==`${t[n].entry.request.query}`)return!0}return!1}function MF(t,e){let n=t.maps=[],r=new Map;for(let s of t){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:f,expr:l}of a.select()){let u=`${l}`;r.has(u)||r.set(u,[`col${r.size}`,l]);let[p]=r.get(u);c.push([p,f])}e(`${a}`)}let o=t[0].entry.request.query.clone(),i=o.groupby();if(i.length){let s={};t.maps[0].forEach(([a,c])=>s[c]=a),o.$groupby(i.map(a=>a instanceof An&&s[a.column]||a))}return o.$select(Array.from(r.values()))}async function AF(t,e){let{maps:n,query:r,result:o}=t;if(!n)return;let i;try{i=await o}catch(a){for(let{entry:c}of t)c.result.reject(a);return}let s=D2(r);t.forEach(({entry:a},c)=>{let{request:f,result:l}=a,u=n[c],p=s&&u?EF(i,u):u?TF(i,u):i;f.cache&&e.set(String(f.query),p),l.fulfill(p)})}function TF(t,e){return t.select(e.map(n=>n[0]),e.map(n=>n[1]))}function EF(t,e){let n=new Map(e),r=[];for(let o of t)n.has(o.column_name)&&r.push({...o,column_name:n.get(o.column_name)});return r}var IF=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,iE=()=>({get:()=>{},set:(t,e)=>e,clear:()=>{}});function sE({max:t=1e3,ttl:e=3*60*60*1e3}={}){let n=new Map;function r(){let o=performance.now()-e,i=null,s=1/0;for(let[a,c]of n){let{last:f}=c;f<s&&(i=a,s=f),o>f&&n.delete(a)}i&&n.delete(i)}return{get(o){let i=n.get(o);if(i)return i.last=performance.now(),i.value},set(o,i){return n.set(o,{last:performance.now(),value:i}),n.size>t&&IF(r),i},clear(){n=new Map}}}var ym=class{constructor(e){this.queue=Array.from({length:e},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(e=>!e.head)}insert(e,n){let r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);let o={item:e,next:null};r.head===null?r.head=r.tail=o:r.tail=r.tail.next=o}remove(e){for(let n of this.queue){let{head:r,tail:o}=n;for(let i=null,s=r;s;i=s,s=s.next)e(s.item)&&(s===r?r=s.next:i.next=s.next,s===o&&(o=i||r));n.head=r,n.tail=o}}next(){for(let e of this.queue){let{head:n}=e;if(n!==null)return e.head=n.next,e.tail===n&&(e.tail=null),n.item}}};var Pr={High:0,Normal:1,Low:2},xm=class{constructor(){this.queue=new ym(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:e,result:n}=this.queue.next();this.pending=this.submit(e,n),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(e,n=Pr.Normal){this.queue.insert(e,n),this.next()}recordQuery(e){this.recorders.length&&e&&this.recorders.forEach(n=>n.add(e))}async submit(e,n){try{let{query:r,type:o,cache:i=!1,record:s=!0,options:a}=e,c=r?`${r}`:null;if(s&&this.recordQuery(c),i){let u=this.clientCache.get(c);if(u){this._logger.debug("Cache"),n.fulfill(u);return}}let f=performance.now();this._logQueries&&this._logger.debug("Query",{type:o,sql:c,...a});let l=await this.db.query({type:o,sql:c,...a});i&&this.clientCache.set(c,l),this._logger.debug(`Request: ${(performance.now()-f).toFixed(1)}`),n.fulfill(l)}catch(r){n.reject(r)}}cache(e){return e!==void 0?this.clientCache=e===!0?sE():e||iE():this.clientCache}logger(e){return e?this._logger=e:this._logger}logQueries(e){return e!==void 0?this._logQueries=!!e:this._logQueries}connector(e){return e?this.db=e:this.db}consolidate(e){e&&!this._consolidate?this._consolidate=oE(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!e&&this._consolidate&&(this._consolidate=null)}request(e,n=Pr.Normal){let r=new Us,o={request:e,result:r};return this._consolidate?this._consolidate.add(o,n):this.enqueue(o,n),r}cancel(e){let n=new Set(e);n.size&&this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1)}clear(){this.queue.remove(({result:e})=>(e.reject("Cleared"),!0))}record(){let e=[],n={add(r){e.push(r)},reset(){e=[]},snapshot(){return e.slice()},stop(){return this.recorders=this.recorders.filter(r=>r!==n),e}};return this.recorders.push(n),n}};function G2(t){switch(t){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(t.startsWith("DECIMAL"))return"number";if(t.startsWith("STRUCT")||t.startsWith("MAP"))return"object";if(t.endsWith("]"))return"array";throw new Error(`Unsupported type: ${t}`)}}var $F="count",CF="nulls",kF="max",NF="min",OF="distinct";var RF={[$F]:sn,[OF]:t=>sn(t).distinct(),[kF]:Kn,[NF]:tr,[CF]:t=>sn().where(qs(t))};function LF(t,e,n){return ft.from(t).select(Array.from(n,r=>[r,RF[r](e)]))}async function aE(t,e){return e.length===1&&`${e[0].column}`=="*"?PF(t,e[0].table):(await Promise.all(e.map(n=>DF(t,n)))).filter(n=>n)}async function DF(t,{table:e,column:n,stats:r}){let o=ft.from({source:e}).select({column:n}).groupby(n.aggregate?U`ALL`:[]),[i]=Array.from(await t.query(ft.describe(o))),s={table:e,column:`${n}`,sqlType:i.column_type,type:G2(i.column_type),nullable:i.null==="YES"};if(!(r?.length||r?.size))return s;let[a]=await t.query(LF(e,n,r),{persist:!0});return Object.assign(s,a)}async function PF(t,e){let n=await t.query(`DESCRIBE ${Ds(e)}`);return Array.from(n).map(r=>({table:e,column:r.column_name,sqlType:r.column_type,type:G2(r.column_type),nullable:r.null==="YES"}))}function cE(){return{debug(){},info(){},log(){},warn(){},error(){}}}var bm;function er(t){return t?bm=t:bm==null&&(bm=new zl),bm}var zl=class{constructor(e=cm(),{logger:n=console,manager:r=new xm,cache:o=!0,consolidate:i=!0,indexes:s={}}={}){this.manager=r,this.manager.cache(o),this.manager.consolidate(i),this.databaseConnector(e),this.logger(n),this.clear(),this.dataCubeIndexer=new gm(this,s)}clear({clients:e=!0,cache:n=!0}={}){this.manager.clear(),e&&(this.filterGroups?.forEach(r=>r.disconnect()),this.filterGroups=new Map,this.clients?.forEach(r=>this.disconnect(r)),this.clients=new Set),n&&this.manager.cache().clear()}databaseConnector(e){return this.manager.connector(e)}logger(e){return arguments.length&&(this._logger=e||cE(),this.manager.logger(this._logger)),this._logger}cancel(e){this.manager.cancel(e)}exec(e,{priority:n=Pr.Normal}={}){return e=Array.isArray(e)?e.filter(r=>r).join(`;
|
|
2
|
+
`):e,this.manager.request({type:"exec",query:e},n)}query(e,{type:n="arrow",cache:r=!0,priority:o=Pr.Normal,...i}={}){return this.manager.request({type:n,query:e,cache:r,options:i},o)}prefetch(e,n={}){return this.query(e,{...n,cache:!0,priority:Pr.Low})}createBundle(e,n,r=Pr.Low){let o={name:e,queries:n.map(i=>typeof i=="string"?{sql:i}:i)};return this.manager.request({type:"create-bundle",options:o},r)}loadBundle(e,n=Pr.High){let r={name:e};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(e,n,r=Pr.Normal){return e.queryPending(),this.query(n,{priority:r}).then(o=>e.queryResult(o).update(),o=>{this._logger.error(o),e.queryError(o)}).catch(o=>this._logger.error(o))}requestQuery(e,n){return this.dataCubeIndexer.clear(),n?this.updateClient(e,n):Promise.resolve(e.update())}async connect(e){let{clients:n}=this;if(n.has(e))throw new Error("Client already connected.");n.add(e),e.coordinator=this,this.initializeClient(e),FF(this,e.filterBy,e)}async initializeClient(e){let n=e.fields();return n?.length&&e.fieldInfo(await aE(this,n)),e.requestQuery()}disconnect(e){let{clients:n,filterGroups:r}=this;if(!n.has(e))return;n.delete(e),e.coordinator=null;let o=r.get(e.filterBy);o&&o.clients.delete(e)}};function FF(t,e,n){if(!e)return;let r=t.filterGroups.get(e);if(!r){let o=s=>qF(t,e,s),i=()=>BF(t,e);e.addEventListener("activate",o),e.addEventListener("value",i),r={selection:e,clients:new Set,disconnect(){e.removeEventListener("activate",o),e.removeEventListener("value",i)}},t.filterGroups.set(e,r)}r.clients.add(n)}function qF(t,e,n){let{dataCubeIndexer:r,filterGroups:o}=t,{clients:i}=o.get(e);for(let s of i)r.index(s,e,n)}function BF(t,e){let{dataCubeIndexer:n,filterGroups:r}=t,{clients:o}=r.get(e),{active:i}=e;return Promise.allSettled(Array.from(o,s=>{let a=n.index(s,e,i),c=a?null:e.predicate(s);if(a?.skip||!a&&!c)return;let f=a?.query(i.predicate)??s.query(c);return t.updateClient(s,f)}))}var wm=class{constructor(){this._callbacks=new Map}addEventListener(e,n){this._callbacks.has(e)||this._callbacks.set(e,{callbacks:new Set,pending:null,queue:new V2}),this._callbacks.get(e).callbacks.add(n)}removeEventListener(e,n){let r=this._callbacks.get(e);r&&r.callbacks.delete(n)}willEmit(e,n){return n}emitQueueFilter(e,n){return null}cancel(e){this._callbacks.get(e)?.queue.clear()}async pending(e){await this._callbacks.get(e)?.pending}emit(e,n){let r=this._callbacks.get(e)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(e,n));else{let o=this.willEmit(e,n),{callbacks:i,queue:s}=r;if(i?.size){let a=Array.from(i,c=>c(o));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(e,s.dequeue())})}}}},V2=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(e,n){let r={value:e};if(n&&this.next){let o=this;for(;o.next;)n(o.next.value)?o=o.next:o.next=o.next.next;o.next=r}else this.next=r}dequeue(){let{next:e}=this;return this.next=e?.next,e?.value}};function Yl(t,e){return t===e?!1:t instanceof Date&&e instanceof Date?+t!=+e:Array.isArray(t)&&Array.isArray(e)?zF(t,e):!0}function zF(t,e){if(t.length!==e.length)return!0;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!0;return!1}function En(t){return t instanceof Ci}var Ci=class t extends wm{constructor(e){super(),this._value=e}static value(e){return new t(e)}static array(e){if(e.some(n=>En(n))){let n=new t,r=()=>{n.update(e.map(o=>En(o)?o.value:o))};return r(),e.forEach(o=>En(o)?o.addEventListener("value",r):0),n}return new t(e)}get value(){return this._value}update(e,{force:n}={}){return Yl(this._value,e)||n?this.emit("value",e):this.cancel("value"),this}willEmit(e,n){return e==="value"&&(this._value=n),n}};function Dn(t){return t instanceof Fr}function vm(t,e){return new Fr(new _m(t),e&&[e].flat())}var Fr=class t extends Ci{static intersect({cross:e=!1,empty:n=!1,include:r=[]}={}){return vm({cross:e,empty:n},r)}static union({cross:e=!1,empty:n=!1,include:r=[]}={}){return vm({cross:e,empty:n,union:!0},r)}static single({cross:e=!1,empty:n=!1,include:r=[]}={}){return vm({cross:e,empty:n,single:!0},r)}static crossfilter({empty:e=!1,include:n=[]}={}){return vm({cross:!0,empty:e},n)}constructor(e=new _m,n=[]){if(super([]),this._resolved=this._value,this._resolver=e,this._relay=new Set,Array.isArray(n))for(let r of n)r._relay.add(this)}clone(){let e=new t(this._resolver);return e._value=e._resolved=this._value,e}remove(e){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:e}),n._value.active={source:e},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(e){return this.clauses.find(n=>n.source===e)?.value}activate(e){this.emit("activate",e),this._relay.forEach(n=>n.activate(e))}update(e){return this._resolved=this._resolver.resolve(this._resolved,e,!0),this._resolved.active=e,this._relay.forEach(n=>n.update(e)),super.update(this._resolved)}willEmit(e,n){return e==="value"?(this._value=n,this.value):n}emitQueueFilter(e,n){return e==="value"?this._resolver.queueFilter(n):null}skip(e,n){return this._resolver.skip(e,n)}predicate(e,n=!1){let{clauses:r}=this,o=n?null:r.active;return this._resolver.predicate(r,o,e)}},_m=class{constructor({union:e,cross:n,single:r,empty:o}={}){this.union=!!e,this.cross=!!n,this.single=!!r,this.empty=!!o}resolve(e,n,r=!1){let{source:o,predicate:i}=n,s=e.filter(c=>o!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),i&&a.push(n),a}skip(e,n){return this.cross&&n?.clients?.has(e)}predicate(e,n,r){let{empty:o,union:i}=this;if(o&&!e.length)return["FALSE"];if(this.skip(r,n))return;let s=e.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return i&&s.length>1?Fs(s):s}queueFilter(e){if(this.cross){let n=e.active?.source;return r=>r.active?.source!==n}return null}};function js(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=e!==void 0?fc(t,Ps(e)):null;return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Xs(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=null;if(e){let i=e.map(s=>{let a=s.map((c,f)=>fc(t[f],Ps(c)));return a.length>1?Tn(a):a[0]});o=i.length>1?Fs(i):i[0]}return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Gs(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scale:i,pixelSize:s=1}){let a=e!=null?ue(t,e):null;return{meta:{type:"interval",scales:i&&[i],bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}function W2(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scales:i=[],pixelSize:s=1}){let a=e!=null?Tn(t.map((f,l)=>ue(f,e[l]))):null;return{meta:{type:"interval",scales:i,bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}var YF={contains:Ub,prefix:jb,suffix:Xb,regexp:Yb};function H2(t,e,{source:n,clients:r=void 0,method:o="contains"}){let i=YF[o],s=e?i(t,Ps(e)):null;return{meta:{type:"match",method:o},source:n,clients:r,value:e,predicate:s}}function Z2(t){return typeof t?.getChild=="function"}function Q2(){let t=new Set,e,n=new Promise(r=>e=r);return{pending(r){t.add(r)},ready(r){return t.delete(r),t.size===0},resolve(){n=new Promise(r=>{e(),e=r})},get promise(){return n}}}function In(t){return Z2(t)?UF(t):jF(t)}function UF(t){let{numRows:e}=t;return{numRows:e,columns:t.toColumns()}}function jF(t){let e=t.length;if(typeof t[0]=="object"){let n=e?Object.keys(t[0]):[],r={};return n.length>0&&n.forEach(o=>{r[o]=t.map(i=>i[o])}),{numRows:e,columns:r}}else return{numRows:e,values:t}}var WA={};ec(WA,{Fixed:()=>qr,Param:()=>Ci,Query:()=>ft,Selection:()=>Fr,agg:()=>Mt,align:()=>NS,and:()=>Tn,area:()=>x8,areaX:()=>b8,areaY:()=>w8,argmax:()=>uc,argmin:()=>lc,arrayAgg:()=>E2,arrow:()=>dA,aspectRatio:()=>OS,avg:()=>Nl,axis:()=>RS,axisFx:()=>xA,axisFy:()=>bA,axisX:()=>gA,axisY:()=>yA,barX:()=>M8,barY:()=>A8,bin:()=>A1,cast:()=>Rl,castDouble:()=>pc,castInteger:()=>I2,cell:()=>T8,cellX:()=>E8,cellY:()=>I8,centroid:()=>Dl,centroidX:()=>R2,centroidY:()=>L2,circle:()=>L8,colorBase:()=>v5,colorClamp:()=>f5,colorConstant:()=>S5,colorDomain:()=>a5,colorExponent:()=>_5,colorInterpolate:()=>d5,colorLabel:()=>g5,colorLegend:()=>XA,colorN:()=>l5,colorNice:()=>u5,colorPercent:()=>y5,colorPivot:()=>h5,colorRange:()=>c5,colorReverse:()=>x5,colorScale:()=>s5,colorScheme:()=>p5,colorSymmetric:()=>m5,colorTickFormat:()=>w5,colorZero:()=>b5,column:()=>Ii,contour:()=>K8,coordinator:()=>er,corr:()=>m2,count:()=>sn,covarPop:()=>y2,covariance:()=>g2,create:()=>Dr,cume_dist:()=>Zb,dateDay:()=>O2,dateMonth:()=>k2,dateMonthDay:()=>N2,delaunayLink:()=>lA,delaunayMesh:()=>uA,denseLine:()=>J8,dense_rank:()=>Wb,density:()=>Q8,densityX:()=>H8,densityY:()=>Z8,dot:()=>N8,dotX:()=>O8,dotY:()=>R8,entropy:()=>p2,eq:()=>Fb,errorbarX:()=>sA,errorbarY:()=>aA,facetGrid:()=>sM,facetLabel:()=>aM,facetMargin:()=>eM,facetMarginBottom:()=>rM,facetMarginLeft:()=>oM,facetMarginRight:()=>iM,facetMarginTop:()=>nM,first:()=>M2,first_value:()=>t2,frame:()=>mA,from:()=>HL,fxAlign:()=>hM,fxAriaDescription:()=>NM,fxAriaLabel:()=>kM,fxAxis:()=>xM,fxDomain:()=>cM,fxFontVariant:()=>CM,fxGrid:()=>AM,fxInset:()=>lM,fxInsetLeft:()=>uM,fxInsetRight:()=>pM,fxLabel:()=>EM,fxLabelAnchor:()=>IM,fxLabelOffset:()=>$M,fxLine:()=>TM,fxPadding:()=>mM,fxPaddingInner:()=>gM,fxPaddingOuter:()=>yM,fxRange:()=>fM,fxReverse:()=>OM,fxRound:()=>dM,fxTickFormat:()=>SM,fxTickPadding:()=>_M,fxTickRotate:()=>MM,fxTickSize:()=>wM,fxTickSpacing:()=>vM,fxTicks:()=>bM,fyAlign:()=>BM,fyAriaDescription:()=>o5,fyAriaLabel:()=>r5,fyAxis:()=>jM,fyDomain:()=>RM,fyFontVariant:()=>n5,fyGrid:()=>QM,fyInset:()=>DM,fyInsetBottom:()=>FM,fyInsetTop:()=>PM,fyLabel:()=>KM,fyLabelAnchor:()=>t5,fyLabelOffset:()=>e5,fyLine:()=>JM,fyPadding:()=>zM,fyPaddingInner:()=>YM,fyPaddingOuter:()=>UM,fyRange:()=>LM,fyReverse:()=>i5,fyRound:()=>qM,fyTickFormat:()=>HM,fyTickPadding:()=>WM,fyTickRotate:()=>ZM,fyTickSize:()=>GM,fyTickSpacing:()=>VM,fyTicks:()=>XM,geo:()=>MA,geojson:()=>Ll,graticule:()=>TA,grid:()=>DS,gridFx:()=>_A,gridFy:()=>SA,gridX:()=>wA,gridY:()=>vA,gt:()=>Cl,gte:()=>qb,hconcat:()=>UL,heatmap:()=>tA,height:()=>ES,hexagon:()=>D8,hexbin:()=>rA,hexgrid:()=>oA,highlight:()=>EA,hspace:()=>GL,hull:()=>pA,image:()=>W8,inset:()=>LS,intervalX:()=>LA,intervalXY:()=>PA,intervalY:()=>DA,isBetween:()=>ue,isDistinct:()=>Bb,isNotBetween:()=>zb,isNotDistinct:()=>fc,isNotNull:()=>No,isNull:()=>qs,kurtosis:()=>u2,label:()=>PS,lag:()=>Jb,last:()=>A2,last_value:()=>e2,lead:()=>Kb,lengthBase:()=>o8,lengthClamp:()=>t8,lengthConstant:()=>s8,lengthDomain:()=>J5,lengthExponent:()=>i8,lengthNice:()=>e8,lengthPercent:()=>n8,lengthRange:()=>K5,lengthScale:()=>Q5,lengthZero:()=>r8,line:()=>v8,lineX:()=>_8,lineY:()=>S8,link:()=>hA,literal:()=>Ps,loadCSV:()=>F2,loadExtension:()=>ql,loadJSON:()=>q2,loadObjects:()=>Y2,loadParquet:()=>B2,loadSpatial:()=>z2,lt:()=>Oo,lte:()=>Ro,mad:()=>o2,margin:()=>SS,marginBottom:()=>kS,marginLeft:()=>IS,marginRight:()=>$S,marginTop:()=>CS,margins:()=>_S,max:()=>Kn,median:()=>s2,menu:()=>PL,min:()=>tr,mode:()=>c2,name:()=>wS,nearest:()=>NA,nearestX:()=>OA,nearestY:()=>RA,neq:()=>Bs,not:()=>Pb,nth_value:()=>n2,ntile:()=>Qb,opacityBase:()=>R5,opacityClamp:()=>E5,opacityConstant:()=>D5,opacityDomain:()=>A5,opacityExponent:()=>L5,opacityLabel:()=>$5,opacityLegend:()=>GA,opacityNice:()=>I5,opacityPercent:()=>C5,opacityRange:()=>T5,opacityReverse:()=>k5,opacityScale:()=>M5,opacityTickFormat:()=>O5,opacityZero:()=>N5,or:()=>Fs,padding:()=>FS,pan:()=>FA,panX:()=>qA,panY:()=>BA,panZoom:()=>zA,panZoomX:()=>YA,panZoomY:()=>UA,percent_rank:()=>Hb,plot:()=>ZL,product:()=>i2,projectionClip:()=>y8,projectionDomain:()=>u8,projectionInset:()=>p8,projectionInsetBottom:()=>g8,projectionInsetLeft:()=>d8,projectionInsetRight:()=>h8,projectionInsetTop:()=>m8,projectionParallels:()=>c8,projectionPrecision:()=>f8,projectionRotate:()=>l8,projectionType:()=>a8,quantile:()=>a2,rBase:()=>W5,rClamp:()=>U5,rConstant:()=>Z5,rDomain:()=>z5,rExponent:()=>H5,rLabel:()=>X5,rNice:()=>j5,rPercent:()=>G5,rRange:()=>Y5,rScale:()=>B5,rZero:()=>V5,rank:()=>Vb,raster:()=>eA,rasterTile:()=>nA,rect:()=>$8,rectX:()=>C8,rectY:()=>k8,regressionY:()=>iA,row_number:()=>Gb,ruleX:()=>B8,ruleY:()=>z8,search:()=>FL,skewness:()=>l2,slider:()=>qL,sphere:()=>AA,spike:()=>V8,sql:()=>U,stddev:()=>Ol,stddevPop:()=>h2,stringAgg:()=>T2,style:()=>AS,sum:()=>Ln,symbolDomain:()=>F5,symbolLegend:()=>VA,symbolRange:()=>q5,symbolScale:()=>P5,table:()=>BL,text:()=>P8,textX:()=>F8,textY:()=>q8,tickX:()=>Y8,tickY:()=>U8,toggle:()=>Ha,toggleColor:()=>kA,toggleX:()=>IA,toggleY:()=>$A,toggleZ:()=>CA,varPop:()=>d2,variance:()=>f2,vconcat:()=>YL,vector:()=>j8,vectorX:()=>X8,vectorY:()=>G8,voronoi:()=>cA,voronoiMesh:()=>fA,vspace:()=>XL,width:()=>TS,xAlign:()=>WS,xAriaDescription:()=>d4,xAriaLabel:()=>p4,xAxis:()=>JS,xBase:()=>y4,xClamp:()=>GS,xConstant:()=>b4,xDomain:()=>BS,xExponent:()=>x4,xFontVariant:()=>u4,xGrid:()=>i4,xInset:()=>US,xInsetLeft:()=>jS,xInsetRight:()=>XS,xLabel:()=>a4,xLabelAnchor:()=>c4,xLabelArrow:()=>f4,xLabelOffset:()=>l4,xLine:()=>s4,xNice:()=>YS,xPadding:()=>HS,xPaddingInner:()=>ZS,xPaddingOuter:()=>QS,xPercent:()=>h4,xRange:()=>zS,xReverse:()=>m4,xRound:()=>VS,xScale:()=>qS,xTickFormat:()=>r4,xTickPadding:()=>n4,xTickRotate:()=>o4,xTickSize:()=>t4,xTickSpacing:()=>e4,xTicks:()=>KS,xZero:()=>g4,xyDomain:()=>MS,yAlign:()=>$4,yAriaDescription:()=>W4,yAriaLabel:()=>V4,yAxis:()=>O4,yBase:()=>J4,yClamp:()=>E4,yConstant:()=>tM,yDomain:()=>v4,yExponent:()=>K4,yFontVariant:()=>G4,yGrid:()=>B4,yInset:()=>M4,yInsetBottom:()=>T4,yInsetTop:()=>A4,yLabel:()=>Y4,yLabelAnchor:()=>U4,yLabelArrow:()=>j4,yLabelOffset:()=>X4,yLine:()=>z4,yNice:()=>S4,yPadding:()=>C4,yPaddingInner:()=>k4,yPaddingOuter:()=>N4,yPercent:()=>H4,yRange:()=>_4,yReverse:()=>Z4,yRound:()=>I4,yScale:()=>w4,yTickFormat:()=>F4,yTickPadding:()=>P4,yTickRotate:()=>q4,yTickSize:()=>L4,yTickSpacing:()=>D4,yTicks:()=>R4,yZero:()=>Q4});var qr=Symbol("Fixed"),qe=Symbol("Transient"),Ul=Symbol("Transform");var nS={};ec(nS,{Area:()=>Fa,Arrow:()=>id,BarX:()=>qa,BarY:()=>Ba,Cell:()=>za,Contour:()=>gd,Density:()=>bd,Dot:()=>Ya,Frame:()=>Jp,Geo:()=>wd,Hexgrid:()=>vd,Image:()=>_d,Line:()=>Ua,Link:()=>rd,Mark:()=>pt,Raster:()=>pd,Rect:()=>Pa,RuleX:()=>Up,RuleY:()=>jp,Text:()=>Ra,TickX:()=>cd,TickY:()=>fd,Tip:()=>Kp,Vector:()=>Da,WaffleX:()=>Md,WaffleY:()=>Ad,area:()=>nd,areaX:()=>xs,areaY:()=>xi,arrow:()=>sO,auto:()=>yO,autoSpec:()=>E3,axisFx:()=>_x,axisFy:()=>vx,axisX:()=>Gp,axisY:()=>Xp,barX:()=>bo,barY:()=>wo,bin:()=>yi,binX:()=>yo,binY:()=>xo,bollinger:()=>_s,bollingerX:()=>SO,bollingerY:()=>MO,boxX:()=>AO,boxY:()=>TO,cell:()=>bs,cellX:()=>cO,cellY:()=>fO,centroid:()=>Hx,circle:()=>pO,cluster:()=>MR,column:()=>Oe,contour:()=>LO,crosshair:()=>FO,crosshairX:()=>qO,crosshairY:()=>BO,delaunayLink:()=>UO,delaunayMesh:()=>jO,density:()=>HO,differenceX:()=>JO,differenceY:()=>KO,dodgeX:()=>jR,dodgeY:()=>XR,dot:()=>mr,dotX:()=>lO,dotY:()=>uO,filter:()=>xC,find:()=>EC,formatIsoDate:()=>J6,formatMonth:()=>Nk,formatNumber:()=>Q6,formatWeekday:()=>Ok,frame:()=>Df,geo:()=>Zx,geoCentroid:()=>eR,graticule:()=>rR,gridFx:()=>Tx,gridFy:()=>Mx,gridX:()=>Ax,gridY:()=>Sx,group:()=>Lp,groupX:()=>rs,groupY:()=>os,groupZ:()=>Rp,hexagon:()=>dO,hexbin:()=>oR,hexgrid:()=>iR,hull:()=>XO,identity:()=>V,image:()=>aR,indexOf:()=>Xt,initializer:()=>Vt,interpolateNearest:()=>hd,interpolateNone:()=>Wx,interpolatorBarycentric:()=>dd,interpolatorRandomWalk:()=>md,legend:()=>IN,line:()=>ja,lineX:()=>ws,lineY:()=>vs,linearRegressionX:()=>lR,linearRegressionY:()=>uR,link:()=>qx,map:()=>kn,mapX:()=>Yf,mapY:()=>Uf,marks:()=>we,normalize:()=>i1,normalizeX:()=>HR,normalizeY:()=>ZR,numberInterval:()=>m6,plot:()=>Pf,pointer:()=>ls,pointerX:()=>us,pointerY:()=>mi,raster:()=>kO,rect:()=>Qp,rectX:()=>Rf,rectY:()=>Lf,reverse:()=>bC,ruleX:()=>Vn,ruleY:()=>Wn,scale:()=>is,select:()=>tL,selectFirst:()=>Id,selectLast:()=>$d,selectMaxX:()=>f1,selectMaxY:()=>l1,selectMinX:()=>a1,selectMinY:()=>c1,shiftX:()=>QR,shiftY:()=>JR,shuffle:()=>wC,sort:()=>Uy,sphere:()=>nR,spike:()=>cN,stackX:()=>g3,stackX1:()=>RN,stackX2:()=>LN,stackY:()=>y3,stackY1:()=>DN,stackY2:()=>PN,text:()=>go,textX:()=>hx,textY:()=>mx,tickX:()=>Xx,tickY:()=>Gx,timeInterval:()=>Ip,tip:()=>Ox,transform:()=>be,tree:()=>V3,treeLink:()=>e1,treeNode:()=>Sd,utcInterval:()=>Ma,valueof:()=>ut,vector:()=>d3,vectorX:()=>xx,vectorY:()=>bx,voronoi:()=>GO,voronoiMesh:()=>VO,waffleX:()=>CR,waffleY:()=>kR,window:()=>jf,windowX:()=>xO,windowY:()=>bO});function gt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function an(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function wr(t){let e,n,r;t.length!==2?(e=gt,n=(a,c)=>gt(t(a),c),r=(a,c)=>t(a)-c):(e=t===gt||t===an?t:VF,n=t,r=t);function o(a,c,f=0,l=a.length){if(f<l){if(e(c,c)!==0)return l;do{let u=f+l>>>1;n(a[u],c)<0?f=u+1:l=u}while(f<l)}return f}function i(a,c,f=0,l=a.length){if(f<l){if(e(c,c)!==0)return l;do{let u=f+l>>>1;n(a[u],c)<=0?f=u+1:l=u}while(f<l)}return f}function s(a,c,f=0,l=a.length){let u=o(a,c,f,l-1);return u>f&&r(a[u-1],c)>-r(a[u],c)?u-1:u}return{left:o,center:s,right:i}}function VF(){return 0}function jl(t){return t===null?NaN:+t}function*fE(t,e){if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(yield r)}}var lE=wr(gt),uE=lE.right,WF=lE.left,HF=wr(jl).center,Lo=uE;var Xl=pE(dE),J2=pE(ZF);function pE(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:o,width:i,height:s}=e;if(!((i=Math.floor(i))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:o.length/i))>=0))throw new RangeError("invalid height");if(!i||!s||!n&&!r)return e;let a=n&&t(n),c=r&&t(r),f=o.slice();return a&&c?(hc(a,f,o,i,s),hc(a,o,f,i,s),hc(a,f,o,i,s),mc(c,o,f,i,s),mc(c,f,o,i,s),mc(c,o,f,i,s)):a?(hc(a,o,f,i,s),hc(a,f,o,i,s),hc(a,o,f,i,s)):c&&(mc(c,o,f,i,s),mc(c,f,o,i,s),mc(c,o,f,i,s)),e}}function hc(t,e,n,r,o){for(let i=0,s=r*o;i<s;)t(e,n,i,i+=r,1)}function mc(t,e,n,r,o){for(let i=0,s=r*o;i<r;++i)t(e,n,i,i+s,r)}function ZF(t){let e=dE(t);return(n,r,o,i,s)=>{o<<=2,i<<=2,s<<=2,e(n,r,o+0,i+0,s),e(n,r,o+1,i+1,s),e(n,r,o+2,i+2,s),e(n,r,o+3,i+3,s)}}function dE(t){let e=Math.floor(t);if(e===t)return QF(t);let n=t-e,r=2*t+1;return(o,i,s,a,c)=>{if(!((a-=c)>=s))return;let f=e*i[s],l=c*e,u=l+c;for(let p=s,d=s+l;p<d;p+=c)f+=i[Math.min(a,p)];for(let p=s,d=a;p<=d;p+=c)f+=i[Math.min(a,p+l)],o[p]=(f+n*(i[Math.max(s,p-u)]+i[Math.min(a,p+u)]))/r,f-=i[Math.max(s,p-l)]}}function QF(t){let e=2*t+1;return(n,r,o,i,s)=>{if(!((i-=s)>=o))return;let a=t*r[o],c=s*t;for(let f=o,l=o+c;f<l;f+=s)a+=r[Math.min(i,f)];for(let f=o,l=i;f<=l;f+=s)a+=r[Math.min(i,f+c)],n[f]=a/e,a-=r[Math.max(o,f-c)]}}function Br(t,e){let n=0;if(e===void 0)for(let r of t)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(o=+o)>=o&&++n}return n}function JF(t){return t.length|0}function KF(t){return!(t>0)}function tq(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function eq(t){return e=>t(...e)}function Sm(...t){let e=typeof t[t.length-1]=="function"&&eq(t.pop());t=t.map(tq);let n=t.map(JF),r=t.length-1,o=new Array(r+1).fill(0),i=[];if(r<0||n.some(KF))return i;for(;;){i.push(o.map((a,c)=>t[c][a]));let s=r;for(;++o[s]===n[s];){if(s===0)return e?i.map(e):i;o[s--]=0}}}function Mm(t,e){var n=0,r=0;return Float64Array.from(t,e===void 0?o=>n+=+o||0:o=>n+=+e(o,r++,t)||0)}function ki(t,e){let n=0,r,o=0,i=0;if(e===void 0)for(let s of t)s!=null&&(s=+s)>=s&&(r=s-o,o+=r/++n,i+=r*(s-o));else{let s=-1;for(let a of t)(a=e(a,++s,t))!=null&&(a=+a)>=a&&(r=a-o,o+=r/++n,i+=r*(a-o))}if(n>1)return i/(n-1)}function nr(t,e){let n=ki(t,e);return n&&Math.sqrt(n)}function Rt(t,e){let n,r;if(e===void 0)for(let o of t)o!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)));else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}var Be=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let n=this._partials,r=0;for(let o=0;o<this._n&&o<32;o++){let i=n[o],s=e+i,a=Math.abs(e)<Math.abs(i)?e-(s-i):i-(s-e);a&&(n[r++]=a),e=s}return n[r]=e,this._n=r+1,this}valueOf(){let e=this._partials,n=this._n,r,o,i,s=0;if(n>0){for(s=e[--n];n>0&&(r=s,o=e[--n],s=r+o,i=o-(s-r),!i););n>0&&(i<0&&e[n-1]<0||i>0&&e[n-1]>0)&&(o=i*2,r=s+o,o==r-s&&(s=r))}return s}};var cn=class extends Map{constructor(e,n=gE){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let[r,o]of e)this.set(r,o)}get(e){return super.get(K2(this,e))}has(e){return super.has(K2(this,e))}set(e,n){return super.set(hE(this,e),n)}delete(e){return super.delete(mE(this,e))}},fn=class extends Set{constructor(e,n=gE){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let r of e)this.add(r)}has(e){return super.has(K2(this,e))}add(e){return super.add(hE(this,e))}delete(e){return super.delete(mE(this,e))}};function K2({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):n}function hE({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function mE({_intern:t,_key:e},n){let r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function gE(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Gl(t){return t}function ze(t,...e){return ew(t,Gl,Gl,e)}function vr(t,e,...n){return ew(t,Gl,e,n)}function tw(t,e,...n){return ew(t,Array.from,e,n)}function ew(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);let a=new cn,c=r[s++],f=-1;for(let l of i){let u=c(l,++f,i),p=a.get(u);p?p.push(l):a.set(u,[l])}for(let[l,u]of a)a.set(l,o(u,s));return e(a)}(t,0)}function nw(t,e){return Array.from(e,n=>t[n])}function Do(t,...e){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&n.length!==2||e.length>1){let r=Uint32Array.from(t,(o,i)=>i);return e.length>1?(e=e.map(o=>t.map(o)),r.sort((o,i)=>{for(let s of e){let a=Vs(s[o],s[i]);if(a)return a}})):(n=t.map(n),r.sort((o,i)=>Vs(n[o],n[i]))),nw(t,r)}return t.sort(Vl(n))}function Vl(t=gt){if(t===gt)return Vs;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{let r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function Vs(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}function gc(t,e,n){return(e.length!==2?Do(vr(t,e,n),([r,o],[i,s])=>gt(o,s)||gt(r,i)):Do(ze(t,n),([r,o],[i,s])=>e(o,s)||gt(r,i))).map(([r])=>r)}var nq=Math.sqrt(50),rq=Math.sqrt(10),oq=Math.sqrt(2);function Am(t,e,n){let r=(e-t)/Math.max(0,n),o=Math.floor(Math.log10(r)),i=r/Math.pow(10,o),s=i>=nq?10:i>=rq?5:i>=oq?2:1,a,c,f;return o<0?(f=Math.pow(10,-o)/s,a=Math.round(t*f),c=Math.round(e*f),a/f<t&&++a,c/f>e&&--c,f=-f):(f=Math.pow(10,o)*s,a=Math.round(t/f),c=Math.round(e/f),a*f<t&&++a,c*f>e&&--c),c<a&&.5<=n&&n<2?Am(t,e,n*2):[a,c,f]}function Ye(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];let r=e<t,[o,i,s]=r?Am(e,t,n):Am(t,e,n);if(!(i>=o))return[];let a=i-o+1,c=new Array(a);if(r)if(s<0)for(let f=0;f<a;++f)c[f]=(i-f)/-s;else for(let f=0;f<a;++f)c[f]=(i-f)*s;else if(s<0)for(let f=0;f<a;++f)c[f]=(o+f)/-s;else for(let f=0;f<a;++f)c[f]=(o+f)*s;return c}function Po(t,e,n){return e=+e,t=+t,n=+n,Am(t,e,n)[2]}function yc(t,e,n){e=+e,t=+t,n=+n;let r=e<t,o=r?Po(e,t,n):Po(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function xc(t,e,n){let r;for(;;){let o=Po(t,e,n);if(o===r||o===0||!isFinite(o))return[t,e];o>0?(t=Math.floor(t/o)*o,e=Math.ceil(e/o)*o):o<0&&(t=Math.ceil(t*o)/o,e=Math.floor(e*o)/o),r=o}}function Ni(t){return Math.max(1,Math.ceil(Math.log(Br(t))/Math.LN2)+1)}function Ct(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function Tm(t,e){let n,r=-1,o=-1;if(e===void 0)for(let i of t)++o,i!=null&&(n<i||n===void 0&&i>=i)&&(n=i,r=o);else for(let i of t)(i=e(i,++o,t))!=null&&(n<i||n===void 0&&i>=i)&&(n=i,r=o);return r}function Bt(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Em(t,e){let n,r=-1,o=-1;if(e===void 0)for(let i of t)++o,i!=null&&(n>i||n===void 0&&i>=i)&&(n=i,r=o);else for(let i of t)(i=e(i,++o,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i,r=o);return r}function Im(t,e,n=0,r=1/0,o){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(o=o===void 0?Vs:Vl(o);r>n;){if(r-n>600){let c=r-n+1,f=e-n+1,l=Math.log(c),u=.5*Math.exp(2*l/3),p=.5*Math.sqrt(l*u*(c-u)/c)*(f-c/2<0?-1:1),d=Math.max(n,Math.floor(e-f*u/c+p)),h=Math.min(r,Math.floor(e+(c-f)*u/c+p));Im(t,e,d,h,o)}let i=t[e],s=n,a=r;for(Wl(t,n,e),o(t[r],i)>0&&Wl(t,n,r);s<a;){for(Wl(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?Wl(t,n,a):(++a,Wl(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function Wl(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Ws(t,e=gt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?gt(s,o)>0:gt(s,s)===0)&&(n=i,o=s,r=!0)}}else for(let o of t)(r?e(o,n)>0:e(o,o)===0)&&(n=o,r=!0);return n}function ln(t,e,n){if(t=Float64Array.from(fE(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return Bt(t);if(e>=1)return Ct(t);var r,o=(r-1)*e,i=Math.floor(o),s=Ct(Im(t,i).subarray(0,i+1)),a=Bt(t.subarray(i+1));return s+(a-s)*(o-i)}}function rw(t,e,n=jl){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),s=+n(t[i],i,t),a=+n(t[i+1],i+1,t);return s+(a-s)*(o-i)}}function $m(t,e,n){let r=Br(t),o=ln(t,.75)-ln(t,.25);return r&&o?Math.ceil((n-e)/(2*o*Math.pow(r,-1/3))):1}function Hl(t,e,n){let r=Br(t),o=nr(t);return r&&o?Math.ceil((n-e)*Math.cbrt(r)/(3.49*o)):1}function Fo(t,e){let n=0,r=0;if(e===void 0)for(let o of t)o!=null&&(o=+o)>=o&&(++n,r+=o);else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(i=+i)>=i&&(++n,r+=i)}if(n)return r/n}function _r(t,e){return ln(t,.5,e)}function*sq(t){for(let e of t)yield*e}function bc(t){return Array.from(sq(t))}function wc(t,e){let n=new cn;if(e===void 0)for(let i of t)i!=null&&i>=i&&n.set(i,(n.get(i)||0)+1);else{let i=-1;for(let s of t)(s=e(s,++i,t))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,o=0;for(let[i,s]of n)s>o&&(o=s,r=i);return r}function Cm(t,e=aq){let n=[],r,o=!1;for(let i of t)o&&n.push(e(r,i)),r=i,o=!0;return n}function aq(t,e){return[t,e]}function ce(t,e,n){t=+t,e=+e,n=(o=arguments.length)<2?(e=t,t=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(o);++r<o;)i[r]=t+r*n;return i}function Zl(t,e=gt){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(t),r=new Float64Array(n.length);e.length!==2&&(n=n.map(e),e=gt);let o=(a,c)=>e(n[a],n[c]),i,s;return t=Uint32Array.from(n,(a,c)=>c),t.sort(e===gt?(a,c)=>Vs(n[a],n[c]):Vl(o)),t.forEach((a,c)=>{let f=o(a,i===void 0?a:i);f>=0?((i===void 0||f>0)&&(i=a,s=c),r[a]=s):r[a]=NaN}),r}function km(t,e=gt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?gt(s,o)<0:gt(s,s)===0)&&(n=i,o=s,r=!0)}}else for(let o of t)(r?e(o,n)<0:e(o,o)===0)&&(n=o,r=!0);return n}function Ue(t,e){let n=0;if(e===void 0)for(let r of t)(r=+r)&&(n+=r);else{let r=-1;for(let o of t)(o=+e(o,++r,t))&&(n+=o)}return n}function Oi(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function yE(t){return t}var ow=1,iw=2,sw=3,Nm=4,xE=1e-6;function cq(t){return"translate("+t+",0)"}function fq(t){return"translate(0,"+t+")"}function lq(t){return e=>+t(e)}function uq(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function pq(){return!this.__axis}function dq(t,e){var n=[],r=null,o=null,i=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,f=t===ow||t===Nm?-1:1,l=t===Nm||t===iw?"x":"y",u=t===ow||t===sw?cq:fq;function p(d){var h=r??(e.ticks?e.ticks.apply(e,n):e.domain()),m=o??(e.tickFormat?e.tickFormat.apply(e,n):yE),g=Math.max(i,0)+a,y=e.range(),x=+y[0]+c,b=+y[y.length-1]+c,w=(e.bandwidth?uq:lq)(e.copy(),c),_=d.selection?d.selection():d,v=_.selectAll(".domain").data([null]),A=_.selectAll(".tick").data(h,e).order(),E=A.exit(),T=A.enter().append("g").attr("class","tick"),$=A.select("line"),M=A.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),A=A.merge(T),$=$.merge(T.append("line").attr("stroke","currentColor").attr(l+"2",f*i)),M=M.merge(T.append("text").attr("fill","currentColor").attr(l,f*g).attr("dy",t===ow?"0em":t===sw?"0.71em":"0.32em")),d!==_&&(v=v.transition(d),A=A.transition(d),$=$.transition(d),M=M.transition(d),E=E.transition(d).attr("opacity",xE).attr("transform",function(k){return isFinite(k=w(k))?u(k+c):this.getAttribute("transform")}),T.attr("opacity",xE).attr("transform",function(k){var R=this.parentNode.__axis;return u((R&&isFinite(R=R(k))?R:w(k))+c)})),E.remove(),v.attr("d",t===Nm||t===iw?s?"M"+f*s+","+x+"H"+c+"V"+b+"H"+f*s:"M"+c+","+x+"V"+b:s?"M"+x+","+f*s+"V"+c+"H"+b+"V"+f*s:"M"+x+","+c+"H"+b),A.attr("opacity",1).attr("transform",function(k){return u(w(k)+c)}),$.attr(l+"2",f*i),M.attr(l,f*g).text(m),_.filter(pq).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===iw?"start":t===Nm?"end":"middle"),_.each(function(){this.__axis=w})}return p.scale=function(d){return arguments.length?(e=d,p):e},p.ticks=function(){return n=Array.from(arguments),p},p.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),p):n.slice()},p.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),p):r&&r.slice()},p.tickFormat=function(d){return arguments.length?(o=d,p):o},p.tickSize=function(d){return arguments.length?(i=s=+d,p):i},p.tickSizeInner=function(d){return arguments.length?(i=+d,p):i},p.tickSizeOuter=function(d){return arguments.length?(s=+d,p):s},p.tickPadding=function(d){return arguments.length?(a=+d,p):a},p.offset=function(d){return arguments.length?(c=+d,p):c},p}function aw(t){return dq(sw,t)}var hq={value:()=>{}};function wE(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Om(n)}function Om(t){this._=t}function mq(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Om.prototype=wE.prototype={constructor:Om,on:function(t,e){var n=this._,r=mq(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=gq(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=bE(n[o],t.name,e);else if(e==null)for(o in n)n[o]=bE(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Om(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function gq(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function bE(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=hq,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Hs=wE;var Rm="http://www.w3.org/1999/xhtml",un={svg:"http://www.w3.org/2000/svg",xhtml:Rm,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qo(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),un.hasOwnProperty(e)?{space:un[e],local:t}:t}function yq(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Rm&&e.documentElement.namespaceURI===Rm?e.createElement(t):e.createElementNS(n,t)}}function xq(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Bo(t){var e=qo(t);return(e.local?xq:yq)(e)}function bq(){}function Zs(t){return t==null?bq:function(){return this.querySelector(t)}}function vE(t){typeof t!="function"&&(t=Zs(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),c,f,l=0;l<s;++l)(c=i[l])&&(f=t.call(c,c.__data__,l,i))&&("__data__"in c&&(f.__data__=c.__data__),a[l]=f);return new ie(r,this._parents)}function cw(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function wq(){return[]}function Ql(t){return t==null?wq:function(){return this.querySelectorAll(t)}}function vq(t){return function(){return cw(t.apply(this,arguments))}}function _E(t){typeof t=="function"?t=vq(t):t=Ql(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&(r.push(t.call(c,c.__data__,f,s)),o.push(c));return new ie(r,o)}function Jl(t){return function(){return this.matches(t)}}function Lm(t){return function(e){return e.matches(t)}}var _q=Array.prototype.find;function Sq(t){return function(){return _q.call(this.children,t)}}function Mq(){return this.firstElementChild}function SE(t){return this.select(t==null?Mq:Sq(typeof t=="function"?t:Lm(t)))}var Aq=Array.prototype.filter;function Tq(){return Array.from(this.children)}function Eq(t){return function(){return Aq.call(this.children,t)}}function ME(t){return this.selectAll(t==null?Tq:Eq(typeof t=="function"?t:Lm(t)))}function AE(t){typeof t!="function"&&(t=Jl(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,f=0;f<s;++f)(c=i[f])&&t.call(c,c.__data__,f,i)&&a.push(c);return new ie(r,this._parents)}function Dm(t){return new Array(t.length)}function TE(){return new ie(this._enter||this._groups.map(Dm),this._parents)}function Kl(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Kl.prototype={constructor:Kl,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function EE(t){return function(){return t}}function Iq(t,e,n,r,o,i){for(var s=0,a,c=e.length,f=i.length;s<f;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new Kl(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function $q(t,e,n,r,o,i,s){var a,c,f=new Map,l=e.length,u=i.length,p=new Array(l),d;for(a=0;a<l;++a)(c=e[a])&&(p[a]=d=s.call(c,c.__data__,a,e)+"",f.has(d)?o[a]=c:f.set(d,c));for(a=0;a<u;++a)d=s.call(t,i[a],a,i)+"",(c=f.get(d))?(r[a]=c,c.__data__=i[a],f.delete(d)):n[a]=new Kl(t,i[a]);for(a=0;a<l;++a)(c=e[a])&&f.get(p[a])===c&&(o[a]=c)}function Cq(t){return t.__data__}function IE(t,e){if(!arguments.length)return Array.from(this,Cq);var n=e?$q:Iq,r=this._parents,o=this._groups;typeof t!="function"&&(t=EE(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),f=0;f<i;++f){var l=r[f],u=o[f],p=u.length,d=kq(t.call(l,l&&l.__data__,f,r)),h=d.length,m=a[f]=new Array(h),g=s[f]=new Array(h),y=c[f]=new Array(p);n(l,u,m,g,y,d,e);for(var x=0,b=0,w,_;x<h;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(_=g[b])&&++b<h;);w._next=_||null}}return s=new ie(s,r),s._enter=a,s._exit=c,s}function kq(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $E(){return new ie(this._exit||this._groups.map(Dm),this._parents)}function CE(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function kE(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var f=n[c],l=r[c],u=f.length,p=a[c]=new Array(u),d,h=0;h<u;++h)(d=f[h]||l[h])&&(p[h]=d);for(;c<o;++c)a[c]=n[c];return new ie(a,this._parents)}function NE(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function OE(t){t||(t=Nq);function e(u,p){return u&&p?t(u.__data__,p.__data__):!u-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),f,l=0;l<a;++l)(f=s[l])&&(c[l]=f);c.sort(e)}return new ie(o,this._parents).order()}function Nq(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function RE(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function LE(){return Array.from(this)}function DE(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function PE(){let t=0;for(let e of this)++t;return t}function FE(){return!this.node()}function qE(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function Oq(t){return function(){this.removeAttribute(t)}}function Rq(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Lq(t,e){return function(){this.setAttribute(t,e)}}function Dq(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Pq(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Fq(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function BE(t,e){var n=qo(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Rq:Oq:typeof e=="function"?n.local?Fq:Pq:n.local?Dq:Lq)(n,e))}function Pm(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function qq(t){return function(){this.style.removeProperty(t)}}function Bq(t,e,n){return function(){this.style.setProperty(t,e,n)}}function zq(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function zE(t,e,n){return arguments.length>1?this.each((e==null?qq:typeof e=="function"?zq:Bq)(t,e,n??"")):Ri(this.node(),t)}function Ri(t,e){return t.style.getPropertyValue(e)||Pm(t).getComputedStyle(t,null).getPropertyValue(e)}function Yq(t){return function(){delete this[t]}}function Uq(t,e){return function(){this[t]=e}}function jq(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function YE(t,e){return arguments.length>1?this.each((e==null?Yq:typeof e=="function"?jq:Uq)(t,e)):this.node()[t]}function UE(t){return t.trim().split(/^|\s+/)}function fw(t){return t.classList||new jE(t)}function jE(t){this._node=t,this._names=UE(t.getAttribute("class")||"")}jE.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function XE(t,e){for(var n=fw(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function GE(t,e){for(var n=fw(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function Xq(t){return function(){XE(this,t)}}function Gq(t){return function(){GE(this,t)}}function Vq(t,e){return function(){(e.apply(this,arguments)?XE:GE)(this,t)}}function VE(t,e){var n=UE(t+"");if(arguments.length<2){for(var r=fw(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?Vq:e?Xq:Gq)(n,e))}function Wq(){this.textContent=""}function Hq(t){return function(){this.textContent=t}}function Zq(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function WE(t){return arguments.length?this.each(t==null?Wq:(typeof t=="function"?Zq:Hq)(t)):this.node().textContent}function Qq(){this.innerHTML=""}function Jq(t){return function(){this.innerHTML=t}}function Kq(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function HE(t){return arguments.length?this.each(t==null?Qq:(typeof t=="function"?Kq:Jq)(t)):this.node().innerHTML}function tB(){this.nextSibling&&this.parentNode.appendChild(this)}function ZE(){return this.each(tB)}function eB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function QE(){return this.each(eB)}function JE(t){var e=typeof t=="function"?t:Bo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function nB(){return null}function KE(t,e){var n=typeof t=="function"?t:Bo(t),r=e==null?nB:typeof e=="function"?e:Zs(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function rB(){var t=this.parentNode;t&&t.removeChild(this)}function t7(){return this.each(rB)}function oB(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function iB(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function e7(t){return this.select(t?iB:oB)}function n7(t){return arguments.length?this.property("__data__",t):this.node().__data__}function sB(t){return function(e){t.call(this,e,this.__data__)}}function aB(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function cB(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function fB(t,e,n){return function(){var r=this.__on,o,i=sB(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function r7(t,e,n){var r=aB(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,f=a.length,l;c<f;++c)for(o=0,l=a[c];o<i;++o)if((s=r[o]).type===l.type&&s.name===l.name)return l.value}return}for(a=e?fB:cB,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function o7(t,e,n){var r=Pm(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function lB(t,e){return function(){return o7(this,t,e)}}function uB(t,e){return function(){return o7(this,t,e.apply(this,arguments))}}function i7(t,e){return this.each((typeof e=="function"?uB:lB)(t,e))}function*s7(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var lw=[null];function ie(t,e){this._groups=t,this._parents=e}function a7(){return new ie([[document.documentElement]],lw)}function pB(){return this}ie.prototype=a7.prototype={constructor:ie,select:vE,selectAll:_E,selectChild:SE,selectChildren:ME,filter:AE,data:IE,enter:TE,exit:$E,join:CE,merge:kE,selection:pB,order:NE,sort:OE,call:RE,nodes:LE,node:DE,size:PE,empty:FE,each:qE,attr:BE,style:zE,property:YE,classed:VE,text:WE,html:HE,raise:ZE,lower:QE,append:JE,insert:KE,remove:t7,clone:e7,datum:n7,on:r7,dispatch:i7,[Symbol.iterator]:s7};var zo=a7;function St(t){return typeof t=="string"?new ie([[document.querySelector(t)]],[document.documentElement]):new ie([[t]],lw)}function c7(t){let e;for(;e=t.sourceEvent;)t=e;return t}function He(t,e){if(t=c7(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}var Fm={capture:!0,passive:!1};function qm(t){t.preventDefault(),t.stopImmediatePropagation()}function tu(t){var e=t.document.documentElement,n=St(t).on("dragstart.drag",qm,Fm);"onselectstart"in e?n.on("selectstart.drag",qm,Fm):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function eu(t,e){var n=t.document.documentElement,r=St(t).on("dragstart.drag",null);e&&(r.on("click.drag",qm,Fm),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 Yo(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Li(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Yr(){}var Di=.7,Ks=1/Di,vc="\\s*([+-]?\\d+)\\s*",nu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dB=/^#([0-9a-f]{3,8})$/,hB=new RegExp(`^rgb\\(${vc},${vc},${vc}\\)$`),mB=new RegExp(`^rgb\\(${zr},${zr},${zr}\\)$`),gB=new RegExp(`^rgba\\(${vc},${vc},${vc},${nu}\\)$`),yB=new RegExp(`^rgba\\(${zr},${zr},${zr},${nu}\\)$`),xB=new RegExp(`^hsl\\(${nu},${zr},${zr}\\)$`),bB=new RegExp(`^hsla\\(${nu},${zr},${zr},${nu}\\)$`),f7={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};Yo(Yr,Pn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:l7,formatHex:l7,formatHex8:wB,formatHsl:vB,formatRgb:u7,toString:u7});function l7(){return this.rgb().formatHex()}function wB(){return this.rgb().formatHex8()}function vB(){return y7(this).formatHsl()}function u7(){return this.rgb().formatRgb()}function Pn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=dB.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?p7(e):n===3?new pe(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Bm(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Bm(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=hB.exec(t))?new pe(e[1],e[2],e[3],1):(e=mB.exec(t))?new pe(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=gB.exec(t))?Bm(e[1],e[2],e[3],e[4]):(e=yB.exec(t))?Bm(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=xB.exec(t))?m7(e[1],e[2]/100,e[3]/100,1):(e=bB.exec(t))?m7(e[1],e[2]/100,e[3]/100,e[4]):f7.hasOwnProperty(t)?p7(f7[t]):t==="transparent"?new pe(NaN,NaN,NaN,0):null}function p7(t){return new pe(t>>16&255,t>>8&255,t&255,1)}function Bm(t,e,n,r){return r<=0&&(t=e=n=NaN),new pe(t,e,n,r)}function ru(t){return t instanceof Yr||(t=Pn(t)),t?(t=t.rgb(),new pe(t.r,t.g,t.b,t.opacity)):new pe}function ve(t,e,n,r){return arguments.length===1?ru(t):new pe(t,e,n,r??1)}function pe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Yo(pe,ve,Li(Yr,{brighter(t){return t=t==null?Ks:Math.pow(Ks,t),new pe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Di:Math.pow(Di,t),new pe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pe(Js(this.r),Js(this.g),Js(this.b),Ym(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:d7,formatHex:d7,formatHex8:_B,formatRgb:h7,toString:h7}));function d7(){return`#${Qs(this.r)}${Qs(this.g)}${Qs(this.b)}`}function _B(){return`#${Qs(this.r)}${Qs(this.g)}${Qs(this.b)}${Qs((isNaN(this.opacity)?1:this.opacity)*255)}`}function h7(){let t=Ym(this.opacity);return`${t===1?"rgb(":"rgba("}${Js(this.r)}, ${Js(this.g)}, ${Js(this.b)}${t===1?")":`, ${t})`}`}function Ym(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Js(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qs(t){return t=Js(t),(t<16?"0":"")+t.toString(16)}function m7(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Sr(t,e,n,r)}function y7(t){if(t instanceof Sr)return new Sr(t.h,t.s,t.l,t.opacity);if(t instanceof Yr||(t=Pn(t)),!t)return new Sr;if(t instanceof Sr)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new Sr(s,a,c,t.opacity)}function ou(t,e,n,r){return arguments.length===1?y7(t):new Sr(t,e,n,r??1)}function Sr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Yo(Sr,ou,Li(Yr,{brighter(t){return t=t==null?Ks:Math.pow(Ks,t),new Sr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Di:Math.pow(Di,t),new Sr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new pe(uw(t>=240?t-240:t+120,o,r),uw(t,o,r),uw(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Sr(g7(this.h),zm(this.s),zm(this.l),Ym(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 t=Ym(this.opacity);return`${t===1?"hsl(":"hsla("}${g7(this.h)}, ${zm(this.s)*100}%, ${zm(this.l)*100}%${t===1?")":`, ${t})`}`}}));function g7(t){return t=(t||0)%360,t<0?t+360:t}function zm(t){return Math.max(0,Math.min(1,t||0))}function uw(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var Um=Math.PI/180,jm=180/Math.PI;var Xm=18,x7=.96422,b7=1,w7=.82521,v7=4/29,_c=6/29,_7=3*_c*_c,SB=_c*_c*_c;function S7(t){if(t instanceof Ur)return new Ur(t.l,t.a,t.b,t.opacity);if(t instanceof Uo)return M7(t);t instanceof pe||(t=ru(t));var e=mw(t.r),n=mw(t.g),r=mw(t.b),o=pw((.2225045*e+.7168786*n+.0606169*r)/b7),i,s;return e===n&&n===r?i=s=o:(i=pw((.4360747*e+.3850649*n+.1430804*r)/x7),s=pw((.0139322*e+.0971045*n+.7141733*r)/w7)),new Ur(116*o-16,500*(i-o),200*(o-s),t.opacity)}function Sc(t,e,n,r){return arguments.length===1?S7(t):new Ur(t,e,n,r??1)}function Ur(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}Yo(Ur,Sc,Li(Yr,{brighter(t){return new Ur(this.l+Xm*(t??1),this.a,this.b,this.opacity)},darker(t){return new Ur(this.l-Xm*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=x7*dw(e),t=b7*dw(t),n=w7*dw(n),new pe(hw(3.1338561*e-1.6168667*t-.4906146*n),hw(-.9787684*e+1.9161415*t+.033454*n),hw(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function pw(t){return t>SB?Math.pow(t,1/3):t/_7+v7}function dw(t){return t>_c?t*t*t:_7*(t-v7)}function hw(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function mw(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function MB(t){if(t instanceof Uo)return new Uo(t.h,t.c,t.l,t.opacity);if(t instanceof Ur||(t=S7(t)),t.a===0&&t.b===0)return new Uo(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*jm;return new Uo(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function iu(t,e,n,r){return arguments.length===1?MB(t):new Uo(t,e,n,r??1)}function Uo(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function M7(t){if(isNaN(t.h))return new Ur(t.l,0,0,t.opacity);var e=t.h*Um;return new Ur(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}Yo(Uo,iu,Li(Yr,{brighter(t){return new Uo(this.h,this.c,this.l+Xm*(t??1),this.opacity)},darker(t){return new Uo(this.h,this.c,this.l-Xm*(t??1),this.opacity)},rgb(){return M7(this).rgb()}}));var I7=-.14861,gw=1.78277,yw=-.29227,Gm=-.90649,su=1.97294,A7=su*Gm,T7=su*gw,E7=gw*yw-Gm*I7;function AB(t){if(t instanceof ta)return new ta(t.h,t.s,t.l,t.opacity);t instanceof pe||(t=ru(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(E7*r+A7*e-T7*n)/(E7+A7-T7),i=r-o,s=(su*(n-o)-yw*i)/Gm,a=Math.sqrt(s*s+i*i)/(su*o*(1-o)),c=a?Math.atan2(s,i)*jm-120:NaN;return new ta(c<0?c+360:c,a,o,t.opacity)}function pn(t,e,n,r){return arguments.length===1?AB(t):new ta(t,e,n,r??1)}function ta(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Yo(ta,pn,Li(Yr,{brighter(t){return t=t==null?Ks:Math.pow(Ks,t),new ta(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Di:Math.pow(Di,t),new ta(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Um,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new pe(255*(e+n*(I7*r+gw*o)),255*(e+n*(yw*r+Gm*o)),255*(e+n*(su*r)),this.opacity)}}));function xw(t,e,n,r,o){var i=t*t,s=i*t;return((1-3*t+3*i-s)*e+(4-6*i+3*s)*n+(1+3*t+3*i-3*s)*r+s*o)/6}function $7(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[r],i=t[r+1],s=r>0?t[r-1]:2*o-i,a=r<e-1?t[r+2]:2*i-o;return xw((n-r/e)*e,s,o,i,a)}}function C7(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return xw((n-r/e)*e,o,i,s,a)}}var Mc=t=>()=>t;function k7(t,e){return function(n){return t+n*e}}function TB(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Ac(t,e){var n=e-t;return n?k7(t,n>180||n<-180?n-360*Math.round(n/360):n):Mc(isNaN(t)?e:t)}function N7(t){return(t=+t)==1?Qt:function(e,n){return n-e?TB(e,n,t):Mc(isNaN(e)?n:e)}}function Qt(t,e){var n=e-t;return n?k7(t,n):Mc(isNaN(t)?e:t)}var rr=function t(e){var n=N7(e);function r(o,i){var s=n((o=ve(o)).r,(i=ve(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),f=Qt(o.opacity,i.opacity);return function(l){return o.r=s(l),o.g=a(l),o.b=c(l),o.opacity=f(l),o+""}}return r.gamma=t,r}(1);function O7(t){return function(e){var n=e.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=ve(e[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=t(r),o=t(o),i=t(i),a.opacity=1,function(c){return a.r=r(c),a.g=o(c),a.b=i(c),a+""}}}var bw=O7($7),EB=O7(C7);function R7(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function L7(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function D7(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=Fn(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function P7(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Ht(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function F7(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=Fn(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var vw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ww=new RegExp(vw.source,"g");function IB(t){return function(){return t}}function $B(t){return function(e){return t(e)+""}}function au(t,e){var n=vw.lastIndex=ww.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=vw.exec(t))&&(o=ww.exec(e));)(i=o.index)>n&&(i=e.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:Ht(r,o)})),n=ww.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?$B(c[0].x):IB(e):(e=c.length,function(f){for(var l=0,u;l<e;++l)a[(u=c[l]).i]=u.x(f);return a.join("")})}function Fn(t,e){var n=typeof e,r;return e==null||n==="boolean"?Mc(e):(n==="number"?Ht:n==="string"?(r=Pn(e))?(e=r,rr):au:e instanceof Pn?rr:e instanceof Date?P7:L7(e)?R7:Array.isArray(e)?D7:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?F7:Ht)(t,e)}function ea(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var q7=180/Math.PI,Vm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _w(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*q7,skewX:Math.atan(c)*q7,scaleX:s,scaleY:a}}var Wm;function B7(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Vm:_w(e.a,e.b,e.c,e.d,e.e,e.f)}function z7(t){return t==null?Vm:(Wm||(Wm=document.createElementNS("http://www.w3.org/2000/svg","g")),Wm.setAttribute("transform",t),(t=Wm.transform.baseVal.consolidate())?(t=t.matrix,_w(t.a,t.b,t.c,t.d,t.e,t.f)):Vm)}function Y7(t,e,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,l,u,p,d,h){if(f!==u||l!==p){var m=d.push("translate(",null,e,null,n);h.push({i:m-4,x:Ht(f,u)},{i:m-2,x:Ht(l,p)})}else(u||p)&&d.push("translate("+u+e+p+n)}function s(f,l,u,p){f!==l?(f-l>180?l+=360:l-f>180&&(f+=360),p.push({i:u.push(o(u)+"rotate(",null,r)-2,x:Ht(f,l)})):l&&u.push(o(u)+"rotate("+l+r)}function a(f,l,u,p){f!==l?p.push({i:u.push(o(u)+"skewX(",null,r)-2,x:Ht(f,l)}):l&&u.push(o(u)+"skewX("+l+r)}function c(f,l,u,p,d,h){if(f!==u||l!==p){var m=d.push(o(d)+"scale(",null,",",null,")");h.push({i:m-4,x:Ht(f,u)},{i:m-2,x:Ht(l,p)})}else(u!==1||p!==1)&&d.push(o(d)+"scale("+u+","+p+")")}return function(f,l){var u=[],p=[];return f=t(f),l=t(l),i(f.translateX,f.translateY,l.translateX,l.translateY,u,p),s(f.rotate,l.rotate,u,p),a(f.skewX,l.skewX,u,p),c(f.scaleX,f.scaleY,l.scaleX,l.scaleY,u,p),f=l=null,function(d){for(var h=-1,m=p.length,g;++h<m;)u[(g=p[h]).i]=g.x(d);return u.join("")}}}var Sw=Y7(B7,"px, ","px)","deg)"),Mw=Y7(z7,", ",")",")");var CB=1e-12;function U7(t){return((t=Math.exp(t))+1/t)/2}function kB(t){return((t=Math.exp(t))-1/t)/2}function NB(t){return((t=Math.exp(2*t))-1)/(t+1)}var Aw=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],f=i[2],l=s[0],u=s[1],p=s[2],d=l-a,h=u-c,m=d*d+h*h,g,y;if(m<CB)y=Math.log(p/f)/e,g=function(A){return[a+A*d,c+A*h,f*Math.exp(e*A*y)]};else{var x=Math.sqrt(m),b=(p*p-f*f+r*m)/(2*f*n*x),w=(p*p-f*f-r*m)/(2*p*n*x),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);y=(v-_)/e,g=function(A){var E=A*y,T=U7(_),$=f/(n*x)*(T*NB(e*E+_)-kB(_));return[a+$*d,c+$*h,f*T/U7(e*E+_)]}}return g.duration=y*1e3*e/Math.SQRT2,g}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);function j7(t){return function(e,n){var r=t((e=ou(e)).h,(n=ou(n)).h),o=Qt(e.s,n.s),i=Qt(e.l,n.l),s=Qt(e.opacity,n.opacity);return function(a){return e.h=r(a),e.s=o(a),e.l=i(a),e.opacity=s(a),e+""}}}var Tw=j7(Ac),OB=j7(Qt);function Hm(t,e){var n=Qt((t=Sc(t)).l,(e=Sc(e)).l),r=Qt(t.a,e.a),o=Qt(t.b,e.b),i=Qt(t.opacity,e.opacity);return function(s){return t.l=n(s),t.a=r(s),t.b=o(s),t.opacity=i(s),t+""}}function X7(t){return function(e,n){var r=t((e=iu(e)).h,(n=iu(n)).h),o=Qt(e.c,n.c),i=Qt(e.l,n.l),s=Qt(e.opacity,n.opacity);return function(a){return e.h=r(a),e.c=o(a),e.l=i(a),e.opacity=s(a),e+""}}}var Ew=X7(Ac),RB=X7(Qt);function G7(t){return function e(n){n=+n;function r(o,i){var s=t((o=pn(o)).h,(i=pn(i)).h),a=Qt(o.s,i.s),c=Qt(o.l,i.l),f=Qt(o.opacity,i.opacity);return function(l){return o.h=s(l),o.s=a(l),o.l=c(Math.pow(l,n)),o.opacity=f(l),o+""}}return r.gamma=e,r}(1)}var LB=G7(Ac),Tc=G7(Qt);function jr(t,e){e===void 0&&(e=t,t=Fn);for(var n=0,r=e.length-1,o=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(o,o=e[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return i[a](s-a)}}function Ze(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}var Ec=0,fu=0,cu=0,W7=1e3,Zm,lu,Qm=0,na=0,Jm=0,uu=typeof performance=="object"&&performance.now?performance:Date,H7=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function du(){return na||(H7(DB),na=uu.now()+Jm)}function DB(){na=0}function pu(){this._call=this._time=this._next=null}pu.prototype=Km.prototype={constructor:pu,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?du():+n)+(e==null?0:+e),!this._next&&lu!==this&&(lu?lu._next=this:Zm=this,lu=this),this._call=t,this._time=n,Iw()},stop:function(){this._call&&(this._call=null,this._time=1/0,Iw())}};function Km(t,e,n){var r=new pu;return r.restart(t,e,n),r}function Z7(){du(),++Ec;for(var t=Zm,e;t;)(e=na-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ec}function V7(){na=(Qm=uu.now())+Jm,Ec=fu=0;try{Z7()}finally{Ec=0,FB(),na=0}}function PB(){var t=uu.now(),e=t-Qm;e>W7&&(Jm-=e,Qm=t)}function FB(){for(var t,e=Zm,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Zm=n);lu=t,Iw(r)}function Iw(t){if(!Ec){fu&&(fu=clearTimeout(fu));var e=t-na;e>24?(t<1/0&&(fu=setTimeout(V7,t-uu.now()-Jm)),cu&&(cu=clearInterval(cu))):(cu||(Qm=uu.now(),cu=setInterval(PB,W7)),Ec=1,H7(V7))}}function t0(t,e,n){var r=new pu;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var qB=Hs("start","end","cancel","interrupt"),BB=[],K7=0,Q7=1,n0=2,e0=3,J7=4,r0=5,hu=6;function Pi(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;zB(t,n,{name:e,index:r,group:o,on:qB,tween:BB,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:K7})}function mu(t,e){var n=_e(t,e);if(n.state>K7)throw new Error("too late; already scheduled");return n}function je(t,e){var n=_e(t,e);if(n.state>e0)throw new Error("too late; already running");return n}function _e(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function zB(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Km(i,0,n.time);function i(f){n.state=Q7,n.timer.restart(s,n.delay,n.time),n.delay<=f&&s(f-n.delay)}function s(f){var l,u,p,d;if(n.state!==Q7)return c();for(l in r)if(d=r[l],d.name===n.name){if(d.state===e0)return t0(s);d.state===J7?(d.state=hu,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[l]):+l<e&&(d.state=hu,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[l])}if(t0(function(){n.state===e0&&(n.state=J7,n.timer.restart(a,n.delay,n.time),a(f))}),n.state=n0,n.on.call("start",t,t.__data__,n.index,n.group),n.state===n0){for(n.state=e0,o=new Array(p=n.tween.length),l=0,u=-1;l<p;++l)(d=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(o[++u]=d);o.length=u+1}}function a(f){for(var l=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(c),n.state=r0,1),u=-1,p=o.length;++u<p;)o[u].call(t,l);n.state===r0&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=hu,n.timer.stop(),delete r[e];for(var f in r)return;delete t.__transition}}function Xr(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>n0&&r.state<r0,r.state=hu,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function tI(t){return this.each(function(){Xr(this,t)})}function YB(t,e){var n,r;return function(){var o=je(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function UB(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=je(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},c=0,f=o.length;c<f;++c)if(o[c].name===e){o[c]=a;break}c===f&&o.push(a)}i.tween=o}}function eI(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=_e(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?YB:UB)(n,t,e))}function Ic(t,e,n){var r=t._id;return t.each(function(){var o=je(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return _e(o,r).value[e]}}function o0(t,e){var n;return(typeof e=="number"?Ht:e instanceof Pn?rr:(n=Pn(e))?(e=n,rr):au)(t,e)}function jB(t){return function(){this.removeAttribute(t)}}function XB(t){return function(){this.removeAttributeNS(t.space,t.local)}}function GB(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function VB(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function WB(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function HB(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function nI(t,e){var n=qo(t),r=n==="transform"?Mw:o0;return this.attrTween(t,typeof e=="function"?(n.local?HB:WB)(n,r,Ic(this,"attr."+t,e)):e==null?(n.local?XB:jB)(n):(n.local?VB:GB)(n,r,e))}function ZB(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function QB(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function JB(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&QB(t,i)),n}return o._value=e,o}function KB(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&ZB(t,i)),n}return o._value=e,o}function rI(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=qo(t);return this.tween(n,(r.local?JB:KB)(r,e))}function tz(t,e){return function(){mu(this,t).delay=+e.apply(this,arguments)}}function ez(t,e){return e=+e,function(){mu(this,t).delay=e}}function oI(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?tz:ez)(e,t)):_e(this.node(),e).delay}function nz(t,e){return function(){je(this,t).duration=+e.apply(this,arguments)}}function rz(t,e){return e=+e,function(){je(this,t).duration=e}}function iI(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?nz:rz)(e,t)):_e(this.node(),e).duration}function oz(t,e){if(typeof e!="function")throw new Error;return function(){je(this,t).ease=e}}function sI(t){var e=this._id;return arguments.length?this.each(oz(e,t)):_e(this.node(),e).ease}function iz(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;je(this,t).ease=n}}function aI(t){if(typeof t!="function")throw new Error;return this.each(iz(this._id,t))}function cI(t){typeof t!="function"&&(t=Jl(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,f=0;f<s;++f)(c=i[f])&&t.call(c,c.__data__,f,i)&&a.push(c);return new dn(r,this._parents,this._name,this._id)}function fI(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=e[a],f=n[a],l=c.length,u=s[a]=new Array(l),p,d=0;d<l;++d)(p=c[d]||f[d])&&(u[d]=p);for(;a<r;++a)s[a]=e[a];return new dn(s,this._parents,this._name,this._id)}function sz(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function az(t,e,n){var r,o,i=sz(e)?mu:je;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function lI(t,e){var n=this._id;return arguments.length<2?_e(this.node(),n).on.on(t):this.each(az(n,t,e))}function cz(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function uI(){return this.on("end.remove",cz(this._id))}function pI(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Zs(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,f=i[s]=new Array(c),l,u,p=0;p<c;++p)(l=a[p])&&(u=t.call(l,l.__data__,p,a))&&("__data__"in l&&(u.__data__=l.__data__),f[p]=u,Pi(f[p],e,n,p,f,_e(l,n)));return new dn(i,this._parents,e,n)}function dI(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ql(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],f=c.length,l,u=0;u<f;++u)if(l=c[u]){for(var p=t.call(l,l.__data__,u,c),d,h=_e(l,n),m=0,g=p.length;m<g;++m)(d=p[m])&&Pi(d,e,n,m,p,h);i.push(p),s.push(l)}return new dn(i,s,e,n)}var fz=zo.prototype.constructor;function hI(){return new fz(this._groups,this._parents)}function lz(t,e){var n,r,o;return function(){var i=Ri(this,t),s=(this.style.removeProperty(t),Ri(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function mI(t){return function(){this.style.removeProperty(t)}}function uz(t,e,n){var r,o=n+"",i;return function(){var s=Ri(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function pz(t,e,n){var r,o,i;return function(){var s=Ri(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ri(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function dz(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=je(this,t),f=c.on,l=c.value[i]==null?a||(a=mI(e)):void 0;(f!==n||o!==l)&&(r=(n=f).copy()).on(s,o=l),c.on=r}}function gI(t,e,n){var r=(t+="")=="transform"?Sw:o0;return e==null?this.styleTween(t,lz(t,r)).on("end.style."+t,mI(t)):typeof e=="function"?this.styleTween(t,pz(t,r,Ic(this,"style."+t,e))).each(dz(this._id,t)):this.styleTween(t,uz(t,r,e),n).on("end.style."+t,null)}function hz(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function mz(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&hz(t,s,n)),r}return i._value=e,i}function yI(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,mz(t,e,n??""))}function gz(t){return function(){this.textContent=t}}function yz(t){return function(){var e=t(this);this.textContent=e??""}}function xI(t){return this.tween("text",typeof t=="function"?yz(Ic(this,"text",t)):gz(t==null?"":t+""))}function xz(t){return function(e){this.textContent=t.call(this,e)}}function bz(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&xz(o)),e}return r._value=t,r}function bI(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,bz(t))}function wI(){for(var t=this._name,e=this._id,n=i0(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,f=0;f<a;++f)if(c=s[f]){var l=_e(c,e);Pi(c,t,n,f,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new dn(r,this._parents,t,n)}function vI(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var f=je(this,r),l=f.on;l!==t&&(e=(t=l).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),f.on=e}),o===0&&i()})}var wz=0;function dn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function _I(t){return zo().transition(t)}function i0(){return++wz}var jo=zo.prototype;dn.prototype=_I.prototype={constructor:dn,select:pI,selectAll:dI,selectChild:jo.selectChild,selectChildren:jo.selectChildren,filter:cI,merge:fI,selection:hI,transition:wI,call:jo.call,nodes:jo.nodes,node:jo.node,size:jo.size,empty:jo.empty,each:jo.each,on:lI,attr:nI,attrTween:rI,style:gI,styleTween:yI,text:xI,textTween:bI,remove:uI,tween:eI,delay:oI,duration:iI,ease:sI,easeVarying:aI,end:vI,[Symbol.iterator]:jo[Symbol.iterator]};function s0(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var vz={time:null,delay:0,duration:250,ease:s0};function _z(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function SI(t){var e,n;t instanceof dn?(e=t._id,t=t._name):(e=i0(),(n=vz).time=du(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&Pi(c,t,e,f,s,n||_z(c,e));return new dn(r,this._parents,t,e)}zo.prototype.interrupt=tI;zo.prototype.transition=SI;var a0=t=>()=>t;function $w(t,{sourceEvent:e,target:n,selection:r,mode:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function MI(t){t.stopImmediatePropagation()}function c0(t){t.preventDefault(),t.stopImmediatePropagation()}var AI={name:"drag"},Cw={name:"space"},$c={name:"handle"},Cc={name:"center"},{abs:TI,max:Qe,min:Je}=Math;function EI(t){return[+t[0],+t[1]]}function Nw(t){return[EI(t[0]),EI(t[1])]}var f0={name:"x",handles:["w","e"].map(gu),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},l0={name:"y",handles:["n","s"].map(gu),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Sz={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(gu),input:function(t){return t==null?null:Nw(t)},output:function(t){return t}},Xo={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"},II={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},$I={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Mz={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Az={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function gu(t){return{type:t}}function Tz(t){return!t.ctrlKey&&!t.button}function Ez(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Iz(){return navigator.maxTouchPoints||"ontouchstart"in this}function kw(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function $z(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Ow(){return Dw(f0)}function Rw(){return Dw(l0)}function Lw(){return Dw(Sz)}function Dw(t){var e=Ez,n=Tz,r=Iz,o=!0,i=Hs("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([gu("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Xo.overlay).merge(y).each(function(){var b=kw(this).extent;St(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),g.selectAll(".selection").data([gu("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Xo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=g.selectAll(".handle").data(t.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return Xo[b.type]}),g.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",p).filter(r).on("touchstart.brush",p).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",h).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,y,x){g.tween?g.on("start.brush",function(b){l(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){l(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,_=l(b,arguments),v=w.selection,A=t.input(typeof y=="function"?y.apply(this,arguments):y,w.extent),E=Fn(v,A);function T($){w.selection=$===1&&A===null?null:E($),f.call(b),_.brush()}return v!==null&&A!==null?T:T(1)}):g.each(function(){var b=this,w=arguments,_=b.__brush,v=t.input(typeof y=="function"?y.apply(b,w):y,_.extent),A=l(b,w).beforestart();Xr(b),_.selection=v===null?null:v,f.call(b),A.start(x).brush(x).end(x)})},c.clear=function(g,y){c.move(g,null,y)};function f(){var g=St(this),y=kw(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(x){return x.type[x.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.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 l(g,y,x){var b=g.__brush.emitter;return b&&(!x||!b.clean)?b:new u(g,y,x)}function u(g,y,x){this.that=g,this.args=y,this.state=g.__brush,this.active=0,this.clean=x}u.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,x){var b=St(this.that).datum();i.call(g,this.that,new $w(g,{sourceEvent:y,target:c,selection:t.output(this.state.selection),mode:x,dispatch:i}),b)}};function p(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,x=g.target.__data__.type,b=(o&&g.metaKey?x="overlay":x)==="selection"?AI:o&&g.altKey?Cc:$c,w=t===l0?null:Mz[x],_=t===f0?null:Az[x],v=kw(y),A=v.extent,E=v.selection,T=A[0][0],$,M,k=A[0][1],R,S,I=A[1][0],C,N,D=A[1][1],L,P,F=0,q=0,W,tt=w&&_&&o&&g.shiftKey,nt,ot,X=Array.from(g.touches||[g],J=>{let qt=J.identifier;return J=He(J,y),J.point0=J.slice(),J.identifier=qt,J});Xr(y);var rt=l(y,arguments,!0).beforestart();if(x==="overlay"){E&&(W=!0);let J=[X[0],X[1]||X[0]];v.selection=E=[[$=t===l0?T:Je(J[0][0],J[1][0]),R=t===f0?k:Je(J[0][1],J[1][1])],[C=t===l0?I:Qe(J[0][0],J[1][0]),L=t===f0?D:Qe(J[0][1],J[1][1])]],X.length>1&&wt(g)}else $=E[0][0],R=E[0][1],C=E[1][0],L=E[1][1];M=$,S=R,N=C,P=L;var Y=St(y).attr("pointer-events","none"),H=Y.selectAll(".overlay").attr("cursor",Xo[x]);if(g.touches)rt.moved=B,rt.ended=ct;else{var et=St(g.view).on("mousemove.brush",B,!0).on("mouseup.brush",ct,!0);o&&et.on("keydown.brush",It,!0).on("keyup.brush",kt,!0),tu(g.view)}f.call(y),rt.start(g,b.name);function B(J){for(let qt of J.changedTouches||[J])for(let Nn of X)Nn.identifier===qt.identifier&&(Nn.cur=He(qt,y));if(tt&&!nt&&!ot&&X.length===1){let qt=X[0];TI(qt.cur[0]-qt[0])>TI(qt.cur[1]-qt[1])?ot=!0:nt=!0}for(let qt of X)qt.cur&&(qt[0]=qt.cur[0],qt[1]=qt.cur[1]);W=!0,c0(J),wt(J)}function wt(J){let qt=X[0],Nn=qt.point0;var kr;switch(F=qt[0]-Nn[0],q=qt[1]-Nn[1],b){case Cw:case AI:{w&&(F=Qe(T-$,Je(I-C,F)),M=$+F,N=C+F),_&&(q=Qe(k-R,Je(D-L,q)),S=R+q,P=L+q);break}case $c:{X[1]?(w&&(M=Qe(T,Je(I,X[0][0])),N=Qe(T,Je(I,X[1][0])),w=1),_&&(S=Qe(k,Je(D,X[0][1])),P=Qe(k,Je(D,X[1][1])),_=1)):(w<0?(F=Qe(T-$,Je(I-$,F)),M=$+F,N=C):w>0&&(F=Qe(T-C,Je(I-C,F)),M=$,N=C+F),_<0?(q=Qe(k-R,Je(D-R,q)),S=R+q,P=L):_>0&&(q=Qe(k-L,Je(D-L,q)),S=R,P=L+q));break}case Cc:{w&&(M=Qe(T,Je(I,$-F*w)),N=Qe(T,Je(I,C+F*w))),_&&(S=Qe(k,Je(D,R-q*_)),P=Qe(k,Je(D,L+q*_)));break}}N<M&&(w*=-1,kr=$,$=C,C=kr,kr=M,M=N,N=kr,x in II&&H.attr("cursor",Xo[x=II[x]])),P<S&&(_*=-1,kr=R,R=L,L=kr,kr=S,S=P,P=kr,x in $I&&H.attr("cursor",Xo[x=$I[x]])),v.selection&&(E=v.selection),nt&&(M=E[0][0],N=E[1][0]),ot&&(S=E[0][1],P=E[1][1]),(E[0][0]!==M||E[0][1]!==S||E[1][0]!==N||E[1][1]!==P)&&(v.selection=[[M,S],[N,P]],f.call(y),rt.brush(J,b.name))}function ct(J){if(MI(J),J.touches){if(J.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else eu(J.view,W),et.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Y.attr("pointer-events","all"),H.attr("cursor",Xo.overlay),v.selection&&(E=v.selection),$z(E)&&(v.selection=null,f.call(y)),rt.end(J,b.name)}function It(J){switch(J.keyCode){case 16:{tt=w&&_;break}case 18:{b===$c&&(w&&(C=N-F*w,$=M+F*w),_&&(L=P-q*_,R=S+q*_),b=Cc,wt(J));break}case 32:{(b===$c||b===Cc)&&(w<0?C=N-F:w>0&&($=M-F),_<0?L=P-q:_>0&&(R=S-q),b=Cw,H.attr("cursor",Xo.selection),wt(J));break}default:return}c0(J)}function kt(J){switch(J.keyCode){case 16:{tt&&(nt=ot=tt=!1,wt(J));break}case 18:{b===Cc&&(w<0?C=N:w>0&&($=M),_<0?L=P:_>0&&(R=S),b=$c,wt(J));break}case 32:{b===Cw&&(J.altKey?(w&&(C=N-F*w,$=M+F*w),_&&(L=P-q*_,R=S+q*_),b=Cc):(w<0?C=N:w>0&&($=M),_<0?L=P:_>0&&(R=S),b=$c),H.attr("cursor",Xo[x]),wt(J));break}default:return}c0(J)}}function d(g){l(this,arguments).moved(g)}function h(g){l(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=Nw(e.apply(this,arguments)),g.dim=t,g}return c.extent=function(g){return arguments.length?(e=typeof g=="function"?g:a0(Nw(g)),c):e},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:a0(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:a0(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(o=!!g,c):o},c.on=function(){var g=i.on.apply(i,arguments);return g===i?c:g},c}var Pw=Math.PI,Fw=2*Pw,ra=1e-6,Cz=Fw-ra;function CI(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function kz(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return CI;let n=10**e;return function(r){this._+=r[0];for(let o=1,i=r.length;o<i;++o)this._+=Math.round(arguments[o]*n)/n+r[o]}}var Fi=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?CI:kz(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,o){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+o}`}bezierCurveTo(e,n,r,o,i,s){this._append`C${+e},${+n},${+r},${+o},${this._x1=+i},${this._y1=+s}`}arcTo(e,n,r,o,i){if(e=+e,n=+n,r=+r,o=+o,i=+i,i<0)throw new Error(`negative radius: ${i}`);let s=this._x1,a=this._y1,c=r-e,f=o-n,l=s-e,u=a-n,p=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>ra)if(!(Math.abs(u*c-f*l)>ra)||!i)this._append`L${this._x1=e},${this._y1=n}`;else{let d=r-s,h=o-a,m=c*c+f*f,g=d*d+h*h,y=Math.sqrt(m),x=Math.sqrt(p),b=i*Math.tan((Pw-Math.acos((m+p-g)/(2*y*x)))/2),w=b/x,_=b/y;Math.abs(w-1)>ra&&this._append`L${e+w*l},${n+w*u}`,this._append`A${i},${i},0,0,${+(u*d>l*h)},${this._x1=e+_*c},${this._y1=n+_*f}`}}arc(e,n,r,o,i,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(o),c=r*Math.sin(o),f=e+a,l=n+c,u=1^s,p=s?o-i:i-o;this._x1===null?this._append`M${f},${l}`:(Math.abs(this._x1-f)>ra||Math.abs(this._y1-l)>ra)&&this._append`L${f},${l}`,r&&(p<0&&(p=p%Fw+Fw),p>Cz?this._append`A${r},${r},0,1,${u},${e-a},${n-c}A${r},${r},0,1,${u},${this._x1=f},${this._y1=l}`:p>ra&&this._append`A${r},${r},0,${+(p>=Pw)},${u},${this._x1=e+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(e,n,r,o){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+o}h${-r}Z`}toString(){return this._}};function kI(){return new Fi}kI.prototype=Fi.prototype;function hn(t=3){return new Fi(+t)}var Nz=Array.prototype,u0=Nz.slice;function NI(t,e){return t-e}function OI(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}var Gr=t=>()=>t;function RI(t,e){for(var n=-1,r=e.length,o;++n<r;)if(o=Oz(t,e[n]))return o;return 0}function Oz(t,e){for(var n=e[0],r=e[1],o=-1,i=0,s=t.length,a=s-1;i<s;a=i++){var c=t[i],f=c[0],l=c[1],u=t[a],p=u[0],d=u[1];if(Rz(c,u,e))return 0;l>r!=d>r&&n<(p-f)*(r-l)/(d-l)+f&&(o=-o)}return o}function Rz(t,e,n){var r;return Lz(t,e,n)&&Dz(t[r=+(t[0]===e[0])],n[r],e[r])}function Lz(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}function Dz(t,e,n){return t<=e&&e<=n||n<=e&&e<=t}function LI(){}var Go=[[],[[[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 qi(){var t=1,e=1,n=Ni,r=c;function o(f){var l=n(f);if(Array.isArray(l))l=l.slice().sort(NI);else{let u=Rt(f,Pz);for(l=Ye(...xc(u[0],u[1],l),l);l[l.length-1]>=u[1];)l.pop();for(;l[1]<u[0];)l.shift()}return l.map(u=>i(f,u))}function i(f,l){let u=l==null?NaN:+l;if(isNaN(u))throw new Error(`invalid value: ${l}`);var p=[],d=[];return s(f,u,function(h){r(h,f,u),OI(h)>0?p.push([h]):d.push(h)}),d.forEach(function(h){for(var m=0,g=p.length,y;m<g;++m)if(RI((y=p[m])[0],h)!==-1){y.push(h);return}}),{type:"MultiPolygon",value:l,coordinates:p}}function s(f,l,u){var p=new Array,d=new Array,h,m,g,y,x,b;for(h=m=-1,y=oa(f[0],l),Go[y<<1].forEach(w);++h<t-1;)g=y,y=oa(f[h+1],l),Go[g|y<<1].forEach(w);for(Go[y<<0].forEach(w);++m<e-1;){for(h=-1,y=oa(f[m*t+t],l),x=oa(f[m*t],l),Go[y<<1|x<<2].forEach(w);++h<t-1;)g=y,y=oa(f[m*t+t+h+1],l),b=x,x=oa(f[m*t+h+1],l),Go[g|y<<1|x<<2|b<<3].forEach(w);Go[y|x<<3].forEach(w)}for(h=-1,x=f[m*t]>=l,Go[x<<2].forEach(w);++h<t-1;)b=x,x=oa(f[m*t+h+1],l),Go[x<<2|b<<3].forEach(w);Go[x<<3].forEach(w);function w(_){var v=[_[0][0]+h,_[0][1]+m],A=[_[1][0]+h,_[1][1]+m],E=a(v),T=a(A),$,M;($=d[E])?(M=p[T])?(delete d[$.end],delete p[M.start],$===M?($.ring.push(A),u($.ring)):p[$.start]=d[M.end]={start:$.start,end:M.end,ring:$.ring.concat(M.ring)}):(delete d[$.end],$.ring.push(A),d[$.end=T]=$):($=p[T])?(M=d[E])?(delete p[$.start],delete d[M.end],$===M?($.ring.push(A),u($.ring)):p[M.start]=d[$.end]={start:M.start,end:$.end,ring:M.ring.concat($.ring)}):(delete p[$.start],$.ring.unshift(v),p[$.start=E]=$):p[E]=d[T]={start:E,end:T,ring:[v,A]}}}function a(f){return f[0]*2+f[1]*(t+1)*4}function c(f,l,u){f.forEach(function(p){var d=p[0],h=p[1],m=d|0,g=h|0,y=qw(l[g*t+m]);d>0&&d<t&&m===d&&(p[0]=DI(d,qw(l[g*t+m-1]),y,u)),h>0&&h<e&&g===h&&(p[1]=DI(h,qw(l[(g-1)*t+m]),y,u))})}return o.contour=i,o.size=function(f){if(!arguments.length)return[t,e];var l=Math.floor(f[0]),u=Math.floor(f[1]);if(!(l>=0&&u>=0))throw new Error("invalid size");return t=l,e=u,o},o.thresholds=function(f){return arguments.length?(n=typeof f=="function"?f:Array.isArray(f)?Gr(u0.call(f)):Gr(f),o):n},o.smooth=function(f){return arguments.length?(r=f?c:LI,o):r===c},o}function Pz(t){return isFinite(t)?t:NaN}function oa(t,e){return t==null?!1:+t>=e}function qw(t){return t==null||isNaN(t=+t)?-1/0:t}function DI(t,e,n,r){let o=r-e,i=n-e,s=isFinite(o)||isFinite(i)?o/i:Math.sign(o)/Math.sign(i);return isNaN(s)?t:t+s-.5}function Fz(t){return t[0]}function qz(t){return t[1]}function Bz(){return 1}function Bw(){var t=Fz,e=qz,n=Bz,r=960,o=500,i=20,s=2,a=i*3,c=r+a*2>>s,f=o+a*2>>s,l=Gr(20);function u(x){var b=new Float32Array(c*f),w=Math.pow(2,-s),_=-1;for(let R of x){var v=(t(R,++_,x)+a)*w,A=(e(R,_,x)+a)*w,E=+n(R,_,x);if(E&&v>=0&&v<c&&A>=0&&A<f){var T=Math.floor(v),$=Math.floor(A),M=v-T-.5,k=A-$-.5;b[T+$*c]+=(1-M)*(1-k)*E,b[T+1+$*c]+=M*(1-k)*E,b[T+1+($+1)*c]+=M*k*E,b[T+($+1)*c]+=(1-M)*k*E}}return Xl({data:b,width:c,height:f},i*w),b}function p(x){var b=u(x),w=l(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=Ye(Number.MIN_VALUE,Ct(b)/_,w)),qi().size([c,f]).thresholds(w.map(v=>v*_))(b).map((v,A)=>(v.value=+w[A],d(v)))}p.contours=function(x){var b=u(x),w=qi().size([c,f]),_=Math.pow(2,2*s),v=A=>{A=+A;var E=d(w.contour(b,A*_));return E.value=A,E};return Object.defineProperty(v,"max",{get:()=>Ct(b)/_}),v};function d(x){return x.coordinates.forEach(h),x}function h(x){x.forEach(m)}function m(x){x.forEach(g)}function g(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function y(){return a=i*3,c=r+a*2>>s,f=o+a*2>>s,p}return p.x=function(x){return arguments.length?(t=typeof x=="function"?x:Gr(+x),p):t},p.y=function(x){return arguments.length?(e=typeof x=="function"?x:Gr(+x),p):e},p.weight=function(x){return arguments.length?(n=typeof x=="function"?x:Gr(+x),p):n},p.size=function(x){if(!arguments.length)return[r,o];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,o=w,y()},p.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),y()},p.thresholds=function(x){return arguments.length?(l=typeof x=="function"?x:Array.isArray(x)?Gr(u0.call(x)):Gr(x),p):l},p.bandwidth=function(x){if(!arguments.length)return Math.sqrt(i*(i+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return i=(Math.sqrt(4*x*x+1)-1)/2,y()},p}var Nt=11102230246251565e-32,de=134217729,yu=(3+8*Nt)*Nt;function ia(t,e,n,r,o){let i,s,a,c,f=e[0],l=r[0],u=0,p=0;l>f==l>-f?(i=f,f=e[++u]):(i=l,l=r[++p]);let d=0;if(u<t&&p<n)for(l>f==l>-f?(s=f+i,a=i-(s-f),f=e[++u]):(s=l+i,a=i-(s-l),l=r[++p]),i=s,a!==0&&(o[d++]=a);u<t&&p<n;)l>f==l>-f?(s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++u]):(s=i+l,c=s-i,a=i-(s-c)+(l-c),l=r[++p]),i=s,a!==0&&(o[d++]=a);for(;u<t;)s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++u],i=s,a!==0&&(o[d++]=a);for(;p<n;)s=i+l,c=s-i,a=i-(s-c)+(l-c),l=r[++p],i=s,a!==0&&(o[d++]=a);return(i!==0||d===0)&&(o[d++]=i),d}function xu(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function j(t){return new Float64Array(t)}var zz=(3+16*Nt)*Nt,Yz=(2+12*Nt)*Nt,Uz=(9+64*Nt)*Nt*Nt,kc=j(4),PI=j(8),FI=j(12),qI=j(16),mn=j(4);function jz(t,e,n,r,o,i,s){let a,c,f,l,u,p,d,h,m,g,y,x,b,w,_,v,A,E,T=t-o,$=n-o,M=e-i,k=r-i;w=T*k,p=de*T,d=p-(p-T),h=T-d,p=de*k,m=p-(p-k),g=k-m,_=h*g-(w-d*m-h*m-d*g),v=M*$,p=de*M,d=p-(p-M),h=M-d,p=de*$,m=p-(p-$),g=$-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,kc[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,kc[1]=b-(y+u)+(u-v),E=x+y,u=E-x,kc[2]=x-(E-u)+(y-u),kc[3]=E;let R=xu(4,kc),S=Yz*s;if(R>=S||-R>=S||(u=t-T,a=t-(T+u)+(u-o),u=n-$,f=n-($+u)+(u-o),u=e-M,c=e-(M+u)+(u-i),u=r-k,l=r-(k+u)+(u-i),a===0&&c===0&&f===0&&l===0)||(S=Uz*s+yu*Math.abs(R),R+=T*l+k*a-(M*f+$*c),R>=S||-R>=S))return R;w=a*k,p=de*a,d=p-(p-a),h=a-d,p=de*k,m=p-(p-k),g=k-m,_=h*g-(w-d*m-h*m-d*g),v=c*$,p=de*c,d=p-(p-c),h=c-d,p=de*$,m=p-(p-$),g=$-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,mn[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,mn[1]=b-(y+u)+(u-v),E=x+y,u=E-x,mn[2]=x-(E-u)+(y-u),mn[3]=E;let I=ia(4,kc,4,mn,PI);w=T*l,p=de*T,d=p-(p-T),h=T-d,p=de*l,m=p-(p-l),g=l-m,_=h*g-(w-d*m-h*m-d*g),v=M*f,p=de*M,d=p-(p-M),h=M-d,p=de*f,m=p-(p-f),g=f-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,mn[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,mn[1]=b-(y+u)+(u-v),E=x+y,u=E-x,mn[2]=x-(E-u)+(y-u),mn[3]=E;let C=ia(I,PI,4,mn,FI);w=a*l,p=de*a,d=p-(p-a),h=a-d,p=de*l,m=p-(p-l),g=l-m,_=h*g-(w-d*m-h*m-d*g),v=c*f,p=de*c,d=p-(p-c),h=c-d,p=de*f,m=p-(p-f),g=f-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,mn[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,mn[1]=b-(y+u)+(u-v),E=x+y,u=E-x,mn[2]=x-(E-u)+(y-u),mn[3]=E;let N=ia(C,FI,4,mn,qI);return qI[N-1]}function Nc(t,e,n,r,o,i){let s=(e-i)*(n-o),a=(t-o)*(r-i),c=s-a,f=Math.abs(s+a);return Math.abs(c)>=zz*f?c:-jz(t,e,n,r,o,i,f)}var Iht=(7+56*Nt)*Nt,$ht=(3+28*Nt)*Nt,Cht=(26+288*Nt)*Nt*Nt,kht=j(4),Nht=j(4),Oht=j(4),Rht=j(4),Lht=j(4),Dht=j(4),Pht=j(4),Fht=j(4),qht=j(4),Bht=j(8),zht=j(8),Yht=j(8),Uht=j(4),jht=j(8),Xht=j(8),Ght=j(8),Vht=j(12),Wht=j(192),Hht=j(192);var Jht=(10+96*Nt)*Nt,Kht=(4+48*Nt)*Nt,tmt=(44+576*Nt)*Nt*Nt,emt=j(4),nmt=j(4),rmt=j(4),omt=j(4),imt=j(4),smt=j(4),amt=j(4),cmt=j(4),fmt=j(8),lmt=j(8),umt=j(8),pmt=j(8),dmt=j(8),hmt=j(8),mmt=j(8),gmt=j(8),ymt=j(8),xmt=j(4),bmt=j(4),wmt=j(4),vmt=j(8),_mt=j(16),Smt=j(16),Mmt=j(16),Amt=j(32),Tmt=j(32),Emt=j(48),Imt=j(64),$mt=j(1152),Cmt=j(1152);var Rmt=(16+224*Nt)*Nt,Lmt=(5+72*Nt)*Nt,Dmt=(71+1408*Nt)*Nt*Nt,Pmt=j(4),Fmt=j(4),qmt=j(4),Bmt=j(4),zmt=j(4),Ymt=j(4),Umt=j(4),jmt=j(4),Xmt=j(4),Gmt=j(4),Vmt=j(24),Wmt=j(24),Hmt=j(24),Zmt=j(24),Qmt=j(24),Jmt=j(24),Kmt=j(24),t0t=j(24),e0t=j(24),n0t=j(24),r0t=j(1152),o0t=j(1152),i0t=j(1152),s0t=j(1152),a0t=j(1152),c0t=j(2304),f0t=j(2304),l0t=j(3456),u0t=j(5760),p0t=j(8),d0t=j(8),h0t=j(8),m0t=j(16),g0t=j(24),y0t=j(48),x0t=j(48),b0t=j(96),w0t=j(192),v0t=j(384),_0t=j(384),S0t=j(384),M0t=j(768);var A0t=j(96),T0t=j(96),E0t=j(96),I0t=j(1152);var zI=Math.pow(2,-52),p0=new Uint32Array(512),Rc=class t{static from(e,n=Zz,r=Qz){let o=e.length,i=new Float64Array(o*2);for(let s=0;s<o;s++){let a=e[s];i[2*s]=n(a),i[2*s+1]=r(a)}return new t(i)}constructor(e){let n=e.length>>1;if(n>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;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),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:e,_hullPrev:n,_hullNext:r,_hullTri:o,_hullHash:i}=this,s=e.length>>1,a=1/0,c=1/0,f=-1/0,l=-1/0;for(let T=0;T<s;T++){let $=e[2*T],M=e[2*T+1];$<a&&(a=$),M<c&&(c=M),$>f&&(f=$),M>l&&(l=M),this._ids[T]=T}let u=(a+f)/2,p=(c+l)/2,d,h,m;for(let T=0,$=1/0;T<s;T++){let M=zw(u,p,e[2*T],e[2*T+1]);M<$&&(d=T,$=M)}let g=e[2*d],y=e[2*d+1];for(let T=0,$=1/0;T<s;T++){if(T===d)continue;let M=zw(g,y,e[2*T],e[2*T+1]);M<$&&M>0&&(h=T,$=M)}let x=e[2*h],b=e[2*h+1],w=1/0;for(let T=0;T<s;T++){if(T===d||T===h)continue;let $=Wz(g,y,x,b,e[2*T],e[2*T+1]);$<w&&(m=T,w=$)}let _=e[2*m],v=e[2*m+1];if(w===1/0){for(let M=0;M<s;M++)this._dists[M]=e[2*M]-e[0]||e[2*M+1]-e[1];Oc(this._ids,this._dists,0,s-1);let T=new Uint32Array(s),$=0;for(let M=0,k=-1/0;M<s;M++){let R=this._ids[M],S=this._dists[R];S>k&&(T[$++]=R,k=S)}this.hull=T.subarray(0,$),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Nc(g,y,x,b,_,v)<0){let T=h,$=x,M=b;h=m,x=_,b=v,m=T,_=$,v=M}let A=Hz(g,y,x,b,_,v);this._cx=A.x,this._cy=A.y;for(let T=0;T<s;T++)this._dists[T]=zw(e[2*T],e[2*T+1],A.x,A.y);Oc(this._ids,this._dists,0,s-1),this._hullStart=d;let E=3;r[d]=n[m]=h,r[h]=n[d]=m,r[m]=n[h]=d,o[d]=0,o[h]=1,o[m]=2,i.fill(-1),i[this._hashKey(g,y)]=d,i[this._hashKey(x,b)]=h,i[this._hashKey(_,v)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let T=0,$,M;T<this._ids.length;T++){let k=this._ids[T],R=e[2*k],S=e[2*k+1];if(T>0&&Math.abs(R-$)<=zI&&Math.abs(S-M)<=zI||($=R,M=S,k===d||k===h||k===m))continue;let I=0;for(let P=0,F=this._hashKey(R,S);P<this._hashSize&&(I=i[(F+P)%this._hashSize],!(I!==-1&&I!==r[I]));P++);I=n[I];let C=I,N;for(;N=r[C],Nc(R,S,e[2*C],e[2*C+1],e[2*N],e[2*N+1])>=0;)if(C=N,C===I){C=-1;break}if(C===-1)continue;let D=this._addTriangle(C,k,r[C],-1,-1,o[C]);o[k]=this._legalize(D+2),o[C]=D,E++;let L=r[C];for(;N=r[L],Nc(R,S,e[2*L],e[2*L+1],e[2*N],e[2*N+1])<0;)D=this._addTriangle(L,k,N,o[k],-1,o[L]),o[k]=this._legalize(D+2),r[L]=L,E--,L=N;if(C===I)for(;N=n[C],Nc(R,S,e[2*N],e[2*N+1],e[2*C],e[2*C+1])<0;)D=this._addTriangle(N,k,C,-1,o[C],o[N]),this._legalize(D+2),o[N]=D,r[C]=C,E--,C=N;this._hullStart=n[k]=C,r[C]=n[L]=k,r[k]=L,i[this._hashKey(R,S)]=k,i[this._hashKey(e[2*C],e[2*C+1])]=C}this.hull=new Uint32Array(E);for(let T=0,$=this._hullStart;T<E;T++)this.hull[T]=$,$=r[$];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,n){return Math.floor(Gz(e-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:n,_halfedges:r,coords:o}=this,i=0,s=0;for(;;){let a=r[e],c=e-e%3;if(s=c+(e+2)%3,a===-1){if(i===0)break;e=p0[--i];continue}let f=a-a%3,l=c+(e+1)%3,u=f+(a+2)%3,p=n[s],d=n[e],h=n[l],m=n[u];if(Vz(o[2*p],o[2*p+1],o[2*d],o[2*d+1],o[2*h],o[2*h+1],o[2*m],o[2*m+1])){n[e]=m,n[a]=p;let y=r[u];if(y===-1){let b=this._hullStart;do{if(this._hullTri[b]===u){this._hullTri[b]=e;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(e,y),this._link(a,r[s]),this._link(s,u);let x=f+(a+1)%3;i<p0.length&&(p0[i++]=x)}else{if(i===0)break;e=p0[--i]}}return s}_link(e,n){this._halfedges[e]=n,n!==-1&&(this._halfedges[n]=e)}_addTriangle(e,n,r,o,i,s){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,o),this._link(a+1,i),this._link(a+2,s),this.trianglesLen+=3,a}};function Gz(t,e){let n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}function zw(t,e,n,r){let o=t-n,i=e-r;return o*o+i*i}function Vz(t,e,n,r,o,i,s,a){let c=t-s,f=e-a,l=n-s,u=r-a,p=o-s,d=i-a,h=c*c+f*f,m=l*l+u*u,g=p*p+d*d;return c*(u*g-m*d)-f*(l*g-m*p)+h*(l*d-u*p)<0}function Wz(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,l=s*s+a*a,u=c*c+f*f,p=.5/(s*f-a*c),d=(f*l-a*u)*p,h=(s*u-c*l)*p;return d*d+h*h}function Hz(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,l=s*s+a*a,u=c*c+f*f,p=.5/(s*f-a*c),d=t+(f*l-a*u)*p,h=e+(s*u-c*l)*p;return{x:d,y:h}}function Oc(t,e,n,r){if(r-n<=20)for(let o=n+1;o<=r;o++){let i=t[o],s=e[i],a=o-1;for(;a>=n&&e[t[a]]>s;)t[a+1]=t[a--];t[a+1]=i}else{let o=n+r>>1,i=n+1,s=r;bu(t,o,i),e[t[n]]>e[t[r]]&&bu(t,n,r),e[t[i]]>e[t[r]]&&bu(t,i,r),e[t[n]]>e[t[i]]&&bu(t,n,i);let a=t[i],c=e[a];for(;;){do i++;while(e[t[i]]<c);do s--;while(e[t[s]]>c);if(s<i)break;bu(t,i,s)}t[n+1]=t[s],t[s]=a,r-i+1>=s-n?(Oc(t,e,i,r),Oc(t,e,n,s-1)):(Oc(t,e,n,s-1),Oc(t,e,i,r))}}function bu(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Zz(t){return t[0]}function Qz(t){return t[1]}var or=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,n){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,n){this._+=`L${this._x1=+e},${this._y1=+n}`}arc(e,n,r){e=+e,n=+n,r=+r;let o=e+r,i=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${o},${i}`:(Math.abs(this._x1-o)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+o+","+i),r&&(this._+=`A${r},${r},0,1,1,${e-r},${n}A${r},${r},0,1,1,${this._x1=o},${this._y1=i}`)}rect(e,n,r,o){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${+r}v${+o}h${-r}Z`}value(){return this._||null}};var Bi=class{constructor(){this._=[]}moveTo(e,n){this._.push([e,n])}closePath(){this._.push(this._[0].slice())}lineTo(e,n){this._.push([e,n])}value(){return this._.length?this._:null}};var wu=class{constructor(e,[n,r,o,i]=[0,0,960,500]){if(!((o=+o)>=(n=+n))||!((i=+i)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=o,this.xmin=n,this.ymax=i,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:n,triangles:r},vectors:o}=this,i,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,g=0,y=r.length,x,b;m<y;m+=3,g+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,A=e[w],E=e[w+1],T=e[_],$=e[_+1],M=e[v],k=e[v+1],R=T-A,S=$-E,I=M-A,C=k-E,N=(R*C-S*I)*2;if(Math.abs(N)<1e-9){if(i===void 0){i=s=0;for(let L of n)i+=e[L*2],s+=e[L*2+1];i/=n.length,s/=n.length}let D=1e9*Math.sign((i-A)*C-(s-E)*I);x=(A+M)/2-D*C,b=(E+k)/2+D*I}else{let D=1/N,L=R*R+S*S,P=I*I+C*C;x=A+(C*L-S*P)*D,b=E+(R*P-I*L)*D}a[g]=x,a[g+1]=b}let c=n[n.length-1],f,l=c*4,u,p=e[2*c],d,h=e[2*c+1];o.fill(0);for(let m=0;m<n.length;++m)c=n[m],f=l,u=p,d=h,l=c*4,p=e[2*c],h=e[2*c+1],o[f+2]=o[l]=d-h,o[f+3]=o[l+1]=p-u}render(e){let n=e==null?e=new or:void 0,{delaunay:{halfedges:r,inedges:o,hull:i},circumcenters:s,vectors:a}=this;if(i.length<=1)return null;for(let l=0,u=r.length;l<u;++l){let p=r[l];if(p<l)continue;let d=Math.floor(l/3)*2,h=Math.floor(p/3)*2,m=s[d],g=s[d+1],y=s[h],x=s[h+1];this._renderSegment(m,g,y,x,e)}let c,f=i[i.length-1];for(let l=0;l<i.length;++l){c=f,f=i[l];let u=Math.floor(o[f]/3)*2,p=s[u],d=s[u+1],h=c*4,m=this._project(p,d,a[h+2],a[h+3]);m&&this._renderSegment(p,d,m[0],m[1],e)}return n&&n.value()}renderBounds(e){let n=e==null?e=new or:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(e,n){let r=n==null?n=new or:void 0,o=this._clip(e);if(o===null||!o.length)return;n.moveTo(o[0],o[1]);let i=o.length;for(;o[0]===o[i-2]&&o[1]===o[i-1]&&i>1;)i-=2;for(let s=2;s<i;s+=2)(o[s]!==o[s-2]||o[s+1]!==o[s-1])&&n.lineTo(o[s],o[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let n=0,r=e.length/2;n<r;++n){let o=this.cellPolygon(n);o&&(o.index=n,yield o)}}cellPolygon(e){let n=new Bi;return this.renderCell(e,n),n.value()}_renderSegment(e,n,r,o,i){let s,a=this._regioncode(e,n),c=this._regioncode(r,o);a===0&&c===0?(i.moveTo(e,n),i.lineTo(r,o)):(s=this._clipSegment(e,n,r,o,a,c))&&(i.moveTo(s[0],s[1]),i.lineTo(s[2],s[3]))}contains(e,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(e,n,r)===e}*neighbors(e){let n=this._clip(e);if(n)for(let r of this.delaunay.neighbors(e)){let o=this._clip(r);if(o){t:for(let i=0,s=n.length;i<s;i+=2)for(let a=0,c=o.length;a<c;a+=2)if(n[i]===o[a]&&n[i+1]===o[a+1]&&n[(i+2)%s]===o[(a+c-2)%c]&&n[(i+3)%s]===o[(a+c-1)%c]){yield r;break t}}}}_cell(e){let{circumcenters:n,delaunay:{inedges:r,halfedges:o,triangles:i}}=this,s=r[e];if(s===-1)return null;let a=[],c=s;do{let f=Math.floor(c/3);if(a.push(n[f*2],n[f*2+1]),c=c%3===2?c-2:c+1,i[c]!==e)break;c=o[c]}while(c!==s&&c!==-1);return a}_clip(e){if(e===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(e);if(n===null)return null;let{vectors:r}=this,o=e*4;return this._simplify(r[o]||r[o+1]?this._clipInfinite(e,n,r[o],r[o+1],r[o+2],r[o+3]):this._clipFinite(e,n))}_clipFinite(e,n){let r=n.length,o=null,i,s,a=n[r-2],c=n[r-1],f,l=this._regioncode(a,c),u,p=0;for(let d=0;d<r;d+=2)if(i=a,s=c,a=n[d],c=n[d+1],f=l,l=this._regioncode(a,c),f===0&&l===0)u=p,p=0,o?o.push(a,c):o=[a,c];else{let h,m,g,y,x;if(f===0){if((h=this._clipSegment(i,s,a,c,f,l))===null)continue;[m,g,y,x]=h}else{if((h=this._clipSegment(a,c,i,s,l,f))===null)continue;[y,x,m,g]=h,u=p,p=this._edgecode(m,g),u&&p&&this._edge(e,u,p,o,o.length),o?o.push(m,g):o=[m,g]}u=p,p=this._edgecode(y,x),u&&p&&this._edge(e,u,p,o,o.length),o?o.push(y,x):o=[y,x]}if(o)u=p,p=this._edgecode(o[0],o[1]),u&&p&&this._edge(e,u,p,o,o.length);else if(this.contains(e,(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 o}_clipSegment(e,n,r,o,i,s){let a=i<s;for(a&&([e,n,r,o,i,s]=[r,o,e,n,s,i]);;){if(i===0&&s===0)return a?[r,o,e,n]:[e,n,r,o];if(i&s)return null;let c,f,l=i||s;l&8?(c=e+(r-e)*(this.ymax-n)/(o-n),f=this.ymax):l&4?(c=e+(r-e)*(this.ymin-n)/(o-n),f=this.ymin):l&2?(f=n+(o-n)*(this.xmax-e)/(r-e),c=this.xmax):(f=n+(o-n)*(this.xmin-e)/(r-e),c=this.xmin),i?(e=c,n=f,i=this._regioncode(e,n)):(r=c,o=f,s=this._regioncode(r,o))}}_clipInfinite(e,n,r,o,i,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,o))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],i,s))&&a.push(c[0],c[1]),a=this._clipFinite(e,a))for(let f=0,l=a.length,u,p=this._edgecode(a[l-2],a[l-1]);f<l;f+=2)u=p,p=this._edgecode(a[f],a[f+1]),u&&p&&(f=this._edge(e,u,p,a,f),l=a.length);else this.contains(e,(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(e,n,r,o,i){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}(o[i]!==s||o[i+1]!==a)&&this.contains(e,s,a)&&(o.splice(i,0,s,a),i+=2)}return i}_project(e,n,r,o){let i=1/0,s,a,c;if(o<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/o)<i&&(c=this.ymin,a=e+(i=s)*r)}else if(o>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/o)<i&&(c=this.ymax,a=e+(i=s)*r)}if(r>0){if(e>=this.xmax)return null;(s=(this.xmax-e)/r)<i&&(a=this.xmax,c=n+(i=s)*o)}else if(r<0){if(e<=this.xmin)return null;(s=(this.xmin-e)/r)<i&&(a=this.xmin,c=n+(i=s)*o)}return[a,c]}_edgecode(e,n){return(e===this.xmin?1:e===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(e,n){return(e<this.xmin?1:e>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let n=0;n<e.length;n+=2){let r=(n+2)%e.length,o=(n+4)%e.length;(e[n]===e[r]&&e[r]===e[o]||e[n+1]===e[r+1]&&e[r+1]===e[o+1])&&(e.splice(r,2),n-=2)}e.length||(e=null)}return e}};var Jz=2*Math.PI,Lc=Math.pow;function Kz(t){return t[0]}function tY(t){return t[1]}function eY(t){let{triangles:e,coords:n}=t;for(let r=0;r<e.length;r+=3){let o=2*e[r],i=2*e[r+1],s=2*e[r+2];if((n[s]-n[o])*(n[i+1]-n[o+1])-(n[i]-n[o])*(n[s+1]-n[o+1])>1e-10)return!1}return!0}function nY(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}var ir=class t{static from(e,n=Kz,r=tY,o){return new t("length"in e?rY(e,n,r,o):Float64Array.from(oY(e,n,r,o)))}constructor(e){this._delaunator=new Rc(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,n=this.points;if(e.hull&&e.hull.length>2&&eY(e)){this.collinear=Int32Array.from({length:n.length/2},(p,d)=>d).sort((p,d)=>n[2*p]-n[2*d]||n[2*p+1]-n[2*d+1]);let c=this.collinear[0],f=this.collinear[this.collinear.length-1],l=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],u=1e-8*Math.hypot(l[3]-l[1],l[2]-l[0]);for(let p=0,d=n.length/2;p<d;++p){let h=nY(n[2*p],n[2*p+1],u);n[2*p]=h[0],n[2*p+1]=h[1]}this._delaunator=new Rc(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,o=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,f=r.length;c<f;++c){let l=i[c%3===2?c-2:c+1];(r[c]===-1||s[l]===-1)&&(s[l]=c)}for(let c=0,f=o.length;c<f;++c)a[o[c]]=c;o.length<=2&&o.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=o[0],s[o[0]]=1,o.length===2&&(s[o[1]]=0,this.triangles[1]=o[1],this.triangles[2]=o[1]))}voronoi(e){return new wu(this,e)}*neighbors(e){let{inedges:n,hull:r,_hullIndex:o,halfedges:i,triangles:s,collinear:a}=this;if(a){let u=a.indexOf(e);u>0&&(yield a[u-1]),u<a.length-1&&(yield a[u+1]);return}let c=n[e];if(c===-1)return;let f=c,l=-1;do{if(yield l=s[f],f=f%3===2?f-2:f+1,s[f]!==e)return;if(f=i[f],f===-1){let u=r[(o[e]+1)%r.length];u!==l&&(yield u);return}}while(f!==c)}find(e,n,r=0){if(e=+e,e!==e||(n=+n,n!==n))return-1;let o=r,i;for(;(i=this._step(r,e,n))>=0&&i!==r&&i!==o;)r=i;return i}_step(e,n,r){let{inedges:o,hull:i,_hullIndex:s,halfedges:a,triangles:c,points:f}=this;if(o[e]===-1||!f.length)return(e+1)%(f.length>>1);let l=e,u=Lc(n-f[e*2],2)+Lc(r-f[e*2+1],2),p=o[e],d=p;do{let h=c[d],m=Lc(n-f[h*2],2)+Lc(r-f[h*2+1],2);if(m<u&&(u=m,l=h),d=d%3===2?d-2:d+1,c[d]!==e)break;if(d=a[d],d===-1){if(d=i[(s[e]+1)%i.length],d!==h&&Lc(n-f[d*2],2)+Lc(r-f[d*2+1],2)<u)return d;break}}while(d!==p);return l}render(e){let n=e==null?e=new or:void 0,{points:r,halfedges:o,triangles:i}=this;for(let s=0,a=o.length;s<a;++s){let c=o[s];if(c<s)continue;let f=i[s]*2,l=i[c]*2;e.moveTo(r[f],r[f+1]),e.lineTo(r[l],r[l+1])}return this.renderHull(e),n&&n.value()}renderPoints(e,n){n===void 0&&(!e||typeof e.moveTo!="function")&&(n=e,e=null),n=n==null?2:+n;let r=e==null?e=new or:void 0,{points:o}=this;for(let i=0,s=o.length;i<s;i+=2){let a=o[i],c=o[i+1];e.moveTo(a+n,c),e.arc(a,c,n,0,Jz)}return r&&r.value()}renderHull(e){let n=e==null?e=new or:void 0,{hull:r,points:o}=this,i=r[0]*2,s=r.length;e.moveTo(o[i],o[i+1]);for(let a=1;a<s;++a){let c=2*r[a];e.lineTo(o[c],o[c+1])}return e.closePath(),n&&n.value()}hullPolygon(){let e=new Bi;return this.renderHull(e),e.value()}renderTriangle(e,n){let r=n==null?n=new or:void 0,{points:o,triangles:i}=this,s=i[e*=3]*2,a=i[e+1]*2,c=i[e+2]*2;return n.moveTo(o[s],o[s+1]),n.lineTo(o[a],o[a+1]),n.lineTo(o[c],o[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:e}=this;for(let n=0,r=e.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(e){let n=new Bi;return this.renderTriangle(e,n),n.value()}};function rY(t,e,n,r){let o=t.length,i=new Float64Array(o*2);for(let s=0;s<o;++s){let a=t[s];i[s*2]=e.call(r,a,s,t),i[s*2+1]=n.call(r,a,s,t)}return i}function*oY(t,e,n,r){let o=0;for(let i of t)yield e.call(r,i,o,t),yield n.call(r,i,o,t),++o}function YI(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function sa(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vr(t){return t=sa(Math.abs(t)),t?t[1]:NaN}function UI(t,e){return function(n,r){for(var o=n.length,i=[],s=0,a=t[0],c=0;o>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(n.substring(o-=a,o+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return i.reverse().join(e)}}function jI(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var iY=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wr(t){if(!(e=iY.exec(t)))throw new Error("invalid format: "+t);var e;return new d0({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Wr.prototype=d0.prototype;function d0(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}d0.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 XI(t){t:for(var e=t.length,n=1,r=-1,o;n<e;++n)switch(t[n]){case".":r=o=n;break;case"0":r===0&&(r=n),o=n;break;default:if(!+t[n])break t;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(o+1):t}var Yw;function GI(t,e){var n=sa(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Yw=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+sa(t,Math.max(0,e+i-1))[0]}function Uw(t,e){var n=sa(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}var jw={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:YI,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Uw(t*100,e),r:Uw,s:GI,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Xw(t){return t}var VI=Array.prototype.map,WI=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function HI(t){var e=t.grouping===void 0||t.thousands===void 0?Xw:UI(VI.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?Xw:jI(VI.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"\u2212":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function f(u){u=Wr(u);var p=u.fill,d=u.align,h=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,w=u.trim,_=u.type;_==="n"?(x=!0,_="g"):jw[_]||(b===void 0&&(b=12),w=!0,_="g"),(g||p==="0"&&d==="=")&&(g=!0,p="0",d="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",A=m==="$"?r:/[%p]/.test(_)?s:"",E=jw[_],T=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function $(M){var k=v,R=A,S,I,C;if(_==="c")R=E(M)+R,M="";else{M=+M;var N=M<0||1/M<0;if(M=isNaN(M)?c:E(Math.abs(M),b),w&&(M=XI(M)),N&&+M==0&&h!=="+"&&(N=!1),k=(N?h==="("?h:a:h==="-"||h==="("?"":h)+k,R=(_==="s"?WI[8+Yw/3]:"")+R+(N&&h==="("?")":""),T){for(S=-1,I=M.length;++S<I;)if(C=M.charCodeAt(S),48>C||C>57){R=(C===46?o+M.slice(S+1):M.slice(S))+R,M=M.slice(0,S);break}}}x&&!g&&(M=e(M,1/0));var D=k.length+M.length+R.length,L=D<y?new Array(y-D+1).join(p):"";switch(x&&g&&(M=e(L+M,L.length?y-R.length:1/0),L=""),d){case"<":M=k+M+R+L;break;case"=":M=k+L+M+R;break;case"^":M=L.slice(0,D=L.length>>1)+k+M+R+L.slice(D);break;default:M=L+k+M+R;break}return i(M)}return $.toString=function(){return u+""},$}function l(u,p){var d=f((u=Wr(u),u.type="f",u)),h=Math.max(-8,Math.min(8,Math.floor(Vr(p)/3)))*3,m=Math.pow(10,-h),g=WI[8+h/3];return function(y){return d(m*y)+g}}return{format:f,formatPrefix:l}}var h0,sr,m0;Gw({thousands:",",grouping:[3],currency:["$",""]});function Gw(t){return h0=HI(t),sr=h0.format,m0=h0.formatPrefix,h0}function Vw(t){return Math.max(0,-Vr(Math.abs(t)))}function Ww(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vr(e)/3)))*3-Vr(Math.abs(t)))}function Hw(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vr(e)-Vr(t))+1}var K=1e-6,aa=1e-12,yt=Math.PI,Ut=yt/2,Zw=yt/4,Ee=yt*2,se=180/yt,At=yt/180,vt=Math.abs,ar=Math.atan,he=Math.atan2,Q=Math.cos,vu=Math.ceil,g0=Math.exp;var y0=Math.hypot,ca=Math.log,x0=Math.pow,Z=Math.sin,Ke=Math.sign||function(t){return t>0?1:t<0?-1:0},jt=Math.sqrt,Dc=Math.tan;function b0(t){return t>1?0:t<-1?yt:Math.acos(t)}function Zt(t){return t>1?Ut:t<-1?-Ut:Math.asin(t)}function me(){}function w0(t,e){t&&QI.hasOwnProperty(t.type)&&QI[t.type](t,e)}var ZI={Feature:function(t,e){w0(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)w0(n[r].geometry,e)}},QI={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Qw(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)Qw(n[r],e,0)},Polygon:function(t,e){JI(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)JI(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)w0(n[r],e)}};function Qw(t,e,n){var r=-1,o=t.length-n,i;for(e.lineStart();++r<o;)i=t[r],e.point(i[0],i[1],i[2]);e.lineEnd()}function JI(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Qw(t[n],e,1);e.polygonEnd()}function qn(t,e){t&&ZI.hasOwnProperty(t.type)?ZI[t.type](t,e):w0(t,e)}function _u(t){return[he(t[1],t[0]),Zt(t[2])]}function Hr(t){var e=t[0],n=t[1],r=Q(n);return[r*Q(e),r*Z(e),Z(n)]}function Su(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Pc(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function v0(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Mu(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Au(t){var e=jt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Tu,_0,S0,M0,A0,T0,E0,I0,Jw,Kw,tv,e$,n$,gn,yn,xn,Mr={sphere:me,point:ev,lineStart:KI,lineEnd:t$,polygonStart:function(){Mr.lineStart=cY,Mr.lineEnd=fY},polygonEnd:function(){Mr.lineStart=KI,Mr.lineEnd=t$}};function ev(t,e){t*=At,e*=At;var n=Q(e);Eu(n*Q(t),n*Z(t),Z(e))}function Eu(t,e,n){++Tu,S0+=(t-S0)/Tu,M0+=(e-M0)/Tu,A0+=(n-A0)/Tu}function KI(){Mr.point=sY}function sY(t,e){t*=At,e*=At;var n=Q(e);gn=n*Q(t),yn=n*Z(t),xn=Z(e),Mr.point=aY,Eu(gn,yn,xn)}function aY(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*Z(t),i=Z(e),s=he(jt((s=yn*i-xn*o)*s+(s=xn*r-gn*i)*s+(s=gn*o-yn*r)*s),gn*r+yn*o+xn*i);_0+=s,T0+=s*(gn+(gn=r)),E0+=s*(yn+(yn=o)),I0+=s*(xn+(xn=i)),Eu(gn,yn,xn)}function t$(){Mr.point=ev}function cY(){Mr.point=lY}function fY(){r$(e$,n$),Mr.point=ev}function lY(t,e){e$=t,n$=e,t*=At,e*=At,Mr.point=r$;var n=Q(e);gn=n*Q(t),yn=n*Z(t),xn=Z(e),Eu(gn,yn,xn)}function r$(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*Z(t),i=Z(e),s=yn*i-xn*o,a=xn*r-gn*i,c=gn*o-yn*r,f=y0(s,a,c),l=Zt(f),u=f&&-l/f;Jw.add(u*s),Kw.add(u*a),tv.add(u*c),_0+=l,T0+=l*(gn+(gn=r)),E0+=l*(yn+(yn=o)),I0+=l*(xn+(xn=i)),Eu(gn,yn,xn)}function nv(t){Tu=_0=S0=M0=A0=T0=E0=I0=0,Jw=new Be,Kw=new Be,tv=new Be,qn(t,Mr);var e=+Jw,n=+Kw,r=+tv,o=y0(e,n,r);return o<aa&&(e=T0,n=E0,r=I0,_0<K&&(e=S0,n=M0,r=A0),o=y0(e,n,r),o<aa)?[NaN,NaN]:[he(n,e)*se,Zt(r/o)*se]}function Iu(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}function rv(t,e){return vt(t)>yt&&(t-=Math.round(t/Ee)*Ee),[t,e]}rv.invert=rv;function ov(t,e,n){return(t%=Ee)?e||n?Iu(i$(t),s$(e,n)):i$(t):e||n?s$(e,n):rv}function o$(t){return function(e,n){return e+=t,vt(e)>yt&&(e-=Math.round(e/Ee)*Ee),[e,n]}}function i$(t){var e=o$(t);return e.invert=o$(-t),e}function s$(t,e){var n=Q(t),r=Z(t),o=Q(e),i=Z(e);function s(a,c){var f=Q(c),l=Q(a)*f,u=Z(a)*f,p=Z(c),d=p*n+l*r;return[he(u*o-d*i,l*n-p*r),Zt(d*o+u*i)]}return s.invert=function(a,c){var f=Q(c),l=Q(a)*f,u=Z(a)*f,p=Z(c),d=p*o-u*i;return[he(u*o+p*i,l*n+d*r),Zt(d*n-l*r)]},s}function a$(t){t=ov(t[0]*At,t[1]*At,t.length>2?t[2]*At:0);function e(n){return n=t(n[0]*At,n[1]*At),n[0]*=se,n[1]*=se,n}return e.invert=function(n){return n=t.invert(n[0]*At,n[1]*At),n[0]*=se,n[1]*=se,n},e}function f$(t,e,n,r,o,i){if(n){var s=Q(e),a=Z(e),c=r*n;o==null?(o=e+r*Ee,i=e-c/2):(o=c$(s,o),i=c$(s,i),(r>0?o<i:o>i)&&(o+=r*Ee));for(var f,l=o;r>0?l>i:l<i;l-=c)f=_u([s,-a*Q(l),-a*Z(l)]),t.point(f[0],f[1])}}function c$(t,e){e=Hr(e),e[0]-=t,Au(e);var n=b0(-e[1]);return((-e[2]<0?-n:n)+Ee-K)%Ee}function $0(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:me,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Fc(t,e){return vt(t[0]-e[0])<K&&vt(t[1]-e[1])<K}function C0(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function k0(t,e,n,r,o){var i=[],s=[],a,c;if(t.forEach(function(h){if(!((m=h.length-1)<=0)){var m,g=h[0],y=h[m],x;if(Fc(g,y)){if(!g[2]&&!y[2]){for(o.lineStart(),a=0;a<m;++a)o.point((g=h[a])[0],g[1]);o.lineEnd();return}y[0]+=2*K}i.push(x=new C0(g,h,null,!0)),s.push(x.o=new C0(g,null,x,!1)),i.push(x=new C0(y,h,null,!1)),s.push(x.o=new C0(y,null,x,!0))}}),!!i.length){for(s.sort(e),l$(i),l$(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var f=i[0],l,u;;){for(var p=f,d=!0;p.v;)if((p=p.n)===f)return;l=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(a=0,c=l.length;a<c;++a)o.point((u=l[a])[0],u[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(d)for(l=p.p.z,a=l.length-1;a>=0;--a)o.point((u=l[a])[0],u[1]);else r(p.x,p.p.x,-1,o);p=p.p}p=p.o,l=p.z,d=!d}while(!p.v);o.lineEnd()}}}function l$(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}function iv(t){return vt(t[0])<=yt?t[0]:Ke(t[0])*((vt(t[0])+yt)%Ee-yt)}function u$(t,e){var n=iv(e),r=e[1],o=Z(r),i=[Z(n),-Q(n),0],s=0,a=0,c=new Be;o===1?r=Ut+K:o===-1&&(r=-Ut-K);for(var f=0,l=t.length;f<l;++f)if(p=(u=t[f]).length)for(var u,p,d=u[p-1],h=iv(d),m=d[1]/2+Zw,g=Z(m),y=Q(m),x=0;x<p;++x,h=w,g=v,y=A,d=b){var b=u[x],w=iv(b),_=b[1]/2+Zw,v=Z(_),A=Q(_),E=w-h,T=E>=0?1:-1,$=T*E,M=$>yt,k=g*v;if(c.add(he(k*T*Z($),y*A+k*Q($))),s+=M?E+T*Ee:E,M^h>=n^w>=n){var R=Pc(Hr(d),Hr(b));Au(R);var S=Pc(i,R);Au(S);var I=(M^E>=0?-1:1)*Zt(S[2]);(r>I||r===I&&(R[0]||R[1]))&&(a+=M^E>=0?1:-1)}}return(s<-K||s<K&&c<-aa)^a&1}function N0(t,e,n,r){return function(o){var i=e(o),s=$0(),a=e(s),c=!1,f,l,u,p={point:d,lineStart:m,lineEnd:g,polygonStart:function(){p.point=y,p.lineStart=x,p.lineEnd=b,l=[],f=[]},polygonEnd:function(){p.point=d,p.lineStart=m,p.lineEnd=g,l=bc(l);var w=u$(f,r);l.length?(c||(o.polygonStart(),c=!0),k0(l,pY,w,n,o)):w&&(c||(o.polygonStart(),c=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),c&&(o.polygonEnd(),c=!1),l=f=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(w,_){t(w,_)&&o.point(w,_)}function h(w,_){i.point(w,_)}function m(){p.point=h,i.lineStart()}function g(){p.point=d,i.lineEnd()}function y(w,_){u.push([w,_]),a.point(w,_)}function x(){a.lineStart(),u=[]}function b(){y(u[0][0],u[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,A=_.length,E,T,$;if(u.pop(),f.push(u),u=null,!!A){if(w&1){if(T=_[0],(E=T.length-1)>0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v<E;++v)o.point(($=T[v])[0],$[1]);o.lineEnd()}return}A>1&&w&2&&_.push(_.pop().concat(_.shift())),l.push(_.filter(uY))}}return p}}function uY(t){return t.length>1}function pY(t,e){return((t=t.x)[0]<0?t[1]-Ut-K:Ut-t[1])-((e=e.x)[0]<0?e[1]-Ut-K:Ut-e[1])}var sv=N0(function(){return!0},dY,mY,[-yt,-Ut]);function dY(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(i,s){var a=i>0?yt:-yt,c=vt(i-e);vt(c-yt)<K?(t.point(e,n=(n+s)/2>0?Ut:-Ut),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(i,n),o=0):r!==a&&c>=yt&&(vt(e-r)<K&&(e-=r*K),vt(i-a)<K&&(i-=a*K),n=hY(e,n,i,s),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),o=0),t.point(e=i,n=s),r=a},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function hY(t,e,n,r){var o,i,s=Z(t-n);return vt(s)>K?ar((Z(e)*(i=Q(r))*Z(n)-Z(r)*(o=Q(e))*Z(t))/(o*i*s)):(e+r)/2}function mY(t,e,n,r){var o;if(t==null)o=n*Ut,r.point(-yt,o),r.point(0,o),r.point(yt,o),r.point(yt,0),r.point(yt,-o),r.point(0,-o),r.point(-yt,-o),r.point(-yt,0),r.point(-yt,o);else if(vt(t[0]-e[0])>K){var i=t[0]<e[0]?yt:-yt;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(e[0],e[1])}function p$(t){var e=Q(t),n=6*At,r=e>0,o=vt(e)>K;function i(l,u,p,d){f$(d,t,n,p,l,u)}function s(l,u){return Q(l)*Q(u)>e}function a(l){var u,p,d,h,m;return{lineStart:function(){h=d=!1,m=1},point:function(g,y){var x=[g,y],b,w=s(g,y),_=r?w?0:f(g,y):w?f(g+(g<0?yt:-yt),y):0;if(!u&&(h=d=w)&&l.lineStart(),w!==d&&(b=c(u,x),(!b||Fc(u,b)||Fc(x,b))&&(x[2]=1)),w!==d)m=0,w?(l.lineStart(),b=c(x,u),l.point(b[0],b[1])):(b=c(u,x),l.point(b[0],b[1],2),l.lineEnd()),u=b;else if(o&&u&&r^w){var v;!(_&p)&&(v=c(x,u,!0))&&(m=0,r?(l.lineStart(),l.point(v[0][0],v[0][1]),l.point(v[1][0],v[1][1]),l.lineEnd()):(l.point(v[1][0],v[1][1]),l.lineEnd(),l.lineStart(),l.point(v[0][0],v[0][1],3)))}w&&(!u||!Fc(u,x))&&l.point(x[0],x[1]),u=x,d=w,p=_},lineEnd:function(){d&&l.lineEnd(),u=null},clean:function(){return m|(h&&d)<<1}}}function c(l,u,p){var d=Hr(l),h=Hr(u),m=[1,0,0],g=Pc(d,h),y=Su(g,g),x=g[0],b=y-x*x;if(!b)return!p&&l;var w=e*y/b,_=-e*x/b,v=Pc(m,g),A=Mu(m,w),E=Mu(g,_);v0(A,E);var T=v,$=Su(A,T),M=Su(T,T),k=$*$-M*(Su(A,A)-1);if(!(k<0)){var R=jt(k),S=Mu(T,(-$-R)/M);if(v0(S,A),S=_u(S),!p)return S;var I=l[0],C=u[0],N=l[1],D=u[1],L;C<I&&(L=I,I=C,C=L);var P=C-I,F=vt(P-yt)<K,q=F||P<K;if(!F&&D<N&&(L=N,N=D,D=L),q?F?N+D>0^S[1]<(vt(S[0]-I)<K?N:D):N<=S[1]&&S[1]<=D:P>yt^(I<=S[0]&&S[0]<=C)){var W=Mu(T,(-$+R)/M);return v0(W,A),[S,_u(W)]}}}function f(l,u){var p=r?t:yt-t,d=0;return l<-p?d|=1:l>p&&(d|=2),u<-p?d|=4:u>p&&(d|=8),d}return N0(s,a,i,r?[0,-t]:[-yt,t-yt])}function d$(t,e,n,r,o,i){var s=t[0],a=t[1],c=e[0],f=e[1],l=0,u=1,p=c-s,d=f-a,h;if(h=n-s,!(!p&&h>0)){if(h/=p,p<0){if(h<l)return;h<u&&(u=h)}else if(p>0){if(h>u)return;h>l&&(l=h)}if(h=o-s,!(!p&&h<0)){if(h/=p,p<0){if(h>u)return;h>l&&(l=h)}else if(p>0){if(h<l)return;h<u&&(u=h)}if(h=r-a,!(!d&&h>0)){if(h/=d,d<0){if(h<l)return;h<u&&(u=h)}else if(d>0){if(h>u)return;h>l&&(l=h)}if(h=i-a,!(!d&&h<0)){if(h/=d,d<0){if(h>u)return;h>l&&(l=h)}else if(d>0){if(h<l)return;h<u&&(u=h)}return l>0&&(t[0]=s+l*p,t[1]=a+l*d),u<1&&(e[0]=s+u*p,e[1]=a+u*d),!0}}}}}var $u=1e9,O0=-$u;function qc(t,e,n,r){function o(f,l){return t<=f&&f<=n&&e<=l&&l<=r}function i(f,l,u,p){var d=0,h=0;if(f==null||(d=s(f,u))!==(h=s(l,u))||c(f,l)<0^u>0)do p.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+u+4)%4)!==h);else p.point(l[0],l[1])}function s(f,l){return vt(f[0]-t)<K?l>0?0:3:vt(f[0]-n)<K?l>0?2:1:vt(f[1]-e)<K?l>0?1:0:l>0?3:2}function a(f,l){return c(f.x,l.x)}function c(f,l){var u=s(f,1),p=s(l,1);return u!==p?u-p:u===0?l[1]-f[1]:u===1?f[0]-l[0]:u===2?f[1]-l[1]:l[0]-f[0]}return function(f){var l=f,u=$0(),p,d,h,m,g,y,x,b,w,_,v,A={point:E,lineStart:k,lineEnd:R,polygonStart:$,polygonEnd:M};function E(I,C){o(I,C)&&l.point(I,C)}function T(){for(var I=0,C=0,N=d.length;C<N;++C)for(var D=d[C],L=1,P=D.length,F=D[0],q,W,tt=F[0],nt=F[1];L<P;++L)q=tt,W=nt,F=D[L],tt=F[0],nt=F[1],W<=r?nt>r&&(tt-q)*(r-W)>(nt-W)*(t-q)&&++I:nt<=r&&(tt-q)*(r-W)<(nt-W)*(t-q)&&--I;return I}function $(){l=u,p=[],d=[],v=!0}function M(){var I=T(),C=v&&I,N=(p=bc(p)).length;(C||N)&&(f.polygonStart(),C&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),N&&k0(p,a,I,i,f),f.polygonEnd()),l=f,p=d=h=null}function k(){A.point=S,d&&d.push(h=[]),_=!0,w=!1,x=b=NaN}function R(){p&&(S(m,g),y&&w&&u.rejoin(),p.push(u.result())),A.point=E,w&&l.lineEnd()}function S(I,C){var N=o(I,C);if(d&&h.push([I,C]),_)m=I,g=C,y=N,_=!1,N&&(l.lineStart(),l.point(I,C));else if(N&&w)l.point(I,C);else{var D=[x=Math.max(O0,Math.min($u,x)),b=Math.max(O0,Math.min($u,b))],L=[I=Math.max(O0,Math.min($u,I)),C=Math.max(O0,Math.min($u,C))];d$(D,L,t,e,n,r)?(w||(l.lineStart(),l.point(D[0],D[1])),l.point(L[0],L[1]),N||l.lineEnd(),v=!1):N&&(l.lineStart(),l.point(I,C),v=!1)}x=I,b=C,w=N}return A}}function h$(t,e,n){var r=ce(t,e-K,n).concat(e);return function(o){return r.map(function(i){return[o,i]})}}function m$(t,e,n){var r=ce(t,e-K,n).concat(e);return function(o){return r.map(function(i){return[i,o]})}}function av(){var t,e,n,r,o,i,s,a,c=10,f=c,l=90,u=360,p,d,h,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:x()}}function x(){return ce(vu(r/l)*l,n,l).map(h).concat(ce(vu(a/u)*u,s,u).map(m)).concat(ce(vu(e/c)*c,t,c).filter(function(b){return vt(b%l)>K}).map(p)).concat(ce(vu(i/f)*f,o,f).filter(function(b){return vt(b%u)>K}).map(d))}return y.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},y.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(m(s).slice(1),h(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(b){return arguments.length?y.extentMajor(b).extentMinor(b):y.extentMinor()},y.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),y.precision(g)):[[r,a],[n,s]]},y.extentMinor=function(b){return arguments.length?(e=+b[0][0],t=+b[1][0],i=+b[0][1],o=+b[1][1],e>t&&(b=e,e=t,t=b),i>o&&(b=i,i=o,o=b),y.precision(g)):[[e,i],[t,o]]},y.step=function(b){return arguments.length?y.stepMajor(b).stepMinor(b):y.stepMinor()},y.stepMajor=function(b){return arguments.length?(l=+b[0],u=+b[1],y):[l,u]},y.stepMinor=function(b){return arguments.length?(c=+b[0],f=+b[1],y):[c,f]},y.precision=function(b){return arguments.length?(g=+b,p=h$(i,o,90),d=m$(e,t,g),h=h$(a,s,90),m=m$(r,n,g),y):g},y.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}function cv(){return av()()}var Cu=t=>t;var fv=new Be,lv=new Be,g$,y$,uv,pv,zi={point:me,lineStart:me,lineEnd:me,polygonStart:function(){zi.lineStart=gY,zi.lineEnd=xY},polygonEnd:function(){zi.lineStart=zi.lineEnd=zi.point=me,fv.add(vt(lv)),lv=new Be},result:function(){var t=fv/2;return fv=new Be,t}};function gY(){zi.point=yY}function yY(t,e){zi.point=x$,g$=uv=t,y$=pv=e}function x$(t,e){lv.add(pv*t-uv*e),uv=t,pv=e}function xY(){x$(g$,y$)}var dv=zi;var Bc=1/0,R0=Bc,ku=-Bc,L0=ku,bY={point:wY,lineStart:me,lineEnd:me,polygonStart:me,polygonEnd:me,result:function(){var t=[[Bc,R0],[ku,L0]];return ku=L0=-(R0=Bc=1/0),t}};function wY(t,e){t<Bc&&(Bc=t),t>ku&&(ku=t),e<R0&&(R0=e),e>L0&&(L0=e)}var zc=bY;var hv=0,mv=0,Nu=0,D0=0,P0=0,Yc=0,gv=0,yv=0,Ou=0,v$,_$,Zr,Qr,Ar={point:fa,lineStart:b$,lineEnd:w$,polygonStart:function(){Ar.lineStart=SY,Ar.lineEnd=MY},polygonEnd:function(){Ar.point=fa,Ar.lineStart=b$,Ar.lineEnd=w$},result:function(){var t=Ou?[gv/Ou,yv/Ou]:Yc?[D0/Yc,P0/Yc]:Nu?[hv/Nu,mv/Nu]:[NaN,NaN];return hv=mv=Nu=D0=P0=Yc=gv=yv=Ou=0,t}};function fa(t,e){hv+=t,mv+=e,++Nu}function b$(){Ar.point=vY}function vY(t,e){Ar.point=_Y,fa(Zr=t,Qr=e)}function _Y(t,e){var n=t-Zr,r=e-Qr,o=jt(n*n+r*r);D0+=o*(Zr+t)/2,P0+=o*(Qr+e)/2,Yc+=o,fa(Zr=t,Qr=e)}function w$(){Ar.point=fa}function SY(){Ar.point=AY}function MY(){S$(v$,_$)}function AY(t,e){Ar.point=S$,fa(v$=Zr=t,_$=Qr=e)}function S$(t,e){var n=t-Zr,r=e-Qr,o=jt(n*n+r*r);D0+=o*(Zr+t)/2,P0+=o*(Qr+e)/2,Yc+=o,o=Qr*t-Zr*e,gv+=o*(Zr+t),yv+=o*(Qr+e),Ou+=o*3,fa(Zr=t,Qr=e)}var xv=Ar;function F0(t){this._context=t}F0.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,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(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ee);break}}},result:me};var wv=new Be,bv,M$,A$,Ru,Lu,q0={point:me,lineStart:function(){q0.point=TY},lineEnd:function(){bv&&T$(M$,A$),q0.point=me},polygonStart:function(){bv=!0},polygonEnd:function(){bv=null},result:function(){var t=+wv;return wv=new Be,t}};function TY(t,e){q0.point=T$,M$=Ru=t,A$=Lu=e}function T$(t,e){Ru-=t,Lu-=e,wv.add(jt(Ru*Ru+Lu*Lu)),Ru=t,Lu=e}var vv=q0;var E$,B0,I$,$$,Uc=class{constructor(e){this._append=e==null?C$:EY(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==I$||this._append!==B0){let r=this._radius,o=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`,I$=r,B0=this._append,$$=this._,this._=o}this._+=$$;break}}}result(){let e=this._;return this._="",e.length?e:null}};function C$(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function EY(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return C$;if(e!==E$){let n=10**e;E$=e,B0=function(o){let i=1;this._+=o[0];for(let s=o.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+o[i]}}return B0}function Ie(t,e){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),qn(a,o(i))),i.result()}return s.area=function(a){return qn(a,o(dv)),dv.result()},s.measure=function(a){return qn(a,o(vv)),vv.result()},s.bounds=function(a){return qn(a,o(zc)),zc.result()},s.centroid=function(a){return qn(a,o(xv)),xv.result()},s.projection=function(a){return arguments.length?(o=a==null?(t=null,Cu):(t=a).stream,s):t},s.context=function(a){return arguments.length?(i=a==null?(e=null,new Uc(n)):new F0(e=a),typeof r!="function"&&i.pointRadius(r),s):e},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(i.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 e===null&&(i=new Uc(n)),s},s.projection(t).digits(n).context(e)}function la(t){return{stream:jc(t)}}function jc(t){return function(e){var n=new _v;for(var r in t)n[r]=t[r];return n.stream=e,n}}function _v(){}_v.prototype={constructor:_v,point:function(t,e){this.stream.point(t,e)},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 Sv(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),qn(n,t.stream(zc)),e(zc.result()),r!=null&&t.clipExtent(r),t}function Du(t,e,n){return Sv(t,function(r){var o=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(o/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(o-s*(r[1][0]+r[0][0]))/2,c=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,c])},n)}function z0(t,e,n){return Du(t,[[0,0],e],n)}function Y0(t,e,n){return Sv(t,function(r){var o=+e,i=o/(r[1][0]-r[0][0]),s=(o-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])},n)}function U0(t,e,n){return Sv(t,function(r){var o=+e,i=o/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(o-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])},n)}var k$=16,IY=Q(30*At);function Mv(t,e){return+e?CY(t,e):$Y(t)}function $Y(t){return jc({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function CY(t,e){function n(r,o,i,s,a,c,f,l,u,p,d,h,m,g){var y=f-r,x=l-o,b=y*y+x*x;if(b>4*e&&m--){var w=s+p,_=a+d,v=c+h,A=jt(w*w+_*_+v*v),E=Zt(v/=A),T=vt(vt(v)-1)<K||vt(i-u)<K?(i+u)/2:he(_,w),$=t(T,E),M=$[0],k=$[1],R=M-r,S=k-o,I=x*R-y*S;(I*I/b>e||vt((y*R+x*S)/b-.5)>.3||s*p+a*d+c*h<IY)&&(n(r,o,i,s,a,c,M,k,T,w/=A,_/=A,v,m,g),g.point(M,k),n(M,k,T,w,_,v,f,l,u,p,d,h,m,g))}}return function(r){var o,i,s,a,c,f,l,u,p,d,h,m,g={point:y,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=_},polygonEnd:function(){r.polygonEnd(),g.lineStart=x}};function y(E,T){E=t(E,T),r.point(E[0],E[1])}function x(){u=NaN,g.point=b,r.lineStart()}function b(E,T){var $=Hr([E,T]),M=t(E,T);n(u,p,l,d,h,m,u=M[0],p=M[1],l=E,d=$[0],h=$[1],m=$[2],k$,r),r.point(u,p)}function w(){g.point=y,r.lineEnd()}function _(){x(),g.point=v,g.lineEnd=A}function v(E,T){b(o=E,T),i=u,s=p,a=d,c=h,f=m,g.point=b}function A(){n(u,p,l,d,h,m,i,s,o,a,c,f,k$,r),g.lineEnd=w,w()}return g}}var kY=jc({point:function(t,e){this.stream.point(t*At,e*At)}});function NY(t){return jc({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function OY(t,e,n,r,o){function i(s,a){return s*=r,a*=o,[e+t*s,n-t*a]}return i.invert=function(s,a){return[(s-e)/t*r,(n-a)/t*o]},i}function N$(t,e,n,r,o,i){if(!i)return OY(t,e,n,r,o);var s=Q(i),a=Z(i),c=s*t,f=a*t,l=s/t,u=a/t,p=(a*n-s*e)/t,d=(a*e+s*n)/t;function h(m,g){return m*=r,g*=o,[c*m-f*g+e,n-f*m-c*g]}return h.invert=function(m,g){return[r*(l*m-u*g+p),o*(d-u*m-l*g)]},h}function Xe(t){return Av(function(){return t})()}function Av(t){var e,n=150,r=480,o=250,i=0,s=0,a=0,c=0,f=0,l,u=0,p=1,d=1,h=null,m=sv,g=null,y,x,b,w=Cu,_=.5,v,A,E,T,$;function M(I){return E(I[0]*At,I[1]*At)}function k(I){return I=E.invert(I[0],I[1]),I&&[I[0]*se,I[1]*se]}M.stream=function(I){return T&&$===I?T:T=kY(NY(l)(m(v(w($=I)))))},M.preclip=function(I){return arguments.length?(m=I,h=void 0,S()):m},M.postclip=function(I){return arguments.length?(w=I,g=y=x=b=null,S()):w},M.clipAngle=function(I){return arguments.length?(m=+I?p$(h=I*At):(h=null,sv),S()):h*se},M.clipExtent=function(I){return arguments.length?(w=I==null?(g=y=x=b=null,Cu):qc(g=+I[0][0],y=+I[0][1],x=+I[1][0],b=+I[1][1]),S()):g==null?null:[[g,y],[x,b]]},M.scale=function(I){return arguments.length?(n=+I,R()):n},M.translate=function(I){return arguments.length?(r=+I[0],o=+I[1],R()):[r,o]},M.center=function(I){return arguments.length?(i=I[0]%360*At,s=I[1]%360*At,R()):[i*se,s*se]},M.rotate=function(I){return arguments.length?(a=I[0]%360*At,c=I[1]%360*At,f=I.length>2?I[2]%360*At:0,R()):[a*se,c*se,f*se]},M.angle=function(I){return arguments.length?(u=I%360*At,R()):u*se},M.reflectX=function(I){return arguments.length?(p=I?-1:1,R()):p<0},M.reflectY=function(I){return arguments.length?(d=I?-1:1,R()):d<0},M.precision=function(I){return arguments.length?(v=Mv(A,_=I*I),S()):jt(_)},M.fitExtent=function(I,C){return Du(M,I,C)},M.fitSize=function(I,C){return z0(M,I,C)},M.fitWidth=function(I,C){return Y0(M,I,C)},M.fitHeight=function(I,C){return U0(M,I,C)};function R(){var I=N$(n,0,0,p,d,u).apply(null,e(i,s)),C=N$(n,r-I[0],o-I[1],p,d,u);return l=ov(a,c,f),A=Iu(e,C),E=Iu(l,A),v=Mv(A,_),S()}function S(){return T=$=null,M}return function(){return e=t.apply(this,arguments),M.invert=e.invert&&k,R()}}function Xc(t){var e=0,n=yt/3,r=Av(t),o=r(e,n);return o.parallels=function(i){return arguments.length?r(e=i[0]*At,n=i[1]*At):[e*se,n*se]},o}function O$(t){var e=Q(t);function n(r,o){return[r*e,Z(o)/e]}return n.invert=function(r,o){return[r/e,Zt(o*e)]},n}function R$(t,e){var n=Z(t),r=(n+Z(e))/2;if(vt(r)<K)return O$(t);var o=1+n*(2*r-n),i=jt(o)/r;function s(a,c){var f=jt(o-2*r*Z(c))/r;return[f*Z(a*=r),i-f*Q(a)]}return s.invert=function(a,c){var f=i-c,l=he(a,vt(f))*Ke(f);return f*r<0&&(l-=yt*Ke(a)*Ke(f)),[l/r,Zt((o-(a*a+f*f)*r*r)/(2*r))]},s}function Yi(){return Xc(R$).scale(155.424).center([0,33.6442])}function Pu(){return Yi().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function RY(t){var e=t.length;return{point:function(n,r){for(var o=-1;++o<e;)t[o].point(n,r)},sphere:function(){for(var n=-1;++n<e;)t[n].sphere()},lineStart:function(){for(var n=-1;++n<e;)t[n].lineStart()},lineEnd:function(){for(var n=-1;++n<e;)t[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<e;)t[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<e;)t[n].polygonEnd()}}}function Tv(){var t,e,n=Pu(),r,o=Yi().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=Yi().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,f={point:function(p,d){c=[p,d]}};function l(p){var d=p[0],h=p[1];return c=null,r.point(d,h),c||(i.point(d,h),c)||(a.point(d,h),c)}l.invert=function(p){var d=n.scale(),h=n.translate(),m=(p[0]-h[0])/d,g=(p[1]-h[1])/d;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?o:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(p)},l.stream=function(p){return t&&e===p?t:t=RY([n.stream(e=p),o.stream(p),s.stream(p)])},l.precision=function(p){return arguments.length?(n.precision(p),o.precision(p),s.precision(p),u()):n.precision()},l.scale=function(p){return arguments.length?(n.scale(p),o.scale(p*.35),s.scale(p),l.translate(n.translate())):n.scale()},l.translate=function(p){if(!arguments.length)return n.translate();var d=n.scale(),h=+p[0],m=+p[1];return r=n.translate(p).clipExtent([[h-.455*d,m-.238*d],[h+.455*d,m+.238*d]]).stream(f),i=o.translate([h-.307*d,m+.201*d]).clipExtent([[h-.425*d+K,m+.12*d+K],[h-.214*d-K,m+.234*d-K]]).stream(f),a=s.translate([h-.205*d,m+.212*d]).clipExtent([[h-.214*d+K,m+.166*d+K],[h-.115*d-K,m+.234*d-K]]).stream(f),u()},l.fitExtent=function(p,d){return Du(l,p,d)},l.fitSize=function(p,d){return z0(l,p,d)},l.fitWidth=function(p,d){return Y0(l,p,d)},l.fitHeight=function(p,d){return U0(l,p,d)};function u(){return t=e=null,l}return l.scale(1070)}function j0(t){return function(e,n){var r=Q(e),o=Q(n),i=t(r*o);return i===1/0?[2,0]:[i*o*Z(e),i*Z(n)]}}function Jr(t){return function(e,n){var r=jt(e*e+n*n),o=t(r),i=Z(o),s=Q(o);return[he(e*i,r*s),Zt(r&&n*i/r)]}}var Ev=j0(function(t){return jt(2/(1+t))});Ev.invert=Jr(function(t){return 2*Zt(t/2)});function Iv(){return Xe(Ev).scale(124.75).clipAngle(180-.001)}var $v=j0(function(t){return(t=b0(t))&&t/Z(t)});$v.invert=Jr(function(t){return t});function Cv(){return Xe($v).scale(79.4188).clipAngle(180-.001)}function Gc(t,e){return[t,ca(Dc((Ut+e)/2))]}Gc.invert=function(t,e){return[t,2*ar(g0(e))-Ut]};function kv(){return Nv(Gc).scale(961/Ee)}function Nv(t){var e=Xe(t),n=e.center,r=e.scale,o=e.translate,i=e.clipExtent,s=null,a,c,f;e.scale=function(u){return arguments.length?(r(u),l()):r()},e.translate=function(u){return arguments.length?(o(u),l()):o()},e.center=function(u){return arguments.length?(n(u),l()):n()},e.clipExtent=function(u){return arguments.length?(u==null?s=a=c=f=null:(s=+u[0][0],a=+u[0][1],c=+u[1][0],f=+u[1][1]),l()):s==null?null:[[s,a],[c,f]]};function l(){var u=yt*r(),p=e(a$(e.rotate()).invert([0,0]));return i(s==null?[[p[0]-u,p[1]-u],[p[0]+u,p[1]+u]]:t===Gc?[[Math.max(p[0]-u,s),a],[Math.min(p[0]+u,c),f]]:[[s,Math.max(p[1]-u,a)],[c,Math.min(p[1]+u,f)]])}return l()}function X0(t){return Dc((Ut+t)/2)}function L$(t,e){var n=Q(t),r=t===e?Z(t):ca(n/Q(e))/ca(X0(e)/X0(t)),o=n*x0(X0(t),r)/r;if(!r)return Gc;function i(s,a){o>0?a<-Ut+K&&(a=-Ut+K):a>Ut-K&&(a=Ut-K);var c=o/x0(X0(a),r);return[c*Z(r*s),o-c*Q(r*s)]}return i.invert=function(s,a){var c=o-a,f=Ke(r)*jt(s*s+c*c),l=he(s,vt(c))*Ke(c);return c*r<0&&(l-=yt*Ke(s)*Ke(c)),[l/r,2*ar(x0(o/f,1/r))-Ut]},i}function Ov(){return Xc(L$).scale(109.5).parallels([30,30])}function Vc(t,e){return[t,e]}Vc.invert=Vc;function Rv(){return Xe(Vc).scale(152.63)}function D$(t,e){var n=Q(t),r=t===e?Z(t):(n-Q(e))/(e-t),o=n/r+t;if(vt(r)<K)return Vc;function i(s,a){var c=o-a,f=r*s;return[c*Z(f),o-c*Q(f)]}return i.invert=function(s,a){var c=o-a,f=he(s,vt(c))*Ke(c);return c*r<0&&(f-=yt*Ke(s)*Ke(c)),[f/r,o-Ke(r)*jt(s*s+c*c)]},i}function Lv(){return Xc(D$).scale(131.154).center([0,13.9389])}var Fu=1.340264,qu=-.081106,Bu=893e-6,zu=.003796,G0=jt(3)/2,LY=12;function Dv(t,e){var n=Zt(G0*Z(e)),r=n*n,o=r*r*r;return[t*Q(n)/(G0*(Fu+3*qu*r+o*(7*Bu+9*zu*r))),n*(Fu+qu*r+o*(Bu+zu*r))]}Dv.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,i=0,s,a,c;i<LY&&(a=n*(Fu+qu*r+o*(Bu+zu*r))-e,c=Fu+3*qu*r+o*(7*Bu+9*zu*r),n-=s=a/c,r=n*n,o=r*r*r,!(vt(s)<aa));++i);return[G0*t*(Fu+3*qu*r+o*(7*Bu+9*zu*r))/Q(n),Zt(Z(n)/G0)]};function Pv(){return Xe(Dv).scale(177.158)}function Fv(t,e){var n=Q(e),r=Q(t)*n;return[n*Z(t)/r,Z(e)/r]}Fv.invert=Jr(ar);function qv(){return Xe(Fv).scale(144.049).clipAngle(60)}function Bv(t,e){return[Q(e)*Z(t),Z(e)]}Bv.invert=Jr(Zt);function zv(){return Xe(Bv).scale(249.5).clipAngle(90+K)}function Yv(t,e){var n=Q(e),r=1+Q(t)*n;return[n*Z(t)/r,Z(e)/r]}Yv.invert=Jr(function(t){return 2*ar(t)});function Uv(){return Xe(Yv).scale(250).clipAngle(142)}function jv(t,e){return[ca(Dc((Ut+e)/2)),-t]}jv.invert=function(t,e){return[-e,2*ar(g0(t))-Ut]};function Xv(){var t=Nv(jv),e=t.center,n=t.rotate;return t.center=function(r){return arguments.length?e([-r[1],r[0]]):(r=e(),[r[1],-r[0]])},t.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 DY(t,e){return t.parent===e.parent?1:2}function PY(t){return t.reduce(FY,0)/t.length}function FY(t,e){return t+e.x}function qY(t){return 1+t.reduce(BY,0)}function BY(t,e){return Math.max(t,e.y)}function zY(t){for(var e;e=t.children;)t=e[0];return t}function YY(t){for(var e;e=t.children;)t=e[e.length-1];return t}function V0(){var t=DY,e=1,n=1,r=!1;function o(i){var s,a=0;i.eachAfter(function(p){var d=p.children;d?(p.x=PY(d),p.y=qY(d)):(p.x=s?a+=t(p,s):0,p.y=0,s=p)});var c=zY(i),f=YY(i),l=c.x-t(c,f)/2,u=f.x+t(f,c)/2;return i.eachAfter(r?function(p){p.x=(p.x-i.x)*e,p.y=(i.y-p.y)*n}:function(p){p.x=(p.x-l)/(u-l)*e,p.y=(1-(i.y?p.y/i.y:1))*n})}return o.separation=function(i){return arguments.length?(t=i,o):t},o.size=function(i){return arguments.length?(r=!1,e=+i[0],n=+i[1],o):r?null:[e,n]},o.nodeSize=function(i){return arguments.length?(r=!0,e=+i[0],n=+i[1],o):r?[e,n]:null},o}function UY(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function P$(){return this.eachAfter(UY)}function F$(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}function q$(t,e){for(var n=this,r=[n],o,i,s=-1;n=r.pop();)if(t.call(e,n,++s,this),o=n.children)for(i=o.length-1;i>=0;--i)r.push(o[i]);return this}function B$(t,e){for(var n=this,r=[n],o=[],i,s,a,c=-1;n=r.pop();)if(o.push(n),i=n.children)for(s=0,a=i.length;s<a;++s)r.push(i[s]);for(;n=o.pop();)t.call(e,n,++c,this);return this}function z$(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}function Y$(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}function U$(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function j$(t){for(var e=this,n=jY(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function jY(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}function X$(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function G$(){return Array.from(this)}function V$(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function W$(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*H$(){var t=this,e,n=[t],r,o,i;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,i=r.length;o<i;++o)n.push(r[o]);while(n.length)}function Gv(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=VY)):e===void 0&&(e=GY);for(var n=new Ui(t),r,o=[n],i,s,a,c;r=o.pop();)if((s=e(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)o.push(i=s[a]=new Ui(s[a])),i.parent=r,i.depth=r.depth+1;return n.eachBefore(Vv)}function XY(){return Gv(this).eachBefore(WY)}function GY(t){return t.children}function VY(t){return Array.isArray(t)?t[1]:null}function WY(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Vv(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Ui(t){this.data=t,this.depth=this.height=0,this.parent=null}Ui.prototype=Gv.prototype={constructor:Ui,count:P$,each:F$,eachAfter:B$,eachBefore:q$,find:z$,sum:Y$,sort:U$,path:j$,ancestors:X$,descendants:G$,leaves:V$,links:W$,copy:XY,[Symbol.iterator]:H$};function W0(t){return t==null?null:HY(t)}function HY(t){if(typeof t!="function")throw new Error;return t}var ZY={depth:-1},Z$={},Wv={};function QY(t){return t.id}function JY(t){return t.parentId}function H0(){var t=QY,e=JY,n;function r(o){var i=Array.from(o),s=t,a=e,c,f,l,u,p,d,h,m,g=new Map;if(n!=null){let y=i.map((w,_)=>KY(n(w,_,o))),x=y.map(Q$),b=new Set(y).add("");for(let w of x)b.has(w)||(b.add(w),y.push(w),x.push(Q$(w)),i.push(Wv));s=(w,_)=>y[_],a=(w,_)=>x[_]}for(l=0,c=i.length;l<c;++l)f=i[l],d=i[l]=new Ui(f),(h=s(f,l,o))!=null&&(h+="")&&(m=d.id=h,g.set(m,g.has(m)?Z$:d)),(h=a(f,l,o))!=null&&(h+="")&&(d.parent=h);for(l=0;l<c;++l)if(d=i[l],h=d.parent){if(p=g.get(h),!p)throw new Error("missing: "+h);if(p===Z$)throw new Error("ambiguous: "+h);p.children?p.children.push(d):p.children=[d],d.parent=p}else{if(u)throw new Error("multiple roots");u=d}if(!u)throw new Error("no root");if(n!=null){for(;u.data===Wv&&u.children.length===1;)u=u.children[0],--c;for(let y=i.length-1;y>=0&&(d=i[y],d.data===Wv);--y)d.data=null}if(u.parent=ZY,u.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(Vv),u.parent=null,c>0)throw new Error("cycle");return u}return r.id=function(o){return arguments.length?(t=W0(o),r):t},r.parentId=function(o){return arguments.length?(e=W0(o),r):e},r.path=function(o){return arguments.length?(n=W0(o),r):n},r}function KY(t){t=`${t}`;let e=t.length;return Hv(t,e-1)&&!Hv(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function Q$(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Hv(t,e););return t.slice(0,e)}function Hv(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}function tU(t,e){return t.parent===e.parent?1:2}function Zv(t){var e=t.children;return e?e[0]:t.t}function Qv(t){var e=t.children;return e?e[e.length-1]:t.t}function eU(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function nU(t){for(var e=0,n=0,r=t.children,o=r.length,i;--o>=0;)i=r[o],i.z+=e,i.m+=e,e+=i.s+(n+=i.c)}function rU(t,e,n){return t.a.parent===e.parent?t.a:n}function Z0(t,e){this._=t,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=e}Z0.prototype=Object.create(Ui.prototype);function oU(t){for(var e=new Z0(t,0),n,r=[e],o,i,s,a;n=r.pop();)if(i=n._.children)for(n.children=new Array(a=i.length),s=a-1;s>=0;--s)r.push(o=n.children[s]=new Z0(i[s],s)),o.parent=n;return(e.parent=new Z0(null,0)).children=[e],e}function ua(){var t=tU,e=1,n=1,r=null;function o(f){var l=oU(f);if(l.eachAfter(i),l.parent.m=-l.z,l.eachBefore(s),r)f.eachBefore(c);else{var u=f,p=f,d=f;f.eachBefore(function(x){x.x<u.x&&(u=x),x.x>p.x&&(p=x),x.depth>d.depth&&(d=x)});var h=u===p?1:t(u,p)/2,m=h-u.x,g=e/(p.x+h+m),y=n/(d.depth||1);f.eachBefore(function(x){x.x=(x.x+m)*g,x.y=x.depth*y})}return f}function i(f){var l=f.children,u=f.parent.children,p=f.i?u[f.i-1]:null;if(l){nU(f);var d=(l[0].z+l[l.length-1].z)/2;p?(f.z=p.z+t(f._,p._),f.m=f.z-d):f.z=d}else p&&(f.z=p.z+t(f._,p._));f.parent.A=a(f,p,f.parent.A||u[0])}function s(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function a(f,l,u){if(l){for(var p=f,d=f,h=l,m=p.parent.children[0],g=p.m,y=d.m,x=h.m,b=m.m,w;h=Qv(h),p=Zv(p),h&&p;)m=Zv(m),d=Qv(d),d.a=f,w=h.z+x-p.z-g+t(h._,p._),w>0&&(eU(rU(h,f,u),f,w),g+=w,y+=w),x+=h.m,g+=p.m,b+=m.m,y+=d.m;h&&!Qv(d)&&(d.t=h,d.m+=x-y),p&&!Zv(m)&&(m.t=p,m.m+=g-b,u=f)}return u}function c(f){f.x*=e,f.y=f.depth*n}return o.separation=function(f){return arguments.length?(t=f,o):t},o.size=function(f){return arguments.length?(r=!1,e=+f[0],n=+f[1],o):r?null:[e,n]},o.nodeSize=function(f){return arguments.length?(r=!0,e=+f[0],n=+f[1],o):r?[e,n]:null},o}var J$=23283064365386963e-26;function pa(t=Math.random()){let e=(0<=t&&t<1?t/J$:Math.abs(t))|0;return()=>(e=1664525*e+1013904223|0,J$*(e>>>0))}function ge(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Yu(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}var Uu=Symbol("implicit");function da(){var t=new cn,e=[],n=[],r=Uu;function o(i){let s=t.get(i);if(s===void 0){if(r!==Uu)return r;t.set(i,s=e.push(i)-1)}return n[s%n.length]}return o.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new cn;for(let s of i)t.has(s)||t.set(s,e.push(s)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return da(e,n).unknown(r)},ge.apply(o,arguments),o}function ji(){var t=da().unknown(void 0),e=t.domain,n=t.range,r=0,o=1,i,s,a=!1,c=0,f=0,l=.5;delete t.unknown;function u(){var p=e().length,d=o<r,h=d?o:r,m=d?r:o;i=(m-h)/Math.max(1,p-c+f*2),a&&(i=Math.floor(i)),h+=(m-h-i*(p-c))*l,s=i*(1-c),a&&(h=Math.round(h),s=Math.round(s));var g=ce(p).map(function(y){return h+i*y});return n(d?g.reverse():g)}return t.domain=function(p){return arguments.length?(e(p),u()):e()},t.range=function(p){return arguments.length?([r,o]=p,r=+r,o=+o,u()):[r,o]},t.rangeRound=function(p){return[r,o]=p,r=+r,o=+o,a=!0,u()},t.bandwidth=function(){return s},t.step=function(){return i},t.round=function(p){return arguments.length?(a=!!p,u()):a},t.padding=function(p){return arguments.length?(c=Math.min(1,f=+p),u()):c},t.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),u()):c},t.paddingOuter=function(p){return arguments.length?(f=+p,u()):f},t.align=function(p){return arguments.length?(l=Math.max(0,Math.min(1,p)),u()):l},t.copy=function(){return ji(e(),[r,o]).round(a).paddingInner(c).paddingOuter(f).align(l)},ge.apply(u(),arguments)}function K$(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return K$(e())},t}function Jv(){return K$(ji.apply(null,arguments).paddingInner(1))}function Kv(t){return function(){return t}}function Wc(t){return+t}var t9=[0,1];function $n(t){return t}function t_(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Kv(isNaN(e)?NaN:.5)}function iU(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function sU(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=t_(o,r),i=n(s,i)):(r=t_(r,o),i=n(i,s)),function(a){return i(r(a))}}function aU(t,e,n){var r=Math.min(t.length,e.length)-1,o=new Array(r),i=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)o[s]=t_(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=Lo(t,a,1,r)-1;return i[c](o[c](a))}}function Kr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ha(){var t=t9,e=t9,n=Fn,r,o,i,s=$n,a,c,f;function l(){var p=Math.min(t.length,e.length);return s!==$n&&(s=iU(t[0],t[p-1])),a=p>2?aU:sU,c=f=null,u}function u(p){return p==null||isNaN(p=+p)?i:(c||(c=a(t.map(r),e,n)))(r(s(p)))}return u.invert=function(p){return s(o((f||(f=a(e,t.map(r),Ht)))(p)))},u.domain=function(p){return arguments.length?(t=Array.from(p,Wc),l()):t.slice()},u.range=function(p){return arguments.length?(e=Array.from(p),l()):e.slice()},u.rangeRound=function(p){return e=Array.from(p),n=ea,l()},u.clamp=function(p){return arguments.length?(s=p?!0:$n,l()):s!==$n},u.interpolate=function(p){return arguments.length?(n=p,l()):n},u.unknown=function(p){return arguments.length?(i=p,u):i},function(p,d){return r=p,o=d,l()}}function ju(){return ha()($n,$n)}function e_(t,e,n,r){var o=yc(t,e,n),i;switch(r=Wr(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=Ww(o,s))&&(r.precision=i),m0(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Hw(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Vw(o))&&(r.precision=i-(r.type==="%")*2);break}}return sr(r)}function Vo(t){var e=t.domain;return t.ticks=function(n){var r=e();return Ye(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return e_(o[0],o[o.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),o=0,i=r.length-1,s=r[o],a=r[i],c,f,l=10;for(a<s&&(f=s,s=a,a=f,f=o,o=i,i=f);l-- >0;){if(f=Po(s,a,n),f===c)return r[o]=s,r[i]=a,e(r);if(f>0)s=Math.floor(s/f)*f,a=Math.ceil(a/f)*f;else if(f<0)s=Math.ceil(s*f)/f,a=Math.floor(a*f)/f;else break;c=f}return t},t}function Wo(){var t=ju();return t.copy=function(){return Kr(t,Wo())},ge.apply(t,arguments),Vo(t)}function Xu(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Wc),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return Xu(t).unknown(e)},t=arguments.length?Array.from(t,Wc):[0,1],Vo(n)}function Gu(t,e){t=t.slice();var n=0,r=t.length-1,o=t[n],i=t[r],s;return i<o&&(s=n,n=r,r=s,s=o,o=i,i=s),t[n]=e.floor(o),t[r]=e.ceil(i),t}function e9(t){return Math.log(t)}function n9(t){return Math.exp(t)}function cU(t){return-Math.log(-t)}function fU(t){return-Math.exp(-t)}function lU(t){return isFinite(t)?+("1e"+t):t<0?0:t}function uU(t){return t===10?lU:t===Math.E?Math.exp:e=>Math.pow(t,e)}function pU(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function r9(t){return(e,n)=>-t(-e,n)}function n_(t){let e=t(e9,n9),n=e.domain,r=10,o,i;function s(){return o=pU(r),i=uU(r),n()[0]<0?(o=r9(o),i=r9(i),t(cU,fU)):t(e9,n9),e}return e.base=function(a){return arguments.length?(r=+a,s()):r},e.domain=function(a){return arguments.length?(n(a),s()):n()},e.ticks=a=>{let c=n(),f=c[0],l=c[c.length-1],u=l<f;u&&([f,l]=[l,f]);let p=o(f),d=o(l),h,m,g=a==null?10:+a,y=[];if(!(r%1)&&d-p<g){if(p=Math.floor(p),d=Math.ceil(d),f>0){for(;p<=d;++p)for(h=1;h<r;++h)if(m=p<0?h/i(-p):h*i(p),!(m<f)){if(m>l)break;y.push(m)}}else for(;p<=d;++p)for(h=r-1;h>=1;--h)if(m=p>0?h/i(-p):h*i(p),!(m<f)){if(m>l)break;y.push(m)}y.length*2<g&&(y=Ye(f,l,g))}else y=Ye(p,d,Math.min(d-p,g)).map(i);return u?y.reverse():y},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Wr(c)).precision==null&&(c.trim=!0),c=sr(c)),a===1/0)return c;let f=Math.max(1,r*a/e.ticks().length);return l=>{let u=l/i(Math.round(o(l)));return u*r<r-.5&&(u*=r),u<=f?c(l):""}},e.nice=()=>n(Gu(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function Vu(){let t=n_(ha()).domain([1,10]);return t.copy=()=>Kr(t,Vu()).base(t.base()),ge.apply(t,arguments),t}function o9(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function i9(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function r_(t){var e=1,n=t(o9(e),i9(e));return n.constant=function(r){return arguments.length?t(o9(e=+r),i9(e)):e},Vo(n)}function Wu(){var t=r_(ha());return t.copy=function(){return Kr(t,Wu()).constant(t.constant())},ge.apply(t,arguments)}function s9(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function dU(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function hU(t){return t<0?-t*t:t*t}function o_(t){var e=t($n,$n),n=1;function r(){return n===1?t($n,$n):n===.5?t(dU,hU):t(s9(n),s9(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},Vo(e)}function Hu(){var t=o_(ha());return t.copy=function(){return Kr(t,Hu()).exponent(t.exponent())},ge.apply(t,arguments),t}function Zu(){var t=[],e=[],n=[],r;function o(){var s=0,a=Math.max(1,e.length);for(n=new Array(a-1);++s<a;)n[s-1]=rw(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[Lo(n,s)]}return i.invertExtent=function(s){var a=e.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},i.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let a of s)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(gt),o()},i.range=function(s){return arguments.length?(e=Array.from(s),o()):e.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return Zu().domain(t).range(e).unknown(r)},ge.apply(i,arguments)}function Qu(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[Lo(t,i,0,r)]:n}return o.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),o):t.slice()},o.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),o):e.slice()},o.invertExtent=function(i){var s=e.indexOf(i);return[t[s-1],t[s]]},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return Qu().domain(t).range(e).unknown(n)},ge.apply(o,arguments)}var i_=new Date,s_=new Date;function Gt(t,e,n,r){function o(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return o.floor=i=>(t(i=new Date(+i)),i),o.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),o.round=i=>{let s=o(i),a=o.ceil(i);return i-s<a-i?s:a},o.offset=(i,s)=>(e(i=new Date(+i),s==null?1:Math.floor(s)),i),o.range=(i,s,a)=>{let c=[];if(i=o.ceil(i),a=a==null?1:Math.floor(a),!(i<s)||!(a>0))return c;let f;do c.push(f=new Date(+i)),e(i,a),t(i);while(f<i&&i<s);return c},o.filter=i=>Gt(s=>{if(s>=s)for(;t(s),!i(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;e(s,-1),!i(s););else for(;--a>=0;)for(;e(s,1),!i(s););}),n&&(o.count=(i,s)=>(i_.setTime(+i),s_.setTime(+s),t(i_),t(s_),Math.floor(n(i_,s_))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(r?s=>r(s)%i===0:s=>o.count(0,s)%i===0):o)),o}var Ju=Gt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ju.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Gt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Ju);var F2t=Ju.range;var $e=Gt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),a9=$e.range;var Ho=Gt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),mU=Ho.range,Zo=Gt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),gU=Zo.range;var Qo=Gt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),yU=Qo.range,Jo=Gt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),xU=Jo.range;var cr=Gt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),bU=cr.range,ya=Gt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),wU=ya.range,xa=Gt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),vU=xa.range;function ba(t){return Gt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}var Bn=ba(0),Xi=ba(1),Q0=ba(2),J0=ba(3),eo=ba(4),K0=ba(5),tg=ba(6),f9=Bn.range,_U=Xi.range,SU=Q0.range,MU=J0.range,AU=eo.range,TU=K0.range,EU=tg.range;function wa(t){return Gt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/6048e5)}var zn=wa(0),Gi=wa(1),eg=wa(2),ng=wa(3),no=wa(4),rg=wa(5),og=wa(6),l9=zn.range,IU=Gi.range,$U=eg.range,CU=ng.range,kU=no.range,NU=rg.range,OU=og.range;var Ko=Gt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),RU=Ko.range,ti=Gt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),LU=ti.range;var tn=Gt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());tn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Gt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});var DU=tn.range,en=Gt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());en.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Gt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});var PU=en.range;function p9(t,e,n,r,o,i){let s=[[$e,1,1e3],[$e,5,5*1e3],[$e,15,15*1e3],[$e,30,30*1e3],[i,1,6e4],[i,5,5*6e4],[i,15,15*6e4],[i,30,30*6e4],[o,1,36e5],[o,3,3*36e5],[o,6,6*36e5],[o,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function a(f,l,u){let p=l<f;p&&([f,l]=[l,f]);let d=u&&typeof u.range=="function"?u:c(f,l,u),h=d?d.range(f,+l+1):[];return p?h.reverse():h}function c(f,l,u){let p=Math.abs(l-f)/u,d=wr(([,,g])=>g).right(s,p);if(d===s.length)return t.every(yc(f/31536e6,l/31536e6,u));if(d===0)return Ju.every(Math.max(yc(f,l,u),1));let[h,m]=s[p/s[d-1][2]<s[d][2]/p?d-1:d];return h.every(m)}return[a,c]}var[a_,tp]=p9(en,ti,zn,xa,Jo,Zo),[c_,f_]=p9(tn,Ko,Bn,cr,Qo,Ho);function l_(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function u_(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ep(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function p_(t){var e=t.dateTime,n=t.date,r=t.time,o=t.periods,i=t.days,s=t.shortDays,a=t.months,c=t.shortMonths,f=np(o),l=rp(o),u=np(i),p=rp(i),d=np(s),h=rp(s),m=np(a),g=rp(a),y=np(c),x=rp(c),b={a:N,A:D,b:L,B:P,c:null,d:x9,e:x9,f:aj,g:yj,G:bj,H:oj,I:ij,j:sj,L:S9,m:cj,M:fj,p:F,q,Q:v9,s:_9,S:lj,u:uj,U:pj,V:dj,w:hj,W:mj,x:null,X:null,y:gj,Y:xj,Z:wj,"%":w9},w={a:W,A:tt,b:nt,B:ot,c:null,d:b9,e:b9,f:Mj,g:Rj,G:Dj,H:vj,I:_j,j:Sj,L:A9,m:Aj,M:Tj,p:X,q:rt,Q:v9,s:_9,S:Ej,u:Ij,U:$j,V:Cj,w:kj,W:Nj,x:null,X:null,y:Oj,Y:Lj,Z:Pj,"%":w9},_={a:$,A:M,b:k,B:R,c:S,d:g9,e:g9,f:tj,g:m9,G:h9,H:y9,I:y9,j:ZU,L:KU,m:HU,M:QU,p:T,q:WU,Q:nj,s:rj,S:JU,u:UU,U:jU,V:XU,w:YU,W:GU,x:I,X:C,y:m9,Y:h9,Z:VU,"%":ej};b.x=v(n,b),b.X=v(r,b),b.c=v(e,b),w.x=v(n,w),w.X=v(r,w),w.c=v(e,w);function v(Y,H){return function(et){var B=[],wt=-1,ct=0,It=Y.length,kt,J,qt;for(et instanceof Date||(et=new Date(+et));++wt<It;)Y.charCodeAt(wt)===37&&(B.push(Y.slice(ct,wt)),(J=d9[kt=Y.charAt(++wt)])!=null?kt=Y.charAt(++wt):J=kt==="e"?" ":"0",(qt=H[kt])&&(kt=qt(et,J)),B.push(kt),ct=wt+1);return B.push(Y.slice(ct,wt)),B.join("")}}function A(Y,H){return function(et){var B=ep(1900,void 0,1),wt=E(B,Y,et+="",0),ct,It;if(wt!=et.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(H&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(ct=u_(ep(B.y,0,1)),It=ct.getUTCDay(),ct=It>4||It===0?Gi.ceil(ct):Gi(ct),ct=ya.offset(ct,(B.V-1)*7),B.y=ct.getUTCFullYear(),B.m=ct.getUTCMonth(),B.d=ct.getUTCDate()+(B.w+6)%7):(ct=l_(ep(B.y,0,1)),It=ct.getDay(),ct=It>4||It===0?Xi.ceil(ct):Xi(ct),ct=cr.offset(ct,(B.V-1)*7),B.y=ct.getFullYear(),B.m=ct.getMonth(),B.d=ct.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),It="Z"in B?u_(ep(B.y,0,1)).getUTCDay():l_(ep(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(It+5)%7:B.w+B.U*7-(It+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,u_(B)):l_(B)}}function E(Y,H,et,B){for(var wt=0,ct=H.length,It=et.length,kt,J;wt<ct;){if(B>=It)return-1;if(kt=H.charCodeAt(wt++),kt===37){if(kt=H.charAt(wt++),J=_[kt in d9?H.charAt(wt++):kt],!J||(B=J(Y,et,B))<0)return-1}else if(kt!=et.charCodeAt(B++))return-1}return B}function T(Y,H,et){var B=f.exec(H.slice(et));return B?(Y.p=l.get(B[0].toLowerCase()),et+B[0].length):-1}function $(Y,H,et){var B=d.exec(H.slice(et));return B?(Y.w=h.get(B[0].toLowerCase()),et+B[0].length):-1}function M(Y,H,et){var B=u.exec(H.slice(et));return B?(Y.w=p.get(B[0].toLowerCase()),et+B[0].length):-1}function k(Y,H,et){var B=y.exec(H.slice(et));return B?(Y.m=x.get(B[0].toLowerCase()),et+B[0].length):-1}function R(Y,H,et){var B=m.exec(H.slice(et));return B?(Y.m=g.get(B[0].toLowerCase()),et+B[0].length):-1}function S(Y,H,et){return E(Y,e,H,et)}function I(Y,H,et){return E(Y,n,H,et)}function C(Y,H,et){return E(Y,r,H,et)}function N(Y){return s[Y.getDay()]}function D(Y){return i[Y.getDay()]}function L(Y){return c[Y.getMonth()]}function P(Y){return a[Y.getMonth()]}function F(Y){return o[+(Y.getHours()>=12)]}function q(Y){return 1+~~(Y.getMonth()/3)}function W(Y){return s[Y.getUTCDay()]}function tt(Y){return i[Y.getUTCDay()]}function nt(Y){return c[Y.getUTCMonth()]}function ot(Y){return a[Y.getUTCMonth()]}function X(Y){return o[+(Y.getUTCHours()>=12)]}function rt(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var H=v(Y+="",b);return H.toString=function(){return Y},H},parse:function(Y){var H=A(Y+="",!1);return H.toString=function(){return Y},H},utcFormat:function(Y){var H=v(Y+="",w);return H.toString=function(){return Y},H},utcParse:function(Y){var H=A(Y+="",!0);return H.toString=function(){return Y},H}}}var d9={"-":"",_:" ",0:"0"},Ce=/^\s*\d+/,qU=/^%/,BU=/[\\^$*+?|[\]().{}]/g;function Lt(t,e,n){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(e)+o:o)}function zU(t){return t.replace(BU,"\\$&")}function np(t){return new RegExp("^(?:"+t.map(zU).join("|")+")","i")}function rp(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function YU(t,e,n){var r=Ce.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function UU(t,e,n){var r=Ce.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function jU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function XU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function GU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function h9(t,e,n){var r=Ce.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function m9(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function VU(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function WU(t,e,n){var r=Ce.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function HU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function g9(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ZU(t,e,n){var r=Ce.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function y9(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function QU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function JU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function KU(t,e,n){var r=Ce.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function tj(t,e,n){var r=Ce.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ej(t,e,n){var r=qU.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function nj(t,e,n){var r=Ce.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function rj(t,e,n){var r=Ce.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function x9(t,e){return Lt(t.getDate(),e,2)}function oj(t,e){return Lt(t.getHours(),e,2)}function ij(t,e){return Lt(t.getHours()%12||12,e,2)}function sj(t,e){return Lt(1+cr.count(tn(t),t),e,3)}function S9(t,e){return Lt(t.getMilliseconds(),e,3)}function aj(t,e){return S9(t,e)+"000"}function cj(t,e){return Lt(t.getMonth()+1,e,2)}function fj(t,e){return Lt(t.getMinutes(),e,2)}function lj(t,e){return Lt(t.getSeconds(),e,2)}function uj(t){var e=t.getDay();return e===0?7:e}function pj(t,e){return Lt(Bn.count(tn(t)-1,t),e,2)}function M9(t){var e=t.getDay();return e>=4||e===0?eo(t):eo.ceil(t)}function dj(t,e){return t=M9(t),Lt(eo.count(tn(t),t)+(tn(t).getDay()===4),e,2)}function hj(t){return t.getDay()}function mj(t,e){return Lt(Xi.count(tn(t)-1,t),e,2)}function gj(t,e){return Lt(t.getFullYear()%100,e,2)}function yj(t,e){return t=M9(t),Lt(t.getFullYear()%100,e,2)}function xj(t,e){return Lt(t.getFullYear()%1e4,e,4)}function bj(t,e){var n=t.getDay();return t=n>=4||n===0?eo(t):eo.ceil(t),Lt(t.getFullYear()%1e4,e,4)}function wj(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Lt(e/60|0,"0",2)+Lt(e%60,"0",2)}function b9(t,e){return Lt(t.getUTCDate(),e,2)}function vj(t,e){return Lt(t.getUTCHours(),e,2)}function _j(t,e){return Lt(t.getUTCHours()%12||12,e,2)}function Sj(t,e){return Lt(1+ya.count(en(t),t),e,3)}function A9(t,e){return Lt(t.getUTCMilliseconds(),e,3)}function Mj(t,e){return A9(t,e)+"000"}function Aj(t,e){return Lt(t.getUTCMonth()+1,e,2)}function Tj(t,e){return Lt(t.getUTCMinutes(),e,2)}function Ej(t,e){return Lt(t.getUTCSeconds(),e,2)}function Ij(t){var e=t.getUTCDay();return e===0?7:e}function $j(t,e){return Lt(zn.count(en(t)-1,t),e,2)}function T9(t){var e=t.getUTCDay();return e>=4||e===0?no(t):no.ceil(t)}function Cj(t,e){return t=T9(t),Lt(no.count(en(t),t)+(en(t).getUTCDay()===4),e,2)}function kj(t){return t.getUTCDay()}function Nj(t,e){return Lt(Gi.count(en(t)-1,t),e,2)}function Oj(t,e){return Lt(t.getUTCFullYear()%100,e,2)}function Rj(t,e){return t=T9(t),Lt(t.getUTCFullYear()%100,e,2)}function Lj(t,e){return Lt(t.getUTCFullYear()%1e4,e,4)}function Dj(t,e){var n=t.getUTCDay();return t=n>=4||n===0?no(t):no.ceil(t),Lt(t.getUTCFullYear()%1e4,e,4)}function Pj(){return"+0000"}function w9(){return"%"}function v9(t){return+t}function _9(t){return Math.floor(+t/1e3)}var Hc,Zc,E9,ro,I9;d_({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 d_(t){return Hc=p_(t),Zc=Hc.format,E9=Hc.parse,ro=Hc.utcFormat,I9=Hc.utcParse,Hc}function Fj(t){return new Date(t)}function qj(t){return t instanceof Date?+t:+new Date(+t)}function ig(t,e,n,r,o,i,s,a,c,f){var l=ju(),u=l.invert,p=l.domain,d=f(".%L"),h=f(":%S"),m=f("%I:%M"),g=f("%I %p"),y=f("%a %d"),x=f("%b %d"),b=f("%B"),w=f("%Y");function _(v){return(c(v)<v?d:a(v)<v?h:s(v)<v?m:i(v)<v?g:r(v)<v?o(v)<v?y:x:n(v)<v?b:w)(v)}return l.invert=function(v){return new Date(u(v))},l.domain=function(v){return arguments.length?p(Array.from(v,qj)):p().map(Fj)},l.ticks=function(v){var A=p();return t(A[0],A[A.length-1],v??10)},l.tickFormat=function(v,A){return A==null?_:f(A)},l.nice=function(v){var A=p();return(!v||typeof v.range!="function")&&(v=e(A[0],A[A.length-1],v??10)),v?p(Gu(A,v)):l},l.copy=function(){return Kr(l,ig(t,e,n,r,o,i,s,a,c,f))},l}function sg(){return ge.apply(ig(c_,f_,tn,Ko,Bn,cr,Qo,Ho,$e,Zc).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ag(){return ge.apply(ig(a_,tp,en,ti,zn,ya,Jo,Zo,$e,ro).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function op(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function cg(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,f=$n,l,u=!1,p;function d(m){return isNaN(m=+m)?p:(m=.5+((m=+l(m))-i)*(r*m<r*i?a:c),f(u?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([t,e,n]=m,o=l(t=+t),i=l(e=+e),s=l(n=+n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,d):[t,e,n]},d.clamp=function(m){return arguments.length?(u=!!m,d):u},d.interpolator=function(m){return arguments.length?(f=m,d):f};function h(m){return function(g){var y,x,b;return arguments.length?([y,x,b]=g,f=jr(m,[y,x,b]),d):[f(0),f(.5),f(1)]}}return d.range=h(Fn),d.rangeRound=h(ea),d.unknown=function(m){return arguments.length?(p=m,d):p},function(m){return l=m,o=m(t),i=m(e),s=m(n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,d}}function ip(){var t=Vo(cg()($n));return t.copy=function(){return op(t,ip())},Yu.apply(t,arguments)}function fg(){var t=n_(cg()).domain([.1,1,10]);return t.copy=function(){return op(t,fg()).base(t.base())},Yu.apply(t,arguments)}function lg(){var t=r_(cg());return t.copy=function(){return op(t,lg()).constant(t.constant())},Yu.apply(t,arguments)}function ug(){var t=o_(cg());return t.copy=function(){return op(t,ug()).exponent(t.exponent())},Yu.apply(t,arguments)}function G(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}var h_=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var m_=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var g_=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var y_=G("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var x_=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var b_=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var w_=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var v_=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var __=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var S_=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var M_=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var lt=t=>bw(t[t.length-1]);var pg=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),dg=lt(pg);var hg=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),mg=lt(hg);var gg=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),yg=lt(gg);var xg=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),bg=lt(xg);var sp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),Qc=lt(sp);var wg=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),vg=lt(wg);var ap=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),Jc=lt(ap);var _g=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),Sg=lt(_g);var Mg=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),Ag=lt(Mg);var Tg=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Eg=lt(Tg);var Ig=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),$g=lt(Ig);var Cg=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),kg=lt(Cg);var Ng=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Og=lt(Ng);var Rg=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),Lg=lt(Rg);var Dg=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Pg=lt(Dg);var Fg=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),qg=lt(Fg);var Bg=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),zg=lt(Bg);var Yg=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),Ug=lt(Yg);var jg=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),Xg=lt(jg);var Gg=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),Vg=lt(Gg);var Wg=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),Hg=lt(Wg);var Zg=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),Qg=lt(Zg);var Jg=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),Kg=lt(Jg);var ty=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),ey=lt(ty);var ny=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),ry=lt(ny);var oy=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),iy=lt(oy);var sy=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),ay=lt(sy);function cy(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}var fy=Tc(pn(300,.5,0),pn(-240,.5,1));var uy=Tc(pn(-100,.75,.35),pn(80,1.5,.8)),py=Tc(pn(260,.75,.35),pn(80,1.5,.8)),ly=pn();function dy(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return ly.h=360*t-100,ly.s=1.5-1.5*e,ly.l=.8-.9*e,ly+""}var hy=ve(),Bj=Math.PI/3,zj=Math.PI*2/3;function my(t){var e;return t=(.5-t)*Math.PI,hy.r=255*(e=Math.sin(t))*e,hy.g=255*(e=Math.sin(t+Bj))*e,hy.b=255*(e=Math.sin(t+zj))*e,hy+""}function gy(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function yy(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var xy=yy(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),by=yy(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),wy=yy(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),vy=yy(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function ye(t){return function(){return t}}var A_=Math.cos;var Kc=Math.min,cp=Math.sin,Dt=Math.sqrt,T_=1e-12,va=Math.PI,f3t=va/2,tf=2*va;function _y(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new Fi(e)}var d3t=Array.prototype.slice;function Sy(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $9(t){this._context=t}$9.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function ei(t){return new $9(t)}function My(t){return t[0]}function Ay(t){return t[1]}function fp(t,e){var n=ye(!0),r=null,o=ei,i=null,s=_y(a);t=typeof t=="function"?t:t===void 0?My:ye(t),e=typeof e=="function"?e:e===void 0?Ay:ye(e);function a(c){var f,l=(c=Sy(c)).length,u,p=!1,d;for(r==null&&(i=o(d=s())),f=0;f<=l;++f)!(f<l&&n(u=c[f],f,c))===p&&((p=!p)?i.lineStart():i.lineEnd()),p&&i.point(+t(u,f,c),+e(u,f,c));if(d)return i=null,d+""||null}return a.x=function(c){return arguments.length?(t=typeof c=="function"?c:ye(+c),a):t},a.y=function(c){return arguments.length?(e=typeof c=="function"?c:ye(+c),a):e},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:ye(!!c),a):n},a.curve=function(c){return arguments.length?(o=c,r!=null&&(i=o(r)),a):o},a.context=function(c){return arguments.length?(c==null?r=i=null:i=o(r=c),a):r},a}function ef(t,e,n){var r=null,o=ye(!0),i=null,s=ei,a=null,c=_y(f);t=typeof t=="function"?t:t===void 0?My:ye(+t),e=typeof e=="function"?e:e===void 0?ye(0):ye(+e),n=typeof n=="function"?n:n===void 0?Ay:ye(+n);function f(u){var p,d,h,m=(u=Sy(u)).length,g,y=!1,x,b=new Array(m),w=new Array(m);for(i==null&&(a=s(x=c())),p=0;p<=m;++p){if(!(p<m&&o(g=u[p],p,u))===y)if(y=!y)d=p,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),h=p-1;h>=d;--h)a.point(b[h],w[h]);a.lineEnd(),a.areaEnd()}y&&(b[p]=+t(g,p,u),w[p]=+e(g,p,u),a.point(r?+r(g,p,u):b[p],n?+n(g,p,u):w[p]))}if(x)return a=null,x+""||null}function l(){return fp().defined(o).curve(s).context(i)}return f.x=function(u){return arguments.length?(t=typeof u=="function"?u:ye(+u),r=null,f):t},f.x0=function(u){return arguments.length?(t=typeof u=="function"?u:ye(+u),f):t},f.x1=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:ye(+u),f):r},f.y=function(u){return arguments.length?(e=typeof u=="function"?u:ye(+u),n=null,f):e},f.y0=function(u){return arguments.length?(e=typeof u=="function"?u:ye(+u),f):e},f.y1=function(u){return arguments.length?(n=u==null?null:typeof u=="function"?u:ye(+u),f):n},f.lineX0=f.lineY0=function(){return l().x(t).y(e)},f.lineY1=function(){return l().x(t).y(n)},f.lineX1=function(){return l().x(r).y(e)},f.defined=function(u){return arguments.length?(o=typeof u=="function"?u:ye(!!u),f):o},f.curve=function(u){return arguments.length?(s=u,i!=null&&(a=s(i)),f):s},f.context=function(u){return arguments.length?(u==null?i=a=null:a=s(i=u),f):i},f}var Ty=class{constructor(e,n){this._context=e,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(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}};function E_(t){return new Ty(t,!0)}function I_(t){return new Ty(t,!1)}var Yj=Dt(3),lp={draw(t,e){let n=Dt(e+Kc(e/28,.75))*.59436,r=n/2,o=r*Yj;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-o,-r),t.lineTo(o,r),t.moveTo(-o,r),t.lineTo(o,-r)}};var ni={draw(t,e){let n=Dt(e/va);t.moveTo(n,0),t.arc(0,0,n,0,tf)}};var up={draw(t,e){let n=Dt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};var C9=Dt(1/3),Uj=C9*2,pp={draw(t,e){let n=Dt(e/Uj),r=n*C9;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}};var dp={draw(t,e){let n=Dt(e)*.62625;t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}};var hp={draw(t,e){let n=Dt(e-Kc(e/7,2))*.87559;t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}};var mp={draw(t,e){let n=Dt(e),r=-n/2;t.rect(r,r,n,n)}};var gp={draw(t,e){let n=Dt(e)*.4431;t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};var jj=.8908130915292852,k9=cp(va/10)/cp(7*va/10),Xj=cp(tf/10)*k9,Gj=-A_(tf/10)*k9,yp={draw(t,e){let n=Dt(e*jj),r=Xj*n,o=Gj*n;t.moveTo(0,-n),t.lineTo(r,o);for(let i=1;i<5;++i){let s=tf*i/5,a=A_(s),c=cp(s);t.lineTo(c*n,-a*n),t.lineTo(a*r-c*o,c*r+a*o)}t.closePath()}};var $_=Dt(3),xp={draw(t,e){let n=-Dt(e/($_*3));t.moveTo(0,n*2),t.lineTo(-$_*n,-n),t.lineTo($_*n,-n),t.closePath()}};var Vj=Dt(3),bp={draw(t,e){let n=Dt(e)*.6824,r=n/2,o=n*Vj/2;t.moveTo(0,-n),t.lineTo(o,r),t.lineTo(-o,r),t.closePath()}};var fr=-.5,lr=Dt(3)/2,C_=1/Dt(12),Wj=(C_/2+1)*3,wp={draw(t,e){let n=Dt(e/Wj),r=n/2,o=n*C_,i=r,s=n*C_+n,a=-i,c=s;t.moveTo(r,o),t.lineTo(i,s),t.lineTo(a,c),t.lineTo(fr*r-lr*o,lr*r+fr*o),t.lineTo(fr*i-lr*s,lr*i+fr*s),t.lineTo(fr*a-lr*c,lr*a+fr*c),t.lineTo(fr*r+lr*o,fr*o-lr*r),t.lineTo(fr*i+lr*s,fr*s-lr*i),t.lineTo(fr*a+lr*c,fr*c-lr*a),t.closePath()}};var nf={draw(t,e){let n=Dt(e-Kc(e/6,1.7))*.6189;t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};var Ey=[ni,up,pp,mp,yp,xp,wp],k_=[ni,hp,nf,bp,lp,gp,dp];function ur(){}function rf(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function vp(t){this._context=t}vp.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:rf(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:rf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function N_(t){return new vp(t)}function N9(t){this._context=t}N9.prototype={areaStart:ur,areaEnd:ur,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:rf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function O_(t){return new N9(t)}function O9(t){this._context=t}O9.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(t,e){switch(t=+t,e=+e,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+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:rf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function R_(t){return new O9(t)}function R9(t,e){this._basis=new vp(t),this._beta=e}R9.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r=t[0],o=e[0],i=t[n]-r,s=e[n]-o,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(r+c*i),this._beta*e[a]+(1-this._beta)*(o+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var L_=function t(e){function n(r){return e===1?new vp(r):new R9(r,e)}return n.beta=function(r){return t(+r)},n}(.85);function of(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Iy(t,e){this._context=t,this._k=(1-e)/6}Iy.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:of(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:of(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var D_=function t(e){function n(r){return new Iy(r,e)}return n.tension=function(r){return t(+r)},n}(0);function $y(t,e){this._context=t,this._k=(1-e)/6}$y.prototype={areaStart:ur,areaEnd:ur,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:of(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var P_=function t(e){function n(r){return new $y(r,e)}return n.tension=function(r){return t(+r)},n}(0);function Cy(t,e){this._context=t,this._k=(1-e)/6}Cy.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(t,e){switch(t=+t,e=+e,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:of(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var F_=function t(e){function n(r){return new Cy(r,e)}return n.tension=function(r){return t(+r)},n}(0);function _p(t,e,n){var r=t._x1,o=t._y1,i=t._x2,s=t._y2;if(t._l01_a>T_){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,o=(o*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>T_){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*f+t._x1*t._l23_2a-e*t._l12_2a)/l,s=(s*f+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(r,o,i,s,t._x2,t._y2)}function L9(t,e){this._context=t,this._alpha=e}L9.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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:_p(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var q_=function t(e){function n(r){return e?new L9(r,e):new Iy(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function D9(t,e){this._context=t,this._alpha=e}D9.prototype={areaStart:ur,areaEnd:ur,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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:_p(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var B_=function t(e){function n(r){return e?new D9(r,e):new $y(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function P9(t,e){this._context=t,this._alpha=e}P9.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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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:_p(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var z_=function t(e){function n(r){return e?new P9(r,e):new Cy(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function F9(t){this._context=t}F9.prototype={areaStart:ur,areaEnd:ur,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Y_(t){return new F9(t)}function q9(t){return t<0?-1:1}function B9(t,e,n){var r=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(r||o<0&&-0),s=(n-t._y1)/(o||r<0&&-0),a=(i*o+s*r)/(r+o);return(q9(i)+q9(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(a))||0}function z9(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function U_(t,e,n){var r=t._x0,o=t._y0,i=t._x1,s=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,o+a*e,i-a,s-a*n,i,s)}function ky(t){this._context=t}ky.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:U_(this,this._t0,z9(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,U_(this,z9(this,n=B9(this,t,e)),n);break;default:U_(this,this._t0,n=B9(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function Y9(t){this._context=new U9(t)}(Y9.prototype=Object.create(ky.prototype)).point=function(t,e){ky.prototype.point.call(this,e,t)};function U9(t){this._context=t}U9.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,o,i){this._context.bezierCurveTo(e,t,r,n,i,o)}};function j_(t){return new ky(t)}function X_(t){return new Y9(t)}function X9(t){this._context=t}X9.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=j9(t),o=j9(e),i=0,s=1;s<n;++i,++s)this._context.bezierCurveTo(r[0][i],o[0][i],r[1][i],o[1][i],t[s],e[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function j9(t){var e,n=t.length-1,r,o=new Array(n),i=new Array(n),s=new Array(n);for(o[0]=0,i[0]=2,s[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,i[e]=4,s[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,i[n-1]=7,s[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=o[e]/i[e-1],i[e]-=r,s[e]-=r*s[e-1];for(o[n-1]=s[n-1]/i[n-1],e=n-2;e>=0;--e)o[e]=(s[e]-o[e+1])/i[e];for(i[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)i[e]=2*t[e+1]-o[e+1];return[o,i]}function G_(t){return new X9(t)}function Ny(t,e){this._context=t,this._t=e}Ny.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function V_(t){return new Ny(t,.5)}function W_(t){return new Ny(t,0)}function H_(t){return new Ny(t,1)}var Sp=t=>()=>t;function Z_(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Yn(t,e,n){this.k=t,this.x=e,this.y=n}Yn.prototype={constructor:Yn,scale:function(t){return t===1?this:new Yn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Yn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Mp=new Yn(1,0,0);Q_.prototype=Yn.prototype;function Q_(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Mp;return t.__zoom}function Oy(t){t.stopImmediatePropagation()}function sf(t){t.preventDefault(),t.stopImmediatePropagation()}function Hj(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Zj(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function G9(){return this.__zoom||Mp}function Qj(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Jj(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kj(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function J_(){var t=Hj,e=Zj,n=Kj,r=Qj,o=Jj,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Aw,f=Hs("start","zoom","end"),l,u,p,d=500,h=150,m=0,g=10;function y(S){S.property("__zoom",G9).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,I,C,N){var D=S.selection?S.selection():S;D.property("__zoom",G9),S!==D?_(S,I,C,N):D.interrupt().each(function(){v(this,arguments).event(N).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},y.scaleBy=function(S,I,C,N){y.scaleTo(S,function(){var D=this.__zoom.k,L=typeof I=="function"?I.apply(this,arguments):I;return D*L},C,N)},y.scaleTo=function(S,I,C,N){y.transform(S,function(){var D=e.apply(this,arguments),L=this.__zoom,P=C==null?w(D):typeof C=="function"?C.apply(this,arguments):C,F=L.invert(P),q=typeof I=="function"?I.apply(this,arguments):I;return n(b(x(L,q),P,F),D,s)},C,N)},y.translateBy=function(S,I,C,N){y.transform(S,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),e.apply(this,arguments),s)},null,N)},y.translateTo=function(S,I,C,N,D){y.transform(S,function(){var L=e.apply(this,arguments),P=this.__zoom,F=N==null?w(L):typeof N=="function"?N.apply(this,arguments):N;return n(Mp.translate(F[0],F[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),L,s)},N,D)};function x(S,I){return I=Math.max(i[0],Math.min(i[1],I)),I===S.k?S:new Yn(I,S.x,S.y)}function b(S,I,C){var N=I[0]-C[0]*S.k,D=I[1]-C[1]*S.k;return N===S.x&&D===S.y?S:new Yn(S.k,N,D)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,I,C,N){S.on("start.zoom",function(){v(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(N).end()}).tween("zoom",function(){var D=this,L=arguments,P=v(D,L).event(N),F=e.apply(D,L),q=C==null?w(F):typeof C=="function"?C.apply(D,L):C,W=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),tt=D.__zoom,nt=typeof I=="function"?I.apply(D,L):I,ot=c(tt.invert(q).concat(W/tt.k),nt.invert(q).concat(W/nt.k));return function(X){if(X===1)X=nt;else{var rt=ot(X),Y=W/rt[2];X=new Yn(Y,q[0]-rt[0]*Y,q[1]-rt[1]*Y)}P.zoom(null,X)}})}function v(S,I,C){return!C&&S.__zooming||new A(S,I)}function A(S,I){this.that=S,this.args=I,this.active=0,this.sourceEvent=null,this.extent=e.apply(S,I),this.taps=0}A.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,I){return this.mouse&&S!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var I=St(this.that).datum();f.call(S,this.that,new Z_(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:f}),I)}};function E(S,...I){if(!t.apply(this,arguments))return;var C=v(this,I).event(S),N=this.__zoom,D=Math.max(i[0],Math.min(i[1],N.k*Math.pow(2,r.apply(this,arguments)))),L=He(S);if(C.wheel)(C.mouse[0][0]!==L[0]||C.mouse[0][1]!==L[1])&&(C.mouse[1]=N.invert(C.mouse[0]=L)),clearTimeout(C.wheel);else{if(N.k===D)return;C.mouse=[L,N.invert(L)],Xr(this),C.start()}sf(S),C.wheel=setTimeout(P,h),C.zoom("mouse",n(b(x(N,D),C.mouse[0],C.mouse[1]),C.extent,s));function P(){C.wheel=null,C.end()}}function T(S,...I){if(p||!t.apply(this,arguments))return;var C=S.currentTarget,N=v(this,I,!0).event(S),D=St(S.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",W,!0),L=He(S,C),P=S.clientX,F=S.clientY;tu(S.view),Oy(S),N.mouse=[L,this.__zoom.invert(L)],Xr(this),N.start();function q(tt){if(sf(tt),!N.moved){var nt=tt.clientX-P,ot=tt.clientY-F;N.moved=nt*nt+ot*ot>m}N.event(tt).zoom("mouse",n(b(N.that.__zoom,N.mouse[0]=He(tt,C),N.mouse[1]),N.extent,s))}function W(tt){D.on("mousemove.zoom mouseup.zoom",null),eu(tt.view,N.moved),sf(tt),N.event(tt).end()}}function $(S,...I){if(t.apply(this,arguments)){var C=this.__zoom,N=He(S.changedTouches?S.changedTouches[0]:S,this),D=C.invert(N),L=C.k*(S.shiftKey?.5:2),P=n(b(x(C,L),N,D),e.apply(this,I),s);sf(S),a>0?St(this).transition().duration(a).call(_,P,N,S):St(this).call(y.transform,P,N,S)}}function M(S,...I){if(t.apply(this,arguments)){var C=S.touches,N=C.length,D=v(this,I,S.changedTouches.length===N).event(S),L,P,F,q;for(Oy(S),P=0;P<N;++P)F=C[P],q=He(F,this),q=[q,this.__zoom.invert(q),F.identifier],D.touch0?!D.touch1&&D.touch0[2]!==q[2]&&(D.touch1=q,D.taps=0):(D.touch0=q,L=!0,D.taps=1+!!l);l&&(l=clearTimeout(l)),L&&(D.taps<2&&(u=q[0],l=setTimeout(function(){l=null},d)),Xr(this),D.start())}}function k(S,...I){if(this.__zooming){var C=v(this,I).event(S),N=S.changedTouches,D=N.length,L,P,F,q;for(sf(S),L=0;L<D;++L)P=N[L],F=He(P,this),C.touch0&&C.touch0[2]===P.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===P.identifier&&(C.touch1[0]=F);if(P=C.that.__zoom,C.touch1){var W=C.touch0[0],tt=C.touch0[1],nt=C.touch1[0],ot=C.touch1[1],X=(X=nt[0]-W[0])*X+(X=nt[1]-W[1])*X,rt=(rt=ot[0]-tt[0])*rt+(rt=ot[1]-tt[1])*rt;P=x(P,Math.sqrt(X/rt)),F=[(W[0]+nt[0])/2,(W[1]+nt[1])/2],q=[(tt[0]+ot[0])/2,(tt[1]+ot[1])/2]}else if(C.touch0)F=C.touch0[0],q=C.touch0[1];else return;C.zoom("touch",n(b(P,F,q),C.extent,s))}}function R(S,...I){if(this.__zooming){var C=v(this,I).event(S),N=S.changedTouches,D=N.length,L,P;for(Oy(S),p&&clearTimeout(p),p=setTimeout(function(){p=null},d),L=0;L<D;++L)P=N[L],C.touch0&&C.touch0[2]===P.identifier?delete C.touch0:C.touch1&&C.touch1[2]===P.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(P=He(P,this),Math.hypot(u[0]-P[0],u[1]-P[1])<g)){var F=St(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Sp(+S),y):r},y.filter=function(S){return arguments.length?(t=typeof S=="function"?S:Sp(!!S),y):t},y.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Sp(!!S),y):o},y.extent=function(S){return arguments.length?(e=typeof S=="function"?S:Sp([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):e},y.scaleExtent=function(S){return arguments.length?(i[0]=+S[0],i[1]=+S[1],y):[i[0],i[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=f.on.apply(f,arguments);return S===f?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 Jt(t){return t!=null&&!Number.isNaN(t)}function ke(t,e){return+Jt(e)-+Jt(t)||gt(t,e)}function _a(t,e){return+Jt(e)-+Jt(t)||an(t,e)}function Ap(t){return t!=null&&`${t}`!=""}function af(t){return isFinite(t)?t:NaN}function bn(t){return t>0&&isFinite(t)?t:NaN}function Vi(t){return t<0&&isFinite(t)?t:NaN}function cf(t,e){if(t instanceof Date||(t=new Date(+t)),isNaN(t))return typeof e=="function"?e(t):e;let n=t.getUTCHours(),r=t.getUTCMinutes(),o=t.getUTCSeconds(),i=t.getUTCMilliseconds();return`${tX(t.getUTCFullYear(),4)}-${ri(t.getUTCMonth()+1,2)}-${ri(t.getUTCDate(),2)}${n||r||o||i?`T${ri(n,2)}:${ri(r,2)}${o||i?`:${ri(o,2)}${i?`.${ri(i,3)}`:""}`:""}Z`:""}`}function tX(t){return t<0?`-${ri(-t,6)}`:t>9999?`+${ri(t,6)}`:ri(t,4)}function ri(t,e){return`${t}`.padStart(e,"0")}var eX=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Tp(t,e){return eX.test(t+="")?new Date(t):typeof e=="function"?e(t):e}function oi(t){if(t==null)return;let e=t[0],n=t[t.length-1];return an(e,n)}var lf=1e3,Hi=lf*60,Zi=Hi*60,io=Zi*24,oo=io*7,Sa=io*30,Wi=io*365,K_=[["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",lf],["5 seconds",5*lf],["15 seconds",15*lf],["30 seconds",30*lf],["minute",Hi],["5 minutes",5*Hi],["15 minutes",15*Hi],["30 minutes",30*Hi],["hour",Zi],["3 hours",3*Zi],["6 hours",6*Zi],["12 hours",12*Zi],["day",io],["2 days",2*io],["week",oo],["2 weeks",2*oo],["month",Sa],["3 months",3*Sa],["6 months",6*Sa],["year",Wi],["2 years",2*Wi],["5 years",5*Wi],["10 years",10*Wi],["20 years",20*Wi],["50 years",50*Wi],["100 years",100*Wi]],t6=new Map([["second",lf],["minute",Hi],["hour",Zi],["day",io],["monday",oo],["tuesday",oo],["wednesday",oo],["thursday",oo],["friday",oo],["saturday",oo],["sunday",oo],["week",oo],["month",Sa],["year",Wi]]),W9=new Map([["second",$e],["minute",Ho],["hour",Qo],["day",cr],["monday",Xi],["tuesday",Q0],["wednesday",J0],["thursday",eo],["friday",K0],["saturday",tg],["sunday",Bn],["week",Bn],["month",Ko],["year",tn]]),e6=new Map([["second",$e],["minute",Zo],["hour",Jo],["day",xa],["monday",Gi],["tuesday",eg],["wednesday",ng],["thursday",no],["friday",rg],["saturday",og],["sunday",zn],["week",zn],["month",ti],["year",en]]),uf=Symbol("intervalDuration"),Ly=Symbol("intervalType");for(let[t,e]of W9)e[uf]=t6.get(t),e[Ly]="time";for(let[t,e]of e6)e[uf]=t6.get(t),e[Ly]="utc";var Ep=[["year",en,"utc"],["month",ti,"utc"],["day",xa,"utc",6*Sa],["hour",Jo,"utc",3*io],["minute",Zo,"utc",6*Zi],["second",$e,"utc",30*Hi]],Ry=[["year",tn,"time"],["month",Ko,"time"],["day",cr,"time",6*Sa],["hour",Qo,"time",3*io],["minute",Ho,"time",6*Zi],["second",$e,"time",30*Hi]],nX=[Ep[0],Ry[0],Ep[1],Ry[1],Ep[2],Ry[2],...Ep.slice(3)];function Dy(t){let e=`${t}`.toLowerCase();e.endsWith("s")&&(e=e.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(e);switch(r&&(e=e.slice(r[0].length),n=+r[1]),e){case"quarter":e="month",n*=3;break;case"half":e="month",n*=6;break}let o=e6.get(e);if(!o)throw new Error(`unknown interval: ${t}`);if(n>1&&!o.every)throw new Error(`non-periodic interval: ${e}`);return[e,n]}function Ip(t){return H9(Dy(t),"time")}function Ma(t){return H9(Dy(t),"utc")}function H9([t,e],n){let r=(n==="time"?W9:e6).get(t);return e>1&&(r=r.every(e),r[uf]=t6.get(t)*e,r[Ly]=n),r}function n6(t,e){if(!(e>1))return;let n=t[uf];if(!K_.some(([,o])=>o===n)||n%io===0&&io<n&&n<Sa)return;let[r]=K_[wr(([,o])=>Math.log(o)).center(K_,Math.log(n*e))];return(t[Ly]==="time"?Ip:Ma)(r)}function V9(t,e,n){let r=e==="time"?Zc:ro;if(n==null)return r(t==="year"?"%Y":t==="month"?"%Y-%m":t==="day"?"%Y-%m-%d":t==="hour"||t==="minute"?"%Y-%m-%dT%H:%M":t==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let o=rX(n);switch(t){case"millisecond":return ff(r(".%L"),r(":%M:%S"),o);case"second":return ff(r(":%S"),r("%-I:%M"),o);case"minute":return ff(r("%-I:%M"),r("%p"),o);case"hour":return ff(r("%-I %p"),r("%b %-d"),o);case"day":return ff(r("%-d"),r("%b"),o);case"month":return ff(r("%b"),r("%Y"),o);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function rX(t){return t==="left"||t==="right"?(e,n)=>`
|
|
3
|
+
${e}
|
|
4
|
+
${n}`:t==="top"?(e,n)=>`${n}
|
|
5
|
+
${e}`:(e,n)=>`${e}
|
|
6
|
+
${n}`}function oX(t){return t==="time"?Ry:t==="utc"?Ep:nX}function Z9(t,e,n){let r=Ct(Cm(e,(o,i)=>Math.abs(i-o)));if(r<1e3)return V9("millisecond","utc",n);for(let[o,i,s,a]of oX(t)){if(r>a||o==="hour"&&!r)break;if(e.every(c=>i.floor(c)>=c))return V9(o,s,n)}}function ff(t,e,n){return(r,o,i)=>{let s=t(r,o),a=e(r,o),c=o-oi(i);return o!==c&&i[c]!==void 0&&a===e(i[c],c)?s:n(s,a)}}var $p=Object.getPrototypeOf(Uint8Array),iX=Object.prototype.toString;function Cn(t){return t instanceof Array||t instanceof $p}function J9(t){return t instanceof $p&&!sX(t)}function K9(t){return t?.prototype instanceof $p&&!aX(t)}function sX(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function aX(t){return t===BigInt64Array||t===BigUint64Array}var o6=Symbol("reindex");function ut(t,e,n){let r=typeof e;return r==="string"?uC(t)?i6(t.getChild(e),n):Q9(t,s6(e),n):r==="function"?Q9(t,e,n):r==="number"||e instanceof Date||r==="boolean"?Et(t,re(e),n):typeof e?.transform=="function"?r6(e.transform(t),n):cX(r6(e,n),t?.[o6])}function cX(t,e){return t!=null&&e?kp(t,e):t}function Q9(t,e,n){return Et(t,K9(n)?(r,o)=>a6(e(r,o)):e,n)}function r6(t,e){return e===void 0?Un(t):pC(t)?i6(t,e):t instanceof e?t:e.from(t,K9(e)&&!J9(t)?a6:void 0)}function i6(t,e){return t==null?t:(e===void 0||e===Array)&&uX(t.type)?c6(t.toArray()):r6(t.toArray(),e)}var Qi=[null],s6=t=>e=>{let n=e[t];return n===void 0&&e.type==="Feature"?e.properties?.[t]:n},Xt={transform:wn},V={transform:t=>t};var Cp=()=>1,tC=()=>!0,fe=t=>t==null?t:`${t}`,Ot=t=>t==null?t:+t;var Aa=t=>t?t[0]:void 0,Ji=t=>t?t[1]:void 0,eC=t=>t?t[2]:void 0,re=t=>()=>t;function pf(t){let e=+`${t}`.slice(1)/100;return(n,r)=>ln(n,e,r)}function xe(t){return J9(t)?t:Et(t,a6,Float64Array)}function a6(t){return t==null?NaN:Number(t)}function c6(t){return Et(t,f6)}function f6(t){return t instanceof Date&&!isNaN(t)?t:typeof t=="string"?Tp(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function ee(t,e){return t===void 0&&(t=e),t===null?[void 0,"none"]:ns(t)?[void 0,t]:[t,void 0]}function Ft(t,e){return t===void 0&&(t=e),t===null||typeof t=="number"?[void 0,t]:[t,void 0]}function l6(t,e,n){if(t!=null)return Se(t,e,n)}function Se(t,e,n){let r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function ii(t){return uC(t)?t:Un(t)}function Un(t){if(t==null||Cn(t))return t;if(pC(t))return i6(t);switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[t]}return Array.from(t)}function Et(t,e,n=Array){return t==null?t:t instanceof n?t.map(e):n.from(t,e)}function Ki(t,e=Array){return t instanceof e?t.slice():e.from(t)}function u6({x:t,x1:e,x2:n}){return t!==void 0||e!==void 0||n!==void 0}function p6({y:t,y1:e,y2:n}){return t!==void 0||e!==void 0||n!==void 0}function si(t){return u6(t)||p6(t)||t.interval!==void 0}function Ne(t){return t?.toString===iX}function so(t){return Ne(t)&&(t.type!==void 0||t.domain!==void 0)}function jn(t){return Ne(t)&&typeof t.transform!="function"}function ao(t){return jn(t)&&t.value===void 0&&t.channel===void 0}function d6(t,e,n,r=V){return e===void 0&&n===void 0?(e=0,n=t===void 0?r:t):e===void 0?e=t===void 0?0:t:n===void 0&&(n=t===void 0?0:t),[e,n]}function ae(t,e){return t===void 0&&e===void 0?[Aa,Ji]:[t,e]}function nn({z:t,fill:e,stroke:n}={}){return t===void 0&&([t]=ee(e)),t===void 0&&([t]=ee(n)),t}function ts(t){return Cn(t)?t.length:t?.numRows}function wn(t){let e=ts(t),n=new Uint32Array(e);for(let r=0;r<e;++r)n[r]=r;return n}function kp(t,e){return Cn(t)?Et(e,n=>t[n],t.constructor):Et(e,n=>t.at(n))}function df(t){return t.length===1?(e,n)=>t(kp(n,e)):t}function ai(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function pr(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Py(t,e){if(e[t]!==void 0)return e[t];switch(t){case"x1":case"x2":t="x";break;case"y1":case"y2":t="y";break}return e[t]}function Oe(t){let e;return[{transform:()=>e,label:Ve(t)},n=>e=n]}function Ge(t){return t==null?[t]:Oe(t)}function Ve(t,e){return typeof t=="string"?t:t&&t.label!==void 0?t.label:e}function hf(t,e){return{transform(n){let r=t.transform(n),o=e.transform(n);return ne(r)||ne(o)?Et(r,(i,s)=>new Date((+r[s]+ +o[s])/2)):Et(r,(i,s)=>(+r[s]+ +o[s])/2,Float64Array)},label:t.label}}function Ta(t,e){let n=h6(e?.interval,e?.type);return n?Et(t,n):t}function h6(t,e){let n=mf(t,e);return n&&(r=>Jt(r)?n.floor(r):r)}function mf(t,e){if(t!=null){if(typeof t=="number")return m6(t);if(typeof t=="string")return(e==="time"?Ip:Ma)(t);if(typeof t.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof t.offset!="function")throw new Error("invalid interval; missing offset method");return t}}function m6(t){t=+t,0<t&&t<1&&Number.isInteger(1/t)&&(t=-1/t);let e=Math.abs(t);return t<0?{floor:n=>Math.floor(n*e)/e,offset:(n,r=1)=>(n*e+Math.floor(r))/e,range:(n,r)=>ce(Math.ceil(n*e),r*e).map(o=>o/e)}:{floor:n=>Math.floor(n/e)*e,offset:(n,r=1)=>n+e*Math.floor(r),range:(n,r)=>ce(Math.ceil(n/e),r/e).map(o=>o*e)}}function co(t,e){if(t=mf(t,e),t&&typeof t.range!="function")throw new Error("invalid interval: missing range method");return t}function nC(t,e){if(t=co(t,e),t&&typeof t.ceil!="function")throw new Error("invalid interval: missing ceil method");return t}function rC(t){return es(t)&&typeof t?.floor=="function"&&t.floor()instanceof Date}function es(t){return typeof t?.range=="function"}function dr(t){return t===void 0||jn(t)?t:{value:t}}function oC(t){return t==null?null:{transform:e=>ut(e,t,Float64Array),label:Ve(t)}}function iC(t){if(!vn(t))return!1;for(let e of t)if(e!=null)return typeof e=="object"&&"0"in e&&"1"in e}function vn(t){return t&&typeof t[Symbol.iterator]=="function"}function Fy(t){for(let e of t)if(e!=null)return typeof e!="object"||e instanceof Date}function Kt(t){for(let e of t){if(e==null)continue;let n=typeof e;return n==="string"||n==="boolean"}}function ne(t){for(let e of t)if(e!=null)return e instanceof Date}function sC(t){for(let e of t)if(e!=null)return typeof e=="string"&&isNaN(e)&&Tp(e)}function aC(t){for(let e of t)if(e!=null){if(typeof e!="string")return!1;if(e.trim())return!isNaN(e)}}function ci(t){for(let e of t)if(e!=null)return typeof e=="number"}function qy(t,e){let n;for(let r of t)if(r!=null){if(!e(r))return!1;n=!0}return n}var fX=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 ns(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||fX.has(t))}function cC(t){return typeof t=="number"&&(0<=t&&t<=1||isNaN(t))}function Pt(t){return t==null||fi(t)}function fi(t){return/^\s*none\s*$/i.test(t)}function fC(t){return/^\s*round\s*$/i.test(t)}function By(t,e){return l6(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function fo(t="middle"){return By(t,"frameAnchor")}function lC(t={},...e){let n=t;for(let r of e)for(let o in r)if(n[o]===void 0){let i=r[o];n===t?n={...n,[o]:i}:n[o]=i}return n}function lX(t){console.warn("named iterables are deprecated; please use an object instead");let e=new Set;return Object.fromEntries(Array.from(t,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let o=`${r}`;if(o==="__proto__")throw new Error(`illegal name: ${o}`);if(e.has(o))throw new Error(`duplicate name: ${o}`);return e.add(o),[r,n]}))}function Np(t){return vn(t)?lX(t):t}function zy(t){return t===!0?t="frame":t===!1?t=null:t!=null&&(t=Se(t,"clip",["frame","sphere"])),t}function uC(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}function pC(t){return t&&typeof t.toArray=="function"&&t.type}function uX(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var hr=Symbol("position"),Xn=Symbol("color"),Ea=Symbol("radius"),Ia=Symbol("length"),$a=Symbol("opacity"),gf=Symbol("symbol"),dC=Symbol("projection"),Yt=new Map([["x",hr],["y",hr],["fx",hr],["fy",hr],["r",Ea],["color",Xn],["opacity",$a],["symbol",gf],["length",Ia],["projection",dC]]);function hC(t){return t===hr||t===dC}function mC(t){return t===hr||t===Ea||t===Ia||t===$a}var g6=Math.sqrt(3),y6=2/g6,pX={draw(t,e){let n=Math.sqrt(e/Math.PI),r=n*y6,o=r/2;t.moveTo(0,r),t.lineTo(n,o),t.lineTo(n,-o),t.lineTo(0,-r),t.lineTo(-n,-o),t.lineTo(-n,o),t.closePath()}},x6=new Map([["asterisk",lp],["circle",ni],["cross",up],["diamond",pp],["diamond2",dp],["hexagon",pX],["plus",hp],["square",mp],["square2",gp],["star",yp],["times",nf],["triangle",xp],["triangle2",bp],["wye",wp]]);function b6(t){return t&&typeof t.draw=="function"}function gC(t){return b6(t)?!0:typeof t!="string"?!1:x6.has(t.toLowerCase())}function yf(t){if(t==null||b6(t))return t;let e=x6.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function yC(t){if(t==null||b6(t))return[void 0,t];if(typeof t=="string"){let e=x6.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}function be({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},s){if(r===void 0&&(t!=null&&(r=_6(t)),e!=null&&!ao(e)&&(r=w6(r,M6(e))),n&&(r=w6(r,S6))),s!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(e===null||ao(e))&&{sort:e},transform:w6(r,s)}}function Vt({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return r===void 0&&(t!=null&&(r=_6(t)),e!=null&&!ao(e)&&(r=v6(r,M6(e))),n&&(r=v6(r,S6))),{...o,...(e===null||ao(e))&&{sort:e},initializer:v6(r,i)}}function w6(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,o){return{data:n,facets:r}=t.call(this,n,r,o),e.call(this,ii(n),r,o)}}function v6(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,o,...i){let s,a,c,f,l,u;return{data:a=n,facets:c=r,channels:s}=t.call(this,n,r,o,...i),{data:l=a,facets:u=c,channels:f}=e.call(this,a,c,{...o,...s},...i),{data:l,facets:u,channels:{...s,...f}}}}function Yy(t,e){return(t.initializer!=null?Vt:be)(t,e)}function xC(t,e){return Yy(e,_6(t))}function _6(t){return(e,n)=>{let r=ut(e,t);return{data:e,facets:n.map(o=>o.filter(i=>r[i]))}}}function bC({sort:t,...e}={}){return{...Yy(e,S6),sort:ao(t)?t:null}}function S6(t,e){return{data:t,facets:e.map(n=>n.slice().reverse())}}function wC({seed:t,sort:e,...n}={}){return{...Yy(n,vC(t==null?Math.random:pa(t))),sort:ao(e)?e:null}}function Uy(t,{sort:e,...n}={}){return{...(jn(t)&&t.channel!==void 0?Vt:Yy)(n,M6(t)),sort:ao(e)?e:null}}function M6(t){return(typeof t=="function"&&t.length!==1?dX:vC)(t)}function dX(t){return(e,n)=>{let r=Cn(e)?(o,i)=>t(e[o],e[i]):(o,i)=>t(e.get(o),e.get(i));return{data:e,facets:n.map(o=>o.slice().sort(r))}}}function vC(t){let e,n;({channel:e,value:t,order:n}={...dr(t)});let r=e?.startsWith("-");if(r&&(e=e.slice(1)),n===void 0&&(n=r?_a:ke),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=ke;break;case"descending":n=_a;break;default:throw new Error(`invalid order: ${n}`)}return(o,i,s)=>{let a;if(e===void 0)a=ut(o,t);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[e],!a)return{};a=a.value}let c=(f,l)=>n(a[f],a[l]);return{data:o,facets:i.map(f=>f.slice().sort(c))}}}function Rp(t,e){return jy(null,null,t,e)}function rs(t={y:"count"},e={}){let{x:n=V}=e;if(n==null)throw new Error("missing channel: x");return jy(n,null,t,e)}function os(t={x:"count"},e={}){let{y:n=V}=e;if(n==null)throw new Error("missing channel: y");return jy(null,n,t,e)}function Lp(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=ae(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return jy(n,r,t,e)}function jy(t,e,{data:n=Vy,filter:r,sort:o,reverse:i,...s}={},a={}){s=T6(s,a),n=TC(n,V),o=o==null?void 0:MC("sort",o,a),r=r==null?void 0:AC("filter",r,a);let[c,f]=Ge(t),[l,u]=Ge(e),{z:p,fill:d,stroke:h,x1:m,x2:g,y1:y,y2:x,...b}=a,[w,_]=Ge(p),[v]=ee(d),[A]=ee(h),[E,T]=Ge(v),[$,M]=Ge(A);return{..."z"in a&&{z:w||p},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:$||h},...be(b,(k,R,S)=>{let I=Ta(ut(k,t),S?.x),C=Ta(ut(k,e),S?.y),N=ut(k,p),D=ut(k,v),L=ut(k,A),P=Dp(s,{z:N,fill:D,stroke:L}),F=[],q=[],W=I&&f([]),tt=C&&u([]),nt=N&&_([]),ot=D&&T([]),X=L&&M([]),rt=0;for(let Y of s)Y.initialize(k);o&&o.initialize(k),r&&r.initialize(k);for(let Y of R){let H=[];for(let et of s)et.scope("facet",Y);o&&o.scope("facet",Y),r&&r.scope("facet",Y);for(let[et,B]of lo(Y,P))for(let[wt,ct]of lo(B,C))for(let[It,kt]of lo(ct,I)){let J={data:k};if(I&&(J.x=It),C&&(J.y=wt),P&&(J.z=et),!(r&&!r.reduce(kt,J))){H.push(rt++),q.push(n.reduceIndex(kt,k,J)),I&&W.push(It),C&&tt.push(wt),N&&nt.push(P===N?et:N[kt[0]]),D&&ot.push(P===D?et:D[kt[0]]),L&&X.push(P===L?et:L[kt[0]]);for(let qt of s)qt.reduce(kt,J);o&&o.reduce(kt,J)}}F.push(H)}return E6(F,o,i),{data:q,facets:F}}),...!uo(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!uo(s,"y")&&(l?{y:l}:{y1:y,y2:x}),...Object.fromEntries(s.map(({name:k,output:R})=>[k,R]))}}function uo(t,...e){for(let{name:n}of t)if(e.includes(n))return!0;return!1}function A6(t,e,n=Xy){let r=Object.entries(t);return e.title!=null&&t.title===void 0&&r.push(["title",bX]),e.href!=null&&t.href===void 0&&r.push(["href",Wy]),r.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?hX(o):n(o,i,e))}function Xy(t,e,n,r=Gy){let o;Ne(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);let i=r(t,e,n),[s,a]=Oe(i.label),c;return{name:t,output:o===void 0?s:{value:s,scale:o},initialize(f){i.initialize(f),c=a([])},scope(f,l){i.scope(f,l)},reduce(f,l){c.push(i.reduce(f,l))}}}function hX(t){return{name:t,initialize(){},scope(){},reduce(){}}}function Gy(t,e,n,r=xf){let o=Py(t,n),i=r(e,o),s,a;return{label:Ve(i===Op?null:o,i.label),initialize(c){s=o===void 0?c:ut(c,o),i.scope==="data"&&(a=i.reduceIndex(wn(c),s))},scope(c,f){i.scope===c&&(a=i.reduceIndex(f,s))},reduce(c,f){return i.scope==null?i.reduceIndex(c,s,f):i.reduceIndex(c,s,a,f)}}}function lo(t,e){return e?ze(t,n=>e[n]):[[,t]]}function xf(t,e,n=mX){if(t==null)return n(t);if(typeof t.reduceIndex=="function")return t;if(typeof t.reduce=="function"&&Ne(t))return yX(t);if(typeof t=="function")return xX(t);if(/^p\d{2}$/i.test(t))return li(pf(t));switch(`${t}`.toLowerCase()){case"first":return Wy;case"last":return wX;case"identity":return Vy;case"count":return Op;case"distinct":return vX;case"sum":return e==null?Op:_X;case"proportion":return SC(e,"data");case"proportion-facet":return SC(e,"facet");case"deviation":return li(nr);case"min":return li(Bt);case"min-index":return li(Em);case"max":return li(Ct);case"max-index":return li(Tm);case"mean":return _C(Fo);case"median":return _C(_r);case"variance":return li(ki);case"mode":return li(wc)}return n(t)}function mX(t){throw new Error(`invalid reduce: ${t}`)}function T6(t,e){return A6(t,e,MC)}function MC(t,e,n){return Xy(t,e,n,AC)}function AC(t,e,n){return Gy(t,e,n,TC)}function TC(t,e){return xf(t,e,gX)}function gX(t){switch(`${t}`.toLowerCase()){case"x":return SX;case"y":return MX;case"z":return I6}throw new Error(`invalid group reduce: ${t}`)}function Dp(t,e){for(let n in e){let r=e[n];if(r!==void 0&&!t.some(o=>o.name===n))return r}}function E6(t,e,n){if(e){let r=e.output.transform(),o=(i,s)=>ke(r[i],r[s]);t.forEach(i=>i.sort(o))}n&&t.forEach(r=>r.reverse())}function yX(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function xX(t){return{reduceIndex(e,n,r){return t(kp(n,e),r)}}}function li(t){return{reduceIndex(e,n){return t(e,r=>n[r])}}}function _C(t){return{reduceIndex(e,n){let r=t(e,o=>n[o]);return ne(n)?new Date(r):r}}}var Vy={reduceIndex(t,e){return kp(e,t)}},Wy={reduceIndex(t,e){return e[t[0]]}},bX={reduceIndex(t,e){let r=Do(vr(t,i=>i.length,i=>e[i]),Ji),o=r.slice(-5).reverse();if(o.length<r.length){let i=r.slice(0,-4);o[4]=[`\u2026 ${i.length.toLocaleString("en-US")} more`,Ue(i,Ji)]}return o.map(([i,s])=>`${i} (${s.toLocaleString("en-US")})`).join(`
|
|
7
|
+
`)}},wX={reduceIndex(t,e){return e[t[t.length-1]]}},Op={label:"Frequency",reduceIndex(t){return t.length}},vX={label:"Distinct",reduceIndex(t,e){let n=new fn;for(let r of t)n.add(e[r]);return n.size}},_X=li(Ue);function SC(t,e){return t==null?{scope:e,label:"Frequency",reduceIndex:(n,r,o=1)=>n.length/o}:{scope:e,reduceIndex:(n,r,o=1)=>Ue(n,i=>r[i])/o}}var SX={reduceIndex(t,e,{x:n}){return n}},MX={reduceIndex(t,e,{y:n}){return n}},I6={reduceIndex(t,e,{z:n}){return n}};function EC(t){if(typeof t!="function")throw new Error(`invalid test function: ${t}`);return{reduceIndex(e,n,{data:r}){return n[e.find(Cn(r)?o=>t(r[o],o,r):o=>t(r.get(o),o,r))]}}}function bf(t,{scale:e,type:n,value:r,filter:o,hint:i,label:s=Ve(r)},a){return i===void 0&&typeof r?.transform=="function"&&(i=r.hint),C6(a,{scale:e,type:n,value:ut(t,r),label:s,filter:o,hint:i})}function Hy(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,bf(e,r,n)]))}function wf(t,e){let n=Object.fromEntries(Object.entries(t).map(([r,{scale:o,value:i}])=>{let s=o==null?null:e[o];return[r,s==null?i:Et(i,s)]}));return n.channels=t,n}function C6(t,e){let{scale:n,value:r}=e;if(n===!0||n==="auto")switch(t){case"fill":case"stroke":case"color":e.scale=n!==!0&&qy(r,ns)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=n!==!0&&qy(r,cC)?null:"opacity",e.defaultScale="opacity";break;case"symbol":n!==!0&&qy(r,gC)?(e.scale=null,e.value=Et(r,yf)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=Yt.has(t)?t:null;break}else if(n===!1)e.scale=null;else if(n!=null&&!Yt.has(n))throw new Error(`unknown scale: ${n}`);return e}function $C(t,e,n,r,o){let{order:i,reverse:s,reduce:a=!0,limit:c}=o;for(let f in o){if(!Yt.has(f))continue;let{value:l,order:u=i,reverse:p=s,reduce:d=a,limit:h=c}=dr(o[f]),m=l?.startsWith("-");if(m&&(l=l.slice(1)),u=u===void 0?m!==(l==="width"||l==="height")?kC:CC:EX(u),d==null||d===!1)continue;let g=f==="fx"||f==="fy"?TX(e,r[f]):AX(n,f);if(!g)throw new Error(`missing channel for scale: ${f}`);let y=g.value,[x=0,b=1/0]=vn(h)?h:h<0?[h]:[0,h];if(l==null)g.domain=()=>{let w=Array.from(new fn(y));return p&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=l==="data"?t:l==="height"?IC(n,"y1","y2"):l==="width"?IC(n,"x1","x2"):$6(n,l,l==="y"?"y2":l==="x"?"x2":void 0),_=xf(d===!0?"max":d,w);g.domain=()=>{let v=tw(wn(y),A=>_.reduceIndex(A,w),A=>y[A]);return u&&v.sort(u),p&&v.reverse(),(x!==0||b!==1/0)&&(v=v.slice(x,b)),v.map(Aa)}}}}function AX(t,e){for(let n in t){let r=t[n];if(r.scale===e)return r}}function TX(t,e){let n=t.original;if(n===t)return e;let r=e.value,o=e.value=[];for(let i=0;i<n.length;++i){let s=r[n[i][0]];for(let a of t[i])o[a]=s}return e}function IC(t,e,n){let r=$6(t,e),o=$6(t,n);return Et(o,(i,s)=>Math.abs(i-r[s]),Float64Array)}function $6(t,e,n){let r=t[e];if(!r&&n!==void 0&&(r=t[n]),r)return r.value;throw new Error(`missing channel: ${e}`)}function EX(t){if(t==null||typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return CC;case"descending":return kC}throw new Error(`invalid order: ${t}`)}function CC([t,e],[n,r]){return ke(e,r)||ke(t,n)}function kC([t,e],[n,r]){return _a(e,r)||ke(t,n)}function Pp(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var DC=new Map([["accent",m_],["category10",h_],["dark2",g_],["observable10",y_],["paired",x_],["pastel1",b_],["pastel2",w_],["set1",v_],["set2",__],["set3",S_],["tableau10",M_]]);function PC(t){return t!=null&&DC.has(`${t}`.toLowerCase())}var NC=new Map([...DC,["brbg",ui(pg,dg)],["prgn",ui(hg,mg)],["piyg",ui(gg,yg)],["puor",ui(xg,bg)],["rdbu",ui(sp,Qc)],["rdgy",ui(wg,vg)],["rdylbu",ui(ap,Jc)],["rdylgn",ui(_g,Sg)],["spectral",ui(Mg,Ag)],["burd",OC(sp,Qc)],["buylrd",OC(ap,Jc)],["blues",Re(Zg,Qg)],["greens",Re(Jg,Kg)],["greys",Re(ty,ey)],["oranges",Re(sy,ay)],["purples",Re(ny,ry)],["reds",Re(oy,iy)],["turbo",pi(gy)],["viridis",pi(xy)],["magma",pi(by)],["inferno",pi(wy)],["plasma",pi(vy)],["cividis",pi(cy)],["cubehelix",pi(fy)],["warm",pi(uy)],["cool",pi(py)],["bugn",Re(Tg,Eg)],["bupu",Re(Ig,$g)],["gnbu",Re(Cg,kg)],["orrd",Re(Ng,Og)],["pubu",Re(Dg,Pg)],["pubugn",Re(Rg,Lg)],["purd",Re(Fg,qg)],["rdpu",Re(Bg,zg)],["ylgn",Re(jg,Xg)],["ylgnbu",Re(Yg,Ug)],["ylorbr",Re(Gg,Vg)],["ylorrd",Re(Wg,Hg)],["rainbow",RC(dy)],["sinebow",RC(my)]]);function Re(t,e){return({length:n})=>n===1?[t[3][1]]:n===2?[t[3][1],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Ze(e,n):t[n])}function ui(t,e){return({length:n})=>n===2?[t[3][0],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Ze(e,n):t[n])}function OC(t,e){return({length:n})=>n===2?[t[3][2],t[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Ze(r=>e(1-r),n):t[n].slice().reverse())}function pi(t){return({length:e})=>Ze(t,Math.max(2,Math.floor(e)))}function RC(t){return({length:e})=>Ze(t,Math.floor(e)+1).slice(0,-1)}function k6(t){let e=`${t}`.toLowerCase();if(!NC.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return NC.get(e)}function Fp(t,e){let n=k6(t),r=typeof n=="function"?n({length:e}):n;return r.length!==e?r.slice(0,e):r}function FC(t,e="greys"){let n=new Set,[r,o]=Fp(e,2);for(let i of t)if(i!=null)if(i===!0)n.add(o);else if(i===!1)n.add(r);else return;return[...n]}var LC=new Map([["brbg",dg],["prgn",mg],["piyg",yg],["puor",bg],["rdbu",Qc],["rdgy",vg],["rdylbu",Jc],["rdylgn",Sg],["spectral",Ag],["burd",t=>Qc(1-t)],["buylrd",t=>Jc(1-t)],["blues",Qg],["greens",Kg],["greys",ey],["purples",ry],["reds",iy],["oranges",ay],["turbo",gy],["viridis",xy],["magma",by],["inferno",wy],["plasma",vy],["cividis",cy],["cubehelix",fy],["warm",uy],["cool",py],["bugn",Eg],["bupu",$g],["gnbu",kg],["orrd",Og],["pubugn",Lg],["pubu",Pg],["purd",qg],["rdpu",zg],["ylgnbu",Ug],["ylgn",Xg],["ylorbr",Vg],["ylorrd",Hg],["rainbow",dy],["sinebow",my]]);function vf(t){let e=`${t}`.toLowerCase();if(!LC.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return LC.get(e)}var IX=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function qC(t){return t!=null&&IX.has(`${t}`.toLowerCase())}var O6=t=>e=>t(1-e),N6=[0,1],BC=new Map([["number",Ht],["rgb",rr],["hsl",Tw],["hcl",Ew],["lab",Hm]]);function R6(t){let e=`${t}`.toLowerCase();if(!BC.has(e))throw new Error(`unknown interpolator: ${e}`);return BC.get(e)}function Sf(t,e,n,{type:r,nice:o,clamp:i,zero:s,domain:a=WC(t,n),unknown:c,round:f,scheme:l,interval:u,range:p=Yt.get(t)===Ea?NX(n,a):Yt.get(t)===Ia?OX(n,a):Yt.get(t)===$a?N6:void 0,interpolate:d=Yt.get(t)===Xn?l==null&&p!==void 0?rr:vf(l!==void 0?l:r==="cyclical"?"rainbow":"turbo"):f?ea:Ht,reverse:h}){if(u=co(u,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=R6(d)),h=!!h,p!==void 0){let m=(a=Un(a)).length,g=(p=Un(p)).length;if(m!==g){if(d.length===1)throw new Error("invalid piecewise interpolator");d=jr(d,p),p=void 0}}if(d.length===1?(h&&(d=O6(d),h=!1),p===void 0&&(p=Float64Array.from(a,(m,g)=>g/(a.length-1)),p.length===2&&(p=N6)),e.interpolate((p===N6?re:qp)(d))):e.interpolate(d),s){let[m,g]=Rt(a);(m>0||g<0)&&(a=Ki(a),(oi(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return h&&(a=Oi(a)),e.domain(a).unknown(c),o&&(e.nice($X(o,r)),a=e.domain()),p!==void 0&&e.range(p),i&&e.clamp(i),{type:r,domain:a,range:p,scale:e,interpolate:d,interval:u}}function $X(t,e){return t===!0?void 0:typeof t=="number"?t:nC(t,e)}function zC(t,e,n){return Sf(t,Wo(),e,n)}function YC(t,e,n){return L6(t,e,{...n,exponent:.5})}function L6(t,e,{exponent:n=1,...r}){return Sf(t,Hu().exponent(n),e,{...r,type:"pow"})}function UC(t,e,{base:n=10,domain:r=RX(e),...o}){return Sf(t,Vu().base(n),e,{...o,domain:r})}function jC(t,e,{constant:n=1,...r}){return Sf(t,Wu().constant(n),e,r)}function XC(t,e,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:o=r,scheme:i="rdylbu",domain:s=LX(e),unknown:a,interpolate:c,reverse:f}){return n===void 0&&(n=c!==void 0?Ze(c,o):Yt.get(t)===Xn?Fp(i,o):void 0),s.length>0&&(s=Zu(s,n===void 0?{length:o}:n).quantiles()),Zy(t,e,{domain:s,range:n,reverse:f,unknown:a})}function GC(t,e,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:o="rdylbu",domain:i=WC(t,e),unknown:s,interpolate:a,reverse:c}){let[f,l]=Rt(i),u;return n===void 0?(u=Ye(f,l,r),u[0]<=f&&u.splice(0,1),u[u.length-1]>=l&&u.pop(),r=u.length+1,n=a!==void 0?Ze(a,r):Yt.get(t)===Xn?Fp(o,r):void 0):(u=Ze(Ht(f,l),r+1).slice(1,-1),f instanceof Date&&(u=u.map(p=>new Date(p)))),oi(Un(i))<0&&u.reverse(),Zy(t,e,{domain:u,range:n,reverse:c,unknown:s})}function Zy(t,e,{domain:n=[0],unknown:r,scheme:o="rdylbu",interpolate:i,range:s=i!==void 0?Ze(i,n.length+1):Yt.get(t)===Xn?Fp(o,n.length+1):void 0,reverse:a}){n=Un(n);let c=oi(n);if(!isNaN(c)&&!CX(n,c))throw new Error(`the ${t} scale has a non-monotonic domain`);return a&&(s=Oi(s)),{type:"threshold",scale:Qu(c<0?Oi(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function CX(t,e){for(let n=1,r=t.length,o=t[0];n<r;++n){let i=an(o,o=t[n]);if(i!==0&&i!==e)return!1}return!0}function VC(t){return{type:"identity",scale:mC(Yt.get(t))?Xu():e=>e}}function _f(t,e=af){return t.length?[Bt(t,({value:n})=>n===void 0?n:Bt(n,e)),Ct(t,({value:n})=>n===void 0?n:Ct(n,e))]:[0,1]}function WC(t,e){let n=Yt.get(t);return(n===Ea||n===$a||n===Ia?kX:_f)(e)}function kX(t){return[0,t.length?Ct(t,({value:e})=>e===void 0?e:Ct(e,af)):1]}function NX(t,e){let n=t.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=ln(t,.5,({value:s})=>s===void 0?NaN:ln(s,.25,bn)),o=e.map(s=>3*Math.sqrt(s/r)),i=30/Ct(o);return i<1?o.map(s=>s*i):o}function OX(t,e){let n=_r(t,({value:i})=>i===void 0?NaN:_r(i,Math.abs)),r=e.map(i=>12*i/n),o=60/Ct(r);return o<1?r.map(i=>i*o):r}function RX(t){for(let{value:e}of t)if(e!==void 0)for(let n of e){if(n>0)return _f(t,bn);if(n<0)return _f(t,Vi)}return[1,10]}function LX(t){let e=[];for(let{value:n}of t)if(n!==void 0)for(let r of n)e.push(r);return e}function qp(t){return(e,n)=>r=>t(e+r*(n-e))}var D6=0,P6;function HC(){let t=D6;return D6=0,P6=void 0,t}function rn(t){t!==P6&&(P6=t,console.warn(t),++D6)}function Qy(t,e,n,r,{type:o,nice:i,clamp:s,domain:a=_f(r),unknown:c,pivot:f=0,scheme:l,range:u,symmetric:p=!0,interpolate:d=Yt.get(t)===Xn?l==null&&u!==void 0?rr:vf(l!==void 0?l:"rdbu"):Ht,reverse:h}){f=+f,a=Un(a);let[m,g]=a;if(a.length>2&&rn(`Warning: the diverging ${t} scale domain contains extra elements.`),an(m,g)<0&&([m,g]=[g,m],h=!h),m=Math.min(m,f),g=Math.max(g,f),typeof d!="function"&&(d=R6(d)),u!==void 0&&(d=d.length===1?qp(d)(...u):jr(d,u)),h&&(d=O6(d)),p){let y=n.apply(f),x=y-n.apply(m),b=n.apply(g)-y;x<b?m=n.invert(y-b):x>b&&(g=n.invert(y+x))}return e.domain([m,f,g]).unknown(c).interpolator(d),s&&e.clamp(s),i&&e.nice(i),{type:o,domain:[m,g],pivot:f,interpolate:d,scale:e}}function ZC(t,e,n){return Qy(t,ip(),DX,e,n)}function QC(t,e,n){return F6(t,e,{...n,exponent:.5})}function F6(t,e,{exponent:n=1,...r}){return Qy(t,ug().exponent(n=+n),qX(n),e,{...r,type:"diverging-pow"})}function JC(t,e,{base:n=10,pivot:r=1,domain:o=_f(e,r<0?Vi:bn),...i}){return Qy(t,fg().base(n=+n),PX,e,{domain:o,pivot:r,...i})}function KC(t,e,{constant:n=1,...r}){return Qy(t,lg().constant(n=+n),BX(n),e,r)}var DX={apply(t){return t},invert(t){return t}},PX={apply:Math.log,invert:Math.exp},FX={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function qX(t){return t===.5?FX:{apply(e){return Math.sign(e)*Math.pow(Math.abs(e),t)},invert(e){return Math.sign(e)*Math.pow(Math.abs(e),1/t)}}}function BX(t){return{apply(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))},invert(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}}function tk(t,e,n,r){return Sf(t,e,n,r)}function ek(t,e,n){return tk(t,sg(),e,n)}function nk(t,e,n){return tk(t,ag(),e,n)}var Mf=Symbol("ordinal");function ok(t,e,n,{type:r,interval:o,domain:i,range:s,reverse:a,hint:c}){return o=co(o,r),i===void 0&&(i=fk(n,o,t)),(r==="categorical"||r===Mf)&&(r="ordinal"),a&&(i=Oi(i)),i=e.domain(i).domain(),s!==void 0&&(typeof s=="function"&&(s=s(i)),e.range(s)),{type:r,domain:i,range:s,scale:e,hint:c,interval:o}}function ik(t,e,{type:n,interval:r,domain:o,range:i,scheme:s,unknown:a,...c}){r=co(r,n),o===void 0&&(o=fk(e,r,t));let f;if(Yt.get(t)===gf)f=zX(e),i=i===void 0?YX(f):Et(i,yf);else if(Yt.get(t)===Xn&&(i===void 0&&(n==="ordinal"||n===Mf)&&(i=FC(o,s),i!==void 0&&(s=void 0)),s===void 0&&i===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(i!==void 0){let l=vf(s),u=i[0],p=i[1]-i[0];i=({length:d})=>Ze(h=>l(u+p*h),d)}else i=k6(s);if(a===Uu)throw new Error(`implicit unknown on ${t} scale is not supported`);return ok(t,da().unknown(a),e,{...c,type:n,domain:o,range:i,hint:f})}function sk(t,e,{align:n=.5,padding:r=.5,...o}){return ck(Jv().align(n).padding(r),e,o,t)}function ak(t,e,{align:n=.5,padding:r=.1,paddingInner:o=r,paddingOuter:i=t==="fx"||t==="fy"?0:r,...s}){return ck(ji().align(n).paddingInner(o).paddingOuter(i),e,s,t)}function ck(t,e,n,r){let{round:o}=n;return o!==void 0&&t.round(o=!!o),t=ok(r,t,e,n),t.round=o,t}function fk(t,e,n){let r=new fn;for(let{value:o,domain:i}of t){if(i!==void 0)return i();if(o!==void 0)for(let s of o)r.add(s)}if(e!==void 0){let[o,i]=Rt(r).map(e.floor,e);return e.range(o,e.offset(i))}if(r.size>1e4&&Yt.get(n)===hr)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Do(r,ke)}function rk(t,e){let n;for(let{hint:r}of t){let o=r?.[e];if(o!==void 0){if(n===void 0)n=o;else if(n!==o)return}}return n}function zX(t){return{fill:rk(t,"fill"),stroke:rk(t,"stroke")}}function YX(t){return Pt(t.fill)?k_:Ey}function Bp(t,{label:e,inset:n=0,insetTop:r=n,insetRight:o=n,insetBottom:i=n,insetLeft:s=n,round:a,nice:c,clamp:f,zero:l,align:u,padding:p,projection:d,facet:{label:h=e}={},...m}={}){let g={};for(let[y,x]of t){let b=m[y],w=yk(y,x,{round:Yt.get(y)===hr?a:void 0,nice:c,clamp:f,zero:l,align:u,padding:p,projection:d,...b});if(w){let{label:_=y==="fx"||y==="fy"?h:e,percent:v,transform:A,inset:E,insetTop:T=E!==void 0?E:y==="y"?r:0,insetRight:$=E!==void 0?E:y==="x"?o:0,insetBottom:M=E!==void 0?E:y==="y"?i:0,insetLeft:k=E!==void 0?E:y==="x"?s:0}=b||{};if(A==null)A=void 0;else if(typeof A!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?UX(x,w):_,w.transform=A,y==="x"||y==="fx"?(w.insetLeft=+k,w.insetRight=+$):(y==="y"||y==="fy")&&(w.insetTop=+T,w.insetBottom=+M),g[y]=w}}return g}function B6(t){let e={},n={scales:e};for(let[r,o]of Object.entries(t)){let{scale:i,type:s,interval:a,label:c}=o;e[r]=bk(o),n[r]=i,i.type=s,a!=null&&(i.interval=a),c!=null&&(i.label=c)}return n}function hk(t,e){let{x:n,y:r,fx:o,fy:i}=t,s=o||i?tx(e):e;o&&lk(o,s),i&&uk(i,s);let a=o||i?z6(t,e):e;n&&lk(n,a),r&&uk(r,a)}function UX(t=[],e){let n;for(let{label:r}of t)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!po(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Ky(t){return Math.sign(oi(t.domain()))*Math.sign(oi(t.range()))}function tx(t){let{marginTop:e,marginRight:n,marginBottom:r,marginLeft:o,width:i,height:s,facet:{marginTop:a,marginRight:c,marginBottom:f,marginLeft:l}}=t;return{marginTop:Math.max(e,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,f),marginLeft:Math.max(o,l),width:i,height:s}}function z6({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=tx(n);return{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:t?t.scale.bandwidth()+s+o:a,height:e?e.scale.bandwidth()+r+i:c,facet:{width:a,height:c}}}function lk(t,e){if(t.range===void 0){let{insetLeft:n,insetRight:r}=t,{width:o,marginLeft:i=0,marginRight:s=0}=e,a=i+n,c=o-s-r;t.range=[a,Math.max(a,c)],po(t)||(t.range=gk(t)),t.scale.range(t.range)}mk(t)}function uk(t,e){if(t.range===void 0){let{insetTop:n,insetBottom:r}=t,{height:o,marginTop:i=0,marginBottom:s=0}=e,a=i+n,c=o-s-r;t.range=[Math.max(a,c),a],po(t)?t.range.reverse():t.range=gk(t),t.scale.range(t.range)}mk(t)}function mk(t){t.round===void 0&&GX(t)&&jX(t)<=30&&t.scale.round(!0)}function jX({scale:t}){let e=t.domain().length,[n,r]=t.range(),o=t.paddingInner?t.paddingInner():1,i=t.paddingOuter?t.paddingOuter():t.padding(),s=e-o,a=Math.abs(r-n)/Math.max(1,s+i*2);return(a-Math.floor(a))*s}function gk(t){let e=t.scale.domain().length+Y6(t);if(!(e>2))return t.range;let[n,r]=t.range;return Array.from({length:e},(o,i)=>n+i/(e-1)*(r-n))}function ex(t,e,n){return yk(t,n===void 0?void 0:[{hint:n}],{...e})}function yk(t,e=[],n={}){let r=XX(t,e,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&t!=="fx"&&t!=="fy"&&po({type:r})){let o=e.map(({value:i})=>i).filter(i=>i!==void 0);o.some(ne)?rn(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Af(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 ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${Af(r)}".`):o.some(sC)?rn(`Warning: some data associated with the ${t} 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 "${Af(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 ${t} scale to "${Af(r)}".`):o.some(aC)&&rn(`Warning: some data associated with the ${t} 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 "${Af(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${Af(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=Jy(e,n,xe);break;case"identity":switch(Yt.get(t)){case hr:n=Jy(e,n,xe);break;case gf:n=Jy(e,n,VX);break}break;case"utc":case"time":n=Jy(e,n,c6);break}switch(r){case"diverging":return ZC(t,e,n);case"diverging-sqrt":return QC(t,e,n);case"diverging-pow":return F6(t,e,n);case"diverging-log":return JC(t,e,n);case"diverging-symlog":return KC(t,e,n);case"categorical":case"ordinal":case Mf:return ik(t,e,n);case"cyclical":case"sequential":case"linear":return zC(t,e,n);case"sqrt":return YC(t,e,n);case"threshold":return Zy(t,e,n);case"quantile":return XC(t,e,n);case"quantize":return GC(t,e,n);case"pow":return L6(t,e,n);case"log":return UC(t,e,n);case"symlog":return jC(t,e,n);case"utc":return nk(t,e,n);case"time":return ek(t,e,n);case"point":return sk(t,e,n);case"band":return ak(t,e,n);case"identity":return VC(t);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Af(t){return typeof t=="symbol"?t.description:t}function pk(t){return typeof t=="string"?`${t}`.toLowerCase():t}var dk={toString:()=>"projection"};function XX(t,e,{type:n,domain:r,range:o,scheme:i,pivot:s,projection:a}){if(n=pk(n),t==="fx"||t==="fy")return"band";(t==="x"||t==="y")&&a!=null&&(n=dk);for(let f of e){let l=pk(f.type);if(l!==void 0){if(n===void 0)n=l;else if(n!==l)throw new Error(`scale incompatible with channel: ${n} !== ${l}`)}}if(n===dk)return;if(n!==void 0)return n;if(r===void 0&&!e.some(({value:f})=>f!==void 0))return;let c=Yt.get(t);if(c===Ea)return"sqrt";if(c===$a||c===Ia)return"linear";if(c===gf)return"ordinal";if((r||o||[]).length>2)return q6(c);if(r!==void 0){if(Kt(r))return q6(c);if(ne(r))return"utc"}else{let f=e.map(({value:l})=>l).filter(l=>l!==void 0);if(f.some(Kt))return q6(c);if(f.some(ne))return"utc"}if(c===Xn){if(s!=null||qC(i))return"diverging";if(PC(i))return"categorical"}return"linear"}function q6(t){switch(t){case hr:return"point";case Xn:return Mf;default:return"ordinal"}}function po({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===Mf}function Y6({type:t}){return t==="threshold"}function GX({type:t}){return t==="point"||t==="band"}function Gn(t){if(t===void 0)return!0;let e=t.domain(),n=t(e[0]);for(let r=1,o=e.length;r<o;++r)if(t(e[r])-n)return!1;return!0}function Jy(t,{domain:e,...n},r){for(let o of t)o.value!==void 0&&(e===void 0&&(e=o.value?.domain),o.value=r(o.value));return{domain:e===void 0?e:r(e),...n}}function VX(t){return Et(t,yf)}function is(t={}){let e;for(let n in t)if(Yt.has(n)&&so(t[n])){if(e!==void 0)throw new Error("ambiguous scale definition; multiple scales found");e=bk(ex(n,t[n]))}if(e===void 0)throw new Error("invalid scale definition; no scale found");return e}function xk(t){return e=>{if(!Yt.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}function bk({scale:t,type:e,domain:n,range:r,interpolate:o,interval:i,transform:s,percent:a,pivot:c}){if(e==="identity")return{type:"identity",apply:l=>l,invert:l=>l};let f=t.unknown?t.unknown():void 0;return{type:e,domain:Ki(n),...r!==void 0&&{range:Ki(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...f!==void 0&&{unknown:f},...i!==void 0&&{interval:i},...o!==void 0&&{interpolate:o},...t.clamp&&{clamp:t.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:l=>t(l),...t.invert&&{invert:l=>t.invert(l)}}}function vk(t,e){let{fx:n,fy:r}=Bp(t,e),o=n?.scale.domain(),i=r?.scale.domain();return o&&i?Sm(o,i).map(([s,a],c)=>({x:s,y:a,i:c})):o?o.map((s,a)=>({x:s,i:a})):i?i.map((s,a)=>({y:s,i:a})):void 0}function _k(t,{x:e,y:n}){return e&&=V6(e),n&&=V6(n),t.filter(e&&n?r=>e.has(r.x)&&n.has(r.y):e?r=>e.has(r.x):r=>n.has(r.y)).sort(e&&n?(r,o)=>e.get(r.x)-e.get(o.x)||n.get(r.y)-n.get(o.y):e?(r,o)=>e.get(r.x)-e.get(o.x):(r,o)=>n.get(r.y)-n.get(o.y))}function rx(t,{fx:e,fy:n}){let r=wn(t),o=e?.value,i=n?.value;return e&&n?vr(r,s=>(s.fx=o[s[0]],s.fy=i[s[0]],s),s=>o[s],s=>i[s]):e?vr(r,s=>(s.fx=o[s[0]],s),s=>o[s]):vr(r,s=>(s.fy=i[s[0]],s),s=>i[s])}function Sk(t,e,{marginTop:n,marginLeft:r}){return t&&e?({x:o,y:i})=>`translate(${t(o)-r},${e(i)-n})`:t?({x:o})=>`translate(${t(o)-r},0)`:({y:o})=>`translate(0,${e(o)-n})`}function Mk(t){let e=[],n=new Uint32Array(Ue(t,r=>r.length));for(let r of t){let o=0;for(let i of t)r!==i&&(n.set(i,o),o+=i.length);e.push(n.slice(0,o))}return e}var WX=new Map([["top",U6],["right",G6],["bottom",j6],["left",X6],["top-left",nx(U6,X6)],["top-right",nx(U6,G6)],["bottom-left",nx(j6,X6)],["bottom-right",nx(j6,G6)],["top-empty",ZX],["right-empty",KX],["bottom-empty",QX],["left-empty",JX],["empty",tG]]);function Ak(t){if(t==null)return null;let e=WX.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}var wk=new WeakMap;function V6(t){let e=wk.get(t);return e||wk.set(t,e=new cn(Et(t,(n,r)=>[n,r]))),e}function ss(t,e){return V6(t).get(e)}function HX(t,e,n){return e=pr(e),n=pr(n),t.find(r=>Object.is(pr(r.x),e)&&Object.is(pr(r.y),n))}function ox(t,e,n){return HX(t,e,n)?.empty}function U6(t,{y:e},{y:n}){return e?ss(e,n)===0:!0}function j6(t,{y:e},{y:n}){return e?ss(e,n)===e.length-1:!0}function X6(t,{x:e},{x:n}){return e?ss(e,n)===0:!0}function G6(t,{x:e},{x:n}){return e?ss(e,n)===e.length-1:!0}function ZX(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,r);if(i>0)return ox(t,n,e[i-1])}function QX(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,r);if(i<e.length-1)return ox(t,n,e[i+1])}function JX(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,n);if(i>0)return ox(t,e[i-1],r)}function KX(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,n);if(i<e.length-1)return ox(t,e[i+1],r)}function tG(t,e,{empty:n}){return n}function nx(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function ix(t,{channels:{fx:e,fy:n},groups:r}){return e&&n?t.map(({x:o,y:i})=>r.get(o)?.get(i)??[]):e?t.map(({x:o})=>r.get(o)??[]):t.map(({y:o})=>r.get(o)??[])}var Tk=Math.PI,di=2*Tk,W6=.618;function Ek({projection:t,inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={},s){if(t==null)return;if(typeof t.stream=="function")return t;let a,c,f="frame";if(Ne(t)){let _;if({type:t,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:o=_!==void 0?_:o,insetLeft:i=_!==void 0?_:i,clip:f=f,...a}=t,t==null)return}typeof t!="function"&&({type:t}=H6(t));let{width:l,height:u,marginLeft:p,marginRight:d,marginTop:h,marginBottom:m}=s,g=l-p-d-i-r,y=u-h-m-n-o;if(t=t?.({width:g,height:y,clip:f,...a}),t==null)return;f=eG(f,p,h,l-d,u-m);let x=p+i,b=h+n,w;if(c!=null){let[[_,v],[A,E]]=Ie(t).bounds(c),T=Math.min(g/(A-_),y/(E-v));T>0?(x-=(T*(_+A)-g)/2,b-=(T*(v+E)-y)/2,w=la({point($,M){this.stream.point($*T+x,M*T+b)}})):rn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?Ik():la({point(_,v){this.stream.point(_+x,v+b)}}),{stream:_=>t.stream(w.stream(f(_)))}}function H6(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Tr(Tv,.7463,.4673);case"albers":return sx(Pu,.7463,.4673);case"azimuthal-equal-area":return Tr(Iv,4,4);case"azimuthal-equidistant":return Tr(Cv,di,di);case"conic-conformal":return sx(Ov,di,di);case"conic-equal-area":return sx(Yi,6.1702,2.9781);case"conic-equidistant":return sx(Lv,7.312,3.6282);case"equal-earth":return Tr(Pv,5.4133,2.6347);case"equirectangular":return Tr(Rv,di,Tk);case"gnomonic":return Tr(qv,3.4641,3.4641);case"identity":return{type:Ik};case"reflect-y":return{type:nG};case"mercator":return Tr(kv,di,di);case"orthographic":return Tr(zv,2,2);case"stereographic":return Tr(Uv,2,2);case"transverse-mercator":return Tr(Xv,di,di);default:throw new Error(`unknown projection type: ${t}`)}}function eG(t,e,n,r,o){if(t===!1||t==null||typeof t=="number")return i=>i;switch(t===!0&&(t="frame"),`${t}`.toLowerCase()){case"frame":return qc(e,n,r,o);default:throw new Error(`unknown projection clip type: ${t}`)}}function Tr(t,e,n){return{type:({width:r,height:o,rotate:i,precision:s=.15,clip:a})=>{let c=t();return s!=null&&c.precision?.(s),i!=null&&c.rotate?.(i),typeof a=="number"&&c.clipAngle?.(a),r!=null&&(c.scale(Math.min(r/e,o/n)),c.translate([r/2,o/2])),c},aspectRatio:n/e}}function sx(t,e,n){let{type:r,aspectRatio:o}=Tr(t,e,n);return{type:i=>{let{parallels:s,domain:a,width:c,height:f}=i,l=r(i);return s!=null&&(l.parallels(s),a===void 0&&c!=null&&l.fitSize([c,f],{type:"Sphere"})),l},aspectRatio:o}}var Ik=re({stream:t=>t}),nG=re(la({point(t,e){this.stream.point(t,-e)}}));function Z6(t,e,n,r){let o=n[t],i=n[e],s=o.length,a=n[t]=new Float64Array(s).fill(NaN),c=n[e]=new Float64Array(s).fill(NaN),f,l=r.stream({point(u,p){a[f]=u,c[f]=p}});for(f=0;f<s;++f)l.point(o[f],i[f])}function $k({projection:t}={}){return t==null?!1:typeof t.stream=="function"?!0:(Ne(t)&&(t=t.type),t!=null)}function Ck(t){if(typeof t?.stream=="function")return W6;if(Ne(t)){let e,n;if({domain:e,type:t,...n}=t,e!=null&&t!=null){let r=typeof t=="string"?H6(t).type:t,[[o,i],[s,a]]=Ie(r({...n,width:100,height:100})).bounds(e),c=(a-i)/(s-o);return c&&isFinite(c)?c<.2?.2:c>5?5:c:W6}}if(t!=null){if(typeof t!="function"){let{aspectRatio:e}=H6(t);if(e)return e}return W6}}function ho(t,e,{projection:n}){let{x:r,y:o}=t,i={};return r&&(i.x=r),o&&(i.y=o),i=wf(i,e),n&&r?.scale==="x"&&o?.scale==="y"&&Z6("x","y",i,n),r&&(i.x=xe(i.x)),o&&(i.y=xe(i.y)),i}function kk(t){let e=[],n=[],r={scale:"x",value:e},o={scale:"y",value:n},i={point(s,a){e.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of t.value)qn(s,i);return[r,o]}function as(t={}){let{document:e=typeof window<"u"?window.document:void 0,clip:n}=t;return{document:e,clip:zy(n)}}function st(t,{document:e}){return St(Bo(t).call(e.documentElement))}var ax=Symbol("unset");function cs(t){return(t.length===1?rG:oG)(t)}function rG(t){let e,n=ax;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function oG(t){let e,n;return(...r)=>((n?.length!==r.length||n.some((o,i)=>!Object.is(o,r[i])))&&(n=r,e=t(...r)),e)}var iG=cs(t=>new Intl.NumberFormat(t)),sG=cs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}})),aG=cs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}}));function Q6(t="en-US"){let e=iG(t);return n=>n!=null&&!isNaN(n)?e.format(n):void 0}function Nk(t="en-US",e="short"){let n=sG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function Ok(t="en-US",e="short"){let n=aG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function J6(t){return cf(t,"Invalid Date")}function cG(t="en-US"){let e=Q6(t);return n=>(n instanceof Date?J6:typeof n=="number"?e:fe)(n)}var mo=cG();var oe=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,fG=0,lG=0;function K6(){return`plot-clip-${++fG}`}function Rk(){return`plot-pattern-${++lG}`}function cx(t,{title:e,href:n,ariaLabel:r,ariaDescription:o,ariaHidden:i,target:s,fill:a,fillOpacity:c,stroke:f,strokeWidth:l,strokeOpacity:u,strokeLinejoin:p,strokeLinecap:d,strokeMiterlimit:h,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:A},{ariaLabel:E,fill:T="currentColor",fillOpacity:$,stroke:M="none",strokeOpacity:k,strokeWidth:R,strokeLinecap:S,strokeLinejoin:I,strokeMiterlimit:C,paintOrder:N}){T===null&&(a=null,c=null),M===null&&(f=null,u=null),Pt(T)?!Pt(M)&&(!Pt(a)||A?.fill)&&(M="none"):Pt(M)&&(!Pt(f)||A?.stroke)&&(T="none");let[D,L]=ee(a,T),[P,F]=Ft(c,$),[q,W]=ee(f,M),[tt,nt]=Ft(u,k),[ot,X]=Ft(y);fi(W)||(l===void 0&&(l=R),d===void 0&&(d=S),p===void 0&&(p=I),h===void 0&&!fC(p)&&(h=C),!fi(L)&&w===void 0&&(w=N));let[rt,Y]=Ft(l);return T!==null&&(t.fill=Wt(L,"currentColor"),t.fillOpacity=zp(F,1)),M!==null&&(t.stroke=Wt(W,"none"),t.strokeWidth=zp(Y,1),t.strokeOpacity=zp(nt,1),t.strokeLinejoin=Wt(p,"miter"),t.strokeLinecap=Wt(d,"butt"),t.strokeMiterlimit=zp(h,4),t.strokeDasharray=Wt(m,"none"),t.strokeDashoffset=Wt(g,"0")),t.target=fe(s),t.ariaLabel=fe(E),t.ariaDescription=fe(o),t.ariaHidden=fe(i),t.opacity=zp(X,1),t.mixBlendMode=Wt(x,"normal"),t.imageFilter=Wt(b,"none"),t.paintOrder=Wt(w,"normal"),t.pointerEvents=Wt(_,"auto"),t.shapeRendering=Wt(v,"auto"),{title:{value:e,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:D,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:q,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:ot,scale:"auto",optional:!0}}}function uG(t,e){e&&t.filter(n=>Ap(e[n])).append("title").call(dG,e)}function pG(t,e){e&&t.filter(([n])=>Ap(e[n])).append("title").call(hG,e)}function dG(t,e){e&&t.text(n=>mo(e[n]))}function hG(t,e){e&&t.text(([n])=>mo(e[n]))}function Tt(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:l,href:u}){r&&at(t,"aria-label",p=>r[p]),i&&at(t,"fill",p=>i[p]),s&&at(t,"fill-opacity",p=>s[p]),a&&at(t,"stroke",p=>a[p]),c&&at(t,"stroke-opacity",p=>c[p]),f&&at(t,"stroke-width",p=>f[p]),l&&at(t,"opacity",p=>l[p]),u&&Dk(t,p=>u[p],e),n||uG(t,o)}function Ca(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:l,href:u}){r&&at(t,"aria-label",([p])=>r[p]),i&&at(t,"fill",([p])=>i[p]),s&&at(t,"fill-opacity",([p])=>s[p]),a&&at(t,"stroke",([p])=>a[p]),c&&at(t,"stroke-opacity",([p])=>c[p]),f&&at(t,"stroke-width",([p])=>f[p]),l&&at(t,"opacity",([p])=>l[p]),u&&Dk(t,([p])=>u[p],e),n||pG(t,o)}function mG({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:o,strokeOpacity:i,strokeWidth:s,opacity:a,href:c},{tip:f}){return[t,f?void 0:e,n,r,o,i,s,a,c].filter(l=>l!==void 0)}function Yp(t,e,n){let r=ze(t,o=>e[o]);return n===void 0&&r.size>1+t.length>>1&&rn("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*fx(t,e,n,r){let{z:o}=n,{z:i}=r,s=mG(r,n),a=[...e,...s];for(let c of i?Yp(t,i,o):[t]){let f,l;t:for(let u of c){for(let p of a)if(!Jt(p[u])){l&&l.push(-1);continue t}if(f===void 0){l&&(yield l),f=s.map(p=>pr(p[u])),l=[u];continue}l.push(u);for(let p=0;p<s.length;++p)if(pr(s[p][u])!==f[p]){yield l,f=s.map(h=>pr(h[u])),l=[u];continue t}}l&&(yield l)}}function gG(t,e,n,r){let o,{clip:i=r.clip}=e;switch(i){case"frame":{t=st("svg:g",r).each(function(){this.appendChild(t.node()),t.node=()=>this}),o=yG(r,n);break}case"sphere":{o=xG(r);break}}at(t,"aria-label",e.ariaLabel),at(t,"aria-description",e.ariaDescription),at(t,"aria-hidden",e.ariaHidden),at(t,"clip-path",o)}function Lk(t){let e=new WeakMap;return(n,r)=>{let o=e.get(n);if(!o){let i=K6();St(n.ownerSVGElement).append("clipPath").attr("id",i).call(t,n,r),e.set(n,o=`url(#${i})`)}return o}}var yG=Lk((t,e,n)=>{let{width:r,height:o,marginLeft:i,marginRight:s,marginTop:a,marginBottom:c}=n;t.append("rect").attr("x",i).attr("y",a).attr("width",r-s-i).attr("height",o-a-c)}),xG=Lk((t,e)=>{let{projection:n}=e;if(!n)throw new Error('the "sphere" clip option requires a projection');t.append("path").attr("d",Ie(n)({type:"Sphere"}))});function xt(t,e,n,r){gG(t,e,n,r),at(t,"class",e.className),at(t,"fill",e.fill),at(t,"fill-opacity",e.fillOpacity),at(t,"stroke",e.stroke),at(t,"stroke-width",e.strokeWidth),at(t,"stroke-opacity",e.strokeOpacity),at(t,"stroke-linejoin",e.strokeLinejoin),at(t,"stroke-linecap",e.strokeLinecap),at(t,"stroke-miterlimit",e.strokeMiterlimit),at(t,"stroke-dasharray",e.strokeDasharray),at(t,"stroke-dashoffset",e.strokeDashoffset),at(t,"shape-rendering",e.shapeRendering),at(t,"filter",e.imageFilter),at(t,"paint-order",e.paintOrder);let{pointerEvents:o=r.pointerSticky===!1?"none":void 0}=e;at(t,"pointer-events",o)}function dt(t,e){bG(t,"mix-blend-mode",e.mixBlendMode),at(t,"opacity",e.opacity)}function Dk(t,e,n){t.each(function(r){let o=e(r);if(o!=null){let i=this.ownerDocument.createElementNS(un.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(un.xlink,"href",o),n!=null&&i.setAttribute("target",n),this.parentNode.insertBefore(i,this).appendChild(this)}})}function at(t,e,n){n!=null&&t.attr(e,n)}function bG(t,e,n){n!=null&&t.style(e,n)}function mt(t,e,{x:n,y:r},o=oe,i=oe){o+=e.dx,i+=e.dy,n?.bandwidth&&(o+=n.bandwidth()/2),r?.bandwidth&&(i+=r.bandwidth()/2),(o||i)&&t.attr("transform",`translate(${o},${i})`)}function Wt(t,e){if((t=fe(t))!==e)return t}function zp(t,e){if((t=Ot(t))!==e)return t}var wG=/^-?([_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 fs(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!wG.test(t))throw new Error(`invalid class name: ${t}`);return t}function Tf(t,e){if(typeof e=="string")t.property("style",e);else if(e!=null)for(let n of t)Object.assign(n.style,e)}function Le({frameAnchor:t},{width:e,height:n,marginTop:r,marginRight:o,marginBottom:i,marginLeft:s}){return[/left$/.test(t)?s:/right$/.test(t)?e-o:(s+e-o)/2,/^top/.test(t)?r:/^bottom/.test(t)?n-i:(r+n-i)/2]}var pt=class{constructor(e,n={},r={},o){let{facet:i="auto",facetAnchor:s,fx:a,fy:c,sort:f,dx:l=0,dy:u=0,margin:p=0,marginTop:d=p,marginRight:h=p,marginBottom:m=p,marginLeft:g=p,className:y,clip:x=o?.clip,channels:b,tip:w,render:_}=r;if(this.data=e,this.sort=ao(f)?f:null,this.initializer=Vt(r).initializer,this.transform=this.initializer?r.transform:be(r).transform,i===null||i===!1?this.facet=null:(this.facet=Se(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=e===Qi&&typeof a=="string"?[a]:a,this.fy=e===Qi&&typeof c=="string"?[c]:c),this.facetAnchor=Ak(s),n=Np(n),b!==void 0&&(n={...vG(b),...n}),o!==void 0&&(n={...cx(this,r,o),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,A])=>{if(jn(A.value)){let{value:E,label:T=A.label,scale:$=A.scale}=A.value;A={...A,label:T,scale:$,value:E}}if(e===Qi&&typeof A.value=="string"){let{value:E}=A;A={...A,value:[E]}}return[v,A]}).filter(([v,{value:A,optional:E}])=>{if(A!=null)return!0;if(E)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+l,this.dy=+u,this.marginTop=+d,this.marginRight=+h,this.marginBottom=+m,this.marginLeft=+g,this.clip=zy(x),this.tip=_G(w),this.className=y?fs(y):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:A}=n[v];if(!(A!=="x"&&A!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=hi(_,this.render))}initialize(e,n,r){let o=ii(this.data);e===void 0&&o!=null&&(e=[wn(o)]);let i=e;this.transform!=null&&({facets:e,data:o}=this.transform(o,e,r),o=ii(o)),e!==void 0&&(e.original=i);let s=Hy(this.channels,o);return this.sort!=null&&$C(o,e,s,n,this.sort),{data:o,facets:e,channels:s}}filter(e,n,r){for(let o in n){let{filter:i=Jt}=n[o];if(i!==null){let s=r[o];e=e.filter(a=>i(s[a]))}}return e}project(e,n,r){for(let o in e)if(e[o].scale==="x"&&/^x|x$/.test(o)){let i=o.replace(/^x|x$/,"y");i in e&&e[i].scale==="y"&&Z6(o,i,n,r.projection)}}scale(e,n,r){let o=wf(e,n);return r.projection&&this.project(e,o,r),o}};function we(...t){return t.plot=pt.prototype.plot,t}function hi(t,e){if(t==null)return e===null?void 0:e;if(e==null)return t===null?void 0:t;if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);return function(n,r,o,i,s,a){return t.call(this,n,r,o,i,s,(c,f,l,u,p)=>e.call(this,c,f,l,u,p,a))}}function vG(t){return Object.fromEntries(Object.entries(Np(t)).map(([e,n])=>(n=typeof n=="string"?{value:n,label:e}:dr(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[e,n])))}function _G(t){return t===!0?"xy":t===!1||t==null?null:typeof t=="string"?Se(t,"tip",["x","y","xy"]):t}function Er(t,e){return t?.tip===!0?{...t,tip:e}:Ne(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:e}}:t}function Fk(t,e,n={}){let r=.5-oe,o=.5+oe,i=.5+oe,s=.5-oe;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:x}of e)m>r&&(r=m),g>o&&(o=g),y>i&&(i=y),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:f=a!==void 0?a:o,marginBottom:l=a!==void 0?a:i,marginLeft:u=a!==void 0?a:s}=n;c=+c,f=+f,l=+l,u=+u;let{width:p=640,height:d=SG(t,n,{width:p,marginTopDefault:r,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:s})+Math.max(0,c-r+l-i)}=n;p=+p,d=+d;let h={width:p,height:d,marginTop:c,marginRight:f,marginBottom:l,marginLeft:u};if(t.fx||t.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:f,marginBottom:x=m!==void 0?m:l,marginLeft:b=m!==void 0?m:u}=n.facet??{};g=+g,y=+y,x=+x,b=+b,h.facet={marginTop:g,marginRight:y,marginBottom:x,marginLeft:b}}return h}function SG({x:t,y:e,fy:n,fx:r},{projection:o,aspectRatio:i},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:f,marginLeftDefault:l}){let u=n&&n.scale.domain().length||1,p=Ck(o);if(p){let h=r?r.scale.domain().length:1,m=(1.1*u-.1)/(1.1*h-.1)*p,g=Math.max(.1,Math.min(10,m));return Math.round((s-l-c)*g+a+f)}let d=e?po(e)?e.scale.domain().length||1:Math.max(7,17/u):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=Pk("y",e)/(Pk("x",t)*i),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-l-c)-t.insetLeft-t.insetRight;return(h*y+e.insetTop+e.insetBottom)/g+a+f}return!!(e||n)*Math.max(1,Math.min(60,d*u))*20+!!r*30+60}function Pk(t,e){if(!e)throw new Error(`aspectRatio requires ${t} scale`);let{type:n,domain:r}=e,o;switch(n){case"linear":case"utc":case"time":o=Number;break;case"pow":{let a=e.scale.exponent();o=c=>Math.pow(c,a);break}case"log":o=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${t} scale for aspectRatio: ${n}`)}let[i,s]=Rt(r);return Math.abs(o(s)-o(i))}var qk=new WeakMap;function t3(t,e,{x:n,y:r,px:o,py:i,maxRadius:s=40,channels:a,render:c,...f}={}){return s=+s,o!=null&&(n??=null,a={...a,px:{value:o,scale:"x"}}),i!=null&&(r??=null,a={...a,py:{value:i,scale:"y"}}),{x:n,y:r,channels:a,...f,render:hi(function(l,u,p,d,h,m){h={...h,pointerSticky:!1};let g=h.ownerSVGElement,{data:y}=h.getMarkState(this),x=qk.get(g);x||qk.set(g,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:_,fx:v,fy:A}=u,E=v?v(l.fx)-d.marginLeft:0,T=A?A(l.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),_?.bandwidth&&(T+=_.bandwidth()/2);let $=l.fi!=null,M;if($){let X=x.facetStates;X||(x.facetStates=X=new Map),M=X.get(this),M||X.set(this,M=new Map)}let[k,R]=Le(this,d),{px:S,py:I}=p,C=S?X=>S[X]:e3(p,k),N=I?X=>I[X]:n3(p,R),D,L,P,F;function q(X,rt){if($)if(F&&(F=cancelAnimationFrame(F)),X==null)M.delete(l.fi);else{M.set(l.fi,rt),F=requestAnimationFrame(()=>{F=null;for(let[Y,H]of M)if(H<rt||H===rt&&Y<l.fi){X=null;break}W(X)});return}W(X)}function W(X){if(D===X&&P===x.sticky)return;D=X,P=h.pointerSticky=x.sticky;let rt=D==null?[]:[D];$&&(rt.fx=l.fx,rt.fy=l.fy,rt.fi=l.fi);let Y=m(rt,u,p,d,h);if(L){if($){let H=L.parentNode,et=L.getAttribute("transform"),B=Y.getAttribute("transform");et?Y.setAttribute("transform",et):Y.removeAttribute("transform"),B?H.setAttribute("transform",B):H.removeAttribute("transform"),Y.removeAttribute("aria-label"),Y.removeAttribute("aria-description"),Y.removeAttribute("aria-hidden")}L.replaceWith(Y)}if(x.roots[b]=L=Y,!(D==null&&M?.size>1)){let H=D==null?null:Cn(y)?y[D]:y.get(D);h.dispatchValue(H)}return Y}function tt(X){if(x.sticky||X.pointerType==="mouse"&&X.buttons===1)return;let[rt,Y]=He(X);rt-=E,Y-=T;let H=rt<d.marginLeft||rt>d.width-d.marginRight?1:t,et=Y<d.marginTop||Y>d.height-d.marginBottom?1:e,B=null,wt=s*s;for(let ct of l){let It=H*(C(ct)-rt),kt=et*(N(ct)-Y),J=It*It+kt*kt;J<=wt&&(B=ct,wt=J)}if(B!=null&&(t!==1||e!==1)){let ct=C(B)-rt,It=N(B)-Y;wt=ct*ct+It*It}q(B,wt)}function nt(X){X.pointerType==="mouse"&&D!=null&&(x.sticky&&x.roots.some(rt=>rt?.contains(X.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(rt=>rt(null))):(x.sticky=!0,W(D)),X.stopImmediatePropagation()))}function ot(X){X.pointerType==="mouse"&&(x.sticky||q(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",ot),W(null)},c)}}function ls(t){return t3(1,1,t)}function us(t){return t3(1,.01,t)}function mi(t){return t3(.01,1,t)}function e3({x1:t,x2:e,x:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function n3({y1:t,y2:e,y:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function lx(t){return po(t)&&t.interval===void 0?void 0:"tabular-nums"}function Bk(t,e){let{label:n=t.label,tickSize:r=6,width:o=240,height:i=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:f=0,style:l,ticks:u=(o-f-a)/64,tickFormat:p,fontVariant:d=lx(t),round:h=!0,opacity:m,className:g}=e,y=as(e);g=fs(g),m=Ft(m)[1],p===null&&(p=()=>null);let x=st("svg",y).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",i).attr("viewBox",`0 0 ${o} ${i}`).call(k=>k.append("style").text(`:where(.${g}-ramp) {
|
|
17
8
|
display: block;
|
|
18
9
|
height: auto;
|
|
19
10
|
height: intrinsic;
|
|
20
11
|
max-width: 100%;
|
|
21
12
|
overflow: visible;
|
|
22
13
|
}
|
|
23
|
-
:where(.${
|
|
14
|
+
:where(.${g}-ramp text) {
|
|
24
15
|
white-space: pre;
|
|
25
|
-
}`)).call(Wf,u),b=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,_=p?(O,C)=>O.rangeRound(C):(O,C)=>O.range(C),{type:v,domain:I,range:E,interpolate:M,scale:N,pivot:A}=e;if(M){let O=E===void 0?M:Eo(M.length===1?ly(M):M,E);w=_(N.copy(),$n(Se(l,i-a),Math.min(I.length+(A!==void 0),E===void 0?1/0:E.length)));let C=256,S=g.document.createElement("canvas");S.width=C,S.height=1;let T=S.getContext("2d");for(let D=0,R=C-1;D<C;++D)T.fillStyle=O(D/R),T.fillRect(D,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(v==="threshold"){let O=I,C=h===void 0?S=>S:typeof h=="string"?pi(h):h;w=_(zs().domain([-1,E.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,T)=>w(T-1)).attr("y",s).attr("width",(S,T)=>w(T)-w(T-1)).attr("height",o-s-c).attr("fill",S=>S),f=Wt(O,(S,T)=>T),h=S=>C(O[S],S)}else w=_(qa().domain(I),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(I).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",N),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(vI(w).ticks(Array.isArray(f)?null:f,typeof h=="string"?h:void 0).tickFormat(typeof h=="function"?h:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",he(d,"normal")).call(b).call(O=>O.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var Zf=Math.PI/180;function Wi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=uT(n),e.markerMid=uT(r),e.markerEnd=uT(i)}function uT(e){if(e==null||e===!1)return null;if(e===!0)return d$;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return h$("auto");case"arrow-reverse":return h$("auto-start-reverse");case"dot":return pK;case"circle":case"circle-fill":return d$;case"circle-stroke":return mK;case"tick":return fT("auto");case"tick-x":return fT(90);case"tick-y":return fT(0)}throw new Error(`invalid marker: ${e}`)}function h$(e){return(t,n)=>ut("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 pK(e,t){return ut("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 d$(e,t){return ut("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 mK(e,t){return ut("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 fT(e){return(t,n)=>ut("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 yK=0;function aa(e,t,{stroke:n},r){return m$(e,t,n&&(i=>n[i]),r)}function p$(e,t,{stroke:n},r){return m$(e,t,n&&(([i])=>n[i]),r)}function m$(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),h=a.get(l);h||a.set(l,h=new Map);let d=h.get(f);if(!d){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++yK}`;p.setAttribute("id",m),h.set(f,d=`url(#${m})`)}return d}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function kl({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=y$(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Rl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=y$(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function y$(e,t,n){return e===void 0&&t===void 0&&n===void 0?Ce?[1,0]:[.5,.5]:[t,n]}function g$(e,{interval:t}){return e={...wi(e)},e.interval=Rf(e.interval===void 0?t:e.interval),e}function Kw(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=g$(i,n);if(a==null||c==null&&!r)return n;let l=Cn(i);if(c==null){let d,p={transform:m=>d||(d=wt(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 h(d){return f!==void 0&&d===u?f:f=Wt(wt(u=d,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:h,label:l}:o,[`${e}2`]:s===void 0?{transform:d=>h(d).map(p=>c.offset(p)),label:l}:s})}function x$(e,t,n){let{[e]:r}=n,{value:i,interval:o}=g$(r,n);return i==null||o==null?n:t({...n,[e]:{label:Cn(r),transform:s=>{let a=Wt(wt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Be(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 hT(e={}){return Kw("x",kl,e,!0)}function dT(e={}){return Kw("y",Rl,e,!0)}function tv(e={}){return Kw("x",kl,e)}function ev(e={}){return Kw("y",Rl,e)}function nv(e={}){return x$("x",kl,e)}function rv(e={}){return x$("y",Rl,e)}var b$={ariaLabel:"rule",fill:null,stroke:"currentColor"},dy=class extends St{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}},Gi(n,"x"),b$),this.insetTop=Bt(a),this.insetBottom=Bt(c),Wi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:x}=this;return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s},Ce,0).call(b=>b.selectAll().data(t).enter().append("line").call(Ct,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!fr(a)?w=>l[w]+g:d+g).attr("y2",u&&!fr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:h-y-x).call(Kt,this,r).call(aa,this,r,o)).node()}},py=class extends St{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}},Gi(n,"y"),b$),this.insetRight=Bt(a),this.insetLeft=Bt(c),Wi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:x}=this;return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{y:c&&a},0,Ce).call(b=>b.selectAll().data(t).enter().append("line").call(Ct,this).attr("x1",l&&!fr(s)?w=>l[w]+g:m+g).attr("x2",u&&!fr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(d+h-y)/2).attr("y2",c?w=>c[w]:(d+h-y)/2).call(Kt,this,r).call(aa,this,r,o)).node()}};function Xr(e,t){let{x:n=G,y:r,y1:i,y2:o,...s}=ev(t);return[i,o]=w$(r,i,o),new dy(e,{...s,x:n,y1:i,y2:o})}function Gr(e,t){let{y:n=G,x:r,x1:i,x2:o,...s}=tv(t);return[i,o]=w$(r,i,o),new py(e,{...s,y:n,x1:i,x2:o})}function w$(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 lc(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 gK={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},M$="\xAD",$l=class extends St{constructor(t,n={}){let{x:r,y:i,text:o=ur(t)&&Mw(t)?G:Ee,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:h,fontFamily:d=h?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:x}=n,[b,w]=ae(x,0),[_,v]=vK(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:OF(b),optional:!0},text:{value:o,filter:Zm,optional:!0}},n,gK),this.rotate=w,this.textAnchor=he(a,"middle"),this.lineAnchor=cn(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=mT(f),this.monospace=!!h,this.fontFamily=qe(d),this.fontSize=v,this.fontStyle=qe(m),this.fontVariant=qe(y),this.fontWeight=qe(g),this.frameAnchor=Go(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=gT(this),this.clipLine=xT(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:h,fontSize:d}=r,{rotate:p}=this,[m,y]=vn(this,i);return ut("svg:g",o).call(kt,this,i,o).call(yT,this,f,i).call(Et,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Ct,this).call(xK,this,f,h).attr("transform",lc`translate(${c?x=>c[x]:m},${l?x=>l[x]:y})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",d&&(x=>d[x])).call(Kt,this,r)).node()}};function mT(e){return e==null?null:cn(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function xK(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(Xi(n[l])??"").map(c),f=u.length,h=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let d=0;for(let p=0;p<f;++p){if(++d,!u[p])continue;let m=this.ownerDocument.createElementNS(ui.svg,"tspan");m.setAttribute("x",0),p===d-1?m.setAttribute("y",`${(h+p)*o}em`):m.setAttribute("dy",`${d*o}em`),m.textContent=u[p],this.appendChild(m),d=0}}else h&&this.setAttribute("y",`${h*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let d=this.ownerDocument.createElementNS(ui.svg,"title");d.textContent=n[l],this.appendChild(d)}})}function Zo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Pe(t,n)),new $l(e,{...r,x:t,y:n})}function iv(e,{x:t=G,...n}={}){return new $l(e,rv({...n,x:t}))}function ov(e,{y:t=G,...n}={}){return new $l(e,nv({...n,y:t}))}function yT(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?bK(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function bK(e){return e&&(ta(e)||Be(e))?"tabular-nums":void 0}var wK=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function vK(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),wK.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function _K(e,t,n){let r=[],i,o=0;for(let[s,a,c]of SK(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===M$?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*SK(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case M$:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
|
|
26
|
-
`&&++
|
|
27
|
-
`:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var v$={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 sv(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Jf(e,i))r+=v$[e[i]]??(T$(e,i)?120:v$.e);return r}function av(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Jf(e,i))r+=T$(e,i)?126:63;return r}function gT({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?av:sv,i=t*100;return o=>_K(o,i,r)}function xT({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?av:sv,i=t*100;switch(n){case"clip-start":return o=>S$(o,i,r,"");case"clip-end":return o=>_$(o,i,r,"");case"ellipsis-start":return o=>S$(o,i,r,Fl);case"ellipsis-middle":return o=>IK(o,i,r,Fl);case"ellipsis-end":return o=>_$(o,i,r,Fl)}}var Fl="\u2026";function Pl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Jf(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 _$(e,t,n,r){e=e.trim();let i=n(r),[o]=Pl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function IK(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Pl(e,t/2,n,o),[c]=Pl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Jf(e,c)).trimStart()}function S$(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Pl(e,i-t+o,n,-o);return s<0?r:r+e.slice(Jf(e,s)).trimStart()}var pT=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,I$=/\p{Extended_Pictographic}/uy;function Jf(e,t){return t+=MK(e,t)?2:1,TK(e,t)&&(t=pT.lastIndex),AK(e,t)?Jf(e,t+1):t}function A$(e,t){return e.charCodeAt(t)<128}function MK(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 AK(e,t){return e.charCodeAt(t)===8205}function TK(e,t){return A$(e,t)?!1:(pT.lastIndex=t,pT.test(e))}function T$(e,t){return A$(e,t)?!1:(I$.lastIndex=t,I$.test(e))}var E$={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},D$=3.5,EK=D$*5,N$={draw(e,t,n){let r=t*n/EK;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},O$={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},DK=new Map([["arrow",N$],["spike",O$]]);function NK(e){return e&&typeof e.draw=="function"}function OK(e){if(NK(e))return e;let t=DK.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Ul=class extends St{constructor(t,n={}){let{x:r,y:i,r:o=D$,length:s,rotate:a,shape:c=N$,anchor:l="middle",frameAnchor:u}=n,[f,h]=ae(s,12),[d,p]=ae(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,E$),this.r=+o,this.length=h,this.rotate=p,this.shape=OK(c),this.anchor=cn(l,"anchor",["start","middle","end"]),this.frameAnchor=Go(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:h,rotate:d,anchor:p,shape:m,r:y}=this,[g,x]=vn(this,i);return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Ct,this).attr("transform",lc`translate(${c?w=>c[w]:g},${l?w=>l[w]:x})${f?w=>` rotate(${f[w]})`:d?` rotate(${d})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${h})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${h/2})`}`).attr("d",u?w=>{let _=rr();return m.draw(_,u[w],y),_}:(()=>{let w=rr();return m.draw(w,h,y),w})()).call(Kt,this,r)).node()}};function bT(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Pe(n,r)),new Ul(e,{...i,x:n,y:r})}function cv(e,t={}){let{x:n=G,...r}=t;return new Ul(e,{...r,x:n})}function lv(e,t={}){let{y:n=G,...r}=t;return new Ul(e,{...r,y:n})}function L$(e,t={}){let{shape:n=O$,stroke:r=E$.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return bT(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function uc(e,t){return arguments.length<2&&!ur(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function uv({anchor:e}={},t){return e===void 0?t[0]:cn(e,"anchor",t)}function B$(e){return uv(e,["left","right"])}function C$(e){return uv(e,["right","left"])}function k$(e){return uv(e,["bottom","top"])}function R$(e){return uv(e,["top","bottom"])}function my(){let[e,t]=uc(...arguments);return F$("y",B$(t),e,t)}function fv(){let[e,t]=uc(...arguments);return F$("fy",C$(t),e,t)}function yy(){let[e,t]=uc(...arguments);return $$("x",k$(t),e,t)}function hv(){let[e,t]=uc(...arguments);return $$("fx",R$(t),e,t)}function F$(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?t==="right"?40:0:x,marginBottom:_=x===void 0?20:x,marginLeft:v=x===void 0?t==="left"?40:0:x,label:I,labelAnchor:E,labelArrow:M,labelOffset:N,...A}){return p=Bt(p),m=Bt(m),y=Bt(y),E!==void 0&&(E=cn(E,"labelAnchor",["center","top","bottom"])),M=X$(M),nn(p&&!ie(o)?LK(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...A}):null,ie(c)?null:CK(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...A}),!ie(c)&&I!==null?Zo([],q$({fill:c,fillOpacity:l,...A},function(O,C,S,T,D){let R=T[e],{marginTop:F,marginRight:k,marginBottom:$,marginLeft:P}=e==="y"&&D.inset||D,U=E??(R.bandwidth?"center":"top"),W=N??(t==="right"?k:P)-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-F:U==="bottom"?$-3:0,this.dx=t==="right"?W:-W,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Y$(e,R,{anchor:t,label:I,labelAnchor:U,labelArrow:M})]}}}})):null)}function $$(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:_=x===void 0?t==="bottom"?30:0:x,marginLeft:v=x===void 0?20:x,label:I,labelAnchor:E,labelArrow:M,labelOffset:N,...A}){return p=Bt(p),m=Bt(m),y=Bt(y),E!==void 0&&(E=cn(E,"labelAnchor",["center","left","right"])),M=X$(M),nn(p&&!ie(o)?BK(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...A}):null,ie(c)?null:kK(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...A}),!ie(c)&&I!==null?Zo([],q$({fill:c,fillOpacity:l,...A},function(O,C,S,T,D){let R=T[e],{marginTop:F,marginRight:k,marginBottom:$,marginLeft:P}=e==="x"&&D.inset||D,U=E??(R.bandwidth?"center":"right"),W=N??(t==="top"?F:$)-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"?-W:W,this.dx=U==="right"?k-3:U==="left"?3-P:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Y$(e,R,{anchor:t,label:I,labelAnchor:U,labelArrow:M})]}}}})):null)}function LK(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:h=0,y:d=e==="y"?void 0:null,...p}){return Qf(lv,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:d,...p,dx:t==="left"?+h-Ce+ +u:+h+Ce-f,anchor:"start",length:c,shape:t==="left"?PK:UK})}function BK(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:h=0,x:d=e==="x"?void 0:null,...p}){return Qf(cv,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:d,...p,dy:t==="bottom"?+h-Ce-f:+h+Ce+ +u,anchor:"start",length:c,shape:t==="bottom"?FK:$K})}function CK(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*Zf):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:h=0,insetLeft:d=h,insetRight:p=h,dx:m=0,y=e==="y"?void 0:null,...g}){return Qf(ov,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +d:+m+ +o+ +a-p},function(x,b,w,_,v){f===void 0&&(this.fontVariant=V$(x)),c===void 0&&(v.text=j$(x,b,w,_,t))})}function kK(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*Zf):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:h=0,insetTop:d=h,insetBottom:p=h,dy:m=0,x:y=e==="x"?void 0:null,...g}){return Qf(iv,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +d},function(x,b,w,_,v){f===void 0&&(this.fontVariant=V$(x)),c===void 0&&(v.text=j$(x,b,w,_,t))})}function dv(){let[e,t]=uc(...arguments);return P$("y",B$(t),e,t)}function pv(){let[e,t]=uc(...arguments);return P$("fy",C$(t),e,t)}function mv(){let[e,t]=uc(...arguments);return U$("x",k$(t),e,t)}function yv(){let[e,t]=uc(...arguments);return U$("fx",R$(t),e,t)}function P$(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 Qf(Gr,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:r,x1:o,x2:s,...z$(a)})}function U$(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 Qf(Xr,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:r,y1:o,y2:s,...z$(a)})}function z$({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 q$({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]=Le(e),[,t]=ae(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 Qf(e,t,n,r,i,o){let s;function a(u,f,h,d,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=d;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:b,ticks:w,tickFormat:_,tickSpacing:v=t==="x"?80:35}=i;if(typeof w=="string"&&G$(g)&&(b=w,w=void 0),w===void 0&&(w=Xo(b,g.type)??RK(g,v)),u==null){if(ur(w))u=je(w);else if(Qa(w))u=wT(w,...ue(x));else if(g.interval){let E=g.interval;if(g.ticks){let[M,N]=ue(x),A=(N-M)/E[Of];E=g3(E,A/w)??E,u=wT(E,M,N)}else{u=x;let M=u.length;E=g3(E,M/w)??E,E!==g.interval&&(u=wT(E,...ue(u)))}if(E===g.interval){let M=Math.round(u.length/w);M>1&&(u=u.filter((N,A)=>A%M===0))}}else g.ticks?u=g.ticks(w):u=x;if(!g.ticks&&u.length&&u!==x){let E=new Kn(x);u=u.filter(M=>E.has(M)),u.length||Yn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[lr(u)]:s[t]={scale:t,value:G}}o?.call(this,g,u,w,_,s);let I=Object.fromEntries(Object.entries(s).map(([E,M])=>[E,{...M,value:wt(u,M.value)}]));return y&&(f=m.filterFacets(u,I)),{data:u,facets:f,channels:I}}let c=Me(i).initializer,l=e(n,Me({...i,initializer:a},c));return n==null?(s=l.channels,l.channels={}):s={},r!==void 0&&Object.assign(l,r),l.clip===void 0&&(l.clip=!1),l}function RK(e,t){let[n,r]=ue(e.range());return(r-n)/t}function j$(e,t,n,r,i){return{value:gy(e,t,n,r,i)}}function gy(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Be(t)?SF(e.type,t,i)??Xi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?Xi:typeof r=="string"?(Be(e.domain())?zo:pi)(r):yn(r)}function wT(e,t,n){return e.range(t,e.offset(e.floor(n)))}var FK={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},$K={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},PK={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},UK={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function V$(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Y$(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&G$(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=zw(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 X$(e="auto"){return ie(e)?!1:typeof e=="boolean"?e:cn(e,"labelArrow",["auto","up","right","down","left"])}function G$(e){return Be(e.domain())}function W$(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function H$(e,{opacity:t,...n}={}){if(!Ho(e)&&!tT(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return J$(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ae(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Z$(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:ie(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Le(t),[f,h]=Le(r),d=W$(c,l),p=W$(c,f),m=s*s*Math.PI;return n=ae(n)[1],i=ae(i)[1],o=ae(o)[1],J$(e,a,(y,g,x,b)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):h).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let _=rr();return e.scale(w).draw(_,m),_}))}function J$(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=Qw(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:h}=t,d=rc(t);u=Gf(u),i=gy(e.scale,e.domain,void 0,i);let p=ut("div",d).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
|
|
16
|
+
}`)).call(Tf,l),b=k=>k.selectAll(".tick line").attr("y1",s+c-i),w,_=h?(k,R)=>k.rangeRound(R):(k,R)=>k.range(R),{type:v,domain:A,range:E,interpolate:T,scale:$,pivot:M}=t;if(T){let k=E===void 0?T:jr(T.length===1?qp(T):T,E);w=_($.copy(),Ze(Ht(f,o-a),Math.min(A.length+(M!==void 0),E===void 0?1/0:E.length)));let R=256,S=y.document.createElement("canvas");S.width=R,S.height=1;let I=S.getContext("2d");for(let C=0,N=R-1;C<R;++C)I.fillStyle=k(C/N),I.fillRect(C,0,1,1);x.append("image").attr("opacity",m).attr("x",f).attr("y",s).attr("width",o-f-a).attr("height",i-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(v==="threshold"){let k=A,R=p===void 0?S=>S:typeof p=="string"?sr(p):p;w=_(Wo().domain([-1,E.length-1]),[f,o-a]),x.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,I)=>w(I-1)).attr("y",s).attr("width",(S,I)=>w(I)-w(I-1)).attr("height",i-s-c).attr("fill",S=>S),u=Et(k,(S,I)=>I),p=S=>R(k[S],S)}else w=_(ji().domain(A),[f,o-a]),x.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",i-s-c).attr("fill",$),b=()=>{};return x.append("g").attr("transform",`translate(0,${i-c})`).call(aw(w).ticks(Array.isArray(u)?null:u,typeof p=="string"?p:void 0).tickFormat(typeof p=="function"?p:void 0).tickSize(r).tickValues(Array.isArray(u)?u:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Wt(d,"normal")).call(b).call(k=>k.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",f).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var Ef=Math.PI/180;function Ir(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=r3(n),t.markerMid=r3(r),t.markerEnd=r3(o)}function r3(t){if(t==null||t===!1)return null;if(t===!0)return Yk;if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return zk("auto");case"arrow-reverse":return zk("auto-start-reverse");case"dot":return MG;case"circle":case"circle-fill":return Yk;case"circle-stroke":return AG;case"tick":return o3("auto");case"tick-x":return o3(90);case"tick-y":return o3(0)}throw new Error(`invalid marker: ${t}`)}function zk(t){return(e,n)=>st("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",e).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 MG(t,e){return st("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function Yk(t,e){return st("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function AG(t,e){return st("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function o3(t){return(e,n)=>st("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",e).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var TG=0;function gi(t,e,{stroke:n},r){return Xk(t,e,n&&(o=>n[o]),null,r)}function Uk(t,e,{stroke:n,z:r},o){return Xk(t,e,n&&(([i])=>n[i]),r,o)}var i3=1,jk=2;function EG(t,e){let n=new Uint8Array(e.length),r=t.data().filter(i=>i.length>1),o=r.length;for(let i=0,s=ax;i<o;++i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=pr(e[c]))&&(n[c]|=i3)}}for(let i=o-1,s=ax;i>=0;--i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=pr(e[c]))&&(n[c]|=jk)}}return([i])=>n[i]}function Xk(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=()=>o,s,a){if(!e&&!n&&!r)return;let c=new Map,f=s&&EG(t,s);function l(u,p,d){return function(h){if(d&&!d(h))return;let m=i(h),g=c.get(p);g||c.set(p,g=new Map);let y=g.get(m);if(!y){let x=this.parentNode.insertBefore(p(m,a),this),b=`plot-marker-${++TG}`;x.setAttribute("id",b),g.set(m,y=`url(#${b})`)}this.setAttribute(u,y)}}e&&t.each(l("marker-start",e,f&&(u=>f(u)&i3))),n&&f&&t.each(l("marker-start",n,u=>!(f(u)&i3))),n&&t.each(l("marker-mid",n)),r&&t.each(l("marker-end",r,f&&(u=>f(u)&jk)))}function ka({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=Gk(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function Na({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=Gk(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function Gk(t,e,n){return t===void 0&&e===void 0&&n===void 0?oe?[1,0]:[.5,.5]:[e,n]}function Vk(t,{interval:e}){return t={...dr(t)},t.interval=mf(t.interval===void 0?e:t.interval),t}function ux(t,e,n,r){let{[t]:o,[`${t}1`]:i,[`${t}2`]:s}=n,{value:a,interval:c}=Vk(o,n);if(a==null||c==null&&!r)return n;let f=Ve(o);if(c==null){let d,h={transform:m=>d||(d=ut(m,a)),label:f};return{...n,[t]:void 0,[`${t}1`]:i===void 0?h:i,[`${t}2`]:s===void 0&&!(i===s&&r)?h:s}}let l,u;function p(d){return u!==void 0&&d===l?u:u=Et(ut(l=d,a),h=>c.floor(h))}return e({...n,[t]:void 0,[`${t}1`]:i===void 0?{transform:p,label:f}:i,[`${t}2`]:s===void 0?{transform:d=>p(d).map(h=>c.offset(h)),label:f}:s})}function Wk(t,e,n){let{[t]:r}=n,{value:o,interval:i}=Vk(r,n);return o==null||i==null?n:e({...n,[t]:{label:Ve(r),transform:s=>{let a=Et(ut(s,o),f=>i.floor(f)),c=a.map(f=>i.offset(f));return a.map(ne(a)?(f,l)=>f==null||isNaN(f=+f)||(l=c[l],l==null)||isNaN(l=+l)?void 0:new Date((f+l)/2):(f,l)=>f==null||(l=c[l],l==null)?NaN:(+f+ +l)/2)}}})}function s3(t={}){return ux("x",ka,t,!0)}function a3(t={}){return ux("y",Na,t,!0)}function If(t={}){return ux("x",ka,t)}function $f(t={}){return ux("y",Na,t)}function px(t={}){return Wk("x",ka,t)}function dx(t={}){return Wk("y",Na,t)}var Hk={ariaLabel:"rule",fill:null,stroke:"currentColor"},Up=class extends pt{constructor(e,n={}){let{x:r,y1:o,y2:i,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(e,{x:{value:r,scale:"x",optional:!0},y1:{value:o,scale:"y",optional:!0},y2:{value:i,scale:"y",optional:!0}},Er(n,"x"),Hk),this.insetTop=Ot(a),this.insetBottom=Ot(c),Ir(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y1:f,y2:l}=r,{width:u,height:p,marginTop:d,marginRight:h,marginLeft:m,marginBottom:g}=o,{insetTop:y,insetBottom:x}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s},oe,0).call(b=>b.selectAll().data(e).enter().append("line").call(dt,this).attr("x1",c?w=>c[w]:(m+u-h)/2).attr("x2",c?w=>c[w]:(m+u-h)/2).attr("y1",f&&!Gn(a)?w=>f[w]+y:d+y).attr("y2",l&&!Gn(a)?a.bandwidth?w=>l[w]+a.bandwidth()-x:w=>l[w]-x:p-g-x).call(Tt,this,r).call(gi,this,r,i)).node()}},jp=class extends pt{constructor(e,n={}){let{x1:r,x2:o,y:i,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(e,{y:{value:i,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:o,scale:"x",optional:!0}},Er(n,"y"),Hk),this.insetRight=Ot(a),this.insetLeft=Ot(c),Ir(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{y:c,x1:f,x2:l}=r,{width:u,height:p,marginTop:d,marginRight:h,marginLeft:m,marginBottom:g}=o,{insetLeft:y,insetRight:x}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{y:c&&a},0,oe).call(b=>b.selectAll().data(e).enter().append("line").call(dt,this).attr("x1",f&&!Gn(s)?w=>f[w]+y:m+y).attr("x2",l&&!Gn(s)?s.bandwidth?w=>l[w]+s.bandwidth()-x:w=>l[w]-x:u-h-x).attr("y1",c?w=>c[w]:(d+p-g)/2).attr("y2",c?w=>c[w]:(d+p-g)/2).call(Tt,this,r).call(gi,this,r,i)).node()}};function Vn(t,e){let{x:n=V,y:r,y1:o,y2:i,...s}=$f(e);return[o,i]=Zk(r,o,i),new Up(t,{...s,x:n,y1:o,y2:i})}function Wn(t,e){let{y:n=V,x:r,x1:o,x2:i,...s}=If(e);return[o,i]=Zk(r,o,i),new jp(t,{...s,y:n,x1:o,x2:i})}function Zk(t,e,n){if(t==null){if(e===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,e]}else{if(e===void 0)return n===void 0?[0,t]:[t,n];if(n===void 0)return[t,e]}return[e,n]}function $r(t,...e){let n=e.length;for(let r=0,o=!0;r<n;++r)typeof e[r]!="function"&&(o&&(t=t.slice(),o=!1),t.splice(r,2,t[r]+e[r]+t[r+1]),e.splice(r,1),--r,--n);return r=>{let o=t[0];for(let i=0;i<n;++i)o+=e[i](r)+t[i+1];return o}}var IG={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},eN="\xAD",Ra=class extends pt{constructor(e,n={}){let{x:r,y:o,text:i=vn(e)&&Fy(e)?V:Xt,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:f=1,lineWidth:l=1/0,textOverflow:u,monospace:p,fontFamily:d=p?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:m,fontVariant:g,fontWeight:y,rotate:x}=n,[b,w]=Ft(x,0),[_,v]=NG(h);if(super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:oC(b),optional:!0},text:{value:i,filter:Ap,optional:!0}},n,IG),this.rotate=w,this.textAnchor=Wt(a,"middle"),this.lineAnchor=Se(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+f,this.lineWidth=+l,this.textOverflow=f3(u),this.monospace=!!p,this.fontFamily=fe(d),this.fontSize=v,this.fontStyle=fe(m),this.fontVariant=fe(g),this.fontWeight=fe(y),this.frameAnchor=fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${l}`);this.splitLines=u3(this),this.clipLine=p3(this)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,rotate:l,text:u,title:p,fontSize:d}=r,{rotate:h}=this,[m,g]=Le(this,o);return st("svg:g",i).call(xt,this,o,i).call(l3,this,u,o).call(mt,this,{x:c&&s,y:f&&a}).call(y=>y.selectAll().data(e).enter().append("text").call(dt,this).call($G,this,u,p).attr("transform",$r`translate(${c?x=>c[x]:m},${f?x=>f[x]:g})${l?x=>` rotate(${l[x]})`:h?` rotate(${h})`:""}`).call(at,"font-size",d&&(x=>d[x])).call(Tt,this,r)).node()}};function f3(t){return t==null?null:Se(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function $G(t,e,n,r){if(!n)return;let{lineAnchor:o,lineHeight:i,textOverflow:s,splitLines:a,clipLine:c}=e;t.each(function(f){let l=a(mo(n[f])??"").map(c),u=l.length,p=o==="top"?.71:o==="bottom"?1-u:(164-u*100)/200;if(u>1){let d=0;for(let h=0;h<u;++h){if(++d,!l[h])continue;let m=this.ownerDocument.createElementNS(un.svg,"tspan");m.setAttribute("x",0),h===d-1?m.setAttribute("y",`${(p+h)*i}em`):m.setAttribute("dy",`${d*i}em`),m.textContent=l[h],this.appendChild(m),d=0}}else p&&this.setAttribute("y",`${p*i}em`),this.textContent=l[0];if(s&&!r&&l[0]!==n[f]){let d=this.ownerDocument.createElementNS(un.svg,"title");d.textContent=n[f],this.appendChild(d)}})}function go(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new Ra(t,{...r,x:e,y:n})}function hx(t,{x:e=V,...n}={}){return new Ra(t,dx({...n,x:e}))}function mx(t,{y:e=V,...n}={}){return new Ra(t,px({...n,y:e}))}function l3(t,e,n){at(t,"text-anchor",e.textAnchor),at(t,"font-family",e.fontFamily),at(t,"font-size",e.fontSize),at(t,"font-style",e.fontStyle),at(t,"font-variant",e.fontVariant===void 0?CG(n):e.fontVariant),at(t,"font-weight",e.fontWeight)}function CG(t){return t&&(ci(t)||ne(t))?"tabular-nums":void 0}var kG=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function NG(t){return t==null||typeof t=="number"?[void 0,t]:typeof t!="string"?[t,void 0]:(t=t.trim().toLowerCase(),kG.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}function OG(t,e,n){let r=[],o,i=0;for(let[s,a,c]of RG(t)){if(o===void 0&&(o=s),i>o&&n(t,o,a)>e&&(r.push(t.slice(o,i)+(t[i-1]===eN?"-":"")),o=s),c){r.push(t.slice(o,a)),o=void 0;continue}i=a}return r}function*RG(t){let e=0,n=0,r=t.length;for(;n<r;){let o=1;switch(t[n]){case eN:case"-":++n,yield[e,n,!1],e=n;break;case" ":for(yield[e,n,!1];t[++n]===" ";);e=n;break;case"\r":t[n+1]===`
|
|
17
|
+
`&&++o;case`
|
|
18
|
+
`:yield[e,n,!0],n+=o,e=n;break;default:++n;break}}yield[e,n,!0]}var Qk={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 gx(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=Cf(t,o))r+=Qk[t[o]]??(rN(t,o)?120:Qk.e);return r}function yx(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=Cf(t,o))r+=rN(t,o)?126:63;return r}function u3({monospace:t,lineWidth:e,textOverflow:n}){if(n!=null||e==1/0)return i=>i.split(/\r\n?|\n/g);let r=t?yx:gx,o=e*100;return i=>OG(i,o,r)}function p3({monospace:t,lineWidth:e,textOverflow:n}){if(n==null||e==1/0)return i=>i;let r=t?yx:gx,o=e*100;switch(n){case"clip-start":return i=>Kk(i,o,r,"");case"clip-end":return i=>Jk(i,o,r,"");case"ellipsis-start":return i=>Kk(i,o,r,Oa);case"ellipsis-middle":return i=>LG(i,o,r,Oa);case"ellipsis-end":return i=>Jk(i,o,r,Oa)}}var Oa="\u2026";function La(t,e,n,r){let o=[],i=0;for(let s=0,a=0,c=t.length;s<c;s=a){a=Cf(t,s);let f=n(t,s,a);if(i+f>e){for(i+=r;i>e&&s>0;)a=s,s=o.pop(),i-=n(t,s,a);return[s,e-i]}i+=f,o.push(s)}return[-1,0]}function Jk(t,e,n,r){t=t.trim();let o=n(r),[i]=La(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function LG(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r)/2,[s,a]=La(t,e/2,n,i),[c]=La(t,o-e/2-a+i,n,-i);return c<0?r:t.slice(0,s).trimEnd()+r+t.slice(Cf(t,c)).trimStart()}function Kk(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r),[s]=La(t,o-e+i,n,-i);return s<0?r:r+t.slice(Cf(t,s)).trimStart()}var c3=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,tN=/\p{Extended_Pictographic}/uy;function Cf(t,e){return e+=DG(t,e)?2:1,FG(t,e)&&(e=c3.lastIndex),PG(t,e)?Cf(t,e+1):e}function nN(t,e){return t.charCodeAt(e)<128}function DG(t,e){let n=t.charCodeAt(e);if(n>=55296&&n<56320){let r=t.charCodeAt(e+1);return r>=56320&&r<57344}return!1}function PG(t,e){return t.charCodeAt(e)===8205}function FG(t,e){return nN(t,e)?!1:(c3.lastIndex=e,c3.test(t))}function rN(t,e){return nN(t,e)?!1:(tN.lastIndex=e,tN.test(t))}var oN={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},iN=3.5,qG=iN*5,sN={draw(t,e,n){let r=e*n/qG;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},aN={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},BG=new Map([["arrow",sN],["spike",aN]]);function zG(t){return t&&typeof t.draw=="function"}function YG(t){if(zG(t))return t;let e=BG.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}var Da=class extends pt{constructor(e,n={}){let{x:r,y:o,r:i=iN,length:s,rotate:a,shape:c=sN,anchor:f="middle",frameAnchor:l}=n,[u,p]=Ft(s,12),[d,h]=Ft(a,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:u,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,oN),this.r=+i,this.length=p,this.rotate=h,this.shape=YG(c),this.anchor=Se(f,"anchor",["start","middle","end"]),this.frameAnchor=fo(l)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,length:l,rotate:u}=r,{length:p,rotate:d,anchor:h,shape:m,r:g}=this,[y,x]=Le(this,o);return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(b=>b.selectAll().data(e).enter().append("path").call(dt,this).attr("transform",$r`translate(${c?w=>c[w]:y},${f?w=>f[w]:x})${u?w=>` rotate(${u[w]})`:d?` rotate(${d})`:""}${h==="start"?"":h==="end"?l?w=>` translate(0,${l[w]})`:` translate(0,${p})`:l?w=>` translate(0,${l[w]/2})`:` translate(0,${p/2})`}`).attr("d",l?w=>{let _=hn();return m.draw(_,l[w],g),_}:(()=>{let w=hn();return m.draw(w,p,g),w})()).call(Tt,this,r)).node()}};function d3(t,e={}){let{x:n,y:r,...o}=e;return e.frameAnchor===void 0&&([n,r]=ae(n,r)),new Da(t,{...o,x:n,y:r})}function xx(t,e={}){let{x:n=V,...r}=e;return new Da(t,{...r,x:n})}function bx(t,e={}){let{y:n=V,...r}=e;return new Da(t,{...r,y:n})}function cN(t,e={}){let{shape:n=aN,stroke:r=oN.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:s=.3,anchor:a="start",...c}=e;return d3(t,{...c,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:s,anchor:a})}function ps(t,e){return arguments.length<2&&!vn(t)&&(e=t,t=null),e===void 0&&(e={}),[t,e]}function wx({anchor:t}={},e){return t===void 0?e[0]:Se(t,"anchor",e)}function fN(t){return wx(t,["left","right"])}function lN(t){return wx(t,["right","left"])}function uN(t){return wx(t,["bottom","top"])}function pN(t){return wx(t,["top","bottom"])}function Xp(){let[t,e]=ps(...arguments);return dN("y",fN(e),t,e)}function vx(){let[t,e]=ps(...arguments);return dN("fy",lN(e),t,e)}function Gp(){let[t,e]=ps(...arguments);return hN("x",uN(e),t,e)}function _x(){let[t,e]=ps(...arguments);return hN("fx",pN(e),t,e)}function dN(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:s=o,strokeWidth:a=1,fill:c=r,fillOpacity:f=o,textAnchor:l,textStroke:u,textStrokeOpacity:p,textStrokeWidth:d,tickSize:h=t==="y"?6:0,tickPadding:m,tickRotate:g,x:y,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?e==="right"?40:0:x,marginBottom:_=x===void 0?20:x,marginLeft:v=x===void 0?e==="left"?40:0:x,label:A,labelAnchor:E,labelArrow:T,labelOffset:$,...M}){return h=Ot(h),m=Ot(m),g=Ot(g),E!==void 0&&(E=Se(E,"labelAnchor",["center","top","bottom"])),T=_N(T),we(h&&!Pt(i)?UG(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:g,x:y,...M}):null,Pt(c)?null:XG(t,e,n,{fill:c,fillOpacity:f,stroke:u,strokeOpacity:p,strokeWidth:d,textAnchor:l,tickSize:h,tickPadding:m,tickRotate:g,x:y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!Pt(c)&&A!==null?go([],xN({fill:c,fillOpacity:f,...M},function(k,R,S,I,C){let N=I[t],{marginTop:D,marginRight:L,marginBottom:P,marginLeft:F}=t==="y"&&C.inset||C,q=E??(N.bandwidth?"center":"top"),W=$??(e==="right"?L:F)-3;return q==="center"?(this.textAnchor=void 0,this.lineAnchor=e==="right"?"bottom":"top",this.frameAnchor=e,this.rotate=-90):(this.textAnchor=e==="right"?"end":"start",this.lineAnchor=q,this.frameAnchor=`${q}-${e}`,this.rotate=0),this.dy=q==="top"?3-D:q==="bottom"?P-3:0,this.dx=e==="right"?W:-W,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[vN(t,N,{anchor:e,label:A,labelAnchor:q,labelArrow:T})]}}}})):null)}function hN(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:s=o,strokeWidth:a=1,fill:c=r,fillOpacity:f=o,textAnchor:l,textStroke:u,textStrokeOpacity:p,textStrokeWidth:d,tickSize:h=t==="x"?6:0,tickPadding:m,tickRotate:g,y,margin:x,marginTop:b=x===void 0?e==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:_=x===void 0?e==="bottom"?30:0:x,marginLeft:v=x===void 0?20:x,label:A,labelAnchor:E,labelArrow:T,labelOffset:$,...M}){return h=Ot(h),m=Ot(m),g=Ot(g),E!==void 0&&(E=Se(E,"labelAnchor",["center","left","right"])),T=_N(T),we(h&&!Pt(i)?jG(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:g,y,...M}):null,Pt(c)?null:GG(t,e,n,{fill:c,fillOpacity:f,stroke:u,strokeOpacity:p,strokeWidth:d,textAnchor:l,tickSize:h,tickPadding:m,tickRotate:g,y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!Pt(c)&&A!==null?go([],xN({fill:c,fillOpacity:f,...M},function(k,R,S,I,C){let N=I[t],{marginTop:D,marginRight:L,marginBottom:P,marginLeft:F}=t==="x"&&C.inset||C,q=E??(N.bandwidth?"center":"right"),W=$??(e==="top"?D:P)-3;return q==="center"?(this.frameAnchor=e,this.textAnchor=void 0):(this.frameAnchor=`${e}-${q}`,this.textAnchor=q==="right"?"end":"start"),this.lineAnchor=e,this.dy=e==="top"?-W:W,this.dx=q==="right"?L-3:q==="left"?3-F:0,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[vN(t,N,{anchor:e,label:A,labelAnchor:q,labelArrow:T})]}}}})):null)}function UG(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:s=e+(t==="y"?"-empty":""),frameAnchor:a=e,tickSize:c,inset:f=0,insetLeft:l=f,insetRight:u=f,dx:p=0,y:d=t==="y"?void 0:null,...h}){return kf(bx,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:s,frameAnchor:a,y:d,...h,dx:e==="left"?+p-oe+ +l:+p+oe-u,anchor:"start",length:c,shape:e==="left"?ZG:QG})}function jG(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:s=e+(t==="x"?"-empty":""),frameAnchor:a=e,tickSize:c,inset:f=0,insetTop:l=f,insetBottom:u=f,dy:p=0,x:d=t==="x"?void 0:null,...h}){return kf(xx,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:s,frameAnchor:a,x:d,...h,dy:e==="bottom"?+p-oe-u:+p+oe+ +l,anchor:"start",length:c,shape:e==="bottom"?WG:HG})}function XG(t,e,n,{facetAnchor:r=e+(t==="y"?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:s=0,tickPadding:a=Math.max(3,9-i)+(Math.abs(s)>60?4*Math.cos(s*Ef):0),text:c,textAnchor:f=Math.abs(s)>60?"middle":e==="left"?"end":"start",lineAnchor:l=s>60?"top":s<-60?"bottom":"middle",fontVariant:u,inset:p=0,insetLeft:d=p,insetRight:h=p,dx:m=0,y:g=t==="y"?void 0:null,...y}){return kf(mx,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c,textAnchor:f,lineAnchor:l,fontVariant:u,rotate:s,y:g,...y,dx:e==="left"?+m-i-a+ +d:+m+ +i+ +a-h},function(x,b,w,_,v){u===void 0&&(this.fontVariant=wN(x)),c===void 0&&(v.text=bN(x,b,w,_,e))})}function GG(t,e,n,{facetAnchor:r=e+(t==="x"?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:s=0,tickPadding:a=Math.max(3,9-i)+(Math.abs(s)>=10?4*Math.cos(s*Ef):0),text:c,textAnchor:f=Math.abs(s)>=10?s<0^e==="bottom"?"start":"end":"middle",lineAnchor:l=Math.abs(s)>=10?"middle":e==="bottom"?"top":"bottom",fontVariant:u,inset:p=0,insetTop:d=p,insetBottom:h=p,dy:m=0,x:g=t==="x"?void 0:null,...y}){return kf(hx,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c===void 0?null:c,textAnchor:f,lineAnchor:l,fontVariant:u,rotate:s,x:g,...y,dy:e==="bottom"?+m+ +i+ +a-h:+m-i-a+ +d},function(x,b,w,_,v){u===void 0&&(this.fontVariant=wN(x)),c===void 0&&(v.text=bN(x,b,w,_,e))})}function Sx(){let[t,e]=ps(...arguments);return mN("y",fN(e),t,e)}function Mx(){let[t,e]=ps(...arguments);return mN("fy",lN(e),t,e)}function Ax(){let[t,e]=ps(...arguments);return gN("x",uN(e),t,e)}function Tx(){let[t,e]=ps(...arguments);return gN("fx",pN(e),t,e)}function mN(t,e,n,{y:r=t==="y"?void 0:null,x:o=null,x1:i=e==="left"?o:null,x2:s=e==="right"?o:null,...a}){return kf(Wn,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{y:r,x1:i,x2:s,...yN(a)})}function gN(t,e,n,{x:r=t==="x"?void 0:null,y:o=null,y1:i=e==="top"?o:null,y2:s=e==="bottom"?o:null,...a}){return kf(Vn,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{x:r,y1:i,y2:s,...yN(a)})}function yN({color:t="currentColor",opacity:e=.1,stroke:n=t,strokeOpacity:r=e,strokeWidth:o=1,...i}){return{stroke:n,strokeOpacity:r,strokeWidth:o,...i}}function xN({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:l=!1},u){return[,t]=ee(t),[,e]=Ft(e),{facet:"super",x:null,y:null,fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:l,initializer:u}}function kf(t,e,n,r,o,i){let s;function a(l,u,p,d,h,m){let g=l==null&&(e==="fx"||e==="fy"),{[e]:y}=d;if(!y)throw new Error(`missing scale: ${e}`);let x=y.domain(),{interval:b,ticks:w,tickFormat:_,tickSpacing:v=e==="x"?80:35}=o;if(typeof w=="string"&&SN(y)&&(b=w,w=void 0),w===void 0&&(w=co(b,y.type)??VG(y,v)),l==null){if(vn(w))l=Un(w);else if(es(w))l=h3(w,...Rt(x));else if(y.interval){let E=y.interval;if(y.ticks){let[T,$]=Rt(x),M=($-T)/E[uf];E=n6(E,M/w)??E,l=h3(E,T,$)}else{l=x;let T=l.length;E=n6(E,T/w)??E,E!==y.interval&&(l=h3(E,...Rt(l)))}if(E===y.interval){let T=Math.round(l.length/w);T>1&&(l=l.filter(($,M)=>M%T===0))}}else y.ticks?l=y.ticks(w):l=x;if(!y.ticks&&l.length&&l!==x){let E=new fn(x);l=l.filter(T=>E.has(T)),l.length||rn(`Warning: the ${e}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}e==="y"||e==="x"?u=[wn(l)]:s[e]={scale:e,value:V}}i?.call(this,y,l,w,_,s);let A=Object.fromEntries(Object.entries(s).map(([E,T])=>[E,{...T,value:ut(l,T.value)}]));return g&&(u=m.filterFacets(l,A)),{data:l,facets:u,channels:A}}let c=Vt(o).initializer,f=t(n,Vt({...o,initializer:a},c));return n==null?(s=f.channels,f.channels={}):s={},r!==void 0&&Object.assign(f,r),f.clip===void 0&&(f.clip=!1),f}function VG(t,e){let[n,r]=Rt(t.range());return(r-n)/e}function bN(t,e,n,r,o){return{value:Vp(t,e,n,r,o)}}function Vp(t,e,n,r,o){return typeof r=="function"&&!(t.type==="log"&&t.tickFormat)?r:r===void 0&&e&&ne(e)?Z9(t.type,e,o)??mo:t.tickFormat?t.tickFormat(typeof n=="number"?n:null,r):r===void 0?mo:typeof r=="string"?(ne(t.domain())?ro:sr)(r):re(r)}function h3(t,e,n){return t.range(e,t.offset(t.floor(n)))}var WG={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},HG={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},ZG={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},QG={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function wN(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function vN(t,e,{anchor:n,label:r=e.label,labelAnchor:o,labelArrow:i}={}){if(!(r==null||r.inferred&&SN(e)&&/^(date|time|year)$/i.test(r))){if(r=String(r),i==="auto"&&(i=(!e.bandwidth||e.interval)&&!/[↑↓→←]/.test(r)),!i)return r;if(i===!0){let s=Ky(e);s&&(i=/x$/.test(t)||o==="center"?/x$/.test(t)===s<0?"left":"right":s<0?"up":"down")}switch(i){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 _N(t="auto"){return Pt(t)?!1:typeof t=="boolean"?t:Se(t,"labelArrow",["auto","up","right","down","left"])}function SN(t){return ne(t.domain())}function MN(t,e){if(e==null)return e;let n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function AN(t,{opacity:e,...n}={}){if(!po(t)&&!Y6(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return EN(t,n,(r,o,i,s)=>r.append("svg").attr("width",i).attr("height",s).attr("fill",o.scale).attr("fill-opacity",Ft(e)[1]).append("rect").attr("width","100%").attr("height","100%"))}function TN(t,{fill:e=t.hint?.fill!==void 0?t.hint.fill:"none",fillOpacity:n=1,stroke:r=t.hint?.stroke!==void 0?t.hint.stroke:Pt(e)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:s=4.5,...a}={},c){let[f,l]=ee(e),[u,p]=ee(r),d=MN(c,f),h=MN(c,u),m=s*s*Math.PI;return n=Ft(n)[1],o=Ft(o)[1],i=Ft(i)[1],EN(t,a,(g,y,x,b)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",f==="color"?w=>d.scale(w):l).attr("fill-opacity",n).attr("stroke",u==="color"?w=>h.scale(w):p).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let _=hn();return t.scale(w).draw(_,m),_}))}function EN(t,e={},n){let{columns:r,tickFormat:o,fontVariant:i=lx(t),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:f=0,className:l,style:u,width:p}=e,d=as(e);l=fs(l),o=Vp(t.scale,t.domain,void 0,o);let h=st("div",d).attr("class",`${l}-swatches ${l}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${l}-swatches-columns .${l}-swatch) {
|
|
28
19
|
display: flex;
|
|
29
20
|
align-items: center;
|
|
30
21
|
break-inside: avoid;
|
|
31
22
|
padding-bottom: 1px;
|
|
32
23
|
}
|
|
33
|
-
:where(.${
|
|
24
|
+
:where(.${l}-swatches-columns .${l}-swatch::before) {
|
|
34
25
|
flex-shrink: 0;
|
|
35
26
|
}
|
|
36
|
-
:where(.${
|
|
27
|
+
:where(.${l}-swatches-columns .${l}-swatch-label) {
|
|
37
28
|
white-space: nowrap;
|
|
38
29
|
overflow: hidden;
|
|
39
30
|
text-overflow: ellipsis;
|
|
40
|
-
}`,
|
|
31
|
+
}`,h.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${l}-swatch`).call(n,t,a,c).call(g=>g.append("div").attr("class",`${l}-swatch-label`).attr("title",o).text(o))):(m=`:where(.${l}-swatches-wrap) {
|
|
41
32
|
display: flex;
|
|
42
33
|
align-items: center;
|
|
43
34
|
min-height: 33px;
|
|
44
35
|
flex-wrap: wrap;
|
|
45
36
|
}
|
|
46
|
-
:where(.${
|
|
37
|
+
:where(.${l}-swatches-wrap .${l}-swatch) {
|
|
47
38
|
display: inline-flex;
|
|
48
39
|
align-items: center;
|
|
49
40
|
margin-right: 1em;
|
|
50
|
-
}`,
|
|
41
|
+
}`,h.selectAll().data(t.domain).enter().append("span").attr("class",`${l}-swatch`).call(n,t,a,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(g=>g.insert("style","*").text(`:where(.${l}-swatches) {
|
|
51
42
|
font-family: system-ui, sans-serif;
|
|
52
43
|
font-size: 10px;
|
|
53
44
|
margin-bottom: 0.5em;
|
|
54
45
|
}
|
|
55
|
-
:where(.${
|
|
46
|
+
:where(.${l}-swatch > svg) {
|
|
56
47
|
margin-right: 0.5em;
|
|
57
48
|
overflow: visible;
|
|
58
49
|
}
|
|
59
|
-
${m}`)).style("margin-left",l?`${+l}px`:null).style("width",h===void 0?null:`${+h}px`).style("font-variant",he(o,"normal")).call(Wf,f).node()}var gv=new Map([["symbol",Z$],["color",t9],["opacity",zK]]);function Q$(e={}){for(let[t,n]of gv){let r=e[t];if(Vo(r)){let i=rc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Vo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(jw(t,r,o),vT(i,r,e),s=>Vo(e[s])?jw(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function K$(e,t,n={}){return(r,i)=>{if(!gv.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return gv.get(r)(e[r],vT(t,n[r],i),o=>e[o])}}function vT({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return FF(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function t9(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return H$(e,n);case"ramp":return f$(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function zK({type:e,interpolate:t,...n},{legend:r=!0,color:i=sn(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 t9({type:e,...n,interpolate:qK(i)},{legend:r,...o})}function qK(e){let{r:t,g:n,b:r}=sn(e)||sn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function e9(e,t,n){let r=[];for(let[i,o]of gv){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],vT(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var jK={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},VK={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},xy=class extends St{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(Ha,void 0,t,n==null?jK:VK),this.anchor=_3(n,"anchor",["top","right","bottom","left"]),this.insetTop=Bt(i),this.insetRight=Bt(o),this.insetBottom=Bt(s),this.insetLeft=Bt(a),this.rx=Bt(c),this.ry=Bt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:h,insetTop:d,insetRight:p,insetBottom:m,insetLeft:y,rx:g,ry:x}=this,b=l+y,w=u-a-p,_=s+d,v=f-c-m;return ut(h?"svg:line":"svg:rect",o).datum(0).call(kt,this,i,o).call(Ct,this).call(Kt,this,r).call(Et,this,{}).call(h==="left"?I=>I.attr("x1",b).attr("x2",b).attr("y1",_).attr("y2",v):h==="right"?I=>I.attr("x1",w).attr("x2",w).attr("y1",_).attr("y2",v):h==="top"?I=>I.attr("x1",b).attr("x2",w).attr("y1",_).attr("y2",_):h==="bottom"?I=>I.attr("x1",b).attr("x2",w).attr("y1",v).attr("y2",v):I=>I.attr("x",b).attr("y",_).attr("width",w-b).attr("height",v-_).attr("rx",g).attr("ry",x)).node()}};function Kf(e){return new xy(e)}var _T={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},YK=new Set(["geometry","href","src","ariaLabel","scales"]),by=class extends St{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&ur(t)&&Mw(t)&&(n={...n,title:G});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:h=f?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:I=8,title:E,pointerSize:M=12,pathFilter:N="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},n,_T),this.anchor=Tw(l,"anchor"),this.preferredAnchor=Tw(u,"preferredAnchor"),this.frameAnchor=Go(b),this.textAnchor=he(_,"middle"),this.textPadding=+I,this.pointerSize=+M,this.pathFilter=qe(N),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=mT(v),this.monospace=!!f,this.fontFamily=qe(h),this.fontSize=Bt(d),this.fontStyle=qe(p),this.fontVariant=qe(m),this.fontWeight=qe(y);for(let A in _T)A in this.channels&&(this[A]=_T[A]);this.splitLines=gT(this),this.clipLine=xT(this),this.format={...w}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:h}=o,{anchor:d,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:_}=i,{x1:v,y1:I,x2:E,y2:M,x:N=v??E,y:A=I??M}=r,O=l?l(t.fx)-_:0,C=u?u(t.fy)-w:0,[S,T]=vn(this,i),D=cT(r,S),R=lT(r,T),F=p?av:sv,k=F(Fl),$,P;"title"in r?($=r.channels,P=ZK):($=HK.call(this,r,n),P=JK);let U=ut("svg:g",o).call(kt,this,i,o).call(yT,this).call(Et,this,{x:N&&a,y:A&&c}).call(ot=>ot.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(D(at))},${Math.round(R(at))})`).call(Ct,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(Y){let st=Yt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=P.call(s,Y,t,$,n,r);if(typeof q=="string")for(let Z of s.splitLines(q))W(st,{value:s.clipLine(Z)});else{let Z=new Set;for(let rt of q){let{label:z=""}=rt;z&&Z.has(z)||(Z.add(z),W(st,rt))}}})));function W(ot,{label:at,value:Y,color:st,opacity:q}){at??="",Y??="";let Z=st!=null||q!=null,rt,z=y*100,[Rt]=Pl(at,z,F,k);if(Rt>=0)at=at.slice(0,Rt).trimEnd()+Fl,rt=Y.trim(),Y="";else{(at||!Y&&!Z)&&(Y=" "+Y);let[Ht]=Pl(Y,z-F(at),F,k);Ht>=0&&(rt=Y.trim(),Y=Y.slice(0,Ht).trimEnd()+Fl)}let ht=ot.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&ht.append("tspan").attr("font-weight","bold").text(at),Y&&ht.append(()=>h.createTextNode(Y)),Z&&ht.append("tspan").text(" \u25A0").attr("fill",st).attr("fill-opacity",q).style("user-select","none"),rt&&ht.append("title").text(rt)}function nt(){let{width:ot,height:at}=i.facet??i;U.selectChildren().each(function(Y){let{x:st,width:q,height:Z}=this.getBBox();q=Math.round(q),Z=Math.round(Z);let rt=d;if(rt===void 0){let ht=D(Y)+O,Ht=R(Y)+C,Qt=ht+q+x+g*2<ot,tt=ht-q-x-g*2>0,ce=Ht+Z+x+g*2<at,Ar=Ht-Z-x-g*2>0;rt=Qt&&tt?ce&&Ar?s.preferredAnchor:Ar?"bottom":"top":ce&&Ar?Qt?"left":"right":(Qt||tt)&&(ce||Ar)?`${Ar?"bottom":"top"}-${Qt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Rt=this.lastChild;if(z.setAttribute("d",WK(rt,x,g,q,Z)),st)for(let ht of Rt.childNodes)ht.setAttribute("x",-st);Rt.setAttribute("y",`${+XK(rt,Rt.childNodes.length,m).toFixed(6)}em`),Rt.setAttribute("transform",`translate(${GK(rt,x,g,q,Z)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(nt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(nt)),U.node()}};function bv(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Pe(t,n)),new by(e,{...r,x:t,y:n})}function XK(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function GK(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 WK(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 HK({channels:e},t){let n={},r=this.format;r=n9(r,e,"x"),r=n9(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=ay(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||YK.has(i))continue;let o=ay(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]=(Be(s)?zo:pi)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?gy(s,s.domain()):Xi}}return n}function n9(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 ZK(e,t,{title:n}){return Xi(n.value[e],e)}function*JK(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:xv(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:i9(r,n,"x"),value:r9(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:i9(r,n,"y"),value:r9(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!ze(a)&&c==null)continue;yield{label:xv(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function r9(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 i9(e,t,n){let r=xv(e,t,`${n}1`,n),i=xv(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function xv(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function vy(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Gf(e.className),l=e.marks===void 0?[]:s9(e.marks);l.push(...itt(l));let u=ntt(t,e),f=new Map;for(let k of l){let $=a9(k,u,e);$&&f.set(k,$)}let h=new Map;u&&wy(h,[u],e),wy(h,f,e);let d=s9(ott(l,h,e));for(let k of d){let $=a9(k,u,e);$&&f.set(k,$)}l.unshift(...d);let p=o$(h,e);if(p!==void 0){let k=u?Jw(p,u):void 0;for(let P of l){if(P.facet===null||P.facet==="super")continue;let U=f.get(P);U!==void 0&&(U.facetsIndex=P.fx!=null||P.fy!=null?Jw(p,U):k)}let $=new Set;for(let{facetsIndex:P}of f.values())P?.forEach((U,W)=>{U?.length>0&&$.add(W)});p.forEach(0<$.size&&$.size<p.length?(P,U)=>P.empty=!$.has(U):P=>P.empty=!1);for(let P of l)if(P.facet==="exclude"){let U=f.get(P);U!==void 0&&(U.facetsIndex=c$(U.facetsIndex))}}for(let k of de.keys())Vo(e[k])&&k!=="fx"&&k!=="fy"&&h.set(k,[]);let m=new Map;for(let k of l){if(m.has(k))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:$,channels:P}=f.get(k)??{},{data:U,facets:W,channels:nt}=k.initialize($,P,e);MT(nt,e),m.set(k,{data:U,facets:W,channels:nt})}let y=uy(wy(h,m,e),e),g=r$(y,l,e);G7(y,g);let x=Q3(y),{fx:b,fy:w}=x,_=b||w?K3(y,g):g,v=b||w?htt(x,g):g,I=rc(e),E=I.document,M=Bs("svg").call(E.documentElement),N=M;I.ownerSVGElement=M,I.className=c,I.projection=s7(e,_),I.filterFacets=(k,$)=>Jw(p,{channels:$,groups:Hw(k,$)}),I.getMarkState=k=>{let $=m.get(k),P=f.get(k);return{...$,channels:{...$.channels,...P?.channels}}},I.dispatchValue=k=>{N.value!==k&&(N.value=k,N.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[k,$]of m)if(k.initializer!=null){let P=k.facet==="super"?v:_,U=k.initializer($.data,$.facets,$.channels,x,P,I);if(U.data!==void 0&&($.data=U.data),U.facets!==void 0&&($.facets=U.facets),U.channels!==void 0){let{fx:W,fy:nt,...ot}=U.channels;ett(ot),Object.assign($.channels,ot);for(let at of Object.values(ot)){let{scale:Y}=at;Y!=null&&!PF(de.get(Y))&&(u9(at,e),A.add(Y))}(W!=null||nt!=null)&&f.set(k,!0)}}if(A.size){let k=new Map;wy(k,m,e,W=>A.has(W)),wy(h,m,e,W=>A.has(W));let $=ftt(uy(k,e),y),{scales:P,...U}=Q3($);Object.assign(y,$),Object.assign(x,U),Object.assign(x.scales,P)}let O,C;p!==void 0&&(O={x:b?.domain(),y:w?.domain()},p=s$(p,O),C=a$(b,w,g));for(let[k,$]of m)$.values=k.scale($.channels,x,I);let{width:S,height:T}=g;Yt(M).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",T).attr("viewBox",`0 0 ${S} ${T}`).attr("aria-label",s).attr("aria-description",a).call(k=>k.append("style").text(`:where(.${c}) {
|
|
50
|
+
${m}`)).style("margin-left",f?`${+f}px`:null).style("width",p===void 0?null:`${+p}px`).style("font-variant",Wt(i,"normal")).call(Tf,u).node()}var Ex=new Map([["symbol",TN],["color",CN],["opacity",JG]]);function IN(t={}){for(let[e,n]of Ex){let r=t[e];if(so(r)){let o=as(t),i;if(e==="symbol"){let{fill:s,stroke:a=s===void 0&&so(t.color)?"color":void 0}=t;i={fill:s,stroke:a}}return n(ex(e,r,i),m3(o,r,t),s=>so(t[s])?ex(s,t[s]):null)}}throw new Error("unknown legend type; no scale found")}function $N(t,e,n={}){return(r,o)=>{if(!Ex.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return Ex.get(r)(t[r],m3(e,n[r],o),i=>t[i])}}function m3({className:t,...e},{label:n,ticks:r,tickFormat:o}={},i){return lC(i,{className:t,...e},{label:n,ticks:r,tickFormat:o})}function CN(t,{legend:e=!0,...n}){if(e===!0&&(e=t.type==="ordinal"?"swatches":"ramp"),t.domain!==void 0)switch(`${e}`.toLowerCase()){case"swatches":return AN(t,n);case"ramp":return Bk(t,n);default:throw new Error(`unknown legend type: ${e}`)}}function JG({type:t,interpolate:e,...n},{legend:r=!0,color:o=ve(0,0,0),...i}){if(!e)throw new Error(`${t} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return CN({type:t,...n,interpolate:KG(o)},{legend:r,...i})}function KG(t){let{r:e,g:n,b:r}=ve(t)||ve(0,0,0);return o=>`rgba(${e},${n},${r},${o})`}function kN(t,e,n){let r=[];for(let[o,i]of Ex){let s=n[o];if(s?.legend&&o in t){let a=i(t[o],m3(e,t[o],s),c=>t[c]);a!=null&&r.push(a)}}return r}function ds(t={}){return u6(t)?t:{...t,x:V}}function hs(t={}){return p6(t)?t:{...t,y:V}}function Ix(t,e){if(e.length===1)return{data:t,facets:e};let n=ts(t),r=new Uint8Array(n),o=0;for(let a of e)for(let c of a)r[c]&&++o,r[c]=1;if(o===0)return{data:t,facets:e};t=Ki(t);let i=t[o6]=new Uint32Array(n+o);e=e.map(a=>Ki(a,Uint32Array));let s=n;r.fill(0);for(let a of e)for(let c=0,f=a.length;c<f;++c){let l=a[c];r[l]?(a[c]=s,t[s]=t[l],i[s]=l,++s):i[l]=l,r[l]=1}return{data:t,facets:e}}function g3(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{y1:n,y:r=n,x:o,...i}=e,[s,a,c,f]=Of(r,o,"y","x",t,i);return{...s,y1:n,y:a,x1:c,x2:f,x:hf(c,f)}}function RN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{y1:n,y:r=n,x:o}=e,[i,s,a]=Of(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function LN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{y1:n,y:r=n,x:o}=e,[i,s,,a]=Of(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function y3(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{x1:n,x:r=n,y:o,...i}=e,[s,a,c,f]=Of(r,o,"x","y",t,i);return{...s,x1:n,x:a,y1:c,y2:f,y:hf(c,f)}}function DN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{x1:n,x:r=n,y:o}=e,[i,s,a]=Of(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function PN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{x1:n,x:r=n,y:o}=e,[i,s,,a]=Of(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function ms({x:t,x1:e,x2:n,...r}={}){return r=Er(r,"y"),e===void 0&&n===void 0?g3({x:t,...r}):([e,n]=d6(t,e,n),{...r,x1:e,x2:n})}function gs({y:t,y1:e,y2:n,...r}={}){return r=Er(r,"x"),e===void 0&&n===void 0?y3({y:t,...r}):([e,n]=d6(t,e,n),{...r,y1:e,y2:n})}function Nf(t){let{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}var tV={length:!0};function Of(t,e=Cp,n,r,{offset:o,order:i,reverse:s},a){if(e===null)throw new Error(`stack requires ${r}`);let c=nn(a),[f,l]=Ge(t),[u,p]=Oe(e),[d,h]=Oe(e);return u.hint=d.hint=tV,o=eV(o),i=oV(i,o,r),[be(a,(m,g,y)=>{({data:m,facets:g}=Ix(m,g));let x=t==null?void 0:l(Ta(ut(m,t),y?.[n])),b=ut(m,e,Float64Array),w=ut(m,c),_=i&&i(m,x,b,w),v=ts(m),A=p(new Float64Array(v)),E=h(new Float64Array(v)),T=[];for(let $ of g){let M=x?Array.from(ze($,k=>x[k]).values()):[$];if(_)for(let k of M)k.sort(_);for(let k of M){let R=0,S=0;s&&k.reverse();for(let I of k){let C=b[I];C<0?R=E[I]=(A[I]=R)+C:C>0?S=E[I]=(A[I]=S)+C:E[I]=A[I]=S}}T.push(M)}return o&&o(T,A,E,w),{data:m,facets:g}}),f,u,d]}function eV(t){if(t!=null){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return nV;case"center":case"silhouette":return rV;case"wiggle":return qN}throw new Error(`unknown offset: ${t}`)}}function FN(t,e){let n=0,r=0;for(let o of t){let i=e[o];i<n&&(n=i),i>r&&(r=i)}return[n,r]}function nV(t,e,n){for(let r of t)for(let o of r){let[i,s]=FN(o,n);for(let a of o){let c=1/(s-i||1);e[a]=c*(e[a]-i),n[a]=c*(n[a]-i)}}}function rV(t,e,n){for(let r of t){for(let o of r){let[i,s]=FN(o,n);for(let a of o){let c=(s+i)/2;e[a]-=c,n[a]-=c}}BN(r,e,n)}zN(t,e,n)}function qN(t,e,n,r){for(let o of t){let i=new cn,s=0;for(let a of o){let c=-1,f=a.map(d=>Math.abs(n[d]-e[d])),l=a.map(d=>{c=r?r[d]:++c;let h=n[d]-e[d],m=i.has(c)?h-i.get(c):0;return i.set(c,h),m}),u=[0,...Mm(l)];for(let d of a)e[d]+=s,n[d]+=s;let p=Ue(f);p&&(s-=Ue(f,(d,h)=>(l[h]/2+u[h])*d)/p)}BN(o,e,n)}zN(t,e,n)}function BN(t,e,n){let r=Bt(t,o=>Bt(o,i=>e[i]));for(let o of t)for(let i of o)e[i]-=r,n[i]-=r}function zN(t,e,n){let r=t.length;if(r===1)return;let o=t.map(a=>a.flat()),i=o.map(a=>(Bt(a,c=>e[c])+Ct(a,c=>n[c]))/2),s=Bt(i);for(let a=0;a<r;a++){let c=s-i[a];for(let f of o[a])e[f]+=c,n[f]+=c}}function oV(t,e,n){if(t===void 0&&e===qN)return NN(ke);if(t!=null){if(typeof t=="string"){let r=t.startsWith("-"),o=r?_a:ke;switch((r?t.slice(1):t).toLowerCase()){case"value":case n:return iV(o);case"z":return sV(o);case"sum":return aV(o);case"appearance":return cV(o);case"inside-out":return NN(o)}return ON(s6(t))}if(typeof t=="function")return(t.length===1?ON:fV)(t);if(Cn(t))return lV(t);throw new Error(`invalid order: ${t}`)}}function iV(t){return(e,n,r)=>(o,i)=>t(r[o],r[i])}function sV(t){return(e,n,r,o)=>(i,s)=>t(o[i],o[s])}function aV(t){return $x(t,(e,n,r,o)=>gc(wn(e),i=>Ue(i,s=>r[s]),i=>o[i]))}function cV(t){return $x(t,(e,n,r,o)=>gc(wn(e),i=>n[Ws(i,s=>r[s])],i=>o[i]))}function NN(t){return $x(t,(e,n,r,o)=>{let i=wn(e),s=gc(i,u=>n[Ws(u,p=>r[p])],u=>o[u]),a=vr(i,u=>Ue(u,p=>r[p]),u=>o[u]),c=[],f=[],l=0;for(let u of s)l<0?(l+=a.get(u),c.push(u)):(l-=a.get(u),f.push(u));return f.reverse().concat(c)})}function ON(t){return e=>{let n=ut(e,t);return(r,o)=>ke(n[r],n[o])}}function fV(t){return e=>Cn(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function lV(t){return $x(ke,()=>t)}function $x(t,e){return(n,r,o,i)=>{if(!i)throw new Error("missing channel: z");let s=new cn(e(n,r,o,i).map((a,c)=>[a,c]));return(a,c)=>t(s.get(i[a]),s.get(i[c]))}}var uV={ariaLabel:"rect"},Pa=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s}=n;super(e,{x1:{value:r,scale:"x",type:r!=null&&i==null?"band":void 0,optional:!0},y1:{value:o,scale:"y",type:o!=null&&s==null?"band":void 0,optional:!0},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,uV),Wp(this,n),Hp(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x1:c,y1:f,x2:l,y2:u}=r,{marginTop:p,marginRight:d,marginBottom:h,marginLeft:m,width:g,height:y}=o,{projection:x}=i,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:A,ry:E,rx1y1:T,rx1y2:$,rx2y1:M,rx2y2:k}=this;(c||l)&&!x&&Gn(s)&&(c=l=null),(f||u)&&!x&&Gn(a)&&(f=u=null);let R=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{},0,0).call(I=>I.selectAll().data(e).enter().call(T||$||M||k?C=>C.append("path").call(dt,this).call(Zp,c&&l?N=>c[N]+(l[N]<c[N]?-w:v):c?N=>c[N]+v:m+v,f&&u?N=>f[N]+(u[N]<f[N]?-_:b):f?N=>f[N]+b:p+b,c&&l?N=>l[N]-(l[N]<c[N]?-v:w):c?N=>c[N]+R-w:g-d-w,f&&u?N=>u[N]-(u[N]<f[N]?-b:_):f?N=>f[N]+S-_:y-h-_,this).call(Tt,this,r):C=>C.append("rect").call(dt,this).attr("x",c?l?N=>Math.min(c[N],l[N])+v:N=>c[N]+v:m+v).attr("y",f?u?N=>Math.min(f[N],u[N])+b:N=>f[N]+b:p+b).attr("width",c?l?N=>Math.max(0,Math.abs(l[N]-c[N])+R-v-w):R-v-w:g-d-m-w-v).attr("height",f?u?N=>Math.max(0,Math.abs(f[N]-u[N])+S-b-_):S-b-_:y-p-h-b-_).call(at,"rx",A).call(at,"ry",E).call(Tt,this,r))).node()}};function Wp(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={}){t.insetTop=Ot(n),t.insetRight=Ot(r),t.insetBottom=Ot(o),t.insetLeft=Ot(i)}function Hp(t,{r:e,rx:n,ry:r,rx1:o=e,ry1:i=e,rx2:s=e,ry2:a=e,rx1y1:c=o!==void 0?+o:i!==void 0?+i:0,rx1y2:f=o!==void 0?+o:a!==void 0?+a:0,rx2y1:l=s!==void 0?+s:i!==void 0?+i:0,rx2y2:u=s!==void 0?+s:a!==void 0?+a:0}={}){c||f||l||u?(t.rx1y1=c,t.rx1y2=f,t.rx2y1=l,t.rx2y2=u):(t.rx=Wt(n,"auto"),t.ry=Wt(r,"auto"))}function Zp(t,e,n,r,o,i){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:f}=i;typeof e!="function"&&(e=re(e)),typeof n!="function"&&(n=re(n)),typeof r!="function"&&(r=re(r)),typeof o!="function"&&(o=re(o));let l=Math.max(Math.abs(s+c),Math.abs(a+f)),u=Math.max(Math.abs(s+a),Math.abs(c+f));t.attr("d",p=>{let d=e(p),h=n(p),m=r(p),g=o(p),y=d>m,x=h>g,b=y?m:d,w=y?d:m,_=x?g:h,v=x?h:g,A=Math.min(1,(w-b)/l,(v-_)/u),E=A*(y?x?f:c:x?a:s),T=A*(y?x?a:s:x?f:c),$=A*(y?x?s:a:x?c:f),M=A*(y?x?c:f:x?s:a);return`M${b},${_+kx(E,M)}A${E},${E} 0 0 ${E<0?0:1} ${b+Cx(E,M)},${_}H${w-Cx(T,$)}A${T},${T} 0 0 ${T<0?0:1} ${w},${_+kx(T,$)}V${v-kx($,T)}A${$},${$} 0 0 ${$<0?0:1} ${w-Cx($,T)},${v}H${b+Cx(M,E)}A${M},${M} 0 0 ${M<0?0:1} ${b},${v-kx(M,E)}Z`})}function Cx(t,e){return e<0?t:Math.abs(t)}function kx(t,e){return e<0?Math.abs(t):t}function Qp(t,e){return new Pa(t,s3(a3(e)))}function Rf(t,e={}){return si(e)||(e={...e,y:Xt,x2:V,interval:1}),new Pa(t,ms(a3(ds(e))))}function Lf(t,e={}){return si(e)||(e={...e,x:Xt,y2:V,interval:1}),new Pa(t,gs(s3(hs(e))))}var pV={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},dV={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Jp=class extends pt{constructor(e={}){let{anchor:n=null}=e;super(Qi,void 0,e,n==null?pV:dV),this.anchor=l6(n,"anchor",["top","right","bottom","left"]),Wp(this,e),n||Hp(this,e)}render(e,n,r,o,i){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:f,width:l,height:u}=o,{anchor:p,insetTop:d,insetRight:h,insetBottom:m,insetLeft:g}=this,{rx:y,ry:x,rx1y1:b,rx1y2:w,rx2y1:_,rx2y2:v}=this,A=f+g,E=l-a-h,T=s+d,$=u-c-m;return st(p?"svg:line":b||w||_||v?"svg:path":"svg:rect",i).datum(0).call(xt,this,o,i).call(dt,this).call(Tt,this,r).call(mt,this,{}).call(p==="left"?M=>M.attr("x1",A).attr("x2",A).attr("y1",T).attr("y2",$):p==="right"?M=>M.attr("x1",E).attr("x2",E).attr("y1",T).attr("y2",$):p==="top"?M=>M.attr("x1",A).attr("x2",E).attr("y1",T).attr("y2",T):p==="bottom"?M=>M.attr("x1",A).attr("x2",E).attr("y1",$).attr("y2",$):b||w||_||v?M=>M.call(Zp,A,T,E,$,this):M=>M.attr("x",A).attr("y",T).attr("width",E-A).attr("height",$-T).attr("rx",y).attr("ry",x)).node()}};function Df(t){return new Jp(t)}var x3={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},hV=new Set(["geometry","href","src","ariaLabel","scales"]),Kp=class extends pt{constructor(e,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&vn(e)&&Fy(e)&&(n={...n,title:V});let{x:r,y:o,x1:i,x2:s,y1:a,y2:c,anchor:f,preferredAnchor:l="bottom",monospace:u,fontFamily:p=u?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:h,fontVariant:m,fontWeight:g,lineHeight:y=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:A=8,title:E,pointerSize:T=12,pathFilter:$="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(e,{x:{value:i!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:o,scale:"y",optional:!0},x1:{value:i,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:i==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},n,x3),this.anchor=By(f,"anchor"),this.preferredAnchor=By(l,"preferredAnchor"),this.frameAnchor=fo(b),this.textAnchor=Wt(_,"middle"),this.textPadding=+A,this.pointerSize=+T,this.pathFilter=fe($),this.lineHeight=+y,this.lineWidth=+x,this.textOverflow=f3(v),this.monospace=!!u,this.fontFamily=fe(p),this.fontSize=Ot(d),this.fontStyle=fe(h),this.fontVariant=fe(m),this.fontWeight=fe(g);for(let M in x3)M in this.channels&&(this[M]=x3[M]);this.splitLines=u3(this),this.clipLine=p3(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(e,n,r,o,i){let s=this,{x:a,y:c,fx:f,fy:l}=n,{ownerSVGElement:u,document:p}=i,{anchor:d,monospace:h,lineHeight:m,lineWidth:g}=this,{textPadding:y,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:A,x2:E,y2:T,x:$=v??E,y:M=A??T}=r,k=f?f(e.fx)-_:0,R=l?l(e.fy)-w:0,[S,I]=Le(this,o),C=e3(r,S),N=n3(r,I),D=h?yx:gx,L=D(Oa),P,F;"title"in r?(P=YN.call(this,{title:r.channels.title},n),F=xV):(P=YN.call(this,r.channels,n),F=bV);let q=st("svg:g",i).call(xt,this,o,i).call(l3,this).call(mt,this,{x:$&&a,y:M&&c}).call(nt=>nt.selectAll().data(e).enter().append("g").attr("transform",ot=>`translate(${Math.round(C(ot))},${Math.round(N(ot))})`).call(dt,this).call(ot=>ot.append("path").attr("filter",b)).call(ot=>ot.append("text").each(function(X){let rt=St(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let Y=F.call(s,X,e,P,n,r);if(typeof Y=="string")for(let H of s.splitLines(Y))W(rt,{value:s.clipLine(H)});else{let H=new Set;for(let et of Y){let{label:B=""}=et;B&&H.has(B)||(H.add(B),W(rt,et))}}})));function W(nt,{label:ot,value:X,color:rt,opacity:Y}){ot??="",X??="";let H=rt!=null||Y!=null,et,B=g*100,[wt]=La(ot,B,D,L);if(wt>=0)ot=ot.slice(0,wt).trimEnd()+Oa,et=X.trim(),X="";else{(ot||!X&&!H)&&(X=" "+X);let[It]=La(X,B-D(ot),D,L);It>=0&&(et=X.trim(),X=X.slice(0,It).trimEnd()+Oa)}let ct=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");ot&&ct.append("tspan").attr("font-weight","bold").text(ot),X&&ct.append(()=>p.createTextNode(X)),H&&ct.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",Y).style("user-select","none"),et&&ct.append("title").text(et)}function tt(){let{width:nt,height:ot}=o.facet??o;q.selectChildren().each(function(X){let{x:rt,width:Y,height:H}=this.getBBox();Y=Math.round(Y),H=Math.round(H);let et=d;if(et===void 0){let ct=C(X)+k,It=N(X)+R,kt=ct+Y+x+y*2<nt,J=ct-Y-x-y*2>0,qt=It+H+x+y*2<ot,Nn=It-H-x-y*2>0;et=kt&&J?qt&&Nn?s.preferredAnchor:Nn?"bottom":"top":qt&&Nn?kt?"left":"right":(kt||J)&&(qt||Nn)?`${Nn?"bottom":"top"}-${kt?"left":"right"}`:s.preferredAnchor}let B=this.firstChild,wt=this.lastChild;if(B.setAttribute("d",yV(et,x,y,Y,H)),rt)for(let ct of wt.childNodes)ct.setAttribute("x",-rt);wt.setAttribute("y",`${+mV(et,wt.childNodes.length,m).toFixed(6)}em`),wt.setAttribute("transform",`translate(${gV(et,x,y,Y,H)})`)}),q.attr("visibility",null)}return e.length&&(q.attr("visibility","hidden"),u.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),q.node()}};function Ox(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new Kp(t,{...r,x:e,y:n})}function mV(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}function gV(t,e,n,r,o){switch(t){case"middle":return[-r/2,o/2];case"top-left":return[n,e+n];case"top":return[-r/2,e/2+n];case"top-right":return[-r-n,e+n];case"right":return[-e/2-r-n,o/2];case"bottom-left":return[n,-e-n];case"bottom":return[-r/2,-e/2-n];case"bottom-right":return[-r-n,-e-n];case"left":return[n+e/2,o/2]}}function yV(t,e,n,r,o){let i=r+n*2,s=o+n*2;switch(t){case"middle":return`M${-i/2},${-s/2}h${i}v${s}h${-i}z`;case"top-left":return`M0,0l${e},${e}h${i-e}v${s}h${-i}z`;case"top":return`M0,0l${e/2},${e/2}h${(i-e)/2}v${s}h${-i}v${-s}h${(i-e)/2}z`;case"top-right":return`M0,0l${-e},${e}h${e-i}v${s}h${i}z`;case"right":return`M0,0l${-e/2},${-e/2}v${e/2-s/2}h${-i}v${s}h${i}v${e/2-s/2}z`;case"bottom-left":return`M0,0l${e},${-e}h${i-e}v${-s}h${-i}z`;case"bottom":return`M0,0l${e/2},${-e/2}h${(i-e)/2}v${-s}h${-i}v${s}h${(i-e)/2}z`;case"bottom-right":return`M0,0l${-e},${-e}h${e-i}v${-s}h${i}z`;case"left":return`M0,0l${e/2},${-e/2}v${e/2-s/2}h${i}v${s}h${-i}v${e/2-s/2}z`}}function YN(t,e){let n={},r=this.format;r=UN(r,t,"x"),r=UN(r,t,"y"),this.format=r;for(let o in r){let i=r[o];if(!(i===null||i===!1))if(o==="fx"||o==="fy")n[o]=!0;else{let s=Pp(t,o);s&&(n[o]=s)}}for(let o in t){if(o in n||o in r||hV.has(o)||(o==="x"||o==="y")&&t.geometry)continue;let i=Pp(t,o);if(i){if(i.scale==null&&i.defaultScale==="color")continue;n[o]=i}}this.facet&&(e.fx&&!("fx"in r)&&(n.fx=!0),e.fy&&!("fy"in r)&&(n.fy=!0));for(let o in n){let i=this.format[o];if(typeof i=="string"){let s=n[o]?.value??e[o]?.domain()??[];this.format[o]=(ne(s)?ro:sr)(i)}else if(i===void 0||i===!0){let s=e[o];this.format[o]=s?.bandwidth?Vp(s,s.domain()):mo}}return n}function UN(t,e,n){if(!(n in t))return t;let r=`${n}1`,o=`${n}2`;if((r in t||!(r in e))&&(o in t||!(o in e)))return t;let i=Object.entries(t),s=t[n];return i.splice(i.findIndex(([a])=>a===n)+1,0,[r,s],[o,s]),Object.fromEntries(i)}function xV(t,e,{title:n}){return this.format.title(n.value[t],t)}function*bV(t,e,n,r,o){for(let i in n){if(i==="fx"||i==="fy"){yield{label:Nx(r,n,i),value:this.format[i](e[i],t)};continue}if(i==="x1"&&"x2"in n||i==="y1"&&"y2"in n)continue;let s=n[i];if(i==="x2"&&"x1"in n)yield{label:XN(r,n,"x"),value:jN(this.format.x2,n.x1,s,t)};else if(i==="y2"&&"y1"in n)yield{label:XN(r,n,"y"),value:jN(this.format.y2,n.y1,s,t)};else{let a=s.value[t],c=s.scale;if(!Jt(a)&&c==null)continue;yield{label:Nx(r,n,i),value:this.format[i](a,t),color:c==="color"?o[i][t]:null,opacity:c==="opacity"?o[i][t]:null}}}}function jN(t,e,n,r){return n.hint?.length?`${t(n.value[r]-e.value[r],r)}`:`${t(e.value[r],r)}\u2013${t(n.value[r],r)}`}function XN(t,e,n){let r=Nx(t,e,`${n}1`,n),o=Nx(t,e,`${n}2`,n);return r===o?r:`${r}\u2013${o}`}function Nx(t,e,n,r=n){let o=e[n],i=t[o?.scale??n];return String(i?.label??o?.label??r)}function Pf(t={}){let{facet:e,style:n,title:r,subtitle:o,caption:i,ariaLabel:s,ariaDescription:a}=t,c=fs(t.className),f=t.marks===void 0?[]:VN(t.marks);f.push(...AV(f));let l=SV(e,t),u=new Map;for(let L of f){let P=WN(L,l,t);P&&u.set(L,P)}let p=new Map;l&&td(p,[l],t),td(p,u,t);let d=VN(TV(f,p,t));for(let L of d){let P=WN(L,l,t);P&&u.set(L,P)}f.unshift(...d);let h=vk(p,t);if(h!==void 0){let L=l?ix(h,l):void 0;for(let F of f){if(F.facet===null||F.facet==="super")continue;let q=u.get(F);q!==void 0&&(q.facetsIndex=F.fx!=null||F.fy!=null?ix(h,q):L)}let P=new Set;for(let{facetsIndex:F}of u.values())F?.forEach((q,W)=>{q?.length>0&&P.add(W)});h.forEach(0<P.size&&P.size<h.length?(F,q)=>F.empty=!P.has(q):F=>F.empty=!1);for(let F of f)if(F.facet==="exclude"){let q=u.get(F);q!==void 0&&(q.facetsIndex=Mk(q.facetsIndex))}}for(let L of Yt.keys())so(t[L])&&L!=="fx"&&L!=="fy"&&p.set(L,[]);let m=new Map;for(let L of f){if(m.has(L))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:F}=u.get(L)??{},{data:q,facets:W,channels:tt}=L.initialize(P,F,t);v3(tt,t),m.set(L,{data:q,facets:W,channels:tt})}let g=Bp(td(p,m,t),t),y=Fk(g,f,t);hk(g,y);let x=B6(g),{fx:b,fy:w}=x,_=b||w?z6(g,y):y,v=b||w?OV(x,y):y,A=as(t),E=A.document,T=Bo("svg").call(E.documentElement),$=T;A.ownerSVGElement=T,A.className=c,A.projection=Ek(t,_),A.filterFacets=(L,P)=>ix(h,{channels:P,groups:rx(L,P)}),A.getMarkState=L=>{let P=m.get(L),F=u.get(L);return{...P,channels:{...P.channels,...F?.channels}}},A.dispatchValue=L=>{$.value!==L&&($.value=L,$.dispatchEvent(new Event("input",{bubbles:!0})))};let M=new Set;for(let[L,P]of m)if(L.initializer!=null){let F=L.facet==="super"?v:_,q=L.initializer(P.data,P.facets,P.channels,x,F,A);if(q.data!==void 0&&(P.data=q.data),q.facets!==void 0&&(P.facets=q.facets),q.channels!==void 0){let{fx:W,fy:tt,...nt}=q.channels;_V(nt),Object.assign(P.channels,nt);for(let ot of Object.values(nt)){let{scale:X}=ot;X!=null&&!hC(Yt.get(X))&&(QN(ot,t),M.add(X))}(W!=null||tt!=null)&&u.set(L,!0)}}if(M.size){let L=new Map;td(L,m,t,W=>M.has(W)),td(p,m,t,W=>M.has(W));let P=NV(Bp(L,t),g),{scales:F,...q}=B6(P);Object.assign(g,P),Object.assign(x,q),Object.assign(x.scales,F)}let k,R;h!==void 0&&(k={x:b?.domain(),y:w?.domain()},h=_k(h,k),R=Sk(b,w,y));for(let[L,P]of m)P.values=L.scale(P.channels,x,A);let{width:S,height:I}=y;St(T).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",I).attr("viewBox",`0 0 ${S} ${I}`).attr("aria-label",s).attr("aria-description",a).call(L=>L.append("style").text(`:where(.${c}) {
|
|
60
51
|
--plot-background: white;
|
|
61
52
|
display: block;
|
|
62
53
|
height: auto;
|
|
@@ -66,24 +57,24 @@ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",h===void 0?null:`${+
|
|
|
66
57
|
:where(.${c} text),
|
|
67
58
|
:where(.${c} tspan) {
|
|
68
59
|
white-space: pre;
|
|
69
|
-
}`)).call(Wf,n);for(let k of l){let{channels:$,values:P,facets:U}=m.get(k);if(p===void 0||k.facet==="super"){let W=null;if(U&&(W=U[0],W=k.filter(W,$,P),W.length===0))continue;let nt=k.render(W,x,P,v,I);if(nt==null)continue;M.appendChild(nt)}else{let W;for(let nt of p){if(!(k.facetAnchor?.(p,O,nt)??!nt.empty))continue;let ot=null;if(U){let Y=f.has(k);if(ot=U[Y?nt.i:0],ot=k.filter(ot,$,P),ot.length===0)continue;!Y&&ot===U[0]&&(ot=Qs(ot)),ot.fx=nt.x,ot.fy=nt.y,ot.fi=nt.i}let at=k.render(ot,x,P,_,I);if(at!=null){(W??=Yt(M).append("g")).append(()=>at).datum(nt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(Y)&&(W.attr(Y,at.getAttribute(Y)),at.removeAttribute(Y))}}W?.selectChildren().attr("transform",C)}}let D=e9(y,I,e),{figure:R=r!=null||i!=null||o!=null||D.length>0}=e;R&&(N=E.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",r!=null&&N.append(o9(E,r,"h2")),i!=null&&N.append(o9(E,i,"h3")),N.append(...D,M),o!=null&&N.append(QK(E,o))),N.scale=J7(x.scales),N.legend=K$(y,I,e);let F=r7();return F>0&&Yt(M).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(`${F.toLocaleString("en-US")} warning${F===1?"":"s"}. Please check the console.`),N}function o9(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function QK(e,t){let n=e.createElement("figcaption");return n.append(t),n}function KK({marks:e=[],...t}={}){return vy({...t,marks:[...e,this]})}St.prototype.plot=KK;function s9(e){return e.flat(1/0).filter(t=>t!=null).map(ttt)}function ttt(e){return typeof e.render=="function"?e:new IT(e)}var IT=class extends St{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function MT(e,t){for(let n in e)u9(e[n],t);return e}function u9(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:A3(s,i)}=t[n]??{};a!=null&&(e.value=Wt(e.value,a),e.transform=!1)}function ett(e){for(let t in e)z3(t,e[t])}function wy(e,t,n,r=AF){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(!l7(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=f7(s);c&&ST(e,"x",u),l&&ST(e,"y",f)}}}else ST(e,a,s)}return e}function ST(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function ntt(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=Uf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Uf(i,{value:r,scale:"fy"})),MT(o,t);let s=Hw(i,o);return{channels:o,groups:s,data:e.data}}function a9(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=Uf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Uf(c,{value:i,scale:"fy"})),MT(l,n),{channels:l,groups:Hw(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&&Yn(`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 rtt(e,t={}){return Me({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function itt(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)?cc:/^y$/i.test(i)?sa:ac,r=i(rtt(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===sa?"left":"bottom");let s=bv(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function ott(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:h}=u,x:{axis:d=c,grid:p=d===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:x=g===null?null:h}=s,fy:{axis:b=f,grid:w=b===null?null:h}=a}=n;(r||!Vo(i)&&!c9("x",e))&&(d=p=null),(r||!Vo(o)&&!c9("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=w=null),d===void 0&&(d=!_v(e,"x")),m===void 0&&(m=!_v(e,"y")),g===void 0&&(g=!_v(e,"fx")),b===void 0&&(b=!_v(e,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),g===!0&&(g=d==="top"||d===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return vv(_,w,pv,a),wv(_,b,fv,"right","left",u,a),vv(_,x,yv,s),wv(_,g,hv,"top","bottom",u,s),vv(_,y,dv,o),wv(_,m,my,"left","right",n,o),vv(_,p,mv,i),wv(_,d,yy,"bottom","top",n,i),_}function wv(e,t,n,r,i,o,s){if(!t)return;let a=stt(t);s=att(a?r:t,o,s);let{line:c}=s;(n===my||n===yy)&&c&&!ea(c)&&e.push(Kf(ctt(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function vv(e,t,n,r){!t||ea(t)||e.push(n(ltt(t,r)))}function stt(e){return/^\s*both\s*$/i.test(e)}function att(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:h=t.label,labelAnchor:d,labelArrow:p=t.labelArrow,labelOffset: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:h,labelAnchor:d,labelArrow:p,labelOffset:m}}function ctt(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function ltt(e,{stroke:t=Ka(e)?e:void 0,ticks:n=utt(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function utt(e){switch(typeof e){case"number":return!0;case"string":return!Ka(e)}return ur(e)||typeof e?.range=="function"}function _v(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function c9(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 ftt(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 htt({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=qw(n),l=e&&l9(e),u=t&&l9(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 l9(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 dtt=new Map([["basis",XA],["basis-closed",GA],["basis-open",WA],["bundle",HA],["bump-x",zA],["bump-y",qA],["cardinal",ZA],["cardinal-closed",JA],["cardinal-open",QA],["catmull-rom",KA],["catmull-rom-closed",t3],["catmull-rom-open",e3],["linear",Ws],["linear-closed",n3],["monotone-x",i3],["monotone-y",o3],["natural",s3],["step",a3],["step-after",l3],["step-before",c3]]);function _y(e=Ws,t){if(typeof e=="function")return e;let n=dtt.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 Sv(e=fc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?fc:_y(e,t)}function fc(e){return Ws(e)}function Jo(e={y:"count"},t={}){[e,t]=TT(e,t);let{x:n,y:r}=t;return AT(Iv(n,t,G),null,null,r,e,kl(t))}function Qo(e={x:"count"},t={}){[e,t]=TT(e,t);let{x:n,y:r}=t;return AT(null,Iv(r,t,G),n,null,e,Rl(t))}function ca(e={fill:"count"},t={}){[e,t]=TT(e,t);let{x:n,y:r}=ptt(t);return AT(n,r,null,null,e,kl(Rl(t)))}function d9(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=kw}=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 th(e={}){return d9(Jo,"y",Gi(e,"x"))}function eh(e={}){return d9(Qo,"x",Gi(e,"y"))}function AT(e,t,n,r,{data:i=Cw,filter:o=ry,sort:s,reverse:a,...c}={},l={}){e=f9(e),t=f9(t),c=mtt(c,l),i=y9(i,G),s=s==null?void 0:p9("sort",s,l),o=o==null?void 0:m9("filter",o,l),n!=null&&Wo(c,"x","x1","x2")&&(n=null),r!=null&&Wo(c,"y","y1","y2")&&(r=null);let[u,f]=Bn(e),[h,d]=Bn(e),[p,m]=Bn(t),[y,g]=Bn(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=Bn(x),{x:v,y:I,z:E,fill:M,stroke:N,x1:A,x2:O,y1:C,y2:S,domain:T,cumulative:D,thresholds:R,interval:F,...k}=l,[$,P]=Bn(E),[U]=Le(M),[W]=Le(N),[nt,ot]=Bn(U),[at,Y]=Bn(W);return{..."z"in l&&{z:$||E},..."fill"in l&&{fill:nt||M},..."stroke"in l&&{stroke:at||N},...bn(k,(st,q,Z)=>{let rt=Nl(wt(st,x),Z?.[b]),z=wt(st,E),Rt=wt(st,U),ht=wt(st,W),Ht=sy(c,{z,fill:Rt,stroke:ht}),Qt=[],tt=[],ce=rt&&_([]),Ar=z&&P([]),Ji=Rt&&ot([]),zz=ht&&Y([]),aO=e&&f([]),qz=e&&d([]),cO=t&&m([]),jz=t&&g([]),Vz=xtt(e,t,st),Yz=0;for(let nu of c)nu.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let nu of q){let lO=[];for(let ru of c)ru.scope("facet",nu);s&&s.scope("facet",nu),o&&o.scope("facet",nu);for(let[ru,Xz]of tc(nu,Ht))for(let[Gz,Dg]of tc(Xz,rt))for(let[Qi,os]of Vz(Dg))if(Ht&&(os.z=ru),!(o&&!o.reduce(Qi,os))){lO.push(Yz++),tt.push(i.reduceIndex(Qi,st,os)),rt&&ce.push(Gz),z&&Ar.push(Ht===z?ru:z[(Qi.length>0?Qi:Dg)[0]]),Rt&&Ji.push(Ht===Rt?ru:Rt[(Qi.length>0?Qi:Dg)[0]]),ht&&zz.push(Ht===ht?ru:ht[(Qi.length>0?Qi:Dg)[0]]),aO&&(aO.push(os.x1),qz.push(os.x2)),cO&&(cO.push(os.y1),jz.push(os.y2));for(let Wz of c)Wz.reduce(Qi,os);s&&s.reduce(Qi,os)}Qt.push(lO)}return $3(Qt,s,a),{data:tt,facets:Qt}}),...!Wo(c,"x")&&(u?{x1:u,x2:h,x:kf(u,h)}:{x:v,x1:A,x2:O}),...!Wo(c,"y")&&(p?{y1:p,y2:y,y:kf(p,y)}:{y:I,y1:C,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:st,output:q})=>[st,q]))}}function TT({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function Iv(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...wi(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=ET(e.thresholds,e.interval),e}function ptt(e){let{x:t,y:n}=e;return t=Iv(t,e),n=Iv(n,e),[t.value,n.value]=Pe(t.value,n.value),{x:t,y:n}}function f9(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ue,thresholds:i}=e,o=s=>{let a=wt(s,t),c;if(Be(a)||gtt(i)){a=Wt(a,v3,Float64Array);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Qa(i)?i(a,u,f):i;typeof h=="number"&&(h=Mm(u,f,h)),Qa(h)&&(r===ue&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f))),c=h}else{a=en(a);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Qa(i)?i(a,u,f):i;if(typeof h=="number")if(r===ue){let d=Ns(u,f,h);if(isFinite(d))if(d>0){let p=Math.round(u/d),m=Math.round(f/d);p*d<=u||--p,m*d>f||++m;let y=m-p+1;h=new Float64Array(y);for(let g=0;g<y;++g)h[g]=(p+g)*d}else if(d<0){d=-d;let p=Math.round(u*d),m=Math.round(f*d);p/d<=u||--p,m/d>f||++m;let y=m-p+1;h=new Float64Array(y);for(let g=0;g<y;++g)h[g]=(p+g)/d}else h=[u];else h=[u]}else h=En(u,f,h);else Qa(h)&&(r===ue&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f)));c=h}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?wtt:n>0?btt:DT)(l,c,a),l};return o.label=Cn(t),o}function ET(e,t,n=h9){if(e===void 0)return t===void 0?n:Xo(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return yx;case"scott":return wp;case"sturges":return Na;case"auto":return h9}return Km(e)}return e}function mtt(e,t){return R3(e,t,p9)}function p9(e,t,n){return Lw(e,t,n,m9)}function m9(e,t,n){return Bw(e,t,n,y9)}function y9(e,t){return Pf(e,t,ytt)}function ytt(e){switch(`${e}`.toLowerCase()){case"x":return vtt;case"x1":return Stt;case"x2":return Itt;case"y":return _tt;case"y1":return Mtt;case"y2":return Att;case"z":return P3}throw new Error(`invalid bin reduce: ${e}`)}function h9(e,t,n){return Math.min(200,wp(e,t,n))}function gtt(e){return NF(e)||ur(e)&&Be(e)}function xtt(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[h,d]]of i.entries())yield[u[f],{data:n,x1:c,y1:h,x2:l,y2:d}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function DT(e,t,n){return t=en(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Es(t,n[o])-1]?.push(o);return i}}function btt(e,t,n){let r=DT(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 wtt(e,t,n){let r=DT(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 g9(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var vtt={reduceIndex(e,t,{x1:n,x2:r}){return g9(n,r)}},_tt={reduceIndex(e,t,{y1:n,y2:r}){return g9(n,r)}},Stt={reduceIndex(e,t,{x1:n}){return n}},Itt={reduceIndex(e,t,{x2:n}){return n}},Mtt={reduceIndex(e,t,{y1:n}){return n}},Att={reduceIndex(e,t,{y2:n}){return n}};function nh(e={}){return S3(e)?e:{...e,x:G}}function rh(e={}){return I3(e)?e:{...e,y:G}}function x9(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=Ja(e);let o=e[x3]=new Uint32Array(n+i);t=t.map(a=>Ja(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 NT(e={},t={}){arguments.length===1&&([e,t]=sh(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=ah(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:kf(c,l)}}function v9(e={},t={}){arguments.length===1&&([e,t]=sh(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=ah(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function _9(e={},t={}){arguments.length===1&&([e,t]=sh(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=ah(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function OT(e={},t={}){arguments.length===1&&([e,t]=sh(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=ah(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:kf(c,l)}}function S9(e={},t={}){arguments.length===1&&([e,t]=sh(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=ah(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function I9(e={},t={}){arguments.length===1&&([e,t]=sh(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=ah(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function ih({x:e,x1:t,x2:n,...r}={}){return r=Gi(r,"y"),t===void 0&&n===void 0?NT({x:e,...r}):([t,n]=M3(e,t,n),{...r,x1:t,x2:n})}function oh({y:e,y1:t,y2:n,...r}={}){return r=Gi(r,"x"),t===void 0&&n===void 0?OT({y:e,...r}):([t,n]=M3(e,t,n),{...r,y1:t,y2:n})}function sh(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var Ttt={length:!0};function ah(e,t=ty,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Vn(a),[l,u]=Bn(e),[f,h]=xn(t),[d,p]=xn(t);return f.hint=d.hint=Ttt,i=Ett(i),o=Ott(o,i,r),[bn(a,(m,y,g)=>{({data:m,facets:y}=x9(m,y));let x=e==null?void 0:u(Nl(wt(m,e),g?.[n])),b=wt(m,t,Float64Array),w=wt(m,c),_=o&&o(m,x,b,w),v=m.length,I=h(new Float64Array(v)),E=p(new Float64Array(v)),M=[];for(let N of y){let A=x?Array.from(fn(N,O=>x[O]).values()):[N];if(_)for(let O of A)O.sort(_);for(let O of A){let C=0,S=0;s&&O.reverse();for(let T of O){let D=b[T];D<0?C=E[T]=(I[T]=C)+D:D>0?S=E[T]=(I[T]=S)+D:E[T]=I[T]=S}}M.push(A)}return i&&i(M,I,E,w),{data:m,facets:y}}),l,f,d]}function Ett(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Dtt;case"center":case"silhouette":return Ntt;case"wiggle":return A9}throw new Error(`unknown offset: ${e}`)}}function M9(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 Dtt(e,t,n){for(let r of e)for(let i of r){let[o,s]=M9(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 Ntt(e,t,n){for(let r of e){for(let i of r){let[o,s]=M9(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}T9(r,t,n)}E9(e,t,n)}function A9(e,t,n,r){for(let i of e){let o=new Qn,s=0;for(let a of i){let c=-1,l=a.map(d=>Math.abs(n[d]-t[d])),u=a.map(d=>{c=r?r[d]:++c;let p=n[d]-t[d],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...fx(u)];for(let d of a)t[d]+=s,n[d]+=s;let h=Dn(l);h&&(s-=Dn(l,(d,p)=>(u[p]/2+f[p])*d)/h)}T9(i,t,n)}E9(e,t,n)}function T9(e,t,n){let r=fe(e,i=>fe(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function E9(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(fe(a,c=>t[c])+Jt(a,c=>n[c]))/2),s=fe(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 Ott(e,t,n){if(e===void 0&&t===A9)return b9(mn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?Al:mn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return Ltt(i);case"z":return Btt(i);case"sum":return Ctt(i);case"appearance":return ktt(i);case"inside-out":return b9(i)}return w9(b3(e))}if(typeof e=="function")return(e.length===1?w9:Rtt)(e);if(Array.isArray(e))return Ftt(e);throw new Error(`invalid order: ${e}`)}}function Ltt(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function Btt(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function Ctt(e){return Mv(e,(t,n,r,i)=>Ru(lr(t),o=>Dn(o,s=>r[s]),o=>i[o]))}function ktt(e){return Mv(e,(t,n,r,i)=>Ru(lr(t),o=>n[Qc(o,s=>r[s])],o=>i[o]))}function b9(e){return Mv(e,(t,n,r,i)=>{let o=lr(t),s=Ru(o,f=>n[Qc(f,h=>r[h])],f=>i[f]),a=Ui(o,f=>Dn(f,h=>r[h]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function w9(e){return t=>{let n=wt(t,e);return(r,i)=>mn(n[r],n[i])}}function Rtt(e){return t=>(n,r)=>e(t[n],t[r])}function Ftt(e){return Mv(mn,()=>e)}function Mv(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Qn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var $tt={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},zl=class extends St{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:Vn(n),optional:!0}},n,$tt),this.z=a,this.curve=_y(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 ut("svg:g",o).call(kt,this,i,o).call(Et,this,n,0,0).call(u=>u.selectAll().data(Gw(t,[s,a,c,l],this,r)).enter().append("path").call(Ct,this).call(Cl,this,r).attr("d",_f().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 Sy(e,t){return t===void 0?la(e,{x:Dl,y:Za}):new zl(e,t)}function hc(e,t){let{y:n=Ee,...r}=eh(t);return new zl(e,ih(nh({...r,y1:n,y2:void 0})))}function la(e,t){let{x:n=Ee,...r}=th(t);return new zl(e,oh(rh({...r,x1:n,x2:void 0})))}var Ptt={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Iy=class extends St{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,Ptt),this.curve=Sv(a,c),Wi(this,n)}project(t,n,r){this.curve!==fc&&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 ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Ct,this).attr("d",u===fc&&o.projection?Utt(o.projection,s,a,c,l):h=>{let d=rr(),p=u(d);return p.lineStart(),p.point(s[h],a[h]),p.point(c[h],l[h]),p.lineEnd(),d}).call(Kt,this,r).call(aa,this,r,o)).node()}};function Utt(e,t,n,r,i){let o=On(e);return t=en(t),n=en(n),r=en(r),i=en(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function Av(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=My(t,n,r),[o,s]=My(i,o,s),new Iy(e,{...a,x1:n,x2:r,y1:o,y2:s})}function My(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 ztt={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},Ay=class extends St{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:h=u,sweep:d}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,ztt),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+h,this.sweep=qtt(d)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:h,headAngle:d,headLength:p,insetStart:m,insetEnd:y}=this,g=u?w=>u[w]:yn(f===void 0?1:f),x=d*Zf/2,b=p/1.5;return ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Ct,this).attr("d",_=>{let v=s[_],I=a[_],E=c[_],M=l[_],N=Math.hypot(E-v,M-I);if(N<=m+y)return null;let A=Math.atan2(M-I,E-v),O=Math.min(b*g(_),N/3),C=this.sweep(v,I,E,M)*h*Zf,S=Math.hypot(N/Math.tan(C),N)/2;if(m||y)if(S<1e5){let nt=Math.sign(C),[ot,at]=jtt([v,I],[E,M],S,nt);if(m&&([v,I]=D9([ot,at,S],[v,I,m],-nt*Math.sign(m))),y){let[Y,st]=D9([ot,at,S],[E,M,y],nt*Math.sign(y));A+=Math.atan2(st-at,Y-ot)-Math.atan2(M-at,E-ot),E=Y,M=st}}else{let nt=E-v,ot=M-I,at=Math.hypot(nt,ot);m&&(v+=nt/at*m,I+=ot/at*m),y&&(E-=nt/at*y,M-=ot/at*y)}let T=A+C,D=T+x,R=T-x,F=E-O*Math.cos(D),k=M-O*Math.sin(D),$=E-O*Math.cos(R),P=M-O*Math.sin(R),U=S<1e5?`A${S},${S} 0,0,${C>0?1:0} `:"L",W=O?`M${F},${k}L${E},${M}L${$},${P}`:"";return`M${v},${I}${U}${E},${M}${W}`}).call(Kt,this,r)).node()}};function qtt(e=1){if(typeof e=="number")return yn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(cn(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Ot(t,r);case"-x":return(t,n,r)=>Jn(t,r);case"+y":return(t,n,r,i)=>Ot(n,i);case"-y":return(t,n,r,i)=>Jn(n,i)}}function jtt([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 D9([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 N9(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=My(t,n,r),[o,s]=My(i,o,s),new Ay(e,{...a,x1:n,x2:r,y1:o,y2:s})}var ch=class extends St{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=Bt(s),this.insetRight=Bt(a),this.insetBottom=Bt(c),this.insetLeft=Bt(l),this.rx=he(u,"auto"),this.ry=he(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ut("svg:g",o).call(kt,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Ct,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(Kt,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)}},O9={ariaLabel:"bar"},Ty=class extends ch{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,O9)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return fr(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 fr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Ey=class extends ch{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,O9)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return fr(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 fr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Ko(e,t={}){return Bf(t)||(t={...t,y:Ee,x2:G}),new Ty(e,ih(tv(nh(t))))}function ts(e,t={}){return Bf(t)||(t={...t,x:Ee,y2:G}),new Ey(e,oh(ev(rh(t))))}var Vtt={ariaLabel:"cell"},ql=class extends ch{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,Vtt)}_transform(t,n){t.call(Et,n,{},0,0)}};function dc(e,{x:t,y:n,...r}={}){return[t,n]=Pe(t,n),new ql(e,{...r,x:t,y:n})}function L9(e,{x:t=Ee,fill:n,stroke:r,...i}={}){return n===void 0&&Le(r)[0]===void 0&&(n=G),new ql(e,{...i,x:t,fill:n,stroke:r})}function B9(e,{y:t=Ee,fill:n,stroke:r,...i}={}){return n===void 0&&Le(r)[0]===void 0&&(n=G),new ql(e,{...i,y:t,fill:n,stroke:r})}var Ytt={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Dy(e){return e.sort===void 0&&e.reverse===void 0?Nw({channel:"-r"},e):e}var jl=class extends St{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Hs,frameAnchor:c}=n,[l,u]=ae(s,0),[f,h]=qF(a),[d,p]=ae(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:d,scale:"r",filter:cr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Dy(n),Ytt),this.r=p,this.rotate=u,this.symbol=h,this.frameAnchor=Go(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:x}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:h}=r,{r:d,rotate:p,symbol:m}=this,[y,g]=vn(this,i),x=m===Hs,b=u?void 0:d*d*Math.PI;return Ya(d)&&(t=[]),ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(Ct,this).call(x?_=>{_.attr("cx",c?v=>c[v]:y).attr("cy",l?v=>l[v]:g).attr("r",u?v=>u[v]:d)}:_=>{_.attr("transform",lc`translate(${c?v=>c[v]:y},${l?v=>l[v]:g})${f?v=>` rotate(${f[v]})`:p?` rotate(${p})`:""}`).attr("d",u&&h?v=>{let I=rr();return h[v].draw(I,u[v]*u[v]*Math.PI),I}:u?v=>{let I=rr();return m.draw(I,u[v]*u[v]*Math.PI),I}:h?v=>{let I=rr();return h[v].draw(I,b),I}:(()=>{let v=rr();return m.draw(v,b),v})())}).call(Kt,this,r)).node()}};function _i(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Pe(t,n)),new jl(e,{...r,x:t,y:n})}function C9(e,{x:t=G,...n}={}){return new jl(e,rv({...n,x:t}))}function k9(e,{y:t=G,...n}={}){return new jl(e,nv({...n,y:t}))}function R9(e,t){return _i(e,{...t,symbol:"circle"})}function F9(e,t){return _i(e,{...t,symbol:"hexagon"})}var Xtt={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Vl=class extends St{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:Vn(n),optional:!0}},n,Xtt),this.z=o,this.curve=Sv(s,a),Wi(this,n)}filter(t){return t}project(t,n,r){this.curve!==fc&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(l=>l.selectAll().data(Gw(t,[s,a],this,r)).enter().append("path").call(Ct,this).call(Cl,this,r).call(p$,this,r,o).attr("d",c===fc&&o.projection?Gtt(o.projection,s,a):Cm().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function Gtt(e,t,n){let r=On(e);return t=en(t),n=en(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Yl(e,{x:t,y:n,...r}={}){return[t,n]=Pe(t,n),new Vl(e,{...r,x:t,y:n})}function pc(e,{x:t=G,y:n=Ee,...r}={}){return new Vl(e,eh({...r,x:t,y:n}))}function mc(e,{x:t=Ee,y:n=G,...r}={}){return new Vl(e,th({...r,x:t,y:n}))}var Wtt={ariaLabel:"rect"},Xl=class extends St{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:h,ry:d}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,Wtt),this.insetTop=Bt(c),this.insetRight=Bt(l),this.insetBottom=Bt(u),this.insetLeft=Bt(f),this.rx=he(h,"auto"),this.ry=he(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:h,marginRight:d,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v,rx:I,ry:E}=this,M=(s?.bandwidth?s.bandwidth():0)-v-w,N=(a?.bandwidth?a.bandwidth():0)-b-_;return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{},0,0).call(A=>A.selectAll().data(t).enter().append("rect").call(Ct,this).attr("x",c&&(x||!fr(s))?u?O=>Math.min(c[O],u[O])+v:O=>c[O]+v:m+v).attr("y",l&&(x||!fr(a))?f?O=>Math.min(l[O],f[O])+b:O=>l[O]+b:h+b).attr("width",c&&(x||!fr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+M):M:y-d-m-w-v).attr("height",l&&(x||!fr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+N):N:g-h-p-b-_).call(ft,"rx",I).call(ft,"ry",E).call(Kt,this,r)).node()}};function Ny(e,t){return new Xl(e,hT(dT(t)))}function lh(e,t={}){return Bf(t)||(t={...t,y:Ee,x2:G,interval:1}),new Xl(e,ih(dT(nh(t))))}function uh(e,t={}){return Bf(t)||(t={...t,x:Ee,y2:G,interval:1}),new Xl(e,oh(hT(rh(t))))}function BT(e,t){t=Htt(t);let{x:n,y:r,color:i,size:o}=t,s=Tv(e,n),a=Tv(e,r),c=Tv(e,i),l=Tv(e,o),{fx:u,fy:f,x:{value:h,reduce:d,zero:p,...m},y:{value:y,reduce:g,zero:x,...b},color:{value:w,color:_,reduce:v},size:{value:I,reduce:E},mark:M}=t;if(d===void 0&&(d=g==null&&h==null&&I==null&&y!=null?"count":null),g===void 0&&(g=d==null&&y==null&&I==null&&h!=null?"count":null),E===void 0&&I==null&&v==null&&d==null&&g==null&&(h==null||De(s))&&(y==null||De(a))&&(E="count"),p===void 0&&(p=Ev(d)?!0:void 0),x===void 0&&(x=Ev(g)?!0:void 0),h==null&&y==null)throw new Error("must specify x or y");if(d!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&h==null)throw new Error("reducing y requires x");M===void 0&&(M=I!=null||E!=null?"dot":Ev(d)||Ev(g)||v!=null?"bar":h!=null&&y!=null?De(s)||De(a)||d==null&&g==null&&!Oy(s)&&!Oy(a)?"dot":"line":h!=null||y!=null?"rule":null);let N,A,O;switch(M){case"dot":O=_i,A="stroke";break;case"line":O=s&&a||d!=null||g!=null?x||g!=null||s&&Oy(s)?mc:p||d!=null||a&&Oy(a)?pc:Yl:s?pc:mc,A="stroke",P9(c)&&(N=null);break;case"area":O=!(x||g!=null)&&(p||d!=null||a&&Oy(a))?hc:la,A="fill",P9(c)&&(N=null);break;case"rule":O=s?Xr:Gr,A="stroke";break;case"bar":O=d!=null?De(a)?$9(d)&&s&&De(s)?dc:Ko:lh:g!=null?De(s)?$9(g)&&a&&De(a)?dc:ts:uh:v!=null||E!=null?s&&De(s)&&a&&De(a)?dc:s&&De(s)?ts:a&&De(a)?Ko:Ny:s&&ta(s)&&!(a&&ta(a))?Ko:a&&ta(a)&&!(s&&ta(s))?ts:dc,A="fill";break;default:throw new Error(`invalid mark: ${M}`)}let C={fx:u,fy:f,x:s??void 0,y:a??void 0,[A]:c??_,z:N,r:l??void 0,tip:!0},S,T={[A]:v??void 0,r:E??void 0};if(d!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(T.y=g,S=De(s)?ec:Jo):d!=null?(T.x=d,S=De(a)?nc:Qo):(v!=null||E!=null)&&(s&&a?S=De(s)&&De(a)?oy:De(s)?Qo:De(a)?Jo:ca:s?S=De(s)?ec:Jo:a&&(S=De(a)?nc:Qo)),(S===ca||S===Jo)&&(C.x={value:s,...m}),(S===ca||S===Qo)&&(C.y={value:a,...b}),p===void 0&&(p=s&&!(S===ca||S===Jo)&&(O===Ko||O===hc||O===lh||O===Gr)),x===void 0&&(x=a&&!(S===ca||S===Qo)&&(O===ts||O===la||O===uh||O===Xr)),{fx:u??null,fy:f??null,x:{value:h??null,reduce:d??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!x,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:I??null,reduce:E??null},mark:M,markImpl:U9[O],markOptions:C,transformImpl:U9[S],transformOptions:T,colorMode:A}}function z9(e,t){let n=BT(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=LT[n.markImpl],f=LT[n.transformImpl],h=r!=null||i!=null?Kf({strokeOpacity:.1}):null,d=[o?Xr([0]):null,s?Gr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?nn(h,d,p):nn(h,p,d)}function Oy(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Ot(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function Htt({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return Vr(e)||(e=fh(e)),Vr(t)||(t=fh(t)),Vr(n)||(n=Ka(n)?{color:n}:fh(n)),Vr(r)||(r=fh(r)),Vr(i)&&({value:i}=fh(i)),Vr(o)&&({value:o}=fh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function Tv(e,t){let n=wt(e,t.value);return n&&(n.label=Cn(t.value)),n}function fh(e){return Ztt(e)?{reduce:e}:{value:e}}function Ev(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function $9(e){return/^(?:first|last|mode)$/i.test(e)}function Ztt(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&gn(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 P9(e){return e?new Kn(e).size>e.length>>1:!1}var LT={dot:_i,line:Yl,lineX:pc,lineY:mc,areaX:hc,areaY:la,ruleX:Xr,ruleY:Gr,barX:Ko,barY:ts,rect:Ny,rectX:lh,rectY:uh,cell:dc,bin:ca,binX:Jo,binY:Qo,group:oy,groupX:ec,groupY:nc},U9=Object.fromEntries(Object.entries(LT).map(([e,t])=>[t,e]));function hh(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=G});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),Ir(o,t)}function dh(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=G});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),Ir(o,t)}function Ir(e={},t={}){let n=Vn(t),r=Object.entries(e).map(([i,o])=>{let s=Iw(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=xn(s);return{key:i,input:s,output:a,setOutput:c,map:Jtt(o)}});return{...bn(t,(i,o)=>{let s=wt(i,n),a=r.map(({input:l})=>wt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?fn(l,f=>s[f]).values():[l])r.forEach(({map:f},h)=>f.mapIndex(u,a[h],c[h]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function Jtt(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&gn(e))return Qtt(e);if(typeof e=="function")return CT(Cf(e));switch(`${e}`.toLowerCase()){case"cumsum":return tet;case"rank":return CT((t,n)=>vp(t,r=>n[r]));case"quantile":return CT((t,n)=>Ktt(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function Qtt(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Ktt(e,t){let n=Io(e,t)-1;return vp(e,t).map(r=>r/n)}function CT(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 tet={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function q9(e={},t){return arguments.length===1&&(t=e),hh(ph(e),t)}function j9(e={},t){return arguments.length===1&&(t=e),dh(ph(e),t)}function ph(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=net(r),Yn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return ret(n)(t,eet(i,t),o)}function eet(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 net(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function ret(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return Dv(Lf(e));switch(e.toLowerCase()){case"deviation":return Dv(li);case"max":return Nv((t,n)=>Jt(t,r=>n[r]));case"mean":return iet;case"median":return Dv(zi);case"min":return Nv((t,n)=>fe(t,r=>n[r]));case"mode":return Nv((t,n)=>Uu(t,r=>n[r]));case"sum":return V9;case"variance":return Dv(Da);case"difference":return aet;case"ratio":return cet;case"first":return uet;case"last":return fet}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return Nv(Cf(e))}function Dv(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 Nv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=ze(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=ze(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Qs(i,c,c+t),o)),a-=ze(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 V9(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 iet(e,t,n){if(n){let r=V9(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],h=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,h!==null&&!isNaN(h=+h)&&(s-=h,--a)}}}}function oet(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(ze(o))return o}}function set(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(ze(o))return o}}function Y9(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 X9(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 aet(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]]=X9(i,r,s,e)-Y9(i,r,s,e)}}}function cet(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]]=X9(i,r,s,e)/Y9(i,r,s,e)}}}function uet(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]]=oet(i,r,s,e)}}}function fet(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]]=set(i,r,s,e)}}}var ua={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function G9(e,{x:t=G,y:n,k:r=ua.k,color:i=ua.color,opacity:o=ua.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return nn(ie(s)?null:hc(e,Ir({x1:yc({k:-r,...f}),x2:yc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ie(c)?null:pc(e,Ir({x:yc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function W9(e,{x:t,y:n=G,k:r=ua.k,color:i=ua.color,opacity:o=ua.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return nn(ie(s)?null:la(e,Ir({y1:yc({k:-r,...f}),y2:yc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ie(c)?null:mc(e,Ir({y:yc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function yc({n:e=ua.n,k:t=0,strict:n=ua.strict,anchor:r=ua.anchor}={}){return ph({k:e,reduce:i=>Os(i)+t*(li(i)||0),strict:n,anchor:r})}var het={ariaLabel:"tick",fill:null,stroke:"currentColor"},Ov=class extends St{constructor(t,n,r){super(t,n,r,het),Wi(this,r)}render(t,n,r,i,o){return ut("svg:g",o).call(kt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Ct,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(Kt,this,r).call(aa,this,r,o)).node()}},Ly=class extends Ov{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=Bt(s),this.insetBottom=Bt(a)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},Ce,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}},By=class extends Ov{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=Bt(s),this.insetLeft=Bt(a)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,Ce)}_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 Lv(e,{x:t=G,...n}={}){return new Ly(e,{...n,x:t})}function Bv(e,{y:t=G,...n}={}){return new By(e,{...n,y:t})}function H9(e,{x:t=G,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?nc:iy;return nn(Gr(e,u({x1:kT,x2:RT},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Ko(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),Lv(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),_i(e,Ir({x:J9},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function Z9(e,{y:t=G,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?ec:iy;return nn(Xr(e,u({y1:kT,y2:RT},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),ts(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),Bv(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),_i(e,Ir({y:J9},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function J9(e){let t=kT(e),n=RT(e);return e.map(r=>r<t||r>n?r:NaN)}function kT(e){let t=Q9(e)*2.5-K9(e)*1.5;return fe(e,n=>n>=t?n:NaN)}function RT(e){let t=K9(e)*2.5-Q9(e)*1.5;return Jt(e,n=>n<=t?n:NaN)}function Q9(e){return tr(e,.25)}function K9(e){return tr(e,.75)}var det={ariaLabel:"raster",stroke:null,pixelSize:1};function mh(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function tP(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var ky=class extends St{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:h=c==null?s:void 0,pixelSize:d=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=tP(o,"width")),s!=null&&(s=tP(s,"height")),l!=null&&(l=mh(l,"x1")),u!=null&&(u=mh(u,"y1")),f!=null&&(f=mh(f,"x2")),h!=null&&(h=mh(h,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||h==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=vet(l,f,o,s)),c===void 0&&u!=null&&h!=null&&(c=_et(u,h,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:h==null?null:[h],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=mh(d,"pixelSize"),this.blur=mh(p,"blur"),this.interpolate=a==null||c==null?null:pet(m)}},Ry=class extends ky{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ae(o)[0]!==void 0&&(n=Cv("fillOpacity",n)),Le(i)[0]!==void 0&&(n=Cv("fill",n))}super(t,void 0,n,det),this.imageRendering=he(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]??(T=>T),{x:a,y:c}=r,{document:l}=o,[u,f,h,d]=nP(r,i,o),p=h-u,m=d-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:x=Math.round(Math.abs(m)/y)}=this,b=g*x,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let T=g/p,D=x/m,R=Wt(a,k=>(k-u)*T,Float64Array),F=Wt(c,k=>(k-f)*D,Float64Array);w&&(w=this.interpolate(t,g,x,R,F,w)),_&&(_=this.interpolate(t,g,x,R,F,_))}else this.data==null&&t&&(v=t.fi*b);let I=l.createElement("canvas");I.width=g,I.height=x;let E=I.getContext("2d"),M=E.createImageData(g,x),N=M.data,{r:A,g:O,b:C}=sn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let T=0;T<b;++T){let D=T<<2;if(w){let R=s(w[T+v]);if(R==null){N[D+3]=0;continue}({r:A,g:O,b:C}=sn(R))}_&&(S=_[T+v]*255),N[D+0]=A,N[D+1]=O,N[D+2]=C,N[D+3]=S}return this.blur>0&&hI(M,this.blur),E.putImageData(M,0,0),ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(T=>T.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(d-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Ct,this).attr("xlink:href",I.toDataURL())).node()}};function FT(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&&LF(t)&&(r=Dl,i=Za,o===void 0&&(o=TF)),[t,{...s,x:r,y:i,[e]:o}]}function eP(){let[e,t]=FT("fill",...arguments);return new Ry(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function nP({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 $T({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),nP(zf(a,i),o,s)}function Cv(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return Me({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,h,d,p]=$T(o,s,a,c),m=d-f,y=p-h,{pixelSize:g}=this,{width:x=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(y)/g)}=t,w=new Array(x*b*(i?i.length:1)),_=m/x,v=y/b,I=0;for(let E of i??[void 0])for(let M=.5;M<b;++M)for(let N=.5;N<x;++N,++I)w[I]=n(l.invert(f+N*_),u.invert(h+M*v),E);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function pet(e){if(typeof e=="function")return e;if(e==null)return kv;switch(`${e}`.toLowerCase()){case"none":return kv;case"nearest":return $y;case"barycentric":return Fy();case"random-walk":return Py()}throw new Error(`invalid interpolate: ${e}`)}function kv(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 Fy({random:e=yl(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=di.from(t,d=>i[d],d=>o[d]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),h=wet(s,e);for(let d=0;d<c.length;d+=3){let p=c[d],m=c[d+1],y=c[d+2],g=a[2*p],x=a[2*m],b=a[2*y],w=a[2*p+1],_=a[2*m+1],v=a[2*y+1],I=Math.min(g,x,b),E=Math.max(g,x,b),M=Math.min(w,_,v),N=Math.max(w,_,v),A=(_-v)*(g-b)+(w-v)*(b-x);if(!A)continue;let O=s[t[p]],C=s[t[m]],S=s[t[y]];for(let T=Math.floor(I);T<E;++T)for(let D=Math.floor(M);D<N;++D){if(T<0||T>=n||D<0||D>=r)continue;let R=T+.5,F=D+.5,k=((_-v)*(R-b)+(F-v)*(b-x))/A;if(k<0)continue;let $=((v-w)*(R-b)+(F-v)*(g-b))/A;if($<0)continue;let P=1-k-$;if(P<0)continue;let U=T+n*D;u[U]=h(O,k,C,$,S,P,T,D),f[U]=1}}return met(u,f,i,o,s,n,r,l,t,h),u}}function met(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),i=Array.from(a,d=>i[c[d]]);let u=n.length,f=Array.from({length:u},(d,p)=>get(p,n,r)),h=0;for(let d=0;d<s;++d){let p=d+.5;for(let m=0;m<o;++m){let y=m+o*d;if(!t[y]){let g=m+.5;for(let x=0;x<u;++x){let b=(u+h+(x%2?(x+1)/2:-x/2))%u;if(f[b](g,p)){let w=yet(n.at(b-1),r.at(b-1),n[b],r[b],g,p);e[y]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,d),h=b;break}}}}}}function yet(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 Cy(e,t,n,r){return e*r-n*t}function get(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),h=s-c,d=a-l,p=i-s,m=o-a,y=c-u,g=l-f,x=Math.hypot(h,d),b=Math.hypot(p,m),w=Math.hypot(y,g);return(_,v)=>{let I=_-s,E=v-a,M=_-c,N=v-l;return Cy(I,E,M,N)>-1e-6&&Cy(I,E,h,d)*b-Cy(I,E,p,m)*x>-1e-6&&Cy(M,N,y,g)*x-Cy(M,N,h,d)*w<=0}}function $y(e,t,n,r,i,o){let s=new o.constructor(t*n),a=di.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let h=.5;h<t;++h,++f)l=a.find(h,u,l),h===.5&&(c=l),s[f]=o[e[l]]}return s}function Py({random:e=yl(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=di.from(r,p=>s[p],p=>a[p]),f,h,d;for(let p=.5,m=0;p<o;++p){h=f;for(let y=.5;y<i;++y,++m){let g=y,x=p;d=h=u.find(g,x,h),y===.5&&(f=h);let b,w=0;for(;(b=Math.hypot(s[r[d]]-g,a[r[d]]-x))>t&&w<n;){let _=e(y,p,w)*2*Math.PI;g+=Math.cos(_)*b,x+=Math.sin(_)*b,d=u.find(g,x,d),++w}l[m]=c[r[d]]}}return l}}function xet(e,t,n,r,i,o){return t*e+r*n+o*i}function bet(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 wet(e,t){return ta(e)||Be(e)?xet:bet(t)}function vet(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 _et(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 rP={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Uy=class extends ky{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=Xw({},i,rP);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:Cn(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=Cv("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},Iet(i),rP);let s={geometry:{value:G}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!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=On();return ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Ct,this).attr("d",l=>a(s[l])).call(Kt,this,r)}).node()}};function Iet({thresholds:e,interval:t,...n}){return e=ET(e,t,Na),Me(n,function(r,i,o,s,a,c){let[l,u,f,h]=$T(o,s,a,c),d=f-l,p=h-u,{pixelSize:m,width:y=Math.round(Math.abs(d)/m),height:g=Math.round(Math.abs(p)/m)}=this,x=y/d,b=g/p,w=o.value.value,_=[];if(this.interpolate){let{x:N,y:A}=ic(o,s,c),O=Wt(N,D=>(D-l)*x,Float64Array),C=Wt(A,D=>(D-u)*b,Float64Array),S=[o.x,o.y,o.value],T=[O,C,w];for(let D of i){let R=this.filter(D,S,T);_.push(this.interpolate(R,y,g,O,C,w))}}else if(i){let N=y*g,A=i.length;for(let O=0;O<A;++O)_.push(w.slice(O*N,O*N+N))}else _.push(w);if(this.blur>0)for(let N of _)yp({data:N,width:y,height:g},this.blur);let v=Met(e,w,...Aet(_));if(v===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:I}=Fa().size([y,g]).smooth(this.smooth),E=[],M=[];for(let N of _)M.push(Ue(E.length,E.push(...Wt(v,A=>I(N,A)))));for(let{coordinates:N}of E)for(let A of N)for(let O of A)for(let C of O)C[0]=C[0]/x+l,C[1]=C[1]/b+u;return{data:E,facets:M,channels:Rw(this.contourChannels,E)}})}function Met(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=En(...$u(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function oP(){return new Uy(...FT("value",...arguments))}function Aet(e){return[fe(e,t=>fe(t,iP)),Jt(e,t=>Jt(t,iP))]}function iP(e){return isFinite(e)?e:NaN}function cP(e,t){return PT(ac,e,t)}function lP(e,t={}){return PT(cc,e,t)}function uP(e,t={}){return PT(sa,e,t)}function PT(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Xr(t,sP("x",{...s,inset:-6},n))),i!=null&&a.push(Gr(t,sP("y",{...s,inset:-6},n))),r!=null&&a.push(Zo(t,aP("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Zo(t,aP("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return nn(...a)}function fP(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:Tet(e,u)}}function Tet(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...h}={},...d}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...h,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...d}}}function sP(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...fP(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function aP(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...fP(e,t,Eet(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function Eet(e,t){return Me(t,(n,r,i)=>({channels:{text:{value:ay(i,e)?.value}}}))}var Det={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Net={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Oet={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Let={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Bet={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},UT=class extends St{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,Det),this.curve=_y(s,a),Wi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[h,d]=vn(this,i),p=c?x=>c[x]:yn(h),m=l?x=>l[x]:yn(d),y=this;function g(x){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],I=[],E=[],M=[];function N(S,T){S=x[S],T=x[T],w.push(++b),v[b]=p(S),E[b]=m(S),I[b]=p(T),M[b]=m(T);for(let D in r)_[D].push(r[D][T])}let{halfedges:A,hull:O,triangles:C}=di.from(x,p,m);for(let S=0;S<A.length;++S){let T=A[S];T>S&&N(C[S],C[T])}for(let S=0;S<O.length;++S)N(O[S],O[(S+1)%O.length]);Yt(this).selectAll().data(w).enter().append("path").call(Ct,y).attr("d",S=>{let T=rr(),D=f(T);return D.lineStart(),D.point(v[S],E[S]),D.point(I[S],M[S]),D.lineEnd(),T}).call(Kt,y,_).call(aa,y,_,o)}return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(fn(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},zy=class extends St{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,h]=vn(this,i),d=c?g=>c[g]:yn(f),p=l?g=>l[g]:yn(h),m=this;function y(g){let x=di.from(g,d,p);Yt(this).append("path").datum(g[0]).call(Ct,m).attr("d",m._render(x,i)).call(Kt,m,r)}return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(fn(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},zT=class extends zy{constructor(t,n={}){super(t,n,Net),this.fill="none"}_render(t){return t.render()}},qT=class extends zy{constructor(t,n={}){super(t,n,Oet,Vn)}_render(t){return t.renderHull()}},jT=class extends St{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,Let)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,h]=vn(this,i),d=c?g=>c[g]:yn(f),p=l?g=>l[g]:yn(h),m=this;function y(g){let x=di.from(g,d,p),b=hP(x,i);Yt(this).selectAll().data(g).enter().append("path").call(Ct,m).attr("d",(w,_)=>b.renderCell(_)).call(Kt,m,r)}return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(fn(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},VT=class extends zy{constructor(t,n){super(t,n,Bet),this.fill="none"}_render(t,n){return hP(t,n).render()}};function hP(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 qy(e,t,{x:n,y:r,...i}={}){return[n,r]=Pe(n,r),new e(t,{...i,x:n,y:r})}function dP(e,t){return qy(UT,e,t)}function pP(e,t){return qy(zT,e,t)}function mP(e,t){return qy(qT,e,t)}function yP(e,t){return qy(jT,e,t)}function gP(e,t){return qy(VT,e,t)}var Cet={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},jy=class extends St{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=xP(s)&&(s="currentColor",!0),u=xP(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Vn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Ret({...c,fill:s,stroke:a},l,u),Cet),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=On();return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Ct,this).call(Kt,this,r).attr("d",l=>a(s[l]))).node()}};function bP(e,{x:t,y:n,...r}={}){return[t,n]=Pe(t,n),new jy(e,{...r,x:t,y:n})}var ket=new Set(["x","y","z","weight"]);function Ret(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"?en(o):+o,Me(e,function(s,a,c,l,u,f){let h=c.weight?en(c.weight.value):null,d=c.z?.value,{z:p}=this,[m,y]=vn(this,u),{width:g,height:x}=u,{x:b,y:w}=ic(c,l,f),_=Object.fromEntries(Object.entries(c).filter(([C])=>!ket.has(C)).map(([C,S])=>[C,{...S,value:[]}])),v=t&&[],I=n&&[],E=tM().x(b?C=>b[C]:m).y(w?C=>w[C]:y).weight(h?C=>h[C]:1).size([g,x]).bandwidth(i),M=[];for(let C of a){let S=[];M.push(S);for(let T of d?hy(C,d,p):[C]){let D=E.contours(T);S.push([T,D])}}let N=o;if(!(N instanceof El)){let C=0;for(let S of M)for(let[,T]of S){let D=T.max;D>C&&(C=D)}N=Float64Array.from({length:o-1},(S,T)=>C*100*(T+1)/o)}let A=[],O=[];for(let C of M){let S=[];A.push(S);for(let[T,D]of C)for(let R of N){S.push(O.length),O.push(D(R/100)),v&&v.push(R),I&&I.push(R);for(let F in _)_[F].value.push(c[F].value[T[0]])}}return v&&v.push(0),I&&I.push(0),{data:s,facets:A,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...I&&{stroke:{value:I,scale:"color"}},contours:{value:O}}}})}function xP(e){return/^density$/i.test(e)}function _P(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ee:void 0,y:s=r===void 0&&i===void 0?G:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:h=u,stroke:d,strokeOpacity:p,z:m=Le(d)[0],clip:y,tip:g,render:x,...b}={}){return[t,n]=wP(o,t,n),[r,i]=wP(s,r,i),t===n&&r===i&&(r=gc(0)),{tip:g}=Gi({tip:g},"x"),nn(ie(c)?null:Object.assign(Sy(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:Hf(x,vP(!0)),clip:y,...b}),{ariaLabel:"positive difference"}),ie(l)?null:Object.assign(Sy(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:h,render:Hf(x,vP(!1)),clip:y,...b}),{ariaLabel:"negative difference"}),Yl(e,{x:n,y:i,z:m,stroke:d,strokeOpacity:p,tip:g,clip:!0,...b}))}function wP(e,t,n){return t===void 0&&n===void 0?t=n=gc(e):t===void 0?(n=gc(n),t=e===void 0?n:gc(e)):n===void 0?(t=gc(t),n=e===void 0?t:gc(e)):(t=gc(t),n=gc(n)),[t,n]}function gc(e){let t,{value:n,label:r=Cn(n)}=wi(e);return{transform:i=>t||(t=wt(i,n)),label:r}}function vP(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===zw(n.y)<0?u:f).fill(l);let h=s(t,n,{...r,x2:a,y2:f},i,o),d=s(t,n,{...r,x1:c,y1:u},i,o),p=h.querySelector("g")??h,m=d.querySelector("g")??d;for(let y=0;p.firstChild;y+=2){let g=Yw(),x=ut("svg:clipPath",o).attr("id",g).node();x.appendChild(p.firstChild),m.childNodes[y].setAttribute("clip-path",`url(#${g})`),m.insertBefore(x,m.childNodes[y])}return d}}var Fet={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Vy=class extends St{constructor(t,n={}){let[r,i]=ae(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:cr,optional:!0}},Dy(n),Fet),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=On(o.projection??$et(n)),{r:l}=this;return Ya(l)?t=[]:l!==void 0&&c.pointRadius(l),ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Ct,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Kt,this,r)}).node()}};function $et({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,pl({point(n,r){this.stream.point(e(n),t(r))}})}function Rv(e,{geometry:t=G,...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 Vy(e,{geometry:t,...n})}function SP({strokeWidth:e=1.5,...t}={}){return Rv({type:"Sphere"},{strokeWidth:e,...t})}function IP({strokeOpacity:e=.1,...t}={}){return Rv(_M(),{strokeOpacity:e,...t})}var yh=.5,gh=0;function MP(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Bt(t),e=F3(e,n),Wo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Wo(e,"r")&&(n.r=t/2),Me(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:h,fill:d,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}=ic(s,a,l)),h=h?h.value:wt(i,r),d=d?.value,p=p?.value,m=m?.value;let y=sy(e,{z:h,fill:d,stroke:p,symbol:m}),g=h&&[],x=d&&[],b=p&&[],w=m&&[],_=[],v=[],I=[],E=-1;for(let O of e)O.initialize(i);for(let O of o){let C=[];for(let S of e)S.scope("facet",O);for(let[S,T]of tc(O,y))for(let{index:D,extent:R}of Pet(i,T,u,f,t)){C.push(++E),v.push(R.x),I.push(R.y),h&&g.push(y===h?S:h[D[0]]),d&&x.push(y===d?S:d[D[0]]),p&&b.push(y===p?S:p[D[0]]),m&&w.push(y===m?S:m[D[0]]);for(let F of e)F.reduce(D,R)}_.push(C)}let M=s.x.scale,N=s.y.scale,A={x:{value:v,source:a[M]?{value:Wt(v,a[M].invert),scale:M}:null},y:{value:I,source:a[N]?{value:Wt(I,a[N].invert),scale:N}:null},...h&&{z:{value:g}},...d&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:C})=>[O,{scale:"auto",label:C.label,radius:O==="r"?t/2:void 0,value:C.transform()}]))};return{data:i,facets:_,channels:A}})}function Pet(e,t,n,r,i){let o=i*(1.5/T3),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-gh)/o),f=Math.round(c=(c-yh)/i-(u&1)/2),h=l-u;if(Math.abs(h)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),x=c-y,b=l-g;m*m+h*h>x*x+b*b&&(f=y+(u&1?1:-1)/2,u=g)}let d=`${f},${u}`,p=s.get(d);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+yh,y:u*o+gh}},s.set(d,p)),p.index.push(a)}return s.values()}var Uet={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function AP(e){return new Yy(e)}var Yy=class extends St{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Ha,void 0,{clip:n,...r},Uet),this.binWidth=Bt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:h}=i,d=u-yh,p=f-c-yh,m=a-gh,y=h-l-gh,g=s/2,x=g*E3,b=x/2,w=g*2,_=x*1.5,v=Math.floor(d/w),I=Math.ceil(p/w),E=Math.floor((m+b)/_),M=Math.ceil((y-b)/_)+1,N=`m0,${xc(-x)}l${xc(g)},${xc(b)}v${xc(x)}l${xc(-g)},${xc(b)}`,A=N;for(let O=E;O<M;++O)for(let C=v;C<I;++C)A+=`M${xc(C*w+(O&1)*g)},${xc(O*_)}${N}`;return ut("svg:g",o).datum(0).call(kt,this,i,o).call(Et,this,{},Ce+yh,Ce+gh).call(O=>O.append("path").call(Ct,this).call(Kt,this,r).attr("d",A)).node()}};function xc(e){return Math.round(e*1e3)/1e3}var zet={ariaLabel:"image",fill:null,stroke:null};function qet(e){return/^\.*\//.test(e)}function jet(e){return/^(blob|data|file|http|https):/i.test(e)}function Vet(e){return typeof e=="string"&&(qet(e)||jet(e))?[void 0,e]:[e,void 0]}var Xy=class extends St{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:d}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=Vet(l),[y,g]=ae(o),[x,b]=ae(s,g!==void 0?g*2:void 0),[w,_]=ae(a,g!==void 0?g*2:void 0),[v,I]=ae(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:cr,optional:!0},width:{value:x,filter:cr,optional:!0},height:{value:w,filter:cr,optional:!0},rotate:{value:v,optional:!0},src:{value:p,optional:!0}},Dy(n),zet),this.src=m,this.width=b,this.rotate=I,this.height=_,this.r=g,this.preserveAspectRatio=he(u,"xMidYMid"),this.crossOrigin=qe(f),this.frameAnchor=Go(h),this.imageRendering=he(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:h,rotate:d,src:p}=r,{r:m,width:y,height:g,rotate:x}=this,[b,w]=vn(this,i);return ut("svg:g",o).call(kt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append("image").call(Ct,this).attr("x",TP(c,u,h,b,y,m)).attr("y",TP(l,f,h,w,g,m)).attr("width",u?v=>u[v]:y!==void 0?y:h?v=>h[v]*2:m*2).attr("height",f?v=>f[v]:g!==void 0?g:h?v=>h[v]*2:m*2).attr("transform",d?v=>`rotate(${d[v]})`:x?`rotate(${x})`:null).attr("transform-origin",d||x?lc`${c?v=>c[v]:b}px ${l?v=>l[v]:w}px`:null).call(ft,"href",p?v=>p[v]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",h?v=>`circle(${h[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Kt,this,r)).node()}};function TP(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 EP(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Pe(t,n)),new Xy(e,{...r,x:t,y:n})}function Yet(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=d*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),d=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?d=Math.pow(t*y*e,1/t):d=1-Math.pow(n*y*(1-e),1/n)),g=-xh(t)-xh(n)+xh(t+n);s<10;s++){if(d===0||d===1)return d;if(h=Xet(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+g),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function Xet(e,t,n){var r=e===0||e===1?0:Math.exp(xh(t+n)-xh(t)-xh(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*DP(e,t,n)/t:1-r*DP(1-e,n,t)/n}function DP(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function xh(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 NP(e,t){var n=Yet(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Get={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fv=class extends St{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:Vn(n),optional:!0}},n,Get),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 ut("svg:g",o).call(kt,this,i,o).call(Et,this,n).call(u=>u.selectAll().data(c?hy(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Ct,this).call(Cl,this,{...r,fill:null,fillOpacity:null}).attr("d",h=>this._renderLine(h,s,a)).call(l&&!ea(this.fill)?h=>h.select(Wet).attr("stroke","none").call(Ct,this).call(Cl,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function Wet(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ui.svg,"path"),this)}var YT=class extends Fv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ue(t,u=>r[u]),c=$v(t,r,n),l=BP(t,r,n,(1-i)/2,c);return _f().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ue(t,a=>r[a]),s=$v(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},XT=class extends Fv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ue(t,u=>n[u]),c=$v(t,n,r),l=BP(t,n,r,(1-i)/2,c);return _f().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ue(t,a=>n[a]),s=$v(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function OP(e,{y:t=Ee,x:n=G,stroke:r,fill:i=ie(r)?"currentColor":r,...o}={}){return new YT(e,eh({...o,x:n,y:t,fill:i,stroke:r}))}function LP(e,{x:t=Ee,y:n=G,stroke:r,fill:i=ie(r)?"currentColor":r,...o}={}){return new XT(e,th({...o,x:t,y:n,fill:i,stroke:r}))}function $v(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],h=n[u];r+=f,i+=h,o+=f*h,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function BP(e,t,n,r,i){let o=Dn(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=NP(r,e.length-2);return(u,f)=>{let h=i(u),d=c*Math.sqrt(1/e.length+(u-o)**2/s);return h+f*l*d}}function Gy({path:e=G,delimiter:t,frameAnchor:n,treeLayout:r=ml,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=qv(s),i=RP(i),a!=null&&(a=WT(a)),n===void 0&&(n=s.frameAnchor);let l=FP(t),u=VP(c,WT),[f,h]=xn(),[d,p]=xn();return{x:f,y:d,frameAnchor:n,...bn(c,(m,y)=>{let g=l(wt(m,e)),x=h([]),b=p([]),w=-1,_=[],v=[],I=Rb().path(M=>g[M]),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??ty);for(let M of u)M[Uv]=M[qP]([]);for(let M of y){let N=[],A=I(M.filter(O=>g[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&A.sort(i),E(A);for(let O of A.descendants())if(!(a!=null&&!a(O))){N.push(++w),_[w]=O.data,s.position(O,w,x,b);for(let C of u)C[Uv][w]=C[jP](O)}v.push(N)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function zv({path:e=G,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=ml,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=qv(l),a=RP(a),u!=null&&(u=kP(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let h=FP(t),d=VP(f,kP),[p,m]=xn(),[y,g]=xn(),[x,b]=xn(),[w,_]=xn();return{x1:p,x2:y,y1:x,y2:w,...bn(f,(v,I)=>{let E=h(wt(v,e)),M=m([]),N=g([]),A=b([]),O=_([]),C=-1,S=[],T=[],D=Rb().path(F=>E[F]),R=s();R.nodeSize&&R.nodeSize([1,1]),R.separation&&c!==void 0&&R.separation(c??ty);for(let F of d)F[Uv]=F[qP]([]);for(let F of I){let k=[],$=D(F.filter(P=>E[P]!=null)).each(P=>P.data=v[P.data]);a!=null&&$.sort(a),R($);for(let{source:P,target:U}of $.links())if(!(u!=null&&!u(U,P))){k.push(++C),S[C]=U.data,l.position(P,C,M,A),l.position(U,C,N,O);for(let W of d)W[Uv][C]=W[jP](U,P)}T.push(k)}return{data:S,facets:T}}),...Object.fromEntries(d)}}function qv(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Het;case"right":return Zet}throw new Error(`invalid tree anchor: ${e}`)}var Het={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},Zet={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function RP(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?CP(WT(e)):CP(Jet(e))}function CP(e){return(t,n)=>mn(e(t),e(n))}function Jet(e){return t=>t.data?.[e]}function FP(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=>Qet(r,t))}var GT=92,$P=47;function Qet(e,t){if(t===GT)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 GT: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 $P: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 Ket(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case GT:if(!t){t=!0;continue}case $P:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function PP(e){return gn(e)&&typeof e.node=="function"}function tnt(e){return gn(e)&&typeof e.link=="function"}function WT(e){if(PP(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return ZT;case"node:path":return HT;case"node:internal":return UP;case"node:external":return zP;case"node:depth":return JT;case"node:height":return QT}throw new Error(`invalid node value: ${e}`)}}function kP(e){if(PP(e))return e.node;if(tnt(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return Pv(ZT);case"parent:path":return Pv(HT);case"parent:depth":return Pv(JT);case"parent:height":return Pv(QT);case"node:name":return ZT;case"node:path":return HT;case"node:internal":return UP;case"node:external":return zP;case"node:depth":return JT;case"node:height":return QT}throw new Error(`invalid link value: ${e}`)}}function HT(e){return e.id}function ZT(e){return ent(e.id)}function JT(e){return e.depth}function QT(e){return e.height}function UP(e){return!!e.children}function zP(e){return!e.children}function Pv(e){return(t,n)=>n==null?void 0:e(n)}function ent(e){let t=e.length;for(;--t>0&&!nnt(e,t););return Ket(e.slice(t+1))}function nnt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var qP=2,jP=3,Uv=4;function VP(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...xn(i),o])}return n}function KT(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:h=u,dot:d=ie(f)&&ie(h),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:w=ml,textLayout:_=w===ml||w===Cb?"mirrored":"normal",tip:v,...I}={}){if(g===void 0&&(g=qv(I.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=cn(_,"textLayout",["mirrored","normal"]);function E(M){return Zo(e,Gy({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...M,...I}))}return nn(Av(e,zv({treeLayout:w,markerStart:f,markerEnd:h,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...I})),d?_i(e,Gy({treeLayout:w,fill:t===void 0?"node:internal":t,title:y,tip:v,...I})):null,p!=null?_==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:E():null)}function YP(e,t){return KT(e,{...t,treeLayout:Cb})}function XP({geometry:e=G,...t}={}){return Me({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=wt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),h=On(a);for(let d=0;d<l;++d)[u[d],f[d]]=h.centroid(c[d]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function GP({geometry:e=G,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=wt(wt(r,e),yM),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var iU=eq(rU(),1);var unt=({marginLeft:e})=>[1,e],fnt=({width:e,marginRight:t})=>[-1,e-t],hnt=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],dnt=({marginTop:e})=>[1,e],pnt=({height:e,marginBottom:t})=>[-1,e-t],mnt=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function oU(e){return typeof e=="string"?{anchor:e}:e}function sU(e={},t={}){arguments.length===1&&([e,t]=cU(e));let{anchor:n="left",padding:r=1,r:i=t.r}=oU(e);switch(`${n}`.toLowerCase()){case"left":n=unt;break;case"right":n=fnt;break;case"middle":n=hnt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return lU("x","y",n,Bt(r),i,t)}function aU(e={},t={}){arguments.length===1&&([e,t]=cU(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=oU(e);switch(`${n}`.toLowerCase()){case"top":n=dnt;break;case"bottom":n=pnt;break;case"middle":n=mnt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return lU("y","x",n,Bt(r),i,t)}function cU(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function lU(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=ny(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 Me(o,function(s,a,c,l,u,f){let{[t]:h,r:d}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:h}=ic(c,l,f));let p=d?void 0:i!==void 0?Bt(i):this.r!==void 0?this.r:3;d&&(d=wt(d.value,l[d.scale]||G,Float64Array));let[m,y]=n(u),g=m?gnt:ynt,x=new Float64Array(h.length),b=d?w=>d[w]:()=>p;for(let w of a){let _=(0,iU.default)();w=w.filter(d?I=>Tf(h[I])&&cr(d[I]):I=>Tf(h[I]));let v=new Float64Array(2*w.length+2);for(let I of w){let E=b(I),M=m?E+r:0,N=h[I]-E,A=h[I]+E,O=2;_.queryInterval(N-r,A+r,([,,S])=>{let T=x[S]-M,D=h[I]-h[S],R=r+(d?d[I]+d[S]:2*p),F=Math.sqrt(R*R-D*D);v[O++]=T-F,v[O++]=T+F});let C=v.slice(0,O);m&&(C=C.filter(S=>S>=0));t:for(let S of C.sort(g)){for(let T=0;T<O;T+=2)if(v[T]+1e-6<S&&S<v[T+1]-1e-6)continue t;x[I]=S+M;break}_.insert([N,A,I])}}m||(m=1);for(let w of a)for(let _ of w)x[_]=x[_]*m+y;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:h,source:c[t]},...d&&{r:{value:d,source:c.r}}}}})}function ynt(e,t){return Math.abs(e)-Math.abs(t)}function gnt(e,t){return e-t}function fU(e,t){return arguments.length===1&&({basis:e,...t}=e),hh(Yv(e),t)}function hU(e,t){return arguments.length===1&&({basis:e,...t}=e),dh(Yv(e),t)}function Yv(e){if(e===void 0)return uU;if(typeof e=="function")return Xv(Cf(e));if(/^p\d{2}$/i.test(e))return _h(Lf(e));switch(`${e}`.toLowerCase()){case"deviation":return wnt;case"first":return uU;case"last":return bnt;case"max":return vnt;case"mean":return _nt;case"median":return Snt;case"min":return Int;case"sum":return Mnt;case"extent":return xnt}throw new Error(`invalid basis: ${e}`)}function Xv(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 _h(e){return Xv((t,n)=>e(t,r=>n[r]))}var xnt={mapIndex(e,t,n){let[r,i]=ue(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},uU=Xv((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(ze(r))return r}}),bnt=Xv((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(ze(r))return r}}),wnt={mapIndex(e,t,n){let r=Os(e,o=>t[o]),i=li(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},vnt=_h(Jt),_nt=_h(Os),Snt=_h(zi),Int=_h(fe),Mnt=_h(Dn);function dU(e,t){return Ant("x",e,t)}function Ant(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]=Sw(t.replace(/^[+-]/,"")),i*=l}t=Rf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Ir({[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]=ue(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function pU(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return Zy(t);case"last":return Jy(t)}if(typeof e=="function")return bc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=Tnt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return bc(n,r,t)}function Tnt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return o6;case"max":return s6}throw new Error(`unknown selector: ${e}`)}function Zy(e){return bc(null,Ent,e)}function Jy(e){return bc(null,Dnt,e)}function Gv(e){return bc("x",o6,e)}function Wv(e){return bc("y",o6,e)}function Hv(e){return bc("x",s6,e)}function Zv(e){return bc("y",s6,e)}function*Ent(e){yield e[0]}function*Dnt(e){yield e[e.length-1]}function*o6(e,t){yield xx(e,n=>t[n])}function*s6(e,t){yield Qc(e,n=>t[n])}function bc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Vn(n);return bn(n,(i,o)=>{let s=wt(i,r),a=wt(i,e),c=[];for(let l of o){let u=[];for(let f of s?fn(l,h=>s[h]).values():[l])for(let h of t(f,a))u.push(h);c.push(u)}return{data:i,facets:c}})}var Nnt=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function Ont(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 mU(e,t,n){for(let r in e){let i=Nnt.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&&Ont(t,i.split("."),o)}}var Lnt=new Set(["frame","hexgrid","sphere","graticule"]),Bnt=new Map([["first",Zy],["last",Jy],["maxX",Hv],["maxY",Zv],["minX",Gv],["minY",Wv],["nearest",ac],["nearestX",cc],["nearestXY",sa]]);async function gU(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;mU(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...h}=u,d=Bnt.get(f)?.(h)??h,p=Lnt.has(c)?[d]:[l,d];t.marks.push(a6[c](...p)),o.push(a.index)}knt(t,e);let s=vy(t);Rnt(s,o),Cnt(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function Cnt(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===So){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 knt(e,t){let{marks:n}=t;Jv("x",e,n),Jv("y",e,n),Jv("fx",e,n),Jv("fy",e,n)}function Jv(e,t,n){let r=t[e]||{};if(r.axis===null||r.label!==void 0)return;let i=n.map(l=>l.channelField(e)?.field);if(i.every(l=>l==null))return;let o,s,a;for(let l=0;l<i.length;++l){let{column:u,label:f}=i[l]||{};u===void 0&&f===void 0||(o===void 0&&s===void 0?(o=u,s=f,a=Fnt(n[l].data,e)||"number"):s!==f?s=void 0:o!==u&&(o=void 0))}let c=s||o;if(c!==void 0){if((a==="number"||a==="date")&&(e==="x"||e==="y")){r.percent&&(c=`${c} (%)`);let l=(e==="x"?1:-1)*(r.reverse?-1:1);e==="x"||r.labelAnchor==="center"?c=e==="x"==l<0?`\u2190 ${c}`:`${c} \u2192`:c=`${l<0?"\u2191 ":"\u2193 "}${c}`}t[e]={...r,label:c}}}function Rnt(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)yU(r,t);else yU(e,t)}function yU(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 Fnt(e,t){if(!e)return;let{columns:n}=e,r=n[t]??n[t+"1"]??n[t+"2"];if(r){for(let i of r)if(i!=null)return i instanceof Date?"date":typeof i}}var $nt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Qy=class{constructor(t){this.attributes={...$nt},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=fI()}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(t=400){let{top:n,bottom:r}=this.margins(),i=this.getAttribute("height");return i==null&&t!=null&&(i=t,this.setAttribute("height",i,{silent:!0})),i-n-r}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 gU(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 up(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 Qv(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||$r(e)!==null)}var Pnt=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function xU(e){return Pnt.has(e)}var Unt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function bU(e){return Unt.has(`${e}`.toLowerCase())}function Hi(e){return sI(e)?znt(e):qnt(e)}function znt(e){let{numRows:t,numCols:n,schema:{fields:r}}=e,i={};for(let o=0;o<n;++o){let s=r[o].name;i[s]?console.warn(`Redundant column name "${s}". Skipping...`):i[s]=cI(e.getChildAt(o))}return{numRows:t,columns:i}}function qnt(e){let t=e.length;if(typeof e[0]=="object"){let n=t?Object.keys(e[0]):[],r={};return n.length>0&&n.forEach(i=>{r[i]=e.map(o=>o[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}var wU=e=>e==="stroke"||e==="fill",jnt=e=>/opacity$/i.test(e),Vnt=e=>e==="symbol",Ynt=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),c6=(e,t)=>({channel:e,field:t,as:t instanceof wr?t.column:e}),l6=(e,t)=>({channel:e,value:t}),Kv=e=>Array.isArray(e),ln=class extends hr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Kv(this.source)&&(this.data=Hi(this.source));let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let h in u)s.add(h),c(h,u[h]);else if(f==="function"&&u[pp]){let h=u(this,l);for(let d in h)c(d,h[d])}else if(f==="string")xU(l)||wU(l)&&Qv(u)||Vnt(l)&&bU(u)?o.push(l6(l,u)):o.push(c6(l,Aa(u)));else if(vs(u))if(Array.isArray(u.columns))o.push(c6(l,u)),a.add(u);else{let h=l6(l,u.value);o.push(h),u.addEventListener("value",d=>(h.value=d,this.update()))}else f==="object"&&Ynt(l,u)?o.push(c6(l,u)):u!==void 0&&o.push(l6(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||Kv(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n=!1}={}){let r=n?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return r?.field?r: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){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=i.get(c)??i.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}return Array.from(i,([o,s])=>({table:t,column:o,stats:s}))}fieldInfo(t){let n=Object.fromEntries(t.map(r=>[r.column,r]));for(let r of this.channels){let{field:i}=r;i&&Object.assign(r,n[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return Ky(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Hi(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this;return u6(t,r,i,n)}};function Xn(e,t){let n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:wU(e.channel)?{value:n,scale:"color"}:jnt(e.channel)?{value:n,scale:"opacity"}:n}function Ky(e,t,n=[]){let r=dt.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 u6(e,t,n,r,i={}){let{numRows:o,values:s,columns:a}=r??{},c={};for(let f of n){let h=t.has(f.channel)?c:i;h[f.channel]=Xn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(r?{length:o}:null),options:i}]}function Wl(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{type:o}=e.channelField(t);r=o==="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 sp(i)}function Wr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=Wl(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,h]=r.map(x=>c(x)),d=l(o),p=a==="time"||a==="utc"?d:o,m=h===f?0:(n-i)/(h-f),y=m!==1?` * ${m}::DOUBLE`:"";return[u?j`(${h} - ${d}::DOUBLE)${y}`:j`(${d}::DOUBLE - ${f})${y}`,p]}var f6={x:["min","max"]},h6={y:["min","max"]},t_={...f6,...h6};function vU(e,t,n,r,i){let{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[An])return s;{let{column:c,min:l,max:u}=e.channelField(n),f=d6(t,c)||(a?zs().domain([l,u]).nice().domain():[l,u]);return s!==So&&(f[An]=!0),o.setAttribute(r,f,{silent:!0}),f}}function es(e,t){return vU(e,t,"x","xDomain","xNice")}function ns(e,t){return vU(e,t,"y","yDomain","yNice")}function d6(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&`${s.field}`===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 tg=class extends ln{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["min","max"]}:void 0;super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i}=this,{optimize:o=!0}=i.options||{},s=super.query(t);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,min:h,max:d}=this.channelField(r);if(o&&(f==="date"||f==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=d6(t,l)||[h,d],[x]=Wr(this,r,m,[y,g],1,u),b=s.select().map(w=>w.as).filter(w=>w!==u&&w!==c);return Xnt(s,x,u,c,b)}else return s.orderby(l)}};function Xnt(e,t,n,r,i=[]){let o=j`FLOOR(${t})::INTEGER`,s=a=>dt.from(e).select(a).groupby(o,i);return dt.union(s([{[n]:ai(n),[r]:Nu(r,n)},...i]),s([{[n]:si(n),[r]:Ou(r,n)},...i]),s([{[n]:Nu(n,r),[r]:ai(r)},...i]),s([{[n]:Ou(n,r),[r]:si(r)},...i])).orderby(i,n)}function _U(e,t=[]){return new t.constructor(e)}function SU(e,t,n){let r=_U(e,n),i=n.length;for(let o=0;o<i;++o)r[t[o]]=n[o];return r}function IU(e,t,n,r,i,o,s){let a=n.length,c=e*t,l=i.map(d=>r[d]),u={},f=[],h=new Int32Array(a);if(o?.length){let d=o.map(m=>r[m]),p={};for(let m=0;m<a;++m){let y=d.map(g=>g[m]);h[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let d=n.map(y=>y%e),p=n.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[h[y]].push(y);i.forEach((y,g)=>{let x=l[g];u[y]=f.map((b,w)=>s(m[w],e,t,d,p,x))})}else i.forEach((d,p)=>{let m=l[p],y=u[d]=f.map(()=>_U(c,m));for(let g=0;g<a;++g)y[h[g]][n[g]]=m[g]});return{numRows:f.length,columns:u}}function eg(e){let t=1/0,n=-1/0;return e.forEach(r=>{let i=r.length;for(let o=0;o<i;++o){let s=r[o];s<t&&(t=s),s>n&&(n=s)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function MU(e){let t=new Kn;return e.forEach(n=>{let r=n.length;for(let i=0;i<r;++i)t.add(n[i])}),Array.from(t).sort(Ot)}function Ve(e,t){return _r(e)?(e.addEventListener("value",t),e.value):e}function ng(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Gnt(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 Gnt(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),h=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),d,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],d=p-2;d>0;d-=2)f[d]+=l[p]*f[d-2]-l[p+1]*f[d-1],f[d+1]+=l[p]*f[d-1]+l[p+1]*f[d-2];for(d=0;d<=p;d+=2)f[d]+=i[p]*h[d]-i[p+1]*h[d+1],f[d+1]+=i[p]*h[d+1]+i[p+1]*h[d];for(h[p+2]=l[p]*h[p]-l[p+1]*h[p+1],h[p+3]=l[p]*h[p+1]+l[p+1]*h[p],d=p;d>0;d-=2)h[d]+=l[p]*h[d-2]-l[p+1]*h[d-1],h[d+1]+=l[p]*h[d-1]+l[p+1]*h[d-2]}for(p=0;p<4;++p)d=p<<1,t[p]=f[d]/u,e[p+1]=h[d+2]}function AU(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);e_(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);e_(t,u,i,r,o,s,a,u)}return c}function e_(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Wnt){let l=r*2,u=r*3,f=r*4,h=r*n,d,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,d=f;p<n;++p,d+=r)i[p]=e.b_causal[0]*t[d]+e.b_causal[1]*t[d-r]+e.b_causal[2]*t[d-l]+e.b_causal[3]*t[d-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,d=h-r*5;p<n;++p,d-=r)o[p]=e.b_anticausal[1]*t[d+r]+e.b_anticausal[2]*t[d+l]+e.b_anticausal[3]*t[d+u]+e.b_anticausal[4]*t[d+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,d=0;p<n;++p,d+=r)a[d]=i[p]+o[n-p-1];else for(p=0,d=0;p<n;++p,d+=r)a[d]=Math.max(0,i[p]+o[n-p-1]);return a}function Wnt(e,t,n,r,i,o,s,a,c,l,u,f=.5){let h=Math.abs(r)*n,d=r<0?h+r:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=d+r*m,p>=0&&p<h&&(e[y]+=l[y-m]*t[p]);let g=t[d],x=Math.ceil(u*10);for(m=0;m<x;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var fa="density",Zi=class extends ln{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Hnt(u);super(t,n,u,t_),this.densityMap=f,this.bandwidth=Ve(i,h=>(this.bandwidth=h,this.grids?this.convolve().update():null)),this.interpolate=Ve(o,h=>(this.interpolate=h,this.requestUpdate())),this.pixelSize=Ve(s,h=>(this.pixelSize=h,this.requestUpdate())),this.pad=Ve(a,h=>(this.pad=h,this.requestUpdate())),this.width=Ve(c,h=>(this.width=h,this.requestUpdate())),this.height=Ve(l,h=>(this.height=h,this.requestUpdate()))}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",r),t.addAttributeListener("yDomain",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[An]&&!n[An]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=es(this,t),[l,u]=this.extentY=ns(this,t),[f,h]=this.bins=this.binDimensions(),[d,p]=Wr(this,"x",f,[a,c],r),[m,y]=Wr(this,"y",h,[l,u],r),g=r?[We(p,[+a,+c]),We(y,[+l,+u])]:[Ms(+a,p),Is(p,+c),Ms(+l,y),Is(y,+u)],x=dt.from(s.table).where(t.concat(g)),b=this.groupby=[],w={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:I,channel:E,field:M}=v;M.aggregate?(w[E]=M,o[E]=!0):E==="weight"?w[fa]=Rr(M):E!=="x"&&E!=="y"&&(x.select({[I]:M}),b.push(I))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(fa),w.density=Zn()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return Qnt(x,d,m,w[fa],f,b)}else return Jnt(x,d,m,w,f,b)}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,i=Znt(this.interpolate),{columns:o}=Hi(t);return this.grids0=IU(n,r,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids0:i,plot:o}=this;if(this.grids=i,n>0){let s=t.length===1?t[0]:t.includes(fa)?fa:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=r,h=a.some(m=>m.some(y=>y<0)),d=ng(n*(u-1)/c,h),p=ng(n*(f-1)/l,h);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>AU(d,p,m,r))}}}return this}};function Hnt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Znt(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return $y;case"barycentric":return Fy();case"random-walk":return Py()}throw new Error(`invalid interpolate: ${e}`)}function Jnt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Qnt(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),c=a(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 dt.from(dt.unionAll(c,l,u,f)).select({index:"i",density:Rr("w")},o).groupby("index",o).having(Xc("density",0))}var rg=class extends Zi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=Ve(r,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,grids:r,thresholds:i,plot:o}=this,{numRows:s,columns:a}=r,c=i,l;if(Array.isArray(c))l=c;else{let[,A]=eg(a.density);l=Array.from({length:c-1},(O,C)=>A*(C+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[h,d]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(d-h)/u,g=(m-p)/f,x=+h,b=+p,w=A=>x+A*y,_=A=>b+A*g,v=Fa().size(t),I=this.contourData=Array(s*l.length),{density:E,...M}=a,N=Object.entries(M);for(let A=0,O=0;A<s;++A){let C=E[A],S=N.reduce((T,[D,R])=>(T[D]=R[A],T),{});for(let T=0;T<l.length;++T,++O)I[O]=Object.assign(Knt(v.contour(C,l[T]),w,_),S)}return this}plotSpecs(){let{type:t,channels:n,densityMap:r,contourData:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=Xn(s))}for(let s in r)r[s]&&(o[s]=Xn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function Knt(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 ig(e){return Array.from({length:e},(t,n)=>n)}function n_(e,t){let n=t.reduce((i,o,s)=>(i[o]=s,i),{}),r=ig(e.length);return r.sort((i,o)=>n[e[i]]-n[e[o]]),r}function r_(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 TU(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 EU(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 DU(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?sn(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 NU(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:h=1}=typeof c=="string"?sn(c):c,d=a<<2;i[d+0]=l,i[d+1]=u,i[d+2]=f,i[d+3]=255*h|0,r[t[a]]=d}return(a,c,l,u)=>{if(u.map)for(let f=0,h=0;f<l;++f)for(let d=0,p=(l-f-1)*c;d<c;++d,h+=4){let m=r[u[d+p]];a[h+0]=i[m+0],a[h+1]=i[m+1],a[h+2]=i[m+2],a[h+3]=i[m+3]}else{let f=r[u];for(let h=0,d=0;h<l;++h)for(let p=0;p<c;++p,d+=4)a[d+0]=i[f+0],a[d+1]=i[f+1],a[d+2]=i[f+2],a[d+3]=i[f+3]}}}function OU(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"?sn(a):a,h=s<<2;i[h+0]=c,i[h+1]=l,i[h+2]=u,i[h+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let h=0,d=(c-u-1)*a;h<a;++h,f+=4){let p=o*n(l[h+d])<<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 wc=class extends Zi{constructor(t,n){super("image",t,n),this.image=null}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=rrt(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=p6(this),p=s[f]??[],m=s[d]??[],y=o>1&&d&&this.groupby?.includes(d)?n_(m,this.plot.getAttribute("colorDomain")):ig(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(h?.(l.data,r,i,m[y[x]]),u?.(l.data,r,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}},og=class extends wc{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function p6(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(fa),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":Qv(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"?fa:null),h=c?.as??(u==="grid"?fa:null),d=l!=="grid"&&l!=="group"?DU(l):ert(e,f),p=u!=="grid"?TU(u):trt(e,h);return{alphaProp:h,colorProp:f,alpha:p,color:d}}function trt(e,t){let{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),o=i===So,s=i?.[An],a=!o&&!s&&i||eg(r.columns[t]);(o||s||!i)&&(o||(a[An]=!0),n.setAttribute("opacityDomain",a));let c=oc({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 EU(c)}function ert(e,t){let{plot:n,grids:r}=e,i=r.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),c=a===So,l=a?.[An],u=!c&&!l&&a||(o?i.slice().sort(Ot):s?MU(i):eg(i));(c||l||!a)&&(c||(u[An]=!0),n.setAttribute("colorDomain",u));let f=oc({color:{type:n.getAttribute("colorScale"),domain:u,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(s)return NU(f);{let h=oc({x:{type:nrt(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return OU(1024,f,h.apply)}}function nrt(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function rrt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=r_(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 sg=class extends wc{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),this.normalize=Ve(r,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:n,normalize:r,source:i,pad:o}=this,[s,a]=this.bins=this.binDimensions(),[c]=Wr(this,"x",s,es(this,t),o),[l]=Wr(this,"y",a,ns(this,t),o),u=dt.from(i.table).where(irt(this,t));this.aggr=["density"];let f=this.groupby=[],h=[];for(let d of n)if(Object.hasOwn(d,"field")){let{channel:p,field:m}=d;p==="z"?(u.select({[p]:m}),h.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return ort(u,c,l,h,s,a,f,r)}};function irt(e,t){if(Array.isArray(t)&&!t.length)return t;let{column:n}=e.channelField("x"),{column:r}=e.channelField("y"),i=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},o=s=>s.op==="AND"?vr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function ort(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=dt.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(vr(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=dt.select({x:j`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),h=dt.select({i:j`UNNEST(range((${f})))::INTEGER`}),d=dt.unionAll(dt.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)`),dt.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)`),dt.select(c,{x:"x0",y:"y0"}).from("pairs").where(Yc("dx"))),p=["x"].concat(c).join(", "),m=dt.from("raster").select(c,"x","y",a?{w:j`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(vr(We("x",[0,i],!0),We("y",[0,o],!0)));return dt.with({pairs:u,indices:h,raster:d,points:m}).from("points").select(s,{index:j`x + y * ${i}::INTEGER`,density:a?Rr("w"):Zn()}).groupby("index",s)}var Sh=class extends ln{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"?f6:h6),this.dim=a,this.bins=Ve(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=Ve(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[An]}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"?es:ns)(this,t),[a,c]=Wr(this,i,n,s),l=Ky(r,o,[i]).where(t.concat(We(c,s))),u=this.channelField("weight")?"weight":null;return srt(l,a,u)}queryResult(t){let{columns:{index:n,density:r}}=Hi(t);return this.grid=SU(this.bins,n,r),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=ng(n*(t-1)/l,c),f=e_(u,i,t),h=r==="x"?"y":"x",d=this.channelField(r).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),x=new Float64Array(t);for(let b=0;b<t;++b)g[b]=p+b*m,x[b]=f[b]*y;return this.data={numRows:t,columns:{[d]:g,[h]:x}},this}plotSpecs(){let{type:t,data:{numRows:n,columns:r},channels:i,dim:o}=this,s=o==="x"?{y:r.y}:{x:r.x};for(let a of i)s[a.channel]=Xn(a,r);return[{type:t,data:{length:n},options:s}]}};function srt(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 dt.from(dt.unionAll(i,o)).select({index:"i",density:Rr("w")}).groupby("index").having(Qd("density",0))}var ag=class extends Zi{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=Wl(this,"x"),c=Wl(this,"y"),[l,u]=r.map(y=>a.apply(y)),[f,h]=i.map(y=>c.apply(y)),d=(u-l)/(o-n),p=(h-f)/(s-n),m=n?0:.5;return this.data=art(this.grids,t,l,f,d,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:{numRows:i,columns:o}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:Xn(a,o)}for(let a in r)r[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function art(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,h=u*f,d=h*e.numRows,p=new Float64Array(d),m=new Float64Array(d),y=new Float64Array(d),g={x:p,y:m,density:y},{density:x,...b}=e.columns;for(let _ in b)g[_]=new b[_].constructor(d);let w=0;for(let _=0;_<e.numRows;++_){for(let I in b)g[I].fill(b[I][_],w,w+h);let v=x[_];for(let I=0,E=0;E<f;++E)for(let M=0;M<u;++M,++w,++I)p[w]=s(n+(M+c)*i),m[w]=a(r+(E+c)*o),y[w]=v[I]*l}return{numRows:d,columns:g}}function crt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=d*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),d=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?d=Math.pow(t*y*e,1/t):d=1-Math.pow(n*y*(1-e),1/n)),g=-Ih(t)-Ih(n)+Ih(t+n);s<10;s++){if(d===0||d===1)return d;if(h=lrt(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+g),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function lrt(e,t,n){var r=e===0||e===1?0:Math.exp(Ih(t+n)-Ih(t)-Ih(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*LU(e,t,n)/t:1-r*LU(1-e,n,t)/n}function LU(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function Ih(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 BU(e,t){var n=crt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}function CU(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}var Mh=class extends ln{constructor(t,n,r){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=r;super(t,n,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=Ve(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:n,field:r,source:{table:i}}=this,o=n.concat([{field:tp(r),as:"__avg__"},{field:Zn(r),as:"__n__"},{field:ep(r),as:"__sd__"}]);return Ky(o,i).where(t)}queryResult(t){return this.data=Hi(t),this}plotSpecs(){let{type:t,dim:n,detail:r,data:i,ci:o,channels:s}=this,a=Math.SQRT2*CU(o),{columns:{__avg__:c,__sd__:l,__n__:u}}=i,f={[`${n}1`]:c.map((h,d)=>h-a*l[d]/Math.sqrt(u[d])),[`${n}2`]:c.map((h,d)=>h+a*l[d]/Math.sqrt(u[d]))};return u6(t,r,s,i,f)}};var urt="geom",cg=class extends ln{constructor(t,n={},r){!Kv(t)&&!n?.geometry&&(n.geometry=rp(urt)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(i=>JSON.parse(i)))}return this}};var lg=class extends ln{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},t_),this.binWidth=Ve(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[An]&&!n[An]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=es(this,t),[c,l]=ns(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),h=`${r}::DOUBLE`,d=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,y,g,x=new Set,b={},w;for(let M of i)M.channel==="orderby"?w=M.value:M.channel==="x"?y=M:M.channel==="y"?g=M:Object.hasOwn(M,"field")&&(b[M.as]=M.field,M.field.aggregate&&M.field.columns.forEach(N=>x.add(N)));let _=dt.select({[y.as]:j`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${h} + ${u})::DOUBLE / ${p}`,[g.as]:j`${l}::DOUBLE - (y * ${d} + ${f})::DOUBLE / ${m}`,...b}).groupby("x","y");w&&_.orderby(w);let v=`${p} * (${y.field} - ${s}::DOUBLE)`,I=`${m} * (${l}::DOUBLE - ${g.field})`,E=dt.select({py:j`(${I} - ${f}) / ${d}`,pj:j`ROUND(py)::INTEGER`,px:j`(${v} - ${u}) / ${h} - 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(x)).from(o.table).where(Ss(y.field),Ss(g.field),t);return _.from(E)}};var ug=class extends Zi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.image=null,this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,h]=this.bins,[d,p]=Wr(this,"x",f,[a,c],r),[m,y]=Wr(this,"y",h,[l,u],r),g=r?[We(p,[+a,+c]),We(y,[+l,+u])]:[Ms(+a,p),Is(p,+c),Ms(+l,y),Is(y,+u)],x=dt.from(s.table).where(g),b=this.groupby=[],w={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:I,channel:E,field:M}=v;M.aggregate?(w[E]=M,o[E]=!0):E==="weight"?w.density=Rr(M):E!=="x"&&E!=="y"&&(x.select({[I]:M}),b.push(I))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),w.density=Zn()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return mrt(x,d,m,w.density,f,b)}else return prt(x,d,m,w,f,b)}async requestTiles(){let t=ci();this.prefetch&&t.cancel(this.prefetch);let{pad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=es(this,this._filter),[f,h]=ns(this,this._filter),d=u-l,p=h-f,m=Math.floor((l-o)*(a-n)/d),y=Math.floor((f-s)*(c-n)/p),g=(A,O)=>[[o+A*d,o+(A+1)*d],[s+O*p,s+(O+1)*p]],x=Math.floor((l-o)/d),b=r?kU((u-o)/d):x,w=Math.floor((f-s)/p),_=i?kU((h-s)/p):w,v=[];for(let A=x;A<=b;++A)for(let O=w;O<=_;++O)v.push([A,O]);let I=v.map(([A,O])=>t.query(this.tileQuery(g(A,O)))),E=[];if(r)for(let A=w;A<=_;++A)E.push([b+1,A]),E.push([x-1,A]);if(i){let A=r?x-1:x,O=r?b+1:b;for(let C=A;C<=O;++C)E.push([C,_+1]),E.push([C,w-1])}this.prefetch=E.map(([A,O])=>t.prefetch(this.tileQuery(g(A,O))));let M=await Promise.all(I),N=frt(a,c,m,y,v,M);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=drt(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=p6(this),p=s[f]??[],m=s[d]??[],y=o>1&&d&&this.groupby?.includes(d)?n_(m,this.plot.getAttribute("colorDomain")):ig(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(h?.(l.data,r,i,m[y[x]]),u?.(l.data,r,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}};function frt(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,h=u*t-r;hrt(e,t,s,a,f,h)}),s}function hrt(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,h=o+Math.floor(u/e);0<=f&&f<e&&0<=h&&h<t&&(n[f+h*e]=c[l])}}function drt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=r_(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 prt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function mrt(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),c=a(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 dt.from(dt.unionAll(c,l,u,f)).select({index:"i",density:Rr("w")},o).groupby("index",o).having(Xc("density",0))}function kU(e){let t=Math.floor(e);return t===e?t-1:t}var fg=class extends ln{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=Ve(r,a=>(this.ci=a,s())),this.precision=Ve(i,a=>(this.precision=a,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 dt.from(super.query(t)).select({intercept:NS(r,n),slope:OS(r,n),n:LS(r,n),ssy:BS(r,n),ssx:CS(r,n),xm:kS(r,n),x0:Lu(ai(n).where(Ss(r))),x1:Lu(si(n).where(Ss(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Hi(t),this.lineData=yrt(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?grt(n,t,r,o):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o=t.columns,s=i?n.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of r)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=Xn(l,s);break;case"stroke":a.stroke=Xn(l,o),c.fill=Xn(l,s);break;case"strokeOpacity":a.strokeOpacity=Xn(l,o);break;case"fillOpacity":c.fillOpacity=Xn(l,s);break;default:a[l.channel]=Xn(l,o),c[l.channel]=Xn(l,s);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function m6(e,t){if(e.concat)return e.concat(t);let n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function yrt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(d,p)=>i[p]+d*o[p],f=m6(t,n),h=m6(t.map(u),n.map(u));for(let d in l)l[d]=m6(l[d],l[d]);return{numRows:f.length,columns:{x:f,y:h,...l}}}function grt(e,t,n,r){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:h,...d}=e.columns,p=Object.keys(d),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=n*(s[y]-o[y])/r,x=BU((1-t)/2,u[y]-2)*Math.sqrt(h[y]/(u[y]-2));Ue(o[y],s[y]-g/2,g).concat(s[y]).forEach(b=>{let w=c[y]+b*l[y],_=x*Math.sqrt(1/u[y]+(b-a[y])**2/f[y]);m.x.push(b),m.y1.push(w-_),m.y2.push(w+_),p.forEach(v=>m[v].push(d[v][y]))})}return{numRows:m.x.length,columns:m}}function RU(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 Ah(e){let t={};for(let n in e)t[RU(n)]=e[n];return t}function xrt(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 hg=class{constructor(t,{selection:n,channels:r={}}){this.mark=xrt(t),this.selection=n;let i=Object.entries(Ah(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Ph(()=>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 brt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=l.__data__,h=a(Array.isArray(f)?f[0]:f);for(let d=0;d<r.length;++d){let[p,m]=r[d];l.setAttribute(p,h?u[d]:m)}}}};async function brt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:vr(n)},o=e.query(r);(o.queries||[o]).forEach(c=>{c.groupby().length?c.select(i):c.$select(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.get(c):c=>s[c].__:()=>!1}function y6(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 FU(){return y6(HI())}function $U(){return y6(GI())}function PU(){return y6(WI())}function dg(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 rs(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function pg(e,t,n=1){return t.invert(n*Math.floor(e/n))}function i_(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var vc=class{constructor(t,{channel:n,selection:r,field:i=void 0,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||rs(t,n),this.style=a&&Ah(a),this.brush=n==="y"?PU():$U(),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=>pg(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),dg(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 Zc(i,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:o,pixelSize:r})}init(t,n){let{brush:r,channel:i,style:o}=this;this.scale=t.scale(i);let s=t.scale("x").range,a=t.scale("y").range;r.extent([[fe(s),fe(a)],[Jt(s),Jt(a)]]);let c=this.value?.map(this.scale.apply).sort(Ot),l=Yt(t).selectAll('g[aria-label="facet"]');if(n=l.size()?l:Yt(n??t),this.g=n.append("g").attr("class",`interval-${i}`).each(i_).call(r).call(r.moveSilent,c),o){let u=this.g.selectAll("rect.selection");for(let f in o)u.attr(f,o[f])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var mg=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||rs(t,"x"),this.yfield=i||rs(t,"y"),this.style=a&&Ah(a),this.brush=FU(),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=>pg(u,i,r)).sort(Ot),a=[c[1],l[1]].map(u=>pg(u,o,r)).sort(Ot)}(!dg(s,n?.[0])||!dg(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 lI([i,o],t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}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([[fe(s),fe(a)],[Jt(s),Jt(a)]]);let c=Yt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Yt(t);if(this.g=l.append("g").attr("class","interval-xy").each(i_).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(Ot),[h,d]=this.value[1].map(o.apply).sort(Ot);this.g.call(n.moveSilent,[[u,h],[f,d]])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var Hl=class{constructor(t,{selection:n,pointer:r,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.pointer=r,this.channels=i||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>rs(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:n,fields:r}=this;return dp(r,t&&[t],{source:this,clients:n})}init(t){let n=this,{mark:r,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=r,c=i.map(x=>r.channelField(x).as),l=!Fr(o),u=Yt(t).selectAll('g[aria-label="facet"]'),f=u.size()?u:Yt(t),h=t.scale("x").apply,d=t.scale("y").apply,p=Array.from(a[r.channelField("x").as],h),m=Array.from(a[r.channelField("y").as],d),y=this.pointer==="y"?.01:1,g=this.pointer==="x"?.01:1;f.on("pointerenter pointerdown pointermove",function(x){let[b,w]=Fn(x,this),_=wrt(p,m,b,w,y,g,s);if(_!==this.valueIndex){this.valueIndex=_;let v=_<0?void 0:c.map(I=>a[I][_]);l?_>-1&&o.update(v.length>1?v:v[0]):o.update(n.clause(v))}}),!l&&(f.on("pointerleave",()=>{o.update(n.clause(void 0))}),t.addEventListener("pointerenter",x=>{if(!x.buttons){let b=this.channels.map(()=>0);o.activate(this.clause(b))}}))}};function wrt(e,t,n,r,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-n),f=o*(t[l]-r),h=u*u+f*f;h<=a&&(a=h,c=l)}return c}var UU=(e,t)=>e-t,yg=class{constructor(t,{x:n=new As,y:r=new As,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||rs(t,"x"),this.yfield=o||rs(t,"y"),this.zoom=g6(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=vrt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=_rt(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return Zc(n,t,{source:this,clients:this.mark.plot.markSet,scale:r})}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(UU),c=this.yscale.range.slice().sort(UU),l=g6(n,[-1/0,1/0],a),u=g6(r,[-1/0,1/0],c),f=h3().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:h})=>this.publish(h));if(Yt(i).call(f),n||r){let h=!1;i.addEventListener("pointerenter",d=>{if(!h&&(h=!0,!d.buttons)){if(n){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(r){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>h=!1)}}};function g6(e,t,n){return e?Array.isArray(e)?e:t:n}function vrt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function _rt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var Zl=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i;let o=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:n,mark:r}=this;return dp(n,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(t,n,r){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;r??=l=>o.map(u=>{let f=l.__data__;return a[u][Array.isArray(f)?f[0]:f]}),n??=`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,h=null;if(Srt(c,f)){let d=r(f);(l.shiftKey||l.metaKey)&&u?.length?(h=u.filter(p=>x6(p,d)),h.length===u.length&&h.push(d)):u?.length===1&&!x6(u[0],d)?h=null:h=[d]}this.value=h,Irt(u,h)&&s.update(this.clause(h))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function Srt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function Irt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>x6(n,t[r]))}function x6(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 qU=":scope > div, :scope > span",o_="swatch",zU="ramp",Th=class{constructor(t,n){let{as:r,field:i,...o}=n;this.channel=t,this.options={label:null,...o},this.type=null,this.handler=null,this.selection=r,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let n=Mrt(this,t);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:t,handler:n}=this,{single:r,value:i}=t,o=r?i:t.valueFor(n),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(qU);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function Mrt(e,t){let{channel:n,options:r,selection:i}=e,o=t.scale(n),s=o.type==="ordinal"?o_:zU,a=s===o_?r:r.label?{tickSize:2,...r}:{tickSize:2,marginTop:1,height:29,...r},c=t.legend(n,a);e.legend=c;let l=!!i;if(l&&s===zU){let u=a.width??240,f=Drt(o,u);f?c.scale=function(h){return h==="x"?{range:[0,u]}:h==="y"?{range:[-10,0]}:h===n?f:void 0}:l=!1}if(l){let u=Art(e,s);s===o_?(u.init(c,qU,f=>[f.__data__]),e.update()):u.init(c,c.querySelector("g:last-of-type"))}return c}function Art(e,t){let{channel:n,handler:r,selection:i}=e;if(r)return r;let o=Trt(e);return t===o_?(e.handler=new Zl(o,{selection:i,channels:[n],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new vc(o,{selection:i,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function Trt(e){let{channel:t,plot:n}=e,r=e.field??Ert(n.marks,t)??"value";if(r){let i={field:r};return{plot:n,channelField:o=>t===o?i:void 0}}}function Ert(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)for(let i of n){let o=e[r].channelField(i,{exact:!0});if(o)return o.field}return null}function Drt(e,t){let{apply:n,invert:r,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return oc({x:{...o,type:a,range:[0,t]}})}var Nrt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function s_(e,t={steps:25}){let n=(r,i)=>Nrt.has(`${r.type}-${i}`)?{[`${i}1`]:b6(r,i,e,t),[`${i}2`]:b6(r,i,e,{...t,offset:1})}:{[i]:b6(r,i,e,t)};return n[pp]=!0,n}function b6(e,t,n,r){return{column:n,label:n,get stats(){return{column:n,stats:["min","max"]}},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=Wl(e,t),{min:a,max:c}=e.channelField(t),l=Ort(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,h=`${(l.max-l.min)/l.steps}::DOUBLE`,d=r.offset?`${r.offset} + `:"",p=`${l.min} + ${h} * (${d}FLOOR(${f} / ${h}))`;return`${s(p)}`}}}function Ort(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],h;for(let m=0,y=f.length;m<y;++m)h=u/f[m],h>=i&&s/h<=a&&(u=h);h=Math.log(u);let d=h>=0?0:~~(-h/c)+1,p=Math.pow(10,-d-1);h=Math.floor(e/u+p)*u,e=e<h?h-u:h,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Lrt=e=>e&&typeof e=="object"&&!Array.isArray(e);var gg=class extends hr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(n),this.from=r,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let h=document.createElement("label");if(h.innerText=o||i,this.element.appendChild(h),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(d=>Lrt(d)?d:{value:d}),this.selectedValue(c??""),this.update()),f){let d=!Fr(f);c!=null&&(!d||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),d&&this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)})}}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,field:r}=this;if(Fr(n)){t===""&&(t=void 0);let i=hp(r,t,{source:this});n.update(i)}else _r(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?dt.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,selection:i}=this;r.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??n(o),this.select.appendChild(a)}if(i){let o=Fr(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var Brt=0;var xg=class extends hr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(n),this.id="search_"+ ++Brt,this.type=s,this.from=r,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),Fr(this.selection)||this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,field:r,type:i}=this;if(Fr(n)){let o=uI(r,t,{source:this,method:i});n.update(o)}else _r(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?dt.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 Crt=0;var bg=class extends hr{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,select:f="point",field:h=c,width:d}={}){if(super(n),this.id="slider_"+ ++Crt,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=f,this.field=h,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),d!=null&&(this.slider.style.width=`${+d}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&!Fr(this.selection)&&this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)})}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:dt.select({min:ai(r),max:si(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(t){let{field:n,selectionType:r,selection:i}=this;if(Fr(i))if(r==="interval"){let o=[this.min??0,t];i.update(Zc(n,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step}))}else i.update(hp(n,t,{source:this}));else _r(this.selection)&&i.update(t)}};var v6=jU(e=>{let t=a_(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?_6(n):`${n}`}),a_=jU(e=>t=>t===0?"0":t.toLocaleString(e)),yYt=v6(),gYt=a_();function _6(e){return Ef(e,"Invalid Date")}function jU(e){let t=null,n;return(r="en")=>r===t?n:n=e(t=r)}var krt=-1;var wg=class extends hr{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-${++krt}`,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),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",h=>{let{pending:d,loaded:p}=this,{scrollHeight:m,scrollTop:y,clientHeight:g}=h.target,x=y<f;f=y,!(x||d||p)&&m-y<2*g&&(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),ci().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Aa(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=Rrt(this.format,t),this.style.innerText=Prt(this.id,Frt(this.align,t),$rt(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return dt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?W2(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],h=document.createElement("td");h.innerText=f==null?"":n[u](f),l.appendChild(h)}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 Rrt(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return a_(n);case"date":return _6;default:return v6(n)}})}function Frt(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function $rt(e={},t){return t.map(({column:n})=>e[n])}function Prt(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 vg(e,...t){let n=e?.context?.coordinator??ci();for(let r of t)n.connect(r)}function c_(e,t,n){let r=new t(n);return vg(e,r),r.element}function VU(e){return c_(this,gg,e)}function YU(e){return c_(this,xg,e)}function XU(e){return c_(this,bg,e)}function GU(e){return c_(this,wg,e)}function WU({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)),Object.assign(r,{value:{element:r}}),r}function HU(...e){return WU({direction:"vertical"},e.flat())}function ZU(...e){return WU({direction:"horizontal"},e.flat())}function JU({dim:e="width",size:t=10}){let n=document.createElement("span");return n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(n,{value:{element:n}})}function QU(e){return JU({dim:"height",size:e})}function KU(e){return JU({dim:"width",size:e})}var l_={};Tr(l_,{align:()=>F6,aspectRatio:()=>$6,axis:()=>P6,colorBase:()=>AE,colorClamp:()=>pE,colorConstant:()=>EE,colorDomain:()=>hE,colorExponent:()=>TE,colorInterpolate:()=>xE,colorLabel:()=>vE,colorN:()=>mE,colorNice:()=>yE,colorPercent:()=>_E,colorPivot:()=>bE,colorRange:()=>dE,colorReverse:()=>SE,colorScale:()=>fE,colorScheme:()=>gE,colorSymmetric:()=>wE,colorTickFormat:()=>ME,colorZero:()=>IE,facetGrid:()=>f8,facetLabel:()=>h8,facetMargin:()=>s8,facetMarginBottom:()=>c8,facetMarginLeft:()=>l8,facetMarginRight:()=>u8,facetMarginTop:()=>a8,fxAlign:()=>b8,fxAriaDescription:()=>F8,fxAriaLabel:()=>R8,fxAxis:()=>S8,fxDomain:()=>d8,fxFontVariant:()=>k8,fxGrid:()=>N8,fxInset:()=>m8,fxInsetLeft:()=>y8,fxInsetRight:()=>g8,fxLabel:()=>L8,fxLabelAnchor:()=>B8,fxLabelOffset:()=>C8,fxLine:()=>O8,fxPadding:()=>w8,fxPaddingInner:()=>v8,fxPaddingOuter:()=>_8,fxRange:()=>p8,fxReverse:()=>$8,fxRound:()=>x8,fxTickFormat:()=>E8,fxTickPadding:()=>T8,fxTickRotate:()=>D8,fxTickSize:()=>M8,fxTickSpacing:()=>A8,fxTicks:()=>I8,fyAlign:()=>Y8,fyAriaDescription:()=>lE,fyAriaLabel:()=>cE,fyAxis:()=>H8,fyDomain:()=>P8,fyFontVariant:()=>aE,fyGrid:()=>nE,fyInset:()=>z8,fyInsetBottom:()=>j8,fyInsetTop:()=>q8,fyLabel:()=>iE,fyLabelAnchor:()=>oE,fyLabelOffset:()=>sE,fyLine:()=>rE,fyPadding:()=>X8,fyPaddingInner:()=>G8,fyPaddingOuter:()=>W8,fyRange:()=>U8,fyReverse:()=>uE,fyRound:()=>V8,fyTickFormat:()=>tE,fyTickPadding:()=>K8,fyTickRotate:()=>eE,fyTickSize:()=>J8,fyTickSpacing:()=>Q8,fyTicks:()=>Z8,grid:()=>z6,height:()=>L6,inset:()=>U6,label:()=>q6,lengthBase:()=>cD,lengthClamp:()=>iD,lengthConstant:()=>uD,lengthDomain:()=>nD,lengthExponent:()=>lD,lengthNice:()=>oD,lengthPercent:()=>sD,lengthRange:()=>rD,lengthScale:()=>eD,lengthZero:()=>aD,margin:()=>E6,marginBottom:()=>R6,marginLeft:()=>B6,marginRight:()=>C6,marginTop:()=>k6,margins:()=>T6,name:()=>M6,opacityBase:()=>PE,opacityClamp:()=>LE,opacityConstant:()=>zE,opacityDomain:()=>NE,opacityExponent:()=>UE,opacityLabel:()=>CE,opacityNice:()=>BE,opacityPercent:()=>kE,opacityRange:()=>OE,opacityReverse:()=>RE,opacityScale:()=>DE,opacityTickFormat:()=>$E,opacityZero:()=>FE,padding:()=>j6,projectionClip:()=>vD,projectionDomain:()=>mD,projectionInset:()=>yD,projectionInsetBottom:()=>wD,projectionInsetLeft:()=>gD,projectionInsetRight:()=>xD,projectionInsetTop:()=>bD,projectionParallels:()=>hD,projectionPrecision:()=>dD,projectionRotate:()=>pD,projectionType:()=>fD,rBase:()=>QE,rClamp:()=>WE,rConstant:()=>tD,rDomain:()=>XE,rExponent:()=>KE,rNice:()=>HE,rPercent:()=>ZE,rRange:()=>GE,rScale:()=>YE,rZero:()=>JE,style:()=>N6,symbolDomain:()=>jE,symbolRange:()=>VE,symbolScale:()=>qE,width:()=>O6,xAlign:()=>K6,xAriaDescription:()=>x4,xAriaLabel:()=>g4,xAxis:()=>r4,xBase:()=>_4,xClamp:()=>J6,xConstant:()=>I4,xDomain:()=>Y6,xExponent:()=>S4,xFontVariant:()=>y4,xGrid:()=>u4,xInset:()=>W6,xInsetLeft:()=>H6,xInsetRight:()=>Z6,xLabel:()=>h4,xLabelAnchor:()=>d4,xLabelArrow:()=>p4,xLabelOffset:()=>m4,xLine:()=>f4,xNice:()=>G6,xPadding:()=>t4,xPaddingInner:()=>e4,xPaddingOuter:()=>n4,xPercent:()=>b4,xRange:()=>X6,xReverse:()=>w4,xRound:()=>Q6,xScale:()=>V6,xTickFormat:()=>c4,xTickPadding:()=>a4,xTickRotate:()=>l4,xTickSize:()=>o4,xTickSpacing:()=>s4,xTicks:()=>i4,xZero:()=>v4,xyDomain:()=>D6,yAlign:()=>C4,yAriaDescription:()=>K4,yAriaLabel:()=>Q4,yAxis:()=>$4,yBase:()=>r8,yClamp:()=>L4,yConstant:()=>o8,yDomain:()=>A4,yExponent:()=>i8,yFontVariant:()=>J4,yGrid:()=>Y4,yInset:()=>D4,yInsetBottom:()=>O4,yInsetTop:()=>N4,yLabel:()=>G4,yLabelAnchor:()=>W4,yLabelArrow:()=>H4,yLabelOffset:()=>Z4,yLine:()=>X4,yNice:()=>E4,yPadding:()=>k4,yPaddingInner:()=>R4,yPaddingOuter:()=>F4,yPercent:()=>t8,yRange:()=>T4,yReverse:()=>e8,yRound:()=>B4,yScale:()=>M4,yTickFormat:()=>j4,yTickPadding:()=>q4,yTickRotate:()=>V4,yTickSize:()=>U4,yTickSpacing:()=>z4,yTicks:()=>P4,yZero:()=>n8});var _g=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)}clear(){return this.waiting?.clear(),super.clear()}},S6=new _g;function I6(e,t,n){(e?.context?.namedPlots??S6).request(t,n)}function tz(e,t,n){(e?.context?.namedPlots??S6).set(t,n)}function M6(e){return t=>tz(this,e,t)}function ez(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 Urt(e,t){return n=>{ez(n,e,t)}}function A6(e){return t=>{for(let[n,r]of Object.entries(e))ez(t,n,r)}}function T6(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),A6(o)}function E6(e){return A6({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function D6(e){return A6({xDomain:e,yDomain:e})}var L=e=>t=>Urt(e,t),N6=L("style"),O6=L("width"),L6=L("height"),B6=L("marginLeft"),C6=L("marginRight"),k6=L("marginTop"),R6=L("marginBottom"),F6=L("align"),$6=L("aspectRatio"),P6=L("axis"),U6=L("inset"),z6=L("grid"),q6=L("label"),j6=L("padding"),V6=L("xScale"),Y6=L("xDomain"),X6=L("xRange"),G6=L("xNice"),W6=L("xInset"),H6=L("xInsetLeft"),Z6=L("xInsetRight"),J6=L("xClamp"),Q6=L("xRound"),K6=L("xAlign"),t4=L("xPadding"),e4=L("xPaddingInner"),n4=L("xPaddingOuter"),r4=L("xAxis"),i4=L("xTicks"),o4=L("xTickSize"),s4=L("xTickSpacing"),a4=L("xTickPadding"),c4=L("xTickFormat"),l4=L("xTickRotate"),u4=L("xGrid"),f4=L("xLine"),h4=L("xLabel"),d4=L("xLabelAnchor"),p4=L("xLabelArrow"),m4=L("xLabelOffset"),y4=L("xFontVariant"),g4=L("xAriaLabel"),x4=L("xAriaDescription"),b4=L("xPercent"),w4=L("xReverse"),v4=L("xZero"),_4=L("xBase"),S4=L("xExponent"),I4=L("xConstant"),M4=L("yScale"),A4=L("yDomain"),T4=L("yRange"),E4=L("yNice"),D4=L("yInset"),N4=L("yInsetTop"),O4=L("yInsetBottom"),L4=L("yClamp"),B4=L("yRound"),C4=L("yAlign"),k4=L("yPadding"),R4=L("yPaddingInner"),F4=L("yPaddingOuter"),$4=L("yAxis"),P4=L("yTicks"),U4=L("yTickSize"),z4=L("yTickSpacing"),q4=L("yTickPadding"),j4=L("yTickFormat"),V4=L("yTickRotate"),Y4=L("yGrid"),X4=L("yLine"),G4=L("yLabel"),W4=L("yLabelAnchor"),H4=L("yLabelArrow"),Z4=L("yLabelOffset"),J4=L("yFontVariant"),Q4=L("yAriaLabel"),K4=L("yAriaDescription"),t8=L("yPercent"),e8=L("yReverse"),n8=L("yZero"),r8=L("yBase"),i8=L("yExponent"),o8=L("yConstant"),s8=L("facetMargin"),a8=L("facetMarginTop"),c8=L("facetMarginBottom"),l8=L("facetMarginLeft"),u8=L("facetMarginRight"),f8=L("facetGrid"),h8=L("facetLabel"),d8=L("fxDomain"),p8=L("fxRange"),m8=L("fxInset"),y8=L("fxInsetLeft"),g8=L("fxInsetRight"),x8=L("fxRound"),b8=L("fxAlign"),w8=L("fxPadding"),v8=L("fxPaddingInner"),_8=L("fxPaddingOuter"),S8=L("fxAxis"),I8=L("fxTicks"),M8=L("fxTickSize"),A8=L("fxTickSpacing"),T8=L("fxTickPadding"),E8=L("fxTickFormat"),D8=L("fxTickRotate"),N8=L("fxGrid"),O8=L("fxLine"),L8=L("fxLabel"),B8=L("fxLabelAnchor"),C8=L("fxLabelOffset"),k8=L("fxFontVariant"),R8=L("fxAriaLabel"),F8=L("fxAriaDescription"),$8=L("fxReverse"),P8=L("fyDomain"),U8=L("fyRange"),z8=L("fyInset"),q8=L("fyInsetTop"),j8=L("fyInsetBottom"),V8=L("fyRound"),Y8=L("fyAlign"),X8=L("fyPadding"),G8=L("fyPaddingInner"),W8=L("fyPaddingOuter"),H8=L("fyAxis"),Z8=L("fyTicks"),J8=L("fyTickSize"),Q8=L("fyTickSpacing"),K8=L("fyTickPadding"),tE=L("fyTickFormat"),eE=L("fyTickRotate"),nE=L("fyGrid"),rE=L("fyLine"),iE=L("fyLabel"),oE=L("fyLabelAnchor"),sE=L("fyLabelOffset"),aE=L("fyFontVariant"),cE=L("fyAriaLabel"),lE=L("fyAriaDescription"),uE=L("fyReverse"),fE=L("colorScale"),hE=L("colorDomain"),dE=L("colorRange"),pE=L("colorClamp"),mE=L("colorN"),yE=L("colorNice"),gE=L("colorScheme"),xE=L("colorInterpolate"),bE=L("colorPivot"),wE=L("colorSymmetric"),vE=L("colorLabel"),_E=L("colorPercent"),SE=L("colorReverse"),IE=L("colorZero"),ME=L("colorTickFormat"),AE=L("colorBase"),TE=L("colorExponent"),EE=L("colorConstant"),DE=L("opacityScale"),NE=L("opacityDomain"),OE=L("opacityRange"),LE=L("opacityClamp"),BE=L("opacityNice"),CE=L("opacityLabel"),kE=L("opacityPercent"),RE=L("opacityReverse"),FE=L("opacityZero"),$E=L("opacityTickFormat"),PE=L("opacityBase"),UE=L("opacityExponent"),zE=L("opacityConstant"),qE=L("symbolScale"),jE=L("symbolDomain"),VE=L("symbolRange"),YE=L("rScale"),XE=L("rDomain"),GE=L("rRange"),WE=L("rClamp"),HE=L("rNice"),ZE=L("rPercent"),JE=L("rZero"),QE=L("rBase"),KE=L("rExponent"),tD=L("rConstant"),eD=L("lengthScale"),nD=L("lengthDomain"),rD=L("lengthRange"),iD=L("lengthClamp"),oD=L("lengthNice"),sD=L("lengthPercent"),aD=L("lengthZero"),cD=L("lengthBase"),lD=L("lengthExponent"),uD=L("lengthConstant"),fD=L("projectionType"),hD=L("projectionParallels"),dD=L("projectionPrecision"),pD=L("projectionRotate"),mD=L("projectionDomain"),yD=L("projectionInset"),gD=L("projectionInsetLeft"),xD=L("projectionInsetRight"),bD=L("projectionInsetTop"),wD=L("projectionInsetBottom"),vD=L("projectionClip");function nz(e,t){return{table:e,options:t}}var f_={};Tr(f_,{area:()=>_D,areaX:()=>SD,areaY:()=>ID,arrow:()=>gN,axisFx:()=>_N,axisFy:()=>SN,axisX:()=>wN,axisY:()=>vN,barX:()=>ED,barY:()=>DD,cell:()=>ND,cellX:()=>OD,cellY:()=>LD,circle:()=>PD,contour:()=>rN,delaunayLink:()=>pN,delaunayMesh:()=>mN,denseLine:()=>nN,density:()=>eN,densityX:()=>KD,densityY:()=>tN,dot:()=>RD,dotX:()=>FD,dotY:()=>$D,errorbarX:()=>uN,errorbarY:()=>fN,frame:()=>bN,geo:()=>EN,graticule:()=>NN,gridFx:()=>AN,gridFy:()=>TN,gridX:()=>IN,gridY:()=>MN,heatmap:()=>iN,hexagon:()=>UD,hexbin:()=>aN,hexgrid:()=>cN,hull:()=>yN,image:()=>QD,line:()=>MD,lineX:()=>AD,lineY:()=>TD,link:()=>xN,raster:()=>oN,rasterTile:()=>sN,rect:()=>BD,rectX:()=>CD,rectY:()=>kD,regressionY:()=>lN,ruleX:()=>VD,ruleY:()=>YD,sphere:()=>DN,spike:()=>JD,text:()=>zD,textX:()=>qD,textY:()=>jD,tickX:()=>XD,tickY:()=>GD,vector:()=>WD,vectorX:()=>HD,vectorY:()=>ZD,voronoi:()=>hN,voronoiMesh:()=>dN});var zrt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function At(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=zrt.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?tg:ln;return u_(r,e,t,n)}function u_(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function is(e,t,n){return r=>{r.addMark(new e(t,n))}}var _D=(...e)=>At("area",...e),SD=(...e)=>At("areaX",...e),ID=(...e)=>At("areaY",...e),MD=(...e)=>At("line",...e),AD=(...e)=>At("lineX",...e),TD=(...e)=>At("lineY",...e),ED=(...e)=>At("barX",...e),DD=(...e)=>At("barY",...e),ND=(...e)=>At("cell",...e),OD=(...e)=>At("cellX",...e),LD=(...e)=>At("cellY",...e),BD=(...e)=>At("rect",...e),CD=(...e)=>At("rectX",...e),kD=(...e)=>At("rectY",...e),RD=(...e)=>At("dot",...e),FD=(...e)=>At("dotX",...e),$D=(...e)=>At("dotY",...e),PD=(...e)=>At("circle",...e),UD=(...e)=>At("hexagon",...e),zD=(...e)=>At("text",...e),qD=(...e)=>At("textX",...e),jD=(...e)=>At("textY",...e),VD=(...e)=>At("ruleX",...e),YD=(...e)=>At("ruleY",...e),XD=(...e)=>At("tickX",...e),GD=(...e)=>At("tickY",...e),WD=(...e)=>At("vector",...e),HD=(...e)=>At("vectoX",...e),ZD=(...e)=>At("vectorY",...e),JD=(...e)=>At("spike",...e),QD=(...e)=>At("image",...e),KD=(...e)=>u_(Sh,"areaX",...e),tN=(...e)=>u_(Sh,"areaY",...e),eN=(...e)=>is(ag,...e),nN=(...e)=>is(sg,...e),rN=(...e)=>is(rg,...e),iN=(...e)=>is(og,...e),oN=(...e)=>is(wc,...e),sN=(...e)=>is(ug,...e),aN=(...e)=>is(lg,...e),cN=(...e)=>At("hexgrid",...e),lN=(...e)=>is(fg,...e),uN=(...e)=>u_(Mh,"ruleY",...e),fN=(...e)=>is(Mh,"ruleX",...e),hN=(...e)=>At("voronoi",...e),dN=(...e)=>At("voronoiMesh",...e),pN=(...e)=>At("delaunayLink",...e),mN=(...e)=>At("delaunayMesh",...e),yN=(...e)=>At("hull",...e),gN=(...e)=>At("arrow",...e),xN=(...e)=>At("link",...e),bN=(...e)=>At("frame",...e),wN=(...e)=>At("axisX",...e),vN=(...e)=>At("axisY",...e),_N=(...e)=>At("axisFx",...e),SN=(...e)=>At("axisFy",...e),IN=(...e)=>At("gridX",...e),MN=(...e)=>At("gridY",...e),AN=(...e)=>At("gridFx",...e),TN=(...e)=>At("gridFy",...e),EN=(...e)=>is(cg,...e),DN=(...e)=>At("sphere",...e),NN=(...e)=>At("graticule",...e);var h_={};Tr(h_,{highlight:()=>ON,intervalX:()=>PN,intervalXY:()=>zN,intervalY:()=>UN,nearest:()=>RN,nearestX:()=>FN,nearestY:()=>$N,pan:()=>qN,panX:()=>jN,panY:()=>VN,panZoom:()=>YN,panZoomX:()=>XN,panZoomY:()=>GN,toggle:()=>Jl,toggleColor:()=>kN,toggleX:()=>LN,toggleY:()=>BN,toggleZ:()=>CN});function ha(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function ON({by:e,...t}){return ha(hg,{selection:e,channels:t})}function Jl({as:e,...t}){return ha(Zl,{...t,selection:e})}function LN(e){return Jl({...e,channels:["x"]})}function BN(e){return Jl({...e,channels:["y"]})}function CN(e){return Jl({...e,channels:["z"]})}function kN(e){return Jl({...e,channels:["color"]})}function RN({as:e,...t}){return ha(Hl,{...t,selection:e,pointer:"xy"})}function FN({as:e,...t}){return ha(Hl,{...t,selection:e,pointer:"x"})}function $N({as:e,...t}){return ha(Hl,{...t,selection:e,pointer:"y"})}function PN({as:e,...t}){return ha(vc,{...t,selection:e,channel:"x"})}function UN({as:e,...t}){return ha(vc,{...t,selection:e,channel:"y"})}function zN({as:e,...t}){return ha(mg,{...t,selection:e})}function Eh(e){return ha(yg,e)}function qN(e={}){return Eh({...e,zoom:!1})}function jN(e={}){return Eh({...e,zoom:!1,pany:!1})}function VN(e={}){return Eh({...e,zoom:!1,panx:!1})}function YN(e={}){return Eh(e)}function XN(e={}){return Eh({...e,pany:!1})}function GN(e={}){return Eh({...e,panx:!1})}var d_={};Tr(d_,{colorLegend:()=>HN,opacityLegend:()=>ZN,symbolLegend:()=>JN});function WN(e,t={}){if(t.for){let{for:n,...r}=t,i=new Th(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?I6(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new Th(e,t))}function HN(e){return WN.call(this,"color",e)}function ZN(e){return WN.call(this,"opacity",e)}function JN(e){return WN.call(this,"symbol",e)}function rz(...e){let t=new Qy;return e.flat().forEach(n=>n(t)),vg(this,...t.marks),t.update(),t.element}function KN({coordinator:e=ci(),namedPlots:t=new _g,extensions:n=null,...r}={}){return{...QN,...n,context:{coordinator:e,namedPlots:t,...r}}}var iz="spec",p_="literal",xXt="dataref",oz="options",sz="selection",az="paramref",cz="param",tO="select",m_="value",lz="crossfilter",y_="intersect",uz="union",fz="single",hz="data",dz="expression",_c="sql",da="agg",Sg="input",Dh="hconcat",Nh="vconcat",Oh="hspace",Lh="vspace",g_="mark",eO="from",Bh="plot",Ig="legend",pz="attribute",mz="transform",yz="interactor",Mg="Fixed";var Pt=class{constructor(t,n=null){this.type=t,this.children=n}instantiate(t){throw Error("instantiate not implemented")}codegen(t){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var Ag=class extends Pt{constructor(t,n,r,i,o,s){super(iz,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=o,this.plotDefaults=s}toJSON(){let{root:t,meta:n,config:r,plotDefaults:i}=this,o=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),o?.size){let c=a.data={};for(let[l,u]of o)c[l]=u.toJSON()}if(s?.size){let c=a.params={};for(let[l,u]of s)c[l]=u.toJSON()}if(i?.length){let c=a.plotDefaults={};for(let l of i)Object.assign(c,l.toJSON())}return Object.assign(a,t.toJSON())}};function gz(e){let t=typeof e;return t==="object"?e?.param:t==="string"?qrt(e):null}function qrt(e){return e?.[0]==="$"?e.slice(1):null}function Tg(e){return`$${e}`}function x_(e){return[e].flat()}function Si(e){return Array.isArray(e)}function Ch(e){return e!==null&&typeof e=="object"&&!Si(e)}function Sc(e){return typeof e=="string"}function kh(e,t){throw Object.assign(Error(e),{data:t})}var jrt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function xz(e,t){return jrt.test(e+="")?new Date(e):t}function Mr(e,t){let n={};for(let r in e)n[r]=t.maybeSelection(e[r]);return new Rh(n)}var Rh=class e extends Pt{constructor(t){super(oz),this.options=t}filter(t){let n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new e(n)}instantiate(t){let{options:n}=this,r={};for(let i in n)r[i]=n[i].instantiate(t);return r}codegen(t){let{options:n}=this,r=[];for(let i in n)r.push(`${i}: ${n[i].codegen(t)}`);return r.length?`{${t.maybeLineWrap(r)}}`:""}toJSON(){let{options:t}=this,n={};for(let r in t)n[r]=t[r].toJSON();return n}};var vz="table",_z="parquet",Sz="csv",nO="json",A_="spatial",bz=new Map([[vz,Grt],[_z,Wrt],[Sz,Hrt],[nO,Zrt],[A_,Jrt]]);function Iz(e,t,n){let r=Vrt(t);if(bz.has(r.type))return bz.get(r.type)(e,r,n);n.error("Unrecognized data format type.",t)}function Vrt(e){return Si(e)&&(e={type:"json",data:e}),Sc(e)&&(e={type:"table",query:e}),{...e,type:Yrt(e)}}function Yrt(e){return e.type||Xrt(e.file)||"table"}function Xrt(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function Grt(e,t,n){let{query:r,type:i,...o}=t;return new w_(e,r,Mr(o,n))}function Wrt(e,t,n){let{file:r,type:i,...o}=t;return new __(e,r,Mr(o,n))}function Hrt(e,t,n){let{file:r,type:i,...o}=t;return new S_(e,r,Mr(o,n))}function Zrt(e,t,n){let{data:r,file:i,type:o,...s}=t,a=Mr(s,n);return r?new M_(e,r,a):new I_(e,i,a)}function Jrt(e,t,n){let{file:r,type:i,...o}=t;return new v_(e,r,Mr(o,n))}function wz(e,t){return t?new URL(e,t).toString():e}function Qrt(e,t){let n=e?.codegen(t);return n?`, ${n}`:""}var b_=class extends Pt{constructor(t,n){super(hz),this.name=t,this.format=n}},Fh=class extends b_{constructor(t,n){super(t,n)}instantiateQuery(t){t.error("instantiateQuery not implemented")}codegenQuery(t){t.error("codegenQuery not implemented")}instantiate(t){let n=this.instantiateQuery(t);if(n)return n}codegen(t){let n=this.codegenQuery(t);if(n)return n}},w_=class extends Fh{constructor(t,n,r){super(t,vz),this.query=n?.trim(),this.options=r}instantiateQuery(t){let{name:n,query:r,options:i}=this;if(r)return t.api.create(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,query:r,options:i}=this;if(r)return`\`${vo(n,r,i.instantiate(t))}\``}toJSON(){let{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}},Ql=class extends Fh{constructor(t,n,r,i,o){super(t,n),this.file=i,this.method=r,this.options=o}instantiateQuery(t){let{name:n,method:r,file:i,options:o}=this,s=wz(i,t.baseURL),a=o?.instantiate(t);return t.api[r](n,s,a)}codegenQuery(t){let{name:n,method:r,file:i,options:o}=this,s=wz(i,t.baseURL),a=Qrt(o,t);return`${t.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}},v_=class extends Ql{constructor(t,n,r){super(t,A_,"loadSpatial",n,r)}},__=class extends Ql{constructor(t,n,r){super(t,_z,"loadParquet",n,r)}},S_=class extends Ql{constructor(t,n,r){super(t,Sz,"loadCSV",n,r)}},I_=class extends Ql{constructor(t,n,r){super(t,nO,"loadJSON",n,r)}},M_=class extends Fh{constructor(t,n,r){super(t,nO),this.data=n,this.options=r}instantiateQuery(t){let{name:n,data:r,options:i}=this;return t.api.loadObjects(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,data:r,options:i}=this,o=i?","+i.codegen(t):"",s=`[
|
|
60
|
+
}`)).call(Tf,n);for(let L of f){let{channels:P,values:F,facets:q}=m.get(L);if(h===void 0||L.facet==="super"){let W=null;if(q&&(W=q[0],W=L.filter(W,P,F),W.length===0))continue;let tt=L.render(W,x,F,v,A);if(tt==null)continue;T.appendChild(tt)}else{let W;for(let tt of h){if(!(L.facetAnchor?.(h,k,tt)??!tt.empty))continue;let nt=null;if(q){let X=u.has(L);if(nt=q[X?tt.i:0],nt=L.filter(nt,P,F),nt.length===0)continue;!X&&nt===q[0]&&(nt=ai(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let ot=L.render(nt,x,F,_,A);if(ot!=null){(W??=St(T).append("g")).append(()=>ot).datum(tt);for(let X of["aria-label","aria-description","aria-hidden","transform"])ot.hasAttribute(X)&&(W.attr(X,ot.getAttribute(X)),ot.removeAttribute(X))}}W?.selectChildren().attr("transform",R)}}let C=kN(g,A,t),{figure:N=r!=null||o!=null||i!=null||C.length>0}=t;N&&($=E.createElement("figure"),$.className=`${c}-figure`,$.style.maxWidth="initial",r!=null&&$.append(GN(E,r,"h2")),o!=null&&$.append(GN(E,o,"h3")),$.append(...C,T),i!=null&&$.append(wV(E,i)),"value"in T&&($.value=T.value,delete T.value)),$.scale=xk(x.scales),$.legend=$N(g,A,t);let D=HC();return D>0&&St(T).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(`${D.toLocaleString("en-US")} warning${D===1?"":"s"}. Please check the console.`),$}function GN(t,e,n){if(e.ownerDocument)return e;let r=t.createElement(n);return r.append(e),r}function wV(t,e){let n=t.createElement("figcaption");return n.append(e),n}function VN(t){return t.flat(1/0).filter(e=>e!=null).map(vV)}function vV(t){return typeof t.render=="function"?t:new w3(t)}var w3=class extends pt{constructor(e){if(typeof e!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=e}render(){}};function v3(t,e){for(let n in t)QN(t[n],e);return t}function QN(t,e){let{scale:n,transform:r=!0}=t;if(n==null||!r)return;let{type:o,percent:i,interval:s,transform:a=i?c=>c==null?NaN:c*100:h6(s,o)}=e[n]??{};a!=null&&(t.value=Et(t.value,a),t.transform=!1)}function _V(t){for(let e in t)C6(e,t[e])}function td(t,e,n,r=tC){for(let{channels:o}of e.values())for(let i in o){let s=o[i],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!$k(n)){let c=n.x?.domain===void 0,f=n.y?.domain===void 0;if(c||f){let[l,u]=kk(s);c&&b3(t,"x",l),f&&b3(t,"y",u)}}}else b3(t,a,s)}return t}function b3(t,e,n){let r=t.get(e);r!==void 0?r.push(n):t.set(e,[n])}function SV(t,e){if(t==null)return;let{x:n,y:r}=t;if(n==null&&r==null)return;let o=ii(t.data);if(o==null)throw new Error("missing facet data");let i={};n!=null&&(i.fx=bf(o,{value:n,scale:"fx"})),r!=null&&(i.fy=bf(o,{value:r,scale:"fy"})),v3(i,e);let s=rx(o,i);return{channels:i,groups:s,data:t.data}}function WN(t,e,n){if(t.facet===null||t.facet==="super")return;let{fx:r,fy:o}=t;if(r!=null||o!=null){let c=ii(t.data??r??o);if(c===void 0)throw new Error(`missing facet data in ${t.ariaLabel}`);if(c===null)return;let f={};return r!=null&&(f.fx=bf(c,{value:r,scale:"fx"})),o!=null&&(f.fy=bf(c,{value:o,scale:"fy"})),v3(f,n),{channels:f,groups:rx(c,f)}}if(e===void 0)return;let{channels:i,groups:s,data:a}=e;if(t.facet!=="auto"||t.data===a)return{channels:i,groups:s};a.length>0&&(s.size>1||s.size===1&&i.fx&&i.fy&&[...s][0][1].size>1)&&ts(ii(t.data))===ts(a)&&rn(`Warning: the ${t.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 MV(t,e={}){return Vt({...e,x:null,y:null},(n,r,o,i,s,a)=>a.getMarkState(t))}function AV(t){let e=[];for(let n of t){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:o,preferredAnchor:i}=r;o=/^x$/i.test(o)?us:/^y$/i.test(o)?mi:ls,r=o(MV(n,r)),r.title=null,i===void 0&&(r.preferredAnchor=o===mi?"left":"bottom");let s=Ox(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,e.push(s)}}return e}function TV(t,e,n){let{projection:r,x:o={},y:i={},fx:s={},fy:a={},axis:c,grid:f,facet:l={},facet:{axis:u=c,grid:p}=l,x:{axis:d=c,grid:h=d===null?null:f}=o,y:{axis:m=c,grid:g=m===null?null:f}=i,fx:{axis:y=u,grid:x=y===null?null:p}=s,fy:{axis:b=u,grid:w=b===null?null:p}=a}=n;(r||!so(o)&&!HN("x",t))&&(d=h=null),(r||!so(i)&&!HN("y",t))&&(m=g=null),e.has("fx")||(y=x=null),e.has("fy")||(b=w=null),d===void 0&&(d=!Dx(t,"x")),m===void 0&&(m=!Dx(t,"y")),y===void 0&&(y=!Dx(t,"fx")),b===void 0&&(b=!Dx(t,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),y===!0&&(y=d==="top"||d===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return Lx(_,w,Mx,a),Rx(_,b,vx,"right","left",l,a),Lx(_,x,Tx,s),Rx(_,y,_x,"top","bottom",l,s),Lx(_,g,Sx,i),Rx(_,m,Xp,"left","right",n,i),Lx(_,h,Ax,o),Rx(_,d,Gp,"bottom","top",n,o),_}function Rx(t,e,n,r,o,i,s){if(!e)return;let a=EV(e);s=IV(a?r:e,i,s);let{line:c}=s;(n===Xp||n===Gp)&&c&&!fi(c)&&t.push(Df($V(s))),t.push(n(s)),a&&t.push(n({...s,anchor:o,label:null}))}function Lx(t,e,n,r){!e||fi(e)||t.push(n(CV(e,r)))}function EV(t){return/^\s*both\s*$/i.test(t)}function IV(t,e,{line:n=e.line,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:l,ariaDescription:u,label:p=e.label,labelAnchor:d,labelArrow:h=e.labelArrow,labelOffset:m}){return{anchor:t,line:n,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:l,ariaDescription:u,label:p,labelAnchor:d,labelArrow:h,labelOffset:m}}function $V(t){let{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:n===!0?void 0:n}}function CV(t,{stroke:e=ns(t)?t:void 0,ticks:n=kV(t)?t:void 0,tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}function kV(t){switch(typeof t){case"number":return!0;case"string":return!ns(t)}return vn(t)||typeof t?.range=="function"}function Dx(t,e){let n=`${e}-axis `;return t.some(r=>r.ariaLabel?.startsWith(n))}function HN(t,e){for(let n of e)for(let r in n.channels){let{scale:o}=n.channels[r];if(o===t||o==="projection")return!0}return!1}function NV(t,e){for(let n in t){let r=t[n],o=e[n];r.label===void 0&&o&&(r.label=o.label)}return t}function OV({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=tx(n),f=t&&ZN(t),l=e&&ZN(e);return{marginTop:e?l[0]:r,marginRight:t?a-f[1]:o,marginBottom:e?c-l[1]:i,marginLeft:t?f[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function ZN(t){let e=t.domain();if(e.length===0)return[0,t.bandwidth()];let n=t(e[0]),r=t(e[e.length-1]);return r<n&&([n,r]=[r,n]),[n,r+t.bandwidth()]}var RV=new Map([["basis",N_],["basis-closed",O_],["basis-open",R_],["bundle",L_],["bump-x",E_],["bump-y",I_],["cardinal",D_],["cardinal-closed",P_],["cardinal-open",F_],["catmull-rom",q_],["catmull-rom-closed",B_],["catmull-rom-open",z_],["linear",ei],["linear-closed",Y_],["monotone-x",j_],["monotone-y",X_],["natural",G_],["step",V_],["step-after",H_],["step-before",W_]]);function ed(t=ei,e){if(typeof t=="function")return t;let n=RV.get(`${t}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${t}`);if(e!==void 0){if("beta"in n)return n.beta(e);if("tension"in n)return n.tension(e);if("alpha"in n)return n.alpha(e)}return n}function Px(t=ys,e){return typeof t!="function"&&`${t}`.toLowerCase()==="auto"?ys:ed(t,e)}function ys(t){return ei(t)}function yo(t={y:"count"},e={}){[t,e]=S3(t,e);let{x:n,y:r}=e;return _3(Fx(n,e,V),null,null,r,t,ka(e))}function xo(t={x:"count"},e={}){[t,e]=S3(t,e);let{x:n,y:r}=e;return _3(null,Fx(r,e,V),n,null,t,Na(e))}function yi(t={fill:"count"},e={}){[t,e]=S3(t,e);let{x:n,y:r}=LV(e);return _3(n,r,null,null,t,ka(Na(e)))}function tO(t,e,n={}){if(n?.interval==null)return n;let{reduce:r=Wy}=n,o={filter:null};return n[e]!=null&&(o[e]=r),n[`${e}1`]!=null&&(o[`${e}1`]=r),n[`${e}2`]!=null&&(o[`${e}2`]=r),t(o,n)}function Ff(t={}){return tO(yo,"y",Er(t,"x"))}function qf(t={}){return tO(xo,"x",Er(t,"y"))}function _3(t,e,n,r,{data:o=Vy,filter:i=Op,sort:s,reverse:a,...c}={},f={}){t=JN(t),e=JN(e),c=DV(c,f),o=rO(o,V),s=s==null?void 0:eO("sort",s,f),i=i==null?void 0:nO("filter",i,f),n!=null&&uo(c,"x","x1","x2")&&(n=null),r!=null&&uo(c,"y","y1","y2")&&(r=null);let[l,u]=Ge(t),[p,d]=Ge(t),[h,m]=Ge(e),[g,y]=Ge(e),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=Ge(x),{x:v,y:A,z:E,fill:T,stroke:$,x1:M,x2:k,y1:R,y2:S,domain:I,cumulative:C,thresholds:N,interval:D,...L}=f,[P,F]=Ge(E),[q]=ee(T),[W]=ee($),[tt,nt]=Ge(q),[ot,X]=Ge(W);return{..."z"in f&&{z:P||E},..."fill"in f&&{fill:tt||T},..."stroke"in f&&{stroke:ot||$},...be(L,(rt,Y,H)=>{let et=Ta(ut(rt,x),H?.[b]),B=ut(rt,E),wt=ut(rt,q),ct=ut(rt,W),It=Dp(c,{z:B,fill:wt,stroke:ct}),kt=[],J=[],qt=et&&_([]),Nn=B&&F([]),kr=wt&&nt([]),RD=ct&&X([]),iT=t&&u([]),LD=t&&d([]),sT=e&&m([]),DD=e&&y([]),PD=qV(t,e,rt),FD=0;for(let Ka of c)Ka.initialize(rt);s&&s.initialize(rt),i&&i.initialize(rt);for(let Ka of Y){let aT=[];for(let tc of c)tc.scope("facet",Ka);s&&s.scope("facet",Ka),i&&i.scope("facet",Ka);for(let[tc,qD]of lo(Ka,It))for(let[BD,ph]of lo(qD,et))for(let[Nr,Ao]of PD(ph))if(It&&(Ao.z=tc),!(i&&!i.reduce(Nr,Ao))){aT.push(FD++),J.push(o.reduceIndex(Nr,rt,Ao)),et&&qt.push(BD),B&&Nn.push(It===B?tc:B[(Nr.length>0?Nr:ph)[0]]),wt&&kr.push(It===wt?tc:wt[(Nr.length>0?Nr:ph)[0]]),ct&&RD.push(It===ct?tc:ct[(Nr.length>0?Nr:ph)[0]]),iT&&(iT.push(Ao.x1),LD.push(Ao.x2)),sT&&(sT.push(Ao.y1),DD.push(Ao.y2));for(let zD of c)zD.reduce(Nr,Ao);s&&s.reduce(Nr,Ao)}kt.push(aT)}return E6(kt,s,a),{data:J,facets:kt}}),...!uo(c,"x")&&(l?{x1:l,x2:p,x:hf(l,p)}:{x:v,x1:M,x2:k}),...!uo(c,"y")&&(h?{y1:h,y2:g,y:hf(h,g)}:{y:A,y1:R,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:rt,output:Y})=>[rt,Y]))}}function S3({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function Fx(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return t={...dr(t)},t.domain===void 0&&(t.domain=n),t.cumulative===void 0&&(t.cumulative=e),t.thresholds===void 0&&(t.thresholds=r),t.interval===void 0&&(t.interval=o),t.value===void 0&&(t.value=i),t.thresholds=M3(t.thresholds,t.interval),t}function LV(t){let{x:e,y:n}=t;return e=Fx(e,t),n=Fx(n,t),[e.value,n.value]=ae(e.value,n.value),{x:e,y:n}}function JN(t){if(t==null)return;let{value:e,cumulative:n,domain:r=Rt,thresholds:o}=t,i=s=>{let a=ut(s,e),c;if(ne(a)||FV(o)){a=Et(a,f6,Float64Array);let[l,u]=typeof r=="function"?r(a):r,p=typeof o=="function"&&!es(o)?o(a,l,u):o;typeof p=="number"&&(p=tp(l,u,p)),es(p)&&(r===Rt&&(l=p.floor(l),u=p.offset(p.floor(u))),p=p.range(l,p.offset(u))),c=p}else{a=xe(a);let[l,u]=typeof r=="function"?r(a):r,p=typeof o=="function"&&!es(o)?o(a,l,u):o;if(typeof p=="number")if(r===Rt){let d=Po(l,u,p);if(isFinite(d))if(d>0){let h=Math.round(l/d),m=Math.round(u/d);h*d<=l||--h,m*d>u||++m;let g=m-h+1;p=new Float64Array(g);for(let y=0;y<g;++y)p[y]=(h+y)*d}else if(d<0){d=-d;let h=Math.round(l*d),m=Math.round(u*d);h/d<=l||--h,m/d>u||++m;let g=m-h+1;p=new Float64Array(g);for(let y=0;y<g;++y)p[y]=(h+y)/d}else p=[l];else p=[l]}else p=Ye(l,u,p);else es(p)&&(r===Rt&&(l=p.floor(l),u=p.offset(p.floor(u))),p=p.range(l,p.offset(u)));c=p}let f=[];if(c.length===1)f.push([c[0],c[0]]);else for(let l=1;l<c.length;++l)f.push([c[l-1],c[l]]);return f.bin=(n<0?zV:n>0?BV:A3)(f,c,a),f};return i.label=Ve(e),i}function M3(t,e,n=KN){if(t===void 0)return e===void 0?n:co(e);if(typeof t=="string"){switch(t.toLowerCase()){case"freedman-diaconis":return $m;case"scott":return Hl;case"sturges":return Ni;case"auto":return KN}return Ma(t)}return t}function DV(t,e){return A6(t,e,eO)}function eO(t,e,n){return Xy(t,e,n,nO)}function nO(t,e,n){return Gy(t,e,n,rO)}function rO(t,e){return xf(t,e,PV)}function PV(t){switch(`${t}`.toLowerCase()){case"x":return YV;case"x1":return jV;case"x2":return XV;case"y":return UV;case"y1":return GV;case"y2":return VV;case"z":return I6}throw new Error(`invalid bin reduce: ${t}`)}function KN(t,e,n){return Math.min(200,Hl(t,e,n))}function FV(t){return rC(t)||vn(t)&&ne(t)}function qV(t,e,n){let r=t?.(n),o=e?.(n);return r&&o?function*(i){let s=r.bin(i);for(let[a,[c,f]]of r.entries()){let l=o.bin(s[a]);for(let[u,[p,d]]of o.entries())yield[l[u],{data:n,x1:c,y1:p,x2:f,y2:d}]}}:r?function*(i){let s=r.bin(i);for(let[a,[c,f]]of r.entries())yield[s[a],{data:n,x1:c,x2:f}]}:function*(i){let s=o.bin(i);for(let[a,[c,f]]of o.entries())yield[s[a],{data:n,y1:c,y2:f}]}}function A3(t,e,n){return e=xe(e),r=>{let o=t.map(()=>[]);for(let i of r)o[Lo(e,n[i])-1]?.push(i);return o}}function BV(t,e,n){let r=A3(t,e,n);return o=>{let i=r(o);for(let s=1,a=i.length;s<a;++s){let c=i[s-1],f=i[s];for(let l of c)f.push(l)}return i}}function zV(t,e,n){let r=A3(t,e,n);return o=>{let i=r(o);for(let s=i.length-2;s>=0;--s){let a=i[s+1],c=i[s];for(let f of a)c.push(f)}return i}}function oO(t,e){let n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}var YV={reduceIndex(t,e,{x1:n,x2:r}){return oO(n,r)}},UV={reduceIndex(t,e,{y1:n,y2:r}){return oO(n,r)}},jV={reduceIndex(t,e,{x1:n}){return n}},XV={reduceIndex(t,e,{x2:n}){return n}},GV={reduceIndex(t,e,{y1:n}){return n}},VV={reduceIndex(t,e,{y2:n}){return n}};var WV={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fa=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,z:a,curve:c,tension:f}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:nn(n),optional:!0}},n,WV),this.z=a,this.curve=ed(c,f)}filter(e){return e}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n,0,0).call(l=>l.selectAll().data(fx(e,[s,a,c,f],this,r)).enter().append("path").call(dt,this).call(Ca,this,r).attr("d",ef().curve(this.curve).defined(u=>u>=0).x0(u=>s[u]).y0(u=>a[u]).x1(u=>c[u]).y1(u=>f[u]))).node()}};function nd(t,e){return e===void 0?xi(t,{x:Aa,y:Ji}):new Fa(t,e)}function xs(t,e){let{y:n=Xt,...r}=qf(e);return new Fa(t,ms(ds({...r,y1:n,y2:void 0})))}function xi(t,e){let{x:n=Xt,...r}=Ff(e);return new Fa(t,gs(hs({...r,x1:n,x2:void 0})))}var HV={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},rd=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,curve:a,tension:c}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,HV),this.curve=Px(a,c),Ir(this,n)}project(e,n,r){this.curve!==ys&&super.project(e,n,r)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r,{curve:l}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(u=>u.selectAll().data(e).enter().append("path").call(dt,this).attr("d",l===ys&&i.projection?ZV(i.projection,s,a,c,f):p=>{let d=hn(),h=l(d);return h.lineStart(),h.point(s[p],a[p]),h.point(c[p],f[p]),h.lineEnd(),d}).call(Tt,this,r).call(gi,this,r,i)).node()}};function ZV(t,e,n,r,o){let i=Ie(t);return e=xe(e),n=xe(n),r=xe(r),o=xe(o),s=>i({type:"LineString",coordinates:[[e[s],n[s]],[r[s],o[s]]]})}function qx(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=od(e,n,r),[i,s]=od(o,i,s),new rd(t,{...a,x1:n,x2:r,y1:i,y2:s})}function od(t,e,n){if(t===void 0){if(e===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[e]}else{if(e===void 0)return n===void 0?[t]:[t,n];if(n===void 0)return[t,e]}return[e,n]}var QV={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},id=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,bend:a=0,headAngle:c=60,headLength:f=8,inset:l=0,insetStart:u=l,insetEnd:p=l,sweep:d}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,QV),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+f,this.insetStart=+u,this.insetEnd=+p,this.sweep=JV(d)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a,SW:l}=r,{strokeWidth:u,bend:p,headAngle:d,headLength:h,insetStart:m,insetEnd:g}=this,y=l?w=>l[w]:re(u===void 0?1:u),x=d*Ef/2,b=h/1.5;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(w=>w.selectAll().data(e).enter().append("path").call(dt,this).attr("d",_=>{let v=s[_],A=a[_],E=c[_],T=f[_],$=Math.hypot(E-v,T-A);if($<=m+g)return null;let M=Math.atan2(T-A,E-v),k=Math.min(b*y(_),$/3),R=this.sweep(v,A,E,T)*p*Ef,S=Math.hypot($/Math.tan(R),$)/2;if(m||g)if(S<1e5){let tt=Math.sign(R),[nt,ot]=KV([v,A],[E,T],S,tt);if(m&&([v,A]=iO([nt,ot,S],[v,A,m],-tt*Math.sign(m))),g){let[X,rt]=iO([nt,ot,S],[E,T,g],tt*Math.sign(g));M+=Math.atan2(rt-ot,X-nt)-Math.atan2(T-ot,E-nt),E=X,T=rt}}else{let tt=E-v,nt=T-A,ot=Math.hypot(tt,nt);m&&(v+=tt/ot*m,A+=nt/ot*m),g&&(E-=tt/ot*g,T-=nt/ot*g)}let I=M+R,C=I+x,N=I-x,D=E-k*Math.cos(C),L=T-k*Math.sin(C),P=E-k*Math.cos(N),F=T-k*Math.sin(N),q=S<1e5?`A${S},${S} 0,0,${R>0?1:0} `:"L",W=k?`M${D},${L}L${E},${T}L${P},${F}`:"";return`M${v},${A}${q}${E},${T}${W}`}).call(Tt,this,r)).node()}};function JV(t=1){if(typeof t=="number")return re(Math.sign(t));if(typeof t=="function")return(e,n,r,o)=>Math.sign(t(e,n,r,o));switch(Se(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(e,n,r)=>gt(e,r);case"-x":return(e,n,r)=>an(e,r);case"+y":return(e,n,r,o)=>gt(n,o);case"-y":return(e,n,r,o)=>an(n,o)}}function KV([t,e],[n,r],o,i){let s=n-t,a=r-e,c=Math.hypot(s,a),f=i*Math.sqrt(o*o-c*c/4)/c;return[(t+n)/2-a*f,(e+r)/2+s*f]}function iO([t,e,n],[r,o,i],s){let a=r-t,c=o-e,f=Math.hypot(a,c),l=(a*a+c*c-i*i+n*n)/(2*f),u=s*Math.sqrt(n*n-l*l);return[t+(a*l+c*u)/f,e+(c*l-a*u)/f]}function sO(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=od(e,n,r),[i,s]=od(o,i,s),new id(t,{...a,x1:n,x2:r,y1:i,y2:s})}var tW={ariaLabel:"bar"},Bf=class extends pt{constructor(e,n,r={},o=tW){super(e,n,r,o),Wp(this,r),Hp(this,r)}render(e,n,r,o,i){let{rx:s,ry:a,rx1y1:c,rx1y2:f,rx2y1:l,rx2y2:u}=this,p=this._x(n,r,o),d=this._y(n,r,o),h=this._width(n,r,o),m=this._height(n,r,o);return st("svg:g",i).call(xt,this,o,i).call(this._transform,this,n).call(g=>g.selectAll().data(e).enter().call(c||f||l||u?y=>y.append("path").call(dt,this).call(Zp,p,d,aO(p,h),aO(d,m),this).call(Tt,this,r):y=>y.append("rect").call(dt,this).attr("x",p).attr("width",h).attr("y",d).attr("height",m).call(at,"rx",s).call(at,"ry",a).call(Tt,this,r))).node()}_x(e,{x:n},{marginLeft:r}){let{insetLeft:o}=this;return n?i=>n[i]+o:r+o}_y(e,{y:n},{marginTop:r}){let{insetTop:o}=this;return n?i=>n[i]+o:r+o}_width({x:e},{x:n},{marginRight:r,marginLeft:o,width:i}){let{insetLeft:s,insetRight:a}=this,c=n&&e?e.bandwidth():i-r-o;return Math.max(0,c-s-a)}_height({y:e},{y:n},{marginTop:r,marginBottom:o,height:i}){let{insetTop:s,insetBottom:a}=this,c=n&&e?e.bandwidth():i-r-o;return Math.max(0,c-s-a)}};function aO(t,e){return typeof t=="function"&&typeof e=="function"?n=>t(n)+e(n):typeof t=="function"?n=>t(n)+e:typeof e=="function"?n=>t+e(n):t+e}var qa=class extends Bf{constructor(e,n={},r){let{x1:o,x2:i,y:s}=n;super(e,{x1:{value:o,scale:"x"},x2:{value:i,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},n,r)}_transform(e,n,{x:r}){e.call(mt,n,{x:r},0,0)}_x({x:e},{x1:n,x2:r},{marginLeft:o}){let{insetLeft:i}=this;return Gn(e)?o+i:s=>Math.min(n[s],r[s])+i}_width({x:e},{x1:n,x2:r},{marginRight:o,marginLeft:i,width:s}){let{insetLeft:a,insetRight:c}=this;return Gn(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}},Ba=class extends Bf{constructor(e,n={},r){let{x:o,y1:i,y2:s}=n;super(e,{y1:{value:i,scale:"y"},y2:{value:s,scale:"y"},x:{value:o,scale:"x",type:"band",optional:!0}},n,r)}_transform(e,n,{y:r}){e.call(mt,n,{y:r},0,0)}_y({y:e},{y1:n,y2:r},{marginTop:o}){let{insetTop:i}=this;return Gn(e)?o+i:s=>Math.min(n[s],r[s])+i}_height({y:e},{y1:n,y2:r},{marginTop:o,marginBottom:i,height:s}){let{insetTop:a,insetBottom:c}=this;return Gn(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}};function bo(t,e={}){return si(e)||(e={...e,y:Xt,x2:V}),new qa(t,ms(If(ds(e))))}function wo(t,e={}){return si(e)||(e={...e,x:Xt,y2:V}),new Ba(t,gs($f(hs(e))))}var eW={ariaLabel:"cell"},za=class extends Bf{constructor(e,{x:n,y:r,...o}={}){super(e,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},o,eW)}_transform(e,n){e.call(mt,n,{},0,0)}};function bs(t,{x:e,y:n,...r}={}){return[e,n]=ae(e,n),new za(t,{...r,x:e,y:n})}function cO(t,{x:e=Xt,fill:n,stroke:r,...o}={}){return n===void 0&&ee(r)[0]===void 0&&(n=V),new za(t,{...o,x:e,fill:n,stroke:r})}function fO(t,{y:e=Xt,fill:n,stroke:r,...o}={}){return n===void 0&&ee(r)[0]===void 0&&(n=V),new za(t,{...o,y:e,fill:n,stroke:r})}var nW={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function sd(t){return t.sort===void 0&&t.reverse===void 0?Uy({channel:"-r"},t):t}var Ya=class extends pt{constructor(e,n={}){let{x:r,y:o,r:i,rotate:s,symbol:a=ni,frameAnchor:c}=n,[f,l]=Ft(s,0),[u,p]=yC(a),[d,h]=Ft(i,u==null?3:4.5);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:d,scale:"r",filter:bn,optional:!0},rotate:{value:f,optional:!0},symbol:{value:u,scale:"auto",optional:!0}},sd(n),nW),this.r=h,this.rotate=l,this.symbol=p,this.frameAnchor=fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:x}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,r:l,rotate:u,symbol:p}=r,{r:d,rotate:h,symbol:m}=this,[g,y]=Le(this,o),x=m===ni,b=l?void 0:d*d*Math.PI;return Vi(d)&&(e=[]),st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(w=>w.selectAll().data(e).enter().append(x?"circle":"path").call(dt,this).call(x?_=>{_.attr("cx",c?v=>c[v]:g).attr("cy",f?v=>f[v]:y).attr("r",l?v=>l[v]:d)}:_=>{_.attr("transform",$r`translate(${c?v=>c[v]:g},${f?v=>f[v]:y})${u?v=>` rotate(${u[v]})`:h?` rotate(${h})`:""}`).attr("d",l&&p?v=>{let A=hn();return p[v].draw(A,l[v]*l[v]*Math.PI),A}:l?v=>{let A=hn();return m.draw(A,l[v]*l[v]*Math.PI),A}:p?v=>{let A=hn();return p[v].draw(A,b),A}:(()=>{let v=hn();return m.draw(v,b),v})())}).call(Tt,this,r)).node()}};function mr(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new Ya(t,{...r,x:e,y:n})}function lO(t,{x:e=V,...n}={}){return new Ya(t,dx({...n,x:e}))}function uO(t,{y:e=V,...n}={}){return new Ya(t,px({...n,y:e}))}function pO(t,e){return mr(t,{...e,symbol:"circle"})}function dO(t,e){return mr(t,{...e,symbol:"hexagon"})}var rW={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Ua=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i,curve:s,tension:a}=n;super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y"},z:{value:nn(n),optional:!0}},n,rW),this.z=i,this.curve=Px(s,a),Ir(this,n)}filter(e){return e}project(e,n,r){this.curve!==ys&&super.project(e,n,r)}render(e,n,r,o,i){let{x:s,y:a}=r,{curve:c}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(f=>f.selectAll().data(fx(e,[s,a],this,r)).enter().append("path").call(dt,this).call(Ca,this,r).call(Uk,this,r,i).attr("d",c===ys&&i.projection?oW(i.projection,s,a):fp().curve(c).defined(l=>l>=0).x(l=>s[l]).y(l=>a[l]))).node()}};function oW(t,e,n){let r=Ie(t);return e=xe(e),n=xe(n),o=>{let i=[],s=[i];for(let a of o)a===-1?(i=[],s.push(i)):i.push([e[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function ja(t,{x:e,y:n,...r}={}){return[e,n]=ae(e,n),new Ua(t,{...r,x:e,y:n})}function ws(t,{x:e=V,y:n=Xt,...r}={}){return new Ua(t,qf({...r,x:e,y:n}))}function vs(t,{x:e=Xt,y:n=V,...r}={}){return new Ua(t,Ff({...r,x:e,y:n}))}function E3(t,e){e=iW(e);let{x:n,y:r,color:o,size:i}=e,s=Bx(t,n),a=Bx(t,r),c=Bx(t,o),f=Bx(t,i),{fx:l,fy:u,x:{value:p,reduce:d,zero:h,...m},y:{value:g,reduce:y,zero:x,...b},color:{value:w,color:_,reduce:v},size:{value:A,reduce:E},mark:T}=e;if(d===void 0&&(d=y==null&&p==null&&A==null&&g!=null?"count":null),y===void 0&&(y=d==null&&g==null&&A==null&&p!=null?"count":null),E===void 0&&A==null&&v==null&&d==null&&y==null&&(p==null||Kt(s))&&(g==null||Kt(a))&&(E="count"),h===void 0&&(h=zx(d)?!0:void 0),x===void 0&&(x=zx(y)?!0:void 0),p==null&&g==null)throw new Error("must specify x or y");if(d!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&p==null)throw new Error("reducing y requires x");T===void 0&&(T=A!=null||E!=null?"dot":zx(d)||zx(y)||v!=null?"bar":p!=null&&g!=null?Kt(s)||Kt(a)||d==null&&y==null&&!ad(s)&&!ad(a)?"dot":"line":p!=null||g!=null?"rule":null);let $,M,k;switch(T){case"dot":k=mr,M="stroke";break;case"line":k=s&&a||d!=null||y!=null?x||y!=null||s&&ad(s)?vs:h||d!=null||a&&ad(a)?ws:ja:s?ws:vs,M="stroke",mO(c)&&($=null);break;case"area":k=!(x||y!=null)&&(h||d!=null||a&&ad(a))?xs:xi,M="fill",mO(c)&&($=null);break;case"rule":k=s?Vn:Wn,M="stroke";break;case"bar":k=d!=null?Kt(a)?hO(d)&&s&&Kt(s)?bs:bo:Rf:y!=null?Kt(s)?hO(y)&&a&&Kt(a)?bs:wo:Lf:v!=null||E!=null?s&&Kt(s)&&a&&Kt(a)?bs:s&&Kt(s)?wo:a&&Kt(a)?bo:Qp:s&&ci(s)&&!(a&&ci(a))?bo:a&&ci(a)&&!(s&&ci(s))?wo:bs,M="fill";break;default:throw new Error(`invalid mark: ${T}`)}let R={fx:l,fy:u,x:s??void 0,y:a??void 0,[M]:c??_,z:$,r:f??void 0,tip:!0},S,I={[M]:v??void 0,r:E??void 0};if(d!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(I.y=y,S=Kt(s)?rs:yo):d!=null?(I.x=d,S=Kt(a)?os:xo):(v!=null||E!=null)&&(s&&a?S=Kt(s)&&Kt(a)?Lp:Kt(s)?xo:Kt(a)?yo:yi:s?S=Kt(s)?rs:yo:a&&(S=Kt(a)?os:xo)),(S===yi||S===yo)&&(R.x={value:s,...m}),(S===yi||S===xo)&&(R.y={value:a,...b}),h===void 0&&(h=s&&!(S===yi||S===yo)&&(k===bo||k===xs||k===Rf||k===Wn)),x===void 0&&(x=a&&!(S===yi||S===xo)&&(k===wo||k===xi||k===Lf||k===Vn)),{fx:l??null,fy:u??null,x:{value:p??null,reduce:d??null,zero:!!h,...m},y:{value:g??null,reduce:y??null,zero:!!x,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:A??null,reduce:E??null},mark:T,markImpl:gO[k],markOptions:R,transformImpl:gO[S],transformOptions:I,colorMode:M}}function yO(t,e){let n=E3(t,e),{fx:r,fy:o,x:{zero:i},y:{zero:s},markOptions:a,transformOptions:c,colorMode:f}=n,l=T3[n.markImpl],u=T3[n.transformImpl],p=r!=null||o!=null?Df({strokeOpacity:.1}):null,d=[i?Vn([0]):null,s?Wn([0]):null],h=l(t,u?u(c,a):a);return f==="stroke"?we(p,d,h):we(p,h,d)}function ad(t){let e,n;for(let r of t){if(r==null)continue;if(e===void 0){e=r;continue}let o=Math.sign(gt(e,r));if(o){if(n!==void 0&&o!==n)return!1;e=r,n=o}}return!0}function iW({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}={}){return jn(t)||(t=zf(t)),jn(e)||(e=zf(e)),jn(n)||(n=ns(n)?{color:n}:zf(n)),jn(r)||(r=zf(r)),jn(o)&&({value:o}=zf(o)),jn(i)&&({value:i}=zf(i)),s!=null&&(s=`${s}`.toLowerCase()),{x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}}function Bx(t,e){let n=ut(t,e.value);return n&&(n.label=Ve(e.value)),n}function zf(t){return sW(t)?{reduce:t}:{value:t}}function zx(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function hO(t){return/^(?:first|last|mode)$/i.test(t)}function sW(t){if(t==null)return!1;if(typeof t.reduceIndex=="function"||typeof t.reduce=="function"&&Ne(t)||/^p\d{2}$/i.test(t))return!0;switch(`${t}`.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 mO(t){return t?new fn(t).size>t.length>>1:!1}var T3={dot:mr,line:ja,lineX:ws,lineY:vs,areaX:xs,areaY:xi,ruleX:Vn,ruleY:Wn,barX:bo,barY:wo,rect:Qp,rectX:Rf,rectY:Lf,cell:bs,bin:yi,binX:yo,binY:xo,group:Lp,groupX:rs,groupY:os},gO=Object.fromEntries(Object.entries(T3).map(([t,e])=>[e,t]));function Yf(t,e={}){let{x:n,x1:r,x2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,x:n=V});let i={};return n!=null&&(i.x=t),r!=null&&(i.x1=t),o!=null&&(i.x2=t),kn(i,e)}function Uf(t,e={}){let{y:n,y1:r,y2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,y:n=V});let i={};return n!=null&&(i.y=t),r!=null&&(i.y1=t),o!=null&&(i.y2=t),kn(i,e)}function kn(t={},e={}){let n=nn(e),r=Object.entries(t).map(([o,i])=>{let s=Py(o,e);if(s==null)throw new Error(`missing channel: ${o}`);let[a,c]=Oe(s);return{key:o,input:s,output:a,setOutput:c,map:aW(i)}});return{...be(e,(o,i)=>{let s=ut(o,n),a=r.map(({input:f})=>ut(o,f)),c=r.map(({setOutput:f})=>f(new Array(o.length)));for(let f of i)for(let l of s?ze(f,u=>s[u]).values():[f])r.forEach(({map:u},p)=>u.mapIndex(l,a[p],c[p]));return{data:o,facets:i}}),...Object.fromEntries(r.map(({key:o,output:i})=>[o,i]))}}function aW(t){if(t==null)throw new Error("missing map");if(typeof t.mapIndex=="function")return t;if(typeof t.map=="function"&&Ne(t))return cW(t);if(typeof t=="function")return I3(df(t));switch(`${t}`.toLowerCase()){case"cumsum":return lW;case"rank":return I3((e,n)=>Zl(e,r=>n[r]));case"quantile":return I3((e,n)=>fW(e,r=>n[r]))}throw new Error(`invalid map: ${t}`)}function cW(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}function fW(t,e){let n=Br(t,e)-1;return Zl(t,e).map(r=>r/n)}function I3(t){return{mapIndex(e,n,r){let o=t(e,n);if(o.length!==e.length)throw new Error("map function returned a mismatched length");for(let i=0,s=e.length;i<s;++i)r[e[i]]=o[i]}}}var lW={mapIndex(t,e,n){let r=0;for(let o of t)n[o]=r+=e[o]}};function xO(t={},e){return arguments.length===1&&(e=t),Yf(jf(t),e)}function bO(t={},e){return arguments.length===1&&(e=t),Uf(jf(t),e)}function jf(t={}){typeof t=="number"&&(t={k:t});let{k:e,reduce:n,shift:r,anchor:o,strict:i}=t;if(o===void 0&&r!==void 0&&(o=pW(r),rn(`Warning: the shift option is deprecated; please use anchor "${o}" instead.`)),!((e=Math.floor(e))>0))throw new Error(`invalid k: ${e}`);return dW(n)(e,uW(o,e),i)}function uW(t="middle",e){switch(`${t}`.toLowerCase()){case"middle":return e-1>>1;case"start":return 0;case"end":return e-1}throw new Error(`invalid anchor: ${t}`)}function pW(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}function dW(t="mean"){if(typeof t=="string"){if(/^p\d{2}$/i.test(t))return Yx(pf(t));switch(t.toLowerCase()){case"deviation":return Yx(nr);case"max":return Ux((e,n)=>Ct(e,r=>n[r]));case"mean":return hW;case"median":return Yx(_r);case"min":return Ux((e,n)=>Bt(e,r=>n[r]));case"mode":return Ux((e,n)=>wc(e,r=>n[r]));case"sum":return wO;case"variance":return Yx(ki);case"difference":return yW;case"ratio":return xW;case"first":return bW;case"last":return wW}}if(typeof t!="function")throw new Error(`invalid reduce: ${t}`);return Ux(df(t))}function Yx(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=f=>i[f]==null?NaN:+i[f],c=0;for(let f=0;f<e-1;++f)isNaN(a(f))&&++c;for(let f=0,l=o.length-e+1;f<l;++f)isNaN(a(f+e-1))&&++c,s[o[f+n]]=c===0?t(ai(o,f,f+e),a):NaN,isNaN(a(f))&&--c}}:{mapIndex(o,i,s){let a=c=>i[c]==null?NaN:+i[c];for(let c=-n;c<0;++c)s[o[c+n]]=t(ai(o,0,c+e),a);for(let c=0,f=o.length-n;c<f;++c)s[o[c+n]]=t(ai(o,c,c+e),a)}}}function Ux(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=0;for(let c=0;c<e-1;++c)a+=Jt(i[o[c]]);for(let c=0,f=o.length-e+1;c<f;++c)a+=Jt(i[o[c+e-1]]),a===e&&(s[o[c+n]]=t(ai(o,c,c+e),i)),a-=Jt(i[o[c]])}}:{mapIndex(o,i,s){for(let a=-n;a<0;++a)s[o[a+n]]=t(ai(o,0,a+e),i);for(let a=0,c=o.length-n;a<c;++a)s[o[a+n]]=t(ai(o,a,a+e),i)}}}function wO(t,e,n){return n?{mapIndex(r,o,i){let s=0,a=0;for(let c=0;c<t-1;++c){let f=o[r[c]];f===null||isNaN(f)?++s:a+=+f}for(let c=0,f=r.length-t+1;c<f;++c){let l=o[r[c]],u=o[r[c+t-1]];u===null||isNaN(u)?++s:a+=+u,i[r[c+e]]=s===0?a:NaN,l===null||isNaN(l)?--s:a-=+l}}}:{mapIndex(r,o,i){let s=0,a=r.length;for(let c=0,f=Math.min(a,t-e-1);c<f;++c)s+=+o[r[c]]||0;for(let c=-e,f=a-e;c<f;++c)s+=+o[r[c+t-1]]||0,i[r[c+e]]=s,s-=+o[r[c]]||0}}}function hW(t,e,n){if(n){let r=wO(t,e,n);return{mapIndex(o,i,s){r.mapIndex(o,i,s);for(let a=0,c=o.length-t+1;a<c;++a)s[o[a+e]]/=t}}}else return{mapIndex(r,o,i){let s=0,a=0,c=r.length;for(let f=0,l=Math.min(c,t-e-1);f<l;++f){let u=o[r[f]];u!==null&&!isNaN(u=+u)&&(s+=u,++a)}for(let f=-e,l=c-e;f<l;++f){let u=o[r[f+t-1]],p=o[r[f]];u!==null&&!isNaN(u=+u)&&(s+=u,++a),i[r[f+e]]=s/a,p!==null&&!isNaN(p=+p)&&(s-=p,--a)}}}}function mW(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(Jt(i))return i}}function gW(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(Jt(i))return i}}function vO(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(i!==null&&!isNaN(i=+i))return i}}function _O(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(i!==null&&!isNaN(i=+i))return i}}function yW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s){let c=o[r[s]],f=o[r[s+t-1]];i[r[s+e]]=c===null||f===null?NaN:f-c}}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=_O(o,r,s,t)-vO(o,r,s,t)}}}function xW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s){let c=o[r[s]],f=o[r[s+t-1]];i[r[s+e]]=c===null||f===null?NaN:f/c}}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=_O(o,r,s,t)/vO(o,r,s,t)}}}function bW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s)i[r[s+e]]=o[r[s]]}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=mW(o,r,s,t)}}}function wW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s)i[r[s+e]]=o[r[s+t-1]]}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=gW(o,r,s,t)}}}var bi={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function SO(t,{x:e=V,y:n,k:r=bi.k,color:o=bi.color,opacity:i=bi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:l,...u}={}){return we(Pt(s)?null:xs(t,kn({x1:_s({k:-r,...u}),x2:_s({k:r,...u})},{x1:e,x2:e,y:n,fill:s,fillOpacity:a,...u})),Pt(c)?null:ws(t,kn({x:_s(u)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:l,...u})))}function MO(t,{x:e,y:n=V,k:r=bi.k,color:o=bi.color,opacity:i=bi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:l,...u}={}){return we(Pt(s)?null:xi(t,kn({y1:_s({k:-r,...u}),y2:_s({k:r,...u})},{x:e,y1:n,y2:n,fill:s,fillOpacity:a,...u})),Pt(c)?null:vs(t,kn({y:_s(u)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:l,...u})))}function _s({n:t=bi.n,k:e=0,strict:n=bi.strict,anchor:r=bi.anchor}={}){return jf({k:t,reduce:o=>Fo(o)+e*(nr(o)||0),strict:n,anchor:r})}var vW={ariaLabel:"tick",fill:null,stroke:"currentColor"},jx=class extends pt{constructor(e,n,r){super(e,n,r,vW),Ir(this,r)}render(e,n,r,o,i){return st("svg:g",i).call(xt,this,o,i).call(this._transform,this,n).call(s=>s.selectAll().data(e).enter().append("line").call(dt,this).attr("x1",this._x1(n,r,o)).attr("x2",this._x2(n,r,o)).attr("y1",this._y1(n,r,o)).attr("y2",this._y2(n,r,o)).call(Tt,this,r).call(gi,this,r,i)).node()}},cd=class extends jx{constructor(e,n={}){let{x:r,y:o,inset:i=0,insetTop:s=i,insetBottom:a=i}=n;super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n),this.insetTop=Ot(s),this.insetBottom=Ot(a)}_transform(e,n,{x:r}){e.call(mt,n,{x:r},oe,0)}_x1(e,{x:n}){return r=>n[r]}_x2(e,{x:n}){return r=>n[r]}_y1({y:e},{y:n},{marginTop:r}){let{insetTop:o}=this;return n&&e?i=>n[i]+o:r+o}_y2({y:e},{y:n},{height:r,marginBottom:o}){let{insetBottom:i}=this;return n&&e?s=>n[s]+e.bandwidth()-i:r-o-i}},fd=class extends jx{constructor(e,n={}){let{x:r,y:o,inset:i=0,insetRight:s=i,insetLeft:a=i}=n;super(e,{y:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Ot(s),this.insetLeft=Ot(a)}_transform(e,n,{y:r}){e.call(mt,n,{y:r},0,oe)}_x1({x:e},{x:n},{marginLeft:r}){let{insetLeft:o}=this;return n&&e?i=>n[i]+o:r+o}_x2({x:e},{x:n},{width:r,marginRight:o}){let{insetRight:i}=this;return n&&e?s=>n[s]+e.bandwidth()-i:r-o-i}_y1(e,{y:n}){return r=>n[r]}_y2(e,{y:n}){return r=>n[r]}};function Xx(t,{x:e=V,...n}={}){return new cd(t,{...n,x:e})}function Gx(t,{y:e=V,...n}={}){return new fd(t,{...n,y:e})}function AO(t,{x:e=V,y:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...l}={}){let u=n!=null?os:Rp;return we(Wn(t,u({x1:$3,x2:C3},{x:e,y:n,stroke:s,strokeOpacity:a,...l})),bo(t,u({x1:"p25",x2:"p75"},{x:e,y:n,fill:o,fillOpacity:i,...l})),Xx(t,u({x:"p50"},{x:e,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...l})),mr(t,kn({x:EO},{x:e,y:n,z:n,r,stroke:s,strokeOpacity:a,...l})))}function TO(t,{y:e=V,x:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...l}={}){let u=n!=null?rs:Rp;return we(Vn(t,u({y1:$3,y2:C3},{x:n,y:e,stroke:s,strokeOpacity:a,...l})),wo(t,u({y1:"p25",y2:"p75"},{x:n,y:e,fill:o,fillOpacity:i,...l})),Gx(t,u({y:"p50"},{x:n,y:e,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...l})),mr(t,kn({y:EO},{x:n,y:e,z:n,r,stroke:s,strokeOpacity:a,...l})))}function EO(t){let e=$3(t),n=C3(t);return t.map(r=>r<e||r>n?r:NaN)}function $3(t){let e=IO(t)*2.5-$O(t)*1.5;return Bt(t,n=>n>=e?n:NaN)}function C3(t){let e=$O(t)*2.5-IO(t)*1.5;return Ct(t,n=>n<=e?n:NaN)}function IO(t){return ln(t,.25)}function $O(t){return ln(t,.75)}var _W={ariaLabel:"raster",stroke:null,pixelSize:1};function Xf(t,e){let n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function CO(t,e){let n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}var ud=class extends pt{constructor(e,n,r={},o){let{width:i,height:s,x:a,y:c,x1:f=a==null?0:void 0,y1:l=c==null?0:void 0,x2:u=a==null?i:void 0,y2:p=c==null?s:void 0,pixelSize:d=o.pixelSize,blur:h=0,interpolate:m}=r;if(i!=null&&(i=CO(i,"width")),s!=null&&(s=CO(s,"height")),f!=null&&(f=Xf(f,"x1")),l!=null&&(l=Xf(l,"y1")),u!=null&&(u=Xf(u,"x2")),p!=null&&(p=Xf(p,"y2")),a==null&&(f==null||u==null))throw new Error("missing x");if(c==null&&(l==null||p==null))throw new Error("missing y");e!=null&&i!=null&&s!=null&&(a===void 0&&f!=null&&u!=null&&(a=CW(f,u,i,s)),c===void 0&&l!=null&&p!=null&&(c=kW(l,p,i,s))),super(e,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y1:{value:l==null?null:[l],scale:"y",optional:!0,filter:null},x2:{value:u==null?null:[u],scale:"x",optional:!0,filter:null},y2:{value:p==null?null:[p],scale:"y",optional:!0,filter:null},...n},r,o),this.width=i,this.height=s,this.pixelSize=Xf(d,"pixelSize"),this.blur=Xf(h,"blur"),this.interpolate=a==null||c==null?null:SW(m)}},pd=class extends ud{constructor(e,n={}){let{imageRendering:r}=n;if(e==null){let{fill:o,fillOpacity:i}=n;Ft(i)[0]!==void 0&&(n=Vx("fillOpacity",n)),ee(o)[0]!==void 0&&(n=Vx("fill",n))}super(e,void 0,n,_W),this.imageRendering=Wt(r,"auto")}scale(e,{color:n,...r},o){return super.scale(e,r,o)}render(e,n,r,o,i){let s=n[r.channels.fill?.scale]??(I=>I),{x:a,y:c}=r,{document:f}=i,[l,u,p,d]=NO(r,o,i),h=p-l,m=d-u,{pixelSize:g,width:y=Math.round(Math.abs(h)/g),height:x=Math.round(Math.abs(m)/g)}=this,b=y*x,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let I=y/h,C=x/m,N=Et(a,L=>(L-l)*I,Float64Array),D=Et(c,L=>(L-u)*C,Float64Array);w&&(w=this.interpolate(e,y,x,N,D,w)),_&&(_=this.interpolate(e,y,x,N,D,_))}else this.data==null&&e&&(v=e.fi*b);let A=f.createElement("canvas");A.width=y,A.height=x;let E=A.getContext("2d"),T=E.createImageData(y,x),$=T.data,{r:M,g:k,b:R}=ve(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let I=0;I<b;++I){let C=I<<2;if(w){let N=s(w[I+v]);if(N==null){$[C+3]=0;continue}({r:M,g:k,b:R}=ve(N))}_&&(S=_[I+v]*255),$[C+0]=M,$[C+1]=k,$[C+2]=R,$[C+3]=S}return this.blur>0&&J2(T,this.blur),E.putImageData(T,0,0),st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(I=>I.append("image").attr("transform",`translate(${l},${u}) scale(${Math.sign(p-l)},${Math.sign(d-u)})`).attr("width",Math.abs(h)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(at,"image-rendering",this.imageRendering).call(dt,this).attr("xlink:href",A.toDataURL())).node()}};function k3(t,e,n){arguments.length<3&&(n=e,e=null);let{x:r,y:o,[t]:i,...s}=n;return r===void 0&&o===void 0&&iC(e)&&(r=Aa,o=Ji,i===void 0&&(i=eC)),[e,{...s,x:r,y:o,[t]:i}]}function kO(){let[t,e]=k3("fill",...arguments);return new pd(t,t==null||e.fill!==void 0||e.fillOpacity!==void 0?e:{...e,fill:V})}function NO({x1:t,y1:e,x2:n,y2:r},o,{projection:i}){let{width:s,height:a,marginTop:c,marginRight:f,marginBottom:l,marginLeft:u}=o;return[t&&i==null?t[0]:u,e&&i==null?e[0]:c,n&&i==null?n[0]:s-f,r&&i==null?r[0]:a-l]}function N3({x1:t,y1:e,x2:n,y2:r},o,i,s){let a={};return t&&(a.x1=t),e&&(a.y1=e),n&&(a.x2=n),r&&(a.y2=r),NO(wf(a,o),i,s)}function Vx(t,e={}){let{[t]:n}=e;if(typeof n!="function")throw new Error(`invalid ${t}: not a function`);return Vt({...e,[t]:void 0},function(r,o,i,s,a,c){let{x:f,y:l}=s;if(!f)throw new Error("missing scale: x");if(!l)throw new Error("missing scale: y");let[u,p,d,h]=N3(i,s,a,c),m=d-u,g=h-p,{pixelSize:y}=this,{width:x=Math.round(Math.abs(m)/y),height:b=Math.round(Math.abs(g)/y)}=e,w=new Array(x*b*(o?o.length:1)),_=m/x,v=g/b,A=0;for(let E of o??[void 0])for(let T=.5;T<b;++T)for(let $=.5;$<x;++$,++A)w[A]=n(f.invert(u+$*_),l.invert(p+T*v),E);return{data:w,facets:o,channels:{[t]:{value:w,scale:"auto"}}}})}function SW(t){if(typeof t=="function")return t;if(t==null)return Wx;switch(`${t}`.toLowerCase()){case"none":return Wx;case"nearest":return hd;case"barycentric":return dd();case"random-walk":return md()}throw new Error(`invalid interpolate: ${t}`)}function Wx(t,e,n,r,o,i){let s=new Array(e*n);for(let a of t)r[a]<0||r[a]>=e||o[a]<0||o[a]>=n||(s[Math.floor(o[a])*e+Math.floor(r[a])]=i[a]);return s}function dd({random:t=pa(42)}={}){return(e,n,r,o,i,s)=>{let{points:a,triangles:c,hull:f}=ir.from(e,d=>o[d],d=>i[d]),l=new s.constructor(n*r).fill(NaN),u=new Uint8Array(n*r),p=$W(s,t);for(let d=0;d<c.length;d+=3){let h=c[d],m=c[d+1],g=c[d+2],y=a[2*h],x=a[2*m],b=a[2*g],w=a[2*h+1],_=a[2*m+1],v=a[2*g+1],A=Math.min(y,x,b),E=Math.max(y,x,b),T=Math.min(w,_,v),$=Math.max(w,_,v),M=(_-v)*(y-b)+(w-v)*(b-x);if(!M)continue;let k=s[e[h]],R=s[e[m]],S=s[e[g]];for(let I=Math.floor(A);I<E;++I)for(let C=Math.floor(T);C<$;++C){if(I<0||I>=n||C<0||C>=r)continue;let N=I+.5,D=C+.5,L=Math.sign(M),P=(_-v)*(N-b)+(D-v)*(b-x);if(P*L<0)continue;let F=(v-w)*(N-b)+(D-v)*(y-b);if(F*L<0)continue;let q=M-(P+F);if(q*L<0)continue;let W=I+n*C;l[W]=p(k,P/M,R,F/M,S,q/M,I,C),u[W]=1}}return MW(l,u,o,i,s,n,r,f,e,p),l}}function MW(t,e,n,r,o,i,s,a,c,f){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),o=Array.from(a,d=>o[c[d]]);let l=n.length,u=Array.from({length:l},(d,h)=>TW(h,n,r)),p=0;for(let d=0;d<s;++d){let h=d+.5;for(let m=0;m<i;++m){let g=m+i*d;if(!e[g]){let y=m+.5;for(let x=0;x<l;++x){let b=(l+p+(x%2?(x+1)/2:-x/2))%l;if(u[b](y,h)){let w=AW(n.at(b-1),r.at(b-1),n[b],r[b],y,h);t[g]=f(o.at(b-1),w,o[b],1-w,o[b],0,m,d),p=b;break}}}}}}function AW(t,e,n,r,o,i){let s=n-t,a=r-e,c=s*(n-o)+a*(r-i),f=s*(o-t)+a*(i-e);return c>0&&f>0?c/(c+f):+(c>f)}function ld(t,e,n,r){return t*r-n*e}function TW(t,e,n){let r=e.length,o=e.at(t-2),i=n.at(t-2),s=e.at(t-1),a=n.at(t-1),c=e[t],f=n[t],l=e.at(t+1-r),u=n.at(t+1-r),p=s-c,d=a-f,h=o-s,m=i-a,g=c-l,y=f-u,x=Math.hypot(p,d),b=Math.hypot(h,m),w=Math.hypot(g,y);return(_,v)=>{let A=_-s,E=v-a,T=_-c,$=v-f;return ld(A,E,T,$)>-1e-6&&ld(A,E,p,d)*b-ld(A,E,h,m)*x>-1e-6&&ld(T,$,g,y)*x-ld(T,$,p,d)*w<=0}}function hd(t,e,n,r,o,i){let s=new i.constructor(e*n),a=ir.from(t,l=>r[l],l=>o[l]),c,f;for(let l=.5,u=0;l<n;++l){f=c;for(let p=.5;p<e;++p,++u)f=a.find(p,l,f),p===.5&&(c=f),s[u]=i[t[f]]}return s}function md({random:t=pa(42),minDistance:e=.5,maxSteps:n=2}={}){return(r,o,i,s,a,c)=>{let f=new c.constructor(o*i),l=ir.from(r,h=>s[h],h=>a[h]),u,p,d;for(let h=.5,m=0;h<i;++h){p=u;for(let g=.5;g<o;++g,++m){let y=g,x=h;d=p=l.find(y,x,p),g===.5&&(u=p);let b,w=0;for(;(b=Math.hypot(s[r[d]]-y,a[r[d]]-x))>e&&w<n;){let _=t(g,h,w)*2*Math.PI;y+=Math.cos(_)*b,x+=Math.sin(_)*b,d=l.find(y,x,d),++w}f[m]=c[r[d]]}}return f}}function EW(t,e,n,r,o,i){return e*t+r*n+i*o}function IW(t){return(e,n,r,o,i,s,a,c)=>{let f=t(a,c);return f<n?e:f<n+o?r:i}}function $W(t,e){return ci(t)||ne(t)?EW:IW(e)}function CW(t,e,n){return{transform(r){let o=r.length,i=new Float64Array(o),s=(e-t)/n,a=t+s/2;for(let c=0;c<o;++c)i[c]=c%n*s+a;return i}}}function kW(t,e,n,r){return{transform(o){let i=o.length,s=new Float64Array(i),a=(e-t)/r,c=t+a/2;for(let f=0;f<i;++f)s[f]=Math.floor(f/n)%r*a+c;return s}}}var OO={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},gd=class extends ud{constructor(e,{smooth:n=!0,value:r,...o}={}){let i=cx({},o,OO);if(r===void 0){for(let a in i)if(i[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=o[a],o[a]="value"}}if(r!=null){let a={transform:c=>c.map(f=>f.value),label:Ve(r)};for(let c in i)o[c]==="value"&&(o[c]=a)}if(e==null){if(r==null)throw new Error("missing contour value");o=Vx("value",{value:r,...o}),r=null}else{let{interpolate:a}=o;r===void 0&&(r=V),a===void 0&&(o.interpolate="nearest")}super(e,{value:{value:r,optional:!0}},NW(o),OO);let s={geometry:{value:V}};for(let a in this.channels){let c=this.channels[a],{scale:f}=c;f==="x"||f==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(e,{x:n,y:r,value:o,...i},s){return super.filter(e,i,s)}render(e,n,r,o,i){let{geometry:s}=r,a=Ie();return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(c=>{c.selectAll().data(e).enter().append("path").call(dt,this).attr("d",f=>a(s[f])).call(Tt,this,r)}).node()}};function NW({thresholds:t,interval:e,...n}){return t=M3(t,e,Ni),Vt(n,function(r,o,i,s,a,c){let[f,l,u,p]=N3(i,s,a,c),d=u-f,h=p-l,{pixelSize:m,width:g=Math.round(Math.abs(d)/m),height:y=Math.round(Math.abs(h)/m)}=this,x=g/d,b=y/h,w=i.value.value,_=[];if(this.interpolate){let{x:$,y:M}=ho(i,s,c),k=Et($,C=>(C-f)*x,Float64Array),R=Et(M,C=>(C-l)*b,Float64Array),S=[i.x,i.y,i.value],I=[k,R,w];for(let C of o){let N=this.filter(C,S,I);_.push(this.interpolate(N,g,y,k,R,w))}}else if(o){let $=g*y,M=o.length;for(let k=0;k<M;++k)_.push(w.slice(k*$,k*$+$))}else _.push(w);if(this.blur>0)for(let $ of _)Xl({data:$,width:g,height:y},this.blur);let v=OW(t,w,...RW(_));if(v===null)throw new Error(`unsupported thresholds: ${t}`);let{contour:A}=qi().size([g,y]).smooth(this.smooth),E=[],T=[];for(let $ of _)T.push(ce(E.length,E.push(...Et(v,M=>A($,M)))));for(let{coordinates:$}of E)for(let M of $)for(let k of M)for(let R of k)R[0]=R[0]/x+f,R[1]=R[1]/b+l;return{data:E,facets:T,channels:Hy(this.contourChannels,E)}})}function OW(t,e,n,r){if(typeof t?.range=="function")return t.range(t.floor(n),r);if(typeof t=="function"&&(t=t(e,n,r)),typeof t!="number")return Un(t);let o=Ye(...xc(n,r,t),t);for(;o[o.length-1]>=r;)o.pop();for(;o[1]<n;)o.shift();return o}function LO(){return new gd(...k3("value",...arguments))}function RW(t){return[Bt(t,e=>Bt(e,RO)),Ct(t,e=>Ct(e,RO))]}function RO(t){return isFinite(t)?t:NaN}function FO(t,e){return O3(ls,t,e)}function qO(t,e={}){return O3(us,t,e)}function BO(t,e={}){return O3(mi,t,e)}function O3(t,e,n={}){let{x:r,y:o,maxRadius:i}=n,s=t({px:r,py:o,maxRadius:i}),a=[];r!=null&&a.push(Vn(e,DO("x",{...s,inset:-6},n))),o!=null&&a.push(Wn(e,DO("y",{...s,inset:-6},n))),r!=null&&a.push(go(e,PO("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),o!=null&&a.push(go(e,PO("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return we(...a)}function zO(t,{channels:e,...n},{facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:c,transform:f,initializer:l}){return{...n,facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:{...e,...c},transform:f,initializer:LW(t,l)}}function LW(t,e){return e==null?e:function(n,r,{x:o,y:i,px:s,py:a,...c},...f){let{channels:{x:l,y:u,...p}={},...d}=e.call(this,n,r,{...c,x:s,y:a},...f);return{channels:{...p,...l&&{px:l,...t==="x"&&{x:l}},...u&&{py:u,...t==="y"&&{y:u}}},...d}}}function DO(t,e,n){let{color:r="currentColor",opacity:o=.2,ruleStroke:i=r,ruleStrokeOpacity:s=o,ruleStrokeWidth:a}=n;return{...zO(t,e,n),stroke:i,strokeOpacity:s,strokeWidth:a}}function PO(t,e,n){let{color:r="currentColor",textFill:o=r,textFillOpacity:i,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...zO(t,e,DW(t,n)),fill:o,fillOpacity:i,stroke:s,strokeOpacity:a,strokeWidth:c}}function DW(t,e){return Vt(e,(n,r,o)=>({channels:{text:{value:Pp(o,t)?.value}}}))}var PW={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},FW={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},qW={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},BW={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},zW={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},R3=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i,curve:s,tension:a}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i,optional:!0}},n,PW),this.curve=ed(s,a),Ir(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:l}=r,{curve:u}=this,[p,d]=Le(this,o),h=c?x=>c[x]:re(p),m=f?x=>f[x]:re(d),g=this;function y(x){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],A=[],E=[],T=[];function $(S,I){S=x[S],I=x[I],w.push(++b),v[b]=h(S),E[b]=m(S),A[b]=h(I),T[b]=m(I);for(let C in r)_[C].push(r[C][I])}let{halfedges:M,hull:k,triangles:R}=ir.from(x,h,m);for(let S=0;S<M.length;++S){let I=M[S];I>S&&$(R[S],R[I])}for(let S=0;S<k.length;++S)$(k[S],k[(S+1)%k.length]);St(this).selectAll().data(w).enter().append("path").call(dt,g).attr("d",S=>{let I=hn(),C=u(I);return C.lineStart(),C.point(v[S],E[S]),C.point(A[S],T[S]),C.lineEnd(),I}).call(Tt,g,_).call(gi,g,_,i)}return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(l?x=>x.selectAll().data(ze(e,b=>l[b]).values()).enter().append("g").each(y):x=>x.datum(e).each(y)).node()}},yd=class extends pt{constructor(e,n={},r,o=({z:i})=>i){let{x:i,y:s}=n;super(e,{x:{value:i,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:o(n),optional:!0}},n,r)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:l}=r,[u,p]=Le(this,o),d=c?y=>c[y]:re(u),h=f?y=>f[y]:re(p),m=this;function g(y){let x=ir.from(y,d,h);St(this).append("path").datum(y[0]).call(dt,m).attr("d",m._render(x,o)).call(Tt,m,r)}return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(l?y=>y.selectAll().data(ze(e,x=>l[x]).values()).enter().append("g").each(g):y=>y.datum(e).each(g)).node()}},L3=class extends yd{constructor(e,n={}){super(e,n,FW),this.fill="none"}_render(e){return e.render()}},D3=class extends yd{constructor(e,n={}){super(e,n,qW,nn)}_render(e){return e.renderHull()}},P3=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i,optional:!0}},Vt(n,function(s,a,c,f,l,u){let{x:p,y:d,z:h}=c;({x:p,y:d}=ho(c,f,u)),h=h?.value;let m=new Array((p??d).length).fill(null),[g,y]=Le(this,l),x=p?w=>p[w]:re(g),b=d?w=>d[w]:re(y);for(let w of a){p&&(w=w.filter(_=>Jt(x(_)))),d&&(w=w.filter(_=>Jt(b(_))));for(let[,_]of lo(w,h)){let v=ir.from(_,x,b),A=YO(v,l);for(let E=0,T=_.length;E<T;++E)m[_[E]]=A.renderCell(E)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),BW)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,cells:l}=r;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(u=>{u.selectAll().data(e).enter().append("path").call(dt,this).attr("d",p=>l[p]).call(Tt,this,r)}).node()}},F3=class extends yd{constructor(e,n){super(e,n,zW),this.fill="none"}_render(e,n){return YO(e,n).render()}};function YO(t,e){let{width:n,height:r,marginTop:o,marginRight:i,marginBottom:s,marginLeft:a}=e;return t.voronoi([a,o,n-i,r-s])}function xd(t,e,{x:n,y:r,...o}={}){return[n,r]=ae(n,r),new t(e,{...o,x:n,y:r})}function UO(t,e){return xd(R3,t,e)}function jO(t,e){return xd(L3,t,e)}function XO(t,e){return xd(D3,t,e)}function GO(t,{x:e,y:n,initializer:r,...o}={}){return xd(P3,t,{...be({...o,x:e,y:n},Ix),initializer:r})}function VO(t,e){return xd(F3,t,e)}var YW={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},bd=class extends pt{constructor(e,{x:n,y:r,z:o,weight:i,fill:s,stroke:a,...c}={}){let f=WO(s)&&(s="currentColor",!0),l=WO(a)&&(a="currentColor",!0);super(e,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:nn({z:o,fill:s,stroke:a}),optional:!0},weight:{value:i,optional:!0}},jW({...c,fill:s,stroke:a},f,l),YW),f&&(this.fill=void 0),l&&(this.stroke=void 0),this.z=o}filter(e){return e}render(e,n,r,o,i){let{contours:s}=r,a=Ie();return st("svg:g",i).call(xt,this,o,i).call(mt,this,{}).call(c=>c.selectAll().data(e).enter().append("path").call(dt,this).call(Tt,this,r).attr("d",f=>a(s[f]))).node()}};function HO(t,{x:e,y:n,...r}={}){return[e,n]=ae(e,n),new bd(t,{...r,x:e,y:n})}var UW=new Set(["x","y","z","weight"]);function jW(t,e,n){let{bandwidth:o,thresholds:i}=t;return o=o===void 0?20:+o,i=i===void 0?20:typeof i?.[Symbol.iterator]=="function"?xe(i):+i,Vt(t,function(s,a,c,f,l,u){let p=c.weight?xe(c.weight.value):null,d=c.z?.value,{z:h}=this,[m,g]=Le(this,l),{width:y,height:x}=l,{x:b,y:w}=ho(c,f,u),_=Object.fromEntries(Object.entries(c).filter(([R])=>!UW.has(R)).map(([R,S])=>[R,{...S,value:[]}])),v=e&&[],A=n&&[],E=Bw().x(b?R=>b[R]:m).y(w?R=>w[R]:g).weight(p?R=>p[R]:1).size([y,x]).bandwidth(o),T=[];for(let R of a){let S=[];T.push(S);for(let I of d?Yp(R,d,h):[R]){let C=E.contours(I);S.push([I,C])}}let $=i;if(!($ instanceof $p)){let R=0;for(let S of T)for(let[,I]of S){let C=I.max;C>R&&(R=C)}$=Float64Array.from({length:i-1},(S,I)=>R*100*(I+1)/i)}let M=[],k=[];for(let R of T){let S=[];M.push(S);for(let[I,C]of R)for(let N of $){S.push(k.length),k.push(C(N/100)),v&&v.push(N),A&&A.push(N);for(let D in _)_[D].value.push(c[D].value[I[0]])}}return v&&v.push(0),A&&A.push(0),{data:s,facets:M,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...A&&{stroke:{value:A,scale:"color"}},contours:{value:k}}}})}function WO(t){return/^density$/i.test(t)}function JO(t,e){return tR("x",t,e)}function KO(t,e){return tR("y",t,e)}function tR(t,e,{x1:n,x2:r,y1:o,y2:i,x:s=n===void 0&&r===void 0?t==="y"?Xt:V:void 0,y:a=o===void 0&&i===void 0?t==="x"?Xt:V:void 0,fill:c,positiveFill:f="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:p=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:m,z:g=ee(h)[0],clip:y,tip:x,render:b,...w}={}){return[n,r]=ZO(s,n,r),[o,i]=ZO(a,o,i),n===r&&o===i&&(t==="y"?o=wi(0):n=wi(0)),{tip:x}=Er({tip:x},t==="y"?"x":"y"),we(Pt(f)?null:Object.assign(nd(e,{x1:n,x2:r,y1:o,y2:i,z:g,fill:f,fillOpacity:p,render:hi(b,QO(t,!0)),clip:y,...w}),{ariaLabel:"positive difference"}),Pt(l)?null:Object.assign(nd(e,{x1:n,x2:r,y1:o,y2:i,z:g,fill:l,fillOpacity:d,render:hi(b,QO(t,!1)),clip:y,...w}),{ariaLabel:"negative difference"}),ja(e,{x:r,y:i,z:g,stroke:h,strokeOpacity:m,tip:x,clip:!0,...w}))}function ZO(t,e,n){return e===void 0&&n===void 0?e=n=wi(t):e===void 0?(n=wi(n),e=t===void 0?n:wi(t)):n===void 0?(e=wi(e),n=t===void 0?e:wi(t)):(e=wi(e),n=wi(n)),[e,n]}function wi(t){let e,{value:n,label:r=Ve(n)}=dr(t);return{transform:o=>e||(e=ut(o,n)),label:r}}function QO(t,e){let n=t==="x"?"y":"x",r=`${n}1`,o=`${n}2`,i=`${t}1`,s=`${t}2`;return(a,c,f,l,u,p)=>{let{[r]:d,[o]:h}=f,m=new Float32Array(d.length),g=new Float32Array(h.length),y=l[t==="y"?"height":"width"];(e===Ky(c[t])<0?m:g).fill(y);let x=p(a,c,{...f,[o]:d,[s]:g},l,u),b=p(a,c,{...f,[r]:h,[i]:m},l,u),w=x.querySelector("g")??x,_=b.querySelector("g")??b;for(let v=0;w.firstChild;v+=2){let A=K6(),E=st("svg:clipPath",u).attr("id",A).node();E.appendChild(w.firstChild),_.childNodes[v].setAttribute("clip-path",`url(#${A})`),_.insertBefore(E,_.childNodes[v])}return b}}function Hx({geometry:t=V,...e}={}){let n=cs(r=>ut(r,t));return Vt({...e,x:null,y:null,geometry:{transform:n}},(r,o,i,s,a,{projection:c})=>{let f=n(r),l=f.length,u=new Float64Array(l),p=new Float64Array(l),d=Ie(c);for(let h=0;h<l;++h)[u[h],p[h]]=d.centroid(f[h]);return{data:r,facets:o,channels:{x:{value:u,scale:c==null?"x":null,source:null},y:{value:p,scale:c==null?"y":null,source:null}}}})}function eR({geometry:t=V,...e}={}){let n=cs(o=>ut(o,t)),r=cs(o=>ut(n(o),nv));return{...e,x:{transform:o=>Float64Array.from(r(o),([i])=>i)},y:{transform:o=>Float64Array.from(r(o),([,i])=>i)},geometry:{transform:n}}}var XW={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},wd=class extends pt{constructor(e,n={}){let[r,o]=Ft(n.r,3);super(e,{x:{value:n.tip?n.x:null,scale:"x",optional:!0},y:{value:n.tip?n.y:null,scale:"y",optional:!0},r:{value:r,scale:"r",filter:bn,optional:!0},geometry:{value:n.geometry,scale:"projection"}},sd(n),XW),this.r=o}render(e,n,r,o,i){let{geometry:s,r:a}=r,c=Ie(i.projection??GW(n)),{r:f}=this;return Vi(f)?e=[]:f!==void 0&&c.pointRadius(f),st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(l=>{l.selectAll().data(e).enter().append("path").call(dt,this).attr("d",a?u=>c.pointRadius(a[u])(s[u]):u=>c(s[u])).call(Tt,this,r)}).node()}};function GW({x:t,y:e}){if(t||e)return t??=n=>n,e??=n=>n,la({point(n,r){this.stream.point(t(n),e(r))}})}function Zx(t,e={}){return e.tip&&e.x===void 0&&e.y===void 0?e=Hx(e):e.geometry===void 0&&(e={...e,geometry:V}),new wd(t,e)}function nR({strokeWidth:t=1.5,...e}={}){return Zx({type:"Sphere"},{strokeWidth:t,...e})}function rR({strokeOpacity:t=.1,...e}={}){return Zx(cv(),{strokeOpacity:t,...e})}var Gf=.5,Vf=0;function oR(t={fill:"count"},{binWidth:e,...n}={}){let{z:r}=n;return e=e===void 0?20:Ot(e),t=T6(t,n),uo(t,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!uo(t,"r")&&(n.r=e/2),Vt(n,(o,i,s,a,c,f)=>{let{x:l,y:u,z:p,fill:d,stroke:h,symbol:m}=s;if(l===void 0)throw new Error("missing channel: x");if(u===void 0)throw new Error("missing channel: y");({x:l,y:u}=ho(s,a,f)),p=p?p.value:ut(o,r),d=d?.value,h=h?.value,m=m?.value;let g=Dp(t,{z:p,fill:d,stroke:h,symbol:m}),y=p&&[],x=d&&[],b=h&&[],w=m&&[],_=[],v=[],A=[],E=-1;for(let k of t)k.initialize(o);for(let k of i){let R=[];for(let S of t)S.scope("facet",k);for(let[S,I]of lo(k,g))for(let{index:C,extent:N}of VW(o,I,l,u,e)){R.push(++E),v.push(N.x),A.push(N.y),p&&y.push(g===p?S:p[C[0]]),d&&x.push(g===d?S:d[C[0]]),h&&b.push(g===h?S:h[C[0]]),m&&w.push(g===m?S:m[C[0]]);for(let D of t)D.reduce(C,N)}_.push(R)}let T=s.x.scale,$=s.y.scale,M={x:{value:v,source:a[T]?{value:Et(v,a[T].invert),scale:T}:null},y:{value:A,source:a[$]?{value:Et(A,a[$].invert),scale:$}:null},...p&&{z:{value:y}},...d&&{fill:{value:x,scale:"auto"}},...h&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(t.map(({name:k,output:R})=>[k,{scale:"auto",label:R.label,radius:k==="r"?e/2:void 0,value:R.transform()}]))};return{data:o,facets:_,channels:M}})}function VW(t,e,n,r,o){let i=o*(1.5/g6),s=new Map;for(let a of e){let c=n[a],f=r[a];if(isNaN(c)||isNaN(f))continue;let l=Math.round(f=(f-Vf)/i),u=Math.round(c=(c-Gf)/o-(l&1)/2),p=f-l;if(Math.abs(p)*3>1){let m=c-u,g=u+(c<u?-1:1)/2,y=l+(f<l?-1:1),x=c-g,b=f-y;m*m+p*p>x*x+b*b&&(u=g+(l&1?1:-1)/2,l=y)}let d=`${u},${l}`,h=s.get(d);h===void 0&&(h={index:[],extent:{data:t,x:(u+(l&1)/2)*o+Gf,y:l*i+Vf}},s.set(d,h)),h.index.push(a)}return s.values()}var WW={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function iR(t){return new vd(t)}var vd=class extends pt{constructor({binWidth:e=20,clip:n=!0,...r}={}){super(Qi,void 0,{clip:n,...r},WW),this.binWidth=Ot(e)}render(e,n,r,o,i){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:f,marginLeft:l,width:u,height:p}=o,d=l-Gf,h=u-c-Gf,m=a-Vf,g=p-f-Vf,y=s/2,x=y*y6,b=x/2,w=y*2,_=x*1.5,v=Math.floor(d/w),A=Math.ceil(h/w),E=Math.floor((m+b)/_),T=Math.ceil((g-b)/_)+1,$=`m0,${Ss(-x)}l${Ss(y)},${Ss(b)}v${Ss(x)}l${Ss(-y)},${Ss(b)}`,M=$;for(let k=E;k<T;++k)for(let R=v;R<A;++R)M+=`M${Ss(R*w+(k&1)*y)},${Ss(k*_)}${$}`;return st("svg:g",i).datum(0).call(xt,this,o,i).call(mt,this,{},oe+Gf,oe+Vf).call(k=>k.append("path").call(dt,this).call(Tt,this,r).attr("d",M)).node()}};function Ss(t){return Math.round(t*1e3)/1e3}var HW={ariaLabel:"image",fill:null,stroke:null};function ZW(t){return/^\.*\//.test(t)}function QW(t){return/^(blob|data|file|http|https):/i.test(t)}function JW(t){return typeof t=="string"&&(ZW(t)||QW(t))?[void 0,t]:[t,void 0]}var _d=class extends pt{constructor(e,n={}){let{x:r,y:o,r:i,width:s,height:a,rotate:c,src:f,preserveAspectRatio:l,crossOrigin:u,frameAnchor:p,imageRendering:d}=n;i==null&&(i=void 0),i===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[h,m]=JW(f),[g,y]=Ft(i),[x,b]=Ft(s,y!==void 0?y*2:void 0),[w,_]=Ft(a,y!==void 0?y*2:void 0),[v,A]=Ft(c,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:g,scale:"r",filter:bn,optional:!0},width:{value:x,filter:bn,optional:!0},height:{value:w,filter:bn,optional:!0},rotate:{value:v,optional:!0},src:{value:h,optional:!0}},sd(n),HW),this.src=m,this.width=b,this.rotate=A,this.height=_,this.r=y,this.preserveAspectRatio=Wt(l,"xMidYMid"),this.crossOrigin=fe(u),this.frameAnchor=fo(p),this.imageRendering=Wt(d,"auto")}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,width:l,height:u,r:p,rotate:d,src:h}=r,{r:m,width:g,height:y,rotate:x}=this,[b,w]=Le(this,o);return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(_=>_.selectAll().data(e).enter().append("image").call(dt,this).attr("x",sR(c,l,p,b,g,m)).attr("y",sR(f,u,p,w,y,m)).attr("width",l?v=>l[v]:g!==void 0?g:p?v=>p[v]*2:m*2).attr("height",u?v=>u[v]:y!==void 0?y:p?v=>p[v]*2:m*2).attr("transform",d?v=>`rotate(${d[v]})`:x?`rotate(${x})`:null).attr("transform-origin",d||x?$r`${c?v=>c[v]:b}px ${f?v=>f[v]:w}px`:null).call(at,"href",h?v=>h[v]:this.src).call(at,"preserveAspectRatio",this.preserveAspectRatio).call(at,"crossorigin",this.crossOrigin).call(at,"image-rendering",this.imageRendering).call(at,"clip-path",p?v=>`circle(${p[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Tt,this,r)).node()}};function sR(t,e,n,r,o,i){return e&&t?s=>t[s]-e[s]/2:e?s=>r-e[s]/2:t&&o!==void 0?s=>t[s]-o/2:o!==void 0?r-o/2:n&&t?s=>t[s]-n[s]:n?s=>r-n[s]:t?s=>t[s]-i:r-i}function aR(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new _d(t,{...r,x:e,y:n})}function KW(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,l,u,p,d,h,m,g,y;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,l=Math.sqrt(-2*Math.log(f)),d=(2.30753+l*.27061)/(1+l*(.99229+l*.04481))-l,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),g=d*Math.sqrt(h+m)/m-(1/(2*n-1)-1/(2*e-1))*(h+5/6-2/(3*m)),d=e/(e+n*Math.exp(2*g))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),l=Math.exp(e*a)/e,u=Math.exp(n*c)/n,g=l+u,t<l/g?d=Math.pow(e*g*t,1/e):d=1-Math.pow(n*g*(1-t),1/n)),y=-Wf(e)-Wf(n)+Wf(e+n);s<10;s++){if(d===0||d===1)return d;if(p=tH(d,e,n)-t,l=Math.exp(o*Math.log(d)+i*Math.log(1-d)+y),u=p/l,d-=l=u/(1-.5*Math.min(1,u*(o/d-i/(1-d)))),d<=0&&(d=.5*(d+l)),d>=1&&(d=.5*(d+l+1)),Math.abs(l)<r*d&&s>0)break}return d}function tH(t,e,n){var r=t===0||t===1?0:Math.exp(Wf(e+n)-Wf(e)-Wf(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?!1:t<(e+1)/(e+n+2)?r*cR(t,e,n)/e:1-r*cR(1-t,n,e)/n}function cR(t,e,n){var r=1e-30,o=1,i=e+n,s=e+1,a=e-1,c=1,f=1-i*t/s,l,u,p,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(l=2*o,u=o*(n-o)*t/((a+l)*(e+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,u=-(e+o)*(i+o)*t/((e+l)*(s+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,p=f*c,d*=p,!(Math.abs(p-1)<3e-7));o++);return d}function Wf(t){var e=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,o,i,s;for(s=(i=o=t)+5.5,s-=(o+.5)*Math.log(s);e<6;e++)r+=n[e]/++i;return Math.log(2.506628274631*r/o)-s}function fR(t,e){var n=KW(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}var eH={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Qx=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i,ci:s=.95,precision:a=4}=n;if(super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y"},z:{value:nn(n),optional:!0}},n,eH),this.z=i,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(e,n,r,o,i){let{x:s,y:a,z:c}=r,{ci:f}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(l=>l.selectAll().data(c?Yp(e,c,this.z):[e]).enter().call(u=>u.append("path").attr("fill","none").call(dt,this).call(Ca,this,{...r,fill:null,fillOpacity:null}).attr("d",p=>this._renderLine(p,s,a)).call(f&&!fi(this.fill)?p=>p.select(nH).attr("stroke","none").call(dt,this).call(Ca,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function nH(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(un.svg,"path"),this)}var q3=class extends Qx{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Rt(e,l=>r[l]),c=Jx(e,r,n),f=pR(e,r,n,(1-o)/2,c);return ef().y(l=>l).x0(l=>f(l,-1)).x1(l=>f(l,1))(ce(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Rt(e,a=>r[a]),s=Jx(e,r,n);return`M${s(o)},${o}L${s(i)},${i}`}},B3=class extends Qx{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Rt(e,l=>n[l]),c=Jx(e,n,r),f=pR(e,n,r,(1-o)/2,c);return ef().x(l=>l).y0(l=>f(l,-1)).y1(l=>f(l,1))(ce(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Rt(e,a=>n[a]),s=Jx(e,n,r);return`M${o},${s(o)}L${i},${s(i)}`}};function lR(t,{y:e=Xt,x:n=V,stroke:r,fill:o=Pt(r)?"currentColor":r,...i}={}){return new q3(t,qf({...i,x:n,y:e,fill:o,stroke:r}))}function uR(t,{x:e=Xt,y:n=V,stroke:r,fill:o=Pt(r)?"currentColor":r,...i}={}){return new B3(t,Ff({...i,x:e,y:n,fill:o,stroke:r}))}function Jx(t,e,n){let r=0,o=0,i=0,s=0;for(let l of t){let u=e[l],p=n[l];r+=u,o+=p,i+=u*p,s+=u*u}let a=t.length,c=(a*i-r*o)/(a*s-r*r),f=(o-c*r)/a;return l=>c*l+f}function pR(t,e,n,r,o){let i=Ue(t,l=>e[l])/t.length,s=0,a=0;for(let l of t)s+=(e[l]-i)**2,a+=(n[l]-o(e[l]))**2;let c=Math.sqrt(a/(t.length-2)),f=fR(r,t.length-2);return(l,u)=>{let p=o(l),d=c*Math.sqrt(1/t.length+(l-i)**2/s);return p+u*f*d}}function Sd({path:t=V,delimiter:e,frameAnchor:n,treeLayout:r=ua,treeSort:o,treeSeparation:i,treeAnchor:s,treeFilter:a,...c}={}){s=n1(s),o=mR(o),a!=null&&(a=Y3(a)),n===void 0&&(n=s.frameAnchor);let f=gR(e),l=SR(c,Y3),[u,p]=Oe(),[d,h]=Oe();return{x:u,y:d,frameAnchor:n,...be(c,(m,g)=>{let y=f(ut(m,t)),x=p([]),b=h([]),w=-1,_=[],v=[],A=H0().path($=>y[$]),E=Cn(m)?$=>$.data=m[$.data]:$=>$.data=m.get($.data),T=r();T.nodeSize&&T.nodeSize([1,1]),T.separation&&i!==void 0&&T.separation(i??Cp);for(let $ of l)$[t1]=$[vR]([]);for(let $ of g){let M=[],k=A($.filter(R=>y[R]!=null)).each(E);o!=null&&k.sort(o),T(k);for(let R of k.descendants())if(!(a!=null&&!a(R))){M.push(++w),_[w]=R.data,s.position(R,w,x,b);for(let S of l)S[t1][w]=S[_R](R)}v.push(M)}return{data:_,facets:v}}),...Object.fromEntries(l)}}function e1({path:t=V,delimiter:e,curve:n="bump-x",stroke:r="#555",strokeWidth:o=1.5,strokeOpacity:i=.5,treeLayout:s=ua,treeSort:a,treeSeparation:c,treeAnchor:f,treeFilter:l,...u}={}){f=n1(f),a=mR(a),l!=null&&(l=hR(l)),u={curve:n,stroke:r,strokeWidth:o,strokeOpacity:i,...u};let p=gR(e),d=SR(u,hR),[h,m]=Oe(),[g,y]=Oe(),[x,b]=Oe(),[w,_]=Oe();return{x1:h,x2:g,y1:x,y2:w,...be(u,(v,A)=>{let E=p(ut(v,t)),T=m([]),$=y([]),M=b([]),k=_([]),R=-1,S=[],I=[],C=H0().path(D=>E[D]),N=s();N.nodeSize&&N.nodeSize([1,1]),N.separation&&c!==void 0&&N.separation(c??Cp);for(let D of d)D[t1]=D[vR]([]);for(let D of A){let L=[],P=C(D.filter(F=>E[F]!=null)).each(F=>F.data=v[F.data]);a!=null&&P.sort(a),N(P);for(let{source:F,target:q}of P.links())if(!(l!=null&&!l(q,F))){L.push(++R),S[R]=q.data,f.position(F,R,T,M),f.position(q,R,$,k);for(let W of d)W[t1][R]=W[_R](q,F)}I.push(L)}return{data:S,facets:I}}),...Object.fromEntries(d)}}function n1(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return rH;case"right":return oH}throw new Error(`invalid tree anchor: ${t}`)}var rH={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},oH={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function mR(t){return t==null||typeof t=="function"?t:`${t}`.trim().toLowerCase().startsWith("node:")?dR(Y3(t)):dR(iH(t))}function dR(t){return(e,n)=>ke(t(e),t(n))}function iH(t){return e=>e.data?.[t]}function gR(t="/"){if(t=`${t}`,t==="/")return n=>n;if(t.length!==1)throw new Error("delimiter must be exactly one character");let e=t.charCodeAt(0);return n=>n.map(r=>sH(r,e))}var z3=92,yR=47;function sH(t,e){if(e===z3)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,o=t.length;r<o;++r){switch(t.charCodeAt(r)){case z3:if(!n){n=!0;continue}break;case e:n?(t=t.slice(0,r-1)+t.slice(r),--r,--o):t=t.slice(0,r)+"/"+t.slice(r+1);break;case yR:n?(t=t.slice(0,r)+"\\\\"+t.slice(r),r+=2,o+=2):(t=t.slice(0,r)+"\\"+t.slice(r),++r,++o);break}n=!1}return t}function aH(t){let e=!1;for(let n=0,r=t.length;n<r;++n){switch(t.charCodeAt(n)){case z3:if(!e){e=!0;continue}case yR:e&&(t=t.slice(0,n-1)+t.slice(n),--n,--r);break}e=!1}return t}function xR(t){return Ne(t)&&typeof t.node=="function"}function cH(t){return Ne(t)&&typeof t.link=="function"}function Y3(t){if(xR(t))return t.node;if(t=`${t}`.trim().toLowerCase(),!!t.startsWith("node:")){switch(t){case"node:name":return j3;case"node:path":return U3;case"node:internal":return bR;case"node:external":return wR;case"node:depth":return X3;case"node:height":return G3}throw new Error(`invalid node value: ${t}`)}}function hR(t){if(xR(t))return t.node;if(cH(t))return t.link;if(t=`${t}`.trim().toLowerCase(),!(!t.startsWith("node:")&&!t.startsWith("parent:"))){switch(t){case"parent:name":return Kx(j3);case"parent:path":return Kx(U3);case"parent:depth":return Kx(X3);case"parent:height":return Kx(G3);case"node:name":return j3;case"node:path":return U3;case"node:internal":return bR;case"node:external":return wR;case"node:depth":return X3;case"node:height":return G3}throw new Error(`invalid link value: ${t}`)}}function U3(t){return t.id}function j3(t){return fH(t.id)}function X3(t){return t.depth}function G3(t){return t.height}function bR(t){return!!t.children}function wR(t){return!t.children}function Kx(t){return(e,n)=>n==null?void 0:t(n)}function fH(t){let e=t.length;for(;--e>0&&!lH(t,e););return aH(t.slice(e+1))}function lH(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}var vR=2,_R=3,t1=4;function SR(t,e){let n=[];for(let r in t){let o=t[r],i=e(o);i!==void 0&&n.push([r,...Oe(o),i])}return n}function V3(t,{fill:e,stroke:n,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,marker:l,markerStart:u=l,markerEnd:p=l,dot:d=Pt(u)&&Pt(p),text:h="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:x,textAnchor:b,treeLayout:w=ua,textLayout:_=w===ua||w===V0?"mirrored":"normal",tip:v,...A}={}){if(y===void 0&&(y=n1(A.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=Se(_,"textLayout",["mirrored","normal"]);function E(T){return go(t,Sd({treeLayout:w,text:h,fill:e===void 0?"currentColor":e,stroke:m,dx:y,dy:x,title:g,...T,...A}))}return we(qx(t,e1({treeLayout:w,markerStart:u,markerEnd:p,stroke:n!==void 0?n:e===void 0?"node:internal":e,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,...A})),d?mr(t,Sd({treeLayout:w,fill:e===void 0?"node:internal":e,title:g,tip:v,...A})):null,h!=null?_==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:E():null)}function MR(t,e){return V3(t,{...e,treeLayout:V0})}var TR={ariaLabel:"waffle"},Md=class extends qa{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:hi(i,ER("x"))},TR),this.unit=Math.max(0,n),this.gap=+r,this.round=IR(o),this.multiple=$R(s)}},Ad=class extends Ba{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:hi(i,ER("y"))},TR),this.unit=Math.max(0,n),this.gap=+r,this.round=IR(o),this.multiple=$R(s)}};function ER(t){return function(e,n,r,o,i){let{unit:s,gap:a,rx:c,ry:f,round:l}=this,{document:u}=i,p=r.channels[`${t}1`].value,d=r.channels[`${t}2`].value,h=this[t==="y"?"_width":"_height"](n,r,o),m=this[t==="y"?"_x":"_y"](n,r,o),g=s*uH(n.scales[t]),{multiple:y=Math.max(1,Math.floor(Math.sqrt(h/g)))}=this,x=Math.min(h/y,g*y),b=g*y,w=t==="y"?([M,k])=>[M*x,-k*b]:([M,k])=>[k*b,M*x],_=(h-y*x)/2,v=typeof m=="function"?M=>m(M)+_:m+_,A=n[t](0),E=Rk(),T=u.createElementNS(un.svg,"pattern");T.setAttribute("width",t==="y"?x:b),T.setAttribute("height",t==="y"?b:x),T.setAttribute("patternUnits","userSpaceOnUse");let $=T.appendChild(u.createElementNS(un.svg,"rect"));return $.setAttribute("x",a/2),$.setAttribute("y",a/2),$.setAttribute("width",(t==="y"?x:b)-a),$.setAttribute("height",(t==="y"?b:x)-a),c!=null&&$.setAttribute("rx",c),f!=null&&$.setAttribute("ry",f),st("svg:g",i).call(xt,this,o,i).call(this._transform,this,n).call(M=>M.selectAll().data(e).enter().append(()=>T.cloneNode(!0)).attr("id",k=>`${E}-${k}`).select("rect").call(dt,this).call(Tt,this,r)).call(M=>M.selectAll().data(e).enter().append("path").attr("transform",t==="y"?$r`translate(${v},${A})`:$r`translate(${A},${v})`).attr("d",k=>`M${W3(l(p[k]/s),l(d[k]/s),y).map(w).join("L")}Z`).attr("fill",k=>`url(#${E}-${k})`).attr("stroke",this.stroke==null?null:k=>`url(#${E}-${k})`)).node()}}function W3(t,e,n){if(t<0||e<0){let r=Math.ceil(-Math.min(t,e)/n);return W3(t+r*n,e+r*n,n).map(([o,i])=>[o,i-r])}return e<t?W3(e,t,n):[[0,Math.ceil(t/n)],[Math.floor(t%n),Math.ceil(t/n)],[Math.floor(t%n),Math.floor(t/n)+t%1],[Math.ceil(t%n),Math.floor(t/n)+t%1],...t%n>n-1?[]:[[Math.ceil(t%n),Math.floor(t/n)],[n,Math.floor(t/n)]],[n,Math.floor(e/n)],[Math.ceil(e%n),Math.floor(e/n)],[Math.ceil(e%n),Math.floor(e/n)+e%1],[Math.floor(e%n),Math.floor(e/n)+e%1],...e%n<1?[]:[[Math.floor(e%n),Math.ceil(e/n)],[0,Math.ceil(e/n)]]]}function IR(t){if(t===void 0||t===!1)return Number;if(t===!0)return Math.round;if(typeof t!="function")throw new Error(`invalid round: ${t}`);return t}function $R(t){return t===void 0?void 0:Math.max(1,Math.floor(t))}function uH({domain:t,range:e}){return AR(e)/AR(t)}function AR(t){let[e,n]=Rt(t);return n-e}function CR(t,e={}){return si(e)||(e={...e,y:Xt,x2:V}),new Md(t,ms(If(ds(e))))}function kR(t,e={}){return si(e)||(e={...e,x:Xt,y2:V}),new Ad(t,gs($f(hs(e))))}var YR=WD(zR(),1);var bH=({marginLeft:t})=>[1,t],wH=({width:t,marginRight:e})=>[-1,t-e],vH=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],_H=({marginTop:t})=>[1,t],SH=({height:t,marginBottom:e})=>[-1,t-e],MH=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function UR(t){return typeof t=="string"?{anchor:t}:t}function jR(t={},e={}){arguments.length===1&&([t,e]=GR(t));let{anchor:n="left",padding:r=1,r:o=e.r}=UR(t);switch(`${n}`.toLowerCase()){case"left":n=bH;break;case"right":n=wH;break;case"middle":n=vH;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return VR("x","y",n,Ot(r),o,e)}function XR(t={},e={}){arguments.length===1&&([t,e]=GR(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=UR(t);switch(`${n}`.toLowerCase()){case"top":n=_H;break;case"bottom":n=SH;break;case"middle":n=MH;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return VR("y","x",n,Ot(r),o,e)}function GR(t){let{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function VR(t,e,n,r,o,i){if(o!=null&&typeof o!="number"){let{channels:s,sort:a,reverse:c}=i;s=Np(s),s?.r===void 0&&(i={...i,channels:{...s,r:{value:o,scale:"r"}}}),a===void 0&&c===void 0&&(i.sort={channel:"-r"})}return Vt(i,function(s,a,c,f,l,u){let{[e]:p,r:d}=c;if(!c[e])throw new Error(`missing channel: ${e}`);({[e]:p}=ho(c,f,u));let h=d?void 0:o!==void 0?Ot(o):this.r!==void 0?this.r:3;d&&(d=ut(d.value,f[d.scale]||V,Float64Array));let[m,g]=n(l),y=m?TH:AH,x=new Float64Array(p.length),b=d?w=>d[w]:()=>h;for(let w of a){let _=(0,YR.default)();w=w.filter(d?A=>af(p[A])&&bn(d[A]):A=>af(p[A]));let v=new Float64Array(2*w.length+2);for(let A of w){let E=b(A),T=m?E+r:0,$=p[A]-E,M=p[A]+E,k=2;_.queryInterval($-r,M+r,([,,S])=>{let I=x[S]-T,C=p[A]-p[S],N=r+(d?d[A]+d[S]:2*h),D=Math.sqrt(N*N-C*C);v[k++]=I-D,v[k++]=I+D});let R=v.slice(0,k);m&&(R=R.filter(S=>S>=0));t:for(let S of R.sort(y)){for(let I=0;I<k;I+=2)if(v[I]+1e-6<S&&S<v[I+1]-1e-6)continue t;x[A]=S+T;break}_.insert([$,M,A])}}m||(m=1);for(let w of a)for(let _ of w)x[_]=x[_]*m+g;return{data:s,facets:a,channels:{[t]:{value:x,source:null},[e]:{value:p,source:c[e]},...d&&{r:{value:d,source:c.r}}}}})}function AH(t,e){return Math.abs(t)-Math.abs(e)}function TH(t,e){return t-e}function HR(t,e){return arguments.length===1&&({basis:t,...e}=t),Yf(i1(t),e)}function ZR(t,e){return arguments.length===1&&({basis:t,...e}=t),Uf(i1(t),e)}function i1(t){if(t===void 0)return WR;if(typeof t=="function")return s1(df(t));if(/^p\d{2}$/i.test(t))return Jf(pf(t));switch(`${t}`.toLowerCase()){case"deviation":return $H;case"first":return WR;case"last":return IH;case"max":return CH;case"mean":return kH;case"median":return NH;case"min":return OH;case"sum":return RH;case"extent":return EH}throw new Error(`invalid basis: ${t}`)}function s1(t){return{mapIndex(e,n,r){let o=+t(e,n);for(let i of e)r[i]=n[i]===null?NaN:n[i]/o}}}function Jf(t){return s1((e,n)=>t(e,r=>n[r]))}var EH={mapIndex(t,e,n){let[r,o]=Rt(t,s=>e[s]),i=o-r;for(let s of t)n[s]=e[s]===null?NaN:(e[s]-r)/i}},WR=s1((t,e)=>{for(let n=0;n<t.length;++n){let r=e[t[n]];if(Jt(r))return r}}),IH=s1((t,e)=>{for(let n=t.length-1;n>=0;--n){let r=e[t[n]];if(Jt(r))return r}}),$H={mapIndex(t,e,n){let r=Fo(t,i=>e[i]),o=nr(t,i=>e[i]);for(let i of t)n[i]=e[i]===null?NaN:o?(e[i]-r)/o:0}},CH=Jf(Ct),kH=Jf(Fo),NH=Jf(_r),OH=Jf(Bt),RH=Jf(Ue);function QR(t,e){return KR("x",t,e)}function JR(t,e){return KR("y",t,e)}function KR(t,e,n={}){let r,o=1;if(typeof e=="number")o=e,r=(f,l)=>+f+l;else{if(typeof e=="string"){let f=e.startsWith("-")?-1:1;[e,o]=Dy(e.replace(/^[+-]/,"")),o*=f}e=mf(e),r=(f,l)=>e.offset(f,l)}let i=`${t}1`,s=`${t}2`,a=kn({[i]:f=>f.map(l=>r(l,o)),[s]:f=>f},n),c=a[s].transform;return a[s].transform=()=>{let f=c(),[l,u]=Rt(f);return f.domain=o<0?[l,r(u,o)]:[r(l,o),u],f},a}function tL(t,e={}){if(typeof t=="string")switch(t.toLowerCase()){case"first":return Id(e);case"last":return $d(e)}if(typeof t=="function")return Ms(null,t,e);let n,r;for(n in t){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=LH(t[n])}if(r===void 0)throw new Error(`invalid selector: ${t}`);return Ms(n,r,e)}function LH(t){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"min":return tS;case"max":return eS}throw new Error(`unknown selector: ${t}`)}function Id(t){return Ms(null,DH,t)}function $d(t){return Ms(null,PH,t)}function a1(t){return Ms("x",tS,t)}function c1(t){return Ms("y",tS,t)}function f1(t){return Ms("x",eS,t)}function l1(t){return Ms("y",eS,t)}function*DH(t){yield t[0]}function*PH(t){yield t[t.length-1]}function*tS(t,e){yield km(t,n=>e[n])}function*eS(t,e){yield Ws(t,n=>e[n])}function Ms(t,e,n){if(t!=null){if(n[t]==null)throw new Error(`missing channel: ${t}`);t=n[t]}let r=nn(n);return be(n,(o,i)=>{let s=ut(o,r),a=ut(o,t),c=[];for(let f of i){let l=[];for(let u of s?ze(f,p=>s[p]).values():[f])for(let p of e(u,a))l.push(p);c.push(l)}return{data:o,facets:c}})}pt.prototype.plot=function({marks:t=[],...e}={}){return Pf({...e,marks:[...t,this]})};var FH=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function qH(t,e,n){for(let r=0;r<e.length;++r){let o=e[r];r===e.length-1?t[o]=n:t=t[o]||(t[o]={})}}function eL(t,e,n){for(let r in t){let o=FH.get(r);if(o==null)throw new Error(`Unrecognized plot attribute: ${r}`);let i=t[r];typeof i=="symbol"?n.push(r):i!==void 0&&qH(e,o.split("."),i)}}var BH=new Set(["frame","hexgrid","sphere","graticule"]),zH=new Map([["first",Id],["last",$d],["maxX",f1],["maxY",l1],["minX",a1],["minY",c1],["nearest",ls],["nearestX",us],["nearestXY",mi]]);async function rL(t){let e={marks:[]},n=[],{attributes:r,marks:o}=t;eL(r,e,n);let i=[];for(let a of o)for(let{type:c,data:f,options:l}of a.plotSpecs()){let{select:u,...p}=l,d=zH.get(u)?.(p)??p,h=BH.has(c)?[d]:[f,d];e.marks.push(nS[c](...h)),i.push(a.index)}UH(e,t);let s=Pf(e);jH(s,i),YH(t,s,r,n);for(let a of t.interactors)await a.init(s);return s}function YH(t,e,n,r){r.forEach(o=>{let i=n[o];if(i===qr){if(!o.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${o}`);let s=o.slice(0,-6),a=e.scale(s);a?.domain&&t.setAttribute(o,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${i}`)})}function UH(t,e){let{marks:n}=e;u1("x",t,n),u1("y",t,n),u1("fx",t,n),u1("fy",t,n)}function u1(t,e,n){let r=e[t]||{};if(r.axis===null||r.label!==void 0)return;let o=n.map(f=>f.channelField(t)?.field);if(o.every(f=>f==null))return;let i,s,a;for(let f=0;f<o.length;++f){let{column:l,label:u}=o[f]||{};l===void 0&&u===void 0||(i===void 0&&s===void 0?(i=l,s=u,a=XH(n[f].data,t)||"number"):s!==u?s=void 0:i!==l&&(i=void 0))}let c=s||i;if(c!==void 0){if((a==="number"||a==="date")&&(t==="x"||t==="y")){r.percent&&(c=`${c} (%)`);let f=(t==="x"?1:-1)*(r.reverse?-1:1);t==="x"||r.labelAnchor==="center"?c=t==="x"==f<0?`\u2190 ${c}`:`${c} \u2192`:c=`${f<0?"\u2191 ":"\u2193 "}${c}`}e[t]={...r,label:c}}}function jH(t,e){let n=t.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)nL(r,e);else nL(t,e)}function nL(t,e){let n=-1;for(let r of t.children){let o=r.getAttribute("aria-label")||"";r.nodeName==="style"||o.includes("-axis")||o.includes("-grid")||r.setAttribute("data-index",e[++n])}}function XH(t,e){if(!t)return;let{columns:n}=t,r=n[e]??n[e+"1"]??n[e+"2"];if(r){for(let o of r)if(o!=null)return o instanceof Date?"date":typeof o}}var GH={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Cd=class{constructor(e){this.attributes={...GH},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=e||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=Q2()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:e,right:n}=this.margins();return this.getAttribute("width")-e-n}innerHeight(e=400){let{top:n,bottom:r}=this.margins(),o=this.getAttribute("height");return o==null&&(o=VH(this,n,r)||e,this.setAttribute("height",o,{silent:!0})),o-n-r}pending(e){this.synch.pending(e)}update(e){return this.synch.ready(e)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let e=await rL(this),n=this.legends.flatMap(({legend:r,include:o})=>{let i=r.init(e);return o?i:[]});this.element.replaceChildren(e,...n),this.synch.resolve()}getAttribute(e){return this.attributes[e]}setAttribute(e,n,r){return Yl(this.attributes[e],n)?(n===void 0?delete this.attributes[e]:this.attributes[e]=n,r?.silent||this.listeners?.get(e)?.forEach(o=>o(e,n)),!0):!1}addAttributeListener(e,n){let r=this.listeners||(this.listeners=new Map);return r.has(e)||r.set(e,new Set),r.get(e).add(n),this}removeAttributeListener(e,n){return this.listeners?.get(e)?.delete(n)}addParams(e,n){let{params:r}=this;for(let o of n)r.has(o)?r.get(o).push(e):(r.set(o,[e]),o.addEventListener("value",()=>Promise.allSettled(r.get(o).map(i=>i.initialize()))))}addMark(e){return e.setPlot(this,this.marks.length),this.marks.push(e),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(e){return this.interactors.push(e),this}addLegend(e,n=!0){e.setPlot(this),this.legends.push({legend:e,include:n})}};function VH(t,e,n){let r=t.getAttribute("aspectRatio");if(r==null)return;let o=t.getAttribute("xDomain"),i=t.getAttribute("yDomain");if(!o||!i)return;let s=Math.abs(o[1]-o[0]);return Math.abs(i[1]-i[0])*t.innerWidth()/(r*s)+e+n}function p1(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),t==="none"||t==="currentcolor"||t.startsWith("url(")&&t.endsWith(")")||t.startsWith("var(")&&t.endsWith(")")||Pn(t)!==null)}var WH=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function oL(t){return WH.has(t)}var HH=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function iL(t){return HH.has(`${t}`.toLowerCase())}var sL=t=>t==="stroke"||t==="fill",ZH=t=>/opacity$/i.test(t),QH=t=>t==="symbol",JH=(t,e)=>t!=="sort"&&t!=="tip"&&e!=null&&!Array.isArray(e),rS=(t,e)=>({channel:t,field:e,as:e instanceof An?e.column:t}),oS=(t,e)=>({channel:t,value:e}),d1=t=>Array.isArray(t),Me=class extends _n{constructor(e,n,r,o={}){super(n?.options?.filterBy),this.type=e,this.reqs=o,this.source=n,d1(this.source)&&(this.data=In(this.source));let i=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(f,l)=>{let u=typeof l;if(f==="channels")for(let p in l)s.add(p),c(p,l[p]);else if(u==="function"&&l[Ul]){let p=l(this,f);for(let d in p)c(d,p[d])}else if(u==="string")oL(f)||sL(f)&&p1(l)||QH(f)&&iL(l)?i.push(oS(f,l)):i.push(rS(f,Ii(l)));else if(Co(l))if(Array.isArray(l.columns))i.push(rS(f,l)),a.add(l);else{let p=oS(f,l.value);i.push(p),l.addEventListener("value",d=>(p.value=d,this.update()))}else u==="object"&&JH(f,l)?i.push(rS(f,l)):l!==void 0&&i.push(oS(f,l))};for(let f in r)c(f,r[f])}setPlot(e,n){this.plot=e,this.index=n,e.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||d1(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(e){return this.channels.find(n=>n.channel===e)}channelField(e,{exact:n=!1}={}){let r=n?this.channel(e):this.channels.find(o=>o.channel.startsWith(e));return r?.field?r:null}fields(){if(this.hasOwnData())return null;let{source:{table:e},channels:n,reqs:r}=this,o=new Map;for(let{channel:i,field:s}of n){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,f=o.get(c)??o.set(c,new Set).get(c);a.forEach(l=>f.add(l)),r[i]?.forEach(l=>f.add(l))}return Array.from(o,([i,s])=>({table:e,column:i,stats:s}))}fieldInfo(e){let n=Object.fromEntries(e.map(r=>[r.column,r]));for(let r of this.channels){let{field:o}=r;o&&Object.assign(r,n[o.stats?.column??o])}return this._fieldInfo=!0,this}query(e=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return kd(n,r).where(e)}queryPending(){return this.plot.pending(this),this}queryResult(e){return this.data=In(e),this}update(){return this.plot.update(this)}plotSpecs(){let{type:e,data:n,detail:r,channels:o}=this;return iS(e,r,o,n)}};function on(t,e){let n=e?.[t.as]??t.as;return Object.hasOwn(t,"value")?t.value:sL(t.channel)?{value:n,scale:"color"}:ZH(t.channel)?{value:n,scale:"opacity"}:n}function kd(t,e,n=[]){let r=ft.from({source:e}),o=new Set,i=!1;for(let s of t){let{channel:a,field:c,as:f}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)i=!0;else{if(o.has(f))continue;o.add(f)}r.select({[f]:c})}}}return i&&r.groupby(Array.from(o)),r}function iS(t,e,n,r,o={}){let{numRows:i,values:s,columns:a}=r??{},c={};for(let u of n){let p=e.has(u.channel)?c:o;p[u.channel]=on(u,a)}return e.size&&(o.channels=c),[{type:t,data:s??(r?{length:i}:null),options:o}]}function Ga(t,e){let{plot:n}=t,r=n.getAttribute(`${e}Scale`);if(!r){let{type:i}=t.channelField(e);r=i==="date"?"time":"linear"}let o={type:r};switch(r){case"log":o.base=n.getAttribute(`${e}Base`)??10;break;case"pow":o.exponent=n.getAttribute(`${e}Exponent`)??1;break;case"symlog":o.constant=n.getAttribute(`${e}Constant`)??1;break}return Fl(o)}function Hn(t,e,n,r,o=1,i){let{field:s}=t.channelField(e);i=i??s;let{type:a,apply:c,sqlApply:f}=Ga(t,e),l=!!t.plot.getAttribute(`${e}Reverse`),[u,p]=r.map(x=>c(x)),d=f(i),h=a==="time"||a==="utc"?d:i,m=p===u?0:(n-o)/(p-u),g=m!==1?` * ${m}::DOUBLE`:"";return[l?U`(${p} - ${d}::DOUBLE)${g}`:U`(${d}::DOUBLE - ${u})${g}`,h]}var sS={x:["min","max"]},aS={y:["min","max"]},h1={...sS,...aS};function aL(t,e,n,r,o){let{plot:i}=t,s=i.getAttribute(r),a=i.getAttribute(o);if(Array.isArray(s)&&!s[qe])return s;{let{column:c,min:f,max:l}=t.channelField(n),u=cS(e,c)||(a?Wo().domain([f,l]).nice().domain():[f,l]);return s!==qr&&(u[qe]=!0),i.setAttribute(r,u,{silent:!0}),u}}function vo(t,e){return aL(t,e,"x","xDomain","xNice")}function _o(t,e){return aL(t,e,"y","yDomain","yNice")}function cS(t,e){if(!t)return;let n,r,o=(i,s)=>{if(i==="BETWEEN"&&`${s.field}`===e){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(t)?t.forEach(i=>i.visit?.(o)):t.visit&&t.visit(o),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Nd=class extends Me{constructor(e,n,r){let o=e.endsWith("X")?"y":e.endsWith("Y")?"x":null,i=o?{[o]:["min","max"]}:void 0;super(e,n,r,i),this.dim=o}query(e=[]){let{plot:n,dim:r,source:o}=this,{optimize:i=!0}=o.options||{},s=super.query(e);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:f,as:l,type:u,min:p,max:d}=this.channelField(r);if(i&&(u==="date"||u==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[g,y]=cS(e,f)||[p,d],[x]=Hn(this,r,m,[g,y],1,l),b=s.select().map(w=>w.as).filter(w=>w!==l&&w!==c);return KH(s,x,l,c,b)}else return s.orderby(f)}};function KH(t,e,n,r,o=[]){let i=U`FLOOR(${e})::INTEGER`,s=a=>ft.from(t).select(a).groupby(i,o);return ft.union(s([{[n]:tr(n),[r]:lc(r,n)},...o]),s([{[n]:Kn(n),[r]:uc(r,n)},...o]),s([{[n]:lc(n,r),[r]:tr(r)},...o]),s([{[n]:uc(n,r),[r]:Kn(r)},...o])).orderby(o,n)}function cL(t,e=[]){return new e.constructor(t)}function fL(t,e,n){let r=cL(t,n),o=n.length;for(let i=0;i<o;++i)r[e[i]]=n[i];return r}function lL(t,e,n,r,o,i,s){let a=n.length,c=t*e,f=o.map(d=>r[d]),l={},u=[],p=new Int32Array(a);if(i?.length){let d=i.map(m=>r[m]),h={};for(let m=0;m<a;++m){let g=d.map(y=>y[m]);p[m]=h[g]??=u.push(g)-1}for(let m=0;m<i.length;++m)l[i[m]]=u.map(g=>g[m])}else u.push([]);if(s){let d=n.map(g=>g%t),h=n.map(g=>Math.floor(g/t)),m=u.map(()=>[]);for(let g=0;g<a;++g)m[p[g]].push(g);o.forEach((g,y)=>{let x=f[y];l[g]=u.map((b,w)=>s(m[w],t,e,d,h,x))})}else o.forEach((d,h)=>{let m=f[h],g=l[d]=u.map(()=>cL(c,m));for(let y=0;y<a;++y)g[p[y]][n[y]]=m[y]});return{numRows:u.length,columns:l}}function Od(t){let e=1/0,n=-1/0;return t.forEach(r=>{let o=r.length;for(let i=0;i<o;++i){let s=r[i];s<e&&(e=s),s>n&&(n=s)}}),Number.isFinite(e)&&Number.isFinite(n)?[e,n]:[0,1]}function uL(t){let e=new fn;return t.forEach(n=>{let r=n.length;for(let o=0;o<r;++o)e.add(n[o])}),Array.from(e).sort(gt)}function le(t,e){return En(t)?(t.addEventListener("value",e),t.value):t}function Rd(t,e=!1){let n=new Float64Array(5),r=new Float64Array(4);tZ(n,r,t);let o=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]),i=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/i,a=(o[1]+o[2]+o[3]+o[4])/i;return{sigma:t,negative:e,a:n,b_causal:r,b_anticausal:o,sum_causal:s,sum_anticausal:a}}function tZ(t,e,n){let o=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,f=Float64Array.of(-i*Math.cos(a),i*Math.sin(a),-i*Math.cos(-a),i*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),l=n*2.5066282746310007,u=Float64Array.of(o[0],o[1],0,0,0,0,0,0),p=Float64Array.of(1,0,f[0],f[1],0,0,0,0,0,0),d,h;for(h=2;h<8;h+=2){for(u[h]=f[h]*u[h-2]-f[h+1]*u[h-1],u[h+1]=f[h]*u[h-1]+f[h+1]*u[h-2],d=h-2;d>0;d-=2)u[d]+=f[h]*u[d-2]-f[h+1]*u[d-1],u[d+1]+=f[h]*u[d-1]+f[h+1]*u[d-2];for(d=0;d<=h;d+=2)u[d]+=o[h]*p[d]-o[h+1]*p[d+1],u[d+1]+=o[h]*p[d+1]+o[h+1]*p[d];for(p[h+2]=f[h]*p[h]-f[h+1]*p[h+1],p[h+3]=f[h]*p[h+1]+f[h+1]*p[h],d=h;d>0;d-=2)p[d]+=f[h]*p[d-2]-f[h+1]*p[d-1],p[d+1]+=f[h]*p[d-1]+f[h+1]*p[d-2]}for(h=0;h<4;++h)d=h<<1,e[h]=u[d]/l,t[h+1]=p[d+2]}function pL(t,e,n,[r,o]){let i=new Float64Array(Math.max(r,o)),s=new Float64Array(Math.max(r,o)),a=new Float64Array(5),c=new Float64Array(n.length);for(let f=0,l=0;f<o;++f,l+=r){let u=c.subarray(l);m1(t,n.subarray(l),r,1,i,s,a,u)}for(let f=0;f<r;++f){let l=c.subarray(f);m1(e,l,o,r,i,s,a,l)}return c}function m1(t,e,n,r=1,o=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(5),a=o,c=eZ){let f=r*2,l=r*3,u=r*4,p=r*n,d,h;for(c(o,e,n,r,t.b_causal,3,t.a,4,t.sum_causal,s,t.sigma),h=4,d=u;h<n;++h,d+=r)o[h]=t.b_causal[0]*e[d]+t.b_causal[1]*e[d-r]+t.b_causal[2]*e[d-f]+t.b_causal[3]*e[d-l]-t.a[1]*o[h-1]-t.a[2]*o[h-2]-t.a[3]*o[h-3]-t.a[4]*o[h-4];for(c(i,e,n,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,s,t.sigma),h=4,d=p-r*5;h<n;++h,d-=r)i[h]=t.b_anticausal[1]*e[d+r]+t.b_anticausal[2]*e[d+f]+t.b_anticausal[3]*e[d+l]+t.b_anticausal[4]*e[d+u]-t.a[1]*i[h-1]-t.a[2]*i[h-2]-t.a[3]*i[h-3]-t.a[4]*i[h-4];if(t.negative)for(h=0,d=0;h<n;++h,d+=r)a[d]=o[h]+i[n-h-1];else for(h=0,d=0;h<n;++h,d+=r)a[d]=Math.max(0,o[h]+i[n-h-1]);return a}function eZ(t,e,n,r,o,i,s,a,c,f,l,u=.5){let p=Math.abs(r)*n,d=r<0?p+r:0,h,m,g;for(m=0;m<=a;++m)for(f[m]=m<=i?o[m]:0,g=1;g<=a&&g<=m;++g)f[m]-=s[g]*f[m-g];for(g=0;g<a;++g)for(t[g]=0,m=1;m<=g;++m)h=d+r*m,h>=0&&h<p&&(t[g]+=f[g-m]*e[h]);let y=e[d],x=Math.ceil(l*10);for(m=0;m<x;++m){for(g=0;g<a;++g)t[g]+=f[g]*y;if(c-=Math.abs(f[0]),c<=u)break;for(f[a]=m+a<=i?o[m+a]:0,g=1;g<=a;++g)f[a]-=s[g]*f[a-g];for(g=0;g<a;++g)f[g]=f[g+1]}}var vi="density",Cr=class extends Me{constructor(e,n,r){let{bandwidth:o=0,interpolate:i="none",pixelSize:s=1,pad:a=1,width:c,height:f,...l}=r,u=nZ(l);super(e,n,l,h1),this.densityMap=u,this.bandwidth=le(o,p=>(this.bandwidth=p,this.grids?this.convolve().update():null)),this.interpolate=le(i,p=>(this.interpolate=p,this.requestUpdate())),this.pixelSize=le(s,p=>(this.pixelSize=p,this.requestUpdate())),this.pad=le(a,p=>(this.pad=p,this.requestUpdate())),this.width=le(c,p=>(this.width=p,this.requestUpdate())),this.height=le(f,p=>(this.height=p,this.requestUpdate()))}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};e.addAttributeListener("xDomain",r),e.addAttributeListener("yDomain",r),super.setPlot(e,n)}get filterIndexable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[qe]&&!n[qe]}query(e=[]){let{interpolate:n,pad:r,channels:o,densityMap:i,source:s}=this,[a,c]=this.extentX=vo(this,e),[f,l]=this.extentY=_o(this,e),[u,p]=this.bins=this.binDimensions(),[d,h]=Hn(this,"x",u,[a,c],r),[m,g]=Hn(this,"y",p,[f,l],r),y=r?[ue(h,[+a,+c]),ue(g,[+f,+l])]:[Ro(+a,h),Oo(h,+c),Ro(+f,g),Oo(g,+l)],x=ft.from(s.table).where(e.concat(y)),b=this.groupby=[],w={};for(let v of o)if(Object.hasOwn(v,"field")){let{as:A,channel:E,field:T}=v;T.aggregate?(w[E]=T,i[E]=!0):E==="weight"?w[vi]=Ln(T):E!=="x"&&E!=="y"&&(x.select({[A]:T}),b.push(A))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(vi),w.density=sn()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return iZ(x,d,m,w[vi],u,b)}else return oZ(x,d,m,w,u,b)}binDimensions(){let{plot:e,pixelSize:n,width:r,height:o}=this;return[r??Math.round(e.innerWidth()/n),o??Math.round(e.innerHeight()/n)]}queryResult(e){let[n,r]=this.bins,o=rZ(this.interpolate),{columns:i}=In(e);return this.grids0=lL(n,r,i.index,i,this.aggr,this.groupby,o),this.convolve()}convolve(){let{aggr:e,bandwidth:n,bins:r,grids0:o,plot:i}=this;if(this.grids=o,n>0){let s=e.length===1?e[0]:e.includes(vi)?vi:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.columns[s],c=i.innerWidth(),f=i.innerHeight(),[l,u]=r,p=a.some(m=>m.some(g=>g<0)),d=Rd(n*(l-1)/c,p),h=Rd(n*(u-1)/f,p);this.grids={numRows:o.numRows,columns:{...o.columns,[s]:a.map(m=>pL(d,h,m,r))}}}return this}};function nZ(t){let e={};for(let n in t)t[n]==="density"&&(delete t[n],e[n]=!0);return e}function rZ(t="none"){if(typeof t=="function")return t;switch(t.toLowerCase()){case"none":case"linear":return;case"nearest":return hd;case"barycentric":return dd();case"random-walk":return md()}throw new Error(`invalid interpolate: ${t}`)}function oZ(t,e,n,r,o,i){return t.select({index:U`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function iZ(t,e,n,r,o,i){let s=r?.column?`* ${r.column}`:"",a=(p,d)=>t.clone().select({xp:e,yp:n,i:p,w:d}),c=a(U`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(U`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),l=a(U`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),u=a(U`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,f,l,u)).select({index:"i",density:Ln("w")},i).groupby("index",i).having(Bs("density",0))}var Ld=class extends Cr{constructor(e,n){let{thresholds:r=10,...o}=n;super("geo",e,{bandwidth:20,interpolate:"linear",pixelSize:2,...o}),this.thresholds=le(r,i=>(this.thresholds=i,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:e,densityMap:n,grids:r,thresholds:o,plot:i}=this,{numRows:s,columns:a}=r,c=o,f;if(Array.isArray(c))f=c;else{let[,M]=Od(a.density);f=Array.from({length:c-1},(k,R)=>M*(R+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[l,u]=e,[p,d]=i.getAttribute("xDomain"),[h,m]=i.getAttribute("yDomain"),g=(d-p)/l,y=(m-h)/u,x=+p,b=+h,w=M=>x+M*g,_=M=>b+M*y,v=qi().size(e),A=this.contourData=Array(s*f.length),{density:E,...T}=a,$=Object.entries(T);for(let M=0,k=0;M<s;++M){let R=E[M],S=$.reduce((I,[C,N])=>(I[C]=N[M],I),{});for(let I=0;I<f.length;++I,++k)A[k]=Object.assign(sZ(v.contour(R,f[I]),w,_),S)}return this}plotSpecs(){let{type:e,channels:n,densityMap:r,contourData:o}=this,i={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(i[a]=on(s))}for(let s in r)r[s]&&(i[s]=on({channel:s,as:"value"}));return[{type:e,data:o,options:i}]}};function sZ(t,e,n){function r(s){s.forEach(o)}function o(s){s.forEach(i)}function i(s){s[0]=e(s[0]),s[1]=n(s[1])}return t.coordinates.forEach(r),t}function Dd(t){return Array.from({length:t},(e,n)=>n)}function g1(t,e){let n=e.reduce((o,i,s)=>(o[i]=s,o),{}),r=Dd(t.length);return r.sort((o,i)=>n[t[o]]-n[t[i]]),r}function y1(t,e){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",t),n.setAttribute("height",e),n}throw new Error("Can not create a canvas instance.")}function dL(t=1){let e=255*t|0;return(n,r,o)=>{for(let i=0,s=0;i<o;++i)for(let a=0;a<r;++a,s+=4)n[s+3]=e}}function hL(t){let{apply:e}=t;return(n,r,o,i)=>{for(let s=0,a=0;s<o;++s)for(let c=0,f=(o-s-1)*r;c<r;++c,a+=4)n[a+3]=255*e(i[c+f])|0}}function mL(t={}){let{r:e=0,g:n=0,b:r=0,opacity:o=1}=typeof t=="string"?ve(t):t,i=new Uint8ClampedArray([e,n,r,255*o|0]);return(s,a,c)=>{for(let f=0,l=0;f<c;++f)for(let u=0;u<a;++u,l+=4)s[l+0]=i[0],s[l+1]=i[1],s[l+2]=i[2],s[l+3]=i[3]}}function gL(t){let{domain:e,range:n}=t,r=Object.create(null),o=new Uint8ClampedArray(4*e.length),i=e.length-1,s=n.length;for(let a=0;a<=i;++a){let c=n[a%s],{r:f,g:l,b:u,opacity:p=1}=typeof c=="string"?ve(c):c,d=a<<2;o[d+0]=f,o[d+1]=l,o[d+2]=u,o[d+3]=255*p|0,r[e[a]]=d}return(a,c,f,l)=>{if(l.map)for(let u=0,p=0;u<f;++u)for(let d=0,h=(f-u-1)*c;d<c;++d,p+=4){let m=r[l[d+h]];a[p+0]=o[m+0],a[p+1]=o[m+1],a[p+2]=o[m+2],a[p+3]=o[m+3]}else{let u=r[l];for(let p=0,d=0;p<f;++p)for(let h=0;h<c;++h,d+=4)a[d+0]=o[u+0],a[d+1]=o[u+1],a[d+2]=o[u+2],a[d+3]=o[u+3]}}}function yL(t,e,n){let{interpolate:r}=e,o=new Uint8ClampedArray(4*t),i=t-1;for(let s=0;s<=i;++s){let a=r(s/i),{r:c,g:f,b:l,opacity:u=1}=typeof a=="string"?ve(a):a,p=s<<2;o[p+0]=c,o[p+1]=f,o[p+2]=l,o[p+3]=255*u|0}return(s,a,c,f)=>{for(let l=0,u=0;l<c;++l)for(let p=0,d=(c-l-1)*a;p<a;++p,u+=4){let h=i*n(f[p+d])<<2;s[u+0]=o[h+0],s[u+1]=o[h+1],s[u+2]=o[h+2],s[u+3]=o[h+3]}}}var As=class extends Cr{constructor(e,n){super("image",e,n),this.image=null}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};e.addAttributeListener("schemeColor",r),super.setPlot(e,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:e,grids:n}=this,[r,o]=e,{numRows:i,columns:s}=n,{canvas:a,ctx:c,img:f}=lZ(this,r,o),{alpha:l,alphaProp:u,color:p,colorProp:d}=fS(this),h=s[u]??[],m=s[d]??[],g=i>1&&d&&this.groupby?.includes(d)?g1(m,this.plot.getAttribute("colorDomain")):Dd(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(y,x)=>(p?.(f.data,r,o,m[g[x]]),l?.(f.data,r,o,h[g[x]]),c.putImageData(f,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:e,plot:n,data:{numRows:r,columns:o}}=this,i={src:o.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:e,data:{length:r},options:i}]}},Pd=class extends As{constructor(e,n){super(e,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function fS(t){let{aggr:e,densityMap:n,groupby:r,plot:o}=t,i=e.includes(vi),s=e.includes("fillOpacity"),a=t.channel("fill"),c=t.channel("fillOpacity");if(e.length>2||i&&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 f=n.fill||e.includes("fill")?"grid":r.includes(a?.as)?"group":p1(a?.value)?a.value:i&&o.getAttribute("colorScheme")?"grid":void 0,l=n.fillOpacity||e.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:i&&f!=="grid"?"grid":void 0;if(f!=="grid"&&l!=="grid")throw new Error("Raster mark missing density values.");let u=a?.as??(f==="grid"?vi:null),p=c?.as??(l==="grid"?vi:null),d=f!=="grid"&&f!=="group"?mL(f):cZ(t,u),h=l!=="grid"?dL(l):aZ(t,p);return{alphaProp:p,colorProp:u,alpha:h,color:d}}function aZ(t,e){let{plot:n,grids:r}=t,o=n.getAttribute("opacityDomain"),i=o===qr,s=o?.[qe],a=!i&&!s&&o||Od(r.columns[e]);(i||s||!o)&&(i||(a[qe]=!0),n.setAttribute("opacityDomain",a));let c=is({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 hL(c)}function cZ(t,e){let{plot:n,grids:r}=t,o=r.columns[e],i=!o[0]?.map,s=i||Array.isArray(o[0]),a=n.getAttribute("colorDomain"),c=a===qr,f=a?.[qe],l=!c&&!f&&a||(i?o.slice().sort(gt):s?uL(o):Od(o));(c||f||!a)&&(c||(l[qe]=!0),n.setAttribute("colorDomain",l));let u=is({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(s)return gL(u);{let p=is({x:{type:fZ(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return yL(1024,u,p.apply)}}function fZ(t){return t.endsWith("symlog")?"symlog":t.endsWith("log")?"log":t.endsWith("pow")?"pow":t.endsWith("sqrt")?"sqrt":t==="diverging"?"linear":t}function lZ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=y1(e,n),o=r.getContext("2d",{willReadFrequently:!0}),i=o.getImageData(0,0,e,n);t.image={canvas:r,ctx:o,img:i,w:e,h:n}}return t.image}var Fd=class extends As{constructor(e,n){let{normalize:r=!0,...o}=n;super(e,o),this.normalize=le(r,i=>(this.normalize=i,this.requestUpdate()))}query(e=[]){let{channels:n,normalize:r,source:o,pad:i}=this,[s,a]=this.bins=this.binDimensions(),[c]=Hn(this,"x",s,vo(this,e),i),[f]=Hn(this,"y",a,_o(this,e),i),l=ft.from(o.table).where(uZ(this,e));this.aggr=["density"];let u=this.groupby=[],p=[];for(let d of n)if(Object.hasOwn(d,"field")){let{channel:h,field:m}=d;h==="z"?(l.select({[h]:m}),p.push("z")):h!=="x"&&h!=="y"&&(l.select({[h]:m}),u.push(h))}return pZ(l,c,f,p,s,a,u,r)}};function uZ(t,e){if(Array.isArray(e)&&!e.length)return e;let{column:n}=t.channelField("x"),{column:r}=t.channelField("y"),o=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},i=s=>s.op==="AND"?Tn(s.children.filter(a=>o(a))):s;return Array.isArray(e)?e.filter(s=>o(s)).map(s=>i(s)):i(e)}function pZ(t,e,n,r,o,i,s=[],a=!0){t.select({x:U`FLOOR(${e})::INTEGER`,y:U`FLOOR(${n})::INTEGER`});let c=s.concat(r),f=c.length?`PARTITION BY ${c.join(", ")} `:"",l=ft.from(t).select(c,{x0:"x",y0:"y",dx:U`(lead(x) OVER sw - x)`,dy:U`(lead(y) OVER sw - y)`}).window({sw:U`${f}ORDER BY x ASC`}).qualify(Tn(U`(x0 < ${o} OR x0 + dx < ${o})`,U`(y0 < ${i} OR y0 + dy < ${i})`,U`(x0 > 0 OR x0 + dx > 0)`,U`(y0 > 0 OR y0 + dy > 0)`)),u=ft.select({x:U`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),p=ft.select({i:U`UNNEST(range((${u})))::INTEGER`}),d=ft.unionAll(ft.select(c,{x:U`x0 + i`,y:U`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(U`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),ft.select(c,{x:U`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:U`y0 + SIGN(dy) * i`}).from("pairs","indices").where(U`ABS(dy) > ABS(dx) AND i < ABS(dy)`),ft.select(c,{x:"x0",y:"y0"}).from("pairs").where(qs("dx"))),h=["x"].concat(c).join(", "),m=ft.from("raster").select(c,"x","y",a?{w:U`1.0 / COUNT(*) OVER (PARTITION BY ${h})`}:null).where(Tn(ue("x",[0,o],!0),ue("y",[0,i],!0)));return ft.with({pairs:l,indices:p,raster:d,points:m}).from("points").select(s,{index:U`x + y * ${o}::INTEGER`,density:a?Ln("w"):sn()}).groupby("index",s)}var Kf=class extends Me{constructor(e,n,r){let{bins:o=1024,bandwidth:i=20,...s}=r,a=e.endsWith("X")?"y":"x";super(e,n,s,a==="x"?sS:aS),this.dim=a,this.bins=le(o,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=le(i,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let e=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(e);return n&&!n[qe]}query(e=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:o,source:{table:i}}=this,s=this.extent=(o==="x"?vo:_o)(this,e),[a,c]=Hn(this,o,n,s),f=kd(r,i,[o]).where(e.concat(ue(c,s))),l=this.channelField("weight")?"weight":null;return dZ(f,a,l)}queryResult(e){let{columns:{index:n,density:r}}=In(e);return this.grid=fL(this.bins,n,r),this.convolve()}convolve(){let{bins:e,bandwidth:n,dim:r,grid:o,plot:i,extent:[s,a]}=this,c=o.some(b=>b<0),f=r==="x"?i.innerWidth():i.innerHeight(),l=Rd(n*(e-1)/f,c),u=m1(l,o,e),p=r==="x"?"y":"x",d=this.channelField(r).as,h=+s,m=(a-h)/(e-1),g=1/m,y=new Float64Array(e),x=new Float64Array(e);for(let b=0;b<e;++b)y[b]=h+b*m,x[b]=u[b]*g;return this.data={numRows:e,columns:{[d]:y,[p]:x}},this}plotSpecs(){let{type:e,data:{numRows:n,columns:r},channels:o,dim:i}=this,s=i==="x"?{y:r.y}:{x:r.x};for(let a of o)s[a.channel]=on(a,r);return[{type:e,data:{length:n},options:s}]}};function dZ(t,e,n){let r=n?`* ${n}`:"",o=t.clone().select({p:e,i:U`FLOOR(p)::INTEGER`,w:U`(FLOOR(p) + 1 - p)${r}`}),i=t.clone().select({p:e,i:U`FLOOR(p)::INTEGER + 1`,w:U`(p - FLOOR(p))${r}`});return ft.from(ft.unionAll(o,i)).select({index:"i",density:Ln("w")}).groupby("index").having(Cl("density",0))}var qd=class extends Cr{constructor(e,n){let{type:r="dot",...o}=n;super(r,e,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...o})}convolve(){super.convolve();let{bins:e,pad:n,extentX:r,extentY:o}=this,[i,s]=e,a=Ga(this,"x"),c=Ga(this,"y"),[f,l]=r.map(g=>a.apply(g)),[u,p]=o.map(g=>c.apply(g)),d=(l-f)/(i-n),h=(p-u)/(s-n),m=n?0:.5;return this.data=hZ(this.grids,e,f,u,d,h,a.invert,c.invert,m),this}plotSpecs(){let{type:e,channels:n,densityMap:r,data:{numRows:o,columns:i}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?i[c]:on(a,i)}for(let a in r)r[a]&&(s[a]=i.density);return[{type:e,data:{length:o},options:s}]}};function hZ(t,e,n,r,o,i,s,a,c){let f=1/(o*i),[l,u]=e,p=l*u,d=p*t.numRows,h=new Float64Array(d),m=new Float64Array(d),g=new Float64Array(d),y={x:h,y:m,density:g},{density:x,...b}=t.columns;for(let _ in b)y[_]=new b[_].constructor(d);let w=0;for(let _=0;_<t.numRows;++_){for(let A in b)y[A].fill(b[A][_],w,w+p);let v=x[_];for(let A=0,E=0;E<u;++E)for(let T=0;T<l;++T,++w,++A)h[w]=s(n+(T+c)*o),m[w]=a(r+(E+c)*i),g[w]=v[A]*f}return{numRows:d,columns:y}}function mZ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,l,u,p,d,h,m,g,y;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,l=Math.sqrt(-2*Math.log(f)),d=(2.30753+l*.27061)/(1+l*(.99229+l*.04481))-l,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),g=d*Math.sqrt(h+m)/m-(1/(2*n-1)-1/(2*e-1))*(h+5/6-2/(3*m)),d=e/(e+n*Math.exp(2*g))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),l=Math.exp(e*a)/e,u=Math.exp(n*c)/n,g=l+u,t<l/g?d=Math.pow(e*g*t,1/e):d=1-Math.pow(n*g*(1-t),1/n)),y=-tl(e)-tl(n)+tl(e+n);s<10;s++){if(d===0||d===1)return d;if(p=gZ(d,e,n)-t,l=Math.exp(o*Math.log(d)+i*Math.log(1-d)+y),u=p/l,d-=l=u/(1-.5*Math.min(1,u*(o/d-i/(1-d)))),d<=0&&(d=.5*(d+l)),d>=1&&(d=.5*(d+l+1)),Math.abs(l)<r*d&&s>0)break}return d}function gZ(t,e,n){var r=t===0||t===1?0:Math.exp(tl(e+n)-tl(e)-tl(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?0:t<(e+1)/(e+n+2)?r*xL(t,e,n)/e:1-r*xL(1-t,n,e)/n}function xL(t,e,n){var r=1e-30,o=1,i=e+n,s=e+1,a=e-1,c=1,f=1-i*t/s,l,u,p,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(l=2*o,u=o*(n-o)*t/((a+l)*(e+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,u=-(e+o)*(i+o)*t/((e+l)*(s+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,p=f*c,d*=p,!(Math.abs(p-1)<3e-7));o++);return d}function tl(t){var e=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,o,i,s;for(s=(i=o=t)+5.5,s-=(o+.5)*Math.log(s);e<6;e++)r+=n[e]/++i;return Math.log(2.506628274631*r/o)-s}function bL(t,e){var n=mZ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}function wL(t){let e=-Math.log((1-t)*(1+t)),n;return e<6.25?(e-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*e,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=-1333171662854621e-31+n*e,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=-4054566272975207e-29+n*e,n=-8151934197605472e-29+n*e,n=26335093153082323e-28+n*e,n=-12975133253453532e-27+n*e,n=-5415412054294628e-26+n*e,n=10512122733215323e-25+n*e,n=-4112633980346984e-24+n*e,n=-29070369957882005e-24+n*e,n=42347877827932404e-23+n*e,n=-13654692000834679e-22+n*e,n=-13882523362786469e-21+n*e,n=.00018673420803405714+n*e,n=-.000740702534166267+n*e,n=-.006033670871430149+n*e,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*e,n=-27517406297064545e-23+n*e,n=18239629214389228e-24+n*e,n=15027403968909828e-22+n*e,n=-4013867526981546e-21+n*e,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=-47318229009055734e-21+n*e,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=-.0003550375203628475+n*e,n=.0009532893797373805+n*e,n=-.0016882755560235047+n*e,n=.002491442096107851+n*e,n=-.003751208507569241+n*e,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*e,n=15076572693500548e-25+n*e,n=-3789465440126737e-24+n*e,n=761570120807834e-23+n*e,n=-1496002662714924e-23+n*e,n=2914795345090108e-23+n*e,n=-6771199775845234e-23+n*e,n=22900482228026655e-23+n*e,n=-99298272942317e-20+n*e,n=4526062597223154e-21+n*e,n=-1968177810553167e-20+n*e,n=7599527703001776e-20+n*e,n=-.00021503011930044477+n*e,n=-.00013871931833623122+n*e,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}var el=class extends Me{constructor(e,n,r){let o=e.endsWith("X")?"y":"x",{ci:i=.95,...s}=r;super(e,n,s),this.dim=o,this.field=this.channelField(o).field,this.channels=this.channels.filter(a=>a.channel!==o),this.ci=le(i,a=>(this.ci=a,this.update()))}query(e=[]){let{channels:n,field:r,source:{table:o}}=this,i=n.concat([{field:Nl(r),as:"__avg__"},{field:sn(r),as:"__n__"},{field:Ol(r),as:"__sd__"}]);return kd(i,o).where(e)}queryResult(e){return this.data=In(e),this}plotSpecs(){let{type:e,dim:n,detail:r,data:o,ci:i,channels:s}=this,a=Math.SQRT2*wL(i),{columns:{__avg__:c,__sd__:f,__n__:l}}=o,u={[`${n}1`]:c.map((p,d)=>p-a*f[d]/Math.sqrt(l[d])),[`${n}2`]:c.map((p,d)=>p+a*f[d]/Math.sqrt(l[d]))};return iS(e,r,s,o,u)}};var yZ="geom",Bd=class extends Me{constructor(e,n={},r){!d1(e)&&!n?.geometry&&(n.geometry=Ll(yZ)),super("geo",e,n,r)}queryResult(e){super.queryResult(e);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(o=>JSON.parse(o)))}return this}};var zd=class extends Me{constructor(e,n){let{type:r="hexagon",binWidth:o=20,...i}=n;super(r,e,{r:o/2,clip:!0,...i},h1),this.binWidth=le(o,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[qe]&&!n[qe]}query(e=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:o,source:i}=this,s,a,c=new Set,f={};for(let w of o)if(w.channel!=="orderby"){if(w.channel==="x")s=w;else if(w.channel==="y")a=w;else if(Object.hasOwn(w,"field")){let{as:_,field:v}=w;f[_]=v,v.aggregate||c.add(_)}}let[l,u]=vo(this,e),[p,d]=_o(this,e),h=.5-n.getAttribute("marginLeft"),m=0-n.getAttribute("marginTop"),g=`${r}::DOUBLE`,y=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,x=`${n.innerWidth()/(u-l)}::DOUBLE`,b=`${n.innerHeight()/(d-p)}::DOUBLE`;return ft.select({[s.as]:U`${l}::DOUBLE + ((_x + 0.5 * (_y & 1)) * ${g} + ${h})::DOUBLE / ${x}`,[a.as]:U`${d}::DOUBLE - (_y * ${y} + ${m})::DOUBLE / ${b}`,...f}).groupby("_x","_y",...c).from(ft.select({_py:U`(${b} * (${d}::DOUBLE - ${a.field}) - ${m}) / ${y}`,_pj:U`ROUND(_py)::INTEGER`,_px:U`(${x} * (${s.field} - ${l}::DOUBLE) - ${h}) / ${g} - 0.5 * (_pj & 1)`,_pi:U`ROUND(_px)::INTEGER`,_tt:U`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:U`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:U`CASE WHEN _tt THEN (_pj + CASE WHEN _py < _pj THEN -1 ELSE 1 END)::INTEGER ELSE _pj END`},"*").from(i.table).where(No(s.field),No(a.field),e))}};var Yd=class extends Cr{constructor(e,n){let{origin:r=[0,0],dim:o="xy",...i}=n;super("image",e,i),this.image=null,this.origin=r,this.tileX=o.toLowerCase().includes("x"),this.tileY=o.toLowerCase().includes("y")}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};e.addAttributeListener("schemeColor",r),super.setPlot(e,n)}requestQuery(){return this.requestTiles()}query(e=[]){return this._filter=e,null}tileQuery(e){let{interpolate:n,pad:r,channels:o,densityMap:i,source:s}=this,[[a,c],[f,l]]=e,[u,p]=this.bins,[d,h]=Hn(this,"x",u,[a,c],r),[m,g]=Hn(this,"y",p,[f,l],r),y=r?[ue(h,[+a,+c]),ue(g,[+f,+l])]:[Ro(+a,h),Oo(h,+c),Ro(+f,g),Oo(g,+l)],x=ft.from(s.table).where(y),b=this.groupby=[],w={};for(let v of o)if(Object.hasOwn(v,"field")){let{as:A,channel:E,field:T}=v;T.aggregate?(w[E]=T,i[E]=!0):E==="weight"?w.density=Ln(T):E!=="x"&&E!=="y"&&(x.select({[A]:T}),b.push(A))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),w.density=sn()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return _Z(x,d,m,w.density,u,b)}else return vZ(x,d,m,w,u,b)}async requestTiles(){let e=er();this.prefetch&&e.cancel(this.prefetch);let{pad:n,tileX:r,tileY:o,origin:[i,s]}=this,[a,c]=this.bins=this.binDimensions(),[f,l]=vo(this,this._filter),[u,p]=_o(this,this._filter),d=l-f,h=p-u,m=Math.floor((f-i)*(a-n)/d),g=Math.floor((u-s)*(c-n)/h),y=(M,k)=>[[i+M*d,i+(M+1)*d],[s+k*h,s+(k+1)*h]],x=Math.floor((f-i)/d),b=r?vL((l-i)/d):x,w=Math.floor((u-s)/h),_=o?vL((p-s)/h):w,v=[];for(let M=x;M<=b;++M)for(let k=w;k<=_;++k)v.push([M,k]);let A=v.map(([M,k])=>e.query(this.tileQuery(y(M,k)))),E=[];if(r)for(let M=w;M<=_;++M)E.push([b+1,M]),E.push([x-1,M]);if(o){let M=r?x-1:x,k=r?b+1:b;for(let R=M;R<=k;++R)E.push([R,_+1]),E.push([R,w-1])}this.prefetch=E.map(([M,k])=>e.prefetch(this.tileQuery(y(M,k))));let T=await Promise.all(A),$=xZ(a,c,m,g,v,T);this.grids0={numRows:$.length,columns:{density:[$]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:e,grids:n}=this,[r,o]=e,{numRows:i,columns:s}=n,{canvas:a,ctx:c,img:f}=wZ(this,r,o),{alpha:l,alphaProp:u,color:p,colorProp:d}=fS(this),h=s[u]??[],m=s[d]??[],g=i>1&&d&&this.groupby?.includes(d)?g1(m,this.plot.getAttribute("colorDomain")):Dd(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(y,x)=>(p?.(f.data,r,o,m[g[x]]),l?.(f.data,r,o,h[g[x]]),c.putImageData(f,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:e,plot:n,data:{numRows:r,columns:o}}=this,i={src:o.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:e,data:{length:r},options:i}]}};function xZ(t,e,n,r,o,i){let s=new Float64Array(t*e);return i.forEach((a,c)=>{let[f,l]=o[c],u=f*t-n,p=l*e-r;bZ(t,e,s,a,u,p)}),s}function bZ(t,e,n,r,o,i){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let f=0;f<s;++f){let l=a[f],u=o+l%t,p=i+Math.floor(l/t);0<=u&&u<t&&0<=p&&p<e&&(n[u+p*t]=c[f])}}function wZ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=y1(e,n),o=r.getContext("2d",{willReadFrequently:!0}),i=o.getImageData(0,0,e,n);t.image={canvas:r,ctx:o,img:i,w:e,h:n}}return t.image}function vZ(t,e,n,r,o,i){return t.select({index:U`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function _Z(t,e,n,r,o,i){let s=r.column?`* ${r.column}`:"",a=(p,d)=>t.clone().select({xp:e,yp:n,i:p,w:d}),c=a(U`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(U`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),l=a(U`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),u=a(U`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,f,l,u)).select({index:"i",density:Ln("w")},i).groupby("index",i).having(Bs("density",0))}function vL(t){let e=Math.floor(t);return e===t?e-1:e}var Ud=class extends Me{constructor(e,n){let{ci:r=.95,precision:o=4,...i}=n;super("line",e,i);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=le(r,a=>(this.ci=a,s())),this.precision=le(o,a=>(this.precision=a,s()))}query(e=[]){let n=this.channelField("x").as,r=this.channelField("y").as,o=Array.from(new Set(["stroke","z","fx","fy"].flatMap(i=>this.channelField(i)?.as||[])));return ft.from(super.query(e)).select({intercept:x2(r,n),slope:b2(r,n),n:w2(r,n),ssy:v2(r,n),ssx:_2(r,n),xm:S2(r,n),x0:pc(tr(n).where(No(r))),x1:pc(Kn(n).where(No(r)))}).select(o).groupby(o)}queryResult(e){return this.modelFit=In(e),this.lineData=SZ(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:e,modelFit:n,precision:r,plot:o}=this,i=o.innerWidth();return this.areaData=e?MZ(n,e,r,i):null,this}plotSpecs(){let{lineData:e,areaData:n,channels:r,ci:o}=this,i=e.columns,s=o?n.columns:{},a={x:i.x,y:i.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let f of r)switch(f.channel){case"x":case"y":case"fill":break;case"tip":c.tip=on(f,s);break;case"stroke":a.stroke=on(f,i),c.fill=on(f,s);break;case"strokeOpacity":a.strokeOpacity=on(f,i);break;case"fillOpacity":c.fillOpacity=on(f,s);break;default:a[f.channel]=on(f,i),c[f.channel]=on(f,s);break}return[...o?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:e.numRows},options:a}]}};function lS(t,e){if(t.concat)return t.concat(e);let n=new t.constructor(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function SZ(t){let{x0:e=[],x1:n=[],xm:r,intercept:o,slope:i,n:s,ssx:a,ssy:c,...f}=t.columns,l=(d,h)=>o[h]+d*i[h],u=lS(e,n),p=lS(e.map(l),n.map(l));for(let d in f)f[d]=lS(f[d],f[d]);return{numRows:u.length,columns:{x:u,y:p,...f}}}function MZ(t,e,n,r){let o=t.numRows,{x0:i,x1:s,xm:a,intercept:c,slope:f,n:l,ssx:u,ssy:p,...d}=t.columns,h=Object.keys(d),m={x:[],y1:[],y2:[]};h.forEach(g=>m[g]=[]);for(let g=0;g<o;++g){let y=n*(s[g]-i[g])/r,x=bL((1-e)/2,l[g]-2)*Math.sqrt(p[g]/(l[g]-2));ce(i[g],s[g]-y/2,y).concat(s[g]).forEach(b=>{let w=c[g]+b*f[g],_=x*Math.sqrt(1/l[g]+(b-a[g])**2/u[g]);m.x.push(b),m.y1.push(w-_),m.y2.push(w+_),h.forEach(v=>m[v].push(d[v][g]))})}return{numRows:m.x.length,columns:m}}function _L(t){let e=t.toLowerCase(),n=t.length,r="";for(let o=0;o<n;++o)r+=(t[o]!==e[o]?"-":"")+e[o];return r}function nl(t){let e={};for(let n in t)e[_L(n)]=t[n];return e}function AZ(t){let{channels:e}=t,n=new Set,r=!1,o=!1;for(let i of e){let{channel:s,field:a,as:c}=i;if(s==="orderby")r=!0;else if(a)if(a.aggregate)o=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&o&&n.size&&t.channels.push({channel:"orderby",value:Array.from(n)}),t}var jd=class{constructor(e,{selection:n,channels:r={}}){this.mark=AZ(e),this.selection=n;let o=Object.entries(nl(r));this.channels=o.length?o:[["opacity",.2]],this.selection.addEventListener("value",ml(()=>this.update()))}init(e){this.svg=e;let n=this.values=[],r=this.mark.index,o=this.nodes=e.querySelectorAll(`[data-index="${r}"] > *`),{channels:i}=this;for(let s=0;s<o.length;++s){let a=o[s];n.push(i.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:e,nodes:n,channels:r,values:o,mark:i,selection:s}=this;if(!e)return;let a=await TZ(i,s);for(let c=0;c<n.length;++c){let f=n[c],l=o[c],u=f.__data__,p=a(Array.isArray(u)?u[0]:u);for(let d=0;d<r.length;++d){let[h,m]=r[d];f.setAttribute(h,p?l[d]:m)}}}};async function TZ(t,e){let n=e?.predicate(t);if(!n||n.length===0)return()=>!0;let r=t.filterBy?.predicate(t,!0),o={__:Tn(n)},i=t.query(r);(i.queries||[i]).forEach(c=>{c.groupby().length?c.select(o):c.$select(o)});let s=await t.coordinator.query(i),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function uS(t){let e=t.on,n=!0;function r(o){n=!1,o(),n=!0}return t.reset=(...o)=>{r(()=>t.clear(...o))},t.moveSilent=(...o)=>{r(()=>t.move(...o))},t.on=(...o)=>{if(o.length>1&&o[1]){let i=o[1];o[1]=(...s)=>n&&i(...s)}return e(...o)},t}function SL(){return uS(Lw())}function ML(){return uS(Ow())}function AL(){return uS(Rw())}function Xd(t,e){return t===e||t&&e&&Math.abs(t[0]-e[0])<1e-12&&Math.abs(t[1]-e[1])<1e-12||!1}function So(t,e){let n=t.channelField(e)?.field;return n?.basis||n}function Gd(t,e,n=1){return e.invert(n*Math.floor(t/n))}function x1(){let t=this,e=t.getScreenCTM,n;t.getScreenCTM=()=>t.isConnected?n=e.call(t):n}var Ts=class{constructor(e,{channel:n,selection:r,field:o=void 0,pixelSize:i=1,peers:s=!0,brush:a}){this.mark=e,this.channel=n,this.pixelSize=i||1,this.selection=r,this.peers=s,this.field=o||So(e,n),this.style=a&&nl(a),this.brush=n==="y"?AL():ML(),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(e){let n;e&&(n=e.map(r=>Gd(r,this.scale,this.pixelSize)).sort((r,o)=>r-o)),Xd(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,e),this.selection.update(this.clause(n)))}clause(e){let{mark:n,pixelSize:r,field:o,scale:i}=this;return Gs(o,e,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:i,pixelSize:r})}init(e,n){let{brush:r,channel:o,style:i}=this;this.scale=e.scale(o);let s=e.scale("x").range,a=e.scale("y").range;r.extent([[Bt(s),Bt(a)],[Ct(s),Ct(a)]]);let c=this.value?.map(this.scale.apply).sort(gt),f=St(e).selectAll('g[aria-label="facet"]');if(n=f.size()?f:St(n??e),this.g=n.append("g").attr("class",`interval-${o}`).each(x1).call(r).call(r.moveSilent,c),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}e.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var Vd=class{constructor(e,{selection:n,xfield:r,yfield:o,pixelSize:i=1,peers:s=!0,brush:a}){this.mark=e,this.pixelSize=i||1,this.selection=n,this.peers=s,this.xfield=r||So(e,"x"),this.yfield=o||So(e,"y"),this.style=a&&nl(a),this.brush=SL(),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(e){let{value:n,pixelSize:r,xscale:o,yscale:i}=this,s,a;if(e){let[c,f]=e;s=[c[0],f[0]].map(l=>Gd(l,o,r)).sort(gt),a=[c[1],f[1]].map(l=>Gd(l,i,r)).sort(gt)}(!Xd(s,n?.[0])||!Xd(a,n?.[1]))&&(this.value=e?[s,a]:void 0,this.g.call(this.brush.moveSilent,e),this.selection.update(this.clause(this.value)))}clause(e){let{mark:n,pixelSize:r,xfield:o,yfield:i,xscale:s,yscale:a}=this;return W2([o,i],e,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}init(e){let{brush:n,style:r}=this,o=this.xscale=e.scale("x"),i=this.yscale=e.scale("y"),s=o.range,a=i.range;n.extent([[Bt(s),Bt(a)],[Ct(s),Ct(a)]]);let c=St(e).selectAll('g[aria-label="facet"]'),f=c.size()?c:St(e);if(this.g=f.append("g").attr("class","interval-xy").each(x1).call(n),r){let l=this.g.selectAll("rect.selection");for(let u in r)l.attr(u,r[u])}if(this.value){let[l,u]=this.value[0].map(o.apply).sort(gt),[p,d]=this.value[1].map(i.apply).sort(gt);this.g.call(n.moveSilent,[[l,p],[u,d]])}e.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var Va=class{constructor(e,{selection:n,pointer:r,channels:o,fields:i,maxRadius:s=40}){this.mark=e,this.selection=n,this.clients=new Set().add(e),this.pointer=r,this.channels=o||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=i||this.channels.map(a=>So(e,[a])),this.maxRadius=s,this.valueIndex=-1}clause(e){let{clients:n,fields:r}=this,o={source:this,clients:n};return r.length>1?Xs(r,e&&[e],o):js(r[0],e?.[0],o)}init(e){let n=this,{mark:r,channels:o,selection:i,maxRadius:s}=this,{data:{columns:a}}=r,c=o.map(x=>r.channelField(x).as),f=!Dn(i),l=St(e).selectAll('g[aria-label="facet"]'),u=l.size()?l:St(e),p=e.scale("x").apply,d=e.scale("y").apply,h=Array.from(a[r.channelField("x").as],p),m=Array.from(a[r.channelField("y").as],d),g=this.pointer==="y"?.01:1,y=this.pointer==="x"?.01:1;u.on("pointerenter pointerdown pointermove",function(x){let[b,w]=He(x,this),_=EZ(h,m,b,w,g,y,s);if(_!==this.valueIndex){this.valueIndex=_;let v=_<0?void 0:c.map(A=>a[A][_]);i.update(f?!v||v.length>1?v:v[0]:n.clause(v))}}),!f&&(u.on("pointerleave",()=>{i.update(n.clause(void 0))}),e.addEventListener("pointerenter",x=>{if(!x.buttons){let b=this.channels.map(()=>0);i.activate(this.clause(b))}}))}};function EZ(t,e,n,r,o,i,s){let a=s*s,c=-1;for(let f=0;f<t.length;++f){let l=o*(t[f]-n),u=i*(e[f]-r),p=l*l+u*u;p<=a&&(a=p,c=f)}return c}var TL=(t,e)=>t-e,Wd=class{constructor(e,{x:n=new Fr,y:r=new Fr,xfield:o,yfield:i,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=e,this.xsel=n,this.ysel=r,this.xfield=o||So(e,"x"),this.yfield=i||So(e,"y"),this.zoom=pS(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:f}=e;a&&this.xsel.addEventListener("value",l=>{f.setAttribute("xDomain",l)&&f.update()}),c&&this.ysel.addEventListener("value",l=>{f.setAttribute("yDomain",l)&&f.update()})}publish(e){if(this.panx){let n=IZ(e,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=$Z(e,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(e,n,r){return Gs(n,e,{source:this,clients:this.mark.plot.markSet,scale:r})}init(e){if(this.svg=e,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:o}},xsel:i,ysel:s}=this;this.xscale=e.scale("x"),this.yscale=e.scale("y");let a=this.xscale.range.slice().sort(TL),c=this.yscale.range.slice().sort(TL),f=pS(n,[-1/0,1/0],a),l=pS(r,[-1/0,1/0],c),u=J_().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[f[0],l[0]],[f[1],l[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>o.__zoom=new Yn(1,0,0)).on("zoom",({transform:p})=>this.publish(p));if(St(o).call(u),n||r){let p=!1;o.addEventListener("pointerenter",d=>{if(!p&&(p=!0,!d.buttons)){if(n){let{xscale:h,xfield:m}=this;i.activate(this.clause(h.domain,m,h))}if(r){let{yscale:h,yfield:m}=this;s.activate(this.clause(h.domain,m,h))}}}),o.addEventListener("pointerleave",()=>p=!1)}}};function pS(t,e,n){return t?Array.isArray(t)?t:e:n}function IZ(t,e){return e.range.map(t.invertX,t).map(e.invert,e)}function $Z(t,e){return e.range.map(t.invertY,t).map(e.invert,e)}var Wa=class{constructor(e,{selection:n,channels:r,peers:o=!0}){this.value=null,this.mark=e,this.selection=n,this.peers=o;let i=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let f=0;f<c.length;++f){let l=e.channelField(c[f],{exact:!0});if(l){i.push(l.field?.basis||l.field),s.push(l.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(e){let{fields:n,mark:r}=this;return Xs(n,e,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(e,n,r){let{mark:o,as:i,selection:s}=this,{data:{columns:a={}}={}}=o;r??=f=>i.map(l=>{let u=f.__data__;return a[l][Array.isArray(u)?u[0]:u]}),n??=`[data-index="${o.index}"]`;let c=new Set(e.querySelectorAll(n));e.addEventListener("pointerdown",f=>{let l=s.single?s.value:this.value,u=f.target,p=null;if(CZ(c,u)){let d=r(u);(f.shiftKey||f.metaKey)&&l?.length?(p=l.filter(h=>dS(h,d)),p.length===l.length&&p.push(d)):l?.length===1&&!dS(l[0],d)?p=null:p=[d]}this.value=p,kZ(l,p)&&s.update(this.clause(p))}),e.addEventListener("pointerenter",f=>{f.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function CZ(t,e){return t.has(e)||t.has(e.parentNode)||t.has(e.parentNode?.parentNode)}function kZ(t,e){return t==null||e==null?t!=null||e!=null:t.length!==e.length||t.some((n,r)=>dS(n,e[r]))}function dS(t,e){let n=t.length;if(e.length!==n)return!0;for(let r=0;r<n;++r)if(t[r]!==e[r])return!0;return!1}var IL=":scope > div, :scope > span",b1="swatch",EL="ramp",rl=class{constructor(e,n){let{as:r,field:o,...i}=n;this.channel=e,this.options=i,this.type=null,this.handler=null,this.selection=r,this.field=o,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(e){this.plot=e}init(e){let n=NZ(this,e);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:e,handler:n}=this,{single:r,value:o}=e,i=r?o:e.valueFor(n),s=i&&i.length?new Set(i.map(c=>c[0])):null,a=this.legend.querySelectorAll(IL);for(let c of a){let f=s?s.has(c.__data__):!0;c.style.opacity=f?1:.2}}};function NZ(t,e){let{channel:n,plot:r,selection:o}=t,i=e.scale(n),s=i.type==="ordinal"?b1:EL,a={label:r.getAttribute(`${n}Label`)??null,...t.options},c=s===b1?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},f=e.legend(n,c);t.legend=f;let l=!!o;if(l&&s===EL){let u=c.width??240,p=DZ(i,u);p?f.scale=function(d){return d==="x"?{range:[0,u]}:d==="y"?{range:[-10,0]}:d===n?p:void 0}:l=!1}if(l){let u=OZ(t,s);s===b1?(u.init(f,IL,p=>[p.__data__]),t.update()):u.init(f,f.querySelector("g:last-of-type"))}return f}function OZ(t,e){let{channel:n,handler:r,selection:o}=t;if(r)return r;let i=RZ(t);return e===b1?(t.handler=new Wa(i,{selection:o,channels:[n],peers:!1}),o.addEventListener("value",()=>t.update())):t.handler=new Ts(i,{selection:o,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),t.handler}function RZ(t){let{channel:e,plot:n}=t,r=t.field??LZ(n.marks,e)??"value";if(r){let o={field:r};return{plot:n,channelField:i=>e===i?o:void 0}}}function LZ(t,e){let n=e==="color"?["fill","stroke"]:e==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=t.length-1;r>-1;--r)for(let o of n){let i=t[r].channelField(o,{exact:!0});if(i)return i.field}return null}function DZ(t,e){let{apply:n,invert:r,interpolate:o,...i}=t,s=t.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return is({x:{...i,type:a,range:[0,e]}})}function w1(t,e,n=0,r=Math.LN10){let o,i=Math.ceil(Math.log(e)/r),s=Math.max(n,Math.pow(10,Math.round(Math.log(t)/r)-i));for(;Math.ceil(t/s)>e;)s*=10;let a=[5,2];for(let c=0,f=a.length;c<f;++c)o=s/a[c],o>=n&&t/o<=e&&(s=o);return s}function $L(t,e,n){let{step:r,steps:o,minstep:i=0,nice:s=!0}=n;if(s!==!1){let a=e-t,c=Math.LN10;r=r||w1(a,o||25,i,c);let f=Math.log(r),l=f>=0?0:~~(-f/c)+1,u=Math.pow(10,-l-1);f=Math.floor(t/r+u)*r,t=t<f?f-r:f,e=Math.ceil(e/r)*r,o=Math.round((e-t)/r)}return{min:t,max:e,steps:o}}var OL="year",CL="month",kL="day",v1="hour",_1="minute",S1="second",PZ="millisecond",Zd=1e3,Qd=Zd*60,Jd=Qd*60,M1=Jd*24,FZ=M1*7,NL=M1*30,RL=M1*365,Hd=[[S1,1,Zd],[S1,5,5*Zd],[S1,15,15*Zd],[S1,30,30*Zd],[_1,1,Qd],[_1,5,5*Qd],[_1,15,15*Qd],[_1,30,30*Qd],[v1,1,Jd],[v1,3,3*Jd],[v1,6,6*Jd],[v1,12,12*Jd],[kL,1,M1],[kL,7,FZ],[CL,1,NL],[CL,3,3*NL],[OL,1,RL]];function LL(t,e,n){let r=e-t,o=r/n,i=wr(s=>s[2]).right(Hd,o);return i===Hd.length?{interval:OL,step:w1(r/RL,n)}:i?(i=Hd[o/Hd[i-1][2]<Hd[i][2]/o?i-1:i],{interval:i[0],step:i[1]}):{interval:PZ,step:w1(r,n,1)}}var qZ=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function BZ(t,e){return qZ.has(`${t.type}-${e}`)}function A1(t,e={}){let n=(r,o)=>BZ(r,o)?{[`${o}1`]:hS(r,o,t,e),[`${o}2`]:hS(r,o,t,{...e,offset:1})}:{[o]:hS(r,o,t,e)};return n[Ul]=!0,n}function hS(t,e,n,r){return{column:n,label:n,get columns(){return[n]},get basis(){return n},get stats(){return{column:n,stats:["min","max"]}},toString(){let{type:o,min:i,max:s}=t.channelField(e),{interval:a,steps:c,offset:f=0}=r,l=a??(o==="date"||zZ(t,e)?"date":"number");if(l==="number"){let{apply:u,sqlApply:p,sqlInvert:d}=Ga(t,e),h=$L(u(i),u(s),r),m=p(n),g=h.min===0?m:`(${m} - ${h.min})`,y=`${(h.max-h.min)/h.steps}::DOUBLE`,x=f?`${f} + `:"",b=`${h.min} + ${y} * (${x}FLOOR(${g} / ${y}))`;return`${d(b)}`}else{let{interval:u,step:p=1}=l==="date"?LL(i,s,c||40):r,d=f?` + INTERVAL ${f*p} ${u}`:"";return`(${C2(n,u,p)}${d})`}}}}function zZ(t,e){let n=t.plot.getAttribute(`${e}Scale`);return n==="utc"||n==="time"}var YZ=t=>t&&typeof t=="object"&&!Array.isArray(t);var Kd=class extends _n{constructor({element:e,filterBy:n,from:r,column:o,label:i=o,format:s=u=>u,options:a,value:c,field:f=o,as:l}={}){super(n),this.from=r,this.column=o,this.format=s,this.field=f;let u=this.selection=l;this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let p=document.createElement("label");if(p.innerText=i||o,this.element.appendChild(p),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(d=>YZ(d)?d:{value:d}),this.selectedValue(c??""),this.update()),u){let d=!Dn(u);c!=null&&(!d||u.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),d&&this.selection.addEventListener("value",h=>{h!==this.select.value&&this.selectedValue(h)})}}selectedValue(e){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===e);n>=0?this.select.selectedIndex=n:this.select.value=String(e)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(e){let{selection:n,field:r}=this;if(Dn(n)){e===""&&(e=void 0);let o=js(r,e,{source:this});n.update(o)}else En(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?ft.from(n).select({value:r}).distinct().where(e).orderby(r):null}queryResult(e){return this.data=[{value:"",label:"All"},...e],this}update(){let{data:e,format:n,select:r,selection:o}=this;r.replaceChildren();for(let{value:i,label:s}of e){let a=document.createElement("option");a.setAttribute("value",i),a.innerText=s??n(i),this.select.appendChild(a)}if(o){let i=Dn(o)?o.valueFor(this):o.value;this.selectedValue(i??"")}return this}};var UZ=0;var th=class extends _n{constructor({element:e,filterBy:n,from:r,column:o,label:i,type:s="contains",field:a=o,as:c}={}){if(super(n),this.id="search_"+ ++UZ,this.type=s,this.from=r,this.column=o,this.selection=c,this.field=a,this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),i){let f=document.createElement("label");f.setAttribute("for",this.id),f.innerText=i,this.element.appendChild(f)}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)}),Dn(this.selection)||this.selection.addEventListener("value",f=>{f!==this.searchbox.value&&(this.searchbox.value=f)}))}reset(){this.searchbox.value=""}publish(e){let{selection:n,field:r,type:o}=this;if(Dn(n)){let i=H2(r,e,{source:this,method:o});n.update(i)}else En(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?ft.from(n).select({list:r}).distinct().where(e):null}queryResult(e){return this.data=e,this}update(){let e=document.createElement("datalist"),n=`${this.id}_list`;e.setAttribute("id",n);for(let r of this.data){let o=document.createElement("option");o.setAttribute("value",r.list),e.append(o)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=e),this.searchbox.setAttribute("list",n),this}};var jZ=0;var eh=class extends _n{constructor({element:e,filterBy:n,as:r,min:o,max:i,step:s,from:a,column:c,label:f=c,value:l=r?.value,select:u="point",field:p=c,width:d}={}){if(super(n),this.id="slider_"+ ++jZ,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=u,this.field=p,this.min=o,this.max=i,this.step=s,this.element=e||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),f){let h=document.createElement("label");h.setAttribute("for",this.id),h.innerText=f,this.element.appendChild(h)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),d!=null&&(this.slider.style.width=`${+d}px`),o!=null&&this.slider.setAttribute("min",`${o}`),i!=null&&this.slider.setAttribute("max",`${i}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),l!=null&&(this.slider.setAttribute("value",`${l}`),this.selection?.value===void 0&&this.publish(l)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:h}=this.slider;this.curval.innerText=h,this.selection&&this.publish(+h)}),this.selection&&!Dn(this.selection)&&this.selection.addEventListener("value",h=>{h!==+this.slider.value&&(this.slider.value=h,this.curval.innerText=h)})}query(e=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:ft.select({min:tr(r),max:Kn(r)}).from(n).where(e)}queryResult(e){let{min:n,max:r}=Array.from(e)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(e){let{field:n,selectionType:r,selection:o}=this;if(Dn(o))if(r==="interval"){let i=[this.min??0,e];o.update(Gs(n,i,{source:this,bin:"ceil",scale:{type:"identity",domain:i},pixelSize:this.step}))}else o.update(js(n,e,{source:this}));else En(this.selection)&&o.update(e)}};var gS=DL(t=>{let e=T1(t);return n=>n==null?"":typeof n=="number"?e(n):n instanceof Date?yS(n):`${n}`}),T1=DL(t=>e=>e===0?"0":e.toLocaleString(t)),hLt=gS(),mLt=T1();function yS(t){return cf(t,"Invalid Date")}function DL(t){let e=null,n;return(r="en")=>r===e?n:n=t(e=r)}var XZ=-1;var nh=class extends _n{constructor({element:e,filterBy:n,from:r,columns:o=["*"],align:i={},format:s,width:a,maxWidth:c,height:f=500,rowBatch:l=100,as:u}={}){super(n),this.id=`table-${++XZ}`,this.from=r,this.columns=o,this.format=s,this.align=i,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+l,this.pending=!1,this.selection=u,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=e||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${f}px`,this.element.style.overflow="auto";let p=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:m}=this,{scrollHeight:g,scrollTop:y,clientHeight:x}=d.target,b=y<p;p=y,!(b||h||m)&&g-y<2*x&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",d=>{let h=GZ(d.target);h>-1&&h!==this.currentRow&&(this.currentRow=h,this.selection.update(this.clause([h])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}clause(e=[]){let{data:n,limit:r,schema:o}=this,i=o.map(a=>a.column),s=e.map(a=>{let{columns:c}=n[~~(a/r)];return i.map(f=>c[f][a%r])});return Xs(i,s,{source:this})}requestData(e=0){this.offset=e;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),er().prefetch(n.clone().offset(e+this.limit))}fields(){return this.columns.map(e=>Ii(this.from,e))}fieldInfo(e){this.schema=e;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:o}of e){let i=document.createElement("th");i.addEventListener("click",s=>this.sort(s,o)),i.appendChild(document.createElement("span")),i.appendChild(document.createTextNode(o)),r.appendChild(i)}return n.appendChild(r),this.formats=VZ(this.format,e),this.style.innerText=ZZ(this.id,WZ(this.align,e),HZ(this.widths,e)),this}query(e=[]){let{from:n,limit:r,offset:o,schema:i,sortColumn:s,sortDesc:a}=this;return ft.from(n).select(i.map(c=>c.column)).where(e).orderby(s?a?Db(s):s:[]).limit(r).offset(o)}queryResult(e){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(In(e)),this}update(){let{body:e,formats:n,data:r,schema:o,limit:i}=this,s=o.length,a=r.length-1,c=i*a,{numRows:f,columns:l}=r[a],u=o.map(p=>l[p.column]);for(let p=0;p<f;++p){let d=document.createElement("tr");Object.assign(d,{__row__:c+p});for(let h=0;h<s;++h){let m=u[h][p],g=document.createElement("td");g.innerText=m==null?"":n[h](m),d.appendChild(g)}e.appendChild(d)}return f<i&&(this.loaded=!0),this.pending=!1,this}sort(e,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=e.currentTarget,o=this.sortHeader;o===r&&e.metaKey?(o.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(o&&(o.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function GZ(t){let e=t.parentElement;return Object.hasOwn(e,"__row__")?+e.__row__:-1}function VZ(t={},e,n){return e.map(({column:r,type:o})=>{if(r in t)return t[r];switch(o){case"number":return T1(n);case"date":return yS;default:return gS(n)}})}function WZ(t={},e){return e.map(({column:n,type:r})=>n in t?t[n]:r==="number"?"right":"left")}function HZ(t={},e){return e.map(({column:n})=>t[n])}function ZZ(t,e,n){let r=[];return e.forEach((o,i)=>{let s=+n[i];if(o!=="left"||s){let a=o!=="left"?`text-align:${o};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${t} tr>:nth-child(${i+1}) {${a}${c}}`)}}),r.join(" ")}function rh(t,...e){let n=t?.context?.coordinator??er();for(let r of e)n.connect(r)}function E1(t,e,n){let r=new e(n);return rh(t,r),r.element}function PL(t){return E1(this,Kd,t)}function FL(t){return E1(this,th,t)}function qL(t){return E1(this,eh,t)}function BL(t){return E1(this,nh,t)}function zL({direction:t="vertical",wrap:e=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=t==="vertical"?"column":"row",r.style.flexWrap=e?e===!0?"wrap":e:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(o=>r.appendChild(o)),Object.assign(r,{value:{element:r}}),r}function YL(...t){return zL({direction:"vertical"},t.flat())}function UL(...t){return zL({direction:"horizontal"},t.flat())}function jL({dim:t="width",size:e=10}){let n=document.createElement("span");return n.style.display="inline-block",n.style[t]=Number.isNaN(+e)?e:`${e}px`,Object.assign(n,{value:{element:n}})}function XL(t){return jL({dim:"height",size:t})}function GL(t){return jL({dim:"width",size:t})}var I1={};ec(I1,{align:()=>NS,aspectRatio:()=>OS,axis:()=>RS,colorBase:()=>v5,colorClamp:()=>f5,colorConstant:()=>S5,colorDomain:()=>a5,colorExponent:()=>_5,colorInterpolate:()=>d5,colorLabel:()=>g5,colorN:()=>l5,colorNice:()=>u5,colorPercent:()=>y5,colorPivot:()=>h5,colorRange:()=>c5,colorReverse:()=>x5,colorScale:()=>s5,colorScheme:()=>p5,colorSymmetric:()=>m5,colorTickFormat:()=>w5,colorZero:()=>b5,facetGrid:()=>sM,facetLabel:()=>aM,facetMargin:()=>eM,facetMarginBottom:()=>rM,facetMarginLeft:()=>oM,facetMarginRight:()=>iM,facetMarginTop:()=>nM,fxAlign:()=>hM,fxAriaDescription:()=>NM,fxAriaLabel:()=>kM,fxAxis:()=>xM,fxDomain:()=>cM,fxFontVariant:()=>CM,fxGrid:()=>AM,fxInset:()=>lM,fxInsetLeft:()=>uM,fxInsetRight:()=>pM,fxLabel:()=>EM,fxLabelAnchor:()=>IM,fxLabelOffset:()=>$M,fxLine:()=>TM,fxPadding:()=>mM,fxPaddingInner:()=>gM,fxPaddingOuter:()=>yM,fxRange:()=>fM,fxReverse:()=>OM,fxRound:()=>dM,fxTickFormat:()=>SM,fxTickPadding:()=>_M,fxTickRotate:()=>MM,fxTickSize:()=>wM,fxTickSpacing:()=>vM,fxTicks:()=>bM,fyAlign:()=>BM,fyAriaDescription:()=>o5,fyAriaLabel:()=>r5,fyAxis:()=>jM,fyDomain:()=>RM,fyFontVariant:()=>n5,fyGrid:()=>QM,fyInset:()=>DM,fyInsetBottom:()=>FM,fyInsetTop:()=>PM,fyLabel:()=>KM,fyLabelAnchor:()=>t5,fyLabelOffset:()=>e5,fyLine:()=>JM,fyPadding:()=>zM,fyPaddingInner:()=>YM,fyPaddingOuter:()=>UM,fyRange:()=>LM,fyReverse:()=>i5,fyRound:()=>qM,fyTickFormat:()=>HM,fyTickPadding:()=>WM,fyTickRotate:()=>ZM,fyTickSize:()=>GM,fyTickSpacing:()=>VM,fyTicks:()=>XM,grid:()=>DS,height:()=>ES,inset:()=>LS,label:()=>PS,lengthBase:()=>o8,lengthClamp:()=>t8,lengthConstant:()=>s8,lengthDomain:()=>J5,lengthExponent:()=>i8,lengthNice:()=>e8,lengthPercent:()=>n8,lengthRange:()=>K5,lengthScale:()=>Q5,lengthZero:()=>r8,margin:()=>SS,marginBottom:()=>kS,marginLeft:()=>IS,marginRight:()=>$S,marginTop:()=>CS,margins:()=>_S,name:()=>wS,opacityBase:()=>R5,opacityClamp:()=>E5,opacityConstant:()=>D5,opacityDomain:()=>A5,opacityExponent:()=>L5,opacityLabel:()=>$5,opacityNice:()=>I5,opacityPercent:()=>C5,opacityRange:()=>T5,opacityReverse:()=>k5,opacityScale:()=>M5,opacityTickFormat:()=>O5,opacityZero:()=>N5,padding:()=>FS,projectionClip:()=>y8,projectionDomain:()=>u8,projectionInset:()=>p8,projectionInsetBottom:()=>g8,projectionInsetLeft:()=>d8,projectionInsetRight:()=>h8,projectionInsetTop:()=>m8,projectionParallels:()=>c8,projectionPrecision:()=>f8,projectionRotate:()=>l8,projectionType:()=>a8,rBase:()=>W5,rClamp:()=>U5,rConstant:()=>Z5,rDomain:()=>z5,rExponent:()=>H5,rLabel:()=>X5,rNice:()=>j5,rPercent:()=>G5,rRange:()=>Y5,rScale:()=>B5,rZero:()=>V5,style:()=>AS,symbolDomain:()=>F5,symbolRange:()=>q5,symbolScale:()=>P5,width:()=>TS,xAlign:()=>WS,xAriaDescription:()=>d4,xAriaLabel:()=>p4,xAxis:()=>JS,xBase:()=>y4,xClamp:()=>GS,xConstant:()=>b4,xDomain:()=>BS,xExponent:()=>x4,xFontVariant:()=>u4,xGrid:()=>i4,xInset:()=>US,xInsetLeft:()=>jS,xInsetRight:()=>XS,xLabel:()=>a4,xLabelAnchor:()=>c4,xLabelArrow:()=>f4,xLabelOffset:()=>l4,xLine:()=>s4,xNice:()=>YS,xPadding:()=>HS,xPaddingInner:()=>ZS,xPaddingOuter:()=>QS,xPercent:()=>h4,xRange:()=>zS,xReverse:()=>m4,xRound:()=>VS,xScale:()=>qS,xTickFormat:()=>r4,xTickPadding:()=>n4,xTickRotate:()=>o4,xTickSize:()=>t4,xTickSpacing:()=>e4,xTicks:()=>KS,xZero:()=>g4,xyDomain:()=>MS,yAlign:()=>$4,yAriaDescription:()=>W4,yAriaLabel:()=>V4,yAxis:()=>O4,yBase:()=>J4,yClamp:()=>E4,yConstant:()=>tM,yDomain:()=>v4,yExponent:()=>K4,yFontVariant:()=>G4,yGrid:()=>B4,yInset:()=>M4,yInsetBottom:()=>T4,yInsetTop:()=>A4,yLabel:()=>Y4,yLabelAnchor:()=>U4,yLabelArrow:()=>j4,yLabelOffset:()=>X4,yLine:()=>z4,yNice:()=>S4,yPadding:()=>C4,yPaddingInner:()=>k4,yPaddingOuter:()=>N4,yPercent:()=>H4,yRange:()=>_4,yReverse:()=>Z4,yRound:()=>I4,yScale:()=>w4,yTickFormat:()=>F4,yTickPadding:()=>P4,yTickRotate:()=>q4,yTickSize:()=>L4,yTickSpacing:()=>D4,yTicks:()=>R4,yZero:()=>Q4});var oh=class extends Map{request(e,n){if(this.has(e))n(this.get(e));else{let r=this.waiting||(this.waiting=new Map),o=r.get(e)||[];r.set(e,o.concat(n))}}set(e,n){this.has(e)&&console.warn(`Overwriting named plot "${e}".`);let{waiting:r}=this;return r?.has(e)&&(r.get(e).forEach(o=>o(n)),r.delete(e)),super.set(e,n)}clear(){return this.waiting?.clear(),super.clear()}},xS=new oh;function bS(t,e,n){(t?.context?.namedPlots??xS).request(e,n)}function VL(t,e,n){(t?.context?.namedPlots??xS).set(e,n)}function wS(t){return e=>VL(this,t,e)}function WL(t,e,n){En(n)?(n.addEventListener("value",r=>{t.setAttribute(e,r),t.update()}),n.value!==void 0&&t.setAttribute(e,n.value)):t.setAttribute(e,n)}function QZ(t,e){return n=>{WL(n,t,e)}}function vS(t){return e=>{for(let[n,r]of Object.entries(t))WL(e,n,r)}}function _S(t){let{top:e,bottom:n,left:r,right:o}=t,i={};return e!==void 0&&(i.marginTop=e),n!==void 0&&(i.marginBottom=n),r!==void 0&&(i.marginLeft=r),o!==void 0&&(i.marginRight=o),vS(i)}function SS(t){return vS({marginTop:t,marginBottom:t,marginLeft:t,marginRight:t})}function MS(t){return vS({xDomain:t,yDomain:t})}var O=t=>e=>QZ(t,e),AS=O("style"),TS=O("width"),ES=O("height"),IS=O("marginLeft"),$S=O("marginRight"),CS=O("marginTop"),kS=O("marginBottom"),NS=O("align"),OS=O("aspectRatio"),RS=O("axis"),LS=O("inset"),DS=O("grid"),PS=O("label"),FS=O("padding"),qS=O("xScale"),BS=O("xDomain"),zS=O("xRange"),YS=O("xNice"),US=O("xInset"),jS=O("xInsetLeft"),XS=O("xInsetRight"),GS=O("xClamp"),VS=O("xRound"),WS=O("xAlign"),HS=O("xPadding"),ZS=O("xPaddingInner"),QS=O("xPaddingOuter"),JS=O("xAxis"),KS=O("xTicks"),t4=O("xTickSize"),e4=O("xTickSpacing"),n4=O("xTickPadding"),r4=O("xTickFormat"),o4=O("xTickRotate"),i4=O("xGrid"),s4=O("xLine"),a4=O("xLabel"),c4=O("xLabelAnchor"),f4=O("xLabelArrow"),l4=O("xLabelOffset"),u4=O("xFontVariant"),p4=O("xAriaLabel"),d4=O("xAriaDescription"),h4=O("xPercent"),m4=O("xReverse"),g4=O("xZero"),y4=O("xBase"),x4=O("xExponent"),b4=O("xConstant"),w4=O("yScale"),v4=O("yDomain"),_4=O("yRange"),S4=O("yNice"),M4=O("yInset"),A4=O("yInsetTop"),T4=O("yInsetBottom"),E4=O("yClamp"),I4=O("yRound"),$4=O("yAlign"),C4=O("yPadding"),k4=O("yPaddingInner"),N4=O("yPaddingOuter"),O4=O("yAxis"),R4=O("yTicks"),L4=O("yTickSize"),D4=O("yTickSpacing"),P4=O("yTickPadding"),F4=O("yTickFormat"),q4=O("yTickRotate"),B4=O("yGrid"),z4=O("yLine"),Y4=O("yLabel"),U4=O("yLabelAnchor"),j4=O("yLabelArrow"),X4=O("yLabelOffset"),G4=O("yFontVariant"),V4=O("yAriaLabel"),W4=O("yAriaDescription"),H4=O("yPercent"),Z4=O("yReverse"),Q4=O("yZero"),J4=O("yBase"),K4=O("yExponent"),tM=O("yConstant"),eM=O("facetMargin"),nM=O("facetMarginTop"),rM=O("facetMarginBottom"),oM=O("facetMarginLeft"),iM=O("facetMarginRight"),sM=O("facetGrid"),aM=O("facetLabel"),cM=O("fxDomain"),fM=O("fxRange"),lM=O("fxInset"),uM=O("fxInsetLeft"),pM=O("fxInsetRight"),dM=O("fxRound"),hM=O("fxAlign"),mM=O("fxPadding"),gM=O("fxPaddingInner"),yM=O("fxPaddingOuter"),xM=O("fxAxis"),bM=O("fxTicks"),wM=O("fxTickSize"),vM=O("fxTickSpacing"),_M=O("fxTickPadding"),SM=O("fxTickFormat"),MM=O("fxTickRotate"),AM=O("fxGrid"),TM=O("fxLine"),EM=O("fxLabel"),IM=O("fxLabelAnchor"),$M=O("fxLabelOffset"),CM=O("fxFontVariant"),kM=O("fxAriaLabel"),NM=O("fxAriaDescription"),OM=O("fxReverse"),RM=O("fyDomain"),LM=O("fyRange"),DM=O("fyInset"),PM=O("fyInsetTop"),FM=O("fyInsetBottom"),qM=O("fyRound"),BM=O("fyAlign"),zM=O("fyPadding"),YM=O("fyPaddingInner"),UM=O("fyPaddingOuter"),jM=O("fyAxis"),XM=O("fyTicks"),GM=O("fyTickSize"),VM=O("fyTickSpacing"),WM=O("fyTickPadding"),HM=O("fyTickFormat"),ZM=O("fyTickRotate"),QM=O("fyGrid"),JM=O("fyLine"),KM=O("fyLabel"),t5=O("fyLabelAnchor"),e5=O("fyLabelOffset"),n5=O("fyFontVariant"),r5=O("fyAriaLabel"),o5=O("fyAriaDescription"),i5=O("fyReverse"),s5=O("colorScale"),a5=O("colorDomain"),c5=O("colorRange"),f5=O("colorClamp"),l5=O("colorN"),u5=O("colorNice"),p5=O("colorScheme"),d5=O("colorInterpolate"),h5=O("colorPivot"),m5=O("colorSymmetric"),g5=O("colorLabel"),y5=O("colorPercent"),x5=O("colorReverse"),b5=O("colorZero"),w5=O("colorTickFormat"),v5=O("colorBase"),_5=O("colorExponent"),S5=O("colorConstant"),M5=O("opacityScale"),A5=O("opacityDomain"),T5=O("opacityRange"),E5=O("opacityClamp"),I5=O("opacityNice"),$5=O("opacityLabel"),C5=O("opacityPercent"),k5=O("opacityReverse"),N5=O("opacityZero"),O5=O("opacityTickFormat"),R5=O("opacityBase"),L5=O("opacityExponent"),D5=O("opacityConstant"),P5=O("symbolScale"),F5=O("symbolDomain"),q5=O("symbolRange"),B5=O("rScale"),z5=O("rDomain"),Y5=O("rRange"),U5=O("rClamp"),j5=O("rNice"),X5=O("rLabel"),G5=O("rPercent"),V5=O("rZero"),W5=O("rBase"),H5=O("rExponent"),Z5=O("rConstant"),Q5=O("lengthScale"),J5=O("lengthDomain"),K5=O("lengthRange"),t8=O("lengthClamp"),e8=O("lengthNice"),n8=O("lengthPercent"),r8=O("lengthZero"),o8=O("lengthBase"),i8=O("lengthExponent"),s8=O("lengthConstant"),a8=O("projectionType"),c8=O("projectionParallels"),f8=O("projectionPrecision"),l8=O("projectionRotate"),u8=O("projectionDomain"),p8=O("projectionInset"),d8=O("projectionInsetLeft"),h8=O("projectionInsetRight"),m8=O("projectionInsetTop"),g8=O("projectionInsetBottom"),y8=O("projectionClip");function HL(t,e){return{table:t,options:e}}var C1={};ec(C1,{area:()=>x8,areaX:()=>b8,areaY:()=>w8,arrow:()=>dA,axisFx:()=>xA,axisFy:()=>bA,axisX:()=>gA,axisY:()=>yA,barX:()=>M8,barY:()=>A8,cell:()=>T8,cellX:()=>E8,cellY:()=>I8,circle:()=>L8,contour:()=>K8,delaunayLink:()=>lA,delaunayMesh:()=>uA,denseLine:()=>J8,density:()=>Q8,densityX:()=>H8,densityY:()=>Z8,dot:()=>N8,dotX:()=>O8,dotY:()=>R8,errorbarX:()=>sA,errorbarY:()=>aA,frame:()=>mA,geo:()=>MA,graticule:()=>TA,gridFx:()=>_A,gridFy:()=>SA,gridX:()=>wA,gridY:()=>vA,heatmap:()=>tA,hexagon:()=>D8,hexbin:()=>rA,hexgrid:()=>oA,hull:()=>pA,image:()=>W8,line:()=>v8,lineX:()=>_8,lineY:()=>S8,link:()=>hA,raster:()=>eA,rasterTile:()=>nA,rect:()=>$8,rectX:()=>C8,rectY:()=>k8,regressionY:()=>iA,ruleX:()=>B8,ruleY:()=>z8,sphere:()=>AA,spike:()=>V8,text:()=>P8,textX:()=>F8,textY:()=>q8,tickX:()=>Y8,tickY:()=>U8,vector:()=>j8,vectorX:()=>X8,vectorY:()=>G8,voronoi:()=>cA,voronoiMesh:()=>fA});var JZ=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function ht(t,e,n={}){arguments.length===2&&!Array.isArray(e)&&(n=e,e=JZ.has(t)?null:[{}]);let r=t.startsWith("area")||t.startsWith("line")?Nd:Me;return $1(r,t,e,n)}function $1(t,e,n,r){return o=>{o.addMark(new t(e,n,r))}}function Mo(t,e,n){return r=>{r.addMark(new t(e,n))}}var x8=(...t)=>ht("area",...t),b8=(...t)=>ht("areaX",...t),w8=(...t)=>ht("areaY",...t),v8=(...t)=>ht("line",...t),_8=(...t)=>ht("lineX",...t),S8=(...t)=>ht("lineY",...t),M8=(...t)=>ht("barX",...t),A8=(...t)=>ht("barY",...t),T8=(...t)=>ht("cell",...t),E8=(...t)=>ht("cellX",...t),I8=(...t)=>ht("cellY",...t),$8=(...t)=>ht("rect",...t),C8=(...t)=>ht("rectX",...t),k8=(...t)=>ht("rectY",...t),N8=(...t)=>ht("dot",...t),O8=(...t)=>ht("dotX",...t),R8=(...t)=>ht("dotY",...t),L8=(...t)=>ht("circle",...t),D8=(...t)=>ht("hexagon",...t),P8=(...t)=>ht("text",...t),F8=(...t)=>ht("textX",...t),q8=(...t)=>ht("textY",...t),B8=(...t)=>ht("ruleX",...t),z8=(...t)=>ht("ruleY",...t),Y8=(...t)=>ht("tickX",...t),U8=(...t)=>ht("tickY",...t),j8=(...t)=>ht("vector",...t),X8=(...t)=>ht("vectoX",...t),G8=(...t)=>ht("vectorY",...t),V8=(...t)=>ht("spike",...t),W8=(...t)=>ht("image",...t),H8=(...t)=>$1(Kf,"areaX",...t),Z8=(...t)=>$1(Kf,"areaY",...t),Q8=(...t)=>Mo(qd,...t),J8=(...t)=>Mo(Fd,...t),K8=(...t)=>Mo(Ld,...t),tA=(...t)=>Mo(Pd,...t),eA=(...t)=>Mo(As,...t),nA=(...t)=>Mo(Yd,...t),rA=(...t)=>Mo(zd,...t),oA=(...t)=>ht("hexgrid",...t),iA=(...t)=>Mo(Ud,...t),sA=(...t)=>$1(el,"ruleY",...t),aA=(...t)=>Mo(el,"ruleX",...t),cA=(...t)=>ht("voronoi",...t),fA=(...t)=>ht("voronoiMesh",...t),lA=(...t)=>ht("delaunayLink",...t),uA=(...t)=>ht("delaunayMesh",...t),pA=(...t)=>ht("hull",...t),dA=(...t)=>ht("arrow",...t),hA=(...t)=>ht("link",...t),mA=(...t)=>ht("frame",...t),gA=(...t)=>ht("axisX",...t),yA=(...t)=>ht("axisY",...t),xA=(...t)=>ht("axisFx",...t),bA=(...t)=>ht("axisFy",...t),wA=(...t)=>ht("gridX",...t),vA=(...t)=>ht("gridY",...t),_A=(...t)=>ht("gridFx",...t),SA=(...t)=>ht("gridFy",...t),MA=(...t)=>Mo(Bd,...t),AA=(...t)=>ht("sphere",...t),TA=(...t)=>ht("graticule",...t);var k1={};ec(k1,{highlight:()=>EA,intervalX:()=>LA,intervalXY:()=>PA,intervalY:()=>DA,nearest:()=>NA,nearestX:()=>OA,nearestY:()=>RA,pan:()=>FA,panX:()=>qA,panY:()=>BA,panZoom:()=>zA,panZoomX:()=>YA,panZoomY:()=>UA,toggle:()=>Ha,toggleColor:()=>kA,toggleX:()=>IA,toggleY:()=>$A,toggleZ:()=>CA});function _i(t,e){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new t(r,e))}}function EA({by:t,...e}){return _i(jd,{selection:t,channels:e})}function Ha({as:t,...e}){return _i(Wa,{...e,selection:t})}function IA(t){return Ha({...t,channels:["x"]})}function $A(t){return Ha({...t,channels:["y"]})}function CA(t){return Ha({...t,channels:["z"]})}function kA(t){return Ha({...t,channels:["color"]})}function NA({as:t,...e}){return _i(Va,{...e,selection:t,pointer:"xy"})}function OA({as:t,...e}){return _i(Va,{...e,selection:t,pointer:"x"})}function RA({as:t,...e}){return _i(Va,{...e,selection:t,pointer:"y"})}function LA({as:t,...e}){return _i(Ts,{...e,selection:t,channel:"x"})}function DA({as:t,...e}){return _i(Ts,{...e,selection:t,channel:"y"})}function PA({as:t,...e}){return _i(Vd,{...e,selection:t})}function ol(t){return _i(Wd,t)}function FA(t={}){return ol({...t,zoom:!1})}function qA(t={}){return ol({...t,zoom:!1,pany:!1})}function BA(t={}){return ol({...t,zoom:!1,panx:!1})}function zA(t={}){return ol(t)}function YA(t={}){return ol({...t,pany:!1})}function UA(t={}){return ol({...t,panx:!1})}var N1={};ec(N1,{colorLegend:()=>XA,opacityLegend:()=>GA,symbolLegend:()=>VA});function jA(t,e={}){if(e.for){let{for:n,...r}=e,o=new rl(t,r),i=typeof n,s=a=>a.addLegend(o,!1);return i==="string"?bS(this,n,s):n.value&&s(n.value),o.element}else return n=>n.addLegend(new rl(t,e))}function XA(t){return jA.call(this,"color",t)}function GA(t){return jA.call(this,"opacity",t)}function VA(t){return jA.call(this,"symbol",t)}function ZL(...t){let e=new Cd;return t.flat().forEach(n=>n(e)),rh(this,...e.marks),e.update(),e.element}function HA({coordinator:t=er(),namedPlots:e=new oh,extensions:n=null,...r}={}){return{...WA,...n,context:{coordinator:t,namedPlots:e,...r}}}var QL="spec",O1="literal",gDt="dataref",JL="options",KL="selection",tD="paramref",eD="param",nD="include",ZA="select",R1="value",rD="crossfilter",L1="intersect",oD="union",iD="single",sD="data",aD="expression",Es="sql",Si="agg",ih="input",il="hconcat",sl="vconcat",al="hspace",cl="vspace",D1="mark",QA="from",fl="plot",sh="legend",cD="attribute",JA="transform",fD="interactor",ah="Fixed";var bt=class{constructor(e,n=null){this.type=e,this.children=n}instantiate(e){throw Error("instantiate not implemented")}codegen(e){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var ch=class extends bt{constructor(e,n,r,o,i,s){super(QL,[e]),this.root=e,this.meta=n,this.config=r,this.data=o,this.params=i,this.plotDefaults=s}toJSON(){let{root:e,meta:n,config:r,plotDefaults:o}=this,i=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),i?.size){let c=a.data={};for(let[f,l]of i)c[f]=l.toJSON()}if(s?.size){let c=a.params={};for(let[f,l]of s)c[f]=l.toJSON()}if(o?.length){let c=a.plotDefaults={};for(let f of o)Object.assign(c,f.toJSON())}return Object.assign(a,e.toJSON())}};function fh(t){let e=typeof t;return e==="object"?t?.param:e==="string"?KZ(t):null}function KZ(t){return t?.[0]==="$"?t.slice(1):null}function lh(t){return`$${t}`}function ll(t){return[t].flat()}function gr(t){return Array.isArray(t)}function ul(t){return t!==null&&typeof t=="object"&&!gr(t)}function Is(t){return typeof t=="string"}function pl(t,e){throw Object.assign(Error(t),{data:e})}var tQ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function lD(t,e){return tQ.test(t+="")?new Date(t):e}function De(t,e){let n={};for(let r in t)n[r]=e.maybeSelection(t[r]);return new $s(n)}var $s=class t extends bt{constructor(e){super(JL),this.options=e}filter(e){let n=Object.fromEntries(Object.entries(this.options).filter(([r,o])=>e(r,o)));return new t(n)}instantiate(e){let{options:n}=this,r={};for(let o in n)r[o]=n[o].instantiate(e);return r}codegen(e){let{options:n}=this,r=[];for(let o in n)r.push(`${o}: ${n[o].codegen(e)}`);return r.length?`{${e.maybeLineWrap(r)}}`:""}toJSON(){let{options:e}=this,n={};for(let r in e)n[r]=e[r].toJSON();return n}};var dD="table",hD="parquet",mD="csv",KA="json",j1="spatial",uD=new Map([[dD,oQ],[hD,iQ],[mD,sQ],[KA,aQ],[j1,cQ]]);function gD(t,e,n){let r=eQ(e);if(uD.has(r.type))return uD.get(r.type)(t,r,n);n.error("Unrecognized data format type.",e)}function eQ(t){return gr(t)&&(t={type:"json",data:t}),Is(t)&&(t={type:"table",query:t}),{...t,type:nQ(t)}}function nQ(t){return t.type||rQ(t.file)||"table"}function rQ(t){let e=t?.lastIndexOf(".");return e>0?t.slice(e+1):null}function oQ(t,e,n){let{query:r,type:o,...i}=e;return new F1(t,r,De(i,n))}function iQ(t,e,n){let{file:r,type:o,...i}=e;return new B1(t,r,De(i,n))}function sQ(t,e,n){let{file:r,type:o,...i}=e;return new z1(t,r,De(i,n))}function aQ(t,e,n){let{data:r,file:o,type:i,...s}=e,a=De(s,n);return r?new U1(t,r,a):new Y1(t,o,a)}function cQ(t,e,n){let{file:r,type:o,...i}=e;return new q1(t,r,De(i,n))}function pD(t,e){return e?new URL(t,e).toString():t}function fQ(t,e){let n=t?.codegen(e);return n?`, ${n}`:""}var P1=class extends bt{constructor(e,n){super(sD),this.name=e,this.format=n}},dl=class extends P1{constructor(e,n){super(e,n)}instantiateQuery(e){e.error("instantiateQuery not implemented")}codegenQuery(e){e.error("codegenQuery not implemented")}instantiate(e){let n=this.instantiateQuery(e);if(n)return n}codegen(e){let n=this.codegenQuery(e);if(n)return n}},F1=class extends dl{constructor(e,n,r){super(e,dD),this.query=n?.trim(),this.options=r}instantiateQuery(e){let{name:n,query:r,options:o}=this;if(r)return e.api.create(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,query:r,options:o}=this;if(r)return`\`${Dr(n,r,o.instantiate(e))}\``}toJSON(){let{format:e,query:n,options:r}=this;return{type:e,query:n,...r.toJSON()}}},Za=class extends dl{constructor(e,n,r,o,i){super(e,n),this.file=o,this.method=r,this.options=i}instantiateQuery(e){let{name:n,method:r,file:o,options:i}=this,s=pD(o,e.baseURL),a=i?.instantiate(e);return e.api[r](n,s,a)}codegenQuery(e){let{name:n,method:r,file:o,options:i}=this,s=pD(o,e.baseURL),a=fQ(i,e);return`${e.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:e,file:n,options:r}=this;return{type:e,file:n,...r.toJSON()}}},q1=class extends Za{constructor(e,n,r){super(e,j1,"loadSpatial",n,r)}},B1=class extends Za{constructor(e,n,r){super(e,hD,"loadParquet",n,r)}},z1=class extends Za{constructor(e,n,r){super(e,mD,"loadCSV",n,r)}},Y1=class extends Za{constructor(e,n,r){super(e,KA,"loadJSON",n,r)}},U1=class extends dl{constructor(e,n,r){super(e,KA),this.data=n,this.options=r}instantiateQuery(e){let{name:n,data:r,options:o}=this;return e.api.loadObjects(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,data:r,options:o}=this,i=o?","+o.codegen(e):"",s=`[
|
|
70
61
|
`+r.map(a=>JSON.stringify(a)).join(`,
|
|
71
62
|
`)+`
|
|
72
|
-
]`;return`${
|
|
73
|
-
`)),c.undent(),d.push(`${c.tab()}]);`));let
|
|
74
|
-
`),"];"]);let
|
|
75
|
-
`)}var
|
|
76
|
-
${this.tab()}${
|
|
77
|
-
`+this.tab()}else return
|
|
63
|
+
]`;return`${e.ns()}loadObjects("${n}", ${s}${i})`}toJSON(){let{format:e,data:n,options:r}=this;return{type:e,data:n,...r.toJSON()}}};function X1(t){let e=t.config?.extensions,n=new Set(e?ll(e):[]);for(let r of Object.values(t.data))r.format===j1&&n.add("spatial");return n}async function lQ(t,e){let{data:n,params:r,plotDefaults:o}=t,i=new G1({plotDefaults:o,...e}),s=[],a=X1(t);s.push(...Array.from(a).map(c=>ql(c)));for(let c of Object.values(n)){let f=c.instantiate(i);f&&s.push(f)}s.length>0&&await i.coordinator.exec(s);for(let[c,f]of Object.entries(r))if(!i.activeParams.has(c)){let l=f.instantiate(i);i.activeParams.set(c,l)}return{element:t.root.instantiate(i),params:i.activeParams}}var G1=class{constructor({api:e=HA(),plotDefaults:n=[],params:r=new Map,baseURL:o=null}={}){this.api=e,this.plotDefaults=n,this.activeParams=r,this.baseURL=o,this.coordinator=e.context.coordinator}error(e,n){pl(e,n)}};function uQ(t,e={}){let{root:n,data:r,params:o,plotDefaults:i}=t,{preamble:s,...a}=e,c=new V1({plotDefaults:i,...a}),f=[];for(let[x,b]of c.imports)f.push(Is(b)?`import ${b} from "${x}";`:`import { ${b.join(", ")} } from "${x}";`);let l=s?ll(s).map(x=>`${c.tab()}${x}`):[],u=[];if(c.connector){let x=`${c.ns()}${c.connector}Connector()`;u.push(`${c.tab()}${c.ns()}coordinator().databaseConnector(${x});`)}let p=[];for(let x of X1(t))p.push(`${c.ns()}loadExtension("${x}")`);for(let x of Object.values(r)){let b=x.codegen(c);b&&p.push(b)}let d=[];p.length&&(d.push(`${c.tab()}await ${c.ns()}coordinator().exec([`),c.indent(),d.push(p.map(x=>`${c.tab()}${x}`).join(`,
|
|
64
|
+
`)),c.undent(),d.push(`${c.tab()}]);`));let h=[];for(let[x,b]of Object.entries(o))h.push(`const ${lh(x)} = ${b.codegen(c)};`);let m=[],g=i;g.length&&(m=["const defaultAttributes = [",g.map(x=>" "+x.codegen(c)).join(`,
|
|
65
|
+
`),"];"]);let y=[`export default ${n.codegen(c)};`];return[...f,...hl(f),...l,...hl(l),...u,...hl(u),...d,...hl(d),...h,...hl(h),...m,...hl(m),...y].join(`
|
|
66
|
+
`)}var V1=class{constructor({plotDefaults:e=void 0,namespace:n="vg",connector:r=void 0,imports:o=new Map([["@uwdata/vgplot","* as vg"]]),baseURL:i=void 0,depth:s=0}={}){this.plotDefaults=e,this.namespace=`${n}.`,this.connector=r,this.imports=o,this.baseURL=i,this.depth=s}addImport(e,n){this.imports.has(e)?this.imports.get(e).push(n):this.imports.set(e,[n])}setImports(e,n){this.imports.set(e,n)}ns(){return this.namespace}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}stringify(e){if(gr(e)){let n=e.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(ul(e)){let n=Object.entries(e).map(([r,o])=>`${pQ(r)}: ${this.stringify(o)}`);return`{${this.maybeLineWrap(n)}}`}else return JSON.stringify(e)}maybeLineWrap(e){let n=80-2*this.depth;if(2*e.length+e.reduce((o,i)=>o+i.length,0)>n){this.indent();let o=e.map(i=>`
|
|
67
|
+
${this.tab()}${i}`).join(",");return this.undent(),o+`
|
|
68
|
+
`+this.tab()}else return e.join(", ")}error(e,n){pl(e,n)}};function pQ(t){return/^[A-Za-z_$]\w*/.test(t)?t:JSON.stringify(t)}function hl(t){return t?.length?[""]:[]}var Cs=class extends bt{constructor(e){super(O1),this.value=e}instantiate(){return this.value}codegen(e){return e.stringify(this.value)}toJSON(){return this.value}};function yD(t,e){let{select:n,include:r,...o}=t,i=De(o,e);return r&&(i.options.include=new tT(ll(r).map(s=>e.selectionRef(fh(s))))),new Qa(n,i)}var Qa=class extends bt{constructor(e=L1,n=new $s({})){super(KL),this.select=e,this.options=n}instantiate(e){let{select:n,options:r}=this;return e.api.Selection[n](r.instantiate(e))}codegen(e){let{select:n,options:r}=this;return`${e.ns()}Selection.${n}(${r.codegen(e)})`}toJSON(){let{select:e,options:n}=this;return{select:e,...n.toJSON()}}},tT=class extends bt{constructor(e){super(nD),this.refs=e}instantiate(e){return this.refs.map(n=>n.instantiate(e))}codegen(e){return`[${this.refs.map(n=>n.codegen(e)).join(", ")}]`}toJSON(){return this.refs.map(e=>e.toJSON())}};var dQ=new Set([R1,iD,rD,L1,oD]);function xD(t,e){let n=ul(t)?t:{value:t},{select:r=R1,value:o,date:i}=n;return dQ.has(r)||e.error(`Unrecognized param type: ${r}`,n),r!==R1?yD(t,e):gr(o)?new Ja(o.map(s=>e.maybeParam(s))):new Ja(o,i)}var Ja=class extends bt{constructor(e,n){super(eD),this.value=e,this.date=n}instantiate(e){let{date:n,value:r}=this,{Param:o}=e.api;return gr(r)?o.array(r.map(i=>i.instantiate(e))):o.value(lD(n,r))}codegen(e){let{value:n,date:r}=this,o=`${e.ns()}Param.`;return gr(n)?`${o}array([${n.map(i=>i.codegen(e)).join(", ")}])`:r?`${o}value(new Date(${JSON.stringify(r)}))`:`${o}value(${JSON.stringify(n)})`}toJSON(){let{date:e,value:n}=this;return gr(n)?n.map(r=>r.toJSON()):e?{date:e}:n}};var uh=class extends bt{constructor(e){super(tD),this.name=e}instantiate(e){return e.activeParams?.get(this.name)}codegen(e){return lh(this.name)}toJSON(){return lh(this.name)}};function Z1(t,e,n){return n.plot?.attributes?.has(t)||n.error(`Unrecognized attribute: ${t}`),new W1(t,e===ah?new H1:n.maybeParam(e))}var W1=class extends bt{constructor(e,n){super(cD),this.name=e,this.value=n}instantiate(e){let{name:n,value:r}=this;return e.api[n](r.instantiate(e))}codegen(e){let{name:n,value:r}=this;return`${e.tab()}${e.ns()}${n}(${r.codegen(e)})`}toJSON(){let{name:e,value:n}=this;return{[e]:n.toJSON()}}},H1=class extends bt{constructor(){super(O1),this.value=ah}instantiate(e){return e.api[ah]}codegen(e){return`${e.ns()}${ah}`}toJSON(){return this.value}};function bD(t,e){let n=t[il].map(r=>e.parseComponent(r));return new Q1(n)}var Q1=class extends bt{constructor(e){super(il,e)}instantiate(e){return e.api[il](this.children.map(n=>n.instantiate(e)))}codegen(e){e.indent();let n=this.children.map(r=>r.codegen(e));return e.undent(),`${e.tab()}${e.ns()}${this.type}(
|
|
78
69
|
${n.join(`,
|
|
79
70
|
`)}
|
|
80
|
-
${
|
|
81
|
-
${
|
|
82
|
-
${
|
|
83
|
-
`,
|
|
84
|
-
`);return
|
|
85
|
-
${
|
|
86
|
-
${
|
|
71
|
+
${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function wD(t){return new J1(t[al])}var J1=class extends bt{constructor(e){super(al),this.value=e}instantiate(e){return e.api[al](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function vD(t,e){let{[ih]:n,...r}=t;return e.inputs?.has(n)||e.error(`Unrecognized input type: ${n}`,t),new K1(n,De(r,e))}var K1=class extends bt{constructor(e,n){super(ih),this.name=e,this.options=n}instantiate(e){return e.api[this.name](this.options.instantiate(e))}codegen(e){let n=this.options.codegen(e);return`${e.tab()}${e.ns()}${this.name}(${n})`}toJSON(){let{type:e,name:n,options:r}=this;return{[e]:n,...r.toJSON()}}};function eb(t,e){let{[sh]:n,...r}=t,o=`${n}Legend`;return e.plot?.legends?.has(o)||e.error(`Unrecognized legend type: ${n}`,t),new tb(o,n,De(r,e))}var tb=class extends bt{constructor(e,n,r){super(sh),this.key=e,this.name=n,this.options=r}instantiate(e){return e.api[this.key](this.options.instantiate(e))}codegen(e){let n=this.options.codegen(e);return`${e.tab()}${e.ns()}${this.key}(${n})`}toJSON(){let{type:e,name:n,options:r}=this;return{[e]:n,...r.toJSON()}}};function _D(t,e){let{[ZA]:n,...r}=t;return e.plot?.interactors?.has(n)||e.error(`Unrecognized interactor type: ${n}`,t),new nb(n,De(r,e))}var nb=class extends bt{constructor(e,n){super(fD),this.name=e,this.options=n}instantiate(e){return e.api[this.name](this.options.instantiate(e))}codegen(e){let n=this.options.codegen(e);return`${e.tab()}${e.ns()}${this.name}(${n})`}toJSON(){let{name:e,options:n}=this;return{[ZA]:e,...n.toJSON()}}};function SD(t,e){let{label:n}=t,r=t[Es]?Es:t[Si]?Si:e.error("Unrecognized expression type",t),o=t[r],i=o.split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,f=0;c<i.length;++c){let l=i[c];l.startsWith("$")?(a[f]=e.maybeParam(l),s[++f]=""):s[f]+=l}return new rb(o,s,a,n,r===Si)}var rb=class extends bt{constructor(e,n,r,o,i){super(aD),this.value=e,this.spans=n,this.params=r,this.label=o,this.aggregate=i}instantiate(e){let{spans:n,params:r,label:o,aggregate:i}=this,s=e.api[i?Si:Es],a=r.map(c=>c.instantiate(e));return s(n,...a).annotate({label:o})}codegen(e){let{spans:n,params:r,label:o,aggregate:i}=this,s=i?Si:Es,a="",c=r.length;for(let f=0;f<c;++f)a+=n[f]+"${"+r[f].codegen(e)+"}";return a+=n[c],`${e.ns()}${s}\`${a}\``+(o?`.annotate({ label: ${JSON.stringify(o)} })`:"")}toJSON(){return{[this.aggregate?Si:Es]:this.value}}};function MD(t,e){if(!t)return null;if(gr(t))return new Cs(t);let{from:n,...r}=t;return new ob(n,De(r,e))}var ob=class extends bt{constructor(e,n){super(QA),this.table=e,this.options=n}instantiate(e){let{table:n,options:r}=this;return e.api[QA](n,r.instantiate(e))}codegen(e){let{type:n,table:r,options:o}=this,i=o.codegen(e);return`${e.ns()}${n}("${r}"${i?", "+i:""})`}toJSON(){let{type:e,table:n,options:r}=this;return{[e]:n,...r.toJSON()}}};function ib(t){return t==null?[]:[t].flat()}function AD(t,e){let n;for(let r in t)e.transforms.has(r)&&(n=r);if(n)if(n==="bin"){let{bin:r,...o}=t,[i]=ib(r);return new nT(n,i,De(o,e))}else{let r=n==="count"&&!t[n]?[]:ib(t[n]),o={distinct:t.distinct,orderby:ib(t.orderby).map(i=>e.maybeParam(i)),partitionby:ib(t.partitionby).map(i=>e.maybeParam(i)),rows:t.rows?e.maybeParam(t.rows):null,range:t.range?e.maybeParam(t.range):null};return new sb(n,r,o)}}var sb=class extends bt{constructor(e,n,r){super(JA),this.name=e,this.args=n,this.options=r}instantiate(e){let{name:n,args:r,options:o}=this,{distinct:i,orderby:s,partitionby:a,rows:c,range:f}=o,l=e.api[n](...r);return i&&(l=l.distinct()),s.length&&(l=l.orderby(s.map(u=>u.instantiate(e)))),a.length&&(l=l.partitionby(a.map(u=>u.instantiate(e)))),c!=null?l=l.rows(c.instantiate(e)):f!=null&&(l=l.range(f.instantiate(e))),l}codegen(e){let{name:n,args:r,options:o}=this,{distinct:i,orderby:s,partitionby:a,rows:c,range:f}=o,l=`${e.ns()}${n}(`+r.map(u=>JSON.stringify(u)).join(", ")+")";if(i&&(l+=".distinct()"),s.length){let u=s.map(p=>p.codegen(e));l+=`.orderby(${u.join(", ")})`}if(a.length){let u=a.map(p=>p.codegen(e));l+=`.partitionby(${u.join(", ")})`}return c?l+=`.rows(${c.codegen(e)})`:f&&(l+=`.range(${f.codegen(e)})`),l}toJSON(){let{name:e,args:n,options:r}=this,{distinct:o,orderby:i,partitionby:s,rows:a,range:c}=r,f={[e]:eT(n)};return o&&(f.distinct=!0),i.length&&(f.orderby=eT(i.map(l=>l.toJSON()))),s.length&&(f.partitionby=eT(s.map(l=>l.toJSON()))),a?f.rows=a.toJSON():c&&(f.range=c.toJSON()),f}},nT=class extends bt{constructor(e,n,r){super(JA),this.name=e,this.arg=n,this.options=r}instantiate(e){let{name:n,arg:r,options:o}=this;return e.api[n](r,o.instantiate(e))}codegen(e){let{name:n,arg:r,options:o}=this,i=o.codegen(e);return`${e.ns()}${n}(`+JSON.stringify(r)+(i?`, ${i}`:"")+")"}toJSON(){let{name:e,arg:n,options:r}=this;return{[e]:n,...r.toJSON()}}};function eT(t){return t.length===0?"":t.length===1?t[0]:t}function hQ(t,e){if(ul(t))return t[Es]||t[Si]?SD(t,e):AD(t,e)}function TD(t,e){let{mark:n,data:r,...o}=t;e.plot?.marks?.has(n)||e.error(`Unrecognized mark type: ${n}`,t);let i=MD(r,e),s={};for(let a in o){let c=o[a];s[a]=hQ(c,e)||e.maybeParam(c)}return new ab(n,i,new $s(s))}var ab=class extends bt{constructor(e,n,r){super(D1),this.name=e,this.data=n,this.options=r}instantiate(e){let{name:n,data:r,options:o}=this,i=o.instantiate(e);return r?e.api[n](r.instantiate(e),i):e.api[n](i)}codegen(e){let{name:n,data:r,options:o}=this,i=r?r.codegen(e):"",s=o.codegen(e),a;if(i&&s){e.indent();let c=o.codegen(e);a=`
|
|
72
|
+
${e.tab()}${i},
|
|
73
|
+
${e.tab()}${c}
|
|
74
|
+
`,e.undent(),a+=e.tab()}else a=`${i}${s}`;return`${e.tab()}${e.ns()}${n}(${a})`}toJSON(){let{type:e,name:n,data:r,options:o}=this;return{[e]:n,...r?{data:r.toJSON()}:{},...o.toJSON()}}};function ED(t,e){return rT({plot:[t]},e)}function rT(t,e){let{[fl]:n,...r}=t,o=Object.entries(r).map(([s,a])=>Z1(s,a,e)),i=n.map(s=>Is(s.mark)?TD(s,e):Is(s.legend)?eb(s,e):Is(s.select)?_D(s,e):e.error("Invalid plot entry.",s));return new cb(i,o)}var cb=class extends bt{constructor(e,n){super(fl,e),this.attributes=n}instantiate(e){let n=[...e.plotDefaults||[],...this.attributes||[]];return e.api[fl](this.children.map(r=>r.instantiate(e)),n.map(r=>r.instantiate(e)))}codegen(e){let{type:n,children:r,attributes:o}=this;e.indent();let i=[...r.map(s=>s.codegen(e)),...e.plotDefaults?.length?[`${e.tab()}...defaultAttributes`]:[],...o.map(s=>s.codegen(e))].join(`,
|
|
75
|
+
`);return e.undent(),`${e.tab()}${e.ns()}${n}(
|
|
76
|
+
${i}
|
|
77
|
+
${e.tab()})`}toJSON(){let{type:e,children:n,attributes:r}=this,o={[e]:n.map(i=>i.toJSON())};for(let i of r)Object.assign(o,i.toJSON());return o}};function ID(t,e){let n=t[sl].map(r=>e.parseComponent(r));return new fb(n)}var fb=class extends bt{constructor(e){super(sl,e)}instantiate(e){return e.api[sl](this.children.map(n=>n.instantiate(e)))}codegen(e){e.indent();let n=this.children.map(r=>r.codegen(e));return e.undent(),`${e.tab()}${e.ns()}${this.type}(
|
|
87
78
|
${n.join(`,
|
|
88
79
|
`)}
|
|
89
|
-
${
|
|
80
|
+
${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function $D(t){return new lb(t[cl])}var lb=class extends bt{constructor(e){super(cl),this.value=e}instantiate(e){return e.api[cl](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function CD(t=[]){return new Map([[fl,rT],[D1,ED],[sh,eb],[ih,vD],[il,bD],[sl,ID],[al,wD],[cl,$D],...t])}function kD(t=[]){return new Set(["menu","search","slider","table",...t])}function ND({attributes:t=mQ(),interactors:e=gQ(),legends:n=yQ(),marks:r=xQ()}={}){return{attributes:t,interactors:e,legends:n,marks:r}}function mQ(t=[]){return new Set([...Object.keys(I1),...t])}function gQ(t=[]){return new Set([...Object.keys(k1),...t])}function yQ(t=[]){return new Set([...Object.keys(N1),...t])}function xQ(t=[]){return new Set([...Object.keys(C1),...t])}function OD(t=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","count","covariance","covarPop","dateMonth","dateMonthDay","dateDay","first","geojson","last","max","median","min","mode","product","quantile","stddev","stddevPop","sum","variance","varPop","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value",...t])}function bQ(t,e){return new oT(e).parse(t)}var oT=class{constructor({components:e=CD(),transforms:n=OD(),inputs:r=kD(),plot:o=ND(),params:i=[],datasets:s=[]}={}){this.components=e,this.transforms=n,this.inputs=r,this.plot=o,this.params=new Map(i),this.datasets=new Map(s)}parse(e){let{meta:n,config:r,data:o={},params:i,plotDefaults:s={},...a}=e;for(let c in o)this.datasets.set(c,gD(c,o[c],this));this.plotDefaults=Object.entries(s).map(([c,f])=>Z1(c,f,this));for(let c in i)this.params.set(c,xD(i[c],this));return new ch(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(e){for(let[n,r]of this.components)if(e[n]!=null)return r(e,this);this.error("Invalid specification.",e)}maybeParam(e){let n=fh(e);return n?this.paramRef(n):new Cs(e)}maybeSelection(e){let n=fh(e);return n?this.selectionRef(n):new Cs(e)}paramRef(e,n=()=>new Ja){let{params:r}=this;if(!e)return null;let o=r.get(e);return o||(o=n(),r.set(e,o)),new uh(e)}selectionRef(e,n=!1){let r=this.params.get(e);return n&&r&&!(r instanceof Qa)?null:this.paramRef(e,()=>new Qa)}error(e,n){pl(e,n)}};export{Si as AGG,bt as ASTNode,cD as ATTRIBUTE,rD as CROSSFILTER,z1 as CSVDataNode,V1 as CodegenContext,sD as DATA,gDt as DATAREF,P1 as DataNode,aD as EXPRESSION,rb as ExpressionNode,ah as FIXED,QA as FROM,Za as FileDataNode,il as HCONCAT,Q1 as HConcatNode,al as HSPACE,J1 as HSpaceNode,nD as INCLUDE,ih as INPUT,fD as INTERACTOR,L1 as INTERSECT,K1 as InputNode,G1 as InstantiateContext,Y1 as JSONDataNode,sh as LEGEND,O1 as LITERAL,U1 as LiteralJSONDataNode,Cs as LiteralNode,D1 as MARK,JL as OPTIONS,$s as OptionsNode,eD as PARAM,tD as PARAMREF,fl as PLOT,Ja as ParamNode,uh as ParamRefNode,B1 as ParquetDataNode,W1 as PlotAttributeNode,H1 as PlotFixedNode,ob as PlotFromNode,nb as PlotInteractorNode,tb as PlotLegendNode,ab as PlotMarkNode,cb as PlotNode,dl as QueryDataNode,ZA as SELECT,KL as SELECTION,iD as SINGLE,QL as SPEC,Es as SQL,Qa as SelectionNode,q1 as SpatialDataNode,ch as SpecNode,JA as TRANSFORM,F1 as TableDataNode,sb as TransformNode,oD as UNION,R1 as VALUE,sl as VCONCAT,fb as VConcatNode,cl as VSPACE,lb as VSpaceNode,lQ as astToDOM,uQ as astToESM,bQ as parseSpec};
|