@uwdata/mosaic-spec 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- var bq=Object.create;var cw=Object.defineProperty;var wq=Object.getOwnPropertyDescriptor;var vq=Object.getOwnPropertyNames;var _q=Object.getPrototypeOf,Sq=Object.prototype.hasOwnProperty;var S7=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pc=(t,e)=>{for(var n in e)cw(t,n,{get:e[n],enumerable:!0})},Mq=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vq(e))!Sq.call(t,o)&&o!==n&&cw(t,o,{get:()=>e[o],enumerable:!(r=wq(e,o))||r.enumerable});return t};var Aq=(t,e,n)=>(n=t!=null?bq(_q(t)):{},Mq(e||!t||!t.__esModule?cw(n,"default",{value:t,enumerable:!0}):n,t));var JD=S7((kPt,ZD)=>{"use strict";function qZ(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 BZ(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 zZ(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 YZ(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 UZ(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 Bh(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)}ZD.exports={ge:function(t,e,n,r,o){return Bh(t,e,n,r,o,qZ)},gt:function(t,e,n,r,o){return Bh(t,e,n,r,o,BZ)},lt:function(t,e,n,r,o){return Bh(t,e,n,r,o,zZ)},le:function(t,e,n,r,o){return Bh(t,e,n,r,o,YZ)},eq:function(t,e,n,r,o){return Bh(t,e,n,r,o,UZ)}}});var sP=S7((LPt,iP)=>{"use strict";var Zb=JD(),qu=0,Ac=1,Qb=2;iP.exports=XZ;function sM(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 zh=sM.prototype;function oM(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 eP(t,e){var n=Bu(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 KD(t,e){var n=t.intervals([]);n.push(e),eP(t,n)}function tP(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?qu:(n.splice(r,1),eP(t,n),Ac)}zh.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t};zh.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)?KD(this,t):this.left.insert(t):this.left=Bu([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?KD(this,t):this.right.insert(t):this.right=Bu([t]);else{var n=Zb.ge(this.leftPoints,t,aM),r=Zb.ge(this.rightPoints,t,cM);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}};zh.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return qu;var n=this.right?this.right.count:0;if(4*n>3*(e-1))return tP(this,t);var r=this.left.remove(t);return r===Qb?(this.left=null,this.count-=1,Ac):(r===Ac&&(this.count-=1),r)}else if(t[0]>this.mid){if(!this.right)return qu;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return tP(this,t);var r=this.right.remove(t);return r===Qb?(this.right=null,this.count-=1,Ac):(r===Ac&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===t?Qb:qu;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}oM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?oM(this,this.left):oM(this,this.right);return Ac}for(var a=Zb.ge(this.leftPoints,t,aM);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=Zb.ge(this.rightPoints,t,cM);r<this.rightPoints.length&&this.rightPoints[r][1]===t[1];++r)if(this.rightPoints[r]===t)return this.rightPoints.splice(r,1),Ac}return qu}};function nP(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 rP(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 oP(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}zh.queryPoint=function(t,e){if(t<this.mid){if(this.left){var n=this.left.queryPoint(t,e);if(n)return n}return nP(this.leftPoints,t,e)}else if(t>this.mid){if(this.right){var n=this.right.queryPoint(t,e);if(n)return n}return rP(this.rightPoints,t,e)}else return oP(this.leftPoints,e)};zh.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?nP(this.leftPoints,e,n):t>this.mid?rP(this.rightPoints,t,n):oP(this.leftPoints,n)};function jZ(t,e){return t-e}function aM(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function cM(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function Bu(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(jZ);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(aM),f.sort(cM),new sM(r,Bu(o),Bu(i),c,f)}function iM(t){this.root=t}var zu=iM.prototype;zu.insert=function(t){this.root?this.root.insert(t):this.root=new sM(t[0],null,null,[t],[t])};zu.remove=function(t){if(this.root){var e=this.root.remove(t);return e===Qb&&(this.root=null),e!==qu}return!1};zu.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)};zu.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)};Object.defineProperty(zu,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(zu,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function XZ(t){return!t||t.length===0?new iM(null):new iM(Bu(t))}});var M7={};function il(t,e=!1){let n,r,o=M7;function i(f){n=t(f).catch(()=>{}).finally(()=>{if(r){let{value:u}=r;r=null,i(u)}else n=null})}function s(f){r={event:f}}function a(f){n?s(f):i(f)}function c(f){o!==f&&requestAnimationFrame(()=>{let u=o;o=M7,a(u)}),o=f}return e?c:a}var Bn=class{constructor(e){this._filterBy=e,this._requestUpdate=il(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(e){this._coordinator=e}get filterBy(){return this._filterBy}get filterStable(){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 sl=Uint8Array.of(65,82,82,79,87,49),mr={V1:0,V2:1,V3:2,V4:3,V5:4};var xr={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},Fc={HALF:0,SINGLE:1,DOUBLE:2},Ko={DAY:0,MILLISECOND:1},De={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},gr={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},ti={Sparse:0,Dense:1};var qc=Uint8Array,Im=Uint16Array,Nm=Uint32Array,Cm=BigUint64Array,al=Int8Array,A7=Int16Array,zn=Int32Array,Zn=BigInt64Array,fw=Float32Array,Hi=Float64Array;function T7(t,e){let n=Math.log2(t)-3;return(e?[al,A7,zn,Zn]:[qc,Im,Nm,Cm])[n]}var rtt=Object.getPrototypeOf(Int8Array);function Bc(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 km(t,e,n){if(e(t))return t;throw new Error(n(t))}function Yn(t,e,n){return e=Array.isArray(e)?e:Object.values(e),km(t,r=>e.includes(r),n??(()=>`${t} must be one of ${e}`))}function Lm(t,e){for(let[n,r]of Object.entries(t))if(r===e)return n;return"<Unknown>"}var ei=t=>`Unsupported data type: "${Lm(z,t)}" (id ${t})`,cl=(t,e,n=!0,r=null)=>({name:t,type:e,nullable:n,metadata:r});function E7(t){return Object.hasOwn(t,"name")&&I7(t.type)}function I7(t){return typeof t?.typeId=="number"}function Qi(t,e="",n=!0){return E7(t)?t:cl(e,km(t,I7,()=>"Data type expected."),n)}var Rm=(t,e,n=!1,r=-1)=>({typeId:z.Dictionary,id:r,dictionary:t,indices:e||zc(),ordered:n});var Om=(t=32,e=!0)=>({typeId:z.Int,bitWidth:Yn(t,[8,16,32,64]),signed:e,values:T7(t,e)});var zc=()=>Om(32);var uw=(t=2)=>({typeId:z.Float,precision:Yn(t,Fc),values:[Im,fw,Hi][t]});var lw=()=>({typeId:z.Binary,offsets:zn}),$m=()=>({typeId:z.Utf8,offsets:zn});var pw=(t,e,n=128)=>({typeId:z.Decimal,precision:t,scale:e,bitWidth:Yn(n,[128,256]),values:Cm}),dw=t=>({typeId:z.Date,unit:Yn(t,Ko),values:t===Ko.DAY?zn:Zn});var hw=(t=De.MILLISECOND,e=32)=>({typeId:z.Time,unit:Yn(t,De),bitWidth:Yn(e,[32,64]),values:e===32?zn:Zn});var Dm=(t=De.MILLISECOND,e=null)=>({typeId:z.Timestamp,unit:Yn(t,De),timezone:e,values:Zn}),mw=(t=gr.MONTH_DAY_NANO)=>({typeId:z.Interval,unit:Yn(t,gr),values:t===gr.MONTH_DAY_NANO?void 0:zn}),Pm=t=>({typeId:z.List,children:[Qi(t)],offsets:zn}),Fm=t=>({typeId:z.Struct,children:Array.isArray(t)&&E7(t[0])?t:Object.entries(t).map(([e,n])=>cl(e,n))}),xw=(t,e,n,r)=>(n??=e.map((o,i)=>i),{typeId:z.Union,mode:Yn(t,ti),typeIds:n,typeMap:n.reduce((o,i,s)=>(o[i]=s,o),{}),children:e.map((o,i)=>Qi(o,`_${i}`)),typeIdForValue:r,offsets:zn}),gw=t=>({typeId:z.FixedSizeBinary,stride:t}),qm=(t,e)=>({typeId:z.FixedSizeList,stride:e,children:[Qi(t)]}),N7=(t,e)=>({typeId:z.Map,keysSorted:t,children:[e],offsets:zn});var yw=(t=De.MILLISECOND)=>({typeId:z.Duration,unit:Yn(t,De),values:Zn}),bw=()=>({typeId:z.LargeBinary,offsets:Zn}),ww=()=>({typeId:z.LargeUtf8,offsets:Zn}),vw=t=>({typeId:z.LargeList,children:[Qi(t)],offsets:Zn}),_w=(t,e)=>({typeId:z.RunEndEncoded,children:[km(Qi(t,"run_ends"),n=>n.type.typeId===z.Int,()=>"Run-ends must have an integer type."),Qi(e,"values")]});var Sw=t=>({typeId:z.ListView,children:[Qi(t,"value")],offsets:zn}),Mw=t=>({typeId:z.LargeListView,children:[Qi(t,"value")],offsets:Zn});var Tq=new Hi(2),Bm=Tq.buffer,ptt=new Zn(Bm),dtt=new Nm(Bm),htt=new zn(Bm),mtt=new qc(Bm);function io(t){if(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${t}`);return Number(t)}function zm(t,e){return Number(t/e)+Number(t%e)/Number(e)}var Yc=t=>BigInt.asUintN(64,t);function k7(t,e){let n=e<<1,r;return BigInt.asIntN(64,t[n+1])<0?(r=Yc(~t[n])|Yc(~t[n+1])<<64n,r=-(r+1n)):r=t[n]|t[n+1]<<64n,r}function L7(t,e){let n=e<<2,r;return BigInt.asIntN(64,t[n+3])<0?(r=Yc(~t[n])|Yc(~t[n+1])<<64n|Yc(~t[n+2])<<128n|Yc(~t[n+3])<<192n,r=-(r+1n)):r=t[n]|t[n+1]<<64n|t[n+2]<<128n|t[n+3]<<192n,r}var Iq=new TextDecoder("utf-8"),wtt=new TextEncoder;function Uc(t){return Iq.decode(t)}var aa=4;function Aw(t,e){return(t[e>>3]&1<<e%8)!==0}function ln(t,e){let n=e+Xt(t,e),r=n-Xt(t,n),o=Je(t,r);return(i,s,a=null)=>{if(i<o){let c=Je(t,r+i);if(c)return s(t,n+c)}return a}}function qr(t,e){return e}function Zi(t,e){return!!Nq(t,e)}function Nq(t,e){return fl(t,e)<<24>>24}function fl(t,e){return t[e]}function Je(t,e){return Cq(t,e)<<16>>16}function Cq(t,e){return t[e]|t[e+1]<<8}function Xt(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function R7(t,e){return Xt(t,e)>>>0}function Pe(t,e){return io(BigInt.asIntN(64,BigInt(R7(t,e))+(BigInt(R7(t,e+aa))<<32n)))}function ca(t,e){let n=e+Xt(t,e),r=Xt(t,n);return n+=aa,Uc(t.subarray(n,n+r))}function Jn(t,e,n,r){if(!e)return[];let o=e+Xt(t,e);return Array.from({length:Xt(t,o)},(i,s)=>r(t,o+aa+s*n))}var Tw=Symbol("rowIndex");function ul(t,e){class n{constructor(i){this[Tw]=i}toJSON(){return O7(t,e,this[Tw])}}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[Tw])},enumerable:!0})}return o=>new n(o)}function Ym(t,e){return n=>O7(t,e,n)}function O7(t,e,n){let r={};for(let o=0;o<t.length;++o)r[t[o]]=e[o].at(n);return r}function $7(t){return t instanceof Ji}var fa=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 Aw(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)}},Ji=class extends fa{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]()}},ll=class extends fa{static ArrayType=Hi},se=class extends fa{static ArrayType=Array},pl=class extends se{value(e){return null}},so=class extends ll{value(e){return io(this.values[e])}},Um=class extends ll{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)}},jm=class extends se{value(e){return Aw(this.values,e)}},Xm=class extends fa{constructor(e){super(e);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?k7:L7,this.scale=10n**BigInt(r)}},Wm=class extends Xm{static ArrayType=Hi;value(e){return zm(this.decimal(this.values,e),this.scale)}},Vm=class extends Xm{static ArrayType=Array;value(e){return this.decimal(this.values,e)}},dl=class extends se{constructor(e){super(e),this.source=e}value(e){return new Date(this.source.value(e))}},Gm=class extends ll{value(e){return 864e5*this.values[e]}},D7=so,Hm=class extends so{value(e){return super.value(e)*1e3}},P7=so,Qm=class extends so{value(e){return zm(this.values[e],1000n)}},Zm=class extends so{value(e){return zm(this.values[e],1000000n)}},Jm=class extends se{value(e){return this.values.subarray(e<<1,e+1<<1)}},Km=class extends se{value(e){let n=this.values,r=e<<4;return Float64Array.of(Xt(n,r),Xt(n,r+4),Pe(n,r+8))}},F7=({values:t,offsets:e},n)=>t.subarray(e[n],e[n+1]),q7=({values:t,offsets:e},n)=>t.subarray(io(e[n]),io(e[n+1])),t0=class extends se{value(e){return F7(this,e)}},e0=class extends se{value(e){return q7(this,e)}},n0=class extends se{value(e){return Uc(F7(this,e))}},r0=class extends se{value(e){return Uc(q7(this,e))}},o0=class extends se{value(e){let n=this.offsets;return this.children[0].slice(n[e],n[e+1])}},i0=class extends se{value(e){let n=this.offsets;return this.children[0].slice(io(n[e]),io(n[e+1]))}},s0=class extends se{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(n,r)}},a0=class extends se{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(io(n),io(r))}},c0=class extends se{constructor(e){super(e),this.stride=this.type.stride}},f0=class extends c0{value(e){let{stride:n,values:r}=this;return r.subarray(e*n,(e+1)*n)}},u0=class extends c0{value(e){let{children:n,stride:r}=this;return n[0].slice(e*r,(e+1)*r)}};function B7({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 l0=class extends se{value(e){return B7(this,e)}},p0=class extends se{value(e){return new Map(B7(this,e))}},hl=class extends se{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)}},d0=class extends hl{value(e){return super.value(e,this.offsets[e])}},ml=class extends se{constructor(e,n=Ym){super(e),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(e){return this.factory(e)}},h0=class extends ml{constructor(e){super(e,ul)}},m0=class extends se{value(e){let[{values:n},r]=this.children;return r.at(Bc(n,e))}},x0=class extends se{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]}},g0=class extends se{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=Xt(s,o);return a>12&&(i=Xt(s,o+12),s=r[Xt(s,o+8)]),s.subarray(i,i+a)}},y0=class extends g0{value(e){return this.view(e)}},b0=class extends g0{value(e){return Uc(this.view(e))}};function Ew(t){let e=[];return{add(n){return e.push(n),this},clear:()=>e=[],done:()=>new ua(e,t)}}var ua=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]():kq(e)}at(e){let{data:n,offsets:r}=this,o=Bc(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&&$7(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?Lq(a,r):Rq(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*kq(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 Lq(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 Rq(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 jc=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?ul:Ym;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)=>Oq(s[a],n[c]))},e.map(a=>r[a]),o===ul)}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=Bc(i,e)-1;return r(s)(e-i[s])}get(e){return this.at(e)}};function Oq(t,e){return e!=null&&e!==t.name?{...t,name:e}:t}function xl(t,e={}){let{typeId:n,bitWidth:r,precision:o,unit:i}=t,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:f,useProxy:u}=e;switch(n){case z.Null:return pl;case z.Bool:return jm;case z.Int:case z.Time:case z.Duration:return s||r<64?Ji:so;case z.Float:return o?Ji:Um;case z.Date:return z7(i===Ko.DAY?Gm:D7,a&&dl);case z.Timestamp:return z7(i===De.SECOND?Hm:i===De.MILLISECOND?P7:i===De.MICROSECOND?Qm:Zm,a&&dl);case z.Decimal:return c?Vm:Wm;case z.Interval:return i===gr.DAY_TIME?Jm:i===gr.YEAR_MONTH?Ji:Km;case z.FixedSizeBinary:return f0;case z.Utf8:return n0;case z.LargeUtf8:return r0;case z.Binary:return t0;case z.LargeBinary:return e0;case z.BinaryView:return y0;case z.Utf8View:return b0;case z.List:return o0;case z.LargeList:return i0;case z.Map:return f?p0:l0;case z.ListView:return s0;case z.LargeListView:return a0;case z.FixedSizeList:return u0;case z.Struct:return u?h0:ml;case z.RunEndEncoded:return m0;case z.Dictionary:return x0;case z.Union:return t.mode?d0:hl}throw new Error(ei(n))}function z7(t,e){return e?class extends e{constructor(r){super(new t(r))}}:t}function $q(t,e){return{offset:Pe(t,e),metadataLength:Xt(t,e+8),bodyLength:Pe(t,e+16)}}function Iw(t,e){return Jn(t,e,24,$q)}function w0(t,e,n){let r=ln(t,e);if(r(10,qr,0))throw new Error("Record batch compression not implemented");let o=n<mr.V4?8:0;return{length:r(4,Pe,0),nodes:Jn(t,r(6,qr),16,(i,s)=>({length:Pe(i,s),nullCount:Pe(i,s+8)})),regions:Jn(t,r(8,qr),16+o,(i,s)=>({offset:Pe(i,s+o),length:Pe(i,s+o+8)})),variadic:Jn(t,r(12,qr),8,Pe)}}function Y7(t,e,n){let r=ln(t,e);return{id:r(4,Pe,0),data:r(6,(o,i)=>w0(o,i,n)),isDelta:r(8,Zi,!1)}}function Nw(t,e,n,r){Yn(n,z,ei);let o=ln(t,e);switch(n){case z.Binary:return lw();case z.Utf8:return $m();case z.LargeBinary:return bw();case z.LargeUtf8:return ww();case z.List:return Pm(r[0]);case z.ListView:return Sw(r[0]);case z.LargeList:return vw(r[0]);case z.LargeListView:return Mw(r[0]);case z.Struct:return Fm(r);case z.RunEndEncoded:return _w(r[0],r[1]);case z.Int:return Om(o(4,Xt,0),o(6,Zi,!1));case z.Float:return uw(o(4,Je,Fc.HALF));case z.Decimal:return pw(o(4,Xt,0),o(6,Xt,0),o(8,Xt,128));case z.Date:return dw(o(4,Je,Ko.MILLISECOND));case z.Time:return hw(o(4,Je,De.MILLISECOND),o(6,Xt,32));case z.Timestamp:return Dm(o(4,Je,De.SECOND),o(6,ca));case z.Interval:return mw(o(4,Je,gr.YEAR_MONTH));case z.Duration:return yw(o(4,Je,De.MILLISECOND));case z.FixedSizeBinary:return gw(o(4,Xt,0));case z.FixedSizeList:return qm(r[0],o(4,Xt,0));case z.Map:return N7(o(4,Zi,!1),r[0]);case z.Union:return xw(o(4,Je,ti.Sparse),r,Jn(t,o(6,qr),4,Xt))}return{typeId:n}}function gl(t,e){let n=Jn(t,e,4,(r,o)=>{let i=ln(r,o);return[i(4,ca),i(6,ca)]});return n.length?new Map(n):null}function v0(t,e,n){let r=ln(t,e);return{version:n,endianness:r(4,Je,0),fields:r(6,Dq,[]),metadata:r(8,gl)}}function Dq(t,e){return Jn(t,e,4,U7)}function U7(t,e){let n=ln(t,e),r=n(8,fl,z.NONE),o=n(10,qr,0),i=n(12,Fq),s=n(14,(c,f)=>Pq(c,f)),a=Nw(t,o,r,s);return i&&(i.dictionary=a,a=i),{name:n(4,ca),type:a,nullable:n(6,Zi,!1),metadata:n(16,gl)}}function Pq(t,e){let n=Jn(t,e,4,U7);return n.length?n:null}function Fq(t,e){if(!e)return null;let n=ln(t,e);return Rm(null,n(6,qq,zc()),n(8,Zi,!1),n(4,Pe,0))}function qq(t,e){return Nw(t,e,z.Int)}var Bq=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,zq=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,Yq=t=>`Unsupported message type: ${t} (${Lm(xr,t)})`;function _0(t,e){let n=Xt(t,e)||0;if(e+=aa,n===-1&&(n=Xt(t,e)||0,e+=aa),n===0)return null;let r=t.subarray(e,e+=n);if(r.byteLength<n)throw new Error(Bq(n,r.byteLength));let o=ln(r,0),i=o(4,Je,mr.V1),s=o(6,fl,xr.NONE),a=o(8,qr,0),c=o(10,Pe,0),f;if(a){let u=s===xr.Schema?v0:s===xr.DictionaryBatch?Y7:s===xr.RecordBatch?w0:null;if(!u)throw new Error(Yq(s));if(f=u(r,a,i),c>0){let p=t.subarray(e,e+=c);if(p.byteLength<c)throw new Error(zq(c,p.byteLength));f.body=p}}return{version:i,type:s,index:e,content:f}}function j7(t){let e=t instanceof ArrayBuffer?new Uint8Array(t):t;return e instanceof Uint8Array&&Uq(e)?Xq(e):jq(e)}function Uq(t){if(!t||t.length<4)return!1;for(let e=0;e<6;++e)if(sl[e]!==t[e])return!1;return!0}function jq(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=_0(i,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case xr.Schema:n||(n=a.content);break;case xr.RecordBatch:r.push(a.content);break;case xr.DictionaryBatch:o.push(a.content);break}}}return{schema:n,dictionaries:o,records:r,metadata:null}}function Xq(t){let e=t.byteLength-(sl.length+4),n=Xt(t,e),r=ln(t,e-n),o=r(4,Je,mr.V1),i=r(8,Iw,[]),s=r(10,Iw,[]);return{schema:r(6,(a,c)=>v0(a,c,o)),dictionaries:i.map(({offset:a})=>_0(t,a).content),records:s.map(({offset:a})=>_0(t,a).content),metadata:r(12,gl)}}function kw(t,e){return Wq(j7(t),e)}function Wq(t,e={}){let{schema:n={fields:[]},dictionaries:r,records:o}=t,{version:i,fields:s}=n,a=new Map,c=Gq(e,i,a),f=new Map;Vq(n,l=>{let d=l.type;d.typeId===z.Dictionary&&f.set(d.id,d.dictionary)});let u=new Map;for(let l of r){let{id:d,data:h,isDelta:m,body:x}=l,g=f.get(d),y=Cw(g,c({...h,body:x}));if(u.has(d)){let b=u.get(d);m||b.clear(),b.add(y)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(d,Ew(g).add(y))}}u.forEach((l,d)=>a.set(d,l.done()));let p=s.map(l=>Ew(l.type));for(let l of o){let d=c(l);s.forEach((h,m)=>p[m].add(Cw(h.type,d)))}return new jc(n,p.map(l=>l.done()),e.useProxy)}function Vq(t,e){t.fields.forEach(function n(r){e(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Gq(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,u=-1,p=-1,l=-1;return{...r,length:i,node:()=>s[++u],buffer:d=>{let{length:h,offset:m}=a[++p];return d?new d(f.buffer,f.byteOffset+m,h/d.BYTES_PER_ELEMENT):f.subarray(m,m+h)},variadic:()=>c[++l],visit(d){return d.map(h=>Cw(h.type,this))}}}}function Cw(t,e){let{typeId:n}=t,{length:r,options:o,node:i,buffer:s,variadic:a,version:c}=e,f=xl(t,o);if(n===z.Null)return new f({length:r,nullCount:r,type:t});let u={...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({...u,validity:s(),values:s(t.values)});case z.Utf8:case z.LargeUtf8:case z.Binary:case z.LargeBinary:return new f({...u,validity:s(),offsets:s(t.offsets),values:s()});case z.BinaryView:case z.Utf8View:return new f({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case z.List:case z.LargeList:case z.Map:return new f({...u,validity:s(),offsets:s(t.offsets),children:e.visit(t.children)});case z.ListView:case z.LargeListView:return new f({...u,validity:s(),offsets:s(t.offsets),sizes:s(t.offsets),children:e.visit(t.children)});case z.FixedSizeList:case z.Struct:return new f({...u,validity:s(),children:e.visit(t.children)});case z.RunEndEncoded:return new f({...u,children:e.visit(t.children)});case z.Dictionary:{let{id:p,indices:l}=t;return new f({...u,validity:s(),values:s(l.values)}).setDictionary(e.dictionary(p))}case z.Union:return c<mr.V5&&s(),new f({...u,typeIds:s(al),offsets:t.mode===ti.Sparse?null:s(t.offsets),children:e.visit(t.children)});default:throw new Error(ei(n))}}var Zet=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function yl(t){return kw(t,{useDate:!0})}function S0(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:u}=r;r=null,c(),u(f)}else console.error("WebSocket error: ",f)},message({data:f}){if(r){let{query:u,resolve:p,reject:l}=r;if(r=null,c(),typeof f=="string"){let d=JSON.parse(f);d.error?l(d.error):p(d)}else if(u.type==="exec")p();else if(u.type==="arrow")p(yl(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,u,p){o==null&&s(),e.push({query:f,resolve:u,reject:p}),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((u,p)=>a(f,u,p))}}}var Xc="COLUMN_REF",M0="COLUMN_PARAM",Z7="TABLE_REF",J7="LITERAL",K7="INTERVAL",A0="ORDER_BY",T0="CAST",E0="CASE",I0="WHEN",N0="UNARY",tI="UNARY_POSTFIX",C0="BINARY",k0="BETWEEN",L0="NOT_BETWEEN",R0="LOGICAL_OPERATOR",O0="IN",$0="FUNCTION",pa="AGGREGATE",Wc="WINDOW",D0="WINDOW_DEF",P0="WINDOW_FRAME",eI="EXPRESSION",Vc="FRAGMENT",F0="VERBATIM",Gc="PARAM",nI="WITH_CLAUSE",q0="SELECT_CLAUSE",B0="FROM_CLAUSE";var rI="SAMPLE_CLAUSE";var z0="WINDOW_CLAUSE";var Y0="SELECT_QUERY",U0="DESCRIBE_QUERY",j0="SET_OPERATION";function pn(t){return t instanceof xe}var xe=class{constructor(e){this.type=e}},vt=class extends xe{};var da=class extends vt{constructor(e){super(J7),this.value=e}toString(){return Lw(this.value)}};function Lw(t){switch(typeof t){case"number":return Number.isFinite(t)?`${t}`:"NULL";case"string":return`'${t.replace("'","''")}'`;case"boolean":return t?"TRUE":"FALSE";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)?`DATE '${n}-${r+1}-${o}'`:`epoch_ms(${e})`}else return t instanceof RegExp?`'${t.source}'`:`${t}`}}var Br=class extends vt{constructor(e){super(Gc),this.param=e}get value(){return this.param.value}toString(){return Lw(this.value)}};function Rw(t){return t.split(".")}function zr(t){return`"${t}"`}function X0(t){return t&&gB(t)?t.slice(1,-1):t}function gB(t){return t[0]==='"'&&t[t.length-1]==='"'}function Ki(t){return t instanceof Hc}var Hc=class extends vt{constructor(e){super(Z7),this.table=[e].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(e=>zr(e)).join(".")}};var ha=class extends vt{constructor(e,n=[]){super($0),this.name=e,this.args=n}toString(){let{name:e,args:n}=this;return`${e}(${n.join(", ")})`}};function Vt(t,...e){return new ha(t,bl(e).map(Mt))}function Ot(t,...e){return new vl(t,bl(e).map(Mt))}function yr(t,...e){return new ma(new wl(t,bl(e).map(Mt)))}function Un(t,e=Mt){return t.flat().filter(n=>n!=null).map(n=>e(n))}function bl(t){let e=t.length,n=e;for(;n>0&&t[n-1]===void 0;--n);return n<e?t.slice(0,n):t}function br(t){return typeof t=="string"}function _l(t){return Array.isArray(t)}function Yr(t){return t&&typeof t.addEventListener=="function"&&t.dynamic!==!1&&"value"in t}var Ml=class extends xe{constructor(e,n){super(z0),this.name=e,this.def=n}toString(){return`${zr(this.name)} AS ${this.def}`}},ma=class t extends vt{constructor(e,n=new xa){super(Wc),this.func=e,this.def=n}over(e){return new t(this.func,this.def.over(e))}partitionby(...e){return new t(this.func,this.def.partitionby(...e))}orderby(...e){return new t(this.func,this.def.orderby(...e))}rows(e){return new t(this.func,this.def.rows(e))}range(e){return new t(this.func,this.def.range(e))}toString(){return`${this.func} OVER ${this.def}`}},wl=class extends ha{constructor(e,n){super(e,n)}},xa=class extends xe{constructor(e,n,r,o){super(D0),this.name=e,this.partition=n,this.order=r,this.frame=o}over(e){return Sl(this,{name:e})}partitionby(...e){return Sl(this,{partition:Un(e)})}orderby(...e){return Sl(this,{order:Un(e)})}rows(e){return Sl(this,{frame:new Al(e)})}range(e){return Sl(this,{frame:new Al(e,!0)})}toString(){let{name:e,partition:n,order:r,frame:o}=this,i=e&&zr(e),s=[i,n?.length&&`PARTITION BY ${n.join(", ")}`,r?.length&&`ORDER BY ${r.join(", ")}`,o].filter(a=>a);return i&&s.length<2?i:`(${s.join(" ")})`}},Al=class extends xe{constructor(e,n=!1,r=void 0){super(P0),this.extent=Yr(e)?new Br(e):e,this.range=n,this.exclude=r}toString(){let{range:e,exclude:n,extent:r}=this,o=e?"RANGE":"ROWS",[i,s]=pn(r)?r.value:r,a=oI(i,"PRECEDING"),c=oI(s,"FOLLOWING");return`${o} BETWEEN ${a} AND ${c}${n?` ${n}`:""}`}};function Sl(t,e){return new xa(e.name??t.name,e.partition??t.partition,e.order??t.order,e.frame??t.frame)}function oI(t,e){return t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} ${e}`:`UNBOUNDED ${e}`}function ts(t){return t instanceof ri}var ri=class extends vt{constructor(e,n){super(e),this.table=n}get column(){return null}toString(){let{column:e,table:n}=this,r=`${n??""}`,o=e==="*"?"*":zr(e);return(r?r+".":"")+o}},Tl=class extends ri{constructor(e,n){super(Xc,n),this.name=e}get column(){return this.name}};var El=class extends ri{constructor(e,n){super(M0,n),this.param=e}get column(){return`${this.param.value}`}};function oi(t,e){let n=ga(e);return Yr(t)?new El(new Br(t),n):new Tl(t,n)}var ya=class extends vt{constructor(e){super(F0),this.value=e}toString(){return this.value}};function Fe(t){return new da(t)}function iI(t){return new ya(t)}function W0(...t){let e=Un(t,String);return e?.length?new Hc(e):void 0}function Mt(t){return br(t)?yB(t):wa(t)}function ba(t){return br(t)?iI(t):wa(t)}function wa(t){return t instanceof vt?t:Yr(t)?new Br(t):Fe(t)}function ga(t){return br(t)?bB(t):_l(t)?W0(t):t}function yB(t){let e=Rw(t);return oi(e.pop(),W0(e))}function bB(t){return W0(Rw(t))}function Ow(){return new xa}var vl=class t extends vt{constructor(e,n,r,o){super(pa),this.name=e,this.args=n,this.isDistinct=r,this.filter=o}distinct(e=!0){return new t(this.name,this.args,e,this.filter)}where(e){return br(e)&&(e=ba(e)),new t(this.name,this.args,this.isDistinct,e)}window(){return new ma(this)}partitionby(...e){return this.window().partitionby(...e)}orderby(...e){return this.window().orderby(...e)}toString(){let{name:e,args:n,isDistinct:r,filter:o}=this,i=r?"DISTINCT ":"",s=n?.length?n.join(", "):"*",a=o?` FILTER (WHERE ${o})`:"";return`${e}(${i}${s})${a}`}},sI=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];var V0=class extends vt{constructor(e,n,r){super(e),this.expr=n,this.extent=r}toSQL(e){let{extent:n,expr:r}=this;return n?`(${r} ${e} ${n[0]} AND ${n[1]})`:""}},va=class extends V0{constructor(e,n){super(k0,e,n)}toString(){return super.toSQL("BETWEEN")}},Il=class extends V0{constructor(e,n){super(L0,e,n)}toString(){return super.toSQL("NOT BETWEEN")}};var Nl=class extends vt{constructor(e,n,r){super(C0),this.op=e,this.left=n,this.right=r}toString(){return`(${this.left} ${this.op} ${this.right})`}};var Qc=class t extends vt{constructor(e=void 0,n=[],r=void 0){super(E0),this.expr=e,this._when=n,this._else=r}when(e,n){return new t(this.expr,this._when.concat(new Zc(Mt(e),Mt(n))),this._else)}else(e){return new t(this.expr,this._when,Mt(e))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}},Zc=class extends xe{constructor(e,n){super(I0),this.when=e,this.then=n}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var Cl=class extends vt{constructor(e,n){super(T0),this.expr=e,this.cast=n}toString(){return`(${this.expr})::${this.cast}`}};var kl=class extends vt{constructor(e){super(Vc),this.spans=e}toString(){return this.spans.join("")}};var Ll=class extends xe{constructor(e,n=!1,r=void 0,o=void 0){super(rI),this.size=e,this.perc=n,this.method=r,this.seed=o}toString(){let{size:e,perc:n,method:r,seed:o}=this,i=n?"%":" ROWS",s=o!=null?`, ${o}`:"";return`${e}${i}${r?` (${r}${s})`:""}`}};var Rl=class extends xe{constructor(e,n){super(q0),this.expr=e,this.alias=n}toString(){let{expr:e,alias:n}=this;return!n||wB(e,n)?`${e}`:`${e} AS ${zr(n)}`}};function wB(t,e){return t instanceof ri&&t.table==null&&t.column===e}var Ol=class extends xe{constructor(e,n){super(nI),this.name=e,this.query=n}toString(){return`"${this.name}" AS (${this.query})`}};function G0(t){return t instanceof st}function es(t){return t instanceof Sa}function $w(t){return t instanceof $l}var st=class extends vt{static select(...e){return new Sa().select(...e)}static from(...e){return new Sa().from(...e)}static with(...e){return new Sa().with(...e)}static union(...e){return new _a("UNION",e.flat())}static unionAll(...e){return new _a("UNION ALL",e.flat())}static intersect(...e){return new _a("INTERSECT",e.flat())}static except(...e){return new _a("EXCEPT",e.flat())}static describe(e){return new $l(e)}constructor(e){super(e),this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}orderby(...e){return this._orderby=this._orderby.concat(Un(e)),this}limit(e){return this._limit=Number.isFinite(e)?e:void 0,this}offset(e){return this._offset=Number.isFinite(e)?e:void 0,this}},Sa=class t extends st{constructor(){super(Y0),this._with=[],this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){let e=this.cteFor||this,r=(e instanceof t?e._with:[]).reduce((i,s)=>(i[s.name]=s.query,i),{}),o=[];return this._from.forEach(({expr:i})=>{if(G0(i))o.push(i);else if(Ki(i)){let s=r[i.name];s&&o.push(s)}}),o}clone(){return Object.assign(new t,this)}with(...e){let n=[],r=(o,i)=>{let s=i.clone();s.cteFor=this,n.push(new Ol(o,s))};return e.flat().forEach(o=>{if(o!=null)for(let i in o)r(i,o[i])}),this._with=this._with.concat(n),this}select(...e){let n=[],r=(i,s)=>n.push(new Rl(i==null?i:Mt(i),X0(s)));e.flat().forEach(i=>{if(i!=null)if(br(i))r(i,i);else if(ts(i))r(i,i.column);else if(_l(i))r(i[1],i[0]);else for(let s in i)r(i[s],s)});let o=new Set(n.map(i=>i.alias));return this._select=this._select.filter(i=>!o.has(i.alias)).concat(n.filter(i=>i.expr)),this}setSelect(...e){return this._select=[],this.select(...e)}distinct(e=!0){return this._distinct=!!e,this}from(...e){let n=[],r=(o,i)=>n.push(new Dl(ga(o),X0(i)));return e.flat().forEach(o=>{if(o!=null)if(br(o))r(o,o);else if(Ki(o))r(o,o.name);else if(pn(o))r(o);else if(_l(o))r(o[1],o[0]);else for(let i in o)r(o[i],i)}),this._from=this._from.concat(n),this}setFrom(...e){return this._from=[],this.from(...e)}sample(e,n,r){let o;if(typeof e=="number"){let i=e>0&&e<1,s=i?e*100:Math.floor(e);o=new Ll(s,i,n,r)}else o=e;return this._sample=o,this}where(...e){return this._where=this._where.concat(Un(e,ba)),this}setWhere(...e){return this._where=[],this.where(...e)}groupby(...e){return this._groupby=this._groupby.concat(Un(e)),this}setGroupby(...e){return this._groupby=[],this.groupby(...e)}having(...e){return this._having=this._having.concat(Un(e,ba)),this}window(...e){let n=[];return e.flat().forEach(r=>{if(r!=null)for(let o in r)n.push(new Ml(X0(o),r[o]))}),this._window=this._window.concat(n),this}qualify(...e){return this._qualify=this._qualify.concat(Un(e,ba)),this}toString(){let{_with:e,_select:n,_distinct:r,_from:o,_sample:i,_where:s,_groupby:a,_having:c,_window:f,_qualify:u,_orderby:p,_limit:l,_offset:d}=this,h=[];if(e.length&&h.push(`WITH ${e.join(", ")}`),h.push(`SELECT${r?" DISTINCT":""} ${n.join(", ")}`),o.length&&h.push(`FROM ${o.join(", ")}`),s.length){let m=s.map(String).filter(x=>x).join(" AND ");m&&h.push(`WHERE ${m}`)}if(i&&h.push(`USING SAMPLE ${i}`),a.length&&h.push(`GROUP BY ${a.join(", ")}`),c.length){let m=c.map(String).filter(x=>x).join(" AND ");m&&h.push(`HAVING ${m}`)}if(f.length&&h.push(`WINDOW ${f.join(", ")}`),u.length){let m=u.map(String).filter(x=>x).join(" AND ");m&&h.push(`QUALIFY ${m}`)}return p.length&&h.push(`ORDER BY ${p.join(", ")}`),Number.isFinite(l)&&h.push(`LIMIT ${l}`),Number.isFinite(d)&&h.push(`OFFSET ${d}`),h.join(" ")}},$l=class t extends xe{constructor(e){super(U0),this.query=e}clone(){return new t(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},_a=class t extends st{constructor(e,n){super(j0),this.op=e,this.queries=n}get subqueries(){let{queries:e,cteFor:n}=this;return n&&e.forEach(r=>r.cteFor=n),e}clone(){let{op:e,queries:n,...r}=this;return Object.assign(new t(e,n),r)}toString(){let{op:e,queries:n,_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(" ")}};var Dl=class extends xe{constructor(e,n){super(B0),this.expr=e,this.alias=n}toString(){let{expr:e,alias:n}=this,r=G0(e)?`(${e})`:`${e}`;return n&&!(Ki(e)&&e.table.join(".")===n)?`${r} AS ${zr(n)}`:`${r}`}};var Pl=class extends vt{constructor(e,n){super(O0),this.expr=e,this.values=n}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var Fl=class extends vt{constructor(e,n=1){super(K7),this.name=e,this.steps=n}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var H0=class extends vt{constructor(e,n){super(R0),this.op=e,this.clauses=n}toString(){let e=this.clauses;return e.length===0?"":e.length===1?`${e[0]}`:`(${e.join(` ${this.op} `)})`}},ql=class extends H0{constructor(e){super("AND",e)}},Bl=class extends H0{constructor(e){super("OR",e)}};var Jc=class extends vt{constructor(e,n,r){super(A0),this.expr=e,this.desc=n,this.nullsFirst=r}toString(){let{expr:e,desc:n,nullsFirst:r}=this;return`${e}${n?" DESC":n===!1?" ASC":""}${r?" NULLS FIRST":r===!1?" NULLS LAST":""}`}};var Q0=class extends vt{constructor(e,n,r){super(e),this.op=n,this.expr=r}},zl=class extends Q0{constructor(e,n){super(N0,e,n)}toString(){return`(${this.op} ${this.expr})`}},Yl=class extends Q0{constructor(e,n){super(tI,e,n)}toString(){return`(${this.expr} ${this.op})`}};function ns(t,e){return Ot("arg_max",t,e)}function rs(t,e){return Ot("arg_min",t,e)}function Dw(t){return Ot("array_agg",t)}function Ul(t){return Ot("avg",t)}function Pw(t,e){return Ot("corr",t,e)}function qe(t){return Ot("count",t)}function Fw(t,e){return Ot("covar_samp",t,e)}function qw(t,e){return Ot("covar_pop",t,e)}function Bw(t){return Ot("entropy",t)}function zw(t){return Ot("first",t)}function Yw(t){return Ot("kurtosis",t)}function Uw(t){return Ot("mad",t)}function Ke(t){return Ot("max",t)}function jw(t){return Ot("median",t)}function jn(t){return Ot("min",t)}function Xw(t){return Ot("mode",t)}function Ww(t){return Ot("last",t)}function Vw(t){return Ot("product",t)}function Gw(t,e){return Ot("quantile",t,e)}function jl(t,e){return Ot("regr_avgx",t,e)}function Hw(t,e){return Ot("regr_avgy",t,e)}function Xl(t,e){return Ot("regr_count",t,e)}function Qw(t,e){return Ot("regr_intercept",t,e)}function Zw(t,e){return Ot("regr_sxx",t,e)}function Jw(t,e){return Ot("regr_syy",t,e)}function Kw(t,e){return Ot("regr_slope",t,e)}function tv(t){return Ot("skewness",t)}function Wl(t){return Ot("stddev",t)}function ev(t){return Ot("stddev_pop",t)}function nv(t){return Ot("string_agg",t)}function Yt(t){return Ot("sum",t)}function rv(t){return Ot("var_samp",t)}function ov(t){return Ot("var_pop",t)}function ii(t,e,n){return t?new Qc(void 0,[new Zc(Mt(t),Mt(e))],Mt(n)):new Qc}function Kc(t,e){return new Cl(Mt(t),e)}function Gt(t){return Kc(t,"INTEGER")}function iv(t){return Kc(t,"FLOAT")}function pe(t){return Kc(t,"DOUBLE")}function Z0(t,e){return new Fl(t,e)}function sv(t){return Vt("epoch_ms",t)}function av(t,e,n=1){return Vt("time_bucket",Z0(e,n),t)}function cv(t){return Vt("make_date",2012,Vt("month",t),1)}function fv(t){let e=Mt(t);return Vt("make_date",2012,Vt("month",e),Vt("day",e))}function uv(t){return Vt("make_date",2012,1,Vt("day",t))}function lv(...t){return Vt("greatest",...t)}function J0(t){return Vt("exp",t)}function pv(t){return Vt("log",t)}function tf(t){return Vt("ln",t)}function Ur(t){return Vt("sign",t)}function Be(t){return Vt("abs",t)}function si(t){return Vt("sqrt",t)}function dv(t){return Vt("ceil",t)}function ze(t){return Vt("floor",t)}function ai(t,e){return Vt("round",t,e)}function vB(t,e){return new zl(t,Mt(e))}function aI(t,e){return new Yl(t,Mt(e))}function Xn(t,e,n){return new Nl(t,Mt(e),Mt(n))}function cI(t,e,n=!1){let r=n?Il:va;return new r(Mt(t),e?.map(Mt))}function dn(...t){return new ql(Un(t))}function wr(...t){return new Bl(Un(t))}function hv(t){return vB("NOT",t)}function Ma(t){return aI("IS NULL",t)}function vr(t){return aI("IS NOT NULL",t)}function Vl(t,e){return Xn("&",t,e)}function Rt(t,e){return Xn("+",t,e)}function dt(t,e){return Xn("-",t,e)}function mt(t,e){return Xn("*",t,e)}function Pt(t,e){return Xn("/",t,e)}function ve(t,e){return Xn("**",t,e)}function mv(t,e){return Xn("=",t,e)}function jr(t,e){return Xn("<>",t,e)}function ae(t,e){return Xn("<",t,e)}function _r(t,e){return Xn(">",t,e)}function Kn(t,e){return Xn("<=",t,e)}function xv(t,e){return Xn(">=",t,e)}function gv(t,e){return Xn("IS DISTINCT FROM",t,e)}function Gl(t,e){return Xn("IS NOT DISTINCT FROM",t,e)}function tn(t,e){return cI(t,e,!1)}function yv(t,e){return cI(t,e,!0)}function K0(t,e){return new Pl(Mt(t),e.map(Mt))}function bv(t,e){return new Jc(Mt(t),!1,e)}function wv(t,e){return new Jc(Mt(t),!0,e)}function Hl(t){return Vt("st_asgeojson",t)}function fI(t){return Vt("st_x",t)}function uI(t){return Vt("st_y",t)}function Ql(t){return Vt("st_centroid",t)}function vv(t){return fI(Ql(t))}function _v(t){return uI(Ql(t))}function ge(t,...e){return new kl(_B(t,e))}function _B(t,e){let n=[t[0]],r=e.length;for(let o=0,i=0;o<r;){let s=e[o];pn(s)?n[++i]=s:Yr(s)?n[++i]=new Br(s):n[i]+=br(s)?s:Fe(s);let a=t[++o];pn(n[i])?n[++i]=a:n[i]+=a}return n.filter(o=>o).map(o=>br(o)?new ya(o):o)}function tx(t,e,...n){return Vt(t,e,...bl(n).map(wa))}function Sv(t,e,n){return tx("regexp_matches",t,e,n)}function Mv(t,e){return tx("contains",t,e)}function Av(t,e){return tx("starts_with",t,e)}function Tv(t,e){return tx("ends_with",t,e)}function Ev(){return yr("row_number")}function Iv(){return yr("rank")}function Nv(){return yr("dense_rank")}function Cv(){return yr("percent_rank")}function kv(){return yr("cume_dist")}function Lv(t){return yr("ntile",t)}function Rv(t,e,n){return yr("lag",t,e,n)}function ef(t,e,n){return yr("lead",t,e,n)}function Ov(t){return yr("first_value",t)}function $v(t){return yr("last_value",t)}function Dv(t,e){return yr("nth_value",t,e)}var ex={[pa]:["args","filter"],[k0]:["expr","extent"],[C0]:["left","right"],[E0]:["expr","_when","_else"],[T0]:["expr"],[M0]:["param","table"],[Xc]:["table"],[U0]:["query"],[eI]:["node"],[Vc]:["spans"],[B0]:["expr"],[$0]:["args"],[O0]:["expr","values"],[R0]:["clauses"],[L0]:["expr","extent"],[A0]:["expr"],[Gc]:["value"],[q0]:["expr"],[Y0]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[j0]:["subqueries","_orderby"],[N0]:["expr"],[I0]:["when","then"],[Wc]:["func","def"],[z0]:["def"],[D0]:["partition","order","frame"],[P0]:["extent"]};function Zl(t,e){if(e.has(t))return e.get(t);if(pn(t)){let n=ex[t.type],r=n?.length??0;for(let o=0;o<r;++o){let i=n[o],s=t[i];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)s[c]=Zl(s[c],e)}else s&&(t[i]=Zl(s,e))}}return t}function ao(t,e){if(!pn(t))return;let n=e(t);if(n)return n;let r=ex[t.type],o=r?.length??0;for(let i=0;i<o;++i){let s=t[r[i]];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)if(s[c]&&+ao(s[c],e)<0)return n}else if(s&&+ao(s,e)<0)return-1}}var SB=new RegExp(`^(${sI.join("|")})$`),MB=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function AB(t){return t.split(MB).some(e=>e.endsWith("(")&&SB.test(e.slice(0,-1)))}function tr(t){let e=0;return ao(t,n=>{switch(n.type){case Wc:return-1;case pa:return e|=1,-1;case Vc:case F0:{let r=`${n}`.toLowerCase(),o=r.indexOf("(select ");return o>=0&&(r=r.slice(0,o)),r.includes(") over ")?-1:AB(r)?(e|=2,-1):1}}}),e}function Pv(t){let e=new Set;return ao(t,n=>{n.type===pa&&e.add(n)}),Array.from(e)}function nf(t){let e={};return ao(t,n=>{n.type===Xc&&(e[n]=n)}),Object.values(e)}function Fv(t){let e=new Set;return ao(t,n=>{n.type===Gc&&e.add(n.param)}),Array.from(e)}function co(t,e,{replace:n=!1,temp:r=!1,view:o=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(o?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+t+" AS "+e}function qv(t,{strict:e=!1}={}){return"CREATE SCHEMA "+(e?"":"IF NOT EXISTS ")+t}function Jl(t){return`INSTALL ${t}; LOAD ${t}`}function lI(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=>`${wa(o[s])} AS "${e[s]}"`);r.push(`(SELECT ${i.join(", ")})`)}return r.join(" UNION ALL ")}function nx(t,e,n,r={},o={}){let{select:i=["*"],where:s,view:a,temp:c,replace:f,...u}=r,p=TB({...o,...u}),l=`${t}('${n}'${p?", "+p:""})`,d=s?` WHERE ${s}`:"",h=`SELECT ${i.join(", ")} FROM ${l}${d}`;return co(e,h,{view:a,temp:c,replace:f})}function zv(t,e,n){return nx("read_csv",t,e,n,{auto_detect:!0,sample_size:-1})}function Yv(t,e,n){return nx("read_json",t,e,n,{auto_detect:!0,format:"auto"})}function Uv(t,e,n){return nx("read_parquet",t,e,n)}function jv(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 nx("st_read",t,e,o)}function Xv(t,e,n={}){let{select:r=["*"],...o}=n,i=lI(e),s=r.length===1&&r[0]==="*"?i:`SELECT ${r} FROM ${i}`;return co(t,s,o)}function TB(t){return Object.entries(t).map(([e,n])=>`${e}=${Bv(n)}`).join(", ")}function Bv(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=>Bv(e)).join(", ")+"]":"{"+Object.entries(t).map(([e,n])=>`'${e}': ${Bv(n)}`).join(", ")+"}";default:return t}}function Wv(t,e,n,r,o){let i=o?dt(n,pe(t)):dt(pe(t),e),s=n===e?0:r/(n-e);return s?mt(i,pe(s)):i}function Vv(t,e,n,r,o,i){return t.select({index:Rt(Gt(ze(e)),mt(Gt(ze(n)),o)),...r}).groupby("index",i)}function Gv(t,e,n){let r=n?s=>mt(s,n):s=>s,o=ze(e),i=Rt(o,1);return st.from(st.unionAll(t.clone().select({i:Gt(o),w:r(dt(i,e))}),t.clone().select({i:Gt(i),w:r(dt(e,o))}))).select({index:"i",density:Yt("w")}).groupby("index").having(jr("density",0))}function EB(t){return t}function Hv(t,e,n,r,o,i){let s=r?g=>mt(g,r):EB,a=(g,y)=>t.clone().select({xp:e,yp:n,i:g,w:y}),c=(g,y)=>Rt(g,mt(y,o)),f=Gt(ze(e)),u=Gt(ze(n)),p=Rt(f,1),l=Rt(u,1),d=dt(e,f),h=dt(p,e),m=dt(n,u),x=dt(l,n);return st.from(st.unionAll(a(c(f,u),s(mt(h,x))),a(c(f,l),s(mt(h,m))),a(c(p,u),s(mt(d,x))),a(c(p,l),s(mt(d,m))))).select({index:"i",density:Yt("w")},i).groupby("index",i).having(jr("density",0))}function Qv(t,e,n,r,o,i,s=[],a=!0){t.select({x:Gt(ze(e)),y:Gt(ze(n))});let c=s.concat(r),f=st.from(t).select(c,{x0:"x",y0:"y",dx:dt(ef("x").over("sw"),"x"),dy:dt(ef("y").over("sw"),"y")}).window({sw:Ow().partitionby(c).orderby(bv("x"))}).qualify([wr(ae("x0",o),ae(Rt("x0","dx"),o)),wr(ae("y0",i),ae(Rt("y0","dy"),i)),wr(_r("x0",0),_r(Rt("x0","dx"),0)),wr(_r("y0",0),_r(Rt("y0","dy"),0))]),u=st.select({x:lv(Ke(Be("dx")),Ke(Be("dy")))}).from("pairs"),p=st.select({i:Gt(ge`UNNEST(range((${u})))`)}),l=st.unionAll(st.select(c,{x:Rt("x0","i"),y:Rt("y0",Gt(ai(Pt(mt("i","dy"),"dx"))))}).from("pairs","indices").where([Kn(Be("dy"),Be("dx")),ae("i",Be("dx"))]),st.select(c,{x:Rt("x0",Gt(ai(Pt(mt(mt(Ur("dy"),"i"),"dx"),"dy")))),y:Rt("y0",mt(Ur("dy"),"i"))}).from("pairs","indices").where([_r(Be("dy"),Be("dx")),ae("i",Be("dy"))]),st.select(c,{x:"x0",y:"y0"}).from("pairs").where(Ma("dx"))),d=st.from("raster").select(c,"x","y",a?{w:Pt(1,qe().partitionby(["x"].concat(c)))}:null).where([Kn(0,"x"),ae("x",o),Kn(0,"y"),ae("y",i)]);return st.with({pairs:f,indices:p,raster:l,points:d}).from("points").select(s,{index:Rt("x",mt("y",Gt(o))),density:a?Yt("w"):qe()}).groupby("index",s)}function Zv(t,e,n,r,o=[]){let i=Gt(ze(e)),s=a=>st.from(t).select(a).groupby(i,o);return st.union(s([{[n]:jn(n),[r]:rs(r,n)},...o]),s([{[n]:Ke(n),[r]:ns(r,n)},...o]),s([{[n]:rs(n,r),[r]:jn(r)},...o]),s([{[n]:ns(n,r),[r]:Ke(r)},...o])).orderby(o,n)}var rx=t=>t;function pI(){return{apply:rx,invert:rx,sqlApply:Mt,sqlInvert:rx}}function IB({base:t=null}={}){if(t==null||t===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:e=>tf(e),sqlInvert:e=>J0(e)};if(t===10)return{apply:Math.log10,invert:e=>Math.pow(10,e),sqlApply:e=>pv(e),sqlInvert:e=>ve(10,e)};{let e=+t;return{apply:n=>Math.log(n)/Math.log(e),invert:n=>Math.pow(e,n),sqlApply:n=>Pt(tf(n),tf(e)),sqlInvert:n=>ve(e,n)}}}function NB({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=Mt(n),mt(Ur(n),tf(Rt(e,Be(n))))),sqlInvert:n=>mt(Ur(n),dt(J0(Be(n)),e))}}function CB(){return{apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*t*t,sqlApply:t=>(t=Mt(t),mt(Ur(t),si(Be(t)))),sqlInvert:t=>mt(Ur(t),ve(t,2))}}function kB({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=Mt(n),mt(Ur(n),ve(Be(n),e))),sqlInvert:n=>mt(Ur(n),ve(Be(n),Pt(1,e)))}}function dI(){return{apply:t=>+t,invert:t=>new Date(t),sqlApply:t=>t instanceof Date?Fe(+t):RB(t)?Fe(+t.value):sv(t),sqlInvert:rx}}var LB={identity:pI,linear:pI,log:IB,symlog:NB,sqrt:CB,pow:kB,time:dI,utc:dI};function Kl(t){let e=LB[t.type];return e?{...t,...e(t)}:null}function RB(t){return t instanceof da&&t.value instanceof Date}function ox(t){let e=2166136261;for(let n=0,r=t.length;n<r;++n){let o=t.charCodeAt(n),i=o&65280;i&&(e=hI(e^i>>8)),e=hI(e^o&255)}return OB(e)>>>0}function hI(t){return t+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}function OB(t){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,t&4294967295}function xI(t,e,n){switch(t.name){case"count":case"sum":return $B(e,t);case"avg":return DB(e,t);case"arg_max":return PB(e,t);case"arg_min":return FB(e,t);case"variance":case"var_samp":return ix(e,t,n);case"var_pop":return ix(e,t,n,!1);case"stddev":case"stddev_samp":return si(ix(e,t,n));case"stddev_pop":return si(ix(e,t,n,!1));case"covar_samp":return sx(e,t,n);case"covar_pop":return sx(e,t,n,!1);case"corr":return mI(e,t,n);case"regr_count":return rf(e,t).expr;case"regr_avgx":return wI(e,t);case"regr_avgy":return vI(e,t);case"regr_syy":return Kv(e,0,t,n);case"regr_sxx":return Kv(e,1,t,n);case"regr_sxy":return sx(e,t,n,null);case"regr_slope":return _I(e,t,n);case"regr_intercept":return qB(e,t,n);case"regr_r2":return ve(mI(e,t,n),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{let r=gI(t);return e[r]=t,ge`${t.name}("${r}")`}default:return null}}function gI(t){return"pre_"+ox(`${t}`).toString(16)}function Mn(t,e,n){let r=n?.filter;r&&(e=e.filter?e.where(dn(r,e.filter)):e.where(r));let o=gI(e);return t[o]=e,o}function yI(t,e){let n=Mn(t,qe(e.args[0]),e);return{expr:Yt(n),name:n}}function $B(t,e){return Yt(Mn(t,e))}function DB(t,e){let n=Mn(t,e),{expr:r,name:o}=yI(t,e);return Pt(Yt(mt(n,o)),r)}function PB(t,e){let n=Mn(t,e),r=Mn(t,Ke(e.args[1]),e);return ns(n,r)}function FB(t,e){let n=Mn(t,e),r=Mn(t,jn(e.args[1]),e);return rs(n,r)}function ix(t,e,n,r=!0){let o=e.args[0],{expr:i}=yI(t,e),s=dt(o,n(o)),a=Mn(t,Yt(ve(s,2)),e),c=Mn(t,Yt(s),e),f=r?dt(i,1):i;return Pt(dt(Yt(a),Pt(ve(Yt(c),2),i)),f)}function sx(t,e,n,r=!0){let{expr:o}=rf(t,e),i=bI(t,e,n),s=tp(t,1,e,n),a=tp(t,0,e,n),c=dt(i,Pt(mt(s,a),o));return r===null?c:r?Pt(c,dt(o,1)):Pt(c,o)}function mI(t,e,n){let{expr:r}=rf(t,e),o=bI(t,e,n),i=Jv(t,1,e,n),s=Jv(t,0,e,n),a=tp(t,1,e,n),c=tp(t,0,e,n),f=dt(i,Pt(ve(a,2),r)),u=dt(s,Pt(ve(c,2),r));return Pt(dt(o,Pt(mt(a,c),r)),si(mt(f,u)))}function rf(t,e){let[n,r]=e.args,o=Mn(t,Xl(n,r),e);return{expr:Yt(o),name:o}}function tp(t,e,n,r){let o=n.args,i=o[e],s=o[1-e],a=Yt(dt(i,r(i))).where(vr(s));return Yt(Mn(t,a,n))}function Jv(t,e,n,r){let o=n.args,i=o[e],s=o[1-e],a=Yt(ve(dt(i,r(i)),2)).where(vr(s));return Yt(Mn(t,a,n))}function bI(t,e,n){let[r,o]=e.args,i=Yt(mt(dt(o,n(o)),dt(r,n(r))));return Yt(Mn(t,i,e))}function wI(t,e){let[n,r]=e.args,{expr:o,name:i}=rf(t,e),s=Mn(t,jl(n,r),e);return Pt(Yt(mt(s,i)),o)}function vI(t,e){let[n,r]=e.args,{expr:o,name:i}=rf(t,e),s=Mn(t,Hw(n,r),e);return Pt(Yt(mt(s,i)),o)}function Kv(t,e,n,r){let{expr:o}=rf(t,n),i=tp(t,e,n,r),s=Jv(t,e,n,r);return dt(s,Pt(ve(i,2),o))}function _I(t,e,n){let r=sx(t,e,n,null),o=Kv(t,1,e,n);return Pt(r,o)}function qB(t,e,n){let r=wI(t,e),o=vI(t,e),i=_I(t,e,n);return dt(o,mt(i,r))}function SI(t){if(!t.filterStable)return null;let e=t.query();if(!es(e))return null;let n=ax(e,c=>{let f=c._from[0]?.expr;return Ki(f)?f.name:f});if(typeof n!="string")return null;let r=new Map,o={},i={},s=[],a=c=>{let f=c.column,u=ax(e,p=>p._select.find(l=>l.alias===f)?.expr);return ge`(SELECT avg(${u??c}) FROM "${n}")`};for(let{alias:c,expr:f}of e._select){if(tr(f)>1)return null;let u=Pv(f);if(u.length===0)s.push(c),o[c]=f;else{for(let p of u){if(p.isDistinct)return null;let l=xI(p,o,a);if(!l)return null;r.set(p,l)}i[c]=Zl(f,r)}}return r.size?{group:s,preagg:o,output:i}:null}function ax(t,e){let n=t.subqueries;if(es(t)&&n.length===0)return e(t);let r=ax(n[0],e);for(let o=1;o<n.length;++o){let i=ax(n[o],e);if(i!==void 0&&i!==r)return NaN}return r}var BB={skip:!0,result:null},cx=class{constructor(e,{schema:n="mosaic",enabled:r=!0}={}){this.entries=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}dropSchema(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.entries.clear(),this.active=null}request(e,n,r){if(!this.enabled)return null;let{entries: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=zB(r),c.source===null))return null;if(o.has(e))return o.get(e);let f=SI(e),u;if(!f)u=null;else if(n.skip(e,r))u=BB;else{let p=n.remove(a).predicate(e);u=jB(e.query(p),c,f,s),u.result=i.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,co(u.table,u.create,{temp:!1})]),u.result.catch(l=>i.logger().error(l))}return o.set(e,u),u}};function zB(t){let{source:e,meta:n}=t,r=t.predicate,o=nf(r).map(p=>p.column),i,s;if(!n||!o)return{source:null,columns:s,predicate:i};let{type:a,scales:c,bin:f,pixelSize:u=1}=n;if(a==="point")i=p=>p,s=Object.fromEntries(o.map(p=>[`${p}`,Mt(p)]));else if(a==="interval"&&c){let p=c.map(l=>UB(l,u,f));p.some(l=>!l)||(p.length===1?(i=l=>l?tn("active0",l.extent.map(p[0])):[],s={active0:p[0](r.expr)}):(i=l=>l?dn(l.clauses.map((d,h)=>tn(`active${h}`,d.extent.map(p[h])))):[],s=Object.fromEntries(r.clauses.map((l,d)=>[`active${d}`,p[d](l.expr)]))))}return{source:s?e:null,columns:s,predicate:i}}var YB={ceil:dv,round:ai};function UB(t,e,n){let{type:r,domain:o,range:i,apply:s,sqlApply:a}=Kl(t);if(!s)return;let c=YB[`${n}`.toLowerCase()]||ze,f=s(Math.min(...o)),u=s(Math.max(...o)),p=(r==="identity"?1:Math.abs(i[1]-i[0])/(u-f))/e,l=p===1?h=>h:h=>mt(pe(p),h),d=f===0?h=>h:h=>dt(h,pe(f));return h=>Gt(c(l(d(a(h)))))}function jB(t,e,n,r){let{group:o,output:i,preagg:s}=n,{columns:a}=e,c=t.setSelect({...s,...a}).groupby(Object.keys(a)),[f]=c.subqueries;if(f){let x=Object.values(a).flatMap(g=>nf(g).map(y=>y.column));XB(f,x)}let u=c._having,p=c._orderby;c._having=[],c._orderby=[];let l=c.toString(),d=(ox(l)>>>0).toString(16),h=`${r}.preagg_${d}`,m=st.select(o,i).from(h).groupby(o).having(u).orderby(p);return new t_({table:h,create:l,active:e,select:m})}function XB(t,e){let n=new Set,r=o=>{n.has(o)||(n.add(o),es(o)&&o._from.length&&o.select(e),o.subqueries.forEach(r))};r(t)}var t_=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))}};function e_(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 WB="count",VB="nulls",GB="max",HB="min",QB="distinct";var ZB={[WB]:qe,[QB]:t=>qe(t).distinct(),[GB]:Ke,[HB]:jn,[VB]:t=>qe().where(Ma(t))};function JB(t,e,n){return st.from(t).select(Array.from(n,r=>({[r]:ZB[r](e)})))}async function MI(t,e){return e.length===1&&e[0].column==="*"?tz(t,e[0].table):(await Promise.all(e.map(n=>KB(t,n)))).filter(n=>n)}async function KB(t,{table:e,column:n,stats:r}){let o=st.from({source:e}).select({column:n}).groupby(n.aggregate?ge`ALL`:[]),[i]=Array.from(await t.query(st.describe(o))),s={table:e,column:`${n}`,sqlType:i.column_type,type:e_(i.column_type),nullable:i.null==="YES"};if(!(r?.length||r?.size))return s;let[a]=await t.query(JB(e,n,r),{persist:!0});return Object.assign(s,a)}async function tz(t,e){let n=await t.query(`DESCRIBE ${ga(e)}`);return Array.from(n).map(r=>({table:e,column:r.column_name,sqlType:r.column_type,type:e_(r.column_type),nullable:r.null==="YES"}))}var os=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),Aa=class extends Promise{constructor(){let e,n;super((r,o)=>{e=r,n=o}),this._resolve=e,this._reject=n,this._state=os.pending,this._value=void 0}fulfill(e){if(this._value!==void 0){if(e!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(e===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(e)}return this._state=os.done,this}ready(e){return this._state=os.ready,this._value=e,this}reject(e){return this._state=os.error,this._reject(e),this}get state(){return this._state}};Aa.prototype.constructor=Promise;function fx(){return{debug(...t){},info(...t){},log(...t){},warn(...t){},error(...t){}}}function ez(t){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(t)}function AI(t,e){let n=[],r=0;function o(){let i=nz(n,e);n=[],r=0;for(let s of i)oz(s,t),az(s,e)}return{add(i,s){i.request.type==="arrow"?(r=r||ez(()=>o()),n.push({entry:i,priority:s,index:n.length})):t(i,s)}}}function nz(t,e){let n=[],r=new Map;for(let o of t){let{entry:{request:i}}=o,s=rz(i.query,e);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(o)}return n}function rz(t,e){let n=`${t}`;if(es(t)&&!e.get(n)){if(t._orderby.length||t._where.length||t._qualify.length||t._having.length)return n;let r=t.clone().setSelect("*"),o=t._groupby;if(o.length){let i={};t._select.forEach(({alias:s,expr:a})=>i[s]=a),r.setGroupby(o.map(s=>ts(s)&&i[s.column]||s))}else t._select.some(i=>tr(i.expr))&&r.setGroupby("ALL");return`${r}`}else return n}function oz(t,e){if(iz(t))e({request:{type:"arrow",cache:!1,query:t.query=sz(t)},result:t.result=new Aa});else for(let{entry:n,priority:r}of t)e(n,r)}function iz(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 sz(t){let e=t.maps=[],n=new Map;for(let i of t){let{query:s}=i.entry.request,a=[];e.push(a);for(let{alias:c,expr:f}of s._select){let u=`${f}`;n.has(u)||n.set(u,[`col${n.size}`,f]);let[p]=n.get(u);a.push([p,c])}}let r=t[0].entry.request.query.clone(),o=r._groupby;if(o.length){let i={};t.maps[0].forEach(([s,a])=>i[a]=s),r.setGroupby(o.map(s=>ts(s)&&i[s.column]||s))}return r.setSelect(Array.from(n.values()))}async function az(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=$w(r);t.forEach(({entry:a},c)=>{let{request:f,result:u}=a,p=n[c],l=s&&p?fz(i,p):p?cz(i,p):i;f.cache&&e.set(String(f.query),l),u.fulfill(l)})}function cz(t,e){return t.select(e.map(n=>n[0]),e.map(n=>n[1]))}function fz(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 uz=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,TI=()=>({get:()=>{},set:(t,e)=>e,clear:()=>{}});function EI({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&&uz(r),i},clear(){n=new Map}}}var ux=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 fo=Object.freeze({High:0,Normal:1,Low:2}),lx=class{constructor(e=32){this.queue=new ux(3),this.db=null,this.clientCache=null,this._logger=fx(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=e,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;let{request:e,result:n}=this.queue.next();this.pendingResults.push(n),e.type==="exec"&&(this.pendingExec=!0),this.submit(e,n).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==os.pending;){let r=this.pendingResults.shift();r.state===os.ready?r.fulfill():r.state===os.done&&this._logger.warn("Found resolved query in pending results.")}e.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(e,n=fo.Normal){this.queue.insert(e,n),this.next()}async submit(e,n){try{let{query:r,type:o,cache:i=!1,options:s}=e,a=r?`${r}`:null;if(i){let p=this.clientCache.get(a);if(p){let l=await p;this._logger.debug("Cache"),n.ready(l);return}}let c=performance.now();this._logQueries&&this._logger.debug("Query",{type:o,sql:a,...s});let f=this.db.query({type:o,sql:a,...s});i&&this.clientCache.set(a,f);let u=await f;i&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-c).toFixed(1)}`),n.ready(o==="exec"?null:u)}catch(r){n.reject(r)}}cache(e){return e!==void 0?this.clientCache=e===!0?EI():e||TI():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=AI(this.enqueue.bind(this),this.clientCache):!e&&this._consolidate&&(this._consolidate=null)}request(e,n=fo.Normal){let r=new Aa,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);if(n.size){this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1);for(let r of this.pendingResults)n.has(r)&&r.reject("Canceled")}}clear(){this.queue.remove(({result:e})=>(e.reject("Cleared"),!0));for(let e of this.pendingResults)e.reject("Cleared");this.pendingResults=[]}};var px;function Sr(t){return t?px=t:px==null&&(px=new ep),px}var ep=class{constructor(e=S0(),{logger:n=console,manager:r=new lx,cache:o=!0,consolidate:i=!0,preagg:s={}}={}){this.manager=r,this.manager.cache(o),this.manager.consolidate(i),this.databaseConnector(e),this.logger(n),this.clear(),this.preaggregator=new cx(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||fx(),this.manager.logger(this._logger)),this._logger}cancel(e){this.manager.cancel(e)}exec(e,{priority:n=fo.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=fo.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:fo.Low})}createBundle(e,n,r=fo.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=fo.High){let r={name:e};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(e,n,r=fo.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.preaggregator.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),lz(this,e.filterBy,e)}async initializeClient(e){let n=e.fields();return n?.length&&e.fieldInfo(await MI(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 lz(t,e,n){if(!e)return;let r=t.filterGroups.get(e);if(!r){let o=s=>pz(t,e,s),i=()=>dz(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 pz(t,e,n){let{preaggregator:r,filterGroups:o}=t,{clients:i}=o.get(e);for(let s of i)r.request(s,e,n)}function dz(t,e){let{preaggregator:n,filterGroups:r}=t,{clients:o}=r.get(e),{active:i}=e;return Promise.allSettled(Array.from(o,s=>{let a=n.request(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 dx=class{constructor(){this._callbacks=new Map}addEventListener(e,n){this._callbacks.has(e)||this._callbacks.set(e,{callbacks:new Set,pending:null,queue:new n_}),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())})}}}},n_=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 np(t,e){return t===e?!1:t instanceof Date&&e instanceof Date?+t!=+e:Array.isArray(t)&&Array.isArray(e)?hz(t,e):!0}function hz(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 _e(t){return t instanceof is}var is=class t extends dx{constructor(e){super(),this._value=e}static value(e){return new t(e)}static array(e){if(e.some(n=>_e(n))){let n=new t,r=()=>{n.update(e.map(o=>_e(o)?o.value:o))};return r(),e.forEach(o=>_e(o)?o.addEventListener("value",r):0),n}return new t(e)}get value(){return this._value}update(e,{force:n}={}){return np(this._value,e)||n?this.emit("value",e):this.cancel("value"),this}willEmit(e,n){return e==="value"&&(this._value=n),n}};function er(t){return t instanceof uo}function hx(t,e){return new uo(new mx(t),e&&[e].flat())}var uo=class t extends is{static intersect({cross:e=!1,empty:n=!1,include:r=[]}={}){return hx({cross:e,empty:n},r)}static union({cross:e=!1,empty:n=!1,include:r=[]}={}){return hx({cross:e,empty:n,union:!0},r)}static single({cross:e=!1,empty:n=!1,include:r=[]}={}){return hx({cross:e,empty:n,single:!0},r)}static crossfilter({empty:e=!1,include:n=[]}={}){return hx({cross:!0,empty:e},n)}constructor(e=new mx,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)}},mx=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[Fe(!1)];if(this.skip(r,n))return;let s=e.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return i&&s.length>1?wr(s):s}queueFilter(e){if(this.cross){let n=e.active?.source;return r=>r.active?.source!==n}return null}};function ss(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=e!==void 0?K0(t,[Fe(e)]):null;return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function ci(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=null;if(e){let i=e.length&&t.length===1?[K0(t[0],e.map(s=>Fe(s[0])))]:e.map(s=>dn(s.map((a,c)=>Gl(t[c],Fe(a)))));o=e.length===0?Fe(!1):i.length>1?wr(i):i[0]}return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Ta(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scale:i,pixelSize:s=1}){let a=e!=null?tn(t,e):null;return{meta:{type:"interval",scales:i&&[i],bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}function r_(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scales:i=[],pixelSize:s=1}){let a=e!=null?dn(t.map((f,u)=>tn(f,e[u]))):null;return{meta:{type:"interval",scales:i,bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}var mz={contains:Mv,prefix:Av,suffix:Tv,regexp:Sv};function o_(t,e,{source:n,clients:r=void 0,method:o="contains"}){let i=mz[o],s=e?i(t,Fe(e)):null;return{meta:{type:"match",method:o},source:n,clients:r,value:e,predicate:s}}function i_(t){return typeof t?.getChild=="function"}function s_(){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 Wn(t){return i_(t)?xz(t):gz(t)}function xz(t){let{numRows:e}=t;return{numRows:e,columns:t.toColumns()}}function gz(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 f7={};Pc(f7,{Fixed:()=>lo,Param:()=>is,Query:()=>st,Selection:()=>uo,align:()=>YM,and:()=>dn,area:()=>CT,areaX:()=>kT,areaY:()=>LT,argmax:()=>ns,argmin:()=>rs,ariaDescription:()=>QM,ariaLabel:()=>HM,arrayAgg:()=>Dw,arrow:()=>AE,aspectRatio:()=>UM,avg:()=>Ul,axis:()=>jM,axisFx:()=>CE,axisFy:()=>kE,axisX:()=>IE,axisY:()=>NE,barX:()=>DT,barY:()=>PT,bin:()=>MM,cast:()=>Kc,cell:()=>FT,cellX:()=>qT,cellY:()=>BT,centroid:()=>Ql,centroidX:()=>vv,centroidY:()=>_v,circle:()=>VT,clip:()=>VM,colorBase:()=>R8,colorClamp:()=>v8,colorConstant:()=>$8,colorDomain:()=>b8,colorExponent:()=>O8,colorInterpolate:()=>A8,colorLabel:()=>I8,colorLegend:()=>s7,colorN:()=>_8,colorNice:()=>S8,colorPercent:()=>N8,colorPivot:()=>T8,colorRange:()=>w8,colorReverse:()=>C8,colorScale:()=>y8,colorScheme:()=>M8,colorSymmetric:()=>E8,colorTickFormat:()=>L8,colorZero:()=>k8,column:()=>oi,contour:()=>lE,coordinator:()=>Sr,corr:()=>Pw,count:()=>qe,covarPop:()=>qw,covariance:()=>Fw,createSchema:()=>qv,createTable:()=>co,cume_dist:()=>kv,dateDay:()=>uv,dateMonth:()=>cv,dateMonthDay:()=>fv,delaunayLink:()=>_E,delaunayMesh:()=>SE,denseLine:()=>uE,dense_rank:()=>Nv,density:()=>fE,densityX:()=>aE,densityY:()=>cE,dot:()=>jT,dotX:()=>XT,dotY:()=>WT,entropy:()=>Bw,eq:()=>mv,errorbarX:()=>yE,errorbarY:()=>bE,facetGrid:()=>yA,facetLabel:()=>bA,facetMargin:()=>dA,facetMarginBottom:()=>mA,facetMarginLeft:()=>xA,facetMarginRight:()=>gA,facetMarginTop:()=>hA,first:()=>zw,first_value:()=>Ov,float32:()=>iv,float64:()=>pe,frame:()=>EE,from:()=>AF,fxAlign:()=>TA,fxAriaDescription:()=>jA,fxAriaLabel:()=>UA,fxAxis:()=>CA,fxDomain:()=>wA,fxFontVariant:()=>YA,fxGrid:()=>PA,fxInset:()=>_A,fxInsetLeft:()=>SA,fxInsetRight:()=>MA,fxLabel:()=>qA,fxLabelAnchor:()=>BA,fxLabelOffset:()=>zA,fxLine:()=>FA,fxPadding:()=>EA,fxPaddingInner:()=>IA,fxPaddingOuter:()=>NA,fxRange:()=>vA,fxReverse:()=>XA,fxRound:()=>AA,fxTickFormat:()=>$A,fxTickPadding:()=>OA,fxTickRotate:()=>DA,fxTickSize:()=>LA,fxTickSpacing:()=>RA,fxTicks:()=>kA,fyAlign:()=>JA,fyAriaDescription:()=>x8,fyAriaLabel:()=>m8,fyAxis:()=>n8,fyDomain:()=>WA,fyFontVariant:()=>h8,fyGrid:()=>f8,fyInset:()=>GA,fyInsetBottom:()=>QA,fyInsetTop:()=>HA,fyLabel:()=>l8,fyLabelAnchor:()=>p8,fyLabelOffset:()=>d8,fyLine:()=>u8,fyPadding:()=>KA,fyPaddingInner:()=>t8,fyPaddingOuter:()=>e8,fyRange:()=>VA,fyReverse:()=>g8,fyRound:()=>ZA,fyTickFormat:()=>a8,fyTickPadding:()=>s8,fyTickRotate:()=>c8,fyTickSize:()=>o8,fyTickSpacing:()=>i8,fyTicks:()=>r8,geo:()=>DE,geojson:()=>Hl,graticule:()=>FE,grid:()=>WM,gridFx:()=>OE,gridFy:()=>$E,gridX:()=>LE,gridY:()=>RE,gt:()=>_r,gte:()=>xv,hconcat:()=>bF,heatmap:()=>pE,height:()=>PM,hexagon:()=>GT,hexbin:()=>mE,hexgrid:()=>xE,highlight:()=>zE,hspace:()=>_F,hull:()=>ME,image:()=>sE,inset:()=>XM,int32:()=>Gt,intervalX:()=>YE,intervalXY:()=>jE,intervalY:()=>UE,isBetween:()=>tn,isDistinct:()=>gv,isNotBetween:()=>yv,isNotDistinct:()=>Gl,isNotNull:()=>vr,isNull:()=>Ma,kurtosis:()=>Yw,lag:()=>Rv,last:()=>Ww,last_value:()=>$v,lead:()=>ef,lengthBase:()=>xT,lengthClamp:()=>pT,lengthConstant:()=>yT,lengthDomain:()=>uT,lengthExponent:()=>gT,lengthNice:()=>dT,lengthPercent:()=>hT,lengthRange:()=>lT,lengthScale:()=>fT,lengthZero:()=>mT,line:()=>RT,lineX:()=>OT,lineY:()=>$T,link:()=>TE,literal:()=>Fe,loadCSV:()=>zv,loadExtension:()=>Jl,loadJSON:()=>Yv,loadObjects:()=>Xv,loadParquet:()=>Uv,loadSpatial:()=>jv,lt:()=>ae,lte:()=>Kn,mad:()=>Uw,margin:()=>RM,marginBottom:()=>zM,marginLeft:()=>FM,marginRight:()=>qM,marginTop:()=>BM,margins:()=>LM,max:()=>Ke,median:()=>jw,menu:()=>dF,min:()=>jn,mode:()=>Xw,name:()=>CM,nearest:()=>XE,nearestX:()=>WE,nearestY:()=>VE,neq:()=>jr,not:()=>hv,nth_value:()=>Dv,ntile:()=>Lv,opacityBase:()=>W8,opacityClamp:()=>q8,opacityConstant:()=>G8,opacityDomain:()=>P8,opacityExponent:()=>V8,opacityLabel:()=>z8,opacityLegend:()=>a7,opacityNice:()=>B8,opacityPercent:()=>Y8,opacityRange:()=>F8,opacityReverse:()=>U8,opacityScale:()=>D8,opacityTickFormat:()=>X8,opacityZero:()=>j8,or:()=>wr,padding:()=>GM,pan:()=>KE,panX:()=>t7,panY:()=>e7,panZoom:()=>n7,panZoomX:()=>r7,panZoomY:()=>o7,percent_rank:()=>Cv,plot:()=>TF,product:()=>Vw,projectionClip:()=>NT,projectionDomain:()=>ST,projectionInset:()=>MT,projectionInsetBottom:()=>IT,projectionInsetLeft:()=>AT,projectionInsetRight:()=>TT,projectionInsetTop:()=>ET,projectionParallels:()=>wT,projectionPrecision:()=>vT,projectionRotate:()=>_T,projectionType:()=>bT,quantile:()=>Gw,rBase:()=>sT,rClamp:()=>eT,rConstant:()=>cT,rDomain:()=>K8,rExponent:()=>aT,rLabel:()=>rT,rNice:()=>nT,rPercent:()=>oT,rRange:()=>tT,rScale:()=>J8,rZero:()=>iT,rank:()=>Iv,raster:()=>dE,rasterTile:()=>hE,rect:()=>zT,rectX:()=>YT,rectY:()=>UT,region:()=>GE,regressionY:()=>gE,row_number:()=>Ev,ruleX:()=>JT,ruleY:()=>KT,search:()=>hF,skewness:()=>tv,slider:()=>mF,sphere:()=>PE,spike:()=>iE,sql:()=>ge,stddev:()=>Wl,stddevPop:()=>ev,stringAgg:()=>nv,style:()=>$M,sum:()=>Yt,symbolDomain:()=>Q8,symbolLegend:()=>c7,symbolRange:()=>Z8,symbolScale:()=>H8,table:()=>xF,text:()=>HT,textX:()=>QT,textY:()=>ZT,tickX:()=>tE,tickY:()=>eE,toggle:()=>Cc,toggleColor:()=>JE,toggleX:()=>HE,toggleY:()=>QE,toggleZ:()=>ZE,varPop:()=>ov,variance:()=>rv,vconcat:()=>yF,vector:()=>nE,vectorX:()=>rE,vectorY:()=>oE,voronoi:()=>wE,voronoiMesh:()=>vE,vspace:()=>vF,waffleX:()=>qE,waffleY:()=>BE,width:()=>DM,xAlign:()=>s5,xAriaDescription:()=>A5,xAriaLabel:()=>M5,xAxis:()=>u5,xBase:()=>N5,xClamp:()=>o5,xConstant:()=>k5,xDomain:()=>JM,xExponent:()=>C5,xFontVariant:()=>S5,xGrid:()=>g5,xInset:()=>e5,xInsetLeft:()=>n5,xInsetRight:()=>r5,xLabel:()=>b5,xLabelAnchor:()=>w5,xLabelArrow:()=>v5,xLabelOffset:()=>_5,xLine:()=>y5,xNice:()=>t5,xPadding:()=>a5,xPaddingInner:()=>c5,xPaddingOuter:()=>f5,xPercent:()=>T5,xRange:()=>KM,xReverse:()=>E5,xRound:()=>i5,xScale:()=>ZM,xTickFormat:()=>m5,xTickPadding:()=>h5,xTickRotate:()=>x5,xTickSize:()=>p5,xTickSpacing:()=>d5,xTicks:()=>l5,xZero:()=>I5,xyDomain:()=>OM,yAlign:()=>z5,yAriaDescription:()=>sA,yAriaLabel:()=>iA,yAxis:()=>X5,yBase:()=>uA,yClamp:()=>q5,yConstant:()=>pA,yDomain:()=>R5,yExponent:()=>lA,yFontVariant:()=>oA,yGrid:()=>J5,yInset:()=>D5,yInsetBottom:()=>F5,yInsetTop:()=>P5,yLabel:()=>tA,yLabelAnchor:()=>eA,yLabelArrow:()=>nA,yLabelOffset:()=>rA,yLine:()=>K5,yNice:()=>$5,yPadding:()=>Y5,yPaddingInner:()=>U5,yPaddingOuter:()=>j5,yPercent:()=>aA,yRange:()=>O5,yReverse:()=>cA,yRound:()=>B5,yScale:()=>L5,yTickFormat:()=>Q5,yTickPadding:()=>H5,yTickRotate:()=>Z5,yTickSize:()=>V5,yTickSpacing:()=>G5,yTicks:()=>W5,yZero:()=>fA});var lo=Symbol("Fixed"),en=Symbol("Transient"),rp=Symbol("Transform");var lM={};Pc(lM,{Area:()=>yc,Arrow:()=>bh,BarX:()=>bc,BarY:()=>wc,Cell:()=>vc,Contour:()=>Ch,Density:()=>Rh,Dot:()=>_c,Frame:()=>ph,Geo:()=>Oh,Hexgrid:()=>$h,Image:()=>Dh,Line:()=>Sc,Link:()=>gh,Mark:()=>lt,Raster:()=>Th,Rect:()=>gc,RuleX:()=>rh,RuleY:()=>oh,Text:()=>hc,TickX:()=>_h,TickY:()=>Sh,Tip:()=>dh,Vector:()=>xc,WaffleX:()=>Fh,WaffleY:()=>qh,area:()=>xh,areaX:()=>Gs,areaY:()=>Wi,arrow:()=>A$,auto:()=>D$,autoSpec:()=>D4,axisFx:()=>mb,axisFy:()=>hb,axisX:()=>sh,axisY:()=>ih,barX:()=>Xo,barY:()=>Wo,bin:()=>Xi,binX:()=>Uo,binY:()=>jo,bollinger:()=>Js,bollingerX:()=>Y$,bollingerY:()=>U$,boxX:()=>j$,boxY:()=>X$,cell:()=>Hs,cellX:()=>E$,cellY:()=>I$,centroid:()=>Yb,circle:()=>k$,cluster:()=>UD,column:()=>Ge,contour:()=>tD,crosshair:()=>rD,crosshairX:()=>oD,crosshairY:()=>iD,delaunayLink:()=>cD,delaunayMesh:()=>fD,density:()=>hD,differenceX:()=>gD,differenceY:()=>yD,dodgeX:()=>fP,dodgeY:()=>uP,dot:()=>Pr,dotX:()=>N$,dotY:()=>C$,filter:()=>PL,find:()=>WL,formatIsoDate:()=>a4,formatMonth:()=>ZR,formatNumber:()=>s4,formatWeekday:()=>JR,frame:()=>Tu,geo:()=>Ub,geoCentroid:()=>wD,graticule:()=>_D,gridFx:()=>bb,gridFy:()=>gb,gridX:()=>yb,gridY:()=>xb,group:()=>Hd,groupX:()=>Rs,groupY:()=>Os,groupZ:()=>Gd,hexagon:()=>L$,hexbin:()=>SD,hexgrid:()=>MD,hull:()=>uD,identity:()=>W,image:()=>TD,indexOf:()=>Zt,initializer:()=>Kt,interpolateNearest:()=>Ih,interpolateNone:()=>zb,interpolatorBarycentric:()=>Eh,interpolatorRandomWalk:()=>Nh,legend:()=>VO,line:()=>Mc,lineX:()=>Qs,lineY:()=>Zs,linearRegressionX:()=>ND,linearRegressionY:()=>CD,link:()=>Lb,map:()=>Hn,mapX:()=>Lu,mapY:()=>Ru,marks:()=>ke,normalize:()=>Jb,normalizeX:()=>hP,normalizeY:()=>mP,numberInterval:()=>MS,plot:()=>Eu,pointer:()=>Bs,pointerX:()=>zs,pointerY:()=>Ui,raster:()=>Q$,rect:()=>lh,rectX:()=>Mu,rectY:()=>Au,reverse:()=>FL,ruleX:()=>pr,ruleY:()=>dr,scale:()=>$s,select:()=>bP,selectFirst:()=>Yh,selectLast:()=>Uh,selectMaxX:()=>n2,selectMaxY:()=>r2,selectMinX:()=>t2,selectMinY:()=>e2,shiftX:()=>xP,shiftY:()=>gP,shuffle:()=>qL,sort:()=>D1,sphere:()=>vD,spike:()=>EO,stackX:()=>A4,stackX1:()=>KO,stackX2:()=>t$,stackY:()=>T4,stackY1:()=>e$,stackY2:()=>n$,text:()=>Yo,textX:()=>ab,textY:()=>cb,tickX:()=>Fb,tickY:()=>qb,timeInterval:()=>Yd,tip:()=>Tb,transform:()=>Ce,tree:()=>nM,treeLink:()=>Gb,treeNode:()=>Ph,utcInterval:()=>oc,valueof:()=>ut,vector:()=>_4,vectorX:()=>lb,vectorY:()=>pb,voronoi:()=>lD,voronoiMesh:()=>pD,waffleX:()=>HD,waffleY:()=>QD,window:()=>Ou,windowX:()=>P$,windowY:()=>F$});function yt(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 Xr(t){let e,n,r;t.length!==2?(e=yt,n=(a,c)=>yt(t(a),c),r=(a,c)=>t(a)-c):(e=t===yt||t===An?t:wz,n=t,r=t);function o(a,c,f=0,u=a.length){if(f<u){if(e(c,c)!==0)return u;do{let p=f+u>>>1;n(a[p],c)<0?f=p+1:u=p}while(f<u)}return f}function i(a,c,f=0,u=a.length){if(f<u){if(e(c,c)!==0)return u;do{let p=f+u>>>1;n(a[p],c)<=0?f=p+1:u=p}while(f<u)}return f}function s(a,c,f=0,u=a.length){let p=o(a,c,f,u-1);return p>f&&r(a[p-1],c)>-r(a[p],c)?p-1:p}return{left:o,center:s,right:i}}function wz(){return 0}function op(t){return t===null?NaN:+t}function*II(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 NI=Xr(yt),CI=NI.right,vz=NI.left,_z=Xr(op).center,fi=CI;var ip=kI(LI),a_=kI(Sz);function kI(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?(of(a,f,o,i,s),of(a,o,f,i,s),of(a,f,o,i,s),sf(c,o,f,i,s),sf(c,f,o,i,s),sf(c,o,f,i,s)):a?(of(a,o,f,i,s),of(a,f,o,i,s),of(a,o,f,i,s)):c&&(sf(c,o,f,i,s),sf(c,f,o,i,s),sf(c,o,f,i,s)),e}}function of(t,e,n,r,o){for(let i=0,s=r*o;i<s;)t(e,n,i,i+=r,1)}function sf(t,e,n,r,o){for(let i=0,s=r*o;i<r;++i)t(e,n,i,i+s,r)}function Sz(t){let e=LI(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 LI(t){let e=Math.floor(t);if(e===t)return Mz(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],u=c*e,p=u+c;for(let l=s,d=s+u;l<d;l+=c)f+=i[Math.min(a,l)];for(let l=s,d=a;l<=d;l+=c)f+=i[Math.min(a,l+u)],o[l]=(f+n*(i[Math.max(s,l-p)]+i[Math.min(a,l+p)]))/r,f-=i[Math.max(s,l-u)]}}function Mz(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,u=o+c;f<u;f+=s)a+=r[Math.min(i,f)];for(let f=o,u=i;f<=u;f+=s)a+=r[Math.min(i,f+c)],n[f]=a/e,a-=r[Math.max(o,f-c)]}}function po(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 Az(t){return t.length|0}function Tz(t){return!(t>0)}function Ez(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function Iz(t){return e=>t(...e)}function xx(...t){let e=typeof t[t.length-1]=="function"&&Iz(t.pop());t=t.map(Ez);let n=t.map(Az),r=t.length-1,o=new Array(r+1).fill(0),i=[];if(r<0||n.some(Tz))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 gx(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 as(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 Mr(t,e){let n=as(t,e);return n&&Math.sqrt(n)}function Ft(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 nn=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 Tn=class extends Map{constructor(e,n=$I){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(c_(this,e))}has(e){return super.has(c_(this,e))}set(e,n){return super.set(RI(this,e),n)}delete(e){return super.delete(OI(this,e))}},En=class extends Set{constructor(e,n=$I){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(c_(this,e))}add(e){return super.add(RI(this,e))}delete(e){return super.delete(OI(this,e))}};function c_({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):n}function RI({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function OI({_intern:t,_key:e},n){let r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function $I(t){return t!==null&&typeof t=="object"?t.valueOf():t}function sp(t){return t}function rn(t,...e){return u_(t,sp,sp,e)}function Wr(t,e,...n){return u_(t,sp,e,n)}function f_(t,e,...n){return u_(t,Array.from,e,n)}function u_(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);let a=new Tn,c=r[s++],f=-1;for(let u of i){let p=c(u,++f,i),l=a.get(p);l?l.push(u):a.set(p,[u])}for(let[u,p]of a)a.set(u,o(p,s));return e(a)}(t,0)}function l_(t,e){return Array.from(e,n=>t[n])}function ui(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=Ea(s[o],s[i]);if(a)return a}})):(n=t.map(n),r.sort((o,i)=>Ea(n[o],n[i]))),l_(t,r)}return t.sort(ap(n))}function ap(t=yt){if(t===yt)return Ea;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 Ea(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}function af(t,e,n){return(e.length!==2?ui(Wr(t,e,n),([r,o],[i,s])=>yt(o,s)||yt(r,i)):ui(rn(t,n),([r,o],[i,s])=>e(o,s)||yt(r,i))).map(([r])=>r)}var Nz=Math.sqrt(50),Cz=Math.sqrt(10),kz=Math.sqrt(2);function yx(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>=Nz?10:i>=Cz?5:i>=kz?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?yx(t,e,n*2):[a,c,f]}function on(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?yx(e,t,n):yx(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 li(t,e,n){return e=+e,t=+t,n=+n,yx(t,e,n)[2]}function cf(t,e,n){e=+e,t=+t,n=+n;let r=e<t,o=r?li(e,t,n):li(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function ff(t,e,n){let r;for(;;){let o=li(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 cs(t){return Math.max(1,Math.ceil(Math.log(po(t))/Math.LN2)+1)}function kt(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 bx(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 It(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 wx(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 vx(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?Ea:ap(o);r>n;){if(r-n>600){let c=r-n+1,f=e-n+1,u=Math.log(c),p=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*p*(c-p)/c)*(f-c/2<0?-1:1),d=Math.max(n,Math.floor(e-f*p/c+l)),h=Math.min(r,Math.floor(e+(c-f)*p/c+l));vx(t,e,d,h,o)}let i=t[e],s=n,a=r;for(cp(t,n,e),o(t[r],i)>0&&cp(t,n,r);s<a;){for(cp(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?cp(t,n,a):(++a,cp(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function cp(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Ia(t,e=yt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?yt(s,o)>0:yt(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 In(t,e,n){if(t=Float64Array.from(II(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return It(t);if(e>=1)return kt(t);var r,o=(r-1)*e,i=Math.floor(o),s=kt(vx(t,i).subarray(0,i+1)),a=It(t.subarray(i+1));return s+(a-s)*(o-i)}}function p_(t,e,n=op){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 _x(t,e,n){let r=po(t),o=In(t,.75)-In(t,.25);return r&&o?Math.ceil((n-e)/(2*o*Math.pow(r,-1/3))):1}function fp(t,e,n){let r=po(t),o=Mr(t);return r&&o?Math.ceil((n-e)*Math.cbrt(r)/(3.49*o)):1}function pi(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 Vr(t,e){return In(t,.5,e)}function*Rz(t){for(let e of t)yield*e}function uf(t){return Array.from(Rz(t))}function lf(t,e){let n=new Tn;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 Sx(t,e=Oz){let n=[],r,o=!1;for(let i of t)o&&n.push(e(r,i)),r=i,o=!0;return n}function Oz(t,e){return[t,e]}function ye(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 up(t,e=yt){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=yt);let o=(a,c)=>e(n[a],n[c]),i,s;return t=Uint32Array.from(n,(a,c)=>c),t.sort(e===yt?(a,c)=>Ea(n[a],n[c]):ap(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 Mx(t,e=yt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?yt(s,o)<0:yt(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 sn(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 fs(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function DI(t){return t}var d_=1,h_=2,m_=3,Ax=4,PI=1e-6;function $z(t){return"translate("+t+",0)"}function Dz(t){return"translate(0,"+t+")"}function Pz(t){return e=>+t(e)}function Fz(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function qz(){return!this.__axis}function Bz(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===d_||t===Ax?-1:1,u=t===Ax||t===h_?"x":"y",p=t===d_||t===m_?$z:Dz;function l(d){var h=r??(e.ticks?e.ticks.apply(e,n):e.domain()),m=o??(e.tickFormat?e.tickFormat.apply(e,n):DI),x=Math.max(i,0)+a,g=e.range(),y=+g[0]+c,b=+g[g.length-1]+c,w=(e.bandwidth?Fz:Pz)(e.copy(),c),_=d.selection?d.selection():d,v=_.selectAll(".domain").data([null]),A=_.selectAll(".tick").data(h,e).order(),T=A.exit(),E=A.enter().append("g").attr("class","tick"),N=A.select("line"),M=A.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),A=A.merge(E),N=N.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",f*i)),M=M.merge(E.append("text").attr("fill","currentColor").attr(u,f*x).attr("dy",t===d_?"0em":t===m_?"0.71em":"0.32em")),d!==_&&(v=v.transition(d),A=A.transition(d),N=N.transition(d),M=M.transition(d),T=T.transition(d).attr("opacity",PI).attr("transform",function(k){return isFinite(k=w(k))?p(k+c):this.getAttribute("transform")}),E.attr("opacity",PI).attr("transform",function(k){var O=this.parentNode.__axis;return p((O&&isFinite(O=O(k))?O:w(k))+c)})),T.remove(),v.attr("d",t===Ax||t===h_?s?"M"+f*s+","+y+"H"+c+"V"+b+"H"+f*s:"M"+c+","+y+"V"+b:s?"M"+y+","+f*s+"V"+c+"H"+b+"V"+f*s:"M"+y+","+c+"H"+b),A.attr("opacity",1).attr("transform",function(k){return p(w(k)+c)}),N.attr(u+"2",f*i),M.attr(u,f*x).text(m),_.filter(qz).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===h_?"start":t===Ax?"end":"middle"),_.each(function(){this.__axis=w})}return l.scale=function(d){return arguments.length?(e=d,l):e},l.ticks=function(){return n=Array.from(arguments),l},l.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),l):n.slice()},l.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),l):r&&r.slice()},l.tickFormat=function(d){return arguments.length?(o=d,l):o},l.tickSize=function(d){return arguments.length?(i=s=+d,l):i},l.tickSizeInner=function(d){return arguments.length?(i=+d,l):i},l.tickSizeOuter=function(d){return arguments.length?(s=+d,l):s},l.tickPadding=function(d){return arguments.length?(a=+d,l):a},l.offset=function(d){return arguments.length?(c=+d,l):c},l}function x_(t){return Bz(m_,t)}var zz={value:()=>{}};function qI(){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 Tx(n)}function Tx(t){this._=t}function Yz(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}})}Tx.prototype=qI.prototype={constructor:Tx,on:function(t,e){var n=this._,r=Yz(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=Uz(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]=FI(n[o],t.name,e);else if(e==null)for(o in n)n[o]=FI(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 Tx(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 Uz(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function FI(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=zz,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Na=qI;var Ex="http://www.w3.org/1999/xhtml",Nn={svg:"http://www.w3.org/2000/svg",xhtml:Ex,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function di(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Nn.hasOwnProperty(e)?{space:Nn[e],local:t}:t}function jz(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ex&&e.documentElement.namespaceURI===Ex?e.createElement(t):e.createElementNS(n,t)}}function Xz(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function hi(t){var e=di(t);return(e.local?Xz:jz)(e)}function Wz(){}function Ca(t){return t==null?Wz:function(){return this.querySelector(t)}}function BI(t){typeof t!="function"&&(t=Ca(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,u=0;u<s;++u)(c=i[u])&&(f=t.call(c,c.__data__,u,i))&&("__data__"in c&&(f.__data__=c.__data__),a[u]=f);return new de(r,this._parents)}function g_(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Vz(){return[]}function lp(t){return t==null?Vz:function(){return this.querySelectorAll(t)}}function Gz(t){return function(){return g_(t.apply(this,arguments))}}function zI(t){typeof t=="function"?t=Gz(t):t=lp(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 de(r,o)}function pp(t){return function(){return this.matches(t)}}function Ix(t){return function(e){return e.matches(t)}}var Hz=Array.prototype.find;function Qz(t){return function(){return Hz.call(this.children,t)}}function Zz(){return this.firstElementChild}function YI(t){return this.select(t==null?Zz:Qz(typeof t=="function"?t:Ix(t)))}var Jz=Array.prototype.filter;function Kz(){return Array.from(this.children)}function tY(t){return function(){return Jz.call(this.children,t)}}function UI(t){return this.selectAll(t==null?Kz:tY(typeof t=="function"?t:Ix(t)))}function jI(t){typeof t!="function"&&(t=pp(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 de(r,this._parents)}function Nx(t){return new Array(t.length)}function XI(){return new de(this._enter||this._groups.map(Nx),this._parents)}function dp(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}dp.prototype={constructor:dp,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 WI(t){return function(){return t}}function eY(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 dp(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function nY(t,e,n,r,o,i,s){var a,c,f=new Map,u=e.length,p=i.length,l=new Array(u),d;for(a=0;a<u;++a)(c=e[a])&&(l[a]=d=s.call(c,c.__data__,a,e)+"",f.has(d)?o[a]=c:f.set(d,c));for(a=0;a<p;++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 dp(t,i[a]);for(a=0;a<u;++a)(c=e[a])&&f.get(l[a])===c&&(o[a]=c)}function rY(t){return t.__data__}function VI(t,e){if(!arguments.length)return Array.from(this,rY);var n=e?nY:eY,r=this._parents,o=this._groups;typeof t!="function"&&(t=WI(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),f=0;f<i;++f){var u=r[f],p=o[f],l=p.length,d=oY(t.call(u,u&&u.__data__,f,r)),h=d.length,m=a[f]=new Array(h),x=s[f]=new Array(h),g=c[f]=new Array(l);n(u,p,m,x,g,d,e);for(var y=0,b=0,w,_;y<h;++y)if(w=m[y]){for(y>=b&&(b=y+1);!(_=x[b])&&++b<h;);w._next=_||null}}return s=new de(s,r),s._enter=a,s._exit=c,s}function oY(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function GI(){return new de(this._exit||this._groups.map(Nx),this._parents)}function HI(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 QI(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],u=r[c],p=f.length,l=a[c]=new Array(p),d,h=0;h<p;++h)(d=f[h]||u[h])&&(l[h]=d);for(;c<o;++c)a[c]=n[c];return new de(a,this._parents)}function ZI(){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 JI(t){t||(t=iY);function e(p,l){return p&&l?t(p.__data__,l.__data__):!p-!l}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,u=0;u<a;++u)(f=s[u])&&(c[u]=f);c.sort(e)}return new de(o,this._parents).order()}function iY(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function KI(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function tN(){return Array.from(this)}function eN(){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 nN(){let t=0;for(let e of this)++t;return t}function rN(){return!this.node()}function oN(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 sY(t){return function(){this.removeAttribute(t)}}function aY(t){return function(){this.removeAttributeNS(t.space,t.local)}}function cY(t,e){return function(){this.setAttribute(t,e)}}function fY(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function uY(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function lY(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 iN(t,e){var n=di(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?aY:sY:typeof e=="function"?n.local?lY:uY:n.local?fY:cY)(n,e))}function Cx(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function pY(t){return function(){this.style.removeProperty(t)}}function dY(t,e,n){return function(){this.style.setProperty(t,e,n)}}function hY(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function sN(t,e,n){return arguments.length>1?this.each((e==null?pY:typeof e=="function"?hY:dY)(t,e,n??"")):us(this.node(),t)}function us(t,e){return t.style.getPropertyValue(e)||Cx(t).getComputedStyle(t,null).getPropertyValue(e)}function mY(t){return function(){delete this[t]}}function xY(t,e){return function(){this[t]=e}}function gY(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function aN(t,e){return arguments.length>1?this.each((e==null?mY:typeof e=="function"?gY:xY)(t,e)):this.node()[t]}function cN(t){return t.trim().split(/^|\s+/)}function y_(t){return t.classList||new fN(t)}function fN(t){this._node=t,this._names=cN(t.getAttribute("class")||"")}fN.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 uN(t,e){for(var n=y_(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function lN(t,e){for(var n=y_(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function yY(t){return function(){uN(this,t)}}function bY(t){return function(){lN(this,t)}}function wY(t,e){return function(){(e.apply(this,arguments)?uN:lN)(this,t)}}function pN(t,e){var n=cN(t+"");if(arguments.length<2){for(var r=y_(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?wY:e?yY:bY)(n,e))}function vY(){this.textContent=""}function _Y(t){return function(){this.textContent=t}}function SY(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function dN(t){return arguments.length?this.each(t==null?vY:(typeof t=="function"?SY:_Y)(t)):this.node().textContent}function MY(){this.innerHTML=""}function AY(t){return function(){this.innerHTML=t}}function TY(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function hN(t){return arguments.length?this.each(t==null?MY:(typeof t=="function"?TY:AY)(t)):this.node().innerHTML}function EY(){this.nextSibling&&this.parentNode.appendChild(this)}function mN(){return this.each(EY)}function IY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xN(){return this.each(IY)}function gN(t){var e=typeof t=="function"?t:hi(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function NY(){return null}function yN(t,e){var n=typeof t=="function"?t:hi(t),r=e==null?NY:typeof e=="function"?e:Ca(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function CY(){var t=this.parentNode;t&&t.removeChild(this)}function bN(){return this.each(CY)}function kY(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function LY(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function wN(t){return this.select(t?LY:kY)}function vN(t){return arguments.length?this.property("__data__",t):this.node().__data__}function RY(t){return function(e){t.call(this,e,this.__data__)}}function OY(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 $Y(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 DY(t,e,n){return function(){var r=this.__on,o,i=RY(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 _N(t,e,n){var r=OY(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,f=a.length,u;c<f;++c)for(o=0,u=a[c];o<i;++o)if((s=r[o]).type===u.type&&s.name===u.name)return u.value}return}for(a=e?DY:$Y,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function SN(t,e,n){var r=Cx(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 PY(t,e){return function(){return SN(this,t,e)}}function FY(t,e){return function(){return SN(this,t,e.apply(this,arguments))}}function MN(t,e){return this.each((typeof e=="function"?FY:PY)(t,e))}function*AN(){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 b_=[null];function de(t,e){this._groups=t,this._parents=e}function TN(){return new de([[document.documentElement]],b_)}function qY(){return this}de.prototype=TN.prototype={constructor:de,select:BI,selectAll:zI,selectChild:YI,selectChildren:UI,filter:jI,data:VI,enter:XI,exit:GI,join:HI,merge:QI,selection:qY,order:ZI,sort:JI,call:KI,nodes:tN,node:eN,size:nN,empty:rN,each:oN,attr:iN,style:sN,property:aN,classed:pN,text:dN,html:hN,raise:mN,lower:xN,append:gN,insert:yN,remove:bN,clone:wN,datum:vN,on:_N,dispatch:MN,[Symbol.iterator]:AN};var mi=TN;function Nt(t){return typeof t=="string"?new de([[document.querySelector(t)]],[document.documentElement]):new de([[t]],b_)}function EN(t){let e;for(;e=t.sourceEvent;)t=e;return t}function hn(t,e){if(t=EN(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 kx={capture:!0,passive:!1};function Lx(t){t.preventDefault(),t.stopImmediatePropagation()}function hp(t){var e=t.document.documentElement,n=Nt(t).on("dragstart.drag",Lx,kx);"onselectstart"in e?n.on("selectstart.drag",Lx,kx):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function mp(t,e){var n=t.document.documentElement,r=Nt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Lx,kx),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 xi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ls(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function mo(){}var ps=.7,Ra=1/ps,pf="\\s*([+-]?\\d+)\\s*",xp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",BY=/^#([0-9a-f]{3,8})$/,zY=new RegExp(`^rgb\\(${pf},${pf},${pf}\\)$`),YY=new RegExp(`^rgb\\(${ho},${ho},${ho}\\)$`),UY=new RegExp(`^rgba\\(${pf},${pf},${pf},${xp}\\)$`),jY=new RegExp(`^rgba\\(${ho},${ho},${ho},${xp}\\)$`),XY=new RegExp(`^hsl\\(${xp},${ho},${ho}\\)$`),WY=new RegExp(`^hsla\\(${xp},${ho},${ho},${xp}\\)$`),IN={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};xi(mo,nr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:NN,formatHex:NN,formatHex8:VY,formatHsl:GY,formatRgb:CN,toString:CN});function NN(){return this.rgb().formatHex()}function VY(){return this.rgb().formatHex8()}function GY(){return DN(this).formatHsl()}function CN(){return this.rgb().formatRgb()}function nr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=BY.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?kN(e):n===3?new Se(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rx(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rx(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=zY.exec(t))?new Se(e[1],e[2],e[3],1):(e=YY.exec(t))?new Se(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=UY.exec(t))?Rx(e[1],e[2],e[3],e[4]):(e=jY.exec(t))?Rx(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=XY.exec(t))?ON(e[1],e[2]/100,e[3]/100,1):(e=WY.exec(t))?ON(e[1],e[2]/100,e[3]/100,e[4]):IN.hasOwnProperty(t)?kN(IN[t]):t==="transparent"?new Se(NaN,NaN,NaN,0):null}function kN(t){return new Se(t>>16&255,t>>8&255,t&255,1)}function Rx(t,e,n,r){return r<=0&&(t=e=n=NaN),new Se(t,e,n,r)}function gp(t){return t instanceof mo||(t=nr(t)),t?(t=t.rgb(),new Se(t.r,t.g,t.b,t.opacity)):new Se}function Le(t,e,n,r){return arguments.length===1?gp(t):new Se(t,e,n,r??1)}function Se(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}xi(Se,Le,ls(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ps:Math.pow(ps,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Se(La(this.r),La(this.g),La(this.b),$x(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:LN,formatHex:LN,formatHex8:HY,formatRgb:RN,toString:RN}));function LN(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}`}function HY(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}${ka((isNaN(this.opacity)?1:this.opacity)*255)}`}function RN(){let t=$x(this.opacity);return`${t===1?"rgb(":"rgba("}${La(this.r)}, ${La(this.g)}, ${La(this.b)}${t===1?")":`, ${t})`}`}function $x(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function La(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ka(t){return t=La(t),(t<16?"0":"")+t.toString(16)}function ON(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Gr(t,e,n,r)}function DN(t){if(t instanceof Gr)return new Gr(t.h,t.s,t.l,t.opacity);if(t instanceof mo||(t=nr(t)),!t)return new Gr;if(t instanceof Gr)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 Gr(s,a,c,t.opacity)}function yp(t,e,n,r){return arguments.length===1?DN(t):new Gr(t,e,n,r??1)}function Gr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}xi(Gr,yp,ls(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Gr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ps:Math.pow(ps,t),new Gr(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 Se(w_(t>=240?t-240:t+120,o,r),w_(t,o,r),w_(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Gr($N(this.h),Ox(this.s),Ox(this.l),$x(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=$x(this.opacity);return`${t===1?"hsl(":"hsla("}${$N(this.h)}, ${Ox(this.s)*100}%, ${Ox(this.l)*100}%${t===1?")":`, ${t})`}`}}));function $N(t){return t=(t||0)%360,t<0?t+360:t}function Ox(t){return Math.max(0,Math.min(1,t||0))}function w_(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 Dx=Math.PI/180,Px=180/Math.PI;var Fx=18,PN=.96422,FN=1,qN=.82521,BN=4/29,df=6/29,zN=3*df*df,QY=df*df*df;function YN(t){if(t instanceof xo)return new xo(t.l,t.a,t.b,t.opacity);if(t instanceof gi)return UN(t);t instanceof Se||(t=gp(t));var e=M_(t.r),n=M_(t.g),r=M_(t.b),o=v_((.2225045*e+.7168786*n+.0606169*r)/FN),i,s;return e===n&&n===r?i=s=o:(i=v_((.4360747*e+.3850649*n+.1430804*r)/PN),s=v_((.0139322*e+.0971045*n+.7141733*r)/qN)),new xo(116*o-16,500*(i-o),200*(o-s),t.opacity)}function hf(t,e,n,r){return arguments.length===1?YN(t):new xo(t,e,n,r??1)}function xo(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}xi(xo,hf,ls(mo,{brighter(t){return new xo(this.l+Fx*(t??1),this.a,this.b,this.opacity)},darker(t){return new xo(this.l-Fx*(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=PN*__(e),t=FN*__(t),n=qN*__(n),new Se(S_(3.1338561*e-1.6168667*t-.4906146*n),S_(-.9787684*e+1.9161415*t+.033454*n),S_(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function v_(t){return t>QY?Math.pow(t,1/3):t/zN+BN}function __(t){return t>df?t*t*t:zN*(t-BN)}function S_(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function M_(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ZY(t){if(t instanceof gi)return new gi(t.h,t.c,t.l,t.opacity);if(t instanceof xo||(t=YN(t)),t.a===0&&t.b===0)return new gi(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Px;return new gi(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bp(t,e,n,r){return arguments.length===1?ZY(t):new gi(t,e,n,r??1)}function gi(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function UN(t){if(isNaN(t.h))return new xo(t.l,0,0,t.opacity);var e=t.h*Dx;return new xo(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}xi(gi,bp,ls(mo,{brighter(t){return new gi(this.h,this.c,this.l+Fx*(t??1),this.opacity)},darker(t){return new gi(this.h,this.c,this.l-Fx*(t??1),this.opacity)},rgb(){return UN(this).rgb()}}));var VN=-.14861,A_=1.78277,T_=-.29227,qx=-.90649,wp=1.97294,jN=wp*qx,XN=wp*A_,WN=A_*T_-qx*VN;function JY(t){if(t instanceof Oa)return new Oa(t.h,t.s,t.l,t.opacity);t instanceof Se||(t=gp(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(WN*r+jN*e-XN*n)/(WN+jN-XN),i=r-o,s=(wp*(n-o)-T_*i)/qx,a=Math.sqrt(s*s+i*i)/(wp*o*(1-o)),c=a?Math.atan2(s,i)*Px-120:NaN;return new Oa(c<0?c+360:c,a,o,t.opacity)}function Cn(t,e,n,r){return arguments.length===1?JY(t):new Oa(t,e,n,r??1)}function Oa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}xi(Oa,Cn,ls(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Oa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ps:Math.pow(ps,t),new Oa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Dx,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new Se(255*(e+n*(VN*r+A_*o)),255*(e+n*(T_*r+qx*o)),255*(e+n*(wp*r)),this.opacity)}}));function E_(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 GN(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 E_((n-r/e)*e,s,o,i,a)}}function HN(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 E_((n-r/e)*e,o,i,s,a)}}var mf=t=>()=>t;function QN(t,e){return function(n){return t+n*e}}function KY(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 xf(t,e){var n=e-t;return n?QN(t,n>180||n<-180?n-360*Math.round(n/360):n):mf(isNaN(t)?e:t)}function ZN(t){return(t=+t)==1?re:function(e,n){return n-e?KY(e,n,t):mf(isNaN(e)?n:e)}}function re(t,e){var n=e-t;return n?QN(t,n):mf(isNaN(t)?e:t)}var Ar=function t(e){var n=ZN(e);function r(o,i){var s=n((o=Le(o)).r,(i=Le(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),f=re(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=f(u),o+""}}return r.gamma=t,r}(1);function JN(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=Le(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 I_=JN(GN),tU=JN(HN);function KN(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 tC(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function eC(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]=rr(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 nC(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function ee(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function rC(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]=rr(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var C_=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,N_=new RegExp(C_.source,"g");function eU(t){return function(){return t}}function nU(t){return function(e){return t(e)+""}}function vp(t,e){var n=C_.lastIndex=N_.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=C_.exec(t))&&(o=N_.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:ee(r,o)})),n=N_.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?nU(c[0].x):eU(e):(e=c.length,function(f){for(var u=0,p;u<e;++u)a[(p=c[u]).i]=p.x(f);return a.join("")})}function rr(t,e){var n=typeof e,r;return e==null||n==="boolean"?mf(e):(n==="number"?ee:n==="string"?(r=nr(e))?(e=r,Ar):vp:e instanceof nr?Ar:e instanceof Date?nC:tC(e)?KN:Array.isArray(e)?eC:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?rC:ee)(t,e)}function $a(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var oC=180/Math.PI,Bx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function k_(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)*oC,skewX:Math.atan(c)*oC,scaleX:s,scaleY:a}}var zx;function iC(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Bx:k_(e.a,e.b,e.c,e.d,e.e,e.f)}function sC(t){return t==null?Bx:(zx||(zx=document.createElementNS("http://www.w3.org/2000/svg","g")),zx.setAttribute("transform",t),(t=zx.transform.baseVal.consolidate())?(t=t.matrix,k_(t.a,t.b,t.c,t.d,t.e,t.f)):Bx)}function aC(t,e,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,u,p,l,d,h){if(f!==p||u!==l){var m=d.push("translate(",null,e,null,n);h.push({i:m-4,x:ee(f,p)},{i:m-2,x:ee(u,l)})}else(p||l)&&d.push("translate("+p+e+l+n)}function s(f,u,p,l){f!==u?(f-u>180?u+=360:u-f>180&&(f+=360),l.push({i:p.push(o(p)+"rotate(",null,r)-2,x:ee(f,u)})):u&&p.push(o(p)+"rotate("+u+r)}function a(f,u,p,l){f!==u?l.push({i:p.push(o(p)+"skewX(",null,r)-2,x:ee(f,u)}):u&&p.push(o(p)+"skewX("+u+r)}function c(f,u,p,l,d,h){if(f!==p||u!==l){var m=d.push(o(d)+"scale(",null,",",null,")");h.push({i:m-4,x:ee(f,p)},{i:m-2,x:ee(u,l)})}else(p!==1||l!==1)&&d.push(o(d)+"scale("+p+","+l+")")}return function(f,u){var p=[],l=[];return f=t(f),u=t(u),i(f.translateX,f.translateY,u.translateX,u.translateY,p,l),s(f.rotate,u.rotate,p,l),a(f.skewX,u.skewX,p,l),c(f.scaleX,f.scaleY,u.scaleX,u.scaleY,p,l),f=u=null,function(d){for(var h=-1,m=l.length,x;++h<m;)p[(x=l[h]).i]=x.x(d);return p.join("")}}}var L_=aC(iC,"px, ","px)","deg)"),R_=aC(sC,", ",")",")");var rU=1e-12;function cC(t){return((t=Math.exp(t))+1/t)/2}function oU(t){return((t=Math.exp(t))-1/t)/2}function iU(t){return((t=Math.exp(2*t))-1)/(t+1)}var O_=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],f=i[2],u=s[0],p=s[1],l=s[2],d=u-a,h=p-c,m=d*d+h*h,x,g;if(m<rU)g=Math.log(l/f)/e,x=function(A){return[a+A*d,c+A*h,f*Math.exp(e*A*g)]};else{var y=Math.sqrt(m),b=(l*l-f*f+r*m)/(2*f*n*y),w=(l*l-f*f-r*m)/(2*l*n*y),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);g=(v-_)/e,x=function(A){var T=A*g,E=cC(_),N=f/(n*y)*(E*iU(e*T+_)-oU(_));return[a+N*d,c+N*h,f*E/cC(e*T+_)]}}return x.duration=g*1e3*e/Math.SQRT2,x}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 fC(t){return function(e,n){var r=t((e=yp(e)).h,(n=yp(n)).h),o=re(e.s,n.s),i=re(e.l,n.l),s=re(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 $_=fC(xf),sU=fC(re);function Yx(t,e){var n=re((t=hf(t)).l,(e=hf(e)).l),r=re(t.a,e.a),o=re(t.b,e.b),i=re(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 uC(t){return function(e,n){var r=t((e=bp(e)).h,(n=bp(n)).h),o=re(e.c,n.c),i=re(e.l,n.l),s=re(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 D_=uC(xf),aU=uC(re);function lC(t){return function e(n){n=+n;function r(o,i){var s=t((o=Cn(o)).h,(i=Cn(i)).h),a=re(o.s,i.s),c=re(o.l,i.l),f=re(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=c(Math.pow(u,n)),o.opacity=f(u),o+""}}return r.gamma=e,r}(1)}var cU=lC(xf),gf=lC(re);function go(t,e){e===void 0&&(e=t,t=rr);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 mn(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}var yf=0,Sp=0,_p=0,dC=1e3,Ux,Mp,jx=0,Da=0,Xx=0,Ap=typeof performance=="object"&&performance.now?performance:Date,hC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ep(){return Da||(hC(fU),Da=Ap.now()+Xx)}function fU(){Da=0}function Tp(){this._call=this._time=this._next=null}Tp.prototype=Wx.prototype={constructor:Tp,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ep():+n)+(e==null?0:+e),!this._next&&Mp!==this&&(Mp?Mp._next=this:Ux=this,Mp=this),this._call=t,this._time=n,P_()},stop:function(){this._call&&(this._call=null,this._time=1/0,P_())}};function Wx(t,e,n){var r=new Tp;return r.restart(t,e,n),r}function mC(){Ep(),++yf;for(var t=Ux,e;t;)(e=Da-t._time)>=0&&t._call.call(void 0,e),t=t._next;--yf}function pC(){Da=(jx=Ap.now())+Xx,yf=Sp=0;try{mC()}finally{yf=0,lU(),Da=0}}function uU(){var t=Ap.now(),e=t-jx;e>dC&&(Xx-=e,jx=t)}function lU(){for(var t,e=Ux,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:Ux=n);Mp=t,P_(r)}function P_(t){if(!yf){Sp&&(Sp=clearTimeout(Sp));var e=t-Da;e>24?(t<1/0&&(Sp=setTimeout(pC,t-Ap.now()-Xx)),_p&&(_p=clearInterval(_p))):(_p||(jx=Ap.now(),_p=setInterval(uU,dC)),yf=1,hC(pC))}}function Vx(t,e,n){var r=new Tp;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var pU=Na("start","end","cancel","interrupt"),dU=[],yC=0,xC=1,Hx=2,Gx=3,gC=4,Qx=5,Ip=6;function ds(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;hU(t,n,{name:e,index:r,group:o,on:pU,tween:dU,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:yC})}function Np(t,e){var n=Re(t,e);if(n.state>yC)throw new Error("too late; already scheduled");return n}function an(t,e){var n=Re(t,e);if(n.state>Gx)throw new Error("too late; already running");return n}function Re(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function hU(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Wx(i,0,n.time);function i(f){n.state=xC,n.timer.restart(s,n.delay,n.time),n.delay<=f&&s(f-n.delay)}function s(f){var u,p,l,d;if(n.state!==xC)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===Gx)return Vx(s);d.state===gC?(d.state=Ip,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[u]):+u<e&&(d.state=Ip,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[u])}if(Vx(function(){n.state===Gx&&(n.state=gC,n.timer.restart(a,n.delay,n.time),a(f))}),n.state=Hx,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Hx){for(n.state=Gx,o=new Array(l=n.tween.length),u=0,p=-1;u<l;++u)(d=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(o[++p]=d);o.length=p+1}}function a(f){for(var u=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(c),n.state=Qx,1),p=-1,l=o.length;++p<l;)o[p].call(t,u);n.state===Qx&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ip,n.timer.stop(),delete r[e];for(var f in r)return;delete t.__transition}}function yo(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>Hx&&r.state<Qx,r.state=Ip,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function bC(t){return this.each(function(){yo(this,t)})}function mU(t,e){var n,r;return function(){var o=an(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 xU(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=an(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 wC(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Re(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?mU:xU)(n,t,e))}function bf(t,e,n){var r=t._id;return t.each(function(){var o=an(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return Re(o,r).value[e]}}function Zx(t,e){var n;return(typeof e=="number"?ee:e instanceof nr?Ar:(n=nr(e))?(e=n,Ar):vp)(t,e)}function gU(t){return function(){this.removeAttribute(t)}}function yU(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bU(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 wU(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 vU(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 _U(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 vC(t,e){var n=di(t),r=n==="transform"?R_:Zx;return this.attrTween(t,typeof e=="function"?(n.local?_U:vU)(n,r,bf(this,"attr."+t,e)):e==null?(n.local?yU:gU)(n):(n.local?wU:bU)(n,r,e))}function SU(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function MU(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function AU(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&MU(t,i)),n}return o._value=e,o}function TU(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&SU(t,i)),n}return o._value=e,o}function _C(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=di(t);return this.tween(n,(r.local?AU:TU)(r,e))}function EU(t,e){return function(){Np(this,t).delay=+e.apply(this,arguments)}}function IU(t,e){return e=+e,function(){Np(this,t).delay=e}}function SC(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?EU:IU)(e,t)):Re(this.node(),e).delay}function NU(t,e){return function(){an(this,t).duration=+e.apply(this,arguments)}}function CU(t,e){return e=+e,function(){an(this,t).duration=e}}function MC(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?NU:CU)(e,t)):Re(this.node(),e).duration}function kU(t,e){if(typeof e!="function")throw new Error;return function(){an(this,t).ease=e}}function AC(t){var e=this._id;return arguments.length?this.each(kU(e,t)):Re(this.node(),e).ease}function LU(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;an(this,t).ease=n}}function TC(t){if(typeof t!="function")throw new Error;return this.each(LU(this._id,t))}function EC(t){typeof t!="function"&&(t=pp(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 kn(r,this._parents,this._name,this._id)}function IC(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],u=c.length,p=s[a]=new Array(u),l,d=0;d<u;++d)(l=c[d]||f[d])&&(p[d]=l);for(;a<r;++a)s[a]=e[a];return new kn(s,this._parents,this._name,this._id)}function RU(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 OU(t,e,n){var r,o,i=RU(e)?Np:an;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function NC(t,e){var n=this._id;return arguments.length<2?Re(this.node(),n).on.on(t):this.each(OU(n,t,e))}function $U(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function CC(){return this.on("end.remove",$U(this._id))}function kC(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ca(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),u,p,l=0;l<c;++l)(u=a[l])&&(p=t.call(u,u.__data__,l,a))&&("__data__"in u&&(p.__data__=u.__data__),f[l]=p,ds(f[l],e,n,l,f,Re(u,n)));return new kn(i,this._parents,e,n)}function LC(t){var e=this._name,n=this._id;typeof t!="function"&&(t=lp(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],f=c.length,u,p=0;p<f;++p)if(u=c[p]){for(var l=t.call(u,u.__data__,p,c),d,h=Re(u,n),m=0,x=l.length;m<x;++m)(d=l[m])&&ds(d,e,n,m,l,h);i.push(l),s.push(u)}return new kn(i,s,e,n)}var DU=mi.prototype.constructor;function RC(){return new DU(this._groups,this._parents)}function PU(t,e){var n,r,o;return function(){var i=us(this,t),s=(this.style.removeProperty(t),us(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function OC(t){return function(){this.style.removeProperty(t)}}function FU(t,e,n){var r,o=n+"",i;return function(){var s=us(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function qU(t,e,n){var r,o,i;return function(){var s=us(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),us(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function BU(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=an(this,t),f=c.on,u=c.value[i]==null?a||(a=OC(e)):void 0;(f!==n||o!==u)&&(r=(n=f).copy()).on(s,o=u),c.on=r}}function $C(t,e,n){var r=(t+="")=="transform"?L_:Zx;return e==null?this.styleTween(t,PU(t,r)).on("end.style."+t,OC(t)):typeof e=="function"?this.styleTween(t,qU(t,r,bf(this,"style."+t,e))).each(BU(this._id,t)):this.styleTween(t,FU(t,r,e),n).on("end.style."+t,null)}function zU(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function YU(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&zU(t,s,n)),r}return i._value=e,i}function DC(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,YU(t,e,n??""))}function UU(t){return function(){this.textContent=t}}function jU(t){return function(){var e=t(this);this.textContent=e??""}}function PC(t){return this.tween("text",typeof t=="function"?jU(bf(this,"text",t)):UU(t==null?"":t+""))}function XU(t){return function(e){this.textContent=t.call(this,e)}}function WU(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&XU(o)),e}return r._value=t,r}function FC(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,WU(t))}function qC(){for(var t=this._name,e=this._id,n=Jx(),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 u=Re(c,e);ds(c,t,n,f,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new kn(r,this._parents,t,n)}function BC(){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=an(this,r),u=f.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),f.on=e}),o===0&&i()})}var VU=0;function kn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function zC(t){return mi().transition(t)}function Jx(){return++VU}var yi=mi.prototype;kn.prototype=zC.prototype={constructor:kn,select:kC,selectAll:LC,selectChild:yi.selectChild,selectChildren:yi.selectChildren,filter:EC,merge:IC,selection:RC,transition:qC,call:yi.call,nodes:yi.nodes,node:yi.node,size:yi.size,empty:yi.empty,each:yi.each,on:NC,attr:vC,attrTween:_C,style:$C,styleTween:DC,text:PC,textTween:FC,remove:CC,tween:wC,delay:SC,duration:MC,ease:AC,easeVarying:TC,end:BC,[Symbol.iterator]:yi[Symbol.iterator]};function Kx(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var GU={time:null,delay:0,duration:250,ease:Kx};function HU(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 YC(t){var e,n;t instanceof kn?(e=t._id,t=t._name):(e=Jx(),(n=GU).time=Ep(),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])&&ds(c,t,e,f,s,n||HU(c,e));return new kn(r,this._parents,t,e)}mi.prototype.interrupt=bC;mi.prototype.transition=YC;var tg=t=>()=>t;function F_(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 UC(t){t.stopImmediatePropagation()}function eg(t){t.preventDefault(),t.stopImmediatePropagation()}var jC={name:"drag"},q_={name:"space"},wf={name:"handle"},vf={name:"center"},{abs:XC,max:xn,min:gn}=Math;function WC(t){return[+t[0],+t[1]]}function z_(t){return[WC(t[0]),WC(t[1])]}var ng={name:"x",handles:["w","e"].map(Cp),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]]}},rg={name:"y",handles:["n","s"].map(Cp),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]]}},QU={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Cp),input:function(t){return t==null?null:z_(t)},output:function(t){return t}},bi={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"},VC={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},GC={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},ZU={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},JU={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Cp(t){return{type:t}}function KU(t){return!t.ctrlKey&&!t.button}function tj(){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 ej(){return navigator.maxTouchPoints||"ontouchstart"in this}function B_(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function nj(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Y_(){return X_(ng)}function U_(){return X_(rg)}function j_(){return X_(QU)}function X_(t){var e=tj,n=KU,r=ej,o=!0,i=Na("start","brush","end"),s=6,a;function c(x){var g=x.property("__brush",m).selectAll(".overlay").data([Cp("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",bi.overlay).merge(g).each(function(){var b=B_(this).extent;Nt(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])}),x.selectAll(".selection").data([Cp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",bi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var y=x.selectAll(".handle").data(t.handles,function(b){return b.type});y.exit().remove(),y.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return bi[b.type]}),x.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",l).filter(r).on("touchstart.brush",l).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(x,g,y){x.tween?x.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,A=t.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),T=rr(v,A);function E(N){w.selection=N===1&&A===null?null:T(N),f.call(b),_.brush()}return v!==null&&A!==null?E:E(1)}):x.each(function(){var b=this,w=arguments,_=b.__brush,v=t.input(typeof g=="function"?g.apply(b,w):g,_.extent),A=u(b,w).beforestart();yo(b),_.selection=v===null?null:v,f.call(b),A.start(y).brush(y).end(y)})},c.clear=function(x,g){c.move(x,null,g)};function f(){var x=Nt(this),g=B_(this).selection;g?(x.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]),x.selectAll(".handle").style("display",null).attr("x",function(y){return y.type[y.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(y){return y.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(y){return y.type==="n"||y.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(y){return y.type==="e"||y.type==="w"?g[1][1]-g[0][1]+s:s})):x.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(x,g,y){var b=x.__brush.emitter;return b&&(!y||!b.clean)?b:new p(x,g,y)}function p(x,g,y){this.that=x,this.args=g,this.state=x.__brush,this.active=0,this.clean=y}p.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(x,g){return this.starting?(this.starting=!1,this.emit("start",x,g)):this.emit("brush",x),this},brush:function(x,g){return this.emit("brush",x,g),this},end:function(x,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",x,g)),this},emit:function(x,g,y){var b=Nt(this.that).datum();i.call(x,this.that,new F_(x,{sourceEvent:g,target:c,selection:t.output(this.state.selection),mode:y,dispatch:i}),b)}};function l(x){if(a&&!x.touches||!n.apply(this,arguments))return;var g=this,y=x.target.__data__.type,b=(o&&x.metaKey?y="overlay":y)==="selection"?jC:o&&x.altKey?vf:wf,w=t===rg?null:ZU[y],_=t===ng?null:JU[y],v=B_(g),A=v.extent,T=v.selection,E=A[0][0],N,M,k=A[0][1],O,S,I=A[1][0],C,L,D=A[1][1],$,P,F=0,q=0,V,K=w&&_&&o&&x.shiftKey,et,rt,j=Array.from(x.touches||[x],Z=>{let jt=Z.identifier;return Z=hn(Z,g),Z.point0=Z.slice(),Z.identifier=jt,Z});yo(g);var nt=u(g,arguments,!0).beforestart();if(y==="overlay"){T&&(V=!0);let Z=[j[0],j[1]||j[0]];v.selection=T=[[N=t===rg?E:gn(Z[0][0],Z[1][0]),O=t===ng?k:gn(Z[0][1],Z[1][1])],[C=t===rg?I:xn(Z[0][0],Z[1][0]),$=t===ng?D:xn(Z[0][1],Z[1][1])]],j.length>1&&_t(x)}else N=T[0][0],O=T[0][1],C=T[1][0],$=T[1][1];M=N,S=O,L=C,P=$;var Y=Nt(g).attr("pointer-events","none"),G=Y.selectAll(".overlay").attr("cursor",bi[y]);if(x.touches)nt.moved=B,nt.ended=ct;else{var tt=Nt(x.view).on("mousemove.brush",B,!0).on("mouseup.brush",ct,!0);o&&tt.on("keydown.brush",Ct,!0).on("keyup.brush",Lt,!0),hp(x.view)}f.call(g),nt.start(x,b.name);function B(Z){for(let jt of Z.changedTouches||[Z])for(let Qn of j)Qn.identifier===jt.identifier&&(Qn.cur=hn(jt,g));if(K&&!et&&!rt&&j.length===1){let jt=j[0];XC(jt.cur[0]-jt[0])>XC(jt.cur[1]-jt[1])?rt=!0:et=!0}for(let jt of j)jt.cur&&(jt[0]=jt.cur[0],jt[1]=jt.cur[1]);V=!0,eg(Z),_t(Z)}function _t(Z){let jt=j[0],Qn=jt.point0;var ro;switch(F=jt[0]-Qn[0],q=jt[1]-Qn[1],b){case q_:case jC:{w&&(F=xn(E-N,gn(I-C,F)),M=N+F,L=C+F),_&&(q=xn(k-O,gn(D-$,q)),S=O+q,P=$+q);break}case wf:{j[1]?(w&&(M=xn(E,gn(I,j[0][0])),L=xn(E,gn(I,j[1][0])),w=1),_&&(S=xn(k,gn(D,j[0][1])),P=xn(k,gn(D,j[1][1])),_=1)):(w<0?(F=xn(E-N,gn(I-N,F)),M=N+F,L=C):w>0&&(F=xn(E-C,gn(I-C,F)),M=N,L=C+F),_<0?(q=xn(k-O,gn(D-O,q)),S=O+q,P=$):_>0&&(q=xn(k-$,gn(D-$,q)),S=O,P=$+q));break}case vf:{w&&(M=xn(E,gn(I,N-F*w)),L=xn(E,gn(I,C+F*w))),_&&(S=xn(k,gn(D,O-q*_)),P=xn(k,gn(D,$+q*_)));break}}L<M&&(w*=-1,ro=N,N=C,C=ro,ro=M,M=L,L=ro,y in VC&&G.attr("cursor",bi[y=VC[y]])),P<S&&(_*=-1,ro=O,O=$,$=ro,ro=S,S=P,P=ro,y in GC&&G.attr("cursor",bi[y=GC[y]])),v.selection&&(T=v.selection),et&&(M=T[0][0],L=T[1][0]),rt&&(S=T[0][1],P=T[1][1]),(T[0][0]!==M||T[0][1]!==S||T[1][0]!==L||T[1][1]!==P)&&(v.selection=[[M,S],[L,P]],f.call(g),nt.brush(Z,b.name))}function ct(Z){if(UC(Z),Z.touches){if(Z.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else mp(Z.view,V),tt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Y.attr("pointer-events","all"),G.attr("cursor",bi.overlay),v.selection&&(T=v.selection),nj(T)&&(v.selection=null,f.call(g)),nt.end(Z,b.name)}function Ct(Z){switch(Z.keyCode){case 16:{K=w&&_;break}case 18:{b===wf&&(w&&(C=L-F*w,N=M+F*w),_&&($=P-q*_,O=S+q*_),b=vf,_t(Z));break}case 32:{(b===wf||b===vf)&&(w<0?C=L-F:w>0&&(N=M-F),_<0?$=P-q:_>0&&(O=S-q),b=q_,G.attr("cursor",bi.selection),_t(Z));break}default:return}eg(Z)}function Lt(Z){switch(Z.keyCode){case 16:{K&&(et=rt=K=!1,_t(Z));break}case 18:{b===vf&&(w<0?C=L:w>0&&(N=M),_<0?$=P:_>0&&(O=S),b=wf,_t(Z));break}case 32:{b===q_&&(Z.altKey?(w&&(C=L-F*w,N=M+F*w),_&&($=P-q*_,O=S+q*_),b=vf):(w<0?C=L:w>0&&(N=M),_<0?$=P:_>0&&(O=S),b=wf),G.attr("cursor",bi[y]),_t(Z));break}default:return}eg(Z)}}function d(x){u(this,arguments).moved(x)}function h(x){u(this,arguments).ended(x)}function m(){var x=this.__brush||{selection:null};return x.extent=z_(e.apply(this,arguments)),x.dim=t,x}return c.extent=function(x){return arguments.length?(e=typeof x=="function"?x:tg(z_(x)),c):e},c.filter=function(x){return arguments.length?(n=typeof x=="function"?x:tg(!!x),c):n},c.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:tg(!!x),c):r},c.handleSize=function(x){return arguments.length?(s=+x,c):s},c.keyModifiers=function(x){return arguments.length?(o=!!x,c):o},c.on=function(){var x=i.on.apply(i,arguments);return x===i?c:x},c}var W_=Math.PI,V_=2*W_,Pa=1e-6,rj=V_-Pa;function HC(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function oj(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return HC;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 hs=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?HC:oj(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,u=s-e,p=a-n,l=u*u+p*p;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(l>Pa)if(!(Math.abs(p*c-f*u)>Pa)||!i)this._append`L${this._x1=e},${this._y1=n}`;else{let d=r-s,h=o-a,m=c*c+f*f,x=d*d+h*h,g=Math.sqrt(m),y=Math.sqrt(l),b=i*Math.tan((W_-Math.acos((m+l-x)/(2*g*y)))/2),w=b/y,_=b/g;Math.abs(w-1)>Pa&&this._append`L${e+w*u},${n+w*p}`,this._append`A${i},${i},0,0,${+(p*d>u*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,u=n+c,p=1^s,l=s?o-i:i-o;this._x1===null?this._append`M${f},${u}`:(Math.abs(this._x1-f)>Pa||Math.abs(this._y1-u)>Pa)&&this._append`L${f},${u}`,r&&(l<0&&(l=l%V_+V_),l>rj?this._append`A${r},${r},0,1,${p},${e-a},${n-c}A${r},${r},0,1,${p},${this._x1=f},${this._y1=u}`:l>Pa&&this._append`A${r},${r},0,${+(l>=W_)},${p},${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 QC(){return new hs}QC.prototype=hs.prototype;function Ln(t=3){return new hs(+t)}var ij=Array.prototype,og=ij.slice;function ZC(t,e){return t-e}function JC(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 bo=t=>()=>t;function KC(t,e){for(var n=-1,r=e.length,o;++n<r;)if(o=sj(t,e[n]))return o;return 0}function sj(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],u=c[1],p=t[a],l=p[0],d=p[1];if(aj(c,p,e))return 0;u>r!=d>r&&n<(l-f)*(r-u)/(d-u)+f&&(o=-o)}return o}function aj(t,e,n){var r;return cj(t,e,n)&&fj(t[r=+(t[0]===e[0])],n[r],e[r])}function cj(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}function fj(t,e,n){return t<=e&&e<=n||n<=e&&e<=t}function t9(){}var wi=[[],[[[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 ms(){var t=1,e=1,n=cs,r=c;function o(f){var u=n(f);if(Array.isArray(u))u=u.slice().sort(ZC);else{let p=Ft(f,uj);for(u=on(...ff(p[0],p[1],u),u);u[u.length-1]>=p[1];)u.pop();for(;u[1]<p[0];)u.shift()}return u.map(p=>i(f,p))}function i(f,u){let p=u==null?NaN:+u;if(isNaN(p))throw new Error(`invalid value: ${u}`);var l=[],d=[];return s(f,p,function(h){r(h,f,p),JC(h)>0?l.push([h]):d.push(h)}),d.forEach(function(h){for(var m=0,x=l.length,g;m<x;++m)if(KC((g=l[m])[0],h)!==-1){g.push(h);return}}),{type:"MultiPolygon",value:u,coordinates:l}}function s(f,u,p){var l=new Array,d=new Array,h,m,x,g,y,b;for(h=m=-1,g=Fa(f[0],u),wi[g<<1].forEach(w);++h<t-1;)x=g,g=Fa(f[h+1],u),wi[x|g<<1].forEach(w);for(wi[g<<0].forEach(w);++m<e-1;){for(h=-1,g=Fa(f[m*t+t],u),y=Fa(f[m*t],u),wi[g<<1|y<<2].forEach(w);++h<t-1;)x=g,g=Fa(f[m*t+t+h+1],u),b=y,y=Fa(f[m*t+h+1],u),wi[x|g<<1|y<<2|b<<3].forEach(w);wi[g|y<<3].forEach(w)}for(h=-1,y=f[m*t]>=u,wi[y<<2].forEach(w);++h<t-1;)b=y,y=Fa(f[m*t+h+1],u),wi[y<<2|b<<3].forEach(w);wi[y<<3].forEach(w);function w(_){var v=[_[0][0]+h,_[0][1]+m],A=[_[1][0]+h,_[1][1]+m],T=a(v),E=a(A),N,M;(N=d[T])?(M=l[E])?(delete d[N.end],delete l[M.start],N===M?(N.ring.push(A),p(N.ring)):l[N.start]=d[M.end]={start:N.start,end:M.end,ring:N.ring.concat(M.ring)}):(delete d[N.end],N.ring.push(A),d[N.end=E]=N):(N=l[E])?(M=d[T])?(delete l[N.start],delete d[M.end],N===M?(N.ring.push(A),p(N.ring)):l[M.start]=d[N.end]={start:M.start,end:N.end,ring:M.ring.concat(N.ring)}):(delete l[N.start],N.ring.unshift(v),l[N.start=T]=N):l[T]=d[E]={start:T,end:E,ring:[v,A]}}}function a(f){return f[0]*2+f[1]*(t+1)*4}function c(f,u,p){f.forEach(function(l){var d=l[0],h=l[1],m=d|0,x=h|0,g=G_(u[x*t+m]);d>0&&d<t&&m===d&&(l[0]=e9(d,G_(u[x*t+m-1]),g,p)),h>0&&h<e&&x===h&&(l[1]=e9(h,G_(u[(x-1)*t+m]),g,p))})}return o.contour=i,o.size=function(f){if(!arguments.length)return[t,e];var u=Math.floor(f[0]),p=Math.floor(f[1]);if(!(u>=0&&p>=0))throw new Error("invalid size");return t=u,e=p,o},o.thresholds=function(f){return arguments.length?(n=typeof f=="function"?f:Array.isArray(f)?bo(og.call(f)):bo(f),o):n},o.smooth=function(f){return arguments.length?(r=f?c:t9,o):r===c},o}function uj(t){return isFinite(t)?t:NaN}function Fa(t,e){return t==null?!1:+t>=e}function G_(t){return t==null||isNaN(t=+t)?-1/0:t}function e9(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 lj(t){return t[0]}function pj(t){return t[1]}function dj(){return 1}function H_(){var t=lj,e=pj,n=dj,r=960,o=500,i=20,s=2,a=i*3,c=r+a*2>>s,f=o+a*2>>s,u=bo(20);function p(y){var b=new Float32Array(c*f),w=Math.pow(2,-s),_=-1;for(let O of y){var v=(t(O,++_,y)+a)*w,A=(e(O,_,y)+a)*w,T=+n(O,_,y);if(T&&v>=0&&v<c&&A>=0&&A<f){var E=Math.floor(v),N=Math.floor(A),M=v-E-.5,k=A-N-.5;b[E+N*c]+=(1-M)*(1-k)*T,b[E+1+N*c]+=M*(1-k)*T,b[E+1+(N+1)*c]+=M*k*T,b[E+(N+1)*c]+=(1-M)*k*T}}return ip({data:b,width:c,height:f},i*w),b}function l(y){var b=p(y),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=on(Number.MIN_VALUE,kt(b)/_,w)),ms().size([c,f]).thresholds(w.map(v=>v*_))(b).map((v,A)=>(v.value=+w[A],d(v)))}l.contours=function(y){var b=p(y),w=ms().size([c,f]),_=Math.pow(2,2*s),v=A=>{A=+A;var T=d(w.contour(b,A*_));return T.value=A,T};return Object.defineProperty(v,"max",{get:()=>kt(b)/_}),v};function d(y){return y.coordinates.forEach(h),y}function h(y){y.forEach(m)}function m(y){y.forEach(x)}function x(y){y[0]=y[0]*Math.pow(2,s)-a,y[1]=y[1]*Math.pow(2,s)-a}function g(){return a=i*3,c=r+a*2>>s,f=o+a*2>>s,l}return l.x=function(y){return arguments.length?(t=typeof y=="function"?y:bo(+y),l):t},l.y=function(y){return arguments.length?(e=typeof y=="function"?y:bo(+y),l):e},l.weight=function(y){return arguments.length?(n=typeof y=="function"?y:bo(+y),l):n},l.size=function(y){if(!arguments.length)return[r,o];var b=+y[0],w=+y[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,o=w,g()},l.cellSize=function(y){if(!arguments.length)return 1<<s;if(!((y=+y)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(y)/Math.LN2),g()},l.thresholds=function(y){return arguments.length?(u=typeof y=="function"?y:Array.isArray(y)?bo(og.call(y)):bo(y),l):u},l.bandwidth=function(y){if(!arguments.length)return Math.sqrt(i*(i+1));if(!((y=+y)>=0))throw new Error("invalid bandwidth");return i=(Math.sqrt(4*y*y+1)-1)/2,g()},l}var $t=11102230246251565e-32,Me=134217729,kp=(3+8*$t)*$t;function qa(t,e,n,r,o){let i,s,a,c,f=e[0],u=r[0],p=0,l=0;u>f==u>-f?(i=f,f=e[++p]):(i=u,u=r[++l]);let d=0;if(p<t&&l<n)for(u>f==u>-f?(s=f+i,a=i-(s-f),f=e[++p]):(s=u+i,a=i-(s-u),u=r[++l]),i=s,a!==0&&(o[d++]=a);p<t&&l<n;)u>f==u>-f?(s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++p]):(s=i+u,c=s-i,a=i-(s-c)+(u-c),u=r[++l]),i=s,a!==0&&(o[d++]=a);for(;p<t;)s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++p],i=s,a!==0&&(o[d++]=a);for(;l<n;)s=i+u,c=s-i,a=i-(s-c)+(u-c),u=r[++l],i=s,a!==0&&(o[d++]=a);return(i!==0||d===0)&&(o[d++]=i),d}function Lp(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function U(t){return new Float64Array(t)}var hj=(3+16*$t)*$t,mj=(2+12*$t)*$t,xj=(9+64*$t)*$t*$t,_f=U(4),n9=U(8),r9=U(12),o9=U(16),Rn=U(4);function gj(t,e,n,r,o,i,s){let a,c,f,u,p,l,d,h,m,x,g,y,b,w,_,v,A,T,E=t-o,N=n-o,M=e-i,k=r-i;w=E*k,l=Me*E,d=l-(l-E),h=E-d,l=Me*k,m=l-(l-k),x=k-m,_=h*x-(w-d*m-h*m-d*x),v=M*N,l=Me*M,d=l-(l-M),h=M-d,l=Me*N,m=l-(l-N),x=N-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,_f[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,_f[1]=b-(g+p)+(p-v),T=y+g,p=T-y,_f[2]=y-(T-p)+(g-p),_f[3]=T;let O=Lp(4,_f),S=mj*s;if(O>=S||-O>=S||(p=t-E,a=t-(E+p)+(p-o),p=n-N,f=n-(N+p)+(p-o),p=e-M,c=e-(M+p)+(p-i),p=r-k,u=r-(k+p)+(p-i),a===0&&c===0&&f===0&&u===0)||(S=xj*s+kp*Math.abs(O),O+=E*u+k*a-(M*f+N*c),O>=S||-O>=S))return O;w=a*k,l=Me*a,d=l-(l-a),h=a-d,l=Me*k,m=l-(l-k),x=k-m,_=h*x-(w-d*m-h*m-d*x),v=c*N,l=Me*c,d=l-(l-c),h=c-d,l=Me*N,m=l-(l-N),x=N-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,Rn[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,Rn[1]=b-(g+p)+(p-v),T=y+g,p=T-y,Rn[2]=y-(T-p)+(g-p),Rn[3]=T;let I=qa(4,_f,4,Rn,n9);w=E*u,l=Me*E,d=l-(l-E),h=E-d,l=Me*u,m=l-(l-u),x=u-m,_=h*x-(w-d*m-h*m-d*x),v=M*f,l=Me*M,d=l-(l-M),h=M-d,l=Me*f,m=l-(l-f),x=f-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,Rn[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,Rn[1]=b-(g+p)+(p-v),T=y+g,p=T-y,Rn[2]=y-(T-p)+(g-p),Rn[3]=T;let C=qa(I,n9,4,Rn,r9);w=a*u,l=Me*a,d=l-(l-a),h=a-d,l=Me*u,m=l-(l-u),x=u-m,_=h*x-(w-d*m-h*m-d*x),v=c*f,l=Me*c,d=l-(l-c),h=c-d,l=Me*f,m=l-(l-f),x=f-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,Rn[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,Rn[1]=b-(g+p)+(p-v),T=y+g,p=T-y,Rn[2]=y-(T-p)+(g-p),Rn[3]=T;let L=qa(C,r9,4,Rn,o9);return o9[L-1]}function Sf(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)>=hj*f?c:-gj(t,e,n,r,o,i,f)}var d2t=(7+56*$t)*$t,h2t=(3+28*$t)*$t,m2t=(26+288*$t)*$t*$t,x2t=U(4),g2t=U(4),y2t=U(4),b2t=U(4),w2t=U(4),v2t=U(4),_2t=U(4),S2t=U(4),M2t=U(4),A2t=U(8),T2t=U(8),E2t=U(8),I2t=U(4),N2t=U(8),C2t=U(8),k2t=U(8),L2t=U(12),R2t=U(192),O2t=U(192);var P2t=(10+96*$t)*$t,F2t=(4+48*$t)*$t,q2t=(44+576*$t)*$t*$t,B2t=U(4),z2t=U(4),Y2t=U(4),U2t=U(4),j2t=U(4),X2t=U(4),W2t=U(4),V2t=U(4),G2t=U(8),H2t=U(8),Q2t=U(8),Z2t=U(8),J2t=U(8),K2t=U(8),twt=U(8),ewt=U(8),nwt=U(8),rwt=U(4),owt=U(4),iwt=U(4),swt=U(8),awt=U(16),cwt=U(16),fwt=U(16),uwt=U(32),lwt=U(32),pwt=U(48),dwt=U(64),hwt=U(1152),mwt=U(1152);var bwt=(16+224*$t)*$t,wwt=(5+72*$t)*$t,vwt=(71+1408*$t)*$t*$t,_wt=U(4),Swt=U(4),Mwt=U(4),Awt=U(4),Twt=U(4),Ewt=U(4),Iwt=U(4),Nwt=U(4),Cwt=U(4),kwt=U(4),Lwt=U(24),Rwt=U(24),Owt=U(24),$wt=U(24),Dwt=U(24),Pwt=U(24),Fwt=U(24),qwt=U(24),Bwt=U(24),zwt=U(24),Ywt=U(1152),Uwt=U(1152),jwt=U(1152),Xwt=U(1152),Wwt=U(1152),Vwt=U(2304),Gwt=U(2304),Hwt=U(3456),Qwt=U(5760),Zwt=U(8),Jwt=U(8),Kwt=U(8),tvt=U(16),evt=U(24),nvt=U(48),rvt=U(48),ovt=U(96),ivt=U(192),svt=U(384),avt=U(384),cvt=U(384),fvt=U(768);var uvt=U(96),lvt=U(96),pvt=U(96),dvt=U(1152);var s9=Math.pow(2,-52),ig=new Uint32Array(512),Af=class t{static from(e,n=Sj,r=Mj){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,u=-1/0;for(let E=0;E<s;E++){let N=e[2*E],M=e[2*E+1];N<a&&(a=N),M<c&&(c=M),N>f&&(f=N),M>u&&(u=M),this._ids[E]=E}let p=(a+f)/2,l=(c+u)/2,d,h,m;for(let E=0,N=1/0;E<s;E++){let M=Q_(p,l,e[2*E],e[2*E+1]);M<N&&(d=E,N=M)}let x=e[2*d],g=e[2*d+1];for(let E=0,N=1/0;E<s;E++){if(E===d)continue;let M=Q_(x,g,e[2*E],e[2*E+1]);M<N&&M>0&&(h=E,N=M)}let y=e[2*h],b=e[2*h+1],w=1/0;for(let E=0;E<s;E++){if(E===d||E===h)continue;let N=vj(x,g,y,b,e[2*E],e[2*E+1]);N<w&&(m=E,w=N)}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];Mf(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),N=0;for(let M=0,k=-1/0;M<s;M++){let O=this._ids[M],S=this._dists[O];S>k&&(E[N++]=O,k=S)}this.hull=E.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Sf(x,g,y,b,_,v)<0){let E=h,N=y,M=b;h=m,y=_,b=v,m=E,_=N,v=M}let A=_j(x,g,y,b,_,v);this._cx=A.x,this._cy=A.y;for(let E=0;E<s;E++)this._dists[E]=Q_(e[2*E],e[2*E+1],A.x,A.y);Mf(this._ids,this._dists,0,s-1),this._hullStart=d;let T=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(x,g)]=d,i[this._hashKey(y,b)]=h,i[this._hashKey(_,v)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let E=0,N,M;E<this._ids.length;E++){let k=this._ids[E],O=e[2*k],S=e[2*k+1];if(E>0&&Math.abs(O-N)<=s9&&Math.abs(S-M)<=s9||(N=O,M=S,k===d||k===h||k===m))continue;let I=0;for(let P=0,F=this._hashKey(O,S);P<this._hashSize&&(I=i[(F+P)%this._hashSize],!(I!==-1&&I!==r[I]));P++);I=n[I];let C=I,L;for(;L=r[C],Sf(O,S,e[2*C],e[2*C+1],e[2*L],e[2*L+1])>=0;)if(C=L,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,T++;let $=r[C];for(;L=r[$],Sf(O,S,e[2*$],e[2*$+1],e[2*L],e[2*L+1])<0;)D=this._addTriangle($,k,L,o[k],-1,o[$]),o[k]=this._legalize(D+2),r[$]=$,T--,$=L;if(C===I)for(;L=n[C],Sf(O,S,e[2*L],e[2*L+1],e[2*C],e[2*C+1])<0;)D=this._addTriangle(L,k,C,-1,o[C],o[L]),this._legalize(D+2),o[L]=D,r[C]=C,T--,C=L;this._hullStart=n[k]=C,r[C]=n[$]=k,r[k]=$,i[this._hashKey(O,S)]=k,i[this._hashKey(e[2*C],e[2*C+1])]=C}this.hull=new Uint32Array(T);for(let E=0,N=this._hullStart;E<T;E++)this.hull[E]=N,N=r[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,n){return Math.floor(bj(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=ig[--i];continue}let f=a-a%3,u=c+(e+1)%3,p=f+(a+2)%3,l=n[s],d=n[e],h=n[u],m=n[p];if(wj(o[2*l],o[2*l+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]=l;let g=r[p];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===p){this._hullTri[b]=e;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(e,g),this._link(a,r[s]),this._link(s,p);let y=f+(a+1)%3;i<ig.length&&(ig[i++]=y)}else{if(i===0)break;e=ig[--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 bj(t,e){let n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}function Q_(t,e,n,r){let o=t-n,i=e-r;return o*o+i*i}function wj(t,e,n,r,o,i,s,a){let c=t-s,f=e-a,u=n-s,p=r-a,l=o-s,d=i-a,h=c*c+f*f,m=u*u+p*p,x=l*l+d*d;return c*(p*x-m*d)-f*(u*x-m*l)+h*(u*d-p*l)<0}function vj(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,u=s*s+a*a,p=c*c+f*f,l=.5/(s*f-a*c),d=(f*u-a*p)*l,h=(s*p-c*u)*l;return d*d+h*h}function _j(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,u=s*s+a*a,p=c*c+f*f,l=.5/(s*f-a*c),d=t+(f*u-a*p)*l,h=e+(s*p-c*u)*l;return{x:d,y:h}}function Mf(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;Rp(t,o,i),e[t[n]]>e[t[r]]&&Rp(t,n,r),e[t[i]]>e[t[r]]&&Rp(t,i,r),e[t[n]]>e[t[i]]&&Rp(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;Rp(t,i,s)}t[n+1]=t[s],t[s]=a,r-i+1>=s-n?(Mf(t,e,i,r),Mf(t,e,n,s-1)):(Mf(t,e,n,s-1),Mf(t,e,i,r))}}function Rp(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Sj(t){return t[0]}function Mj(t){return t[1]}var Tr=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 xs=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 Op=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,x=0,g=r.length,y,b;m<g;m+=3,x+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,A=e[w],T=e[w+1],E=e[_],N=e[_+1],M=e[v],k=e[v+1],O=E-A,S=N-T,I=M-A,C=k-T,L=(O*C-S*I)*2;if(Math.abs(L)<1e-9){if(i===void 0){i=s=0;for(let $ of n)i+=e[$*2],s+=e[$*2+1];i/=n.length,s/=n.length}let D=1e9*Math.sign((i-A)*C-(s-T)*I);y=(A+M)/2-D*C,b=(T+k)/2+D*I}else{let D=1/L,$=O*O+S*S,P=I*I+C*C;y=A+(C*$-S*P)*D,b=T+(O*P-I*$)*D}a[x]=y,a[x+1]=b}let c=n[n.length-1],f,u=c*4,p,l=e[2*c],d,h=e[2*c+1];o.fill(0);for(let m=0;m<n.length;++m)c=n[m],f=u,p=l,d=h,u=c*4,l=e[2*c],h=e[2*c+1],o[f+2]=o[u]=d-h,o[f+3]=o[u+1]=l-p}render(e){let n=e==null?e=new Tr:void 0,{delaunay:{halfedges:r,inedges:o,hull:i},circumcenters:s,vectors:a}=this;if(i.length<=1)return null;for(let u=0,p=r.length;u<p;++u){let l=r[u];if(l<u)continue;let d=Math.floor(u/3)*2,h=Math.floor(l/3)*2,m=s[d],x=s[d+1],g=s[h],y=s[h+1];this._renderSegment(m,x,g,y,e)}let c,f=i[i.length-1];for(let u=0;u<i.length;++u){c=f,f=i[u];let p=Math.floor(o[f]/3)*2,l=s[p],d=s[p+1],h=c*4,m=this._project(l,d,a[h+2],a[h+3]);m&&this._renderSegment(l,d,m[0],m[1],e)}return n&&n.value()}renderBounds(e){let n=e==null?e=new Tr: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 Tr: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 xs;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,u=this._regioncode(a,c),p,l=0;for(let d=0;d<r;d+=2)if(i=a,s=c,a=n[d],c=n[d+1],f=u,u=this._regioncode(a,c),f===0&&u===0)p=l,l=0,o?o.push(a,c):o=[a,c];else{let h,m,x,g,y;if(f===0){if((h=this._clipSegment(i,s,a,c,f,u))===null)continue;[m,x,g,y]=h}else{if((h=this._clipSegment(a,c,i,s,u,f))===null)continue;[g,y,m,x]=h,p=l,l=this._edgecode(m,x),p&&l&&this._edge(e,p,l,o,o.length),o?o.push(m,x):o=[m,x]}p=l,l=this._edgecode(g,y),p&&l&&this._edge(e,p,l,o,o.length),o?o.push(g,y):o=[g,y]}if(o)p=l,l=this._edgecode(o[0],o[1]),p&&l&&this._edge(e,p,l,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,u=i||s;u&8?(c=e+(r-e)*(this.ymax-n)/(o-n),f=this.ymax):u&4?(c=e+(r-e)*(this.ymin-n)/(o-n),f=this.ymin):u&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,u=a.length,p,l=this._edgecode(a[u-2],a[u-1]);f<u;f+=2)p=l,l=this._edgecode(a[f],a[f+1]),p&&l&&(f=this._edge(e,p,l,a,f),u=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 Aj=2*Math.PI,Tf=Math.pow;function Tj(t){return t[0]}function Ej(t){return t[1]}function Ij(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 Nj(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}var Er=class t{static from(e,n=Tj,r=Ej,o){return new t("length"in e?Cj(e,n,r,o):Float64Array.from(kj(e,n,r,o)))}constructor(e){this._delaunator=new Af(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&&Ij(e)){this.collinear=Int32Array.from({length:n.length/2},(l,d)=>d).sort((l,d)=>n[2*l]-n[2*d]||n[2*l+1]-n[2*d+1]);let c=this.collinear[0],f=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],p=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let l=0,d=n.length/2;l<d;++l){let h=Nj(n[2*l],n[2*l+1],p);n[2*l]=h[0],n[2*l+1]=h[1]}this._delaunator=new Af(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 u=i[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=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 Op(this,e)}*neighbors(e){let{inedges:n,hull:r,_hullIndex:o,halfedges:i,triangles:s,collinear:a}=this;if(a){let p=a.indexOf(e);p>0&&(yield a[p-1]),p<a.length-1&&(yield a[p+1]);return}let c=n[e];if(c===-1)return;let f=c,u=-1;do{if(yield u=s[f],f=f%3===2?f-2:f+1,s[f]!==e)return;if(f=i[f],f===-1){let p=r[(o[e]+1)%r.length];p!==u&&(yield p);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 u=e,p=Tf(n-f[e*2],2)+Tf(r-f[e*2+1],2),l=o[e],d=l;do{let h=c[d],m=Tf(n-f[h*2],2)+Tf(r-f[h*2+1],2);if(m<p&&(p=m,u=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&&Tf(n-f[d*2],2)+Tf(r-f[d*2+1],2)<p)return d;break}}while(d!==l);return u}render(e){let n=e==null?e=new Tr: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,u=i[c]*2;e.moveTo(r[f],r[f+1]),e.lineTo(r[u],r[u+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 Tr: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,Aj)}return r&&r.value()}renderHull(e){let n=e==null?e=new Tr: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 xs;return this.renderHull(e),e.value()}renderTriangle(e,n){let r=n==null?n=new Tr: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 xs;return this.renderTriangle(e,n),n.value()}};function Cj(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*kj(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 a9(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ba(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 wo(t){return t=Ba(Math.abs(t)),t?t[1]:NaN}function c9(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 f9(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Lj=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vo(t){if(!(e=Lj.exec(t)))throw new Error("invalid format: "+t);var e;return new sg({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]})}vo.prototype=sg.prototype;function sg(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+""}sg.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 u9(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 Z_;function l9(t,e){var n=Ba(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Z_=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")+Ba(t,Math.max(0,e+i-1))[0]}function J_(t,e){var n=Ba(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 K_={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:a9,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)=>J_(t*100,e),r:J_,s:l9,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function t6(t){return t}var p9=Array.prototype.map,d9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function h9(t){var e=t.grouping===void 0||t.thousands===void 0?t6:c9(p9.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?t6:f9(p9.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(p){p=vo(p);var l=p.fill,d=p.align,h=p.sign,m=p.symbol,x=p.zero,g=p.width,y=p.comma,b=p.precision,w=p.trim,_=p.type;_==="n"?(y=!0,_="g"):K_[_]||(b===void 0&&(b=12),w=!0,_="g"),(x||l==="0"&&d==="=")&&(x=!0,l="0",d="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",A=m==="$"?r:/[%p]/.test(_)?s:"",T=K_[_],E=/[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(M){var k=v,O=A,S,I,C;if(_==="c")O=T(M)+O,M="";else{M=+M;var L=M<0||1/M<0;if(M=isNaN(M)?c:T(Math.abs(M),b),w&&(M=u9(M)),L&&+M==0&&h!=="+"&&(L=!1),k=(L?h==="("?h:a:h==="-"||h==="("?"":h)+k,O=(_==="s"?d9[8+Z_/3]:"")+O+(L&&h==="("?")":""),E){for(S=-1,I=M.length;++S<I;)if(C=M.charCodeAt(S),48>C||C>57){O=(C===46?o+M.slice(S+1):M.slice(S))+O,M=M.slice(0,S);break}}}y&&!x&&(M=e(M,1/0));var D=k.length+M.length+O.length,$=D<g?new Array(g-D+1).join(l):"";switch(y&&x&&(M=e($+M,$.length?g-O.length:1/0),$=""),d){case"<":M=k+M+O+$;break;case"=":M=k+$+M+O;break;case"^":M=$.slice(0,D=$.length>>1)+k+M+O+$.slice(D);break;default:M=$+k+M+O;break}return i(M)}return N.toString=function(){return p+""},N}function u(p,l){var d=f((p=vo(p),p.type="f",p)),h=Math.max(-8,Math.min(8,Math.floor(wo(l)/3)))*3,m=Math.pow(10,-h),x=d9[8+h/3];return function(g){return d(m*g)+x}}return{format:f,formatPrefix:u}}var ag,Ir,cg;e6({thousands:",",grouping:[3],currency:["$",""]});function e6(t){return ag=h9(t),Ir=ag.format,cg=ag.formatPrefix,ag}function n6(t){return Math.max(0,-wo(Math.abs(t)))}function r6(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wo(e)/3)))*3-wo(Math.abs(t)))}function o6(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,wo(e)-wo(t))+1}var J=1e-6,za=1e-12,bt=Math.PI,Ht=bt/2,i6=bt/4,Ye=bt*2,he=180/bt,At=bt/180,St=Math.abs,Nr=Math.atan,Ae=Math.atan2,Q=Math.cos,$p=Math.ceil,fg=Math.exp;var ug=Math.hypot,Ya=Math.log,lg=Math.pow,H=Math.sin,yn=Math.sign||function(t){return t>0?1:t<0?-1:0},Qt=Math.sqrt,Ef=Math.tan;function pg(t){return t>1?0:t<-1?bt:Math.acos(t)}function ne(t){return t>1?Ht:t<-1?-Ht:Math.asin(t)}function Te(){}function dg(t,e){t&&x9.hasOwnProperty(t.type)&&x9[t.type](t,e)}var m9={Feature:function(t,e){dg(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)dg(n[r].geometry,e)}},x9={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){s6(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)s6(n[r],e,0)},Polygon:function(t,e){g9(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)g9(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)dg(n[r],e)}};function s6(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 g9(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)s6(t[n],e,1);e.polygonEnd()}function or(t,e){t&&m9.hasOwnProperty(t.type)?m9[t.type](t,e):dg(t,e)}function Dp(t){return[Ae(t[1],t[0]),ne(t[2])]}function _o(t){var e=t[0],n=t[1],r=Q(n);return[r*Q(e),r*H(e),H(n)]}function Pp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function If(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 hg(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Fp(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qp(t){var e=Qt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Bp,mg,xg,gg,yg,bg,wg,vg,a6,c6,f6,w9,v9,On,$n,Dn,Hr={sphere:Te,point:u6,lineStart:y9,lineEnd:b9,polygonStart:function(){Hr.lineStart=$j,Hr.lineEnd=Dj},polygonEnd:function(){Hr.lineStart=y9,Hr.lineEnd=b9}};function u6(t,e){t*=At,e*=At;var n=Q(e);zp(n*Q(t),n*H(t),H(e))}function zp(t,e,n){++Bp,xg+=(t-xg)/Bp,gg+=(e-gg)/Bp,yg+=(n-yg)/Bp}function y9(){Hr.point=Rj}function Rj(t,e){t*=At,e*=At;var n=Q(e);On=n*Q(t),$n=n*H(t),Dn=H(e),Hr.point=Oj,zp(On,$n,Dn)}function Oj(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*H(t),i=H(e),s=Ae(Qt((s=$n*i-Dn*o)*s+(s=Dn*r-On*i)*s+(s=On*o-$n*r)*s),On*r+$n*o+Dn*i);mg+=s,bg+=s*(On+(On=r)),wg+=s*($n+($n=o)),vg+=s*(Dn+(Dn=i)),zp(On,$n,Dn)}function b9(){Hr.point=u6}function $j(){Hr.point=Pj}function Dj(){_9(w9,v9),Hr.point=u6}function Pj(t,e){w9=t,v9=e,t*=At,e*=At,Hr.point=_9;var n=Q(e);On=n*Q(t),$n=n*H(t),Dn=H(e),zp(On,$n,Dn)}function _9(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*H(t),i=H(e),s=$n*i-Dn*o,a=Dn*r-On*i,c=On*o-$n*r,f=ug(s,a,c),u=ne(f),p=f&&-u/f;a6.add(p*s),c6.add(p*a),f6.add(p*c),mg+=u,bg+=u*(On+(On=r)),wg+=u*($n+($n=o)),vg+=u*(Dn+(Dn=i)),zp(On,$n,Dn)}function l6(t){Bp=mg=xg=gg=yg=bg=wg=vg=0,a6=new nn,c6=new nn,f6=new nn,or(t,Hr);var e=+a6,n=+c6,r=+f6,o=ug(e,n,r);return o<za&&(e=bg,n=wg,r=vg,mg<J&&(e=xg,n=gg,r=yg),o=ug(e,n,r),o<za)?[NaN,NaN]:[Ae(n,e)*he,ne(r/o)*he]}function Yp(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 p6(t,e){return St(t)>bt&&(t-=Math.round(t/Ye)*Ye),[t,e]}p6.invert=p6;function d6(t,e,n){return(t%=Ye)?e||n?Yp(M9(t),A9(e,n)):M9(t):e||n?A9(e,n):p6}function S9(t){return function(e,n){return e+=t,St(e)>bt&&(e-=Math.round(e/Ye)*Ye),[e,n]}}function M9(t){var e=S9(t);return e.invert=S9(-t),e}function A9(t,e){var n=Q(t),r=H(t),o=Q(e),i=H(e);function s(a,c){var f=Q(c),u=Q(a)*f,p=H(a)*f,l=H(c),d=l*n+u*r;return[Ae(p*o-d*i,u*n-l*r),ne(d*o+p*i)]}return s.invert=function(a,c){var f=Q(c),u=Q(a)*f,p=H(a)*f,l=H(c),d=l*o-p*i;return[Ae(p*o+l*i,u*n+d*r),ne(d*n-u*r)]},s}function T9(t){t=d6(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]*=he,n[1]*=he,n}return e.invert=function(n){return n=t.invert(n[0]*At,n[1]*At),n[0]*=he,n[1]*=he,n},e}function I9(t,e,n,r,o,i){if(n){var s=Q(e),a=H(e),c=r*n;o==null?(o=e+r*Ye,i=e-c/2):(o=E9(s,o),i=E9(s,i),(r>0?o<i:o>i)&&(o+=r*Ye));for(var f,u=o;r>0?u>i:u<i;u-=c)f=Dp([s,-a*Q(u),-a*H(u)]),t.point(f[0],f[1])}}function E9(t,e){e=_o(e),e[0]-=t,qp(e);var n=pg(-e[1]);return((-e[2]<0?-n:n)+Ye-J)%Ye}function _g(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Te,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Nf(t,e){return St(t[0]-e[0])<J&&St(t[1]-e[1])<J}function Sg(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 Mg(t,e,n,r,o){var i=[],s=[],a,c;if(t.forEach(function(h){if(!((m=h.length-1)<=0)){var m,x=h[0],g=h[m],y;if(Nf(x,g)){if(!x[2]&&!g[2]){for(o.lineStart(),a=0;a<m;++a)o.point((x=h[a])[0],x[1]);o.lineEnd();return}g[0]+=2*J}i.push(y=new Sg(x,h,null,!0)),s.push(y.o=new Sg(x,null,y,!1)),i.push(y=new Sg(g,h,null,!1)),s.push(y.o=new Sg(g,null,y,!0))}}),!!i.length){for(s.sort(e),N9(i),N9(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var f=i[0],u,p;;){for(var l=f,d=!0;l.v;)if((l=l.n)===f)return;u=l.z,o.lineStart();do{if(l.v=l.o.v=!0,l.e){if(d)for(a=0,c=u.length;a<c;++a)o.point((p=u[a])[0],p[1]);else r(l.x,l.n.x,1,o);l=l.n}else{if(d)for(u=l.p.z,a=u.length-1;a>=0;--a)o.point((p=u[a])[0],p[1]);else r(l.x,l.p.x,-1,o);l=l.p}l=l.o,u=l.z,d=!d}while(!l.v);o.lineEnd()}}}function N9(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 h6(t){return St(t[0])<=bt?t[0]:yn(t[0])*((St(t[0])+bt)%Ye-bt)}function C9(t,e){var n=h6(e),r=e[1],o=H(r),i=[H(n),-Q(n),0],s=0,a=0,c=new nn;o===1?r=Ht+J:o===-1&&(r=-Ht-J);for(var f=0,u=t.length;f<u;++f)if(l=(p=t[f]).length)for(var p,l,d=p[l-1],h=h6(d),m=d[1]/2+i6,x=H(m),g=Q(m),y=0;y<l;++y,h=w,x=v,g=A,d=b){var b=p[y],w=h6(b),_=b[1]/2+i6,v=H(_),A=Q(_),T=w-h,E=T>=0?1:-1,N=E*T,M=N>bt,k=x*v;if(c.add(Ae(k*E*H(N),g*A+k*Q(N))),s+=M?T+E*Ye:T,M^h>=n^w>=n){var O=If(_o(d),_o(b));qp(O);var S=If(i,O);qp(S);var I=(M^T>=0?-1:1)*ne(S[2]);(r>I||r===I&&(O[0]||O[1]))&&(a+=M^T>=0?1:-1)}}return(s<-J||s<J&&c<-za)^a&1}function Ag(t,e,n,r){return function(o){var i=e(o),s=_g(),a=e(s),c=!1,f,u,p,l={point:d,lineStart:m,lineEnd:x,polygonStart:function(){l.point=g,l.lineStart=y,l.lineEnd=b,u=[],f=[]},polygonEnd:function(){l.point=d,l.lineStart=m,l.lineEnd=x,u=uf(u);var w=C9(f,r);u.length?(c||(o.polygonStart(),c=!0),Mg(u,qj,w,n,o)):w&&(c||(o.polygonStart(),c=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),c&&(o.polygonEnd(),c=!1),u=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(){l.point=h,i.lineStart()}function x(){l.point=d,i.lineEnd()}function g(w,_){p.push([w,_]),a.point(w,_)}function y(){a.lineStart(),p=[]}function b(){g(p[0][0],p[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,A=_.length,T,E,N;if(p.pop(),f.push(p),p=null,!!A){if(w&1){if(E=_[0],(T=E.length-1)>0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v<T;++v)o.point((N=E[v])[0],N[1]);o.lineEnd()}return}A>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(Fj))}}return l}}function Fj(t){return t.length>1}function qj(t,e){return((t=t.x)[0]<0?t[1]-Ht-J:Ht-t[1])-((e=e.x)[0]<0?e[1]-Ht-J:Ht-e[1])}var m6=Ag(function(){return!0},Bj,Yj,[-bt,-Ht]);function Bj(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(i,s){var a=i>0?bt:-bt,c=St(i-e);St(c-bt)<J?(t.point(e,n=(n+s)/2>0?Ht:-Ht),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(i,n),o=0):r!==a&&c>=bt&&(St(e-r)<J&&(e-=r*J),St(i-a)<J&&(i-=a*J),n=zj(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 zj(t,e,n,r){var o,i,s=H(t-n);return St(s)>J?Nr((H(e)*(i=Q(r))*H(n)-H(r)*(o=Q(e))*H(t))/(o*i*s)):(e+r)/2}function Yj(t,e,n,r){var o;if(t==null)o=n*Ht,r.point(-bt,o),r.point(0,o),r.point(bt,o),r.point(bt,0),r.point(bt,-o),r.point(0,-o),r.point(-bt,-o),r.point(-bt,0),r.point(-bt,o);else if(St(t[0]-e[0])>J){var i=t[0]<e[0]?bt:-bt;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(e[0],e[1])}function k9(t){var e=Q(t),n=2*At,r=e>0,o=St(e)>J;function i(u,p,l,d){I9(d,t,n,l,u,p)}function s(u,p){return Q(u)*Q(p)>e}function a(u){var p,l,d,h,m;return{lineStart:function(){h=d=!1,m=1},point:function(x,g){var y=[x,g],b,w=s(x,g),_=r?w?0:f(x,g):w?f(x+(x<0?bt:-bt),g):0;if(!p&&(h=d=w)&&u.lineStart(),w!==d&&(b=c(p,y),(!b||Nf(p,b)||Nf(y,b))&&(y[2]=1)),w!==d)m=0,w?(u.lineStart(),b=c(y,p),u.point(b[0],b[1])):(b=c(p,y),u.point(b[0],b[1],2),u.lineEnd()),p=b;else if(o&&p&&r^w){var v;!(_&l)&&(v=c(y,p,!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&&(!p||!Nf(p,y))&&u.point(y[0],y[1]),p=y,d=w,l=_},lineEnd:function(){d&&u.lineEnd(),p=null},clean:function(){return m|(h&&d)<<1}}}function c(u,p,l){var d=_o(u),h=_o(p),m=[1,0,0],x=If(d,h),g=Pp(x,x),y=x[0],b=g-y*y;if(!b)return!l&&u;var w=e*g/b,_=-e*y/b,v=If(m,x),A=Fp(m,w),T=Fp(x,_);hg(A,T);var E=v,N=Pp(A,E),M=Pp(E,E),k=N*N-M*(Pp(A,A)-1);if(!(k<0)){var O=Qt(k),S=Fp(E,(-N-O)/M);if(hg(S,A),S=Dp(S),!l)return S;var I=u[0],C=p[0],L=u[1],D=p[1],$;C<I&&($=I,I=C,C=$);var P=C-I,F=St(P-bt)<J,q=F||P<J;if(!F&&D<L&&($=L,L=D,D=$),q?F?L+D>0^S[1]<(St(S[0]-I)<J?L:D):L<=S[1]&&S[1]<=D:P>bt^(I<=S[0]&&S[0]<=C)){var V=Fp(E,(-N+O)/M);return hg(V,A),[S,Dp(V)]}}}function f(u,p){var l=r?t:bt-t,d=0;return u<-l?d|=1:u>l&&(d|=2),p<-l?d|=4:p>l&&(d|=8),d}return Ag(s,a,i,r?[0,-t]:[-bt,t-bt])}function L9(t,e,n,r,o,i){var s=t[0],a=t[1],c=e[0],f=e[1],u=0,p=1,l=c-s,d=f-a,h;if(h=n-s,!(!l&&h>0)){if(h/=l,l<0){if(h<u)return;h<p&&(p=h)}else if(l>0){if(h>p)return;h>u&&(u=h)}if(h=o-s,!(!l&&h<0)){if(h/=l,l<0){if(h>p)return;h>u&&(u=h)}else if(l>0){if(h<u)return;h<p&&(p=h)}if(h=r-a,!(!d&&h>0)){if(h/=d,d<0){if(h<u)return;h<p&&(p=h)}else if(d>0){if(h>p)return;h>u&&(u=h)}if(h=i-a,!(!d&&h<0)){if(h/=d,d<0){if(h>p)return;h>u&&(u=h)}else if(d>0){if(h<u)return;h<p&&(p=h)}return u>0&&(t[0]=s+u*l,t[1]=a+u*d),p<1&&(e[0]=s+p*l,e[1]=a+p*d),!0}}}}}var Up=1e9,Tg=-Up;function Cf(t,e,n,r){function o(f,u){return t<=f&&f<=n&&e<=u&&u<=r}function i(f,u,p,l){var d=0,h=0;if(f==null||(d=s(f,p))!==(h=s(u,p))||c(f,u)<0^p>0)do l.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+p+4)%4)!==h);else l.point(u[0],u[1])}function s(f,u){return St(f[0]-t)<J?u>0?0:3:St(f[0]-n)<J?u>0?2:1:St(f[1]-e)<J?u>0?1:0:u>0?3:2}function a(f,u){return c(f.x,u.x)}function c(f,u){var p=s(f,1),l=s(u,1);return p!==l?p-l:p===0?u[1]-f[1]:p===1?f[0]-u[0]:p===2?f[1]-u[1]:u[0]-f[0]}return function(f){var u=f,p=_g(),l,d,h,m,x,g,y,b,w,_,v,A={point:T,lineStart:k,lineEnd:O,polygonStart:N,polygonEnd:M};function T(I,C){o(I,C)&&u.point(I,C)}function E(){for(var I=0,C=0,L=d.length;C<L;++C)for(var D=d[C],$=1,P=D.length,F=D[0],q,V,K=F[0],et=F[1];$<P;++$)q=K,V=et,F=D[$],K=F[0],et=F[1],V<=r?et>r&&(K-q)*(r-V)>(et-V)*(t-q)&&++I:et<=r&&(K-q)*(r-V)<(et-V)*(t-q)&&--I;return I}function N(){u=p,l=[],d=[],v=!0}function M(){var I=E(),C=v&&I,L=(l=uf(l)).length;(C||L)&&(f.polygonStart(),C&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),L&&Mg(l,a,I,i,f),f.polygonEnd()),u=f,l=d=h=null}function k(){A.point=S,d&&d.push(h=[]),_=!0,w=!1,y=b=NaN}function O(){l&&(S(m,x),g&&w&&p.rejoin(),l.push(p.result())),A.point=T,w&&u.lineEnd()}function S(I,C){var L=o(I,C);if(d&&h.push([I,C]),_)m=I,x=C,g=L,_=!1,L&&(u.lineStart(),u.point(I,C));else if(L&&w)u.point(I,C);else{var D=[y=Math.max(Tg,Math.min(Up,y)),b=Math.max(Tg,Math.min(Up,b))],$=[I=Math.max(Tg,Math.min(Up,I)),C=Math.max(Tg,Math.min(Up,C))];L9(D,$,t,e,n,r)?(w||(u.lineStart(),u.point(D[0],D[1])),u.point($[0],$[1]),L||u.lineEnd(),v=!1):L&&(u.lineStart(),u.point(I,C),v=!1)}y=I,b=C,w=L}return A}}function R9(t,e,n){var r=ye(t,e-J,n).concat(e);return function(o){return r.map(function(i){return[o,i]})}}function O9(t,e,n){var r=ye(t,e-J,n).concat(e);return function(o){return r.map(function(i){return[i,o]})}}function x6(){var t,e,n,r,o,i,s,a,c=10,f=c,u=90,p=360,l,d,h,m,x=2.5;function g(){return{type:"MultiLineString",coordinates:y()}}function y(){return ye($p(r/u)*u,n,u).map(h).concat(ye($p(a/p)*p,s,p).map(m)).concat(ye($p(e/c)*c,t,c).filter(function(b){return St(b%u)>J}).map(l)).concat(ye($p(i/f)*f,o,f).filter(function(b){return St(b%p)>J}).map(d))}return g.lines=function(){return y().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(m(s).slice(1),h(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(x)):[[r,a],[n,s]]},g.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),g.precision(x)):[[e,i],[t,o]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],p=+b[1],g):[u,p]},g.stepMinor=function(b){return arguments.length?(c=+b[0],f=+b[1],g):[c,f]},g.precision=function(b){return arguments.length?(x=+b,l=R9(i,o,90),d=O9(e,t,x),h=R9(a,s,90),m=O9(r,n,x),g):x},g.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function g6(){return x6()()}var jp=t=>t;var y6=new nn,b6=new nn,$9,D9,w6,v6,gs={point:Te,lineStart:Te,lineEnd:Te,polygonStart:function(){gs.lineStart=Uj,gs.lineEnd=Xj},polygonEnd:function(){gs.lineStart=gs.lineEnd=gs.point=Te,y6.add(St(b6)),b6=new nn},result:function(){var t=y6/2;return y6=new nn,t}};function Uj(){gs.point=jj}function jj(t,e){gs.point=P9,$9=w6=t,D9=v6=e}function P9(t,e){b6.add(v6*t-w6*e),w6=t,v6=e}function Xj(){P9($9,D9)}var _6=gs;var kf=1/0,Eg=kf,Xp=-kf,Ig=Xp,Wj={point:Vj,lineStart:Te,lineEnd:Te,polygonStart:Te,polygonEnd:Te,result:function(){var t=[[kf,Eg],[Xp,Ig]];return Xp=Ig=-(Eg=kf=1/0),t}};function Vj(t,e){t<kf&&(kf=t),t>Xp&&(Xp=t),e<Eg&&(Eg=e),e>Ig&&(Ig=e)}var Lf=Wj;var S6=0,M6=0,Wp=0,Ng=0,Cg=0,Rf=0,A6=0,T6=0,Vp=0,B9,z9,So,Mo,Qr={point:Ua,lineStart:F9,lineEnd:q9,polygonStart:function(){Qr.lineStart=Qj,Qr.lineEnd=Zj},polygonEnd:function(){Qr.point=Ua,Qr.lineStart=F9,Qr.lineEnd=q9},result:function(){var t=Vp?[A6/Vp,T6/Vp]:Rf?[Ng/Rf,Cg/Rf]:Wp?[S6/Wp,M6/Wp]:[NaN,NaN];return S6=M6=Wp=Ng=Cg=Rf=A6=T6=Vp=0,t}};function Ua(t,e){S6+=t,M6+=e,++Wp}function F9(){Qr.point=Gj}function Gj(t,e){Qr.point=Hj,Ua(So=t,Mo=e)}function Hj(t,e){var n=t-So,r=e-Mo,o=Qt(n*n+r*r);Ng+=o*(So+t)/2,Cg+=o*(Mo+e)/2,Rf+=o,Ua(So=t,Mo=e)}function q9(){Qr.point=Ua}function Qj(){Qr.point=Jj}function Zj(){Y9(B9,z9)}function Jj(t,e){Qr.point=Y9,Ua(B9=So=t,z9=Mo=e)}function Y9(t,e){var n=t-So,r=e-Mo,o=Qt(n*n+r*r);Ng+=o*(So+t)/2,Cg+=o*(Mo+e)/2,Rf+=o,o=Mo*t-So*e,A6+=o*(So+t),T6+=o*(Mo+e),Vp+=o*3,Ua(So=t,Mo=e)}var E6=Qr;function kg(t){this._context=t}kg.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,Ye);break}}},result:Te};var N6=new nn,I6,U9,j9,Gp,Hp,Lg={point:Te,lineStart:function(){Lg.point=Kj},lineEnd:function(){I6&&X9(U9,j9),Lg.point=Te},polygonStart:function(){I6=!0},polygonEnd:function(){I6=null},result:function(){var t=+N6;return N6=new nn,t}};function Kj(t,e){Lg.point=X9,U9=Gp=t,j9=Hp=e}function X9(t,e){Gp-=t,Hp-=e,N6.add(Qt(Gp*Gp+Hp*Hp)),Gp=t,Hp=e}var C6=Lg;var W9,Rg,V9,G9,Of=class{constructor(e){this._append=e==null?H9:tX(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!==V9||this._append!==Rg){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`,V9=r,Rg=this._append,G9=this._,this._=o}this._+=G9;break}}}result(){let e=this._;return this._="",e.length?e:null}};function H9(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function tX(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return H9;if(e!==W9){let n=10**e;W9=e,Rg=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 Rg}function Ue(t,e){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),or(a,o(i))),i.result()}return s.area=function(a){return or(a,o(_6)),_6.result()},s.measure=function(a){return or(a,o(C6)),C6.result()},s.bounds=function(a){return or(a,o(Lf)),Lf.result()},s.centroid=function(a){return or(a,o(E6)),E6.result()},s.projection=function(a){return arguments.length?(o=a==null?(t=null,jp):(t=a).stream,s):t},s.context=function(a){return arguments.length?(i=a==null?(e=null,new Of(n)):new kg(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 Of(n)),s},s.projection(t).digits(n).context(e)}function ja(t){return{stream:$f(t)}}function $f(t){return function(e){var n=new k6;for(var r in t)n[r]=t[r];return n.stream=e,n}}function k6(){}k6.prototype={constructor:k6,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 L6(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),or(n,t.stream(Lf)),e(Lf.result()),r!=null&&t.clipExtent(r),t}function Qp(t,e,n){return L6(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 Og(t,e,n){return Qp(t,[[0,0],e],n)}function $g(t,e,n){return L6(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 Dg(t,e,n){return L6(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 Q9=16,eX=Q(30*At);function R6(t,e){return+e?rX(t,e):nX(t)}function nX(t){return $f({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function rX(t,e){function n(r,o,i,s,a,c,f,u,p,l,d,h,m,x){var g=f-r,y=u-o,b=g*g+y*y;if(b>4*e&&m--){var w=s+l,_=a+d,v=c+h,A=Qt(w*w+_*_+v*v),T=ne(v/=A),E=St(St(v)-1)<J||St(i-p)<J?(i+p)/2:Ae(_,w),N=t(E,T),M=N[0],k=N[1],O=M-r,S=k-o,I=y*O-g*S;(I*I/b>e||St((g*O+y*S)/b-.5)>.3||s*l+a*d+c*h<eX)&&(n(r,o,i,s,a,c,M,k,E,w/=A,_/=A,v,m,x),x.point(M,k),n(M,k,E,w,_,v,f,u,p,l,d,h,m,x))}}return function(r){var o,i,s,a,c,f,u,p,l,d,h,m,x={point:g,lineStart:y,lineEnd:w,polygonStart:function(){r.polygonStart(),x.lineStart=_},polygonEnd:function(){r.polygonEnd(),x.lineStart=y}};function g(T,E){T=t(T,E),r.point(T[0],T[1])}function y(){p=NaN,x.point=b,r.lineStart()}function b(T,E){var N=_o([T,E]),M=t(T,E);n(p,l,u,d,h,m,p=M[0],l=M[1],u=T,d=N[0],h=N[1],m=N[2],Q9,r),r.point(p,l)}function w(){x.point=g,r.lineEnd()}function _(){y(),x.point=v,x.lineEnd=A}function v(T,E){b(o=T,E),i=p,s=l,a=d,c=h,f=m,x.point=b}function A(){n(p,l,u,d,h,m,i,s,o,a,c,f,Q9,r),x.lineEnd=w,w()}return x}}var oX=$f({point:function(t,e){this.stream.point(t*At,e*At)}});function iX(t){return $f({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function sX(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 Z9(t,e,n,r,o,i){if(!i)return sX(t,e,n,r,o);var s=Q(i),a=H(i),c=s*t,f=a*t,u=s/t,p=a/t,l=(a*n-s*e)/t,d=(a*e+s*n)/t;function h(m,x){return m*=r,x*=o,[c*m-f*x+e,n-f*m-c*x]}return h.invert=function(m,x){return[r*(u*m-p*x+l),o*(d-p*m-u*x)]},h}function cn(t){return O6(function(){return t})()}function O6(t){var e,n=150,r=480,o=250,i=0,s=0,a=0,c=0,f=0,u,p=0,l=1,d=1,h=null,m=m6,x=null,g,y,b,w=jp,_=.5,v,A,T,E,N;function M(I){return T(I[0]*At,I[1]*At)}function k(I){return I=T.invert(I[0],I[1]),I&&[I[0]*he,I[1]*he]}M.stream=function(I){return E&&N===I?E:E=oX(iX(u)(m(v(w(N=I)))))},M.preclip=function(I){return arguments.length?(m=I,h=void 0,S()):m},M.postclip=function(I){return arguments.length?(w=I,x=g=y=b=null,S()):w},M.clipAngle=function(I){return arguments.length?(m=+I?k9(h=I*At):(h=null,m6),S()):h*he},M.clipExtent=function(I){return arguments.length?(w=I==null?(x=g=y=b=null,jp):Cf(x=+I[0][0],g=+I[0][1],y=+I[1][0],b=+I[1][1]),S()):x==null?null:[[x,g],[y,b]]},M.scale=function(I){return arguments.length?(n=+I,O()):n},M.translate=function(I){return arguments.length?(r=+I[0],o=+I[1],O()):[r,o]},M.center=function(I){return arguments.length?(i=I[0]%360*At,s=I[1]%360*At,O()):[i*he,s*he]},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,O()):[a*he,c*he,f*he]},M.angle=function(I){return arguments.length?(p=I%360*At,O()):p*he},M.reflectX=function(I){return arguments.length?(l=I?-1:1,O()):l<0},M.reflectY=function(I){return arguments.length?(d=I?-1:1,O()):d<0},M.precision=function(I){return arguments.length?(v=R6(A,_=I*I),S()):Qt(_)},M.fitExtent=function(I,C){return Qp(M,I,C)},M.fitSize=function(I,C){return Og(M,I,C)},M.fitWidth=function(I,C){return $g(M,I,C)},M.fitHeight=function(I,C){return Dg(M,I,C)};function O(){var I=Z9(n,0,0,l,d,p).apply(null,e(i,s)),C=Z9(n,r-I[0],o-I[1],l,d,p);return u=d6(a,c,f),A=Yp(e,C),T=Yp(u,A),v=R6(A,_),S()}function S(){return E=N=null,M}return function(){return e=t.apply(this,arguments),M.invert=e.invert&&k,O()}}function Df(t){var e=0,n=bt/3,r=O6(t),o=r(e,n);return o.parallels=function(i){return arguments.length?r(e=i[0]*At,n=i[1]*At):[e*he,n*he]},o}function J9(t){var e=Q(t);function n(r,o){return[r*e,H(o)/e]}return n.invert=function(r,o){return[r/e,ne(o*e)]},n}function K9(t,e){var n=H(t),r=(n+H(e))/2;if(St(r)<J)return J9(t);var o=1+n*(2*r-n),i=Qt(o)/r;function s(a,c){var f=Qt(o-2*r*H(c))/r;return[f*H(a*=r),i-f*Q(a)]}return s.invert=function(a,c){var f=i-c,u=Ae(a,St(f))*yn(f);return f*r<0&&(u-=bt*yn(a)*yn(f)),[u/r,ne((o-(a*a+f*f)*r*r)/(2*r))]},s}function ys(){return Df(K9).scale(155.424).center([0,33.6442])}function Zp(){return ys().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function aX(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 $6(){var t,e,n=Zp(),r,o=ys().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=ys().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,f={point:function(l,d){c=[l,d]}};function u(l){var d=l[0],h=l[1];return c=null,r.point(d,h),c||(i.point(d,h),c)||(a.point(d,h),c)}u.invert=function(l){var d=n.scale(),h=n.translate(),m=(l[0]-h[0])/d,x=(l[1]-h[1])/d;return(x>=.12&&x<.234&&m>=-.425&&m<-.214?o:x>=.166&&x<.234&&m>=-.214&&m<-.115?s:n).invert(l)},u.stream=function(l){return t&&e===l?t:t=aX([n.stream(e=l),o.stream(l),s.stream(l)])},u.precision=function(l){return arguments.length?(n.precision(l),o.precision(l),s.precision(l),p()):n.precision()},u.scale=function(l){return arguments.length?(n.scale(l),o.scale(l*.35),s.scale(l),u.translate(n.translate())):n.scale()},u.translate=function(l){if(!arguments.length)return n.translate();var d=n.scale(),h=+l[0],m=+l[1];return r=n.translate(l).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+J,m+.12*d+J],[h-.214*d-J,m+.234*d-J]]).stream(f),a=s.translate([h-.205*d,m+.212*d]).clipExtent([[h-.214*d+J,m+.166*d+J],[h-.115*d-J,m+.234*d-J]]).stream(f),p()},u.fitExtent=function(l,d){return Qp(u,l,d)},u.fitSize=function(l,d){return Og(u,l,d)},u.fitWidth=function(l,d){return $g(u,l,d)},u.fitHeight=function(l,d){return Dg(u,l,d)};function p(){return t=e=null,u}return u.scale(1070)}function Pg(t){return function(e,n){var r=Q(e),o=Q(n),i=t(r*o);return i===1/0?[2,0]:[i*o*H(e),i*H(n)]}}function Ao(t){return function(e,n){var r=Qt(e*e+n*n),o=t(r),i=H(o),s=Q(o);return[Ae(e*i,r*s),ne(r&&n*i/r)]}}var D6=Pg(function(t){return Qt(2/(1+t))});D6.invert=Ao(function(t){return 2*ne(t/2)});function P6(){return cn(D6).scale(124.75).clipAngle(180-.001)}var F6=Pg(function(t){return(t=pg(t))&&t/H(t)});F6.invert=Ao(function(t){return t});function q6(){return cn(F6).scale(79.4188).clipAngle(180-.001)}function Pf(t,e){return[t,Ya(Ef((Ht+e)/2))]}Pf.invert=function(t,e){return[t,2*Nr(fg(e))-Ht]};function B6(){return z6(Pf).scale(961/Ye)}function z6(t){var e=cn(t),n=e.center,r=e.scale,o=e.translate,i=e.clipExtent,s=null,a,c,f;e.scale=function(p){return arguments.length?(r(p),u()):r()},e.translate=function(p){return arguments.length?(o(p),u()):o()},e.center=function(p){return arguments.length?(n(p),u()):n()},e.clipExtent=function(p){return arguments.length?(p==null?s=a=c=f=null:(s=+p[0][0],a=+p[0][1],c=+p[1][0],f=+p[1][1]),u()):s==null?null:[[s,a],[c,f]]};function u(){var p=bt*r(),l=e(T9(e.rotate()).invert([0,0]));return i(s==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:t===Pf?[[Math.max(l[0]-p,s),a],[Math.min(l[0]+p,c),f]]:[[s,Math.max(l[1]-p,a)],[c,Math.min(l[1]+p,f)]])}return u()}function Fg(t){return Ef((Ht+t)/2)}function tk(t,e){var n=Q(t),r=t===e?H(t):Ya(n/Q(e))/Ya(Fg(e)/Fg(t)),o=n*lg(Fg(t),r)/r;if(!r)return Pf;function i(s,a){o>0?a<-Ht+J&&(a=-Ht+J):a>Ht-J&&(a=Ht-J);var c=o/lg(Fg(a),r);return[c*H(r*s),o-c*Q(r*s)]}return i.invert=function(s,a){var c=o-a,f=yn(r)*Qt(s*s+c*c),u=Ae(s,St(c))*yn(c);return c*r<0&&(u-=bt*yn(s)*yn(c)),[u/r,2*Nr(lg(o/f,1/r))-Ht]},i}function Y6(){return Df(tk).scale(109.5).parallels([30,30])}function Ff(t,e){return[t,e]}Ff.invert=Ff;function U6(){return cn(Ff).scale(152.63)}function ek(t,e){var n=Q(t),r=t===e?H(t):(n-Q(e))/(e-t),o=n/r+t;if(St(r)<J)return Ff;function i(s,a){var c=o-a,f=r*s;return[c*H(f),o-c*Q(f)]}return i.invert=function(s,a){var c=o-a,f=Ae(s,St(c))*yn(c);return c*r<0&&(f-=bt*yn(s)*yn(c)),[f/r,o-yn(r)*Qt(s*s+c*c)]},i}function j6(){return Df(ek).scale(131.154).center([0,13.9389])}var Jp=1.340264,Kp=-.081106,td=893e-6,ed=.003796,qg=Qt(3)/2,cX=12;function X6(t,e){var n=ne(qg*H(e)),r=n*n,o=r*r*r;return[t*Q(n)/(qg*(Jp+3*Kp*r+o*(7*td+9*ed*r))),n*(Jp+Kp*r+o*(td+ed*r))]}X6.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,i=0,s,a,c;i<cX&&(a=n*(Jp+Kp*r+o*(td+ed*r))-e,c=Jp+3*Kp*r+o*(7*td+9*ed*r),n-=s=a/c,r=n*n,o=r*r*r,!(St(s)<za));++i);return[qg*t*(Jp+3*Kp*r+o*(7*td+9*ed*r))/Q(n),ne(H(n)/qg)]};function W6(){return cn(X6).scale(177.158)}function V6(t,e){var n=Q(e),r=Q(t)*n;return[n*H(t)/r,H(e)/r]}V6.invert=Ao(Nr);function G6(){return cn(V6).scale(144.049).clipAngle(60)}function H6(t,e){return[Q(e)*H(t),H(e)]}H6.invert=Ao(ne);function Q6(){return cn(H6).scale(249.5).clipAngle(90+J)}function Z6(t,e){var n=Q(e),r=1+Q(t)*n;return[n*H(t)/r,H(e)/r]}Z6.invert=Ao(function(t){return 2*Nr(t)});function J6(){return cn(Z6).scale(250).clipAngle(142)}function K6(t,e){return[Ya(Ef((Ht+e)/2)),-t]}K6.invert=function(t,e){return[-e,2*Nr(fg(t))-Ht]};function t3(){var t=z6(K6),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 fX(t,e){return t.parent===e.parent?1:2}function uX(t){return t.reduce(lX,0)/t.length}function lX(t,e){return t+e.x}function pX(t){return 1+t.reduce(dX,0)}function dX(t,e){return Math.max(t,e.y)}function hX(t){for(var e;e=t.children;)t=e[0];return t}function mX(t){for(var e;e=t.children;)t=e[e.length-1];return t}function Bg(){var t=fX,e=1,n=1,r=!1;function o(i){var s,a=0;i.eachAfter(function(l){var d=l.children;d?(l.x=uX(d),l.y=pX(d)):(l.x=s?a+=t(l,s):0,l.y=0,s=l)});var c=hX(i),f=mX(i),u=c.x-t(c,f)/2,p=f.x+t(f,c)/2;return i.eachAfter(r?function(l){l.x=(l.x-i.x)*e,l.y=(i.y-l.y)*n}:function(l){l.x=(l.x-u)/(p-u)*e,l.y=(1-(i.y?l.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 xX(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 nk(){return this.eachAfter(xX)}function rk(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}function ok(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 ik(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 sk(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}function ak(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 ck(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function fk(t){for(var e=this,n=gX(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 gX(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 uk(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function lk(){return Array.from(this)}function pk(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function dk(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*hk(){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 e3(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=wX)):e===void 0&&(e=bX);for(var n=new bs(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 bs(s[a])),i.parent=r,i.depth=r.depth+1;return n.eachBefore(n3)}function yX(){return e3(this).eachBefore(vX)}function bX(t){return t.children}function wX(t){return Array.isArray(t)?t[1]:null}function vX(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function n3(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function bs(t){this.data=t,this.depth=this.height=0,this.parent=null}bs.prototype=e3.prototype={constructor:bs,count:nk,each:rk,eachAfter:ik,eachBefore:ok,find:sk,sum:ak,sort:ck,path:fk,ancestors:uk,descendants:lk,leaves:pk,links:dk,copy:yX,[Symbol.iterator]:hk};function zg(t){return t==null?null:_X(t)}function _X(t){if(typeof t!="function")throw new Error;return t}var SX={depth:-1},mk={},r3={};function MX(t){return t.id}function AX(t){return t.parentId}function Yg(){var t=MX,e=AX,n;function r(o){var i=Array.from(o),s=t,a=e,c,f,u,p,l,d,h,m,x=new Map;if(n!=null){let g=i.map((w,_)=>TX(n(w,_,o))),y=g.map(xk),b=new Set(g).add("");for(let w of y)b.has(w)||(b.add(w),g.push(w),y.push(xk(w)),i.push(r3));s=(w,_)=>g[_],a=(w,_)=>y[_]}for(u=0,c=i.length;u<c;++u)f=i[u],d=i[u]=new bs(f),(h=s(f,u,o))!=null&&(h+="")&&(m=d.id=h,x.set(m,x.has(m)?mk:d)),(h=a(f,u,o))!=null&&(h+="")&&(d.parent=h);for(u=0;u<c;++u)if(d=i[u],h=d.parent){if(l=x.get(h),!l)throw new Error("missing: "+h);if(l===mk)throw new Error("ambiguous: "+h);l.children?l.children.push(d):l.children=[d],d.parent=l}else{if(p)throw new Error("multiple roots");p=d}if(!p)throw new Error("no root");if(n!=null){for(;p.data===r3&&p.children.length===1;)p=p.children[0],--c;for(let g=i.length-1;g>=0&&(d=i[g],d.data===r3);--g)d.data=null}if(p.parent=SX,p.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(n3),p.parent=null,c>0)throw new Error("cycle");return p}return r.id=function(o){return arguments.length?(t=zg(o),r):t},r.parentId=function(o){return arguments.length?(e=zg(o),r):e},r.path=function(o){return arguments.length?(n=zg(o),r):n},r}function TX(t){t=`${t}`;let e=t.length;return o3(t,e-1)&&!o3(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function xk(t){let e=t.length;if(e<2)return"";for(;--e>1&&!o3(t,e););return t.slice(0,e)}function o3(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}function EX(t,e){return t.parent===e.parent?1:2}function i3(t){var e=t.children;return e?e[0]:t.t}function s3(t){var e=t.children;return e?e[e.length-1]:t.t}function IX(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 NX(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 CX(t,e,n){return t.a.parent===e.parent?t.a:n}function Ug(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}Ug.prototype=Object.create(bs.prototype);function kX(t){for(var e=new Ug(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 Ug(i[s],s)),o.parent=n;return(e.parent=new Ug(null,0)).children=[e],e}function Xa(){var t=EX,e=1,n=1,r=null;function o(f){var u=kX(f);if(u.eachAfter(i),u.parent.m=-u.z,u.eachBefore(s),r)f.eachBefore(c);else{var p=f,l=f,d=f;f.eachBefore(function(y){y.x<p.x&&(p=y),y.x>l.x&&(l=y),y.depth>d.depth&&(d=y)});var h=p===l?1:t(p,l)/2,m=h-p.x,x=e/(l.x+h+m),g=n/(d.depth||1);f.eachBefore(function(y){y.x=(y.x+m)*x,y.y=y.depth*g})}return f}function i(f){var u=f.children,p=f.parent.children,l=f.i?p[f.i-1]:null;if(u){NX(f);var d=(u[0].z+u[u.length-1].z)/2;l?(f.z=l.z+t(f._,l._),f.m=f.z-d):f.z=d}else l&&(f.z=l.z+t(f._,l._));f.parent.A=a(f,l,f.parent.A||p[0])}function s(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function a(f,u,p){if(u){for(var l=f,d=f,h=u,m=l.parent.children[0],x=l.m,g=d.m,y=h.m,b=m.m,w;h=s3(h),l=i3(l),h&&l;)m=i3(m),d=s3(d),d.a=f,w=h.z+y-l.z-x+t(h._,l._),w>0&&(IX(CX(h,f,p),f,w),x+=w,g+=w),y+=h.m,x+=l.m,b+=m.m,g+=d.m;h&&!s3(d)&&(d.t=h,d.m+=y-g),l&&!i3(m)&&(m.t=l,m.m+=x-b,p=f)}return p}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 gk=23283064365386963e-26;function Wa(t=Math.random()){let e=(0<=t&&t<1?t/gk:Math.abs(t))|0;return()=>(e=1664525*e+1013904223|0,gk*(e>>>0))}function Ee(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function nd(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 rd=Symbol("implicit");function Va(){var t=new Tn,e=[],n=[],r=rd;function o(i){let s=t.get(i);if(s===void 0){if(r!==rd)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 Tn;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 Va(e,n).unknown(r)},Ee.apply(o,arguments),o}function ws(){var t=Va().unknown(void 0),e=t.domain,n=t.range,r=0,o=1,i,s,a=!1,c=0,f=0,u=.5;delete t.unknown;function p(){var l=e().length,d=o<r,h=d?o:r,m=d?r:o;i=(m-h)/Math.max(1,l-c+f*2),a&&(i=Math.floor(i)),h+=(m-h-i*(l-c))*u,s=i*(1-c),a&&(h=Math.round(h),s=Math.round(s));var x=ye(l).map(function(g){return h+i*g});return n(d?x.reverse():x)}return t.domain=function(l){return arguments.length?(e(l),p()):e()},t.range=function(l){return arguments.length?([r,o]=l,r=+r,o=+o,p()):[r,o]},t.rangeRound=function(l){return[r,o]=l,r=+r,o=+o,a=!0,p()},t.bandwidth=function(){return s},t.step=function(){return i},t.round=function(l){return arguments.length?(a=!!l,p()):a},t.padding=function(l){return arguments.length?(c=Math.min(1,f=+l),p()):c},t.paddingInner=function(l){return arguments.length?(c=Math.min(1,l),p()):c},t.paddingOuter=function(l){return arguments.length?(f=+l,p()):f},t.align=function(l){return arguments.length?(u=Math.max(0,Math.min(1,l)),p()):u},t.copy=function(){return ws(e(),[r,o]).round(a).paddingInner(c).paddingOuter(f).align(u)},Ee.apply(p(),arguments)}function yk(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return yk(e())},t}function a3(){return yk(ws.apply(null,arguments).paddingInner(1))}function c3(t){return function(){return t}}function qf(t){return+t}var bk=[0,1];function Vn(t){return t}function f3(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:c3(isNaN(e)?NaN:.5)}function LX(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function RX(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=f3(o,r),i=n(s,i)):(r=f3(r,o),i=n(i,s)),function(a){return i(r(a))}}function OX(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]=f3(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=fi(t,a,1,r)-1;return i[c](o[c](a))}}function To(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ga(){var t=bk,e=bk,n=rr,r,o,i,s=Vn,a,c,f;function u(){var l=Math.min(t.length,e.length);return s!==Vn&&(s=LX(t[0],t[l-1])),a=l>2?OX:RX,c=f=null,p}function p(l){return l==null||isNaN(l=+l)?i:(c||(c=a(t.map(r),e,n)))(r(s(l)))}return p.invert=function(l){return s(o((f||(f=a(e,t.map(r),ee)))(l)))},p.domain=function(l){return arguments.length?(t=Array.from(l,qf),u()):t.slice()},p.range=function(l){return arguments.length?(e=Array.from(l),u()):e.slice()},p.rangeRound=function(l){return e=Array.from(l),n=$a,u()},p.clamp=function(l){return arguments.length?(s=l?!0:Vn,u()):s!==Vn},p.interpolate=function(l){return arguments.length?(n=l,u()):n},p.unknown=function(l){return arguments.length?(i=l,p):i},function(l,d){return r=l,o=d,u()}}function od(){return Ga()(Vn,Vn)}function u3(t,e,n,r){var o=cf(t,e,n),i;switch(r=vo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=r6(o,s))&&(r.precision=i),cg(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=o6(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=n6(o))&&(r.precision=i-(r.type==="%")*2);break}}return Ir(r)}function vi(t){var e=t.domain;return t.ticks=function(n){var r=e();return on(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return u3(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,u=10;for(a<s&&(f=s,s=a,a=f,f=o,o=i,i=f);u-- >0;){if(f=li(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 _i(){var t=od();return t.copy=function(){return To(t,_i())},Ee.apply(t,arguments),vi(t)}function id(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,qf),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return id(t).unknown(e)},t=arguments.length?Array.from(t,qf):[0,1],vi(n)}function sd(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 wk(t){return Math.log(t)}function vk(t){return Math.exp(t)}function $X(t){return-Math.log(-t)}function DX(t){return-Math.exp(-t)}function PX(t){return isFinite(t)?+("1e"+t):t<0?0:t}function FX(t){return t===10?PX:t===Math.E?Math.exp:e=>Math.pow(t,e)}function qX(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 _k(t){return(e,n)=>-t(-e,n)}function l3(t){let e=t(wk,vk),n=e.domain,r=10,o,i;function s(){return o=qX(r),i=FX(r),n()[0]<0?(o=_k(o),i=_k(i),t($X,DX)):t(wk,vk),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],u=c[c.length-1],p=u<f;p&&([f,u]=[u,f]);let l=o(f),d=o(u),h,m,x=a==null?10:+a,g=[];if(!(r%1)&&d-l<x){if(l=Math.floor(l),d=Math.ceil(d),f>0){for(;l<=d;++l)for(h=1;h<r;++h)if(m=l<0?h/i(-l):h*i(l),!(m<f)){if(m>u)break;g.push(m)}}else for(;l<=d;++l)for(h=r-1;h>=1;--h)if(m=l>0?h/i(-l):h*i(l),!(m<f)){if(m>u)break;g.push(m)}g.length*2<x&&(g=on(f,u,x))}else g=on(l,d,Math.min(d-l,x)).map(i);return p?g.reverse():g},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=vo(c)).precision==null&&(c.trim=!0),c=Ir(c)),a===1/0)return c;let f=Math.max(1,r*a/e.ticks().length);return u=>{let p=u/i(Math.round(o(u)));return p*r<r-.5&&(p*=r),p<=f?c(u):""}},e.nice=()=>n(sd(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function ad(){let t=l3(Ga()).domain([1,10]);return t.copy=()=>To(t,ad()).base(t.base()),Ee.apply(t,arguments),t}function Sk(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Mk(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function p3(t){var e=1,n=t(Sk(e),Mk(e));return n.constant=function(r){return arguments.length?t(Sk(e=+r),Mk(e)):e},vi(n)}function cd(){var t=p3(Ga());return t.copy=function(){return To(t,cd()).constant(t.constant())},Ee.apply(t,arguments)}function Ak(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function BX(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function zX(t){return t<0?-t*t:t*t}function d3(t){var e=t(Vn,Vn),n=1;function r(){return n===1?t(Vn,Vn):n===.5?t(BX,zX):t(Ak(n),Ak(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},vi(e)}function fd(){var t=d3(Ga());return t.copy=function(){return To(t,fd()).exponent(t.exponent())},Ee.apply(t,arguments),t}function ud(){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]=p_(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[fi(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(yt),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 ud().domain(t).range(e).unknown(r)},Ee.apply(i,arguments)}function ld(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[fi(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 ld().domain(t).range(e).unknown(n)},Ee.apply(o,arguments)}var h3=new Date,m3=new Date;function Jt(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=>Jt(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)=>(h3.setTime(+i),m3.setTime(+s),t(h3),t(m3),Math.floor(n(h3,m3))),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 pd=Jt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);pd.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Jt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):pd);var SMt=pd.range;var je=Jt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),Tk=je.range;var Si=Jt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),YX=Si.range,Mi=Jt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),UX=Mi.range;var Ai=Jt(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()),jX=Ai.range,Ti=Jt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),XX=Ti.range;var Cr=Jt(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),WX=Cr.range,Za=Jt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),VX=Za.range,Ja=Jt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),GX=Ja.range;function Ka(t){return Jt(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 ir=Ka(0),vs=Ka(1),jg=Ka(2),Xg=Ka(3),Io=Ka(4),Wg=Ka(5),Vg=Ka(6),Ik=ir.range,HX=vs.range,QX=jg.range,ZX=Xg.range,JX=Io.range,KX=Wg.range,tW=Vg.range;function tc(t){return Jt(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 sr=tc(0),_s=tc(1),Gg=tc(2),Hg=tc(3),No=tc(4),Qg=tc(5),Zg=tc(6),Nk=sr.range,eW=_s.range,nW=Gg.range,rW=Hg.range,oW=No.range,iW=Qg.range,sW=Zg.range;var Ei=Jt(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()),aW=Ei.range,Ii=Jt(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()),cW=Ii.range;var bn=Jt(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());bn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Jt(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 fW=bn.range,wn=Jt(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());wn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Jt(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 uW=wn.range;function kk(t,e,n,r,o,i){let s=[[je,1,1e3],[je,5,5*1e3],[je,15,15*1e3],[je,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,u,p){let l=u<f;l&&([f,u]=[u,f]);let d=p&&typeof p.range=="function"?p:c(f,u,p),h=d?d.range(f,+u+1):[];return l?h.reverse():h}function c(f,u,p){let l=Math.abs(u-f)/p,d=Xr(([,,x])=>x).right(s,l);if(d===s.length)return t.every(cf(f/31536e6,u/31536e6,p));if(d===0)return pd.every(Math.max(cf(f,u,p),1));let[h,m]=s[l/s[d-1][2]<s[d][2]/l?d-1:d];return h.every(m)}return[a,c]}var[x3,hd]=kk(wn,Ii,sr,Ja,Ti,Mi),[g3,y3]=kk(bn,Ei,ir,Cr,Ai,Si);function b3(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 w3(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 md(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function v3(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=xd(o),u=gd(o),p=xd(i),l=gd(i),d=xd(s),h=gd(s),m=xd(a),x=gd(a),g=xd(c),y=gd(c),b={a:L,A:D,b:$,B:P,c:null,d:Pk,e:Pk,f:OW,g:jW,G:WW,H:kW,I:LW,j:RW,L:Yk,m:$W,M:DW,p:F,q,Q:Bk,s:zk,S:PW,u:FW,U:qW,V:BW,w:zW,W:YW,x:null,X:null,y:UW,Y:XW,Z:VW,"%":qk},w={a:V,A:K,b:et,B:rt,c:null,d:Fk,e:Fk,f:ZW,g:aV,G:fV,H:GW,I:HW,j:QW,L:jk,m:JW,M:KW,p:j,q:nt,Q:Bk,s:zk,S:tV,u:eV,U:nV,V:rV,w:oV,W:iV,x:null,X:null,y:sV,Y:cV,Z:uV,"%":qk},_={a:N,A:M,b:k,B:O,c:S,d:$k,e:$k,f:EW,g:Ok,G:Rk,H:Dk,I:Dk,j:SW,L:TW,m:_W,M:MW,p:E,q:vW,Q:NW,s:CW,S:AW,u:xW,U:gW,V:yW,w:mW,W:bW,x:I,X:C,y:Ok,Y:Rk,Z:wW,"%":IW};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,G){return function(tt){var B=[],_t=-1,ct=0,Ct=Y.length,Lt,Z,jt;for(tt instanceof Date||(tt=new Date(+tt));++_t<Ct;)Y.charCodeAt(_t)===37&&(B.push(Y.slice(ct,_t)),(Z=Lk[Lt=Y.charAt(++_t)])!=null?Lt=Y.charAt(++_t):Z=Lt==="e"?" ":"0",(jt=G[Lt])&&(Lt=jt(tt,Z)),B.push(Lt),ct=_t+1);return B.push(Y.slice(ct,_t)),B.join("")}}function A(Y,G){return function(tt){var B=md(1900,void 0,1),_t=T(B,Y,tt+="",0),ct,Ct;if(_t!=tt.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(G&&!("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=w3(md(B.y,0,1)),Ct=ct.getUTCDay(),ct=Ct>4||Ct===0?_s.ceil(ct):_s(ct),ct=Za.offset(ct,(B.V-1)*7),B.y=ct.getUTCFullYear(),B.m=ct.getUTCMonth(),B.d=ct.getUTCDate()+(B.w+6)%7):(ct=b3(md(B.y,0,1)),Ct=ct.getDay(),ct=Ct>4||Ct===0?vs.ceil(ct):vs(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),Ct="Z"in B?w3(md(B.y,0,1)).getUTCDay():b3(md(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Ct+5)%7:B.w+B.U*7-(Ct+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,w3(B)):b3(B)}}function T(Y,G,tt,B){for(var _t=0,ct=G.length,Ct=tt.length,Lt,Z;_t<ct;){if(B>=Ct)return-1;if(Lt=G.charCodeAt(_t++),Lt===37){if(Lt=G.charAt(_t++),Z=_[Lt in Lk?G.charAt(_t++):Lt],!Z||(B=Z(Y,tt,B))<0)return-1}else if(Lt!=tt.charCodeAt(B++))return-1}return B}function E(Y,G,tt){var B=f.exec(G.slice(tt));return B?(Y.p=u.get(B[0].toLowerCase()),tt+B[0].length):-1}function N(Y,G,tt){var B=d.exec(G.slice(tt));return B?(Y.w=h.get(B[0].toLowerCase()),tt+B[0].length):-1}function M(Y,G,tt){var B=p.exec(G.slice(tt));return B?(Y.w=l.get(B[0].toLowerCase()),tt+B[0].length):-1}function k(Y,G,tt){var B=g.exec(G.slice(tt));return B?(Y.m=y.get(B[0].toLowerCase()),tt+B[0].length):-1}function O(Y,G,tt){var B=m.exec(G.slice(tt));return B?(Y.m=x.get(B[0].toLowerCase()),tt+B[0].length):-1}function S(Y,G,tt){return T(Y,e,G,tt)}function I(Y,G,tt){return T(Y,n,G,tt)}function C(Y,G,tt){return T(Y,r,G,tt)}function L(Y){return s[Y.getDay()]}function D(Y){return i[Y.getDay()]}function $(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 V(Y){return s[Y.getUTCDay()]}function K(Y){return i[Y.getUTCDay()]}function et(Y){return c[Y.getUTCMonth()]}function rt(Y){return a[Y.getUTCMonth()]}function j(Y){return o[+(Y.getUTCHours()>=12)]}function nt(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var G=v(Y+="",b);return G.toString=function(){return Y},G},parse:function(Y){var G=A(Y+="",!1);return G.toString=function(){return Y},G},utcFormat:function(Y){var G=v(Y+="",w);return G.toString=function(){return Y},G},utcParse:function(Y){var G=A(Y+="",!0);return G.toString=function(){return Y},G}}}var Lk={"-":"",_:" ",0:"0"},Xe=/^\s*\d+/,pW=/^%/,dW=/[\\^$*+?|[\]().{}]/g;function qt(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 hW(t){return t.replace(dW,"\\$&")}function xd(t){return new RegExp("^(?:"+t.map(hW).join("|")+")","i")}function gd(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function mW(t,e,n){var r=Xe.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function xW(t,e,n){var r=Xe.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function gW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function yW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function bW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Rk(t,e,n){var r=Xe.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ok(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function wW(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 vW(t,e,n){var r=Xe.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function _W(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function $k(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function SW(t,e,n){var r=Xe.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Dk(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function MW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function AW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function TW(t,e,n){var r=Xe.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function EW(t,e,n){var r=Xe.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function IW(t,e,n){var r=pW.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function NW(t,e,n){var r=Xe.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function CW(t,e,n){var r=Xe.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Pk(t,e){return qt(t.getDate(),e,2)}function kW(t,e){return qt(t.getHours(),e,2)}function LW(t,e){return qt(t.getHours()%12||12,e,2)}function RW(t,e){return qt(1+Cr.count(bn(t),t),e,3)}function Yk(t,e){return qt(t.getMilliseconds(),e,3)}function OW(t,e){return Yk(t,e)+"000"}function $W(t,e){return qt(t.getMonth()+1,e,2)}function DW(t,e){return qt(t.getMinutes(),e,2)}function PW(t,e){return qt(t.getSeconds(),e,2)}function FW(t){var e=t.getDay();return e===0?7:e}function qW(t,e){return qt(ir.count(bn(t)-1,t),e,2)}function Uk(t){var e=t.getDay();return e>=4||e===0?Io(t):Io.ceil(t)}function BW(t,e){return t=Uk(t),qt(Io.count(bn(t),t)+(bn(t).getDay()===4),e,2)}function zW(t){return t.getDay()}function YW(t,e){return qt(vs.count(bn(t)-1,t),e,2)}function UW(t,e){return qt(t.getFullYear()%100,e,2)}function jW(t,e){return t=Uk(t),qt(t.getFullYear()%100,e,2)}function XW(t,e){return qt(t.getFullYear()%1e4,e,4)}function WW(t,e){var n=t.getDay();return t=n>=4||n===0?Io(t):Io.ceil(t),qt(t.getFullYear()%1e4,e,4)}function VW(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+qt(e/60|0,"0",2)+qt(e%60,"0",2)}function Fk(t,e){return qt(t.getUTCDate(),e,2)}function GW(t,e){return qt(t.getUTCHours(),e,2)}function HW(t,e){return qt(t.getUTCHours()%12||12,e,2)}function QW(t,e){return qt(1+Za.count(wn(t),t),e,3)}function jk(t,e){return qt(t.getUTCMilliseconds(),e,3)}function ZW(t,e){return jk(t,e)+"000"}function JW(t,e){return qt(t.getUTCMonth()+1,e,2)}function KW(t,e){return qt(t.getUTCMinutes(),e,2)}function tV(t,e){return qt(t.getUTCSeconds(),e,2)}function eV(t){var e=t.getUTCDay();return e===0?7:e}function nV(t,e){return qt(sr.count(wn(t)-1,t),e,2)}function Xk(t){var e=t.getUTCDay();return e>=4||e===0?No(t):No.ceil(t)}function rV(t,e){return t=Xk(t),qt(No.count(wn(t),t)+(wn(t).getUTCDay()===4),e,2)}function oV(t){return t.getUTCDay()}function iV(t,e){return qt(_s.count(wn(t)-1,t),e,2)}function sV(t,e){return qt(t.getUTCFullYear()%100,e,2)}function aV(t,e){return t=Xk(t),qt(t.getUTCFullYear()%100,e,2)}function cV(t,e){return qt(t.getUTCFullYear()%1e4,e,4)}function fV(t,e){var n=t.getUTCDay();return t=n>=4||n===0?No(t):No.ceil(t),qt(t.getUTCFullYear()%1e4,e,4)}function uV(){return"+0000"}function qk(){return"%"}function Bk(t){return+t}function zk(t){return Math.floor(+t/1e3)}var Bf,zf,Wk,Co,Vk;_3({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 _3(t){return Bf=v3(t),zf=Bf.format,Wk=Bf.parse,Co=Bf.utcFormat,Vk=Bf.utcParse,Bf}function lV(t){return new Date(t)}function pV(t){return t instanceof Date?+t:+new Date(+t)}function Jg(t,e,n,r,o,i,s,a,c,f){var u=od(),p=u.invert,l=u.domain,d=f(".%L"),h=f(":%S"),m=f("%I:%M"),x=f("%I %p"),g=f("%a %d"),y=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?x:r(v)<v?o(v)<v?g:y:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(p(v))},u.domain=function(v){return arguments.length?l(Array.from(v,pV)):l().map(lV)},u.ticks=function(v){var A=l();return t(A[0],A[A.length-1],v??10)},u.tickFormat=function(v,A){return A==null?_:f(A)},u.nice=function(v){var A=l();return(!v||typeof v.range!="function")&&(v=e(A[0],A[A.length-1],v??10)),v?l(sd(A,v)):u},u.copy=function(){return To(u,Jg(t,e,n,r,o,i,s,a,c,f))},u}function Kg(){return Ee.apply(Jg(g3,y3,bn,Ei,ir,Cr,Ai,Si,je,zf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ty(){return Ee.apply(Jg(x3,hd,wn,Ii,sr,Za,Ti,Mi,je,Co).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function yd(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function ey(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,f=Vn,u,p=!1,l;function d(m){return isNaN(m=+m)?l:(m=.5+((m=+u(m))-i)*(r*m<r*i?a:c),f(p?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([t,e,n]=m,o=u(t=+t),i=u(e=+e),s=u(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?(p=!!m,d):p},d.interpolator=function(m){return arguments.length?(f=m,d):f};function h(m){return function(x){var g,y,b;return arguments.length?([g,y,b]=x,f=go(m,[g,y,b]),d):[f(0),f(.5),f(1)]}}return d.range=h(rr),d.rangeRound=h($a),d.unknown=function(m){return arguments.length?(l=m,d):l},function(m){return u=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 bd(){var t=vi(ey()(Vn));return t.copy=function(){return yd(t,bd())},nd.apply(t,arguments)}function ny(){var t=l3(ey()).domain([.1,1,10]);return t.copy=function(){return yd(t,ny()).base(t.base())},nd.apply(t,arguments)}function ry(){var t=p3(ey());return t.copy=function(){return yd(t,ry()).constant(t.constant())},nd.apply(t,arguments)}function oy(){var t=d3(ey());return t.copy=function(){return yd(t,oy()).exponent(t.exponent())},nd.apply(t,arguments)}function X(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 S3=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var M3=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var A3=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var T3=X("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var E3=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var I3=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var N3=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var C3=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var k3=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var L3=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var R3=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ft=t=>I_(t[t.length-1]);var iy=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),sy=ft(iy);var ay=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),cy=ft(ay);var fy=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),uy=ft(fy);var ly=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),py=ft(ly);var wd=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),Yf=ft(wd);var dy=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),hy=ft(dy);var vd=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),Uf=ft(vd);var my=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),xy=ft(my);var gy=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),yy=ft(gy);var by=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),wy=ft(by);var vy=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),_y=ft(vy);var Sy=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),My=ft(Sy);var Ay=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),Ty=ft(Ay);var Ey=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),Iy=ft(Ey);var Ny=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),Cy=ft(Ny);var ky=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),Ly=ft(ky);var Ry=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),Oy=ft(Ry);var $y=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),Dy=ft($y);var Py=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),Fy=ft(Py);var qy=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),By=ft(qy);var zy=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),Yy=ft(zy);var Uy=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),jy=ft(Uy);var Xy=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),Wy=ft(Xy);var Vy=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),Gy=ft(Vy);var Hy=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),Qy=ft(Hy);var Zy=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),Jy=ft(Zy);var Ky=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),t1=ft(Ky);function e1(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 n1=gf(Cn(300,.5,0),Cn(-240,.5,1));var o1=gf(Cn(-100,.75,.35),Cn(80,1.5,.8)),i1=gf(Cn(260,.75,.35),Cn(80,1.5,.8)),r1=Cn();function s1(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return r1.h=360*t-100,r1.s=1.5-1.5*e,r1.l=.8-.9*e,r1+""}var a1=Le(),dV=Math.PI/3,hV=Math.PI*2/3;function c1(t){var e;return t=(.5-t)*Math.PI,a1.r=255*(e=Math.sin(t))*e,a1.g=255*(e=Math.sin(t+dV))*e,a1.b=255*(e=Math.sin(t+hV))*e,a1+""}function f1(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 u1(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var l1=u1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),p1=u1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),d1=u1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),h1=u1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ie(t){return function(){return t}}var O3=Math.cos;var jf=Math.min,_d=Math.sin,Bt=Math.sqrt,$3=1e-12,ec=Math.PI,GTt=ec/2,Xf=2*ec;function m1(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 hs(e)}var JTt=Array.prototype.slice;function x1(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Gk(t){this._context=t}Gk.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 Ni(t){return new Gk(t)}function g1(t){return t[0]}function y1(t){return t[1]}function Sd(t,e){var n=Ie(!0),r=null,o=Ni,i=null,s=m1(a);t=typeof t=="function"?t:t===void 0?g1:Ie(t),e=typeof e=="function"?e:e===void 0?y1:Ie(e);function a(c){var f,u=(c=x1(c)).length,p,l=!1,d;for(r==null&&(i=o(d=s())),f=0;f<=u;++f)!(f<u&&n(p=c[f],f,c))===l&&((l=!l)?i.lineStart():i.lineEnd()),l&&i.point(+t(p,f,c),+e(p,f,c));if(d)return i=null,d+""||null}return a.x=function(c){return arguments.length?(t=typeof c=="function"?c:Ie(+c),a):t},a.y=function(c){return arguments.length?(e=typeof c=="function"?c:Ie(+c),a):e},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ie(!!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 Wf(t,e,n){var r=null,o=Ie(!0),i=null,s=Ni,a=null,c=m1(f);t=typeof t=="function"?t:t===void 0?g1:Ie(+t),e=typeof e=="function"?e:e===void 0?Ie(0):Ie(+e),n=typeof n=="function"?n:n===void 0?y1:Ie(+n);function f(p){var l,d,h,m=(p=x1(p)).length,x,g=!1,y,b=new Array(m),w=new Array(m);for(i==null&&(a=s(y=c())),l=0;l<=m;++l){if(!(l<m&&o(x=p[l],l,p))===g)if(g=!g)d=l,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),h=l-1;h>=d;--h)a.point(b[h],w[h]);a.lineEnd(),a.areaEnd()}g&&(b[l]=+t(x,l,p),w[l]=+e(x,l,p),a.point(r?+r(x,l,p):b[l],n?+n(x,l,p):w[l]))}if(y)return a=null,y+""||null}function u(){return Sd().defined(o).curve(s).context(i)}return f.x=function(p){return arguments.length?(t=typeof p=="function"?p:Ie(+p),r=null,f):t},f.x0=function(p){return arguments.length?(t=typeof p=="function"?p:Ie(+p),f):t},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Ie(+p),f):r},f.y=function(p){return arguments.length?(e=typeof p=="function"?p:Ie(+p),n=null,f):e},f.y0=function(p){return arguments.length?(e=typeof p=="function"?p:Ie(+p),f):e},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Ie(+p),f):n},f.lineX0=f.lineY0=function(){return u().x(t).y(e)},f.lineY1=function(){return u().x(t).y(n)},f.lineX1=function(){return u().x(r).y(e)},f.defined=function(p){return arguments.length?(o=typeof p=="function"?p:Ie(!!p),f):o},f.curve=function(p){return arguments.length?(s=p,i!=null&&(a=s(i)),f):s},f.context=function(p){return arguments.length?(p==null?i=a=null:a=s(i=p),f):i},f}var b1=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 D3(t){return new b1(t,!0)}function P3(t){return new b1(t,!1)}var mV=Bt(3),Md={draw(t,e){let n=Bt(e+jf(e/28,.75))*.59436,r=n/2,o=r*mV;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 Ci={draw(t,e){let n=Bt(e/ec);t.moveTo(n,0),t.arc(0,0,n,0,Xf)}};var Ad={draw(t,e){let n=Bt(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 Hk=Bt(1/3),xV=Hk*2,Td={draw(t,e){let n=Bt(e/xV),r=n*Hk;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}};var Ed={draw(t,e){let n=Bt(e)*.62625;t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}};var Id={draw(t,e){let n=Bt(e-jf(e/7,2))*.87559;t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}};var Nd={draw(t,e){let n=Bt(e),r=-n/2;t.rect(r,r,n,n)}};var Cd={draw(t,e){let n=Bt(e)*.4431;t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};var gV=.8908130915292852,Qk=_d(ec/10)/_d(7*ec/10),yV=_d(Xf/10)*Qk,bV=-O3(Xf/10)*Qk,kd={draw(t,e){let n=Bt(e*gV),r=yV*n,o=bV*n;t.moveTo(0,-n),t.lineTo(r,o);for(let i=1;i<5;++i){let s=Xf*i/5,a=O3(s),c=_d(s);t.lineTo(c*n,-a*n),t.lineTo(a*r-c*o,c*r+a*o)}t.closePath()}};var F3=Bt(3),Ld={draw(t,e){let n=-Bt(e/(F3*3));t.moveTo(0,n*2),t.lineTo(-F3*n,-n),t.lineTo(F3*n,-n),t.closePath()}};var wV=Bt(3),Rd={draw(t,e){let n=Bt(e)*.6824,r=n/2,o=n*wV/2;t.moveTo(0,-n),t.lineTo(o,r),t.lineTo(-o,r),t.closePath()}};var kr=-.5,Lr=Bt(3)/2,q3=1/Bt(12),vV=(q3/2+1)*3,Od={draw(t,e){let n=Bt(e/vV),r=n/2,o=n*q3,i=r,s=n*q3+n,a=-i,c=s;t.moveTo(r,o),t.lineTo(i,s),t.lineTo(a,c),t.lineTo(kr*r-Lr*o,Lr*r+kr*o),t.lineTo(kr*i-Lr*s,Lr*i+kr*s),t.lineTo(kr*a-Lr*c,Lr*a+kr*c),t.lineTo(kr*r+Lr*o,kr*o-Lr*r),t.lineTo(kr*i+Lr*s,kr*s-Lr*i),t.lineTo(kr*a+Lr*c,kr*c-Lr*a),t.closePath()}};var Vf={draw(t,e){let n=Bt(e-jf(e/6,1.7))*.6189;t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};var w1=[Ci,Ad,Td,Nd,kd,Ld,Od],B3=[Ci,Id,Vf,Rd,Md,Cd,Ed];function Rr(){}function Gf(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 $d(t){this._context=t}$d.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:Gf(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:Gf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function z3(t){return new $d(t)}function Zk(t){this._context=t}Zk.prototype={areaStart:Rr,areaEnd:Rr,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:Gf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Y3(t){return new Zk(t)}function Jk(t){this._context=t}Jk.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:Gf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function U3(t){return new Jk(t)}function Kk(t,e){this._basis=new $d(t),this._beta=e}Kk.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 j3=function t(e){function n(r){return e===1?new $d(r):new Kk(r,e)}return n.beta=function(r){return t(+r)},n}(.85);function Hf(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 v1(t,e){this._context=t,this._k=(1-e)/6}v1.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:Hf(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:Hf(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 X3=function t(e){function n(r){return new v1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function _1(t,e){this._context=t,this._k=(1-e)/6}_1.prototype={areaStart:Rr,areaEnd:Rr,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:Hf(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 W3=function t(e){function n(r){return new _1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function S1(t,e){this._context=t,this._k=(1-e)/6}S1.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:Hf(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 V3=function t(e){function n(r){return new S1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function Dd(t,e,n){var r=t._x1,o=t._y1,i=t._x2,s=t._y2;if(t._l01_a>$3){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>$3){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*f+t._x1*t._l23_2a-e*t._l12_2a)/u,s=(s*f+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,o,i,s,t._x2,t._y2)}function tL(t,e){this._context=t,this._alpha=e}tL.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:Dd(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 G3=function t(e){function n(r){return e?new tL(r,e):new v1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function eL(t,e){this._context=t,this._alpha=e}eL.prototype={areaStart:Rr,areaEnd:Rr,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:Dd(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 H3=function t(e){function n(r){return e?new eL(r,e):new _1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function nL(t,e){this._context=t,this._alpha=e}nL.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:Dd(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 Q3=function t(e){function n(r){return e?new nL(r,e):new S1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function rL(t){this._context=t}rL.prototype={areaStart:Rr,areaEnd:Rr,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 Z3(t){return new rL(t)}function oL(t){return t<0?-1:1}function iL(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(oL(i)+oL(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(a))||0}function sL(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function J3(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 M1(t){this._context=t}M1.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:J3(this,this._t0,sL(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,J3(this,sL(this,n=iL(this,t,e)),n);break;default:J3(this,this._t0,n=iL(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function aL(t){this._context=new cL(t)}(aL.prototype=Object.create(M1.prototype)).point=function(t,e){M1.prototype.point.call(this,e,t)};function cL(t){this._context=t}cL.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 K3(t){return new M1(t)}function tS(t){return new aL(t)}function uL(t){this._context=t}uL.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=fL(t),o=fL(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 fL(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 eS(t){return new uL(t)}function A1(t,e){this._context=t,this._t=e}A1.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 nS(t){return new A1(t,.5)}function rS(t){return new A1(t,0)}function oS(t){return new A1(t,1)}var Pd=t=>()=>t;function iS(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 ar(t,e,n){this.k=t,this.x=e,this.y=n}ar.prototype={constructor:ar,scale:function(t){return t===1?this:new ar(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ar(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 Fd=new ar(1,0,0);sS.prototype=ar.prototype;function sS(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Fd;return t.__zoom}function T1(t){t.stopImmediatePropagation()}function Qf(t){t.preventDefault(),t.stopImmediatePropagation()}function _V(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function SV(){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 lL(){return this.__zoom||Fd}function MV(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function AV(){return navigator.maxTouchPoints||"ontouchstart"in this}function TV(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 aS(){var t=_V,e=SV,n=TV,r=MV,o=AV,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=O_,f=Na("start","zoom","end"),u,p,l,d=500,h=150,m=0,x=10;function g(S){S.property("__zoom",lL).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",N).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,I,C,L){var D=S.selection?S.selection():S;D.property("__zoom",lL),S!==D?_(S,I,C,L):D.interrupt().each(function(){v(this,arguments).event(L).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},g.scaleBy=function(S,I,C,L){g.scaleTo(S,function(){var D=this.__zoom.k,$=typeof I=="function"?I.apply(this,arguments):I;return D*$},C,L)},g.scaleTo=function(S,I,C,L){g.transform(S,function(){var D=e.apply(this,arguments),$=this.__zoom,P=C==null?w(D):typeof C=="function"?C.apply(this,arguments):C,F=$.invert(P),q=typeof I=="function"?I.apply(this,arguments):I;return n(b(y($,q),P,F),D,s)},C,L)},g.translateBy=function(S,I,C,L){g.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,L)},g.translateTo=function(S,I,C,L,D){g.transform(S,function(){var $=e.apply(this,arguments),P=this.__zoom,F=L==null?w($):typeof L=="function"?L.apply(this,arguments):L;return n(Fd.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),$,s)},L,D)};function y(S,I){return I=Math.max(i[0],Math.min(i[1],I)),I===S.k?S:new ar(I,S.x,S.y)}function b(S,I,C){var L=I[0]-C[0]*S.k,D=I[1]-C[1]*S.k;return L===S.x&&D===S.y?S:new ar(S.k,L,D)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,I,C,L){S.on("start.zoom",function(){v(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(L).end()}).tween("zoom",function(){var D=this,$=arguments,P=v(D,$).event(L),F=e.apply(D,$),q=C==null?w(F):typeof C=="function"?C.apply(D,$):C,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),K=D.__zoom,et=typeof I=="function"?I.apply(D,$):I,rt=c(K.invert(q).concat(V/K.k),et.invert(q).concat(V/et.k));return function(j){if(j===1)j=et;else{var nt=rt(j),Y=V/nt[2];j=new ar(Y,q[0]-nt[0]*Y,q[1]-nt[1]*Y)}P.zoom(null,j)}})}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=Nt(this.that).datum();f.call(S,this.that,new iS(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:f}),I)}};function T(S,...I){if(!t.apply(this,arguments))return;var C=v(this,I).event(S),L=this.__zoom,D=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),$=hn(S);if(C.wheel)(C.mouse[0][0]!==$[0]||C.mouse[0][1]!==$[1])&&(C.mouse[1]=L.invert(C.mouse[0]=$)),clearTimeout(C.wheel);else{if(L.k===D)return;C.mouse=[$,L.invert($)],yo(this),C.start()}Qf(S),C.wheel=setTimeout(P,h),C.zoom("mouse",n(b(y(L,D),C.mouse[0],C.mouse[1]),C.extent,s));function P(){C.wheel=null,C.end()}}function E(S,...I){if(l||!t.apply(this,arguments))return;var C=S.currentTarget,L=v(this,I,!0).event(S),D=Nt(S.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",V,!0),$=hn(S,C),P=S.clientX,F=S.clientY;hp(S.view),T1(S),L.mouse=[$,this.__zoom.invert($)],yo(this),L.start();function q(K){if(Qf(K),!L.moved){var et=K.clientX-P,rt=K.clientY-F;L.moved=et*et+rt*rt>m}L.event(K).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=hn(K,C),L.mouse[1]),L.extent,s))}function V(K){D.on("mousemove.zoom mouseup.zoom",null),mp(K.view,L.moved),Qf(K),L.event(K).end()}}function N(S,...I){if(t.apply(this,arguments)){var C=this.__zoom,L=hn(S.changedTouches?S.changedTouches[0]:S,this),D=C.invert(L),$=C.k*(S.shiftKey?.5:2),P=n(b(y(C,$),L,D),e.apply(this,I),s);Qf(S),a>0?Nt(this).transition().duration(a).call(_,P,L,S):Nt(this).call(g.transform,P,L,S)}}function M(S,...I){if(t.apply(this,arguments)){var C=S.touches,L=C.length,D=v(this,I,S.changedTouches.length===L).event(S),$,P,F,q;for(T1(S),P=0;P<L;++P)F=C[P],q=hn(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,$=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),$&&(D.taps<2&&(p=q[0],u=setTimeout(function(){u=null},d)),yo(this),D.start())}}function k(S,...I){if(this.__zooming){var C=v(this,I).event(S),L=S.changedTouches,D=L.length,$,P,F,q;for(Qf(S),$=0;$<D;++$)P=L[$],F=hn(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 V=C.touch0[0],K=C.touch0[1],et=C.touch1[0],rt=C.touch1[1],j=(j=et[0]-V[0])*j+(j=et[1]-V[1])*j,nt=(nt=rt[0]-K[0])*nt+(nt=rt[1]-K[1])*nt;P=y(P,Math.sqrt(j/nt)),F=[(V[0]+et[0])/2,(V[1]+et[1])/2],q=[(K[0]+rt[0])/2,(K[1]+rt[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 O(S,...I){if(this.__zooming){var C=v(this,I).event(S),L=S.changedTouches,D=L.length,$,P;for(T1(S),l&&clearTimeout(l),l=setTimeout(function(){l=null},d),$=0;$<D;++$)P=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=hn(P,this),Math.hypot(p[0]-P[0],p[1]-P[1])<x)){var F=Nt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Pd(+S),g):r},g.filter=function(S){return arguments.length?(t=typeof S=="function"?S:Pd(!!S),g):t},g.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Pd(!!S),g):o},g.extent=function(S){return arguments.length?(e=typeof S=="function"?S:Pd([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):e},g.scaleExtent=function(S){return arguments.length?(i[0]=+S[0],i[1]=+S[1],g):[i[0],i[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=f.on.apply(f,arguments);return S===f?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(x=+S,g):x},g}function oe(t){return t!=null&&!Number.isNaN(t)}function We(t,e){return+oe(e)-+oe(t)||yt(t,e)}function nc(t,e){return+oe(e)-+oe(t)||An(t,e)}function qd(t){return t!=null&&`${t}`!=""}function Zf(t){return isFinite(t)?t:NaN}function Pn(t){return t>0&&isFinite(t)?t:NaN}function Ss(t){return t<0&&isFinite(t)?t:NaN}function Jf(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`${EV(t.getUTCFullYear(),4)}-${ki(t.getUTCMonth()+1,2)}-${ki(t.getUTCDate(),2)}${n||r||o||i?`T${ki(n,2)}:${ki(r,2)}${o||i?`:${ki(o,2)}${i?`.${ki(i,3)}`:""}`:""}Z`:""}`}function EV(t){return t<0?`-${ki(-t,6)}`:t>9999?`+${ki(t,6)}`:ki(t,4)}function ki(t,e){return`${t}`.padStart(e,"0")}var IV=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Bd(t,e){return IV.test(t+="")?new Date(t):typeof e=="function"?e(t):e}function Li(t){if(t==null)return;let e=t[0],n=t[t.length-1];return An(e,n)}var tu=1e3,As=tu*60,Ts=As*60,Lo=Ts*24,ko=Lo*7,rc=Lo*30,Ms=Lo*365,cS=[["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",tu],["5 seconds",5*tu],["15 seconds",15*tu],["30 seconds",30*tu],["minute",As],["5 minutes",5*As],["15 minutes",15*As],["30 minutes",30*As],["hour",Ts],["3 hours",3*Ts],["6 hours",6*Ts],["12 hours",12*Ts],["day",Lo],["2 days",2*Lo],["week",ko],["2 weeks",2*ko],["month",rc],["3 months",3*rc],["6 months",6*rc],["year",Ms],["2 years",2*Ms],["5 years",5*Ms],["10 years",10*Ms],["20 years",20*Ms],["50 years",50*Ms],["100 years",100*Ms]],fS=new Map([["second",tu],["minute",As],["hour",Ts],["day",Lo],["monday",ko],["tuesday",ko],["wednesday",ko],["thursday",ko],["friday",ko],["saturday",ko],["sunday",ko],["week",ko],["month",rc],["year",Ms]]),dL=new Map([["second",je],["minute",Si],["hour",Ai],["day",Cr],["monday",vs],["tuesday",jg],["wednesday",Xg],["thursday",Io],["friday",Wg],["saturday",Vg],["sunday",ir],["week",ir],["month",Ei],["year",bn]]),uS=new Map([["second",je],["minute",Mi],["hour",Ti],["day",Ja],["monday",_s],["tuesday",Gg],["wednesday",Hg],["thursday",No],["friday",Qg],["saturday",Zg],["sunday",sr],["week",sr],["month",Ii],["year",wn]]),eu=Symbol("intervalDuration"),I1=Symbol("intervalType");for(let[t,e]of dL)e[eu]=fS.get(t),e[I1]="time";for(let[t,e]of uS)e[eu]=fS.get(t),e[I1]="utc";var zd=[["year",wn,"utc"],["month",Ii,"utc"],["day",Ja,"utc",6*rc],["hour",Ti,"utc",3*Lo],["minute",Mi,"utc",6*Ts],["second",je,"utc",30*As]],E1=[["year",bn,"time"],["month",Ei,"time"],["day",Cr,"time",6*rc],["hour",Ai,"time",3*Lo],["minute",Si,"time",6*Ts],["second",je,"time",30*As]],NV=[zd[0],E1[0],zd[1],E1[1],zd[2],E1[2],...zd.slice(3)];function N1(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=uS.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 Yd(t){return hL(N1(t),"time")}function oc(t){return hL(N1(t),"utc")}function hL([t,e],n){let r=(n==="time"?dL:uS).get(t);return e>1&&(r=r.every(e),r[eu]=fS.get(t)*e,r[I1]=n),r}function lS(t,e){if(!(e>1))return;let n=t[eu];if(!cS.some(([,o])=>o===n)||n%Lo===0&&Lo<n&&n<rc)return;let[r]=cS[Xr(([,o])=>Math.log(o)).center(cS,Math.log(n*e))];return(t[I1]==="time"?Yd:oc)(r)}function pL(t,e,n){let r=e==="time"?zf:Co;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=CV(n);switch(t){case"millisecond":return Kf(r(".%L"),r(":%M:%S"),o);case"second":return Kf(r(":%S"),r("%-I:%M"),o);case"minute":return Kf(r("%-I:%M"),r("%p"),o);case"hour":return Kf(r("%-I %p"),r("%b %-d"),o);case"day":return Kf(r("%-d"),r("%b"),o);case"month":return Kf(r("%b"),r("%Y"),o);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function CV(t){return t==="left"||t==="right"?(e,n)=>`
1
+ var wq=Object.create;var fw=Object.defineProperty;var vq=Object.getOwnPropertyDescriptor;var _q=Object.getOwnPropertyNames;var Sq=Object.getPrototypeOf,Mq=Object.prototype.hasOwnProperty;var E7=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pc=(t,e)=>{for(var n in e)fw(t,n,{get:e[n],enumerable:!0})},Aq=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _q(e))!Mq.call(t,o)&&o!==n&&fw(t,o,{get:()=>e[o],enumerable:!(r=vq(e,o))||r.enumerable});return t};var Eq=(t,e,n)=>(n=t!=null?wq(Sq(t)):{},Aq(e||!t||!t.__esModule?fw(n,"default",{value:t,enumerable:!0}):n,t));var tP=E7((DPt,KD)=>{"use strict";function BZ(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 zZ(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 YZ(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 UZ(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 jZ(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 zh(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)}KD.exports={ge:function(t,e,n,r,o){return zh(t,e,n,r,o,BZ)},gt:function(t,e,n,r,o){return zh(t,e,n,r,o,zZ)},lt:function(t,e,n,r,o){return zh(t,e,n,r,o,YZ)},le:function(t,e,n,r,o){return zh(t,e,n,r,o,UZ)},eq:function(t,e,n,r,o){return zh(t,e,n,r,o,jZ)}}});var cP=E7((PPt,aP)=>{"use strict";var Jb=tP(),zu=0,Ac=1,Zb=2;aP.exports=WZ;function cM(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 Yh=cM.prototype;function sM(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 rP(t,e){var n=Yu(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 eP(t,e){var n=t.intervals([]);n.push(e),rP(t,n)}function nP(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?zu:(n.splice(r,1),rP(t,n),Ac)}Yh.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t};Yh.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)?eP(this,t):this.left.insert(t):this.left=Yu([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?eP(this,t):this.right.insert(t):this.right=Yu([t]);else{var n=Jb.ge(this.leftPoints,t,fM),r=Jb.ge(this.rightPoints,t,uM);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}};Yh.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return zu;var n=this.right?this.right.count:0;if(4*n>3*(e-1))return nP(this,t);var r=this.left.remove(t);return r===Zb?(this.left=null,this.count-=1,Ac):(r===Ac&&(this.count-=1),r)}else if(t[0]>this.mid){if(!this.right)return zu;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return nP(this,t);var r=this.right.remove(t);return r===Zb?(this.right=null,this.count-=1,Ac):(r===Ac&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===t?Zb:zu;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}sM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?sM(this,this.left):sM(this,this.right);return Ac}for(var a=Jb.ge(this.leftPoints,t,fM);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=Jb.ge(this.rightPoints,t,uM);r<this.rightPoints.length&&this.rightPoints[r][1]===t[1];++r)if(this.rightPoints[r]===t)return this.rightPoints.splice(r,1),Ac}return zu}};function oP(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 iP(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 sP(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}Yh.queryPoint=function(t,e){if(t<this.mid){if(this.left){var n=this.left.queryPoint(t,e);if(n)return n}return oP(this.leftPoints,t,e)}else if(t>this.mid){if(this.right){var n=this.right.queryPoint(t,e);if(n)return n}return iP(this.rightPoints,t,e)}else return sP(this.leftPoints,e)};Yh.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?oP(this.leftPoints,e,n):t>this.mid?iP(this.rightPoints,t,n):sP(this.leftPoints,n)};function XZ(t,e){return t-e}function fM(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function uM(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function Yu(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(XZ);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(fM),f.sort(uM),new cM(r,Yu(o),Yu(i),c,f)}function aM(t){this.root=t}var Uu=aM.prototype;Uu.insert=function(t){this.root?this.root.insert(t):this.root=new cM(t[0],null,null,[t],[t])};Uu.remove=function(t){if(this.root){var e=this.root.remove(t);return e===Zb&&(this.root=null),e!==zu}return!1};Uu.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)};Uu.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)};Object.defineProperty(Uu,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(Uu,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function WZ(t){return!t||t.length===0?new aM(null):new aM(Yu(t))}});var T7={};function al(t,e=!1){let n,r,o=T7;function i(f){n=t(f).catch(()=>{}).finally(()=>{if(r){let{value:u}=r;r=null,i(u)}else n=null})}function s(f){r={event:f}}function a(f){n?s(f):i(f)}function c(f){o!==f&&requestAnimationFrame(()=>{let u=o;o=T7,a(u)}),o=f}return e?c:a}var zn=class{constructor(e){this._filterBy=e,this._requestUpdate=al(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(e){this._coordinator=e}get filterBy(){return this._filterBy}get filterStable(){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 cl=Uint8Array.of(65,82,82,79,87,49),mr={V1:0,V2:1,V3:2,V4:3,V5:4};var gr={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},Fc={HALF:0,SINGLE:1,DOUBLE:2},Ko={DAY:0,MILLISECOND:1},Pe={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},xr={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},ti={Sparse:0,Dense:1};var qc=Uint8Array,Cm=Uint16Array,Nm=Uint32Array,km=BigUint64Array,fl=Int8Array,I7=Int16Array,Yn=Int32Array,Jn=BigInt64Array,uw=Float32Array,Gi=Float64Array;function C7(t,e){let n=Math.log2(t)-3;return(e?[fl,I7,Yn,Jn]:[qc,Cm,Nm,km])[n]}var stt=Object.getPrototypeOf(Int8Array);function Bc(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 Lm(t,e,n){if(e(t))return t;throw new Error(n(t))}function Un(t,e,n){return e=Array.isArray(e)?e:Object.values(e),Lm(t,r=>e.includes(r),n??(()=>`${t} must be one of ${e}`))}function Rm(t,e){for(let[n,r]of Object.entries(t))if(r===e)return n;return"<Unknown>"}var ei=t=>`Unsupported data type: "${Rm(z,t)}" (id ${t})`,ul=(t,e,n=!0,r=null)=>({name:t,type:e,nullable:n,metadata:r});function N7(t){return Object.hasOwn(t,"name")&&k7(t.type)}function k7(t){return typeof t?.typeId=="number"}function Hi(t,e="",n=!0){return N7(t)?t:ul(e,Lm(t,k7,()=>"Data type expected."),n)}var Om=(t,e,n=!1,r=-1)=>({typeId:z.Dictionary,id:r,dictionary:t,indices:e||zc(),ordered:n});var $m=(t=32,e=!0)=>({typeId:z.Int,bitWidth:Un(t,[8,16,32,64]),signed:e,values:C7(t,e)});var zc=()=>$m(32);var lw=(t=2)=>({typeId:z.Float,precision:Un(t,Fc),values:[Cm,uw,Gi][t]});var pw=()=>({typeId:z.Binary,offsets:Yn}),Dm=()=>({typeId:z.Utf8,offsets:Yn});var dw=(t,e,n=128)=>({typeId:z.Decimal,precision:t,scale:e,bitWidth:Un(n,[128,256]),values:km}),hw=t=>({typeId:z.Date,unit:Un(t,Ko),values:t===Ko.DAY?Yn:Jn});var mw=(t=Pe.MILLISECOND,e=32)=>({typeId:z.Time,unit:Un(t,Pe),bitWidth:Un(e,[32,64]),values:e===32?Yn:Jn});var Pm=(t=Pe.MILLISECOND,e=null)=>({typeId:z.Timestamp,unit:Un(t,Pe),timezone:e,values:Jn}),gw=(t=xr.MONTH_DAY_NANO)=>({typeId:z.Interval,unit:Un(t,xr),values:t===xr.MONTH_DAY_NANO?void 0:Yn}),Fm=t=>({typeId:z.List,children:[Hi(t)],offsets:Yn}),qm=t=>({typeId:z.Struct,children:Array.isArray(t)&&N7(t[0])?t:Object.entries(t).map(([e,n])=>ul(e,n))}),xw=(t,e,n,r)=>(n??=e.map((o,i)=>i),{typeId:z.Union,mode:Un(t,ti),typeIds:n,typeMap:n.reduce((o,i,s)=>(o[i]=s,o),{}),children:e.map((o,i)=>Hi(o,`_${i}`)),typeIdForValue:r,offsets:Yn}),yw=t=>({typeId:z.FixedSizeBinary,stride:t}),Bm=(t,e)=>({typeId:z.FixedSizeList,stride:e,children:[Hi(t)]}),L7=(t,e)=>({typeId:z.Map,keysSorted:t,children:[e],offsets:Yn});var bw=(t=Pe.MILLISECOND)=>({typeId:z.Duration,unit:Un(t,Pe),values:Jn}),ww=()=>({typeId:z.LargeBinary,offsets:Jn}),vw=()=>({typeId:z.LargeUtf8,offsets:Jn}),_w=t=>({typeId:z.LargeList,children:[Hi(t)],offsets:Jn}),Sw=(t,e)=>({typeId:z.RunEndEncoded,children:[Lm(Hi(t,"run_ends"),n=>n.type.typeId===z.Int,()=>"Run-ends must have an integer type."),Hi(e,"values")]});var Mw=t=>({typeId:z.ListView,children:[Hi(t,"value")],offsets:Yn}),Aw=t=>({typeId:z.LargeListView,children:[Hi(t,"value")],offsets:Jn});var Tq=new Gi(2),zm=Tq.buffer,mtt=new Jn(zm),gtt=new Nm(zm),xtt=new Yn(zm),ytt=new qc(zm);function io(t){if(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${t}`);return Number(t)}function Ym(t,e){return Number(t/e)+Number(t%e)/Number(e)}var Yc=t=>BigInt.asUintN(64,t);function O7(t,e){let n=e<<1,r;return BigInt.asIntN(64,t[n+1])<0?(r=Yc(~t[n])|Yc(~t[n+1])<<64n,r=-(r+1n)):r=t[n]|t[n+1]<<64n,r}function $7(t,e){let n=e<<2,r;return BigInt.asIntN(64,t[n+3])<0?(r=Yc(~t[n])|Yc(~t[n+1])<<64n|Yc(~t[n+2])<<128n|Yc(~t[n+3])<<192n,r=-(r+1n)):r=t[n]|t[n+1]<<64n|t[n+2]<<128n|t[n+3]<<192n,r}var Cq=new TextDecoder("utf-8"),Stt=new TextEncoder;function Uc(t){return Cq.decode(t)}var sa=4;function Ew(t,e){return(t[e>>3]&1<<e%8)!==0}function pn(t,e){let n=e+Xt(t,e),r=n-Xt(t,n),o=tn(t,r);return(i,s,a=null)=>{if(i<o){let c=tn(t,r+i);if(c)return s(t,n+c)}return a}}function qr(t,e){return e}function Qi(t,e){return!!Nq(t,e)}function Nq(t,e){return ll(t,e)<<24>>24}function ll(t,e){return t[e]}function tn(t,e){return kq(t,e)<<16>>16}function kq(t,e){return t[e]|t[e+1]<<8}function Xt(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function D7(t,e){return Xt(t,e)>>>0}function Fe(t,e){return io(BigInt.asIntN(64,BigInt(D7(t,e))+(BigInt(D7(t,e+sa))<<32n)))}function aa(t,e){let n=e+Xt(t,e),r=Xt(t,n);return n+=sa,Uc(t.subarray(n,n+r))}function Kn(t,e,n,r){if(!e)return[];let o=e+Xt(t,e);return Array.from({length:Xt(t,o)},(i,s)=>r(t,o+sa+s*n))}var Tw=Symbol("rowIndex");function pl(t,e){class n{constructor(i){this[Tw]=i}toJSON(){return P7(t,e,this[Tw])}}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[Tw])},enumerable:!0})}return o=>new n(o)}function Um(t,e){return n=>P7(t,e,n)}function P7(t,e,n){let r={};for(let o=0;o<t.length;++o)r[t[o]]=e[o].at(n);return r}function F7(t){return t instanceof Zi}var ca=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 Ew(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)}},Zi=class extends ca{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]()}},dl=class extends ca{static ArrayType=Gi},se=class extends ca{static ArrayType=Array},hl=class extends se{value(e){return null}},so=class extends dl{value(e){return io(this.values[e])}},jm=class extends dl{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)}},Xm=class extends se{value(e){return Ew(this.values,e)}},Wm=class extends ca{constructor(e){super(e);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?O7:$7,this.scale=10n**BigInt(r)}},Vm=class extends Wm{static ArrayType=Gi;value(e){return Ym(this.decimal(this.values,e),this.scale)}},Gm=class extends Wm{static ArrayType=Array;value(e){return this.decimal(this.values,e)}},ml=class extends se{constructor(e){super(e),this.source=e}value(e){return new Date(this.source.value(e))}},Hm=class extends dl{value(e){return 864e5*this.values[e]}},q7=so,Qm=class extends so{value(e){return super.value(e)*1e3}},B7=so,Zm=class extends so{value(e){return Ym(this.values[e],1000n)}},Jm=class extends so{value(e){return Ym(this.values[e],1000000n)}},Km=class extends se{value(e){return this.values.subarray(e<<1,e+1<<1)}},t0=class extends se{value(e){let n=this.values,r=e<<4;return Float64Array.of(Xt(n,r),Xt(n,r+4),Fe(n,r+8))}},z7=({values:t,offsets:e},n)=>t.subarray(e[n],e[n+1]),Y7=({values:t,offsets:e},n)=>t.subarray(io(e[n]),io(e[n+1])),e0=class extends se{value(e){return z7(this,e)}},n0=class extends se{value(e){return Y7(this,e)}},r0=class extends se{value(e){return Uc(z7(this,e))}},o0=class extends se{value(e){return Uc(Y7(this,e))}},i0=class extends se{value(e){let n=this.offsets;return this.children[0].slice(n[e],n[e+1])}},s0=class extends se{value(e){let n=this.offsets;return this.children[0].slice(io(n[e]),io(n[e+1]))}},a0=class extends se{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(n,r)}},c0=class extends se{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(io(n),io(r))}},f0=class extends se{constructor(e){super(e),this.stride=this.type.stride}},u0=class extends f0{value(e){let{stride:n,values:r}=this;return r.subarray(e*n,(e+1)*n)}},l0=class extends f0{value(e){let{children:n,stride:r}=this;return n[0].slice(e*r,(e+1)*r)}};function U7({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 p0=class extends se{value(e){return U7(this,e)}},d0=class extends se{value(e){return new Map(U7(this,e))}},gl=class extends se{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)}},h0=class extends gl{value(e){return super.value(e,this.offsets[e])}},xl=class extends se{constructor(e,n=Um){super(e),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(e){return this.factory(e)}},m0=class extends xl{constructor(e){super(e,pl)}},g0=class extends se{value(e){let[{values:n},r]=this.children;return r.at(Bc(n,e))}},x0=class extends se{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]}},y0=class extends se{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=Xt(s,o);return a>12&&(i=Xt(s,o+12),s=r[Xt(s,o+8)]),s.subarray(i,i+a)}},b0=class extends y0{value(e){return this.view(e)}},w0=class extends y0{value(e){return Uc(this.view(e))}};function Iw(t){let e=[];return{add(n){return e.push(n),this},clear:()=>e=[],done:()=>new fa(e,t)}}var fa=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]():Lq(e)}at(e){let{data:n,offsets:r}=this,o=Bc(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&&F7(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?Rq(a,r):Oq(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*Lq(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 Rq(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 Oq(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 jc=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?pl:Um;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)=>$q(s[a],n[c]))},e.map(a=>r[a]),o===pl)}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=Bc(i,e)-1;return r(s)(e-i[s])}get(e){return this.at(e)}};function $q(t,e){return e!=null&&e!==t.name?{...t,name:e}:t}function yl(t,e={}){let{typeId:n,bitWidth:r,precision:o,unit:i}=t,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:f,useProxy:u}=e;switch(n){case z.Null:return hl;case z.Bool:return Xm;case z.Int:case z.Time:case z.Duration:return s||r<64?Zi:so;case z.Float:return o?Zi:jm;case z.Date:return j7(i===Ko.DAY?Hm:q7,a&&ml);case z.Timestamp:return j7(i===Pe.SECOND?Qm:i===Pe.MILLISECOND?B7:i===Pe.MICROSECOND?Zm:Jm,a&&ml);case z.Decimal:return c?Gm:Vm;case z.Interval:return i===xr.DAY_TIME?Km:i===xr.YEAR_MONTH?Zi:t0;case z.FixedSizeBinary:return u0;case z.Utf8:return r0;case z.LargeUtf8:return o0;case z.Binary:return e0;case z.LargeBinary:return n0;case z.BinaryView:return b0;case z.Utf8View:return w0;case z.List:return i0;case z.LargeList:return s0;case z.Map:return f?d0:p0;case z.ListView:return a0;case z.LargeListView:return c0;case z.FixedSizeList:return l0;case z.Struct:return u?m0:xl;case z.RunEndEncoded:return g0;case z.Dictionary:return x0;case z.Union:return t.mode?h0:gl}throw new Error(ei(n))}function j7(t,e){return e?class extends e{constructor(r){super(new t(r))}}:t}function Dq(t,e){return{offset:Fe(t,e),metadataLength:Xt(t,e+8),bodyLength:Fe(t,e+16)}}function Cw(t,e){return Kn(t,e,24,Dq)}function v0(t,e,n){let r=pn(t,e);if(r(10,qr,0))throw new Error("Record batch compression not implemented");let o=n<mr.V4?8:0;return{length:r(4,Fe,0),nodes:Kn(t,r(6,qr),16,(i,s)=>({length:Fe(i,s),nullCount:Fe(i,s+8)})),regions:Kn(t,r(8,qr),16+o,(i,s)=>({offset:Fe(i,s+o),length:Fe(i,s+o+8)})),variadic:Kn(t,r(12,qr),8,Fe)}}function X7(t,e,n){let r=pn(t,e);return{id:r(4,Fe,0),data:r(6,(o,i)=>v0(o,i,n)),isDelta:r(8,Qi,!1)}}function Nw(t,e,n,r){Un(n,z,ei);let o=pn(t,e);switch(n){case z.Binary:return pw();case z.Utf8:return Dm();case z.LargeBinary:return ww();case z.LargeUtf8:return vw();case z.List:return Fm(r[0]);case z.ListView:return Mw(r[0]);case z.LargeList:return _w(r[0]);case z.LargeListView:return Aw(r[0]);case z.Struct:return qm(r);case z.RunEndEncoded:return Sw(r[0],r[1]);case z.Int:return $m(o(4,Xt,0),o(6,Qi,!1));case z.Float:return lw(o(4,tn,Fc.HALF));case z.Decimal:return dw(o(4,Xt,0),o(6,Xt,0),o(8,Xt,128));case z.Date:return hw(o(4,tn,Ko.MILLISECOND));case z.Time:return mw(o(4,tn,Pe.MILLISECOND),o(6,Xt,32));case z.Timestamp:return Pm(o(4,tn,Pe.SECOND),o(6,aa));case z.Interval:return gw(o(4,tn,xr.YEAR_MONTH));case z.Duration:return bw(o(4,tn,Pe.MILLISECOND));case z.FixedSizeBinary:return yw(o(4,Xt,0));case z.FixedSizeList:return Bm(r[0],o(4,Xt,0));case z.Map:return L7(o(4,Qi,!1),r[0]);case z.Union:return xw(o(4,tn,ti.Sparse),r,Kn(t,o(6,qr),4,Xt))}return{typeId:n}}function bl(t,e){let n=Kn(t,e,4,(r,o)=>{let i=pn(r,o);return[i(4,aa),i(6,aa)]});return n.length?new Map(n):null}function _0(t,e,n){let r=pn(t,e);return{version:n,endianness:r(4,tn,0),fields:r(6,Pq,[]),metadata:r(8,bl)}}function Pq(t,e){return Kn(t,e,4,W7)}function W7(t,e){let n=pn(t,e),r=n(8,ll,z.NONE),o=n(10,qr,0),i=n(12,qq),s=n(14,(c,f)=>Fq(c,f)),a=Nw(t,o,r,s);return i&&(i.dictionary=a,a=i),{name:n(4,aa),type:a,nullable:n(6,Qi,!1),metadata:n(16,bl)}}function Fq(t,e){let n=Kn(t,e,4,W7);return n.length?n:null}function qq(t,e){if(!e)return null;let n=pn(t,e);return Om(null,n(6,Bq,zc()),n(8,Qi,!1),n(4,Fe,0))}function Bq(t,e){return Nw(t,e,z.Int)}var zq=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,Yq=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,Uq=t=>`Unsupported message type: ${t} (${Rm(gr,t)})`;function S0(t,e){let n=Xt(t,e)||0;if(e+=sa,n===-1&&(n=Xt(t,e)||0,e+=sa),n===0)return null;let r=t.subarray(e,e+=n);if(r.byteLength<n)throw new Error(zq(n,r.byteLength));let o=pn(r,0),i=o(4,tn,mr.V1),s=o(6,ll,gr.NONE),a=o(8,qr,0),c=o(10,Fe,0),f;if(a){let u=s===gr.Schema?_0:s===gr.DictionaryBatch?X7:s===gr.RecordBatch?v0:null;if(!u)throw new Error(Uq(s));if(f=u(r,a,i),c>0){let p=t.subarray(e,e+=c);if(p.byteLength<c)throw new Error(Yq(c,p.byteLength));f.body=p}}return{version:i,type:s,index:e,content:f}}function V7(t){let e=t instanceof ArrayBuffer?new Uint8Array(t):t;return e instanceof Uint8Array&&jq(e)?Wq(e):Xq(e)}function jq(t){if(!t||t.length<4)return!1;for(let e=0;e<6;++e)if(cl[e]!==t[e])return!1;return!0}function Xq(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=S0(i,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case gr.Schema:n||(n=a.content);break;case gr.RecordBatch:r.push(a.content);break;case gr.DictionaryBatch:o.push(a.content);break}}}return{schema:n,dictionaries:o,records:r,metadata:null}}function Wq(t){let e=t.byteLength-(cl.length+4),n=Xt(t,e),r=pn(t,e-n),o=r(4,tn,mr.V1),i=r(8,Cw,[]),s=r(10,Cw,[]);return{schema:r(6,(a,c)=>_0(a,c,o)),dictionaries:i.map(({offset:a})=>S0(t,a).content),records:s.map(({offset:a})=>S0(t,a).content),metadata:r(12,bl)}}function Lw(t,e){return Vq(V7(t),e)}function Vq(t,e={}){let{schema:n={fields:[]},dictionaries:r,records:o}=t,{version:i,fields:s}=n,a=new Map,c=Hq(e,i,a),f=new Map;Gq(n,l=>{let d=l.type;d.typeId===z.Dictionary&&f.set(d.id,d.dictionary)});let u=new Map;for(let l of r){let{id:d,data:h,isDelta:m,body:g}=l,x=f.get(d),y=kw(x,c({...h,body:g}));if(u.has(d)){let b=u.get(d);m||b.clear(),b.add(y)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(d,Iw(x).add(y))}}u.forEach((l,d)=>a.set(d,l.done()));let p=s.map(l=>Iw(l.type));for(let l of o){let d=c(l);s.forEach((h,m)=>p[m].add(kw(h.type,d)))}return new jc(n,p.map(l=>l.done()),e.useProxy)}function Gq(t,e){t.fields.forEach(function n(r){e(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Hq(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,u=-1,p=-1,l=-1;return{...r,length:i,node:()=>s[++u],buffer:d=>{let{length:h,offset:m}=a[++p];return d?new d(f.buffer,f.byteOffset+m,h/d.BYTES_PER_ELEMENT):f.subarray(m,m+h)},variadic:()=>c[++l],visit(d){return d.map(h=>kw(h.type,this))}}}}function kw(t,e){let{typeId:n}=t,{length:r,options:o,node:i,buffer:s,variadic:a,version:c}=e,f=yl(t,o);if(n===z.Null)return new f({length:r,nullCount:r,type:t});let u={...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({...u,validity:s(),values:s(t.values)});case z.Utf8:case z.LargeUtf8:case z.Binary:case z.LargeBinary:return new f({...u,validity:s(),offsets:s(t.offsets),values:s()});case z.BinaryView:case z.Utf8View:return new f({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case z.List:case z.LargeList:case z.Map:return new f({...u,validity:s(),offsets:s(t.offsets),children:e.visit(t.children)});case z.ListView:case z.LargeListView:return new f({...u,validity:s(),offsets:s(t.offsets),sizes:s(t.offsets),children:e.visit(t.children)});case z.FixedSizeList:case z.Struct:return new f({...u,validity:s(),children:e.visit(t.children)});case z.RunEndEncoded:return new f({...u,children:e.visit(t.children)});case z.Dictionary:{let{id:p,indices:l}=t;return new f({...u,validity:s(),values:s(l.values)}).setDictionary(e.dictionary(p))}case z.Union:return c<mr.V5&&s(),new f({...u,typeIds:s(fl),offsets:t.mode===ti.Sparse?null:s(t.offsets),children:e.visit(t.children)});default:throw new Error(ei(n))}}var tnt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function wl(t){return Lw(t,{useDate:!0})}function M0(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:u}=r;r=null,c(),u(f)}else console.error("WebSocket error: ",f)},message({data:f}){if(r){let{query:u,resolve:p,reject:l}=r;if(r=null,c(),typeof f=="string"){let d=JSON.parse(f);d.error?l(d.error):p(d)}else if(u.type==="exec")p();else if(u.type==="arrow")p(wl(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,u,p){o==null&&s(),e.push({query:f,resolve:u,reject:p}),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((u,p)=>a(f,u,p))}}}var Xc="COLUMN_REF",Wc="COLUMN_PARAM",tI="TABLE_REF",eI="LITERAL",nI="INTERVAL",A0="ORDER_BY",E0="CAST",T0="CASE",I0="WHEN",C0="UNARY",rI="UNARY_POSTFIX",N0="BINARY",k0="BETWEEN",L0="NOT_BETWEEN",R0="LOGICAL_OPERATOR",O0="IN",$0="FUNCTION",la="AGGREGATE",Vc="WINDOW",D0="WINDOW_DEF",P0="WINDOW_FRAME",oI="EXPRESSION",Gc="FRAGMENT",F0="VERBATIM",Hc="PARAM",iI="WITH_CLAUSE",q0="SELECT_CLAUSE",B0="FROM_CLAUSE";var sI="SAMPLE_CLAUSE";var z0="WINDOW_CLAUSE";var Y0="SELECT_QUERY",U0="DESCRIBE_QUERY",j0="SET_OPERATION";function qe(t){return t instanceof xe}var xe=class{constructor(e){this.type=e}},vt=class extends xe{};var pa=class extends vt{constructor(e){super(eI),this.value=e}toString(){return Rw(this.value)}};function Rw(t){switch(typeof t){case"number":return Number.isFinite(t)?`${t}`:"NULL";case"string":return`'${t.replace("'","''")}'`;case"boolean":return t?"TRUE":"FALSE";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)?`DATE '${n}-${r+1}-${o}'`:`epoch_ms(${e})`}else return t instanceof RegExp?`'${t.source}'`:`${t}`}}var Br=class extends vt{constructor(e){super(Hc),this.param=e}get value(){return this.param.value}toString(){return Rw(this.value)}};function Ow(t){return t.split(".")}function zr(t){return`"${t}"`}function X0(t){return t&&yB(t)?t.slice(1,-1):t}function yB(t){return t[0]==='"'&&t[t.length-1]==='"'}function Ji(t){return t instanceof Qc}var Qc=class extends vt{constructor(e){super(tI),this.table=[e].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(e=>zr(e)).join(".")}};var da=class extends vt{constructor(e,n=[]){super($0),this.name=e,this.args=n}toString(){let{name:e,args:n}=this;return`${e}(${n.join(", ")})`}};function Vt(t,...e){return new da(t,vl(e).map(Mt))}function Ot(t,...e){return new Sl(t,vl(e).map(Mt))}function yr(t,...e){return new ha(new _l(t,vl(e).map(Mt)))}function jn(t,e=Mt){return t.flat().filter(n=>n!=null).map(n=>e(n))}function vl(t){let e=t.length,n=e;for(;n>0&&t[n-1]===void 0;--n);return n<e?t.slice(0,n):t}function br(t){return typeof t=="string"}function Ml(t){return Array.isArray(t)}function Yr(t){return t&&typeof t.addEventListener=="function"&&t.dynamic!==!1&&"value"in t}var El=class extends xe{constructor(e,n){super(z0),this.name=e,this.def=n}toString(){return`${zr(this.name)} AS ${this.def}`}},ha=class t extends vt{constructor(e,n=new ma){super(Vc),this.func=e,this.def=n}over(e){return new t(this.func,this.def.over(e))}partitionby(...e){return new t(this.func,this.def.partitionby(...e))}orderby(...e){return new t(this.func,this.def.orderby(...e))}rows(e){return new t(this.func,this.def.rows(e))}range(e){return new t(this.func,this.def.range(e))}toString(){return`${this.func} OVER ${this.def}`}},_l=class extends da{constructor(e,n){super(e,n)}},ma=class extends xe{constructor(e,n,r,o){super(D0),this.name=e,this.partition=n,this.order=r,this.frame=o}over(e){return Al(this,{name:e})}partitionby(...e){return Al(this,{partition:jn(e)})}orderby(...e){return Al(this,{order:jn(e)})}rows(e){return Al(this,{frame:new Tl(e)})}range(e){return Al(this,{frame:new Tl(e,!0)})}toString(){let{name:e,partition:n,order:r,frame:o}=this,i=e&&zr(e),s=[i,n?.length&&`PARTITION BY ${n.join(", ")}`,r?.length&&`ORDER BY ${r.join(", ")}`,o].filter(a=>a);return i&&s.length<2?i:`(${s.join(" ")})`}},Tl=class extends xe{constructor(e,n=!1,r=void 0){super(P0),this.extent=Yr(e)?new Br(e):e,this.range=n,this.exclude=r}toString(){let{range:e,exclude:n,extent:r}=this,o=e?"RANGE":"ROWS",[i,s]=qe(r)?r.value:r,a=aI(i,"PRECEDING"),c=aI(s,"FOLLOWING");return`${o} BETWEEN ${a} AND ${c}${n?` ${n}`:""}`}};function Al(t,e){return new ma(e.name??t.name,e.partition??t.partition,e.order??t.order,e.frame??t.frame)}function aI(t,e){return t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} ${e}`:`UNBOUNDED ${e}`}function Ki(t){return t instanceof ri}var ri=class extends vt{constructor(e,n){super(e),this.table=n}get column(){return null}toString(){let{column:e,table:n}=this,r=`${n??""}`,o=e==="*"?"*":zr(e);return(r?r+".":"")+o}},Il=class extends ri{constructor(e,n){super(Xc,n),this.name=e}get column(){return this.name}};function $w(t){return t instanceof Zc}var Zc=class extends ri{constructor(e,n){super(Wc,n),this.param=e}get column(){return`${this.param.value}`}};function ga(t,e){let n=xa(e);return Yr(t)?new Zc(new Br(t),n):new Il(t,n)}var ya=class extends vt{constructor(e){super(F0),this.value=e}toString(){return this.value}};function Be(t){return new pa(t)}function cI(t){return new ya(t)}function W0(...t){let e=jn(t,String);return e?.length?new Qc(e):void 0}function Mt(t){return br(t)?bB(t):wa(t)}function ba(t){return br(t)?cI(t):wa(t)}function wa(t){return t instanceof vt?t:Yr(t)?new Br(t):Be(t)}function xa(t){return br(t)?wB(t):Ml(t)?W0(t):t}function bB(t){let e=Ow(t);return ga(e.pop(),W0(e))}function wB(t){return W0(Ow(t))}function Dw(){return new ma}var Sl=class t extends vt{constructor(e,n,r,o){super(la),this.name=e,this.args=n,this.isDistinct=r,this.filter=o}distinct(e=!0){return new t(this.name,this.args,e,this.filter)}where(e){return br(e)&&(e=ba(e)),new t(this.name,this.args,this.isDistinct,e)}window(){return new ha(this)}partitionby(...e){return this.window().partitionby(...e)}orderby(...e){return this.window().orderby(...e)}toString(){let{name:e,args:n,isDistinct:r,filter:o}=this,i=r?"DISTINCT ":"",s=n?.length?n.join(", "):"*",a=o?` FILTER (WHERE ${o})`:"";return`${e}(${i}${s})${a}`}},fI=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];var V0=class extends vt{constructor(e,n,r){super(e),this.expr=n,this.extent=r}toSQL(e){let{extent:n,expr:r}=this;return n?`(${r} ${e} ${n[0]} AND ${n[1]})`:""}},va=class extends V0{constructor(e,n){super(k0,e,n)}toString(){return super.toSQL("BETWEEN")}},Cl=class extends V0{constructor(e,n){super(L0,e,n)}toString(){return super.toSQL("NOT BETWEEN")}};var Nl=class extends vt{constructor(e,n,r){super(N0),this.op=e,this.left=n,this.right=r}toString(){return`(${this.left} ${this.op} ${this.right})`}};var Jc=class t extends vt{constructor(e=void 0,n=[],r=void 0){super(T0),this.expr=e,this._when=n,this._else=r}when(e,n){return new t(this.expr,this._when.concat(new Kc(Mt(e),Mt(n))),this._else)}else(e){return new t(this.expr,this._when,Mt(e))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}},Kc=class extends xe{constructor(e,n){super(I0),this.when=e,this.then=n}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var kl=class extends vt{constructor(e,n){super(E0),this.expr=e,this.cast=n}toString(){return`(${this.expr})::${this.cast}`}};var Ll=class extends vt{constructor(e){super(Gc),this.spans=e}toString(){return this.spans.join("")}};var Rl=class extends xe{constructor(e,n=!1,r=void 0,o=void 0){super(sI),this.size=e,this.perc=n,this.method=r,this.seed=o}toString(){let{size:e,perc:n,method:r,seed:o}=this,i=n?"%":" ROWS",s=o!=null?`, ${o}`:"";return`${e}${i}${r?` (${r}${s})`:""}`}};var Ol=class extends xe{constructor(e,n){super(q0),this.expr=e,this.alias=n}toString(){let{expr:e,alias:n}=this;return!n||vB(e,n)?`${e}`:`${e} AS ${zr(n)}`}};function vB(t,e){return t instanceof ri&&t.table==null&&t.column===e}var $l=class extends xe{constructor(e,n){super(iI),this.name=e,this.query=n}toString(){return`"${this.name}" AS (${this.query})`}};function G0(t){return t instanceof st}function ts(t){return t instanceof Sa}function Pw(t){return t instanceof Dl}var st=class extends vt{static select(...e){return new Sa().select(...e)}static from(...e){return new Sa().from(...e)}static with(...e){return new Sa().with(...e)}static union(...e){return new _a("UNION",e.flat())}static unionAll(...e){return new _a("UNION ALL",e.flat())}static intersect(...e){return new _a("INTERSECT",e.flat())}static except(...e){return new _a("EXCEPT",e.flat())}static describe(e){return new Dl(e)}constructor(e){super(e),this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}orderby(...e){return this._orderby=this._orderby.concat(jn(e)),this}limit(e){return this._limit=Number.isFinite(e)?e:void 0,this}offset(e){return this._offset=Number.isFinite(e)?e:void 0,this}},Sa=class t extends st{constructor(){super(Y0),this._with=[],this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){let e=this.cteFor||this,r=(e instanceof t?e._with:[]).reduce((i,s)=>(i[s.name]=s.query,i),{}),o=[];return this._from.forEach(({expr:i})=>{if(G0(i))o.push(i);else if(Ji(i)){let s=r[i.name];s&&o.push(s)}}),o}clone(){return Object.assign(new t,this)}with(...e){let n=[],r=(o,i)=>{let s=i.clone();s.cteFor=this,n.push(new $l(o,s))};return e.flat().forEach(o=>{if(o!=null)for(let i in o)r(i,o[i])}),this._with=this._with.concat(n),this}select(...e){let n=[],r=(i,s)=>n.push(new Ol(i==null?i:Mt(i),X0(s)));e.flat().forEach(i=>{if(i!=null)if(br(i))r(i,i);else if(Ki(i))r(i,i.column);else if(Ml(i))r(i[1],i[0]);else for(let s in i)r(i[s],s)});let o=new Set(n.map(i=>i.alias));return this._select=this._select.filter(i=>!o.has(i.alias)).concat(n.filter(i=>i.expr)),this}setSelect(...e){return this._select=[],this.select(...e)}distinct(e=!0){return this._distinct=!!e,this}from(...e){let n=[],r=(o,i)=>n.push(new Pl(xa(o),X0(i)));return e.flat().forEach(o=>{if(o!=null)if(br(o))r(o,o);else if(Ji(o))r(o,o.name);else if(qe(o))r(o);else if(Ml(o))r(o[1],o[0]);else for(let i in o)r(o[i],i)}),this._from=this._from.concat(n),this}setFrom(...e){return this._from=[],this.from(...e)}sample(e,n,r){let o;if(typeof e=="number"){let i=e>0&&e<1,s=i?e*100:Math.floor(e);o=new Rl(s,i,n,r)}else o=e;return this._sample=o,this}where(...e){return this._where=this._where.concat(jn(e,ba)),this}setWhere(...e){return this._where=[],this.where(...e)}groupby(...e){return this._groupby=this._groupby.concat(jn(e)),this}setGroupby(...e){return this._groupby=[],this.groupby(...e)}having(...e){return this._having=this._having.concat(jn(e,ba)),this}window(...e){let n=[];return e.flat().forEach(r=>{if(r!=null)for(let o in r)n.push(new El(X0(o),r[o]))}),this._window=this._window.concat(n),this}qualify(...e){return this._qualify=this._qualify.concat(jn(e,ba)),this}toString(){let{_with:e,_select:n,_distinct:r,_from:o,_sample:i,_where:s,_groupby:a,_having:c,_window:f,_qualify:u,_orderby:p,_limit:l,_offset:d}=this,h=[];if(e.length&&h.push(`WITH ${e.join(", ")}`),h.push(`SELECT${r?" DISTINCT":""} ${n.join(", ")}`),o.length&&h.push(`FROM ${o.join(", ")}`),s.length){let m=s.map(String).filter(g=>g).join(" AND ");m&&h.push(`WHERE ${m}`)}if(i&&h.push(`USING SAMPLE ${i}`),a.length&&h.push(`GROUP BY ${a.join(", ")}`),c.length){let m=c.map(String).filter(g=>g).join(" AND ");m&&h.push(`HAVING ${m}`)}if(f.length&&h.push(`WINDOW ${f.join(", ")}`),u.length){let m=u.map(String).filter(g=>g).join(" AND ");m&&h.push(`QUALIFY ${m}`)}return p.length&&h.push(`ORDER BY ${p.join(", ")}`),Number.isFinite(l)&&h.push(`LIMIT ${l}`),Number.isFinite(d)&&h.push(`OFFSET ${d}`),h.join(" ")}},Dl=class t extends xe{constructor(e){super(U0),this.query=e}clone(){return new t(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},_a=class t extends st{constructor(e,n){super(j0),this.op=e,this.queries=n}get subqueries(){let{queries:e,cteFor:n}=this;return n&&e.forEach(r=>r.cteFor=n),e}clone(){let{op:e,queries:n,...r}=this;return Object.assign(new t(e,n),r)}toString(){let{op:e,queries:n,_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(" ")}};var Pl=class extends xe{constructor(e,n){super(B0),this.expr=e,this.alias=n}toString(){let{expr:e,alias:n}=this,r=G0(e)?`(${e})`:`${e}`;return n&&!(Ji(e)&&e.table.join(".")===n)?`${r} AS ${zr(n)}`:`${r}`}};var Fl=class extends vt{constructor(e,n){super(O0),this.expr=e,this.values=n}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var ql=class extends vt{constructor(e,n=1){super(nI),this.name=e,this.steps=n}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var H0=class extends vt{constructor(e,n){super(R0),this.op=e,this.clauses=n}toString(){let e=this.clauses;return e.length===0?"":e.length===1?`${e[0]}`:`(${e.join(` ${this.op} `)})`}},Bl=class extends H0{constructor(e){super("AND",e)}},zl=class extends H0{constructor(e){super("OR",e)}};var tf=class extends vt{constructor(e,n,r){super(A0),this.expr=e,this.desc=n,this.nullsFirst=r}toString(){let{expr:e,desc:n,nullsFirst:r}=this;return`${e}${n?" DESC":n===!1?" ASC":""}${r?" NULLS FIRST":r===!1?" NULLS LAST":""}`}};var Q0=class extends vt{constructor(e,n,r){super(e),this.op=n,this.expr=r}},Yl=class extends Q0{constructor(e,n){super(C0,e,n)}toString(){return`(${this.op} ${this.expr})`}},Ul=class extends Q0{constructor(e,n){super(rI,e,n)}toString(){return`(${this.expr} ${this.op})`}};function es(t,e){return Ot("arg_max",t,e)}function ns(t,e){return Ot("arg_min",t,e)}function Fw(t){return Ot("array_agg",t)}function jl(t){return Ot("avg",t)}function qw(t,e){return Ot("corr",t,e)}function ze(t){return Ot("count",t)}function Bw(t,e){return Ot("covar_samp",t,e)}function zw(t,e){return Ot("covar_pop",t,e)}function Yw(t){return Ot("entropy",t)}function Uw(t){return Ot("first",t)}function jw(t){return Ot("kurtosis",t)}function Xw(t){return Ot("mad",t)}function en(t){return Ot("max",t)}function Ww(t){return Ot("median",t)}function Xn(t){return Ot("min",t)}function Vw(t){return Ot("mode",t)}function Gw(t){return Ot("last",t)}function Hw(t){return Ot("product",t)}function Qw(t,e){return Ot("quantile",t,e)}function Xl(t,e){return Ot("regr_avgx",t,e)}function Zw(t,e){return Ot("regr_avgy",t,e)}function Wl(t,e){return Ot("regr_count",t,e)}function Jw(t,e){return Ot("regr_intercept",t,e)}function Kw(t,e){return Ot("regr_sxx",t,e)}function tv(t,e){return Ot("regr_syy",t,e)}function ev(t,e){return Ot("regr_slope",t,e)}function nv(t){return Ot("skewness",t)}function Vl(t){return Ot("stddev",t)}function rv(t){return Ot("stddev_pop",t)}function ov(t){return Ot("string_agg",t)}function Yt(t){return Ot("sum",t)}function iv(t){return Ot("var_samp",t)}function sv(t){return Ot("var_pop",t)}function oi(t,e,n){return t?new Jc(void 0,[new Kc(Mt(t),Mt(e))],Mt(n)):new Jc}function ef(t,e){return new kl(Mt(t),e)}function Gt(t){return ef(t,"INTEGER")}function av(t){return ef(t,"FLOAT")}function de(t){return ef(t,"DOUBLE")}function Z0(t,e){return new ql(t,e)}function cv(t){return Vt("epoch_ms",t)}function fv(t,e,n=1){return Vt("time_bucket",Z0(e,n),t)}function uv(t){return Vt("make_date",2012,Vt("month",t),1)}function lv(t){let e=Mt(t);return Vt("make_date",2012,Vt("month",e),Vt("day",e))}function pv(t){return Vt("make_date",2012,1,Vt("day",t))}function dv(...t){return Vt("greatest",...t)}function J0(t){return Vt("exp",t)}function hv(t){return Vt("log",t)}function nf(t){return Vt("ln",t)}function Ur(t){return Vt("sign",t)}function Ye(t){return Vt("abs",t)}function ii(t){return Vt("sqrt",t)}function mv(t){return Vt("ceil",t)}function Ue(t){return Vt("floor",t)}function si(t,e){return Vt("round",t,e)}function _B(t,e){return new Yl(t,Mt(e))}function uI(t,e){return new Ul(t,Mt(e))}function Wn(t,e,n){return new Nl(t,Mt(e),Mt(n))}function lI(t,e,n=!1){let r=n?Cl:va;return new r(Mt(t),e?.map(Mt))}function dn(...t){return new Bl(jn(t))}function wr(...t){return new zl(jn(t))}function gv(t){return _B("NOT",t)}function Ma(t){return uI("IS NULL",t)}function vr(t){return uI("IS NOT NULL",t)}function Gl(t,e){return Wn("&",t,e)}function Rt(t,e){return Wn("+",t,e)}function dt(t,e){return Wn("-",t,e)}function mt(t,e){return Wn("*",t,e)}function Pt(t,e){return Wn("/",t,e)}function ve(t,e){return Wn("**",t,e)}function xv(t,e){return Wn("=",t,e)}function jr(t,e){return Wn("<>",t,e)}function ae(t,e){return Wn("<",t,e)}function _r(t,e){return Wn(">",t,e)}function tr(t,e){return Wn("<=",t,e)}function yv(t,e){return Wn(">=",t,e)}function bv(t,e){return Wn("IS DISTINCT FROM",t,e)}function Hl(t,e){return Wn("IS NOT DISTINCT FROM",t,e)}function nn(t,e){return lI(t,e,!1)}function wv(t,e){return lI(t,e,!0)}function K0(t,e){return new Fl(Mt(t),e.map(Mt))}function vv(t,e){return new tf(Mt(t),!1,e)}function _v(t,e){return new tf(Mt(t),!0,e)}function Ql(t){return Vt("st_asgeojson",t)}function pI(t){return Vt("st_x",t)}function dI(t){return Vt("st_y",t)}function Zl(t){return Vt("st_centroid",t)}function Sv(t){return pI(Zl(t))}function Mv(t){return dI(Zl(t))}function ye(t,...e){return new Ll(SB(t,e))}function SB(t,e){let n=[t[0]],r=e.length;for(let o=0,i=0;o<r;){let s=e[o];qe(s)?n[++i]=s:Yr(s)?n[++i]=new Br(s):n[i]+=br(s)?s:Be(s);let a=t[++o];qe(n[i])?n[++i]=a:n[i]+=a}return n.filter(o=>o).map(o=>br(o)?new ya(o):o)}function tg(t,e,...n){return Vt(t,e,...vl(n).map(wa))}function Av(t,e,n){return tg("regexp_matches",t,e,n)}function Ev(t,e){return tg("contains",t,e)}function Tv(t,e){return tg("starts_with",t,e)}function Iv(t,e){return tg("ends_with",t,e)}function Cv(){return yr("row_number")}function Nv(){return yr("rank")}function kv(){return yr("dense_rank")}function Lv(){return yr("percent_rank")}function Rv(){return yr("cume_dist")}function Ov(t){return yr("ntile",t)}function $v(t,e,n){return yr("lag",t,e,n)}function rf(t,e,n){return yr("lead",t,e,n)}function Dv(t){return yr("first_value",t)}function Pv(t){return yr("last_value",t)}function Fv(t,e){return yr("nth_value",t,e)}var eg={[la]:["args","filter"],[k0]:["expr","extent"],[N0]:["left","right"],[T0]:["expr","_when","_else"],[E0]:["expr"],[Wc]:["param","table"],[Xc]:["table"],[U0]:["query"],[oI]:["node"],[Gc]:["spans"],[B0]:["expr"],[$0]:["args"],[O0]:["expr","values"],[R0]:["clauses"],[L0]:["expr","extent"],[A0]:["expr"],[Hc]:["value"],[q0]:["expr"],[Y0]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[j0]:["subqueries","_orderby"],[C0]:["expr"],[I0]:["when","then"],[Vc]:["func","def"],[z0]:["def"],[D0]:["partition","order","frame"],[P0]:["extent"]};function Jl(t,e){if(e.has(t))return e.get(t);if(qe(t)){let n=eg[t.type],r=n?.length??0;for(let o=0;o<r;++o){let i=n[o],s=t[i];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)s[c]=Jl(s[c],e)}else s&&(t[i]=Jl(s,e))}}return t}function ao(t,e){if(!qe(t))return;let n=e(t);if(n)return n;let r=eg[t.type],o=r?.length??0;for(let i=0;i<o;++i){let s=t[r[i]];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)if(s[c]&&+ao(s[c],e)<0)return n}else if(s&&+ao(s,e)<0)return-1}}var MB=new RegExp(`^(${fI.join("|")})$`),AB=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function EB(t){return t.split(AB).some(e=>e.endsWith("(")&&MB.test(e.slice(0,-1)))}function Mn(t){let e=0;return ao(t,n=>{switch(n.type){case Vc:return-1;case la:return e|=1,-1;case Gc:case F0:{let r=`${n}`.toLowerCase(),o=r.indexOf("(select ");return o>=0&&(r=r.slice(0,o)),r.includes(") over ")?-1:EB(r)?(e|=2,-1):1}}}),e}function qv(t){let e=new Set;return ao(t,n=>{n.type===la&&e.add(n)}),Array.from(e)}function of(t){let e={};return ao(t,n=>{(n.type===Xc||n.type===Wc)&&(e[n]=n)}),Object.values(e)}function Bv(t){let e=new Set;return ao(t,n=>{n.type===Hc&&e.add(n.param)}),Array.from(e)}function co(t,e,{replace:n=!1,temp:r=!1,view:o=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(o?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+t+" AS "+e}function zv(t,{strict:e=!1}={}){return"CREATE SCHEMA "+(e?"":"IF NOT EXISTS ")+t}function Kl(t){return`INSTALL ${t}; LOAD ${t}`}function hI(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=>`${wa(o[s])} AS "${e[s]}"`);r.push(`(SELECT ${i.join(", ")})`)}return r.join(" UNION ALL ")}function ng(t,e,n,r={},o={}){let{select:i=["*"],where:s,view:a,temp:c,replace:f,...u}=r,p=TB({...o,...u}),l=`${t}('${n}'${p?", "+p:""})`,d=s?` WHERE ${s}`:"",h=`SELECT ${i.join(", ")} FROM ${l}${d}`;return co(e,h,{view:a,temp:c,replace:f})}function Uv(t,e,n){return ng("read_csv",t,e,n,{auto_detect:!0,sample_size:-1})}function jv(t,e,n){return ng("read_json",t,e,n,{auto_detect:!0,format:"auto"})}function Xv(t,e,n){return ng("read_parquet",t,e,n)}function Wv(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 ng("st_read",t,e,o)}function Vv(t,e,n={}){let{select:r=["*"],...o}=n,i=hI(e),s=r.length===1&&r[0]==="*"?i:`SELECT ${r} FROM ${i}`;return co(t,s,o)}function TB(t){return Object.entries(t).map(([e,n])=>`${e}=${Yv(n)}`).join(", ")}function Yv(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=>Yv(e)).join(", ")+"]":"{"+Object.entries(t).map(([e,n])=>`'${e}': ${Yv(n)}`).join(", ")+"}";default:return t}}function Gv(t,e,n,r,o){let i=o?dt(n,de(t)):dt(de(t),e),s=n===e?0:r/(n-e);return s?mt(i,de(s)):i}function Hv(t,e,n,r,o,i){return t.select({index:Rt(Gt(Ue(e)),mt(Gt(Ue(n)),o)),...r}).groupby("index",i)}function Qv(t,e,n=void 0,r=[]){let o=n?a=>mt(a,n):a=>a,i=Ue(e),s=Rt(i,1);return st.from(st.unionAll(t.clone().select({i:Gt(i),w:o(dt(s,e))}),t.clone().select({i:Gt(s),w:o(dt(e,i))}))).select({index:"i",density:Yt("w")},r).groupby("index",r).having(jr("density",0))}function IB(t){return t}function Zv(t,e,n,r,o,i=[]){let s=r?x=>mt(x,r):IB,a=(x,y)=>t.clone().select({xp:e,yp:n,i:x,w:y}),c=(x,y)=>Rt(x,mt(y,o)),f=Gt(Ue(e)),u=Gt(Ue(n)),p=Rt(f,1),l=Rt(u,1),d=dt(e,f),h=dt(p,e),m=dt(n,u),g=dt(l,n);return st.from(st.unionAll(a(c(f,u),s(mt(h,g))),a(c(f,l),s(mt(h,m))),a(c(p,u),s(mt(d,g))),a(c(p,l),s(mt(d,m))))).select({index:"i",density:Yt("w")},i).groupby("index",i).having(jr("density",0))}function Jv(t,e,n,r,o,i,s=[],a=!0){t.select({x:Gt(Ue(e)),y:Gt(Ue(n))});let c=s.concat(r),f=st.from(t).select(c,{x0:"x",y0:"y",dx:dt(rf("x").over("sw"),"x"),dy:dt(rf("y").over("sw"),"y")}).window({sw:Dw().partitionby(c).orderby(vv("x"))}).qualify([wr(ae("x0",o),ae(Rt("x0","dx"),o)),wr(ae("y0",i),ae(Rt("y0","dy"),i)),wr(_r("x0",0),_r(Rt("x0","dx"),0)),wr(_r("y0",0),_r(Rt("y0","dy"),0))]),u=st.select({x:dv(en(Ye("dx")),en(Ye("dy")))}).from("pairs"),p=st.select({i:Gt(ye`UNNEST(range((${u})))`)}),l=st.unionAll(st.select(c,{x:Rt("x0","i"),y:Rt("y0",Gt(si(Pt(mt("i","dy"),"dx"))))}).from("pairs","indices").where([tr(Ye("dy"),Ye("dx")),ae("i",Ye("dx"))]),st.select(c,{x:Rt("x0",Gt(si(Pt(mt(mt(Ur("dy"),"i"),"dx"),"dy")))),y:Rt("y0",mt(Ur("dy"),"i"))}).from("pairs","indices").where([_r(Ye("dy"),Ye("dx")),ae("i",Ye("dy"))]),st.select(c,{x:"x0",y:"y0"}).from("pairs").where(Ma("dx"))),d=st.from("raster").select(c,"x","y",a?{w:Pt(1,ze().partitionby(["x"].concat(c)))}:null).where([tr(0,"x"),ae("x",o),tr(0,"y"),ae("y",i)]);return st.with({pairs:f,indices:p,raster:l,points:d}).from("points").select(s,{index:Rt("x",mt("y",Gt(o))),density:a?Yt("w"):ze()}).groupby("index",s)}function Kv(t,e,n,r,o=[]){let i=Gt(Ue(e)),s=a=>st.from(t).select(a).groupby(i,o);return st.union(s([{[n]:Xn(n),[r]:ns(r,n)},...o]),s([{[n]:en(n),[r]:es(r,n)},...o]),s([{[n]:ns(n,r),[r]:Xn(r)},...o]),s([{[n]:es(n,r),[r]:en(r)},...o])).orderby(o,n)}var rg=t=>t;function mI(){return{apply:rg,invert:rg,sqlApply:Mt,sqlInvert:rg}}function CB({base:t=null}={}){if(t==null||t===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:e=>nf(e),sqlInvert:e=>J0(e)};if(t===10)return{apply:Math.log10,invert:e=>Math.pow(10,e),sqlApply:e=>hv(e),sqlInvert:e=>ve(10,e)};{let e=+t;return{apply:n=>Math.log(n)/Math.log(e),invert:n=>Math.pow(e,n),sqlApply:n=>Pt(nf(n),nf(e)),sqlInvert:n=>ve(e,n)}}}function NB({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=Mt(n),mt(Ur(n),nf(Rt(e,Ye(n))))),sqlInvert:n=>mt(Ur(n),dt(J0(Ye(n)),e))}}function kB(){return{apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*t*t,sqlApply:t=>(t=Mt(t),mt(Ur(t),ii(Ye(t)))),sqlInvert:t=>mt(Ur(t),ve(t,2))}}function LB({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=Mt(n),mt(Ur(n),ve(Ye(n),e))),sqlInvert:n=>mt(Ur(n),ve(Ye(n),Pt(1,e)))}}function gI(){return{apply:t=>+t,invert:t=>new Date(t),sqlApply:t=>t instanceof Date?Be(+t):OB(t)?Be(+t.value):cv(t),sqlInvert:rg}}var RB={identity:mI,linear:mI,log:CB,symlog:NB,sqrt:kB,pow:LB,time:gI,utc:gI};function tp(t){let e=RB[t.type];return e?{...t,...e(t)}:null}function OB(t){return t instanceof pa&&t.value instanceof Date}function og(t){let e=2166136261;for(let n=0,r=t.length;n<r;++n){let o=t.charCodeAt(n),i=o&65280;i&&(e=xI(e^i>>8)),e=xI(e^o&255)}return $B(e)>>>0}function xI(t){return t+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}function $B(t){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,t&4294967295}function bI(t,e,n){switch(t.name){case"count":case"sum":return DB(e,t);case"avg":return PB(e,t);case"arg_max":return FB(e,t);case"arg_min":return qB(e,t);case"variance":case"var_samp":return ig(e,t,n);case"var_pop":return ig(e,t,n,!1);case"stddev":case"stddev_samp":return ii(ig(e,t,n));case"stddev_pop":return ii(ig(e,t,n,!1));case"covar_samp":return sg(e,t,n);case"covar_pop":return sg(e,t,n,!1);case"corr":return yI(e,t,n);case"regr_count":return sf(e,t).expr;case"regr_avgx":return SI(e,t);case"regr_avgy":return MI(e,t);case"regr_syy":return e_(e,0,t,n);case"regr_sxx":return e_(e,1,t,n);case"regr_sxy":return sg(e,t,n,null);case"regr_slope":return AI(e,t,n);case"regr_intercept":return BB(e,t,n);case"regr_r2":return ve(yI(e,t,n),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{let r=wI(t);return e[r]=t,ye`${t.name}("${r}")`}default:return null}}function wI(t){return"pre_"+og(`${t}`).toString(16)}function An(t,e,n){let r=n?.filter;r&&(e=e.filter?e.where(dn(r,e.filter)):e.where(r));let o=wI(e);return t[o]=e,o}function vI(t,e){let n=An(t,ze(e.args[0]),e);return{expr:Yt(n),name:n}}function DB(t,e){return Yt(An(t,e))}function PB(t,e){let n=An(t,e),{expr:r,name:o}=vI(t,e);return Pt(Yt(mt(n,o)),r)}function FB(t,e){let n=An(t,e),r=An(t,en(e.args[1]),e);return es(n,r)}function qB(t,e){let n=An(t,e),r=An(t,Xn(e.args[1]),e);return ns(n,r)}function ig(t,e,n,r=!0){let o=e.args[0],{expr:i}=vI(t,e),s=dt(o,n(o)),a=An(t,Yt(ve(s,2)),e),c=An(t,Yt(s),e),f=r?dt(i,1):i;return Pt(dt(Yt(a),Pt(ve(Yt(c),2),i)),f)}function sg(t,e,n,r=!0){let{expr:o}=sf(t,e),i=_I(t,e,n),s=ep(t,1,e,n),a=ep(t,0,e,n),c=dt(i,Pt(mt(s,a),o));return r===null?c:r?Pt(c,dt(o,1)):Pt(c,o)}function yI(t,e,n){let{expr:r}=sf(t,e),o=_I(t,e,n),i=t_(t,1,e,n),s=t_(t,0,e,n),a=ep(t,1,e,n),c=ep(t,0,e,n),f=dt(i,Pt(ve(a,2),r)),u=dt(s,Pt(ve(c,2),r));return Pt(dt(o,Pt(mt(a,c),r)),ii(mt(f,u)))}function sf(t,e){let[n,r]=e.args,o=An(t,Wl(n,r),e);return{expr:Yt(o),name:o}}function ep(t,e,n,r){let o=n.args,i=o[e],s=o[1-e],a=Yt(dt(i,r(i))).where(vr(s));return Yt(An(t,a,n))}function t_(t,e,n,r){let o=n.args,i=o[e],s=o[1-e],a=Yt(ve(dt(i,r(i)),2)).where(vr(s));return Yt(An(t,a,n))}function _I(t,e,n){let[r,o]=e.args,i=Yt(mt(dt(o,n(o)),dt(r,n(r))));return Yt(An(t,i,e))}function SI(t,e){let[n,r]=e.args,{expr:o,name:i}=sf(t,e),s=An(t,Xl(n,r),e);return Pt(Yt(mt(s,i)),o)}function MI(t,e){let[n,r]=e.args,{expr:o,name:i}=sf(t,e),s=An(t,Zw(n,r),e);return Pt(Yt(mt(s,i)),o)}function e_(t,e,n,r){let{expr:o}=sf(t,n),i=ep(t,e,n,r),s=t_(t,e,n,r);return dt(s,Pt(ve(i,2),o))}function AI(t,e,n){let r=sg(t,e,n,null),o=e_(t,1,e,n);return Pt(r,o)}function BB(t,e,n){let r=SI(t,e),o=MI(t,e),i=AI(t,e,n);return dt(o,mt(i,r))}function EI(t){if(!t.filterStable)return null;let e=t.query();if(!ts(e))return null;let n=ag(e,c=>{let f=c._from[0]?.expr;return Ji(f)?f.name:f});if(typeof n!="string")return null;let r=new Map,o={},i={},s=[],a=c=>{let f=c.column,u=ag(e,p=>p._select.find(l=>l.alias===f)?.expr);return ye`(SELECT avg(${u??c}) FROM "${n}")`};for(let{alias:c,expr:f}of e._select){if(Mn(f)>1)return null;let u=qv(f);if(u.length===0)s.push(c),o[c]=f;else{for(let p of u){if(p.isDistinct)return null;let l=bI(p,o,a);if(!l)return null;r.set(p,l)}i[c]=Jl(f,r)}}return r.size?{group:s,preagg:o,output:i}:null}function ag(t,e){let n=t.subqueries;if(ts(t)&&n.length===0)return e(t);let r=ag(n[0],e);for(let o=1;o<n.length;++o){let i=ag(n[o],e);if(i!==void 0&&i!==r)return NaN}return r}var zB={skip:!0,result:null},cg=class{constructor(e,{schema:n="mosaic",enabled:r=!0}={}){this.entries=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}dropSchema(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.entries.clear(),this.active=null}request(e,n,r){if(!this.enabled)return null;let{entries: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=YB(r),c.source===null))return null;if(o.has(e))return o.get(e);let f=EI(e),u;if(!f)u=null;else if(n.skip(e,r))u=zB;else{let p=n.remove(a).predicate(e);u=XB(e.query(p),c,f,s),u.result=i.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,co(u.table,u.create,{temp:!1})]),u.result.catch(l=>i.logger().error(l))}return o.set(e,u),u}};function YB(t){let{source:e,meta:n}=t,r=t.predicate,o=of(r).map(p=>p.column),i,s;if(!n||!o)return{source:null,columns:s,predicate:i};let{type:a,scales:c,bin:f,pixelSize:u=1}=n;if(a==="point")i=p=>p,s=Object.fromEntries(o.map(p=>[`${p}`,Mt(p)]));else if(a==="interval"&&c){let p=c.map(l=>jB(l,u,f));p.some(l=>!l)||(p.length===1?(i=l=>l?nn("active0",l.extent.map(p[0])):[],s={active0:p[0](r.expr)}):(i=l=>l?dn(l.clauses.map((d,h)=>nn(`active${h}`,d.extent.map(p[h])))):[],s=Object.fromEntries(r.clauses.map((l,d)=>[`active${d}`,p[d](l.expr)]))))}return{source:s?e:null,columns:s,predicate:i}}var UB={ceil:mv,round:si};function jB(t,e,n){let{type:r,domain:o,range:i,apply:s,sqlApply:a}=tp(t);if(!s)return;let c=UB[`${n}`.toLowerCase()]||Ue,f=s(Math.min(...o)),u=s(Math.max(...o)),p=(r==="identity"?1:Math.abs(i[1]-i[0])/(u-f))/e,l=p===1?h=>h:h=>mt(de(p),h),d=f===0?h=>h:h=>dt(h,de(f));return h=>Gt(c(l(d(a(h)))))}function XB(t,e,n,r){let{group:o,output:i,preagg:s}=n,{columns:a}=e,c=t.setSelect({...s,...a}).groupby(Object.keys(a)),[f]=c.subqueries;if(f){let g=Object.values(a).flatMap(x=>of(x).map(y=>y.column));WB(f,g)}let u=c._having,p=c._orderby;c._having=[],c._orderby=[];let l=c.toString(),d=(og(l)>>>0).toString(16),h=`${r}.preagg_${d}`,m=st.select(o,i).from(h).groupby(o).having(u).orderby(p);return new n_({table:h,create:l,active:e,select:m})}function WB(t,e){let n=new Set,r=o=>{n.has(o)||(n.add(o),ts(o)&&o._from.length&&o.select(e),o.subqueries.forEach(r))};r(t)}var n_=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))}};function fg(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 VB="count",GB="nulls",HB="max",QB="min",ZB="distinct";var JB={[VB]:ze,[ZB]:t=>ze(t).distinct(),[HB]:en,[QB]:Xn,[GB]:t=>ze().where(Ma(t))};function KB({table:t,column:e,stats:n}){return st.from(t).select(Array.from(n,r=>({[r]:JB[r](e)})))}async function r_(t,e){return e.length===1&&e[0].column==="*"?ez(t,e[0].table):(await Promise.all(e.map(n=>tz(t,n)))).filter(n=>n)}async function tz(t,{table:e,column:n,stats:r}){let o=st.from({source:e}).select({column:n}).groupby(qe(n)&&Mn(n)?ye`ALL`:[]),[i]=Array.from(await t.query(st.describe(o))),s={table:e,column:`${n}`,sqlType:i.column_type,type:fg(i.column_type),nullable:i.null==="YES"};if(!r?.length)return s;let[a]=await t.query(KB({table:e,column:n,stats:r}),{persist:!0});return Object.assign(s,a)}async function ez(t,e){return Array.from(await t.query(`DESCRIBE ${xa(e)}`)).map(r=>({table:e,column:r.column_name,sqlType:r.column_type,type:fg(r.column_type),nullable:r.null==="YES"}))}var rs=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),Aa=class extends Promise{constructor(){let e,n;super((r,o)=>{e=r,n=o}),this._resolve=e,this._reject=n,this._state=rs.pending,this._value=void 0}fulfill(e){if(this._value!==void 0){if(e!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(e===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(e)}return this._state=rs.done,this}ready(e){return this._state=rs.ready,this._value=e,this}reject(e){return this._state=rs.error,this._reject(e),this}get state(){return this._state}};Aa.prototype.constructor=Promise;function ug(){return{debug(...t){},info(...t){},log(...t){},warn(...t){},error(...t){}}}function nz(t){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(t)}function TI(t,e){let n=[],r=0;function o(){let i=rz(n,e);n=[],r=0;for(let s of i)iz(s,t),cz(s,e)}return{add(i,s){i.request.type==="arrow"?(r=r||nz(()=>o()),n.push({entry:i,priority:s,index:n.length})):t(i,s)}}}function rz(t,e){let n=[],r=new Map;for(let o of t){let{entry:{request:i}}=o,s=oz(i.query,e);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(o)}return n}function oz(t,e){let n=`${t}`;if(ts(t)&&!e.get(n)){if(t._orderby.length||t._where.length||t._qualify.length||t._having.length)return n;let r=t.clone().setSelect("*"),o=t._groupby;if(o.length){let i={};t._select.forEach(({alias:s,expr:a})=>i[s]=a),r.setGroupby(o.map(s=>Ki(s)&&i[s.column]||s))}else t._select.some(i=>Mn(i.expr))&&r.setGroupby("ALL");return`${r}`}else return n}function iz(t,e){if(sz(t))e({request:{type:"arrow",cache:!1,query:t.query=az(t)},result:t.result=new Aa});else for(let{entry:n,priority:r}of t)e(n,r)}function sz(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 az(t){let e=t.maps=[],n=new Map;for(let i of t){let{query:s}=i.entry.request,a=[];e.push(a);for(let{alias:c,expr:f}of s._select){let u=`${f}`;n.has(u)||n.set(u,[`col${n.size}`,f]);let[p]=n.get(u);a.push([p,c])}}let r=t[0].entry.request.query.clone(),o=r._groupby;if(o.length){let i={};t.maps[0].forEach(([s,a])=>i[a]=s),r.setGroupby(o.map(s=>Ki(s)&&i[s.column]||s))}return r.setSelect(Array.from(n.values()))}async function cz(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=Pw(r);t.forEach(({entry:a},c)=>{let{request:f,result:u}=a,p=n[c],l=s&&p?uz(i,p):p?fz(i,p):i;f.cache&&e.set(String(f.query),l),u.fulfill(l)})}function fz(t,e){return t.select(e.map(n=>n[0]),e.map(n=>n[1]))}function uz(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 lz=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,II=()=>({get:()=>{},set:(t,e)=>e,clear:()=>{}});function CI({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&&lz(r),i},clear(){n=new Map}}}var lg=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 fo=Object.freeze({High:0,Normal:1,Low:2}),pg=class{constructor(e=32){this.queue=new lg(3),this.db=null,this.clientCache=null,this._logger=ug(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=e,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;let{request:e,result:n}=this.queue.next();this.pendingResults.push(n),e.type==="exec"&&(this.pendingExec=!0),this.submit(e,n).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==rs.pending;){let r=this.pendingResults.shift();r.state===rs.ready?r.fulfill():r.state===rs.done&&this._logger.warn("Found resolved query in pending results.")}e.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(e,n=fo.Normal){this.queue.insert(e,n),this.next()}async submit(e,n){try{let{query:r,type:o,cache:i=!1,options:s}=e,a=r?`${r}`:null;if(i){let p=this.clientCache.get(a);if(p){let l=await p;this._logger.debug("Cache"),n.ready(l);return}}let c=performance.now();this._logQueries&&this._logger.debug("Query",{type:o,sql:a,...s});let f=this.db.query({type:o,sql:a,...s});i&&this.clientCache.set(a,f);let u=await f;i&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-c).toFixed(1)}`),n.ready(o==="exec"?null:u)}catch(r){n.reject(r)}}cache(e){return e!==void 0?this.clientCache=e===!0?CI():e||II():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=TI(this.enqueue.bind(this),this.clientCache):!e&&this._consolidate&&(this._consolidate=null)}request(e,n=fo.Normal){let r=new Aa,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);if(n.size){this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1);for(let r of this.pendingResults)n.has(r)&&r.reject("Canceled")}}clear(){this.queue.remove(({result:e})=>(e.reject("Cleared"),!0));for(let e of this.pendingResults)e.reject("Cleared");this.pendingResults=[]}};var dg;function Sr(t){return t?dg=t:dg==null&&(dg=new np),dg}var np=class{constructor(e=M0(),{logger:n=console,manager:r=new pg,cache:o=!0,consolidate:i=!0,preagg:s={}}={}){this.manager=r,this.manager.cache(o),this.manager.consolidate(i),this.databaseConnector(e),this.logger(n),this.clear(),this.preaggregator=new cg(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||ug(),this.manager.logger(this._logger)),this._logger}cancel(e){this.manager.cancel(e)}exec(e,{priority:n=fo.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=fo.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:fo.Low})}createBundle(e,n,r=fo.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=fo.High){let r={name:e};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(e,n,r=fo.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.preaggregator.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),pz(this,e.filterBy,e)}async initializeClient(e){let n=e.fields();return n?.length&&e.fieldInfo(await r_(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 pz(t,e,n){if(!e)return;let r=t.filterGroups.get(e);if(!r){let o=s=>dz(t,e,s),i=()=>hz(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 dz(t,e,n){let{preaggregator:r,filterGroups:o}=t,{clients:i}=o.get(e);for(let s of i)r.request(s,e,n)}function hz(t,e){let{preaggregator:n,filterGroups:r}=t,{clients:o}=r.get(e),{active:i}=e;return Promise.allSettled(Array.from(o,s=>{let a=n.request(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 hg=class{constructor(){this._callbacks=new Map}addEventListener(e,n){this._callbacks.has(e)||this._callbacks.set(e,{callbacks:new Set,pending:null,queue:new o_}),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())})}}}},o_=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 rp(t,e){return t===e?!1:t instanceof Date&&e instanceof Date?+t!=+e:Array.isArray(t)&&Array.isArray(e)?mz(t,e):!0}function mz(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 _e(t){return t instanceof os}var os=class t extends hg{constructor(e){super(),this._value=e}static value(e){return new t(e)}static array(e){if(e.some(n=>_e(n))){let n=new t,r=()=>{n.update(e.map(o=>_e(o)?o.value:o))};return r(),e.forEach(o=>_e(o)?o.addEventListener("value",r):0),n}return new t(e)}get value(){return this._value}update(e,{force:n}={}){return rp(this._value,e)||n?this.emit("value",e):this.cancel("value"),this}willEmit(e,n){return e==="value"&&(this._value=n),n}};function er(t){return t instanceof uo}function mg(t,e){return new uo(new gg(t),e&&[e].flat())}var uo=class t extends os{static intersect({cross:e=!1,empty:n=!1,include:r=[]}={}){return mg({cross:e,empty:n},r)}static union({cross:e=!1,empty:n=!1,include:r=[]}={}){return mg({cross:e,empty:n,union:!0},r)}static single({cross:e=!1,empty:n=!1,include:r=[]}={}){return mg({cross:e,empty:n,single:!0},r)}static crossfilter({empty:e=!1,include:n=[]}={}){return mg({cross:!0,empty:e},n)}constructor(e=new gg,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)}},gg=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[Be(!1)];if(this.skip(r,n))return;let s=e.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return i&&s.length>1?wr(s):s}queueFilter(e){if(this.cross){let n=e.active?.source;return r=>r.active?.source!==n}return null}};function is(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=e!==void 0?K0(t,[Be(e)]):null;return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function ai(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=null;if(e){let i=e.length&&t.length===1?[K0(t[0],e.map(s=>Be(s[0])))]:e.map(s=>dn(s.map((a,c)=>Hl(t[c],Be(a)))));o=e.length===0?Be(!1):i.length>1?wr(i):i[0]}return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Ea(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scale:i,pixelSize:s=1}){let a=e!=null?nn(t,e):null;return{meta:{type:"interval",scales:i&&[i],bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}function i_(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scales:i=[],pixelSize:s=1}){let a=e!=null?dn(t.map((f,u)=>nn(f,e[u]))):null;return{meta:{type:"interval",scales:i,bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}var gz={contains:Ev,prefix:Tv,suffix:Iv,regexp:Av};function s_(t,e,{source:n,clients:r=void 0,method:o="contains"}){let i=gz[o],s=e?i(t,Be(e)):null;return{meta:{type:"match",method:o},source:n,clients:r,value:e,predicate:s}}function a_(t){return typeof t?.getChild=="function"}function c_(){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 Vn(t){return a_(t)?xz(t):yz(t)}function xz(t){let{numRows:e}=t;return{numRows:e,columns:t.toColumns()}}function yz(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 p7={};Pc(p7,{Fixed:()=>lo,Param:()=>os,Query:()=>st,Selection:()=>uo,align:()=>XM,and:()=>dn,area:()=>RE,areaX:()=>OE,areaY:()=>$E,argmax:()=>es,argmin:()=>ns,ariaDescription:()=>KM,ariaLabel:()=>JM,arrayAgg:()=>Fw,arrow:()=>IT,aspectRatio:()=>WM,avg:()=>jl,axis:()=>VM,axisFx:()=>RT,axisFy:()=>OT,axisX:()=>kT,axisY:()=>LT,barX:()=>qE,barY:()=>BE,bin:()=>TM,cast:()=>ef,cell:()=>zE,cellX:()=>YE,cellY:()=>UE,centroid:()=>Zl,centroidX:()=>Sv,centroidY:()=>Mv,circle:()=>QE,clip:()=>QM,colorBase:()=>D8,colorClamp:()=>M8,colorConstant:()=>F8,colorDomain:()=>_8,colorExponent:()=>P8,colorInterpolate:()=>I8,colorLabel:()=>k8,colorLegend:()=>f7,colorN:()=>A8,colorNice:()=>E8,colorPercent:()=>L8,colorPivot:()=>C8,colorRange:()=>S8,colorReverse:()=>R8,colorScale:()=>v8,colorScheme:()=>T8,colorSymmetric:()=>N8,colorTickFormat:()=>$8,colorZero:()=>O8,column:()=>ga,contour:()=>hT,coordinator:()=>Sr,corr:()=>qw,count:()=>ze,covarPop:()=>zw,covariance:()=>Bw,createSchema:()=>zv,createTable:()=>co,cume_dist:()=>Rv,dateDay:()=>pv,dateMonth:()=>uv,dateMonthDay:()=>lv,delaunayLink:()=>AT,delaunayMesh:()=>ET,denseLine:()=>dT,dense_rank:()=>kv,density:()=>pT,densityX:()=>uT,densityY:()=>lT,dot:()=>VE,dotX:()=>GE,dotY:()=>HE,entropy:()=>Yw,eq:()=>xv,errorbarX:()=>vT,errorbarY:()=>_T,facetGrid:()=>vA,facetLabel:()=>_A,facetMargin:()=>gA,facetMarginBottom:()=>yA,facetMarginLeft:()=>bA,facetMarginRight:()=>wA,facetMarginTop:()=>xA,first:()=>Uw,first_value:()=>Dv,float32:()=>av,float64:()=>de,frame:()=>NT,from:()=>EF,fxAlign:()=>CA,fxAriaDescription:()=>VA,fxAriaLabel:()=>WA,fxAxis:()=>RA,fxDomain:()=>SA,fxFontVariant:()=>XA,fxGrid:()=>BA,fxInset:()=>AA,fxInsetLeft:()=>EA,fxInsetRight:()=>TA,fxLabel:()=>YA,fxLabelAnchor:()=>UA,fxLabelOffset:()=>jA,fxLine:()=>zA,fxPadding:()=>NA,fxPaddingInner:()=>kA,fxPaddingOuter:()=>LA,fxRange:()=>MA,fxReverse:()=>GA,fxRound:()=>IA,fxTickFormat:()=>FA,fxTickPadding:()=>PA,fxTickRotate:()=>qA,fxTickSize:()=>$A,fxTickSpacing:()=>DA,fxTicks:()=>OA,fyAlign:()=>e8,fyAriaDescription:()=>b8,fyAriaLabel:()=>y8,fyAxis:()=>i8,fyDomain:()=>HA,fyFontVariant:()=>x8,fyGrid:()=>p8,fyInset:()=>ZA,fyInsetBottom:()=>KA,fyInsetTop:()=>JA,fyLabel:()=>h8,fyLabelAnchor:()=>m8,fyLabelOffset:()=>g8,fyLine:()=>d8,fyPadding:()=>n8,fyPaddingInner:()=>r8,fyPaddingOuter:()=>o8,fyRange:()=>QA,fyReverse:()=>w8,fyRound:()=>t8,fyTickFormat:()=>u8,fyTickPadding:()=>f8,fyTickRotate:()=>l8,fyTickSize:()=>a8,fyTickSpacing:()=>c8,fyTicks:()=>s8,geo:()=>qT,geojson:()=>Ql,graticule:()=>zT,grid:()=>HM,gridFx:()=>PT,gridFy:()=>FT,gridX:()=>$T,gridY:()=>DT,gt:()=>_r,gte:()=>yv,hconcat:()=>wF,heatmap:()=>mT,height:()=>BM,hexagon:()=>ZE,hexbin:()=>yT,hexgrid:()=>bT,highlight:()=>jT,hspace:()=>SF,hull:()=>TT,image:()=>fT,inset:()=>GM,int32:()=>Gt,intervalX:()=>XT,intervalXY:()=>VT,intervalY:()=>WT,isBetween:()=>nn,isDistinct:()=>bv,isNotBetween:()=>wv,isNotDistinct:()=>Hl,isNotNull:()=>vr,isNull:()=>Ma,kurtosis:()=>jw,lag:()=>$v,last:()=>Gw,last_value:()=>Pv,lead:()=>rf,lengthBase:()=>bE,lengthClamp:()=>mE,lengthConstant:()=>vE,lengthDomain:()=>dE,lengthExponent:()=>wE,lengthNice:()=>gE,lengthPercent:()=>xE,lengthRange:()=>hE,lengthScale:()=>pE,lengthZero:()=>yE,line:()=>DE,lineX:()=>PE,lineY:()=>FE,link:()=>CT,literal:()=>Be,loadCSV:()=>Uv,loadExtension:()=>Kl,loadJSON:()=>jv,loadObjects:()=>Vv,loadParquet:()=>Xv,loadSpatial:()=>Wv,lt:()=>ae,lte:()=>tr,mad:()=>Xw,margin:()=>DM,marginBottom:()=>jM,marginLeft:()=>zM,marginRight:()=>YM,marginTop:()=>UM,margins:()=>$M,max:()=>en,median:()=>Ww,menu:()=>hF,min:()=>Xn,mode:()=>Vw,name:()=>RM,nearest:()=>GT,nearestX:()=>HT,nearestY:()=>QT,neq:()=>jr,not:()=>gv,nth_value:()=>Fv,ntile:()=>Ov,opacityBase:()=>H8,opacityClamp:()=>Y8,opacityConstant:()=>Z8,opacityDomain:()=>B8,opacityExponent:()=>Q8,opacityLabel:()=>j8,opacityLegend:()=>u7,opacityNice:()=>U8,opacityPercent:()=>X8,opacityRange:()=>z8,opacityReverse:()=>W8,opacityScale:()=>q8,opacityTickFormat:()=>G8,opacityZero:()=>V8,or:()=>wr,padding:()=>ZM,pan:()=>n7,panX:()=>r7,panY:()=>o7,panZoom:()=>i7,panZoomX:()=>s7,panZoomY:()=>a7,percent_rank:()=>Lv,plot:()=>TF,product:()=>Hw,projectionClip:()=>LE,projectionDomain:()=>EE,projectionInset:()=>TE,projectionInsetBottom:()=>kE,projectionInsetLeft:()=>IE,projectionInsetRight:()=>CE,projectionInsetTop:()=>NE,projectionParallels:()=>SE,projectionPrecision:()=>ME,projectionRotate:()=>AE,projectionType:()=>_E,quantile:()=>Qw,rBase:()=>fE,rClamp:()=>oE,rConstant:()=>lE,rDomain:()=>nE,rExponent:()=>uE,rLabel:()=>sE,rNice:()=>iE,rPercent:()=>aE,rRange:()=>rE,rScale:()=>eE,rZero:()=>cE,rank:()=>Nv,raster:()=>gT,rasterTile:()=>xT,rect:()=>jE,rectX:()=>XE,rectY:()=>WE,region:()=>ZT,regressionY:()=>wT,row_number:()=>Cv,ruleX:()=>eT,ruleY:()=>nT,search:()=>mF,skewness:()=>nv,slider:()=>gF,sphere:()=>BT,spike:()=>cT,sql:()=>ye,stddev:()=>Vl,stddevPop:()=>rv,stringAgg:()=>ov,style:()=>FM,sum:()=>Yt,symbolDomain:()=>K8,symbolLegend:()=>l7,symbolRange:()=>tE,symbolScale:()=>J8,table:()=>xF,text:()=>JE,textX:()=>KE,textY:()=>tT,tickX:()=>rT,tickY:()=>oT,toggle:()=>Nc,toggleColor:()=>e7,toggleX:()=>JT,toggleY:()=>KT,toggleZ:()=>t7,varPop:()=>sv,variance:()=>iv,vconcat:()=>bF,vector:()=>iT,vectorX:()=>sT,vectorY:()=>aT,voronoi:()=>ST,voronoiMesh:()=>MT,vspace:()=>_F,waffleX:()=>YT,waffleY:()=>UT,width:()=>qM,xAlign:()=>f5,xAriaDescription:()=>I5,xAriaLabel:()=>T5,xAxis:()=>d5,xBase:()=>L5,xClamp:()=>a5,xConstant:()=>O5,xDomain:()=>e5,xExponent:()=>R5,xFontVariant:()=>E5,xGrid:()=>w5,xInset:()=>o5,xInsetLeft:()=>i5,xInsetRight:()=>s5,xLabel:()=>_5,xLabelAnchor:()=>S5,xLabelArrow:()=>M5,xLabelOffset:()=>A5,xLine:()=>v5,xNice:()=>r5,xPadding:()=>u5,xPaddingInner:()=>l5,xPaddingOuter:()=>p5,xPercent:()=>C5,xRange:()=>n5,xReverse:()=>N5,xRound:()=>c5,xScale:()=>t5,xTickFormat:()=>y5,xTickPadding:()=>x5,xTickRotate:()=>b5,xTickSize:()=>m5,xTickSpacing:()=>g5,xTicks:()=>h5,xZero:()=>k5,xyDomain:()=>PM,yAlign:()=>j5,yAriaDescription:()=>fA,yAriaLabel:()=>cA,yAxis:()=>G5,yBase:()=>dA,yClamp:()=>Y5,yConstant:()=>mA,yDomain:()=>D5,yExponent:()=>hA,yFontVariant:()=>aA,yGrid:()=>eA,yInset:()=>q5,yInsetBottom:()=>z5,yInsetTop:()=>B5,yLabel:()=>rA,yLabelAnchor:()=>oA,yLabelArrow:()=>iA,yLabelOffset:()=>sA,yLine:()=>nA,yNice:()=>F5,yPadding:()=>X5,yPaddingInner:()=>W5,yPaddingOuter:()=>V5,yPercent:()=>uA,yRange:()=>P5,yReverse:()=>lA,yRound:()=>U5,yScale:()=>$5,yTickFormat:()=>K5,yTickPadding:()=>J5,yTickRotate:()=>tA,yTickSize:()=>Q5,yTickSpacing:()=>Z5,yTicks:()=>H5,yZero:()=>pA});var lo=Symbol("Fixed"),rn=Symbol("Transient"),op=Symbol("Transform");var dM={};Pc(dM,{Area:()=>yc,Arrow:()=>wh,BarX:()=>bc,BarY:()=>wc,Cell:()=>vc,Contour:()=>kh,Density:()=>Oh,Dot:()=>_c,Frame:()=>dh,Geo:()=>$h,Hexgrid:()=>Dh,Image:()=>Ph,Line:()=>Sc,Link:()=>yh,Mark:()=>lt,Raster:()=>Th,Rect:()=>xc,RuleX:()=>oh,RuleY:()=>ih,Text:()=>hc,TickX:()=>Sh,TickY:()=>Mh,Tip:()=>hh,Vector:()=>gc,WaffleX:()=>qh,WaffleY:()=>Bh,area:()=>xh,areaX:()=>Vs,areaY:()=>Xi,arrow:()=>T$,auto:()=>F$,autoSpec:()=>F4,axisFx:()=>gb,axisFy:()=>mb,axisX:()=>ah,axisY:()=>sh,barX:()=>Xo,barY:()=>Wo,bin:()=>ji,binX:()=>Uo,binY:()=>jo,bollinger:()=>Zs,bollingerX:()=>j$,bollingerY:()=>X$,boxX:()=>W$,boxY:()=>V$,cell:()=>Gs,cellX:()=>C$,cellY:()=>N$,centroid:()=>Ub,circle:()=>R$,cluster:()=>XD,column:()=>Qe,contour:()=>nD,crosshair:()=>iD,crosshairX:()=>sD,crosshairY:()=>aD,delaunayLink:()=>uD,delaunayMesh:()=>lD,density:()=>gD,differenceX:()=>bD,differenceY:()=>wD,dodgeX:()=>lP,dodgeY:()=>pP,dot:()=>Pr,dotX:()=>k$,dotY:()=>L$,filter:()=>qL,find:()=>GL,formatIsoDate:()=>f4,formatMonth:()=>KR,formatNumber:()=>c4,formatWeekday:()=>tO,frame:()=>Iu,geo:()=>jb,geoCentroid:()=>_D,graticule:()=>MD,gridFx:()=>wb,gridFy:()=>yb,gridX:()=>bb,gridY:()=>xb,group:()=>Qd,groupX:()=>Ls,groupY:()=>Rs,groupZ:()=>Hd,hexagon:()=>O$,hexbin:()=>AD,hexgrid:()=>ED,hull:()=>pD,identity:()=>W,image:()=>ID,indexOf:()=>Zt,initializer:()=>Kt,interpolateNearest:()=>Ch,interpolateNone:()=>Yb,interpolatorBarycentric:()=>Ih,interpolatorRandomWalk:()=>Nh,legend:()=>HO,line:()=>Mc,lineX:()=>Hs,lineY:()=>Qs,linearRegressionX:()=>kD,linearRegressionY:()=>LD,link:()=>Rb,map:()=>Qn,mapX:()=>Ou,mapY:()=>$u,marks:()=>ke,normalize:()=>Kb,normalizeX:()=>gP,normalizeY:()=>xP,numberInterval:()=>ES,plot:()=>Cu,pointer:()=>qs,pointerX:()=>Bs,pointerY:()=>Yi,raster:()=>J$,rect:()=>ph,rectX:()=>Eu,rectY:()=>Tu,reverse:()=>BL,ruleX:()=>pr,ruleY:()=>dr,scale:()=>Os,select:()=>vP,selectFirst:()=>Uh,selectLast:()=>jh,selectMaxX:()=>r2,selectMaxY:()=>o2,selectMinX:()=>e2,selectMinY:()=>n2,shiftX:()=>yP,shiftY:()=>bP,shuffle:()=>zL,sort:()=>P1,sphere:()=>SD,spike:()=>CO,stackX:()=>T4,stackX1:()=>e$,stackX2:()=>n$,stackY:()=>I4,stackY1:()=>r$,stackY2:()=>o$,text:()=>Yo,textX:()=>cb,textY:()=>fb,tickX:()=>qb,tickY:()=>Bb,timeInterval:()=>Ud,tip:()=>Tb,transform:()=>Ne,tree:()=>oM,treeLink:()=>Hb,treeNode:()=>Fh,utcInterval:()=>oc,valueof:()=>ut,vector:()=>M4,vectorX:()=>pb,vectorY:()=>db,voronoi:()=>dD,voronoiMesh:()=>hD,waffleX:()=>ZD,waffleY:()=>JD,window:()=>Du,windowX:()=>q$,windowY:()=>B$});function yt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function En(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Xr(t){let e,n,r;t.length!==2?(e=yt,n=(a,c)=>yt(t(a),c),r=(a,c)=>t(a)-c):(e=t===yt||t===En?t:vz,n=t,r=t);function o(a,c,f=0,u=a.length){if(f<u){if(e(c,c)!==0)return u;do{let p=f+u>>>1;n(a[p],c)<0?f=p+1:u=p}while(f<u)}return f}function i(a,c,f=0,u=a.length){if(f<u){if(e(c,c)!==0)return u;do{let p=f+u>>>1;n(a[p],c)<=0?f=p+1:u=p}while(f<u)}return f}function s(a,c,f=0,u=a.length){let p=o(a,c,f,u-1);return p>f&&r(a[p-1],c)>-r(a[p],c)?p-1:p}return{left:o,center:s,right:i}}function vz(){return 0}function ip(t){return t===null?NaN:+t}function*NI(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 kI=Xr(yt),LI=kI.right,_z=kI.left,Sz=Xr(ip).center,ci=LI;var sp=RI(OI),f_=RI(Mz);function RI(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?(af(a,f,o,i,s),af(a,o,f,i,s),af(a,f,o,i,s),cf(c,o,f,i,s),cf(c,f,o,i,s),cf(c,o,f,i,s)):a?(af(a,o,f,i,s),af(a,f,o,i,s),af(a,o,f,i,s)):c&&(cf(c,o,f,i,s),cf(c,f,o,i,s),cf(c,o,f,i,s)),e}}function af(t,e,n,r,o){for(let i=0,s=r*o;i<s;)t(e,n,i,i+=r,1)}function cf(t,e,n,r,o){for(let i=0,s=r*o;i<r;++i)t(e,n,i,i+s,r)}function Mz(t){let e=OI(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 OI(t){let e=Math.floor(t);if(e===t)return Az(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],u=c*e,p=u+c;for(let l=s,d=s+u;l<d;l+=c)f+=i[Math.min(a,l)];for(let l=s,d=a;l<=d;l+=c)f+=i[Math.min(a,l+u)],o[l]=(f+n*(i[Math.max(s,l-p)]+i[Math.min(a,l+p)]))/r,f-=i[Math.max(s,l-u)]}}function Az(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,u=o+c;f<u;f+=s)a+=r[Math.min(i,f)];for(let f=o,u=i;f<=u;f+=s)a+=r[Math.min(i,f+c)],n[f]=a/e,a-=r[Math.max(o,f-c)]}}function po(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 Ez(t){return t.length|0}function Tz(t){return!(t>0)}function Iz(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function Cz(t){return e=>t(...e)}function xg(...t){let e=typeof t[t.length-1]=="function"&&Cz(t.pop());t=t.map(Iz);let n=t.map(Ez),r=t.length-1,o=new Array(r+1).fill(0),i=[];if(r<0||n.some(Tz))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 yg(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 ss(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 Mr(t,e){let n=ss(t,e);return n&&Math.sqrt(n)}function Ft(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 on=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 Tn=class extends Map{constructor(e,n=PI){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(u_(this,e))}has(e){return super.has(u_(this,e))}set(e,n){return super.set($I(this,e),n)}delete(e){return super.delete(DI(this,e))}},In=class extends Set{constructor(e,n=PI){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(u_(this,e))}add(e){return super.add($I(this,e))}delete(e){return super.delete(DI(this,e))}};function u_({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):n}function $I({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function DI({_intern:t,_key:e},n){let r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function PI(t){return t!==null&&typeof t=="object"?t.valueOf():t}function ap(t){return t}function sn(t,...e){return p_(t,ap,ap,e)}function Wr(t,e,...n){return p_(t,ap,e,n)}function l_(t,e,...n){return p_(t,Array.from,e,n)}function p_(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);let a=new Tn,c=r[s++],f=-1;for(let u of i){let p=c(u,++f,i),l=a.get(p);l?l.push(u):a.set(p,[u])}for(let[u,p]of a)a.set(u,o(p,s));return e(a)}(t,0)}function d_(t,e){return Array.from(e,n=>t[n])}function fi(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=Ta(s[o],s[i]);if(a)return a}})):(n=t.map(n),r.sort((o,i)=>Ta(n[o],n[i]))),d_(t,r)}return t.sort(cp(n))}function cp(t=yt){if(t===yt)return Ta;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 Ta(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}function ff(t,e,n){return(e.length!==2?fi(Wr(t,e,n),([r,o],[i,s])=>yt(o,s)||yt(r,i)):fi(sn(t,n),([r,o],[i,s])=>e(o,s)||yt(r,i))).map(([r])=>r)}var Nz=Math.sqrt(50),kz=Math.sqrt(10),Lz=Math.sqrt(2);function bg(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>=Nz?10:i>=kz?5:i>=Lz?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?bg(t,e,n*2):[a,c,f]}function an(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?bg(e,t,n):bg(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 ui(t,e,n){return e=+e,t=+t,n=+n,bg(t,e,n)[2]}function uf(t,e,n){e=+e,t=+t,n=+n;let r=e<t,o=r?ui(e,t,n):ui(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function lf(t,e,n){let r;for(;;){let o=ui(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 as(t){return Math.max(1,Math.ceil(Math.log(po(t))/Math.LN2)+1)}function Tt(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 wg(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 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 vg(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 _g(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?Ta:cp(o);r>n;){if(r-n>600){let c=r-n+1,f=e-n+1,u=Math.log(c),p=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*p*(c-p)/c)*(f-c/2<0?-1:1),d=Math.max(n,Math.floor(e-f*p/c+l)),h=Math.min(r,Math.floor(e+(c-f)*p/c+l));_g(t,e,d,h,o)}let i=t[e],s=n,a=r;for(fp(t,n,e),o(t[r],i)>0&&fp(t,n,r);s<a;){for(fp(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?fp(t,n,a):(++a,fp(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function fp(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Ia(t,e=yt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?yt(s,o)>0:yt(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 Cn(t,e,n){if(t=Float64Array.from(NI(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return Ct(t);if(e>=1)return Tt(t);var r,o=(r-1)*e,i=Math.floor(o),s=Tt(_g(t,i).subarray(0,i+1)),a=Ct(t.subarray(i+1));return s+(a-s)*(o-i)}}function h_(t,e,n=ip){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 Sg(t,e,n){let r=po(t),o=Cn(t,.75)-Cn(t,.25);return r&&o?Math.ceil((n-e)/(2*o*Math.pow(r,-1/3))):1}function up(t,e,n){let r=po(t),o=Mr(t);return r&&o?Math.ceil((n-e)*Math.cbrt(r)/(3.49*o)):1}function li(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 Vr(t,e){return Cn(t,.5,e)}function*Oz(t){for(let e of t)yield*e}function pf(t){return Array.from(Oz(t))}function df(t,e){let n=new Tn;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 Mg(t,e=$z){let n=[],r,o=!1;for(let i of t)o&&n.push(e(r,i)),r=i,o=!0;return n}function $z(t,e){return[t,e]}function be(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 lp(t,e=yt){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=yt);let o=(a,c)=>e(n[a],n[c]),i,s;return t=Uint32Array.from(n,(a,c)=>c),t.sort(e===yt?(a,c)=>Ta(n[a],n[c]):cp(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 Ag(t,e=yt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?yt(s,o)<0:yt(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 Le(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 cs(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function FI(t){return t}var m_=1,g_=2,x_=3,Eg=4,qI=1e-6;function Dz(t){return"translate("+t+",0)"}function Pz(t){return"translate(0,"+t+")"}function Fz(t){return e=>+t(e)}function qz(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Bz(){return!this.__axis}function zz(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===m_||t===Eg?-1:1,u=t===Eg||t===g_?"x":"y",p=t===m_||t===x_?Dz:Pz;function l(d){var h=r??(e.ticks?e.ticks.apply(e,n):e.domain()),m=o??(e.tickFormat?e.tickFormat.apply(e,n):FI),g=Math.max(i,0)+a,x=e.range(),y=+x[0]+c,b=+x[x.length-1]+c,w=(e.bandwidth?qz:Fz)(e.copy(),c),_=d.selection?d.selection():d,v=_.selectAll(".domain").data([null]),S=_.selectAll(".tick").data(h,e).order(),E=S.exit(),T=S.enter().append("g").attr("class","tick"),I=S.select("line"),A=S.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(T),I=I.merge(T.append("line").attr("stroke","currentColor").attr(u+"2",f*i)),A=A.merge(T.append("text").attr("fill","currentColor").attr(u,f*g).attr("dy",t===m_?"0em":t===x_?"0.71em":"0.32em")),d!==_&&(v=v.transition(d),S=S.transition(d),I=I.transition(d),A=A.transition(d),E=E.transition(d).attr("opacity",qI).attr("transform",function(k){return isFinite(k=w(k))?p(k+c):this.getAttribute("transform")}),T.attr("opacity",qI).attr("transform",function(k){var O=this.parentNode.__axis;return p((O&&isFinite(O=O(k))?O:w(k))+c)})),E.remove(),v.attr("d",t===Eg||t===g_?s?"M"+f*s+","+y+"H"+c+"V"+b+"H"+f*s:"M"+c+","+y+"V"+b:s?"M"+y+","+f*s+"V"+c+"H"+b+"V"+f*s:"M"+y+","+c+"H"+b),S.attr("opacity",1).attr("transform",function(k){return p(w(k)+c)}),I.attr(u+"2",f*i),A.attr(u,f*g).text(m),_.filter(Bz).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===g_?"start":t===Eg?"end":"middle"),_.each(function(){this.__axis=w})}return l.scale=function(d){return arguments.length?(e=d,l):e},l.ticks=function(){return n=Array.from(arguments),l},l.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),l):n.slice()},l.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),l):r&&r.slice()},l.tickFormat=function(d){return arguments.length?(o=d,l):o},l.tickSize=function(d){return arguments.length?(i=s=+d,l):i},l.tickSizeInner=function(d){return arguments.length?(i=+d,l):i},l.tickSizeOuter=function(d){return arguments.length?(s=+d,l):s},l.tickPadding=function(d){return arguments.length?(a=+d,l):a},l.offset=function(d){return arguments.length?(c=+d,l):c},l}function y_(t){return zz(x_,t)}var Yz={value:()=>{}};function zI(){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 Tg(n)}function Tg(t){this._=t}function Uz(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}})}Tg.prototype=zI.prototype={constructor:Tg,on:function(t,e){var n=this._,r=Uz(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=jz(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]=BI(n[o],t.name,e);else if(e==null)for(o in n)n[o]=BI(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 Tg(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 jz(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function BI(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=Yz,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Ca=zI;var Ig="http://www.w3.org/1999/xhtml",Nn={svg:"http://www.w3.org/2000/svg",xhtml:Ig,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pi(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Nn.hasOwnProperty(e)?{space:Nn[e],local:t}:t}function Xz(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ig&&e.documentElement.namespaceURI===Ig?e.createElement(t):e.createElementNS(n,t)}}function Wz(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function di(t){var e=pi(t);return(e.local?Wz:Xz)(e)}function Vz(){}function Na(t){return t==null?Vz:function(){return this.querySelector(t)}}function YI(t){typeof t!="function"&&(t=Na(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,u=0;u<s;++u)(c=i[u])&&(f=t.call(c,c.__data__,u,i))&&("__data__"in c&&(f.__data__=c.__data__),a[u]=f);return new he(r,this._parents)}function b_(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Gz(){return[]}function pp(t){return t==null?Gz:function(){return this.querySelectorAll(t)}}function Hz(t){return function(){return b_(t.apply(this,arguments))}}function UI(t){typeof t=="function"?t=Hz(t):t=pp(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 he(r,o)}function dp(t){return function(){return this.matches(t)}}function Cg(t){return function(e){return e.matches(t)}}var Qz=Array.prototype.find;function Zz(t){return function(){return Qz.call(this.children,t)}}function Jz(){return this.firstElementChild}function jI(t){return this.select(t==null?Jz:Zz(typeof t=="function"?t:Cg(t)))}var Kz=Array.prototype.filter;function tY(){return Array.from(this.children)}function eY(t){return function(){return Kz.call(this.children,t)}}function XI(t){return this.selectAll(t==null?tY:eY(typeof t=="function"?t:Cg(t)))}function WI(t){typeof t!="function"&&(t=dp(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 he(r,this._parents)}function Ng(t){return new Array(t.length)}function VI(){return new he(this._enter||this._groups.map(Ng),this._parents)}function hp(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}hp.prototype={constructor:hp,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 GI(t){return function(){return t}}function nY(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 hp(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function rY(t,e,n,r,o,i,s){var a,c,f=new Map,u=e.length,p=i.length,l=new Array(u),d;for(a=0;a<u;++a)(c=e[a])&&(l[a]=d=s.call(c,c.__data__,a,e)+"",f.has(d)?o[a]=c:f.set(d,c));for(a=0;a<p;++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 hp(t,i[a]);for(a=0;a<u;++a)(c=e[a])&&f.get(l[a])===c&&(o[a]=c)}function oY(t){return t.__data__}function HI(t,e){if(!arguments.length)return Array.from(this,oY);var n=e?rY:nY,r=this._parents,o=this._groups;typeof t!="function"&&(t=GI(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),f=0;f<i;++f){var u=r[f],p=o[f],l=p.length,d=iY(t.call(u,u&&u.__data__,f,r)),h=d.length,m=a[f]=new Array(h),g=s[f]=new Array(h),x=c[f]=new Array(l);n(u,p,m,g,x,d,e);for(var y=0,b=0,w,_;y<h;++y)if(w=m[y]){for(y>=b&&(b=y+1);!(_=g[b])&&++b<h;);w._next=_||null}}return s=new he(s,r),s._enter=a,s._exit=c,s}function iY(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function QI(){return new he(this._exit||this._groups.map(Ng),this._parents)}function ZI(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 JI(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],u=r[c],p=f.length,l=a[c]=new Array(p),d,h=0;h<p;++h)(d=f[h]||u[h])&&(l[h]=d);for(;c<o;++c)a[c]=n[c];return new he(a,this._parents)}function KI(){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 tC(t){t||(t=sY);function e(p,l){return p&&l?t(p.__data__,l.__data__):!p-!l}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,u=0;u<a;++u)(f=s[u])&&(c[u]=f);c.sort(e)}return new he(o,this._parents).order()}function sY(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function eC(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function nC(){return Array.from(this)}function rC(){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 oC(){let t=0;for(let e of this)++t;return t}function iC(){return!this.node()}function sC(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 aY(t){return function(){this.removeAttribute(t)}}function cY(t){return function(){this.removeAttributeNS(t.space,t.local)}}function fY(t,e){return function(){this.setAttribute(t,e)}}function uY(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function lY(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function pY(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 aC(t,e){var n=pi(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?cY:aY:typeof e=="function"?n.local?pY:lY:n.local?uY:fY)(n,e))}function kg(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function dY(t){return function(){this.style.removeProperty(t)}}function hY(t,e,n){return function(){this.style.setProperty(t,e,n)}}function mY(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function cC(t,e,n){return arguments.length>1?this.each((e==null?dY:typeof e=="function"?mY:hY)(t,e,n??"")):fs(this.node(),t)}function fs(t,e){return t.style.getPropertyValue(e)||kg(t).getComputedStyle(t,null).getPropertyValue(e)}function gY(t){return function(){delete this[t]}}function xY(t,e){return function(){this[t]=e}}function yY(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function fC(t,e){return arguments.length>1?this.each((e==null?gY:typeof e=="function"?yY:xY)(t,e)):this.node()[t]}function uC(t){return t.trim().split(/^|\s+/)}function w_(t){return t.classList||new lC(t)}function lC(t){this._node=t,this._names=uC(t.getAttribute("class")||"")}lC.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 pC(t,e){for(var n=w_(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function dC(t,e){for(var n=w_(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function bY(t){return function(){pC(this,t)}}function wY(t){return function(){dC(this,t)}}function vY(t,e){return function(){(e.apply(this,arguments)?pC:dC)(this,t)}}function hC(t,e){var n=uC(t+"");if(arguments.length<2){for(var r=w_(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?vY:e?bY:wY)(n,e))}function _Y(){this.textContent=""}function SY(t){return function(){this.textContent=t}}function MY(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function mC(t){return arguments.length?this.each(t==null?_Y:(typeof t=="function"?MY:SY)(t)):this.node().textContent}function AY(){this.innerHTML=""}function EY(t){return function(){this.innerHTML=t}}function TY(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function gC(t){return arguments.length?this.each(t==null?AY:(typeof t=="function"?TY:EY)(t)):this.node().innerHTML}function IY(){this.nextSibling&&this.parentNode.appendChild(this)}function xC(){return this.each(IY)}function CY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yC(){return this.each(CY)}function bC(t){var e=typeof t=="function"?t:di(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function NY(){return null}function wC(t,e){var n=typeof t=="function"?t:di(t),r=e==null?NY:typeof e=="function"?e:Na(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kY(){var t=this.parentNode;t&&t.removeChild(this)}function vC(){return this.each(kY)}function LY(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function RY(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function _C(t){return this.select(t?RY:LY)}function SC(t){return arguments.length?this.property("__data__",t):this.node().__data__}function OY(t){return function(e){t.call(this,e,this.__data__)}}function $Y(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 DY(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 PY(t,e,n){return function(){var r=this.__on,o,i=OY(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 MC(t,e,n){var r=$Y(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,f=a.length,u;c<f;++c)for(o=0,u=a[c];o<i;++o)if((s=r[o]).type===u.type&&s.name===u.name)return u.value}return}for(a=e?PY:DY,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function AC(t,e,n){var r=kg(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 FY(t,e){return function(){return AC(this,t,e)}}function qY(t,e){return function(){return AC(this,t,e.apply(this,arguments))}}function EC(t,e){return this.each((typeof e=="function"?qY:FY)(t,e))}function*TC(){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 v_=[null];function he(t,e){this._groups=t,this._parents=e}function IC(){return new he([[document.documentElement]],v_)}function BY(){return this}he.prototype=IC.prototype={constructor:he,select:YI,selectAll:UI,selectChild:jI,selectChildren:XI,filter:WI,data:HI,enter:VI,exit:QI,join:ZI,merge:JI,selection:BY,order:KI,sort:tC,call:eC,nodes:nC,node:rC,size:oC,empty:iC,each:sC,attr:aC,style:cC,property:fC,classed:hC,text:mC,html:gC,raise:xC,lower:yC,append:bC,insert:wC,remove:vC,clone:_C,datum:SC,on:MC,dispatch:EC,[Symbol.iterator]:TC};var hi=IC;function Nt(t){return typeof t=="string"?new he([[document.querySelector(t)]],[document.documentElement]):new he([[t]],v_)}function CC(t){let e;for(;e=t.sourceEvent;)t=e;return t}function hn(t,e){if(t=CC(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 Lg={capture:!0,passive:!1};function Rg(t){t.preventDefault(),t.stopImmediatePropagation()}function mp(t){var e=t.document.documentElement,n=Nt(t).on("dragstart.drag",Rg,Lg);"onselectstart"in e?n.on("selectstart.drag",Rg,Lg):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function gp(t,e){var n=t.document.documentElement,r=Nt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Rg,Lg),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 mi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function us(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function mo(){}var ls=.7,Ra=1/ls,hf="\\s*([+-]?\\d+)\\s*",xp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zY=/^#([0-9a-f]{3,8})$/,YY=new RegExp(`^rgb\\(${hf},${hf},${hf}\\)$`),UY=new RegExp(`^rgb\\(${ho},${ho},${ho}\\)$`),jY=new RegExp(`^rgba\\(${hf},${hf},${hf},${xp}\\)$`),XY=new RegExp(`^rgba\\(${ho},${ho},${ho},${xp}\\)$`),WY=new RegExp(`^hsl\\(${xp},${ho},${ho}\\)$`),VY=new RegExp(`^hsla\\(${xp},${ho},${ho},${xp}\\)$`),NC={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};mi(mo,nr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:kC,formatHex:kC,formatHex8:GY,formatHsl:HY,formatRgb:LC,toString:LC});function kC(){return this.rgb().formatHex()}function GY(){return this.rgb().formatHex8()}function HY(){return FC(this).formatHsl()}function LC(){return this.rgb().formatRgb()}function nr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=zY.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?RC(e):n===3?new Se(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Og(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Og(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=YY.exec(t))?new Se(e[1],e[2],e[3],1):(e=UY.exec(t))?new Se(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=jY.exec(t))?Og(e[1],e[2],e[3],e[4]):(e=XY.exec(t))?Og(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=WY.exec(t))?DC(e[1],e[2]/100,e[3]/100,1):(e=VY.exec(t))?DC(e[1],e[2]/100,e[3]/100,e[4]):NC.hasOwnProperty(t)?RC(NC[t]):t==="transparent"?new Se(NaN,NaN,NaN,0):null}function RC(t){return new Se(t>>16&255,t>>8&255,t&255,1)}function Og(t,e,n,r){return r<=0&&(t=e=n=NaN),new Se(t,e,n,r)}function yp(t){return t instanceof mo||(t=nr(t)),t?(t=t.rgb(),new Se(t.r,t.g,t.b,t.opacity)):new Se}function Re(t,e,n,r){return arguments.length===1?yp(t):new Se(t,e,n,r??1)}function Se(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}mi(Se,Re,us(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ls:Math.pow(ls,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Se(La(this.r),La(this.g),La(this.b),Dg(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:OC,formatHex:OC,formatHex8:QY,formatRgb:$C,toString:$C}));function OC(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}`}function QY(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}${ka((isNaN(this.opacity)?1:this.opacity)*255)}`}function $C(){let t=Dg(this.opacity);return`${t===1?"rgb(":"rgba("}${La(this.r)}, ${La(this.g)}, ${La(this.b)}${t===1?")":`, ${t})`}`}function Dg(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function La(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ka(t){return t=La(t),(t<16?"0":"")+t.toString(16)}function DC(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Gr(t,e,n,r)}function FC(t){if(t instanceof Gr)return new Gr(t.h,t.s,t.l,t.opacity);if(t instanceof mo||(t=nr(t)),!t)return new Gr;if(t instanceof Gr)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 Gr(s,a,c,t.opacity)}function bp(t,e,n,r){return arguments.length===1?FC(t):new Gr(t,e,n,r??1)}function Gr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}mi(Gr,bp,us(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Gr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ls:Math.pow(ls,t),new Gr(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 Se(__(t>=240?t-240:t+120,o,r),__(t,o,r),__(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Gr(PC(this.h),$g(this.s),$g(this.l),Dg(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=Dg(this.opacity);return`${t===1?"hsl(":"hsla("}${PC(this.h)}, ${$g(this.s)*100}%, ${$g(this.l)*100}%${t===1?")":`, ${t})`}`}}));function PC(t){return t=(t||0)%360,t<0?t+360:t}function $g(t){return Math.max(0,Math.min(1,t||0))}function __(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 Pg=Math.PI/180,Fg=180/Math.PI;var qg=18,qC=.96422,BC=1,zC=.82521,YC=4/29,mf=6/29,UC=3*mf*mf,ZY=mf*mf*mf;function jC(t){if(t instanceof go)return new go(t.l,t.a,t.b,t.opacity);if(t instanceof gi)return XC(t);t instanceof Se||(t=yp(t));var e=E_(t.r),n=E_(t.g),r=E_(t.b),o=S_((.2225045*e+.7168786*n+.0606169*r)/BC),i,s;return e===n&&n===r?i=s=o:(i=S_((.4360747*e+.3850649*n+.1430804*r)/qC),s=S_((.0139322*e+.0971045*n+.7141733*r)/zC)),new go(116*o-16,500*(i-o),200*(o-s),t.opacity)}function gf(t,e,n,r){return arguments.length===1?jC(t):new go(t,e,n,r??1)}function go(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}mi(go,gf,us(mo,{brighter(t){return new go(this.l+qg*(t??1),this.a,this.b,this.opacity)},darker(t){return new go(this.l-qg*(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=qC*M_(e),t=BC*M_(t),n=zC*M_(n),new Se(A_(3.1338561*e-1.6168667*t-.4906146*n),A_(-.9787684*e+1.9161415*t+.033454*n),A_(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function S_(t){return t>ZY?Math.pow(t,1/3):t/UC+YC}function M_(t){return t>mf?t*t*t:UC*(t-YC)}function A_(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function E_(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function JY(t){if(t instanceof gi)return new gi(t.h,t.c,t.l,t.opacity);if(t instanceof go||(t=jC(t)),t.a===0&&t.b===0)return new gi(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Fg;return new gi(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function wp(t,e,n,r){return arguments.length===1?JY(t):new gi(t,e,n,r??1)}function gi(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function XC(t){if(isNaN(t.h))return new go(t.l,0,0,t.opacity);var e=t.h*Pg;return new go(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}mi(gi,wp,us(mo,{brighter(t){return new gi(this.h,this.c,this.l+qg*(t??1),this.opacity)},darker(t){return new gi(this.h,this.c,this.l-qg*(t??1),this.opacity)},rgb(){return XC(this).rgb()}}));var HC=-.14861,T_=1.78277,I_=-.29227,Bg=-.90649,vp=1.97294,WC=vp*Bg,VC=vp*T_,GC=T_*I_-Bg*HC;function KY(t){if(t instanceof Oa)return new Oa(t.h,t.s,t.l,t.opacity);t instanceof Se||(t=yp(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(GC*r+WC*e-VC*n)/(GC+WC-VC),i=r-o,s=(vp*(n-o)-I_*i)/Bg,a=Math.sqrt(s*s+i*i)/(vp*o*(1-o)),c=a?Math.atan2(s,i)*Fg-120:NaN;return new Oa(c<0?c+360:c,a,o,t.opacity)}function kn(t,e,n,r){return arguments.length===1?KY(t):new Oa(t,e,n,r??1)}function Oa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}mi(Oa,kn,us(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Oa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ls:Math.pow(ls,t),new Oa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Pg,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new Se(255*(e+n*(HC*r+T_*o)),255*(e+n*(I_*r+Bg*o)),255*(e+n*(vp*r)),this.opacity)}}));function C_(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 QC(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 C_((n-r/e)*e,s,o,i,a)}}function ZC(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 C_((n-r/e)*e,o,i,s,a)}}var xf=t=>()=>t;function JC(t,e){return function(n){return t+n*e}}function tU(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 yf(t,e){var n=e-t;return n?JC(t,n>180||n<-180?n-360*Math.round(n/360):n):xf(isNaN(t)?e:t)}function KC(t){return(t=+t)==1?re:function(e,n){return n-e?tU(e,n,t):xf(isNaN(e)?n:e)}}function re(t,e){var n=e-t;return n?JC(t,n):xf(isNaN(t)?e:t)}var Ar=function t(e){var n=KC(e);function r(o,i){var s=n((o=Re(o)).r,(i=Re(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),f=re(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=f(u),o+""}}return r.gamma=t,r}(1);function tN(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=Re(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 N_=tN(QC),eU=tN(ZC);function eN(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 nN(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function rN(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]=rr(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 oN(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function ee(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function iN(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]=rr(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var L_=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,k_=new RegExp(L_.source,"g");function nU(t){return function(){return t}}function rU(t){return function(e){return t(e)+""}}function _p(t,e){var n=L_.lastIndex=k_.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=L_.exec(t))&&(o=k_.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:ee(r,o)})),n=k_.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?rU(c[0].x):nU(e):(e=c.length,function(f){for(var u=0,p;u<e;++u)a[(p=c[u]).i]=p.x(f);return a.join("")})}function rr(t,e){var n=typeof e,r;return e==null||n==="boolean"?xf(e):(n==="number"?ee:n==="string"?(r=nr(e))?(e=r,Ar):_p:e instanceof nr?Ar:e instanceof Date?oN:nN(e)?eN:Array.isArray(e)?rN:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?iN:ee)(t,e)}function $a(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var sN=180/Math.PI,zg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function R_(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)*sN,skewX:Math.atan(c)*sN,scaleX:s,scaleY:a}}var Yg;function aN(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?zg:R_(e.a,e.b,e.c,e.d,e.e,e.f)}function cN(t){return t==null?zg:(Yg||(Yg=document.createElementNS("http://www.w3.org/2000/svg","g")),Yg.setAttribute("transform",t),(t=Yg.transform.baseVal.consolidate())?(t=t.matrix,R_(t.a,t.b,t.c,t.d,t.e,t.f)):zg)}function fN(t,e,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,u,p,l,d,h){if(f!==p||u!==l){var m=d.push("translate(",null,e,null,n);h.push({i:m-4,x:ee(f,p)},{i:m-2,x:ee(u,l)})}else(p||l)&&d.push("translate("+p+e+l+n)}function s(f,u,p,l){f!==u?(f-u>180?u+=360:u-f>180&&(f+=360),l.push({i:p.push(o(p)+"rotate(",null,r)-2,x:ee(f,u)})):u&&p.push(o(p)+"rotate("+u+r)}function a(f,u,p,l){f!==u?l.push({i:p.push(o(p)+"skewX(",null,r)-2,x:ee(f,u)}):u&&p.push(o(p)+"skewX("+u+r)}function c(f,u,p,l,d,h){if(f!==p||u!==l){var m=d.push(o(d)+"scale(",null,",",null,")");h.push({i:m-4,x:ee(f,p)},{i:m-2,x:ee(u,l)})}else(p!==1||l!==1)&&d.push(o(d)+"scale("+p+","+l+")")}return function(f,u){var p=[],l=[];return f=t(f),u=t(u),i(f.translateX,f.translateY,u.translateX,u.translateY,p,l),s(f.rotate,u.rotate,p,l),a(f.skewX,u.skewX,p,l),c(f.scaleX,f.scaleY,u.scaleX,u.scaleY,p,l),f=u=null,function(d){for(var h=-1,m=l.length,g;++h<m;)p[(g=l[h]).i]=g.x(d);return p.join("")}}}var O_=fN(aN,"px, ","px)","deg)"),$_=fN(cN,", ",")",")");var oU=1e-12;function uN(t){return((t=Math.exp(t))+1/t)/2}function iU(t){return((t=Math.exp(t))-1/t)/2}function sU(t){return((t=Math.exp(2*t))-1)/(t+1)}var D_=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],f=i[2],u=s[0],p=s[1],l=s[2],d=u-a,h=p-c,m=d*d+h*h,g,x;if(m<oU)x=Math.log(l/f)/e,g=function(S){return[a+S*d,c+S*h,f*Math.exp(e*S*x)]};else{var y=Math.sqrt(m),b=(l*l-f*f+r*m)/(2*f*n*y),w=(l*l-f*f-r*m)/(2*l*n*y),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);x=(v-_)/e,g=function(S){var E=S*x,T=uN(_),I=f/(n*y)*(T*sU(e*E+_)-iU(_));return[a+I*d,c+I*h,f*T/uN(e*E+_)]}}return g.duration=x*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 lN(t){return function(e,n){var r=t((e=bp(e)).h,(n=bp(n)).h),o=re(e.s,n.s),i=re(e.l,n.l),s=re(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 P_=lN(yf),aU=lN(re);function Ug(t,e){var n=re((t=gf(t)).l,(e=gf(e)).l),r=re(t.a,e.a),o=re(t.b,e.b),i=re(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 pN(t){return function(e,n){var r=t((e=wp(e)).h,(n=wp(n)).h),o=re(e.c,n.c),i=re(e.l,n.l),s=re(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 F_=pN(yf),cU=pN(re);function dN(t){return function e(n){n=+n;function r(o,i){var s=t((o=kn(o)).h,(i=kn(i)).h),a=re(o.s,i.s),c=re(o.l,i.l),f=re(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=c(Math.pow(u,n)),o.opacity=f(u),o+""}}return r.gamma=e,r}(1)}var fU=dN(yf),bf=dN(re);function xo(t,e){e===void 0&&(e=t,t=rr);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 mn(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}var wf=0,Mp=0,Sp=0,mN=1e3,jg,Ap,Xg=0,Da=0,Wg=0,Ep=typeof performance=="object"&&performance.now?performance:Date,gN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ip(){return Da||(gN(uU),Da=Ep.now()+Wg)}function uU(){Da=0}function Tp(){this._call=this._time=this._next=null}Tp.prototype=Vg.prototype={constructor:Tp,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ip():+n)+(e==null?0:+e),!this._next&&Ap!==this&&(Ap?Ap._next=this:jg=this,Ap=this),this._call=t,this._time=n,q_()},stop:function(){this._call&&(this._call=null,this._time=1/0,q_())}};function Vg(t,e,n){var r=new Tp;return r.restart(t,e,n),r}function xN(){Ip(),++wf;for(var t=jg,e;t;)(e=Da-t._time)>=0&&t._call.call(void 0,e),t=t._next;--wf}function hN(){Da=(Xg=Ep.now())+Wg,wf=Mp=0;try{xN()}finally{wf=0,pU(),Da=0}}function lU(){var t=Ep.now(),e=t-Xg;e>mN&&(Wg-=e,Xg=t)}function pU(){for(var t,e=jg,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:jg=n);Ap=t,q_(r)}function q_(t){if(!wf){Mp&&(Mp=clearTimeout(Mp));var e=t-Da;e>24?(t<1/0&&(Mp=setTimeout(hN,t-Ep.now()-Wg)),Sp&&(Sp=clearInterval(Sp))):(Sp||(Xg=Ep.now(),Sp=setInterval(lU,mN)),wf=1,gN(hN))}}function Gg(t,e,n){var r=new Tp;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var dU=Ca("start","end","cancel","interrupt"),hU=[],wN=0,yN=1,Qg=2,Hg=3,bN=4,Zg=5,Cp=6;function ps(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;mU(t,n,{name:e,index:r,group:o,on:dU,tween:hU,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:wN})}function Np(t,e){var n=Oe(t,e);if(n.state>wN)throw new Error("too late; already scheduled");return n}function cn(t,e){var n=Oe(t,e);if(n.state>Hg)throw new Error("too late; already running");return n}function Oe(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function mU(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Vg(i,0,n.time);function i(f){n.state=yN,n.timer.restart(s,n.delay,n.time),n.delay<=f&&s(f-n.delay)}function s(f){var u,p,l,d;if(n.state!==yN)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===Hg)return Gg(s);d.state===bN?(d.state=Cp,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[u]):+u<e&&(d.state=Cp,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[u])}if(Gg(function(){n.state===Hg&&(n.state=bN,n.timer.restart(a,n.delay,n.time),a(f))}),n.state=Qg,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Qg){for(n.state=Hg,o=new Array(l=n.tween.length),u=0,p=-1;u<l;++u)(d=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(o[++p]=d);o.length=p+1}}function a(f){for(var u=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(c),n.state=Zg,1),p=-1,l=o.length;++p<l;)o[p].call(t,u);n.state===Zg&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Cp,n.timer.stop(),delete r[e];for(var f in r)return;delete t.__transition}}function yo(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>Qg&&r.state<Zg,r.state=Cp,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function vN(t){return this.each(function(){yo(this,t)})}function gU(t,e){var n,r;return function(){var o=cn(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 xU(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=cn(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 _N(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Oe(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?gU:xU)(n,t,e))}function vf(t,e,n){var r=t._id;return t.each(function(){var o=cn(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return Oe(o,r).value[e]}}function Jg(t,e){var n;return(typeof e=="number"?ee:e instanceof nr?Ar:(n=nr(e))?(e=n,Ar):_p)(t,e)}function yU(t){return function(){this.removeAttribute(t)}}function bU(t){return function(){this.removeAttributeNS(t.space,t.local)}}function wU(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 vU(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 _U(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 SU(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 SN(t,e){var n=pi(t),r=n==="transform"?$_:Jg;return this.attrTween(t,typeof e=="function"?(n.local?SU:_U)(n,r,vf(this,"attr."+t,e)):e==null?(n.local?bU:yU)(n):(n.local?vU:wU)(n,r,e))}function MU(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function AU(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function EU(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&AU(t,i)),n}return o._value=e,o}function TU(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&MU(t,i)),n}return o._value=e,o}function MN(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=pi(t);return this.tween(n,(r.local?EU:TU)(r,e))}function IU(t,e){return function(){Np(this,t).delay=+e.apply(this,arguments)}}function CU(t,e){return e=+e,function(){Np(this,t).delay=e}}function AN(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?IU:CU)(e,t)):Oe(this.node(),e).delay}function NU(t,e){return function(){cn(this,t).duration=+e.apply(this,arguments)}}function kU(t,e){return e=+e,function(){cn(this,t).duration=e}}function EN(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?NU:kU)(e,t)):Oe(this.node(),e).duration}function LU(t,e){if(typeof e!="function")throw new Error;return function(){cn(this,t).ease=e}}function TN(t){var e=this._id;return arguments.length?this.each(LU(e,t)):Oe(this.node(),e).ease}function RU(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;cn(this,t).ease=n}}function IN(t){if(typeof t!="function")throw new Error;return this.each(RU(this._id,t))}function CN(t){typeof t!="function"&&(t=dp(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 Ln(r,this._parents,this._name,this._id)}function NN(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],u=c.length,p=s[a]=new Array(u),l,d=0;d<u;++d)(l=c[d]||f[d])&&(p[d]=l);for(;a<r;++a)s[a]=e[a];return new Ln(s,this._parents,this._name,this._id)}function OU(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 $U(t,e,n){var r,o,i=OU(e)?Np:cn;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function kN(t,e){var n=this._id;return arguments.length<2?Oe(this.node(),n).on.on(t):this.each($U(n,t,e))}function DU(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function LN(){return this.on("end.remove",DU(this._id))}function RN(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Na(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),u,p,l=0;l<c;++l)(u=a[l])&&(p=t.call(u,u.__data__,l,a))&&("__data__"in u&&(p.__data__=u.__data__),f[l]=p,ps(f[l],e,n,l,f,Oe(u,n)));return new Ln(i,this._parents,e,n)}function ON(t){var e=this._name,n=this._id;typeof t!="function"&&(t=pp(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],f=c.length,u,p=0;p<f;++p)if(u=c[p]){for(var l=t.call(u,u.__data__,p,c),d,h=Oe(u,n),m=0,g=l.length;m<g;++m)(d=l[m])&&ps(d,e,n,m,l,h);i.push(l),s.push(u)}return new Ln(i,s,e,n)}var PU=hi.prototype.constructor;function $N(){return new PU(this._groups,this._parents)}function FU(t,e){var n,r,o;return function(){var i=fs(this,t),s=(this.style.removeProperty(t),fs(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function DN(t){return function(){this.style.removeProperty(t)}}function qU(t,e,n){var r,o=n+"",i;return function(){var s=fs(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function BU(t,e,n){var r,o,i;return function(){var s=fs(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),fs(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function zU(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=cn(this,t),f=c.on,u=c.value[i]==null?a||(a=DN(e)):void 0;(f!==n||o!==u)&&(r=(n=f).copy()).on(s,o=u),c.on=r}}function PN(t,e,n){var r=(t+="")=="transform"?O_:Jg;return e==null?this.styleTween(t,FU(t,r)).on("end.style."+t,DN(t)):typeof e=="function"?this.styleTween(t,BU(t,r,vf(this,"style."+t,e))).each(zU(this._id,t)):this.styleTween(t,qU(t,r,e),n).on("end.style."+t,null)}function YU(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function UU(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&YU(t,s,n)),r}return i._value=e,i}function FN(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,UU(t,e,n??""))}function jU(t){return function(){this.textContent=t}}function XU(t){return function(){var e=t(this);this.textContent=e??""}}function qN(t){return this.tween("text",typeof t=="function"?XU(vf(this,"text",t)):jU(t==null?"":t+""))}function WU(t){return function(e){this.textContent=t.call(this,e)}}function VU(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&WU(o)),e}return r._value=t,r}function BN(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,VU(t))}function zN(){for(var t=this._name,e=this._id,n=Kg(),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 u=Oe(c,e);ps(c,t,n,f,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ln(r,this._parents,t,n)}function YN(){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=cn(this,r),u=f.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),f.on=e}),o===0&&i()})}var GU=0;function Ln(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function UN(t){return hi().transition(t)}function Kg(){return++GU}var xi=hi.prototype;Ln.prototype=UN.prototype={constructor:Ln,select:RN,selectAll:ON,selectChild:xi.selectChild,selectChildren:xi.selectChildren,filter:CN,merge:NN,selection:$N,transition:zN,call:xi.call,nodes:xi.nodes,node:xi.node,size:xi.size,empty:xi.empty,each:xi.each,on:kN,attr:SN,attrTween:MN,style:PN,styleTween:FN,text:qN,textTween:BN,remove:LN,tween:_N,delay:AN,duration:EN,ease:TN,easeVarying:IN,end:YN,[Symbol.iterator]:xi[Symbol.iterator]};function tx(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var HU={time:null,delay:0,duration:250,ease:tx};function QU(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 jN(t){var e,n;t instanceof Ln?(e=t._id,t=t._name):(e=Kg(),(n=HU).time=Ip(),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])&&ps(c,t,e,f,s,n||QU(c,e));return new Ln(r,this._parents,t,e)}hi.prototype.interrupt=vN;hi.prototype.transition=jN;var ex=t=>()=>t;function B_(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 XN(t){t.stopImmediatePropagation()}function nx(t){t.preventDefault(),t.stopImmediatePropagation()}var WN={name:"drag"},z_={name:"space"},_f={name:"handle"},Sf={name:"center"},{abs:VN,max:gn,min:xn}=Math;function GN(t){return[+t[0],+t[1]]}function U_(t){return[GN(t[0]),GN(t[1])]}var rx={name:"x",handles:["w","e"].map(kp),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]]}},ox={name:"y",handles:["n","s"].map(kp),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]]}},ZU={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(kp),input:function(t){return t==null?null:U_(t)},output:function(t){return t}},yi={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"},HN={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},QN={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},JU={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},KU={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function kp(t){return{type:t}}function tj(t){return!t.ctrlKey&&!t.button}function ej(){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 nj(){return navigator.maxTouchPoints||"ontouchstart"in this}function Y_(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function rj(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function j_(){return V_(rx)}function X_(){return V_(ox)}function W_(){return V_(ZU)}function V_(t){var e=ej,n=tj,r=nj,o=!0,i=Ca("start","brush","end"),s=6,a;function c(g){var x=g.property("__brush",m).selectAll(".overlay").data([kp("overlay")]);x.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",yi.overlay).merge(x).each(function(){var b=Y_(this).extent;Nt(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([kp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",yi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var y=g.selectAll(".handle").data(t.handles,function(b){return b.type});y.exit().remove(),y.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return yi[b.type]}),g.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",l).filter(r).on("touchstart.brush",l).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,x,y){g.tween?g.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,S=t.input(typeof x=="function"?x.apply(this,arguments):x,w.extent),E=rr(v,S);function T(I){w.selection=I===1&&S===null?null:E(I),f.call(b),_.brush()}return v!==null&&S!==null?T:T(1)}):g.each(function(){var b=this,w=arguments,_=b.__brush,v=t.input(typeof x=="function"?x.apply(b,w):x,_.extent),S=u(b,w).beforestart();yo(b),_.selection=v===null?null:v,f.call(b),S.start(y).brush(y).end(y)})},c.clear=function(g,x){c.move(g,null,x)};function f(){var g=Nt(this),x=Y_(this).selection;x?(g.selectAll(".selection").style("display",null).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(y){return y.type[y.type.length-1]==="e"?x[1][0]-s/2:x[0][0]-s/2}).attr("y",function(y){return y.type[0]==="s"?x[1][1]-s/2:x[0][1]-s/2}).attr("width",function(y){return y.type==="n"||y.type==="s"?x[1][0]-x[0][0]+s:s}).attr("height",function(y){return y.type==="e"||y.type==="w"?x[1][1]-x[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,x,y){var b=g.__brush.emitter;return b&&(!y||!b.clean)?b:new p(g,x,y)}function p(g,x,y){this.that=g,this.args=x,this.state=g.__brush,this.active=0,this.clean=y}p.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(g,x){return this.starting?(this.starting=!1,this.emit("start",g,x)):this.emit("brush",g),this},brush:function(g,x){return this.emit("brush",g,x),this},end:function(g,x){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,x)),this},emit:function(g,x,y){var b=Nt(this.that).datum();i.call(g,this.that,new B_(g,{sourceEvent:x,target:c,selection:t.output(this.state.selection),mode:y,dispatch:i}),b)}};function l(g){if(a&&!g.touches||!n.apply(this,arguments))return;var x=this,y=g.target.__data__.type,b=(o&&g.metaKey?y="overlay":y)==="selection"?WN:o&&g.altKey?Sf:_f,w=t===ox?null:JU[y],_=t===rx?null:KU[y],v=Y_(x),S=v.extent,E=v.selection,T=S[0][0],I,A,k=S[0][1],O,M,C=S[1][0],N,L,D=S[1][1],$,P,F=0,q=0,V,K=w&&_&&o&&g.shiftKey,et,rt,j=Array.from(g.touches||[g],Z=>{let jt=Z.identifier;return Z=hn(Z,x),Z.point0=Z.slice(),Z.identifier=jt,Z});yo(x);var nt=u(x,arguments,!0).beforestart();if(y==="overlay"){E&&(V=!0);let Z=[j[0],j[1]||j[0]];v.selection=E=[[I=t===ox?T:xn(Z[0][0],Z[1][0]),O=t===rx?k:xn(Z[0][1],Z[1][1])],[N=t===ox?C:gn(Z[0][0],Z[1][0]),$=t===rx?D:gn(Z[0][1],Z[1][1])]],j.length>1&&_t(g)}else I=E[0][0],O=E[0][1],N=E[1][0],$=E[1][1];A=I,M=O,L=N,P=$;var Y=Nt(x).attr("pointer-events","none"),G=Y.selectAll(".overlay").attr("cursor",yi[y]);if(g.touches)nt.moved=B,nt.ended=ct;else{var tt=Nt(g.view).on("mousemove.brush",B,!0).on("mouseup.brush",ct,!0);o&&tt.on("keydown.brush",kt,!0).on("keyup.brush",Lt,!0),mp(g.view)}f.call(x),nt.start(g,b.name);function B(Z){for(let jt of Z.changedTouches||[Z])for(let Zn of j)Zn.identifier===jt.identifier&&(Zn.cur=hn(jt,x));if(K&&!et&&!rt&&j.length===1){let jt=j[0];VN(jt.cur[0]-jt[0])>VN(jt.cur[1]-jt[1])?rt=!0:et=!0}for(let jt of j)jt.cur&&(jt[0]=jt.cur[0],jt[1]=jt.cur[1]);V=!0,nx(Z),_t(Z)}function _t(Z){let jt=j[0],Zn=jt.point0;var ro;switch(F=jt[0]-Zn[0],q=jt[1]-Zn[1],b){case z_:case WN:{w&&(F=gn(T-I,xn(C-N,F)),A=I+F,L=N+F),_&&(q=gn(k-O,xn(D-$,q)),M=O+q,P=$+q);break}case _f:{j[1]?(w&&(A=gn(T,xn(C,j[0][0])),L=gn(T,xn(C,j[1][0])),w=1),_&&(M=gn(k,xn(D,j[0][1])),P=gn(k,xn(D,j[1][1])),_=1)):(w<0?(F=gn(T-I,xn(C-I,F)),A=I+F,L=N):w>0&&(F=gn(T-N,xn(C-N,F)),A=I,L=N+F),_<0?(q=gn(k-O,xn(D-O,q)),M=O+q,P=$):_>0&&(q=gn(k-$,xn(D-$,q)),M=O,P=$+q));break}case Sf:{w&&(A=gn(T,xn(C,I-F*w)),L=gn(T,xn(C,N+F*w))),_&&(M=gn(k,xn(D,O-q*_)),P=gn(k,xn(D,$+q*_)));break}}L<A&&(w*=-1,ro=I,I=N,N=ro,ro=A,A=L,L=ro,y in HN&&G.attr("cursor",yi[y=HN[y]])),P<M&&(_*=-1,ro=O,O=$,$=ro,ro=M,M=P,P=ro,y in QN&&G.attr("cursor",yi[y=QN[y]])),v.selection&&(E=v.selection),et&&(A=E[0][0],L=E[1][0]),rt&&(M=E[0][1],P=E[1][1]),(E[0][0]!==A||E[0][1]!==M||E[1][0]!==L||E[1][1]!==P)&&(v.selection=[[A,M],[L,P]],f.call(x),nt.brush(Z,b.name))}function ct(Z){if(XN(Z),Z.touches){if(Z.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else gp(Z.view,V),tt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Y.attr("pointer-events","all"),G.attr("cursor",yi.overlay),v.selection&&(E=v.selection),rj(E)&&(v.selection=null,f.call(x)),nt.end(Z,b.name)}function kt(Z){switch(Z.keyCode){case 16:{K=w&&_;break}case 18:{b===_f&&(w&&(N=L-F*w,I=A+F*w),_&&($=P-q*_,O=M+q*_),b=Sf,_t(Z));break}case 32:{(b===_f||b===Sf)&&(w<0?N=L-F:w>0&&(I=A-F),_<0?$=P-q:_>0&&(O=M-q),b=z_,G.attr("cursor",yi.selection),_t(Z));break}default:return}nx(Z)}function Lt(Z){switch(Z.keyCode){case 16:{K&&(et=rt=K=!1,_t(Z));break}case 18:{b===Sf&&(w<0?N=L:w>0&&(I=A),_<0?$=P:_>0&&(O=M),b=_f,_t(Z));break}case 32:{b===z_&&(Z.altKey?(w&&(N=L-F*w,I=A+F*w),_&&($=P-q*_,O=M+q*_),b=Sf):(w<0?N=L:w>0&&(I=A),_<0?$=P:_>0&&(O=M),b=_f),G.attr("cursor",yi[y]),_t(Z));break}default:return}nx(Z)}}function d(g){u(this,arguments).moved(g)}function h(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=U_(e.apply(this,arguments)),g.dim=t,g}return c.extent=function(g){return arguments.length?(e=typeof g=="function"?g:ex(U_(g)),c):e},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:ex(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:ex(!!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 G_=Math.PI,H_=2*G_,Pa=1e-6,oj=H_-Pa;function ZN(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function ij(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ZN;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 ds=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?ZN:ij(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,u=s-e,p=a-n,l=u*u+p*p;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(l>Pa)if(!(Math.abs(p*c-f*u)>Pa)||!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,x=Math.sqrt(m),y=Math.sqrt(l),b=i*Math.tan((G_-Math.acos((m+l-g)/(2*x*y)))/2),w=b/y,_=b/x;Math.abs(w-1)>Pa&&this._append`L${e+w*u},${n+w*p}`,this._append`A${i},${i},0,0,${+(p*d>u*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,u=n+c,p=1^s,l=s?o-i:i-o;this._x1===null?this._append`M${f},${u}`:(Math.abs(this._x1-f)>Pa||Math.abs(this._y1-u)>Pa)&&this._append`L${f},${u}`,r&&(l<0&&(l=l%H_+H_),l>oj?this._append`A${r},${r},0,1,${p},${e-a},${n-c}A${r},${r},0,1,${p},${this._x1=f},${this._y1=u}`:l>Pa&&this._append`A${r},${r},0,${+(l>=G_)},${p},${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 JN(){return new ds}JN.prototype=ds.prototype;function Rn(t=3){return new ds(+t)}var sj=Array.prototype,ix=sj.slice;function KN(t,e){return t-e}function tk(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 bo=t=>()=>t;function ek(t,e){for(var n=-1,r=e.length,o;++n<r;)if(o=aj(t,e[n]))return o;return 0}function aj(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],u=c[1],p=t[a],l=p[0],d=p[1];if(cj(c,p,e))return 0;u>r!=d>r&&n<(l-f)*(r-u)/(d-u)+f&&(o=-o)}return o}function cj(t,e,n){var r;return fj(t,e,n)&&uj(t[r=+(t[0]===e[0])],n[r],e[r])}function fj(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}function uj(t,e,n){return t<=e&&e<=n||n<=e&&e<=t}function nk(){}var bi=[[],[[[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 hs(){var t=1,e=1,n=as,r=c;function o(f){var u=n(f);if(Array.isArray(u))u=u.slice().sort(KN);else{let p=Ft(f,lj);for(u=an(...lf(p[0],p[1],u),u);u[u.length-1]>=p[1];)u.pop();for(;u[1]<p[0];)u.shift()}return u.map(p=>i(f,p))}function i(f,u){let p=u==null?NaN:+u;if(isNaN(p))throw new Error(`invalid value: ${u}`);var l=[],d=[];return s(f,p,function(h){r(h,f,p),tk(h)>0?l.push([h]):d.push(h)}),d.forEach(function(h){for(var m=0,g=l.length,x;m<g;++m)if(ek((x=l[m])[0],h)!==-1){x.push(h);return}}),{type:"MultiPolygon",value:u,coordinates:l}}function s(f,u,p){var l=new Array,d=new Array,h,m,g,x,y,b;for(h=m=-1,x=Fa(f[0],u),bi[x<<1].forEach(w);++h<t-1;)g=x,x=Fa(f[h+1],u),bi[g|x<<1].forEach(w);for(bi[x<<0].forEach(w);++m<e-1;){for(h=-1,x=Fa(f[m*t+t],u),y=Fa(f[m*t],u),bi[x<<1|y<<2].forEach(w);++h<t-1;)g=x,x=Fa(f[m*t+t+h+1],u),b=y,y=Fa(f[m*t+h+1],u),bi[g|x<<1|y<<2|b<<3].forEach(w);bi[x|y<<3].forEach(w)}for(h=-1,y=f[m*t]>=u,bi[y<<2].forEach(w);++h<t-1;)b=y,y=Fa(f[m*t+h+1],u),bi[y<<2|b<<3].forEach(w);bi[y<<3].forEach(w);function w(_){var v=[_[0][0]+h,_[0][1]+m],S=[_[1][0]+h,_[1][1]+m],E=a(v),T=a(S),I,A;(I=d[E])?(A=l[T])?(delete d[I.end],delete l[A.start],I===A?(I.ring.push(S),p(I.ring)):l[I.start]=d[A.end]={start:I.start,end:A.end,ring:I.ring.concat(A.ring)}):(delete d[I.end],I.ring.push(S),d[I.end=T]=I):(I=l[T])?(A=d[E])?(delete l[I.start],delete d[A.end],I===A?(I.ring.push(S),p(I.ring)):l[A.start]=d[I.end]={start:A.start,end:I.end,ring:A.ring.concat(I.ring)}):(delete l[I.start],I.ring.unshift(v),l[I.start=E]=I):l[E]=d[T]={start:E,end:T,ring:[v,S]}}}function a(f){return f[0]*2+f[1]*(t+1)*4}function c(f,u,p){f.forEach(function(l){var d=l[0],h=l[1],m=d|0,g=h|0,x=Q_(u[g*t+m]);d>0&&d<t&&m===d&&(l[0]=rk(d,Q_(u[g*t+m-1]),x,p)),h>0&&h<e&&g===h&&(l[1]=rk(h,Q_(u[(g-1)*t+m]),x,p))})}return o.contour=i,o.size=function(f){if(!arguments.length)return[t,e];var u=Math.floor(f[0]),p=Math.floor(f[1]);if(!(u>=0&&p>=0))throw new Error("invalid size");return t=u,e=p,o},o.thresholds=function(f){return arguments.length?(n=typeof f=="function"?f:Array.isArray(f)?bo(ix.call(f)):bo(f),o):n},o.smooth=function(f){return arguments.length?(r=f?c:nk,o):r===c},o}function lj(t){return isFinite(t)?t:NaN}function Fa(t,e){return t==null?!1:+t>=e}function Q_(t){return t==null||isNaN(t=+t)?-1/0:t}function rk(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 pj(t){return t[0]}function dj(t){return t[1]}function hj(){return 1}function Z_(){var t=pj,e=dj,n=hj,r=960,o=500,i=20,s=2,a=i*3,c=r+a*2>>s,f=o+a*2>>s,u=bo(20);function p(y){var b=new Float32Array(c*f),w=Math.pow(2,-s),_=-1;for(let O of y){var v=(t(O,++_,y)+a)*w,S=(e(O,_,y)+a)*w,E=+n(O,_,y);if(E&&v>=0&&v<c&&S>=0&&S<f){var T=Math.floor(v),I=Math.floor(S),A=v-T-.5,k=S-I-.5;b[T+I*c]+=(1-A)*(1-k)*E,b[T+1+I*c]+=A*(1-k)*E,b[T+1+(I+1)*c]+=A*k*E,b[T+(I+1)*c]+=(1-A)*k*E}}return sp({data:b,width:c,height:f},i*w),b}function l(y){var b=p(y),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=an(Number.MIN_VALUE,Tt(b)/_,w)),hs().size([c,f]).thresholds(w.map(v=>v*_))(b).map((v,S)=>(v.value=+w[S],d(v)))}l.contours=function(y){var b=p(y),w=hs().size([c,f]),_=Math.pow(2,2*s),v=S=>{S=+S;var E=d(w.contour(b,S*_));return E.value=S,E};return Object.defineProperty(v,"max",{get:()=>Tt(b)/_}),v};function d(y){return y.coordinates.forEach(h),y}function h(y){y.forEach(m)}function m(y){y.forEach(g)}function g(y){y[0]=y[0]*Math.pow(2,s)-a,y[1]=y[1]*Math.pow(2,s)-a}function x(){return a=i*3,c=r+a*2>>s,f=o+a*2>>s,l}return l.x=function(y){return arguments.length?(t=typeof y=="function"?y:bo(+y),l):t},l.y=function(y){return arguments.length?(e=typeof y=="function"?y:bo(+y),l):e},l.weight=function(y){return arguments.length?(n=typeof y=="function"?y:bo(+y),l):n},l.size=function(y){if(!arguments.length)return[r,o];var b=+y[0],w=+y[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,o=w,x()},l.cellSize=function(y){if(!arguments.length)return 1<<s;if(!((y=+y)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(y)/Math.LN2),x()},l.thresholds=function(y){return arguments.length?(u=typeof y=="function"?y:Array.isArray(y)?bo(ix.call(y)):bo(y),l):u},l.bandwidth=function(y){if(!arguments.length)return Math.sqrt(i*(i+1));if(!((y=+y)>=0))throw new Error("invalid bandwidth");return i=(Math.sqrt(4*y*y+1)-1)/2,x()},l}var $t=11102230246251565e-32,Me=134217729,Lp=(3+8*$t)*$t;function qa(t,e,n,r,o){let i,s,a,c,f=e[0],u=r[0],p=0,l=0;u>f==u>-f?(i=f,f=e[++p]):(i=u,u=r[++l]);let d=0;if(p<t&&l<n)for(u>f==u>-f?(s=f+i,a=i-(s-f),f=e[++p]):(s=u+i,a=i-(s-u),u=r[++l]),i=s,a!==0&&(o[d++]=a);p<t&&l<n;)u>f==u>-f?(s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++p]):(s=i+u,c=s-i,a=i-(s-c)+(u-c),u=r[++l]),i=s,a!==0&&(o[d++]=a);for(;p<t;)s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++p],i=s,a!==0&&(o[d++]=a);for(;l<n;)s=i+u,c=s-i,a=i-(s-c)+(u-c),u=r[++l],i=s,a!==0&&(o[d++]=a);return(i!==0||d===0)&&(o[d++]=i),d}function Rp(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function U(t){return new Float64Array(t)}var mj=(3+16*$t)*$t,gj=(2+12*$t)*$t,xj=(9+64*$t)*$t*$t,Mf=U(4),ok=U(8),ik=U(12),sk=U(16),On=U(4);function yj(t,e,n,r,o,i,s){let a,c,f,u,p,l,d,h,m,g,x,y,b,w,_,v,S,E,T=t-o,I=n-o,A=e-i,k=r-i;w=T*k,l=Me*T,d=l-(l-T),h=T-d,l=Me*k,m=l-(l-k),g=k-m,_=h*g-(w-d*m-h*m-d*g),v=A*I,l=Me*A,d=l-(l-A),h=A-d,l=Me*I,m=l-(l-I),g=I-m,S=h*g-(v-d*m-h*m-d*g),x=_-S,p=_-x,Mf[0]=_-(x+p)+(p-S),y=w+x,p=y-w,b=w-(y-p)+(x-p),x=b-v,p=b-x,Mf[1]=b-(x+p)+(p-v),E=y+x,p=E-y,Mf[2]=y-(E-p)+(x-p),Mf[3]=E;let O=Rp(4,Mf),M=gj*s;if(O>=M||-O>=M||(p=t-T,a=t-(T+p)+(p-o),p=n-I,f=n-(I+p)+(p-o),p=e-A,c=e-(A+p)+(p-i),p=r-k,u=r-(k+p)+(p-i),a===0&&c===0&&f===0&&u===0)||(M=xj*s+Lp*Math.abs(O),O+=T*u+k*a-(A*f+I*c),O>=M||-O>=M))return O;w=a*k,l=Me*a,d=l-(l-a),h=a-d,l=Me*k,m=l-(l-k),g=k-m,_=h*g-(w-d*m-h*m-d*g),v=c*I,l=Me*c,d=l-(l-c),h=c-d,l=Me*I,m=l-(l-I),g=I-m,S=h*g-(v-d*m-h*m-d*g),x=_-S,p=_-x,On[0]=_-(x+p)+(p-S),y=w+x,p=y-w,b=w-(y-p)+(x-p),x=b-v,p=b-x,On[1]=b-(x+p)+(p-v),E=y+x,p=E-y,On[2]=y-(E-p)+(x-p),On[3]=E;let C=qa(4,Mf,4,On,ok);w=T*u,l=Me*T,d=l-(l-T),h=T-d,l=Me*u,m=l-(l-u),g=u-m,_=h*g-(w-d*m-h*m-d*g),v=A*f,l=Me*A,d=l-(l-A),h=A-d,l=Me*f,m=l-(l-f),g=f-m,S=h*g-(v-d*m-h*m-d*g),x=_-S,p=_-x,On[0]=_-(x+p)+(p-S),y=w+x,p=y-w,b=w-(y-p)+(x-p),x=b-v,p=b-x,On[1]=b-(x+p)+(p-v),E=y+x,p=E-y,On[2]=y-(E-p)+(x-p),On[3]=E;let N=qa(C,ok,4,On,ik);w=a*u,l=Me*a,d=l-(l-a),h=a-d,l=Me*u,m=l-(l-u),g=u-m,_=h*g-(w-d*m-h*m-d*g),v=c*f,l=Me*c,d=l-(l-c),h=c-d,l=Me*f,m=l-(l-f),g=f-m,S=h*g-(v-d*m-h*m-d*g),x=_-S,p=_-x,On[0]=_-(x+p)+(p-S),y=w+x,p=y-w,b=w-(y-p)+(x-p),x=b-v,p=b-x,On[1]=b-(x+p)+(p-v),E=y+x,p=E-y,On[2]=y-(E-p)+(x-p),On[3]=E;let L=qa(N,ik,4,On,sk);return sk[L-1]}function Af(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)>=mj*f?c:-yj(t,e,n,r,o,i,f)}var y2t=(7+56*$t)*$t,b2t=(3+28*$t)*$t,w2t=(26+288*$t)*$t*$t,v2t=U(4),_2t=U(4),S2t=U(4),M2t=U(4),A2t=U(4),E2t=U(4),T2t=U(4),I2t=U(4),C2t=U(4),N2t=U(8),k2t=U(8),L2t=U(8),R2t=U(4),O2t=U(8),$2t=U(8),D2t=U(8),P2t=U(12),F2t=U(192),q2t=U(192);var Y2t=(10+96*$t)*$t,U2t=(4+48*$t)*$t,j2t=(44+576*$t)*$t*$t,X2t=U(4),W2t=U(4),V2t=U(4),G2t=U(4),H2t=U(4),Q2t=U(4),Z2t=U(4),J2t=U(4),K2t=U(8),twt=U(8),ewt=U(8),nwt=U(8),rwt=U(8),owt=U(8),iwt=U(8),swt=U(8),awt=U(8),cwt=U(4),fwt=U(4),uwt=U(4),lwt=U(8),pwt=U(16),dwt=U(16),hwt=U(16),mwt=U(32),gwt=U(32),xwt=U(48),ywt=U(64),bwt=U(1152),wwt=U(1152);var Mwt=(16+224*$t)*$t,Awt=(5+72*$t)*$t,Ewt=(71+1408*$t)*$t*$t,Twt=U(4),Iwt=U(4),Cwt=U(4),Nwt=U(4),kwt=U(4),Lwt=U(4),Rwt=U(4),Owt=U(4),$wt=U(4),Dwt=U(4),Pwt=U(24),Fwt=U(24),qwt=U(24),Bwt=U(24),zwt=U(24),Ywt=U(24),Uwt=U(24),jwt=U(24),Xwt=U(24),Wwt=U(24),Vwt=U(1152),Gwt=U(1152),Hwt=U(1152),Qwt=U(1152),Zwt=U(1152),Jwt=U(2304),Kwt=U(2304),tvt=U(3456),evt=U(5760),nvt=U(8),rvt=U(8),ovt=U(8),ivt=U(16),svt=U(24),avt=U(48),cvt=U(48),fvt=U(96),uvt=U(192),lvt=U(384),pvt=U(384),dvt=U(384),hvt=U(768);var mvt=U(96),gvt=U(96),xvt=U(96),yvt=U(1152);var ck=Math.pow(2,-52),sx=new Uint32Array(512),Tf=class t{static from(e,n=Mj,r=Aj){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,u=-1/0;for(let T=0;T<s;T++){let I=e[2*T],A=e[2*T+1];I<a&&(a=I),A<c&&(c=A),I>f&&(f=I),A>u&&(u=A),this._ids[T]=T}let p=(a+f)/2,l=(c+u)/2,d,h,m;for(let T=0,I=1/0;T<s;T++){let A=J_(p,l,e[2*T],e[2*T+1]);A<I&&(d=T,I=A)}let g=e[2*d],x=e[2*d+1];for(let T=0,I=1/0;T<s;T++){if(T===d)continue;let A=J_(g,x,e[2*T],e[2*T+1]);A<I&&A>0&&(h=T,I=A)}let y=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 I=_j(g,x,y,b,e[2*T],e[2*T+1]);I<w&&(m=T,w=I)}let _=e[2*m],v=e[2*m+1];if(w===1/0){for(let A=0;A<s;A++)this._dists[A]=e[2*A]-e[0]||e[2*A+1]-e[1];Ef(this._ids,this._dists,0,s-1);let T=new Uint32Array(s),I=0;for(let A=0,k=-1/0;A<s;A++){let O=this._ids[A],M=this._dists[O];M>k&&(T[I++]=O,k=M)}this.hull=T.subarray(0,I),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Af(g,x,y,b,_,v)<0){let T=h,I=y,A=b;h=m,y=_,b=v,m=T,_=I,v=A}let S=Sj(g,x,y,b,_,v);this._cx=S.x,this._cy=S.y;for(let T=0;T<s;T++)this._dists[T]=J_(e[2*T],e[2*T+1],S.x,S.y);Ef(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,x)]=d,i[this._hashKey(y,b)]=h,i[this._hashKey(_,v)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let T=0,I,A;T<this._ids.length;T++){let k=this._ids[T],O=e[2*k],M=e[2*k+1];if(T>0&&Math.abs(O-I)<=ck&&Math.abs(M-A)<=ck||(I=O,A=M,k===d||k===h||k===m))continue;let C=0;for(let P=0,F=this._hashKey(O,M);P<this._hashSize&&(C=i[(F+P)%this._hashSize],!(C!==-1&&C!==r[C]));P++);C=n[C];let N=C,L;for(;L=r[N],Af(O,M,e[2*N],e[2*N+1],e[2*L],e[2*L+1])>=0;)if(N=L,N===C){N=-1;break}if(N===-1)continue;let D=this._addTriangle(N,k,r[N],-1,-1,o[N]);o[k]=this._legalize(D+2),o[N]=D,E++;let $=r[N];for(;L=r[$],Af(O,M,e[2*$],e[2*$+1],e[2*L],e[2*L+1])<0;)D=this._addTriangle($,k,L,o[k],-1,o[$]),o[k]=this._legalize(D+2),r[$]=$,E--,$=L;if(N===C)for(;L=n[N],Af(O,M,e[2*L],e[2*L+1],e[2*N],e[2*N+1])<0;)D=this._addTriangle(L,k,N,-1,o[N],o[L]),this._legalize(D+2),o[L]=D,r[N]=N,E--,N=L;this._hullStart=n[k]=N,r[N]=n[$]=k,r[k]=$,i[this._hashKey(O,M)]=k,i[this._hashKey(e[2*N],e[2*N+1])]=N}this.hull=new Uint32Array(E);for(let T=0,I=this._hullStart;T<E;T++)this.hull[T]=I,I=r[I];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,n){return Math.floor(wj(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=sx[--i];continue}let f=a-a%3,u=c+(e+1)%3,p=f+(a+2)%3,l=n[s],d=n[e],h=n[u],m=n[p];if(vj(o[2*l],o[2*l+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]=l;let x=r[p];if(x===-1){let b=this._hullStart;do{if(this._hullTri[b]===p){this._hullTri[b]=e;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(e,x),this._link(a,r[s]),this._link(s,p);let y=f+(a+1)%3;i<sx.length&&(sx[i++]=y)}else{if(i===0)break;e=sx[--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 wj(t,e){let n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}function J_(t,e,n,r){let o=t-n,i=e-r;return o*o+i*i}function vj(t,e,n,r,o,i,s,a){let c=t-s,f=e-a,u=n-s,p=r-a,l=o-s,d=i-a,h=c*c+f*f,m=u*u+p*p,g=l*l+d*d;return c*(p*g-m*d)-f*(u*g-m*l)+h*(u*d-p*l)<0}function _j(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,u=s*s+a*a,p=c*c+f*f,l=.5/(s*f-a*c),d=(f*u-a*p)*l,h=(s*p-c*u)*l;return d*d+h*h}function Sj(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,u=s*s+a*a,p=c*c+f*f,l=.5/(s*f-a*c),d=t+(f*u-a*p)*l,h=e+(s*p-c*u)*l;return{x:d,y:h}}function Ef(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;Op(t,o,i),e[t[n]]>e[t[r]]&&Op(t,n,r),e[t[i]]>e[t[r]]&&Op(t,i,r),e[t[n]]>e[t[i]]&&Op(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;Op(t,i,s)}t[n+1]=t[s],t[s]=a,r-i+1>=s-n?(Ef(t,e,i,r),Ef(t,e,n,s-1)):(Ef(t,e,n,s-1),Ef(t,e,i,r))}}function Op(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Mj(t){return t[0]}function Aj(t){return t[1]}var Er=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 ms=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 $p=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,x=r.length,y,b;m<x;m+=3,g+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,S=e[w],E=e[w+1],T=e[_],I=e[_+1],A=e[v],k=e[v+1],O=T-S,M=I-E,C=A-S,N=k-E,L=(O*N-M*C)*2;if(Math.abs(L)<1e-9){if(i===void 0){i=s=0;for(let $ of n)i+=e[$*2],s+=e[$*2+1];i/=n.length,s/=n.length}let D=1e9*Math.sign((i-S)*N-(s-E)*C);y=(S+A)/2-D*N,b=(E+k)/2+D*C}else{let D=1/L,$=O*O+M*M,P=C*C+N*N;y=S+(N*$-M*P)*D,b=E+(O*P-C*$)*D}a[g]=y,a[g+1]=b}let c=n[n.length-1],f,u=c*4,p,l=e[2*c],d,h=e[2*c+1];o.fill(0);for(let m=0;m<n.length;++m)c=n[m],f=u,p=l,d=h,u=c*4,l=e[2*c],h=e[2*c+1],o[f+2]=o[u]=d-h,o[f+3]=o[u+1]=l-p}render(e){let n=e==null?e=new Er:void 0,{delaunay:{halfedges:r,inedges:o,hull:i},circumcenters:s,vectors:a}=this;if(i.length<=1)return null;for(let u=0,p=r.length;u<p;++u){let l=r[u];if(l<u)continue;let d=Math.floor(u/3)*2,h=Math.floor(l/3)*2,m=s[d],g=s[d+1],x=s[h],y=s[h+1];this._renderSegment(m,g,x,y,e)}let c,f=i[i.length-1];for(let u=0;u<i.length;++u){c=f,f=i[u];let p=Math.floor(o[f]/3)*2,l=s[p],d=s[p+1],h=c*4,m=this._project(l,d,a[h+2],a[h+3]);m&&this._renderSegment(l,d,m[0],m[1],e)}return n&&n.value()}renderBounds(e){let n=e==null?e=new Er: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 Er: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 ms;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,u=this._regioncode(a,c),p,l=0;for(let d=0;d<r;d+=2)if(i=a,s=c,a=n[d],c=n[d+1],f=u,u=this._regioncode(a,c),f===0&&u===0)p=l,l=0,o?o.push(a,c):o=[a,c];else{let h,m,g,x,y;if(f===0){if((h=this._clipSegment(i,s,a,c,f,u))===null)continue;[m,g,x,y]=h}else{if((h=this._clipSegment(a,c,i,s,u,f))===null)continue;[x,y,m,g]=h,p=l,l=this._edgecode(m,g),p&&l&&this._edge(e,p,l,o,o.length),o?o.push(m,g):o=[m,g]}p=l,l=this._edgecode(x,y),p&&l&&this._edge(e,p,l,o,o.length),o?o.push(x,y):o=[x,y]}if(o)p=l,l=this._edgecode(o[0],o[1]),p&&l&&this._edge(e,p,l,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,u=i||s;u&8?(c=e+(r-e)*(this.ymax-n)/(o-n),f=this.ymax):u&4?(c=e+(r-e)*(this.ymin-n)/(o-n),f=this.ymin):u&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,u=a.length,p,l=this._edgecode(a[u-2],a[u-1]);f<u;f+=2)p=l,l=this._edgecode(a[f],a[f+1]),p&&l&&(f=this._edge(e,p,l,a,f),u=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 Ej=2*Math.PI,If=Math.pow;function Tj(t){return t[0]}function Ij(t){return t[1]}function Cj(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 Nj(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}var Tr=class t{static from(e,n=Tj,r=Ij,o){return new t("length"in e?kj(e,n,r,o):Float64Array.from(Lj(e,n,r,o)))}constructor(e){this._delaunator=new Tf(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&&Cj(e)){this.collinear=Int32Array.from({length:n.length/2},(l,d)=>d).sort((l,d)=>n[2*l]-n[2*d]||n[2*l+1]-n[2*d+1]);let c=this.collinear[0],f=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],p=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let l=0,d=n.length/2;l<d;++l){let h=Nj(n[2*l],n[2*l+1],p);n[2*l]=h[0],n[2*l+1]=h[1]}this._delaunator=new Tf(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 u=i[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=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 $p(this,e)}*neighbors(e){let{inedges:n,hull:r,_hullIndex:o,halfedges:i,triangles:s,collinear:a}=this;if(a){let p=a.indexOf(e);p>0&&(yield a[p-1]),p<a.length-1&&(yield a[p+1]);return}let c=n[e];if(c===-1)return;let f=c,u=-1;do{if(yield u=s[f],f=f%3===2?f-2:f+1,s[f]!==e)return;if(f=i[f],f===-1){let p=r[(o[e]+1)%r.length];p!==u&&(yield p);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 u=e,p=If(n-f[e*2],2)+If(r-f[e*2+1],2),l=o[e],d=l;do{let h=c[d],m=If(n-f[h*2],2)+If(r-f[h*2+1],2);if(m<p&&(p=m,u=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&&If(n-f[d*2],2)+If(r-f[d*2+1],2)<p)return d;break}}while(d!==l);return u}render(e){let n=e==null?e=new Er: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,u=i[c]*2;e.moveTo(r[f],r[f+1]),e.lineTo(r[u],r[u+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 Er: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,Ej)}return r&&r.value()}renderHull(e){let n=e==null?e=new Er: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 ms;return this.renderHull(e),e.value()}renderTriangle(e,n){let r=n==null?n=new Er: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 ms;return this.renderTriangle(e,n),n.value()}};function kj(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*Lj(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 fk(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ba(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 wo(t){return t=Ba(Math.abs(t)),t?t[1]:NaN}function uk(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 lk(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Rj=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vo(t){if(!(e=Rj.exec(t)))throw new Error("invalid format: "+t);var e;return new ax({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]})}vo.prototype=ax.prototype;function ax(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+""}ax.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 pk(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 K_;function dk(t,e){var n=Ba(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(K_=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")+Ba(t,Math.max(0,e+i-1))[0]}function t6(t,e){var n=Ba(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 e6={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:fk,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)=>t6(t*100,e),r:t6,s:dk,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function n6(t){return t}var hk=Array.prototype.map,mk=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function gk(t){var e=t.grouping===void 0||t.thousands===void 0?n6:uk(hk.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?n6:lk(hk.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(p){p=vo(p);var l=p.fill,d=p.align,h=p.sign,m=p.symbol,g=p.zero,x=p.width,y=p.comma,b=p.precision,w=p.trim,_=p.type;_==="n"?(y=!0,_="g"):e6[_]||(b===void 0&&(b=12),w=!0,_="g"),(g||l==="0"&&d==="=")&&(g=!0,l="0",d="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",S=m==="$"?r:/[%p]/.test(_)?s:"",E=e6[_],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 I(A){var k=v,O=S,M,C,N;if(_==="c")O=E(A)+O,A="";else{A=+A;var L=A<0||1/A<0;if(A=isNaN(A)?c:E(Math.abs(A),b),w&&(A=pk(A)),L&&+A==0&&h!=="+"&&(L=!1),k=(L?h==="("?h:a:h==="-"||h==="("?"":h)+k,O=(_==="s"?mk[8+K_/3]:"")+O+(L&&h==="("?")":""),T){for(M=-1,C=A.length;++M<C;)if(N=A.charCodeAt(M),48>N||N>57){O=(N===46?o+A.slice(M+1):A.slice(M))+O,A=A.slice(0,M);break}}}y&&!g&&(A=e(A,1/0));var D=k.length+A.length+O.length,$=D<x?new Array(x-D+1).join(l):"";switch(y&&g&&(A=e($+A,$.length?x-O.length:1/0),$=""),d){case"<":A=k+A+O+$;break;case"=":A=k+$+A+O;break;case"^":A=$.slice(0,D=$.length>>1)+k+A+O+$.slice(D);break;default:A=$+k+A+O;break}return i(A)}return I.toString=function(){return p+""},I}function u(p,l){var d=f((p=vo(p),p.type="f",p)),h=Math.max(-8,Math.min(8,Math.floor(wo(l)/3)))*3,m=Math.pow(10,-h),g=mk[8+h/3];return function(x){return d(m*x)+g}}return{format:f,formatPrefix:u}}var cx,Ir,fx;r6({thousands:",",grouping:[3],currency:["$",""]});function r6(t){return cx=gk(t),Ir=cx.format,fx=cx.formatPrefix,cx}function o6(t){return Math.max(0,-wo(Math.abs(t)))}function i6(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wo(e)/3)))*3-wo(Math.abs(t)))}function s6(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,wo(e)-wo(t))+1}var J=1e-6,za=1e-12,bt=Math.PI,Ht=bt/2,a6=bt/4,je=bt*2,me=180/bt,At=bt/180,St=Math.abs,Cr=Math.atan,Ae=Math.atan2,Q=Math.cos,Dp=Math.ceil,ux=Math.exp;var lx=Math.hypot,Ya=Math.log,px=Math.pow,H=Math.sin,yn=Math.sign||function(t){return t>0?1:t<0?-1:0},Qt=Math.sqrt,Cf=Math.tan;function dx(t){return t>1?0:t<-1?bt:Math.acos(t)}function ne(t){return t>1?Ht:t<-1?-Ht:Math.asin(t)}function Ee(){}function hx(t,e){t&&yk.hasOwnProperty(t.type)&&yk[t.type](t,e)}var xk={Feature:function(t,e){hx(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)hx(n[r].geometry,e)}},yk={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){c6(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)c6(n[r],e,0)},Polygon:function(t,e){bk(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)bk(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)hx(n[r],e)}};function c6(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 bk(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)c6(t[n],e,1);e.polygonEnd()}function or(t,e){t&&xk.hasOwnProperty(t.type)?xk[t.type](t,e):hx(t,e)}function Pp(t){return[Ae(t[1],t[0]),ne(t[2])]}function _o(t){var e=t[0],n=t[1],r=Q(n);return[r*Q(e),r*H(e),H(n)]}function Fp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Nf(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 mx(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function qp(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Bp(t){var e=Qt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var zp,gx,xx,yx,bx,wx,vx,_x,f6,u6,l6,_k,Sk,$n,Dn,Pn,Hr={sphere:Ee,point:p6,lineStart:wk,lineEnd:vk,polygonStart:function(){Hr.lineStart=Dj,Hr.lineEnd=Pj},polygonEnd:function(){Hr.lineStart=wk,Hr.lineEnd=vk}};function p6(t,e){t*=At,e*=At;var n=Q(e);Yp(n*Q(t),n*H(t),H(e))}function Yp(t,e,n){++zp,xx+=(t-xx)/zp,yx+=(e-yx)/zp,bx+=(n-bx)/zp}function wk(){Hr.point=Oj}function Oj(t,e){t*=At,e*=At;var n=Q(e);$n=n*Q(t),Dn=n*H(t),Pn=H(e),Hr.point=$j,Yp($n,Dn,Pn)}function $j(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*H(t),i=H(e),s=Ae(Qt((s=Dn*i-Pn*o)*s+(s=Pn*r-$n*i)*s+(s=$n*o-Dn*r)*s),$n*r+Dn*o+Pn*i);gx+=s,wx+=s*($n+($n=r)),vx+=s*(Dn+(Dn=o)),_x+=s*(Pn+(Pn=i)),Yp($n,Dn,Pn)}function vk(){Hr.point=p6}function Dj(){Hr.point=Fj}function Pj(){Mk(_k,Sk),Hr.point=p6}function Fj(t,e){_k=t,Sk=e,t*=At,e*=At,Hr.point=Mk;var n=Q(e);$n=n*Q(t),Dn=n*H(t),Pn=H(e),Yp($n,Dn,Pn)}function Mk(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*H(t),i=H(e),s=Dn*i-Pn*o,a=Pn*r-$n*i,c=$n*o-Dn*r,f=lx(s,a,c),u=ne(f),p=f&&-u/f;f6.add(p*s),u6.add(p*a),l6.add(p*c),gx+=u,wx+=u*($n+($n=r)),vx+=u*(Dn+(Dn=o)),_x+=u*(Pn+(Pn=i)),Yp($n,Dn,Pn)}function d6(t){zp=gx=xx=yx=bx=wx=vx=_x=0,f6=new on,u6=new on,l6=new on,or(t,Hr);var e=+f6,n=+u6,r=+l6,o=lx(e,n,r);return o<za&&(e=wx,n=vx,r=_x,gx<J&&(e=xx,n=yx,r=bx),o=lx(e,n,r),o<za)?[NaN,NaN]:[Ae(n,e)*me,ne(r/o)*me]}function Up(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 h6(t,e){return St(t)>bt&&(t-=Math.round(t/je)*je),[t,e]}h6.invert=h6;function m6(t,e,n){return(t%=je)?e||n?Up(Ek(t),Tk(e,n)):Ek(t):e||n?Tk(e,n):h6}function Ak(t){return function(e,n){return e+=t,St(e)>bt&&(e-=Math.round(e/je)*je),[e,n]}}function Ek(t){var e=Ak(t);return e.invert=Ak(-t),e}function Tk(t,e){var n=Q(t),r=H(t),o=Q(e),i=H(e);function s(a,c){var f=Q(c),u=Q(a)*f,p=H(a)*f,l=H(c),d=l*n+u*r;return[Ae(p*o-d*i,u*n-l*r),ne(d*o+p*i)]}return s.invert=function(a,c){var f=Q(c),u=Q(a)*f,p=H(a)*f,l=H(c),d=l*o-p*i;return[Ae(p*o+l*i,u*n+d*r),ne(d*n-u*r)]},s}function Ik(t){t=m6(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]*=me,n[1]*=me,n}return e.invert=function(n){return n=t.invert(n[0]*At,n[1]*At),n[0]*=me,n[1]*=me,n},e}function Nk(t,e,n,r,o,i){if(n){var s=Q(e),a=H(e),c=r*n;o==null?(o=e+r*je,i=e-c/2):(o=Ck(s,o),i=Ck(s,i),(r>0?o<i:o>i)&&(o+=r*je));for(var f,u=o;r>0?u>i:u<i;u-=c)f=Pp([s,-a*Q(u),-a*H(u)]),t.point(f[0],f[1])}}function Ck(t,e){e=_o(e),e[0]-=t,Bp(e);var n=dx(-e[1]);return((-e[2]<0?-n:n)+je-J)%je}function Sx(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Ee,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function kf(t,e){return St(t[0]-e[0])<J&&St(t[1]-e[1])<J}function Mx(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 Ax(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],x=h[m],y;if(kf(g,x)){if(!g[2]&&!x[2]){for(o.lineStart(),a=0;a<m;++a)o.point((g=h[a])[0],g[1]);o.lineEnd();return}x[0]+=2*J}i.push(y=new Mx(g,h,null,!0)),s.push(y.o=new Mx(g,null,y,!1)),i.push(y=new Mx(x,h,null,!1)),s.push(y.o=new Mx(x,null,y,!0))}}),!!i.length){for(s.sort(e),kk(i),kk(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var f=i[0],u,p;;){for(var l=f,d=!0;l.v;)if((l=l.n)===f)return;u=l.z,o.lineStart();do{if(l.v=l.o.v=!0,l.e){if(d)for(a=0,c=u.length;a<c;++a)o.point((p=u[a])[0],p[1]);else r(l.x,l.n.x,1,o);l=l.n}else{if(d)for(u=l.p.z,a=u.length-1;a>=0;--a)o.point((p=u[a])[0],p[1]);else r(l.x,l.p.x,-1,o);l=l.p}l=l.o,u=l.z,d=!d}while(!l.v);o.lineEnd()}}}function kk(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 g6(t){return St(t[0])<=bt?t[0]:yn(t[0])*((St(t[0])+bt)%je-bt)}function Lk(t,e){var n=g6(e),r=e[1],o=H(r),i=[H(n),-Q(n),0],s=0,a=0,c=new on;o===1?r=Ht+J:o===-1&&(r=-Ht-J);for(var f=0,u=t.length;f<u;++f)if(l=(p=t[f]).length)for(var p,l,d=p[l-1],h=g6(d),m=d[1]/2+a6,g=H(m),x=Q(m),y=0;y<l;++y,h=w,g=v,x=S,d=b){var b=p[y],w=g6(b),_=b[1]/2+a6,v=H(_),S=Q(_),E=w-h,T=E>=0?1:-1,I=T*E,A=I>bt,k=g*v;if(c.add(Ae(k*T*H(I),x*S+k*Q(I))),s+=A?E+T*je:E,A^h>=n^w>=n){var O=Nf(_o(d),_o(b));Bp(O);var M=Nf(i,O);Bp(M);var C=(A^E>=0?-1:1)*ne(M[2]);(r>C||r===C&&(O[0]||O[1]))&&(a+=A^E>=0?1:-1)}}return(s<-J||s<J&&c<-za)^a&1}function Ex(t,e,n,r){return function(o){var i=e(o),s=Sx(),a=e(s),c=!1,f,u,p,l={point:d,lineStart:m,lineEnd:g,polygonStart:function(){l.point=x,l.lineStart=y,l.lineEnd=b,u=[],f=[]},polygonEnd:function(){l.point=d,l.lineStart=m,l.lineEnd=g,u=pf(u);var w=Lk(f,r);u.length?(c||(o.polygonStart(),c=!0),Ax(u,Bj,w,n,o)):w&&(c||(o.polygonStart(),c=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),c&&(o.polygonEnd(),c=!1),u=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(){l.point=h,i.lineStart()}function g(){l.point=d,i.lineEnd()}function x(w,_){p.push([w,_]),a.point(w,_)}function y(){a.lineStart(),p=[]}function b(){x(p[0][0],p[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,S=_.length,E,T,I;if(p.pop(),f.push(p),p=null,!!S){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((I=T[v])[0],I[1]);o.lineEnd()}return}S>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(qj))}}return l}}function qj(t){return t.length>1}function Bj(t,e){return((t=t.x)[0]<0?t[1]-Ht-J:Ht-t[1])-((e=e.x)[0]<0?e[1]-Ht-J:Ht-e[1])}var x6=Ex(function(){return!0},zj,Uj,[-bt,-Ht]);function zj(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(i,s){var a=i>0?bt:-bt,c=St(i-e);St(c-bt)<J?(t.point(e,n=(n+s)/2>0?Ht:-Ht),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(i,n),o=0):r!==a&&c>=bt&&(St(e-r)<J&&(e-=r*J),St(i-a)<J&&(i-=a*J),n=Yj(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 Yj(t,e,n,r){var o,i,s=H(t-n);return St(s)>J?Cr((H(e)*(i=Q(r))*H(n)-H(r)*(o=Q(e))*H(t))/(o*i*s)):(e+r)/2}function Uj(t,e,n,r){var o;if(t==null)o=n*Ht,r.point(-bt,o),r.point(0,o),r.point(bt,o),r.point(bt,0),r.point(bt,-o),r.point(0,-o),r.point(-bt,-o),r.point(-bt,0),r.point(-bt,o);else if(St(t[0]-e[0])>J){var i=t[0]<e[0]?bt:-bt;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(e[0],e[1])}function Rk(t){var e=Q(t),n=2*At,r=e>0,o=St(e)>J;function i(u,p,l,d){Nk(d,t,n,l,u,p)}function s(u,p){return Q(u)*Q(p)>e}function a(u){var p,l,d,h,m;return{lineStart:function(){h=d=!1,m=1},point:function(g,x){var y=[g,x],b,w=s(g,x),_=r?w?0:f(g,x):w?f(g+(g<0?bt:-bt),x):0;if(!p&&(h=d=w)&&u.lineStart(),w!==d&&(b=c(p,y),(!b||kf(p,b)||kf(y,b))&&(y[2]=1)),w!==d)m=0,w?(u.lineStart(),b=c(y,p),u.point(b[0],b[1])):(b=c(p,y),u.point(b[0],b[1],2),u.lineEnd()),p=b;else if(o&&p&&r^w){var v;!(_&l)&&(v=c(y,p,!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&&(!p||!kf(p,y))&&u.point(y[0],y[1]),p=y,d=w,l=_},lineEnd:function(){d&&u.lineEnd(),p=null},clean:function(){return m|(h&&d)<<1}}}function c(u,p,l){var d=_o(u),h=_o(p),m=[1,0,0],g=Nf(d,h),x=Fp(g,g),y=g[0],b=x-y*y;if(!b)return!l&&u;var w=e*x/b,_=-e*y/b,v=Nf(m,g),S=qp(m,w),E=qp(g,_);mx(S,E);var T=v,I=Fp(S,T),A=Fp(T,T),k=I*I-A*(Fp(S,S)-1);if(!(k<0)){var O=Qt(k),M=qp(T,(-I-O)/A);if(mx(M,S),M=Pp(M),!l)return M;var C=u[0],N=p[0],L=u[1],D=p[1],$;N<C&&($=C,C=N,N=$);var P=N-C,F=St(P-bt)<J,q=F||P<J;if(!F&&D<L&&($=L,L=D,D=$),q?F?L+D>0^M[1]<(St(M[0]-C)<J?L:D):L<=M[1]&&M[1]<=D:P>bt^(C<=M[0]&&M[0]<=N)){var V=qp(T,(-I+O)/A);return mx(V,S),[M,Pp(V)]}}}function f(u,p){var l=r?t:bt-t,d=0;return u<-l?d|=1:u>l&&(d|=2),p<-l?d|=4:p>l&&(d|=8),d}return Ex(s,a,i,r?[0,-t]:[-bt,t-bt])}function Ok(t,e,n,r,o,i){var s=t[0],a=t[1],c=e[0],f=e[1],u=0,p=1,l=c-s,d=f-a,h;if(h=n-s,!(!l&&h>0)){if(h/=l,l<0){if(h<u)return;h<p&&(p=h)}else if(l>0){if(h>p)return;h>u&&(u=h)}if(h=o-s,!(!l&&h<0)){if(h/=l,l<0){if(h>p)return;h>u&&(u=h)}else if(l>0){if(h<u)return;h<p&&(p=h)}if(h=r-a,!(!d&&h>0)){if(h/=d,d<0){if(h<u)return;h<p&&(p=h)}else if(d>0){if(h>p)return;h>u&&(u=h)}if(h=i-a,!(!d&&h<0)){if(h/=d,d<0){if(h>p)return;h>u&&(u=h)}else if(d>0){if(h<u)return;h<p&&(p=h)}return u>0&&(t[0]=s+u*l,t[1]=a+u*d),p<1&&(e[0]=s+p*l,e[1]=a+p*d),!0}}}}}var jp=1e9,Tx=-jp;function Lf(t,e,n,r){function o(f,u){return t<=f&&f<=n&&e<=u&&u<=r}function i(f,u,p,l){var d=0,h=0;if(f==null||(d=s(f,p))!==(h=s(u,p))||c(f,u)<0^p>0)do l.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+p+4)%4)!==h);else l.point(u[0],u[1])}function s(f,u){return St(f[0]-t)<J?u>0?0:3:St(f[0]-n)<J?u>0?2:1:St(f[1]-e)<J?u>0?1:0:u>0?3:2}function a(f,u){return c(f.x,u.x)}function c(f,u){var p=s(f,1),l=s(u,1);return p!==l?p-l:p===0?u[1]-f[1]:p===1?f[0]-u[0]:p===2?f[1]-u[1]:u[0]-f[0]}return function(f){var u=f,p=Sx(),l,d,h,m,g,x,y,b,w,_,v,S={point:E,lineStart:k,lineEnd:O,polygonStart:I,polygonEnd:A};function E(C,N){o(C,N)&&u.point(C,N)}function T(){for(var C=0,N=0,L=d.length;N<L;++N)for(var D=d[N],$=1,P=D.length,F=D[0],q,V,K=F[0],et=F[1];$<P;++$)q=K,V=et,F=D[$],K=F[0],et=F[1],V<=r?et>r&&(K-q)*(r-V)>(et-V)*(t-q)&&++C:et<=r&&(K-q)*(r-V)<(et-V)*(t-q)&&--C;return C}function I(){u=p,l=[],d=[],v=!0}function A(){var C=T(),N=v&&C,L=(l=pf(l)).length;(N||L)&&(f.polygonStart(),N&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),L&&Ax(l,a,C,i,f),f.polygonEnd()),u=f,l=d=h=null}function k(){S.point=M,d&&d.push(h=[]),_=!0,w=!1,y=b=NaN}function O(){l&&(M(m,g),x&&w&&p.rejoin(),l.push(p.result())),S.point=E,w&&u.lineEnd()}function M(C,N){var L=o(C,N);if(d&&h.push([C,N]),_)m=C,g=N,x=L,_=!1,L&&(u.lineStart(),u.point(C,N));else if(L&&w)u.point(C,N);else{var D=[y=Math.max(Tx,Math.min(jp,y)),b=Math.max(Tx,Math.min(jp,b))],$=[C=Math.max(Tx,Math.min(jp,C)),N=Math.max(Tx,Math.min(jp,N))];Ok(D,$,t,e,n,r)?(w||(u.lineStart(),u.point(D[0],D[1])),u.point($[0],$[1]),L||u.lineEnd(),v=!1):L&&(u.lineStart(),u.point(C,N),v=!1)}y=C,b=N,w=L}return S}}function $k(t,e,n){var r=be(t,e-J,n).concat(e);return function(o){return r.map(function(i){return[o,i]})}}function Dk(t,e,n){var r=be(t,e-J,n).concat(e);return function(o){return r.map(function(i){return[i,o]})}}function y6(){var t,e,n,r,o,i,s,a,c=10,f=c,u=90,p=360,l,d,h,m,g=2.5;function x(){return{type:"MultiLineString",coordinates:y()}}function y(){return be(Dp(r/u)*u,n,u).map(h).concat(be(Dp(a/p)*p,s,p).map(m)).concat(be(Dp(e/c)*c,t,c).filter(function(b){return St(b%u)>J}).map(l)).concat(be(Dp(i/f)*f,o,f).filter(function(b){return St(b%p)>J}).map(d))}return x.lines=function(){return y().map(function(b){return{type:"LineString",coordinates:b}})},x.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(m(s).slice(1),h(n).reverse().slice(1),m(a).reverse().slice(1))]}},x.extent=function(b){return arguments.length?x.extentMajor(b).extentMinor(b):x.extentMinor()},x.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),x.precision(g)):[[r,a],[n,s]]},x.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),x.precision(g)):[[e,i],[t,o]]},x.step=function(b){return arguments.length?x.stepMajor(b).stepMinor(b):x.stepMinor()},x.stepMajor=function(b){return arguments.length?(u=+b[0],p=+b[1],x):[u,p]},x.stepMinor=function(b){return arguments.length?(c=+b[0],f=+b[1],x):[c,f]},x.precision=function(b){return arguments.length?(g=+b,l=$k(i,o,90),d=Dk(e,t,g),h=$k(a,s,90),m=Dk(r,n,g),x):g},x.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function b6(){return y6()()}var Xp=t=>t;var w6=new on,v6=new on,Pk,Fk,_6,S6,gs={point:Ee,lineStart:Ee,lineEnd:Ee,polygonStart:function(){gs.lineStart=jj,gs.lineEnd=Wj},polygonEnd:function(){gs.lineStart=gs.lineEnd=gs.point=Ee,w6.add(St(v6)),v6=new on},result:function(){var t=w6/2;return w6=new on,t}};function jj(){gs.point=Xj}function Xj(t,e){gs.point=qk,Pk=_6=t,Fk=S6=e}function qk(t,e){v6.add(S6*t-_6*e),_6=t,S6=e}function Wj(){qk(Pk,Fk)}var M6=gs;var Rf=1/0,Ix=Rf,Wp=-Rf,Cx=Wp,Vj={point:Gj,lineStart:Ee,lineEnd:Ee,polygonStart:Ee,polygonEnd:Ee,result:function(){var t=[[Rf,Ix],[Wp,Cx]];return Wp=Cx=-(Ix=Rf=1/0),t}};function Gj(t,e){t<Rf&&(Rf=t),t>Wp&&(Wp=t),e<Ix&&(Ix=e),e>Cx&&(Cx=e)}var Of=Vj;var A6=0,E6=0,Vp=0,Nx=0,kx=0,$f=0,T6=0,I6=0,Gp=0,Yk,Uk,So,Mo,Qr={point:Ua,lineStart:Bk,lineEnd:zk,polygonStart:function(){Qr.lineStart=Zj,Qr.lineEnd=Jj},polygonEnd:function(){Qr.point=Ua,Qr.lineStart=Bk,Qr.lineEnd=zk},result:function(){var t=Gp?[T6/Gp,I6/Gp]:$f?[Nx/$f,kx/$f]:Vp?[A6/Vp,E6/Vp]:[NaN,NaN];return A6=E6=Vp=Nx=kx=$f=T6=I6=Gp=0,t}};function Ua(t,e){A6+=t,E6+=e,++Vp}function Bk(){Qr.point=Hj}function Hj(t,e){Qr.point=Qj,Ua(So=t,Mo=e)}function Qj(t,e){var n=t-So,r=e-Mo,o=Qt(n*n+r*r);Nx+=o*(So+t)/2,kx+=o*(Mo+e)/2,$f+=o,Ua(So=t,Mo=e)}function zk(){Qr.point=Ua}function Zj(){Qr.point=Kj}function Jj(){jk(Yk,Uk)}function Kj(t,e){Qr.point=jk,Ua(Yk=So=t,Uk=Mo=e)}function jk(t,e){var n=t-So,r=e-Mo,o=Qt(n*n+r*r);Nx+=o*(So+t)/2,kx+=o*(Mo+e)/2,$f+=o,o=Mo*t-So*e,T6+=o*(So+t),I6+=o*(Mo+e),Gp+=o*3,Ua(So=t,Mo=e)}var C6=Qr;function Lx(t){this._context=t}Lx.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,je);break}}},result:Ee};var k6=new on,N6,Xk,Wk,Hp,Qp,Rx={point:Ee,lineStart:function(){Rx.point=tX},lineEnd:function(){N6&&Vk(Xk,Wk),Rx.point=Ee},polygonStart:function(){N6=!0},polygonEnd:function(){N6=null},result:function(){var t=+k6;return k6=new on,t}};function tX(t,e){Rx.point=Vk,Xk=Hp=t,Wk=Qp=e}function Vk(t,e){Hp-=t,Qp-=e,k6.add(Qt(Hp*Hp+Qp*Qp)),Hp=t,Qp=e}var L6=Rx;var Gk,Ox,Hk,Qk,Df=class{constructor(e){this._append=e==null?Zk:eX(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!==Hk||this._append!==Ox){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`,Hk=r,Ox=this._append,Qk=this._,this._=o}this._+=Qk;break}}}result(){let e=this._;return this._="",e.length?e:null}};function Zk(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function eX(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Zk;if(e!==Gk){let n=10**e;Gk=e,Ox=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 Ox}function Xe(t,e){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),or(a,o(i))),i.result()}return s.area=function(a){return or(a,o(M6)),M6.result()},s.measure=function(a){return or(a,o(L6)),L6.result()},s.bounds=function(a){return or(a,o(Of)),Of.result()},s.centroid=function(a){return or(a,o(C6)),C6.result()},s.projection=function(a){return arguments.length?(o=a==null?(t=null,Xp):(t=a).stream,s):t},s.context=function(a){return arguments.length?(i=a==null?(e=null,new Df(n)):new Lx(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 Df(n)),s},s.projection(t).digits(n).context(e)}function ja(t){return{stream:Pf(t)}}function Pf(t){return function(e){var n=new R6;for(var r in t)n[r]=t[r];return n.stream=e,n}}function R6(){}R6.prototype={constructor:R6,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 O6(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),or(n,t.stream(Of)),e(Of.result()),r!=null&&t.clipExtent(r),t}function Zp(t,e,n){return O6(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 $x(t,e,n){return Zp(t,[[0,0],e],n)}function Dx(t,e,n){return O6(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 Px(t,e,n){return O6(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 Jk=16,nX=Q(30*At);function $6(t,e){return+e?oX(t,e):rX(t)}function rX(t){return Pf({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function oX(t,e){function n(r,o,i,s,a,c,f,u,p,l,d,h,m,g){var x=f-r,y=u-o,b=x*x+y*y;if(b>4*e&&m--){var w=s+l,_=a+d,v=c+h,S=Qt(w*w+_*_+v*v),E=ne(v/=S),T=St(St(v)-1)<J||St(i-p)<J?(i+p)/2:Ae(_,w),I=t(T,E),A=I[0],k=I[1],O=A-r,M=k-o,C=y*O-x*M;(C*C/b>e||St((x*O+y*M)/b-.5)>.3||s*l+a*d+c*h<nX)&&(n(r,o,i,s,a,c,A,k,T,w/=S,_/=S,v,m,g),g.point(A,k),n(A,k,T,w,_,v,f,u,p,l,d,h,m,g))}}return function(r){var o,i,s,a,c,f,u,p,l,d,h,m,g={point:x,lineStart:y,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=_},polygonEnd:function(){r.polygonEnd(),g.lineStart=y}};function x(E,T){E=t(E,T),r.point(E[0],E[1])}function y(){p=NaN,g.point=b,r.lineStart()}function b(E,T){var I=_o([E,T]),A=t(E,T);n(p,l,u,d,h,m,p=A[0],l=A[1],u=E,d=I[0],h=I[1],m=I[2],Jk,r),r.point(p,l)}function w(){g.point=x,r.lineEnd()}function _(){y(),g.point=v,g.lineEnd=S}function v(E,T){b(o=E,T),i=p,s=l,a=d,c=h,f=m,g.point=b}function S(){n(p,l,u,d,h,m,i,s,o,a,c,f,Jk,r),g.lineEnd=w,w()}return g}}var iX=Pf({point:function(t,e){this.stream.point(t*At,e*At)}});function sX(t){return Pf({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function aX(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 Kk(t,e,n,r,o,i){if(!i)return aX(t,e,n,r,o);var s=Q(i),a=H(i),c=s*t,f=a*t,u=s/t,p=a/t,l=(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*(u*m-p*g+l),o*(d-p*m-u*g)]},h}function fn(t){return D6(function(){return t})()}function D6(t){var e,n=150,r=480,o=250,i=0,s=0,a=0,c=0,f=0,u,p=0,l=1,d=1,h=null,m=x6,g=null,x,y,b,w=Xp,_=.5,v,S,E,T,I;function A(C){return E(C[0]*At,C[1]*At)}function k(C){return C=E.invert(C[0],C[1]),C&&[C[0]*me,C[1]*me]}A.stream=function(C){return T&&I===C?T:T=iX(sX(u)(m(v(w(I=C)))))},A.preclip=function(C){return arguments.length?(m=C,h=void 0,M()):m},A.postclip=function(C){return arguments.length?(w=C,g=x=y=b=null,M()):w},A.clipAngle=function(C){return arguments.length?(m=+C?Rk(h=C*At):(h=null,x6),M()):h*me},A.clipExtent=function(C){return arguments.length?(w=C==null?(g=x=y=b=null,Xp):Lf(g=+C[0][0],x=+C[0][1],y=+C[1][0],b=+C[1][1]),M()):g==null?null:[[g,x],[y,b]]},A.scale=function(C){return arguments.length?(n=+C,O()):n},A.translate=function(C){return arguments.length?(r=+C[0],o=+C[1],O()):[r,o]},A.center=function(C){return arguments.length?(i=C[0]%360*At,s=C[1]%360*At,O()):[i*me,s*me]},A.rotate=function(C){return arguments.length?(a=C[0]%360*At,c=C[1]%360*At,f=C.length>2?C[2]%360*At:0,O()):[a*me,c*me,f*me]},A.angle=function(C){return arguments.length?(p=C%360*At,O()):p*me},A.reflectX=function(C){return arguments.length?(l=C?-1:1,O()):l<0},A.reflectY=function(C){return arguments.length?(d=C?-1:1,O()):d<0},A.precision=function(C){return arguments.length?(v=$6(S,_=C*C),M()):Qt(_)},A.fitExtent=function(C,N){return Zp(A,C,N)},A.fitSize=function(C,N){return $x(A,C,N)},A.fitWidth=function(C,N){return Dx(A,C,N)},A.fitHeight=function(C,N){return Px(A,C,N)};function O(){var C=Kk(n,0,0,l,d,p).apply(null,e(i,s)),N=Kk(n,r-C[0],o-C[1],l,d,p);return u=m6(a,c,f),S=Up(e,N),E=Up(u,S),v=$6(S,_),M()}function M(){return T=I=null,A}return function(){return e=t.apply(this,arguments),A.invert=e.invert&&k,O()}}function Ff(t){var e=0,n=bt/3,r=D6(t),o=r(e,n);return o.parallels=function(i){return arguments.length?r(e=i[0]*At,n=i[1]*At):[e*me,n*me]},o}function t9(t){var e=Q(t);function n(r,o){return[r*e,H(o)/e]}return n.invert=function(r,o){return[r/e,ne(o*e)]},n}function e9(t,e){var n=H(t),r=(n+H(e))/2;if(St(r)<J)return t9(t);var o=1+n*(2*r-n),i=Qt(o)/r;function s(a,c){var f=Qt(o-2*r*H(c))/r;return[f*H(a*=r),i-f*Q(a)]}return s.invert=function(a,c){var f=i-c,u=Ae(a,St(f))*yn(f);return f*r<0&&(u-=bt*yn(a)*yn(f)),[u/r,ne((o-(a*a+f*f)*r*r)/(2*r))]},s}function xs(){return Ff(e9).scale(155.424).center([0,33.6442])}function Jp(){return xs().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function cX(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 P6(){var t,e,n=Jp(),r,o=xs().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=xs().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,f={point:function(l,d){c=[l,d]}};function u(l){var d=l[0],h=l[1];return c=null,r.point(d,h),c||(i.point(d,h),c)||(a.point(d,h),c)}u.invert=function(l){var d=n.scale(),h=n.translate(),m=(l[0]-h[0])/d,g=(l[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(l)},u.stream=function(l){return t&&e===l?t:t=cX([n.stream(e=l),o.stream(l),s.stream(l)])},u.precision=function(l){return arguments.length?(n.precision(l),o.precision(l),s.precision(l),p()):n.precision()},u.scale=function(l){return arguments.length?(n.scale(l),o.scale(l*.35),s.scale(l),u.translate(n.translate())):n.scale()},u.translate=function(l){if(!arguments.length)return n.translate();var d=n.scale(),h=+l[0],m=+l[1];return r=n.translate(l).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+J,m+.12*d+J],[h-.214*d-J,m+.234*d-J]]).stream(f),a=s.translate([h-.205*d,m+.212*d]).clipExtent([[h-.214*d+J,m+.166*d+J],[h-.115*d-J,m+.234*d-J]]).stream(f),p()},u.fitExtent=function(l,d){return Zp(u,l,d)},u.fitSize=function(l,d){return $x(u,l,d)},u.fitWidth=function(l,d){return Dx(u,l,d)},u.fitHeight=function(l,d){return Px(u,l,d)};function p(){return t=e=null,u}return u.scale(1070)}function Fx(t){return function(e,n){var r=Q(e),o=Q(n),i=t(r*o);return i===1/0?[2,0]:[i*o*H(e),i*H(n)]}}function Ao(t){return function(e,n){var r=Qt(e*e+n*n),o=t(r),i=H(o),s=Q(o);return[Ae(e*i,r*s),ne(r&&n*i/r)]}}var F6=Fx(function(t){return Qt(2/(1+t))});F6.invert=Ao(function(t){return 2*ne(t/2)});function q6(){return fn(F6).scale(124.75).clipAngle(180-.001)}var B6=Fx(function(t){return(t=dx(t))&&t/H(t)});B6.invert=Ao(function(t){return t});function z6(){return fn(B6).scale(79.4188).clipAngle(180-.001)}function qf(t,e){return[t,Ya(Cf((Ht+e)/2))]}qf.invert=function(t,e){return[t,2*Cr(ux(e))-Ht]};function Y6(){return U6(qf).scale(961/je)}function U6(t){var e=fn(t),n=e.center,r=e.scale,o=e.translate,i=e.clipExtent,s=null,a,c,f;e.scale=function(p){return arguments.length?(r(p),u()):r()},e.translate=function(p){return arguments.length?(o(p),u()):o()},e.center=function(p){return arguments.length?(n(p),u()):n()},e.clipExtent=function(p){return arguments.length?(p==null?s=a=c=f=null:(s=+p[0][0],a=+p[0][1],c=+p[1][0],f=+p[1][1]),u()):s==null?null:[[s,a],[c,f]]};function u(){var p=bt*r(),l=e(Ik(e.rotate()).invert([0,0]));return i(s==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:t===qf?[[Math.max(l[0]-p,s),a],[Math.min(l[0]+p,c),f]]:[[s,Math.max(l[1]-p,a)],[c,Math.min(l[1]+p,f)]])}return u()}function qx(t){return Cf((Ht+t)/2)}function n9(t,e){var n=Q(t),r=t===e?H(t):Ya(n/Q(e))/Ya(qx(e)/qx(t)),o=n*px(qx(t),r)/r;if(!r)return qf;function i(s,a){o>0?a<-Ht+J&&(a=-Ht+J):a>Ht-J&&(a=Ht-J);var c=o/px(qx(a),r);return[c*H(r*s),o-c*Q(r*s)]}return i.invert=function(s,a){var c=o-a,f=yn(r)*Qt(s*s+c*c),u=Ae(s,St(c))*yn(c);return c*r<0&&(u-=bt*yn(s)*yn(c)),[u/r,2*Cr(px(o/f,1/r))-Ht]},i}function j6(){return Ff(n9).scale(109.5).parallels([30,30])}function Bf(t,e){return[t,e]}Bf.invert=Bf;function X6(){return fn(Bf).scale(152.63)}function r9(t,e){var n=Q(t),r=t===e?H(t):(n-Q(e))/(e-t),o=n/r+t;if(St(r)<J)return Bf;function i(s,a){var c=o-a,f=r*s;return[c*H(f),o-c*Q(f)]}return i.invert=function(s,a){var c=o-a,f=Ae(s,St(c))*yn(c);return c*r<0&&(f-=bt*yn(s)*yn(c)),[f/r,o-yn(r)*Qt(s*s+c*c)]},i}function W6(){return Ff(r9).scale(131.154).center([0,13.9389])}var Kp=1.340264,td=-.081106,ed=893e-6,nd=.003796,Bx=Qt(3)/2,fX=12;function V6(t,e){var n=ne(Bx*H(e)),r=n*n,o=r*r*r;return[t*Q(n)/(Bx*(Kp+3*td*r+o*(7*ed+9*nd*r))),n*(Kp+td*r+o*(ed+nd*r))]}V6.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,i=0,s,a,c;i<fX&&(a=n*(Kp+td*r+o*(ed+nd*r))-e,c=Kp+3*td*r+o*(7*ed+9*nd*r),n-=s=a/c,r=n*n,o=r*r*r,!(St(s)<za));++i);return[Bx*t*(Kp+3*td*r+o*(7*ed+9*nd*r))/Q(n),ne(H(n)/Bx)]};function G6(){return fn(V6).scale(177.158)}function H6(t,e){var n=Q(e),r=Q(t)*n;return[n*H(t)/r,H(e)/r]}H6.invert=Ao(Cr);function Q6(){return fn(H6).scale(144.049).clipAngle(60)}function Z6(t,e){return[Q(e)*H(t),H(e)]}Z6.invert=Ao(ne);function J6(){return fn(Z6).scale(249.5).clipAngle(90+J)}function K6(t,e){var n=Q(e),r=1+Q(t)*n;return[n*H(t)/r,H(e)/r]}K6.invert=Ao(function(t){return 2*Cr(t)});function t3(){return fn(K6).scale(250).clipAngle(142)}function e3(t,e){return[Ya(Cf((Ht+e)/2)),-t]}e3.invert=function(t,e){return[-e,2*Cr(ux(t))-Ht]};function n3(){var t=U6(e3),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 uX(t,e){return t.parent===e.parent?1:2}function lX(t){return t.reduce(pX,0)/t.length}function pX(t,e){return t+e.x}function dX(t){return 1+t.reduce(hX,0)}function hX(t,e){return Math.max(t,e.y)}function mX(t){for(var e;e=t.children;)t=e[0];return t}function gX(t){for(var e;e=t.children;)t=e[e.length-1];return t}function zx(){var t=uX,e=1,n=1,r=!1;function o(i){var s,a=0;i.eachAfter(function(l){var d=l.children;d?(l.x=lX(d),l.y=dX(d)):(l.x=s?a+=t(l,s):0,l.y=0,s=l)});var c=mX(i),f=gX(i),u=c.x-t(c,f)/2,p=f.x+t(f,c)/2;return i.eachAfter(r?function(l){l.x=(l.x-i.x)*e,l.y=(i.y-l.y)*n}:function(l){l.x=(l.x-u)/(p-u)*e,l.y=(1-(i.y?l.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 xX(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 o9(){return this.eachAfter(xX)}function i9(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}function s9(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 a9(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 c9(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}function f9(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 u9(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function l9(t){for(var e=this,n=yX(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 yX(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 p9(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function d9(){return Array.from(this)}function h9(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function m9(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*g9(){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 r3(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=vX)):e===void 0&&(e=wX);for(var n=new ys(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 ys(s[a])),i.parent=r,i.depth=r.depth+1;return n.eachBefore(o3)}function bX(){return r3(this).eachBefore(_X)}function wX(t){return t.children}function vX(t){return Array.isArray(t)?t[1]:null}function _X(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function o3(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function ys(t){this.data=t,this.depth=this.height=0,this.parent=null}ys.prototype=r3.prototype={constructor:ys,count:o9,each:i9,eachAfter:a9,eachBefore:s9,find:c9,sum:f9,sort:u9,path:l9,ancestors:p9,descendants:d9,leaves:h9,links:m9,copy:bX,[Symbol.iterator]:g9};function Yx(t){return t==null?null:SX(t)}function SX(t){if(typeof t!="function")throw new Error;return t}var MX={depth:-1},x9={},i3={};function AX(t){return t.id}function EX(t){return t.parentId}function Ux(){var t=AX,e=EX,n;function r(o){var i=Array.from(o),s=t,a=e,c,f,u,p,l,d,h,m,g=new Map;if(n!=null){let x=i.map((w,_)=>TX(n(w,_,o))),y=x.map(y9),b=new Set(x).add("");for(let w of y)b.has(w)||(b.add(w),x.push(w),y.push(y9(w)),i.push(i3));s=(w,_)=>x[_],a=(w,_)=>y[_]}for(u=0,c=i.length;u<c;++u)f=i[u],d=i[u]=new ys(f),(h=s(f,u,o))!=null&&(h+="")&&(m=d.id=h,g.set(m,g.has(m)?x9:d)),(h=a(f,u,o))!=null&&(h+="")&&(d.parent=h);for(u=0;u<c;++u)if(d=i[u],h=d.parent){if(l=g.get(h),!l)throw new Error("missing: "+h);if(l===x9)throw new Error("ambiguous: "+h);l.children?l.children.push(d):l.children=[d],d.parent=l}else{if(p)throw new Error("multiple roots");p=d}if(!p)throw new Error("no root");if(n!=null){for(;p.data===i3&&p.children.length===1;)p=p.children[0],--c;for(let x=i.length-1;x>=0&&(d=i[x],d.data===i3);--x)d.data=null}if(p.parent=MX,p.eachBefore(function(x){x.depth=x.parent.depth+1,--c}).eachBefore(o3),p.parent=null,c>0)throw new Error("cycle");return p}return r.id=function(o){return arguments.length?(t=Yx(o),r):t},r.parentId=function(o){return arguments.length?(e=Yx(o),r):e},r.path=function(o){return arguments.length?(n=Yx(o),r):n},r}function TX(t){t=`${t}`;let e=t.length;return s3(t,e-1)&&!s3(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function y9(t){let e=t.length;if(e<2)return"";for(;--e>1&&!s3(t,e););return t.slice(0,e)}function s3(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}function IX(t,e){return t.parent===e.parent?1:2}function a3(t){var e=t.children;return e?e[0]:t.t}function c3(t){var e=t.children;return e?e[e.length-1]:t.t}function CX(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 NX(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 kX(t,e,n){return t.a.parent===e.parent?t.a:n}function jx(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}jx.prototype=Object.create(ys.prototype);function LX(t){for(var e=new jx(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 jx(i[s],s)),o.parent=n;return(e.parent=new jx(null,0)).children=[e],e}function Xa(){var t=IX,e=1,n=1,r=null;function o(f){var u=LX(f);if(u.eachAfter(i),u.parent.m=-u.z,u.eachBefore(s),r)f.eachBefore(c);else{var p=f,l=f,d=f;f.eachBefore(function(y){y.x<p.x&&(p=y),y.x>l.x&&(l=y),y.depth>d.depth&&(d=y)});var h=p===l?1:t(p,l)/2,m=h-p.x,g=e/(l.x+h+m),x=n/(d.depth||1);f.eachBefore(function(y){y.x=(y.x+m)*g,y.y=y.depth*x})}return f}function i(f){var u=f.children,p=f.parent.children,l=f.i?p[f.i-1]:null;if(u){NX(f);var d=(u[0].z+u[u.length-1].z)/2;l?(f.z=l.z+t(f._,l._),f.m=f.z-d):f.z=d}else l&&(f.z=l.z+t(f._,l._));f.parent.A=a(f,l,f.parent.A||p[0])}function s(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function a(f,u,p){if(u){for(var l=f,d=f,h=u,m=l.parent.children[0],g=l.m,x=d.m,y=h.m,b=m.m,w;h=c3(h),l=a3(l),h&&l;)m=a3(m),d=c3(d),d.a=f,w=h.z+y-l.z-g+t(h._,l._),w>0&&(CX(kX(h,f,p),f,w),g+=w,x+=w),y+=h.m,g+=l.m,b+=m.m,x+=d.m;h&&!c3(d)&&(d.t=h,d.m+=y-x),l&&!a3(m)&&(m.t=l,m.m+=g-b,p=f)}return p}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 b9=23283064365386963e-26;function Wa(t=Math.random()){let e=(0<=t&&t<1?t/b9:Math.abs(t))|0;return()=>(e=1664525*e+1013904223|0,b9*(e>>>0))}function Te(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function rd(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 od=Symbol("implicit");function Va(){var t=new Tn,e=[],n=[],r=od;function o(i){let s=t.get(i);if(s===void 0){if(r!==od)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 Tn;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 Va(e,n).unknown(r)},Te.apply(o,arguments),o}function bs(){var t=Va().unknown(void 0),e=t.domain,n=t.range,r=0,o=1,i,s,a=!1,c=0,f=0,u=.5;delete t.unknown;function p(){var l=e().length,d=o<r,h=d?o:r,m=d?r:o;i=(m-h)/Math.max(1,l-c+f*2),a&&(i=Math.floor(i)),h+=(m-h-i*(l-c))*u,s=i*(1-c),a&&(h=Math.round(h),s=Math.round(s));var g=be(l).map(function(x){return h+i*x});return n(d?g.reverse():g)}return t.domain=function(l){return arguments.length?(e(l),p()):e()},t.range=function(l){return arguments.length?([r,o]=l,r=+r,o=+o,p()):[r,o]},t.rangeRound=function(l){return[r,o]=l,r=+r,o=+o,a=!0,p()},t.bandwidth=function(){return s},t.step=function(){return i},t.round=function(l){return arguments.length?(a=!!l,p()):a},t.padding=function(l){return arguments.length?(c=Math.min(1,f=+l),p()):c},t.paddingInner=function(l){return arguments.length?(c=Math.min(1,l),p()):c},t.paddingOuter=function(l){return arguments.length?(f=+l,p()):f},t.align=function(l){return arguments.length?(u=Math.max(0,Math.min(1,l)),p()):u},t.copy=function(){return bs(e(),[r,o]).round(a).paddingInner(c).paddingOuter(f).align(u)},Te.apply(p(),arguments)}function w9(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return w9(e())},t}function f3(){return w9(bs.apply(null,arguments).paddingInner(1))}function u3(t){return function(){return t}}function zf(t){return+t}var v9=[0,1];function Gn(t){return t}function l3(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:u3(isNaN(e)?NaN:.5)}function RX(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function OX(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=l3(o,r),i=n(s,i)):(r=l3(r,o),i=n(i,s)),function(a){return i(r(a))}}function $X(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]=l3(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=ci(t,a,1,r)-1;return i[c](o[c](a))}}function Eo(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ga(){var t=v9,e=v9,n=rr,r,o,i,s=Gn,a,c,f;function u(){var l=Math.min(t.length,e.length);return s!==Gn&&(s=RX(t[0],t[l-1])),a=l>2?$X:OX,c=f=null,p}function p(l){return l==null||isNaN(l=+l)?i:(c||(c=a(t.map(r),e,n)))(r(s(l)))}return p.invert=function(l){return s(o((f||(f=a(e,t.map(r),ee)))(l)))},p.domain=function(l){return arguments.length?(t=Array.from(l,zf),u()):t.slice()},p.range=function(l){return arguments.length?(e=Array.from(l),u()):e.slice()},p.rangeRound=function(l){return e=Array.from(l),n=$a,u()},p.clamp=function(l){return arguments.length?(s=l?!0:Gn,u()):s!==Gn},p.interpolate=function(l){return arguments.length?(n=l,u()):n},p.unknown=function(l){return arguments.length?(i=l,p):i},function(l,d){return r=l,o=d,u()}}function id(){return Ga()(Gn,Gn)}function p3(t,e,n,r){var o=uf(t,e,n),i;switch(r=vo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=i6(o,s))&&(r.precision=i),fx(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=s6(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=o6(o))&&(r.precision=i-(r.type==="%")*2);break}}return Ir(r)}function wi(t){var e=t.domain;return t.ticks=function(n){var r=e();return an(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return p3(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,u=10;for(a<s&&(f=s,s=a,a=f,f=o,o=i,i=f);u-- >0;){if(f=ui(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 vi(){var t=id();return t.copy=function(){return Eo(t,vi())},Te.apply(t,arguments),wi(t)}function sd(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,zf),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return sd(t).unknown(e)},t=arguments.length?Array.from(t,zf):[0,1],wi(n)}function ad(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 _9(t){return Math.log(t)}function S9(t){return Math.exp(t)}function DX(t){return-Math.log(-t)}function PX(t){return-Math.exp(-t)}function FX(t){return isFinite(t)?+("1e"+t):t<0?0:t}function qX(t){return t===10?FX:t===Math.E?Math.exp:e=>Math.pow(t,e)}function BX(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 M9(t){return(e,n)=>-t(-e,n)}function d3(t){let e=t(_9,S9),n=e.domain,r=10,o,i;function s(){return o=BX(r),i=qX(r),n()[0]<0?(o=M9(o),i=M9(i),t(DX,PX)):t(_9,S9),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],u=c[c.length-1],p=u<f;p&&([f,u]=[u,f]);let l=o(f),d=o(u),h,m,g=a==null?10:+a,x=[];if(!(r%1)&&d-l<g){if(l=Math.floor(l),d=Math.ceil(d),f>0){for(;l<=d;++l)for(h=1;h<r;++h)if(m=l<0?h/i(-l):h*i(l),!(m<f)){if(m>u)break;x.push(m)}}else for(;l<=d;++l)for(h=r-1;h>=1;--h)if(m=l>0?h/i(-l):h*i(l),!(m<f)){if(m>u)break;x.push(m)}x.length*2<g&&(x=an(f,u,g))}else x=an(l,d,Math.min(d-l,g)).map(i);return p?x.reverse():x},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=vo(c)).precision==null&&(c.trim=!0),c=Ir(c)),a===1/0)return c;let f=Math.max(1,r*a/e.ticks().length);return u=>{let p=u/i(Math.round(o(u)));return p*r<r-.5&&(p*=r),p<=f?c(u):""}},e.nice=()=>n(ad(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function cd(){let t=d3(Ga()).domain([1,10]);return t.copy=()=>Eo(t,cd()).base(t.base()),Te.apply(t,arguments),t}function A9(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function E9(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function h3(t){var e=1,n=t(A9(e),E9(e));return n.constant=function(r){return arguments.length?t(A9(e=+r),E9(e)):e},wi(n)}function fd(){var t=h3(Ga());return t.copy=function(){return Eo(t,fd()).constant(t.constant())},Te.apply(t,arguments)}function T9(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function zX(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function YX(t){return t<0?-t*t:t*t}function m3(t){var e=t(Gn,Gn),n=1;function r(){return n===1?t(Gn,Gn):n===.5?t(zX,YX):t(T9(n),T9(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},wi(e)}function ud(){var t=m3(Ga());return t.copy=function(){return Eo(t,ud()).exponent(t.exponent())},Te.apply(t,arguments),t}function ld(){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]=h_(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[ci(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(yt),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 ld().domain(t).range(e).unknown(r)},Te.apply(i,arguments)}function pd(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[ci(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 pd().domain(t).range(e).unknown(n)},Te.apply(o,arguments)}var g3=new Date,x3=new Date;function Jt(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=>Jt(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)=>(g3.setTime(+i),x3.setTime(+s),t(g3),t(x3),Math.floor(n(g3,x3))),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 dd=Jt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);dd.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Jt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):dd);var IMt=dd.range;var We=Jt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),I9=We.range;var _i=Jt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),UX=_i.range,Si=Jt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),jX=Si.range;var Mi=Jt(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()),XX=Mi.range,Ai=Jt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),WX=Ai.range;var Nr=Jt(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),VX=Nr.range,Za=Jt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),GX=Za.range,Ja=Jt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),HX=Ja.range;function Ka(t){return Jt(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 ir=Ka(0),ws=Ka(1),Xx=Ka(2),Wx=Ka(3),Io=Ka(4),Vx=Ka(5),Gx=Ka(6),N9=ir.range,QX=ws.range,ZX=Xx.range,JX=Wx.range,KX=Io.range,tW=Vx.range,eW=Gx.range;function tc(t){return Jt(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 sr=tc(0),vs=tc(1),Hx=tc(2),Qx=tc(3),Co=tc(4),Zx=tc(5),Jx=tc(6),k9=sr.range,nW=vs.range,rW=Hx.range,oW=Qx.range,iW=Co.range,sW=Zx.range,aW=Jx.range;var Ei=Jt(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()),cW=Ei.range,Ti=Jt(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()),fW=Ti.range;var bn=Jt(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());bn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Jt(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 uW=bn.range,wn=Jt(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());wn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Jt(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 lW=wn.range;function R9(t,e,n,r,o,i){let s=[[We,1,1e3],[We,5,5*1e3],[We,15,15*1e3],[We,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,u,p){let l=u<f;l&&([f,u]=[u,f]);let d=p&&typeof p.range=="function"?p:c(f,u,p),h=d?d.range(f,+u+1):[];return l?h.reverse():h}function c(f,u,p){let l=Math.abs(u-f)/p,d=Xr(([,,g])=>g).right(s,l);if(d===s.length)return t.every(uf(f/31536e6,u/31536e6,p));if(d===0)return dd.every(Math.max(uf(f,u,p),1));let[h,m]=s[l/s[d-1][2]<s[d][2]/l?d-1:d];return h.every(m)}return[a,c]}var[y3,md]=R9(wn,Ti,sr,Ja,Ai,Si),[b3,w3]=R9(bn,Ei,ir,Nr,Mi,_i);function v3(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 _3(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 gd(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function S3(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=xd(o),u=yd(o),p=xd(i),l=yd(i),d=xd(s),h=yd(s),m=xd(a),g=yd(a),x=xd(c),y=yd(c),b={a:L,A:D,b:$,B:P,c:null,d:q9,e:q9,f:$W,g:XW,G:VW,H:LW,I:RW,j:OW,L:j9,m:DW,M:PW,p:F,q,Q:Y9,s:U9,S:FW,u:qW,U:BW,V:zW,w:YW,W:UW,x:null,X:null,y:jW,Y:WW,Z:GW,"%":z9},w={a:V,A:K,b:et,B:rt,c:null,d:B9,e:B9,f:JW,g:cV,G:uV,H:HW,I:QW,j:ZW,L:W9,m:KW,M:tV,p:j,q:nt,Q:Y9,s:U9,S:eV,u:nV,U:rV,V:oV,w:iV,W:sV,x:null,X:null,y:aV,Y:fV,Z:lV,"%":z9},_={a:I,A,b:k,B:O,c:M,d:P9,e:P9,f:IW,g:D9,G:$9,H:F9,I:F9,j:MW,L:TW,m:SW,M:AW,p:T,q:_W,Q:NW,s:kW,S:EW,u:xW,U:yW,V:bW,w:gW,W:wW,x:C,X:N,y:D9,Y:$9,Z:vW,"%":CW};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,G){return function(tt){var B=[],_t=-1,ct=0,kt=Y.length,Lt,Z,jt;for(tt instanceof Date||(tt=new Date(+tt));++_t<kt;)Y.charCodeAt(_t)===37&&(B.push(Y.slice(ct,_t)),(Z=O9[Lt=Y.charAt(++_t)])!=null?Lt=Y.charAt(++_t):Z=Lt==="e"?" ":"0",(jt=G[Lt])&&(Lt=jt(tt,Z)),B.push(Lt),ct=_t+1);return B.push(Y.slice(ct,_t)),B.join("")}}function S(Y,G){return function(tt){var B=gd(1900,void 0,1),_t=E(B,Y,tt+="",0),ct,kt;if(_t!=tt.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(G&&!("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=_3(gd(B.y,0,1)),kt=ct.getUTCDay(),ct=kt>4||kt===0?vs.ceil(ct):vs(ct),ct=Za.offset(ct,(B.V-1)*7),B.y=ct.getUTCFullYear(),B.m=ct.getUTCMonth(),B.d=ct.getUTCDate()+(B.w+6)%7):(ct=v3(gd(B.y,0,1)),kt=ct.getDay(),ct=kt>4||kt===0?ws.ceil(ct):ws(ct),ct=Nr.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),kt="Z"in B?_3(gd(B.y,0,1)).getUTCDay():v3(gd(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(kt+5)%7:B.w+B.U*7-(kt+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,_3(B)):v3(B)}}function E(Y,G,tt,B){for(var _t=0,ct=G.length,kt=tt.length,Lt,Z;_t<ct;){if(B>=kt)return-1;if(Lt=G.charCodeAt(_t++),Lt===37){if(Lt=G.charAt(_t++),Z=_[Lt in O9?G.charAt(_t++):Lt],!Z||(B=Z(Y,tt,B))<0)return-1}else if(Lt!=tt.charCodeAt(B++))return-1}return B}function T(Y,G,tt){var B=f.exec(G.slice(tt));return B?(Y.p=u.get(B[0].toLowerCase()),tt+B[0].length):-1}function I(Y,G,tt){var B=d.exec(G.slice(tt));return B?(Y.w=h.get(B[0].toLowerCase()),tt+B[0].length):-1}function A(Y,G,tt){var B=p.exec(G.slice(tt));return B?(Y.w=l.get(B[0].toLowerCase()),tt+B[0].length):-1}function k(Y,G,tt){var B=x.exec(G.slice(tt));return B?(Y.m=y.get(B[0].toLowerCase()),tt+B[0].length):-1}function O(Y,G,tt){var B=m.exec(G.slice(tt));return B?(Y.m=g.get(B[0].toLowerCase()),tt+B[0].length):-1}function M(Y,G,tt){return E(Y,e,G,tt)}function C(Y,G,tt){return E(Y,n,G,tt)}function N(Y,G,tt){return E(Y,r,G,tt)}function L(Y){return s[Y.getDay()]}function D(Y){return i[Y.getDay()]}function $(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 V(Y){return s[Y.getUTCDay()]}function K(Y){return i[Y.getUTCDay()]}function et(Y){return c[Y.getUTCMonth()]}function rt(Y){return a[Y.getUTCMonth()]}function j(Y){return o[+(Y.getUTCHours()>=12)]}function nt(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var G=v(Y+="",b);return G.toString=function(){return Y},G},parse:function(Y){var G=S(Y+="",!1);return G.toString=function(){return Y},G},utcFormat:function(Y){var G=v(Y+="",w);return G.toString=function(){return Y},G},utcParse:function(Y){var G=S(Y+="",!0);return G.toString=function(){return Y},G}}}var O9={"-":"",_:" ",0:"0"},Ve=/^\s*\d+/,dW=/^%/,hW=/[\\^$*+?|[\]().{}]/g;function qt(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 mW(t){return t.replace(hW,"\\$&")}function xd(t){return new RegExp("^(?:"+t.map(mW).join("|")+")","i")}function yd(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function gW(t,e,n){var r=Ve.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function xW(t,e,n){var r=Ve.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function yW(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function bW(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function wW(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function $9(t,e,n){var r=Ve.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function D9(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function vW(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 _W(t,e,n){var r=Ve.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function SW(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function P9(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function MW(t,e,n){var r=Ve.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function F9(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function AW(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function EW(t,e,n){var r=Ve.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function TW(t,e,n){var r=Ve.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function IW(t,e,n){var r=Ve.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function CW(t,e,n){var r=dW.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function NW(t,e,n){var r=Ve.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function kW(t,e,n){var r=Ve.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function q9(t,e){return qt(t.getDate(),e,2)}function LW(t,e){return qt(t.getHours(),e,2)}function RW(t,e){return qt(t.getHours()%12||12,e,2)}function OW(t,e){return qt(1+Nr.count(bn(t),t),e,3)}function j9(t,e){return qt(t.getMilliseconds(),e,3)}function $W(t,e){return j9(t,e)+"000"}function DW(t,e){return qt(t.getMonth()+1,e,2)}function PW(t,e){return qt(t.getMinutes(),e,2)}function FW(t,e){return qt(t.getSeconds(),e,2)}function qW(t){var e=t.getDay();return e===0?7:e}function BW(t,e){return qt(ir.count(bn(t)-1,t),e,2)}function X9(t){var e=t.getDay();return e>=4||e===0?Io(t):Io.ceil(t)}function zW(t,e){return t=X9(t),qt(Io.count(bn(t),t)+(bn(t).getDay()===4),e,2)}function YW(t){return t.getDay()}function UW(t,e){return qt(ws.count(bn(t)-1,t),e,2)}function jW(t,e){return qt(t.getFullYear()%100,e,2)}function XW(t,e){return t=X9(t),qt(t.getFullYear()%100,e,2)}function WW(t,e){return qt(t.getFullYear()%1e4,e,4)}function VW(t,e){var n=t.getDay();return t=n>=4||n===0?Io(t):Io.ceil(t),qt(t.getFullYear()%1e4,e,4)}function GW(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+qt(e/60|0,"0",2)+qt(e%60,"0",2)}function B9(t,e){return qt(t.getUTCDate(),e,2)}function HW(t,e){return qt(t.getUTCHours(),e,2)}function QW(t,e){return qt(t.getUTCHours()%12||12,e,2)}function ZW(t,e){return qt(1+Za.count(wn(t),t),e,3)}function W9(t,e){return qt(t.getUTCMilliseconds(),e,3)}function JW(t,e){return W9(t,e)+"000"}function KW(t,e){return qt(t.getUTCMonth()+1,e,2)}function tV(t,e){return qt(t.getUTCMinutes(),e,2)}function eV(t,e){return qt(t.getUTCSeconds(),e,2)}function nV(t){var e=t.getUTCDay();return e===0?7:e}function rV(t,e){return qt(sr.count(wn(t)-1,t),e,2)}function V9(t){var e=t.getUTCDay();return e>=4||e===0?Co(t):Co.ceil(t)}function oV(t,e){return t=V9(t),qt(Co.count(wn(t),t)+(wn(t).getUTCDay()===4),e,2)}function iV(t){return t.getUTCDay()}function sV(t,e){return qt(vs.count(wn(t)-1,t),e,2)}function aV(t,e){return qt(t.getUTCFullYear()%100,e,2)}function cV(t,e){return t=V9(t),qt(t.getUTCFullYear()%100,e,2)}function fV(t,e){return qt(t.getUTCFullYear()%1e4,e,4)}function uV(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Co(t):Co.ceil(t),qt(t.getUTCFullYear()%1e4,e,4)}function lV(){return"+0000"}function z9(){return"%"}function Y9(t){return+t}function U9(t){return Math.floor(+t/1e3)}var Yf,Uf,G9,No,H9;M3({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 M3(t){return Yf=S3(t),Uf=Yf.format,G9=Yf.parse,No=Yf.utcFormat,H9=Yf.utcParse,Yf}function pV(t){return new Date(t)}function dV(t){return t instanceof Date?+t:+new Date(+t)}function Kx(t,e,n,r,o,i,s,a,c,f){var u=id(),p=u.invert,l=u.domain,d=f(".%L"),h=f(":%S"),m=f("%I:%M"),g=f("%I %p"),x=f("%a %d"),y=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?x:y:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(p(v))},u.domain=function(v){return arguments.length?l(Array.from(v,dV)):l().map(pV)},u.ticks=function(v){var S=l();return t(S[0],S[S.length-1],v??10)},u.tickFormat=function(v,S){return S==null?_:f(S)},u.nice=function(v){var S=l();return(!v||typeof v.range!="function")&&(v=e(S[0],S[S.length-1],v??10)),v?l(ad(S,v)):u},u.copy=function(){return Eo(u,Kx(t,e,n,r,o,i,s,a,c,f))},u}function ty(){return Te.apply(Kx(b3,w3,bn,Ei,ir,Nr,Mi,_i,We,Uf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ey(){return Te.apply(Kx(y3,md,wn,Ti,sr,Za,Ai,Si,We,No).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function bd(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function ny(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,f=Gn,u,p=!1,l;function d(m){return isNaN(m=+m)?l:(m=.5+((m=+u(m))-i)*(r*m<r*i?a:c),f(p?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([t,e,n]=m,o=u(t=+t),i=u(e=+e),s=u(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?(p=!!m,d):p},d.interpolator=function(m){return arguments.length?(f=m,d):f};function h(m){return function(g){var x,y,b;return arguments.length?([x,y,b]=g,f=xo(m,[x,y,b]),d):[f(0),f(.5),f(1)]}}return d.range=h(rr),d.rangeRound=h($a),d.unknown=function(m){return arguments.length?(l=m,d):l},function(m){return u=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 wd(){var t=wi(ny()(Gn));return t.copy=function(){return bd(t,wd())},rd.apply(t,arguments)}function ry(){var t=d3(ny()).domain([.1,1,10]);return t.copy=function(){return bd(t,ry()).base(t.base())},rd.apply(t,arguments)}function oy(){var t=h3(ny());return t.copy=function(){return bd(t,oy()).constant(t.constant())},rd.apply(t,arguments)}function iy(){var t=m3(ny());return t.copy=function(){return bd(t,iy()).exponent(t.exponent())},rd.apply(t,arguments)}function X(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 A3=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var E3=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var T3=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var I3=X("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var C3=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var N3=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var k3=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var L3=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var R3=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var O3=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var $3=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ft=t=>N_(t[t.length-1]);var sy=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),ay=ft(sy);var cy=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),fy=ft(cy);var uy=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),ly=ft(uy);var py=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),dy=ft(py);var vd=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),jf=ft(vd);var hy=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),my=ft(hy);var _d=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),Xf=ft(_d);var gy=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),xy=ft(gy);var yy=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),by=ft(yy);var wy=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),vy=ft(wy);var _y=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),Sy=ft(_y);var My=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),Ay=ft(My);var Ey=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),Ty=ft(Ey);var Iy=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),Cy=ft(Iy);var Ny=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),ky=ft(Ny);var Ly=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),Ry=ft(Ly);var Oy=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),$y=ft(Oy);var Dy=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),Py=ft(Dy);var Fy=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),qy=ft(Fy);var By=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),zy=ft(By);var Yy=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),Uy=ft(Yy);var jy=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),Xy=ft(jy);var Wy=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),Vy=ft(Wy);var Gy=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),Hy=ft(Gy);var Qy=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),Zy=ft(Qy);var Jy=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),Ky=ft(Jy);var t1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),e1=ft(t1);function n1(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 r1=bf(kn(300,.5,0),kn(-240,.5,1));var i1=bf(kn(-100,.75,.35),kn(80,1.5,.8)),s1=bf(kn(260,.75,.35),kn(80,1.5,.8)),o1=kn();function a1(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return o1.h=360*t-100,o1.s=1.5-1.5*e,o1.l=.8-.9*e,o1+""}var c1=Re(),hV=Math.PI/3,mV=Math.PI*2/3;function f1(t){var e;return t=(.5-t)*Math.PI,c1.r=255*(e=Math.sin(t))*e,c1.g=255*(e=Math.sin(t+hV))*e,c1.b=255*(e=Math.sin(t+mV))*e,c1+""}function u1(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 l1(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var p1=l1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),d1=l1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),h1=l1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),m1=l1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ie(t){return function(){return t}}var D3=Math.cos;var Wf=Math.min,Sd=Math.sin,Bt=Math.sqrt,P3=1e-12,ec=Math.PI,KEt=ec/2,Vf=2*ec;function g1(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 ds(e)}var rTt=Array.prototype.slice;function x1(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Q9(t){this._context=t}Q9.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 Ii(t){return new Q9(t)}function y1(t){return t[0]}function b1(t){return t[1]}function Md(t,e){var n=Ie(!0),r=null,o=Ii,i=null,s=g1(a);t=typeof t=="function"?t:t===void 0?y1:Ie(t),e=typeof e=="function"?e:e===void 0?b1:Ie(e);function a(c){var f,u=(c=x1(c)).length,p,l=!1,d;for(r==null&&(i=o(d=s())),f=0;f<=u;++f)!(f<u&&n(p=c[f],f,c))===l&&((l=!l)?i.lineStart():i.lineEnd()),l&&i.point(+t(p,f,c),+e(p,f,c));if(d)return i=null,d+""||null}return a.x=function(c){return arguments.length?(t=typeof c=="function"?c:Ie(+c),a):t},a.y=function(c){return arguments.length?(e=typeof c=="function"?c:Ie(+c),a):e},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ie(!!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 Gf(t,e,n){var r=null,o=Ie(!0),i=null,s=Ii,a=null,c=g1(f);t=typeof t=="function"?t:t===void 0?y1:Ie(+t),e=typeof e=="function"?e:e===void 0?Ie(0):Ie(+e),n=typeof n=="function"?n:n===void 0?b1:Ie(+n);function f(p){var l,d,h,m=(p=x1(p)).length,g,x=!1,y,b=new Array(m),w=new Array(m);for(i==null&&(a=s(y=c())),l=0;l<=m;++l){if(!(l<m&&o(g=p[l],l,p))===x)if(x=!x)d=l,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),h=l-1;h>=d;--h)a.point(b[h],w[h]);a.lineEnd(),a.areaEnd()}x&&(b[l]=+t(g,l,p),w[l]=+e(g,l,p),a.point(r?+r(g,l,p):b[l],n?+n(g,l,p):w[l]))}if(y)return a=null,y+""||null}function u(){return Md().defined(o).curve(s).context(i)}return f.x=function(p){return arguments.length?(t=typeof p=="function"?p:Ie(+p),r=null,f):t},f.x0=function(p){return arguments.length?(t=typeof p=="function"?p:Ie(+p),f):t},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Ie(+p),f):r},f.y=function(p){return arguments.length?(e=typeof p=="function"?p:Ie(+p),n=null,f):e},f.y0=function(p){return arguments.length?(e=typeof p=="function"?p:Ie(+p),f):e},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Ie(+p),f):n},f.lineX0=f.lineY0=function(){return u().x(t).y(e)},f.lineY1=function(){return u().x(t).y(n)},f.lineX1=function(){return u().x(r).y(e)},f.defined=function(p){return arguments.length?(o=typeof p=="function"?p:Ie(!!p),f):o},f.curve=function(p){return arguments.length?(s=p,i!=null&&(a=s(i)),f):s},f.context=function(p){return arguments.length?(p==null?i=a=null:a=s(i=p),f):i},f}var w1=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 F3(t){return new w1(t,!0)}function q3(t){return new w1(t,!1)}var gV=Bt(3),Ad={draw(t,e){let n=Bt(e+Wf(e/28,.75))*.59436,r=n/2,o=r*gV;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 Ci={draw(t,e){let n=Bt(e/ec);t.moveTo(n,0),t.arc(0,0,n,0,Vf)}};var Ed={draw(t,e){let n=Bt(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 Z9=Bt(1/3),xV=Z9*2,Td={draw(t,e){let n=Bt(e/xV),r=n*Z9;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}};var Id={draw(t,e){let n=Bt(e)*.62625;t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}};var Cd={draw(t,e){let n=Bt(e-Wf(e/7,2))*.87559;t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}};var Nd={draw(t,e){let n=Bt(e),r=-n/2;t.rect(r,r,n,n)}};var kd={draw(t,e){let n=Bt(e)*.4431;t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};var yV=.8908130915292852,J9=Sd(ec/10)/Sd(7*ec/10),bV=Sd(Vf/10)*J9,wV=-D3(Vf/10)*J9,Ld={draw(t,e){let n=Bt(e*yV),r=bV*n,o=wV*n;t.moveTo(0,-n),t.lineTo(r,o);for(let i=1;i<5;++i){let s=Vf*i/5,a=D3(s),c=Sd(s);t.lineTo(c*n,-a*n),t.lineTo(a*r-c*o,c*r+a*o)}t.closePath()}};var B3=Bt(3),Rd={draw(t,e){let n=-Bt(e/(B3*3));t.moveTo(0,n*2),t.lineTo(-B3*n,-n),t.lineTo(B3*n,-n),t.closePath()}};var vV=Bt(3),Od={draw(t,e){let n=Bt(e)*.6824,r=n/2,o=n*vV/2;t.moveTo(0,-n),t.lineTo(o,r),t.lineTo(-o,r),t.closePath()}};var kr=-.5,Lr=Bt(3)/2,z3=1/Bt(12),_V=(z3/2+1)*3,$d={draw(t,e){let n=Bt(e/_V),r=n/2,o=n*z3,i=r,s=n*z3+n,a=-i,c=s;t.moveTo(r,o),t.lineTo(i,s),t.lineTo(a,c),t.lineTo(kr*r-Lr*o,Lr*r+kr*o),t.lineTo(kr*i-Lr*s,Lr*i+kr*s),t.lineTo(kr*a-Lr*c,Lr*a+kr*c),t.lineTo(kr*r+Lr*o,kr*o-Lr*r),t.lineTo(kr*i+Lr*s,kr*s-Lr*i),t.lineTo(kr*a+Lr*c,kr*c-Lr*a),t.closePath()}};var Hf={draw(t,e){let n=Bt(e-Wf(e/6,1.7))*.6189;t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};var v1=[Ci,Ed,Td,Nd,Ld,Rd,$d],Y3=[Ci,Cd,Hf,Od,Ad,kd,Id];function Rr(){}function Qf(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 Dd(t){this._context=t}Dd.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:Qf(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:Qf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function U3(t){return new Dd(t)}function K9(t){this._context=t}K9.prototype={areaStart:Rr,areaEnd:Rr,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:Qf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function j3(t){return new K9(t)}function tL(t){this._context=t}tL.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:Qf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function X3(t){return new tL(t)}function eL(t,e){this._basis=new Dd(t),this._beta=e}eL.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 W3=function t(e){function n(r){return e===1?new Dd(r):new eL(r,e)}return n.beta=function(r){return t(+r)},n}(.85);function Zf(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 _1(t,e){this._context=t,this._k=(1-e)/6}_1.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:Zf(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:Zf(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 V3=function t(e){function n(r){return new _1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function S1(t,e){this._context=t,this._k=(1-e)/6}S1.prototype={areaStart:Rr,areaEnd:Rr,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:Zf(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 G3=function t(e){function n(r){return new S1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function M1(t,e){this._context=t,this._k=(1-e)/6}M1.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:Zf(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 H3=function t(e){function n(r){return new M1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function Pd(t,e,n){var r=t._x1,o=t._y1,i=t._x2,s=t._y2;if(t._l01_a>P3){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>P3){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*f+t._x1*t._l23_2a-e*t._l12_2a)/u,s=(s*f+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,o,i,s,t._x2,t._y2)}function nL(t,e){this._context=t,this._alpha=e}nL.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:Pd(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 Q3=function t(e){function n(r){return e?new nL(r,e):new _1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function rL(t,e){this._context=t,this._alpha=e}rL.prototype={areaStart:Rr,areaEnd:Rr,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:Pd(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 Z3=function t(e){function n(r){return e?new rL(r,e):new S1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function oL(t,e){this._context=t,this._alpha=e}oL.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:Pd(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 J3=function t(e){function n(r){return e?new oL(r,e):new M1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function iL(t){this._context=t}iL.prototype={areaStart:Rr,areaEnd:Rr,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 K3(t){return new iL(t)}function sL(t){return t<0?-1:1}function aL(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(sL(i)+sL(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(a))||0}function cL(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function tS(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 A1(t){this._context=t}A1.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:tS(this,this._t0,cL(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,tS(this,cL(this,n=aL(this,t,e)),n);break;default:tS(this,this._t0,n=aL(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function fL(t){this._context=new uL(t)}(fL.prototype=Object.create(A1.prototype)).point=function(t,e){A1.prototype.point.call(this,e,t)};function uL(t){this._context=t}uL.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 eS(t){return new A1(t)}function nS(t){return new fL(t)}function pL(t){this._context=t}pL.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=lL(t),o=lL(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 lL(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 rS(t){return new pL(t)}function E1(t,e){this._context=t,this._t=e}E1.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 oS(t){return new E1(t,.5)}function iS(t){return new E1(t,0)}function sS(t){return new E1(t,1)}var Fd=t=>()=>t;function aS(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 ar(t,e,n){this.k=t,this.x=e,this.y=n}ar.prototype={constructor:ar,scale:function(t){return t===1?this:new ar(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ar(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 qd=new ar(1,0,0);cS.prototype=ar.prototype;function cS(t){for(;!t.__zoom;)if(!(t=t.parentNode))return qd;return t.__zoom}function T1(t){t.stopImmediatePropagation()}function Jf(t){t.preventDefault(),t.stopImmediatePropagation()}function SV(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function MV(){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 dL(){return this.__zoom||qd}function AV(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function EV(){return navigator.maxTouchPoints||"ontouchstart"in this}function TV(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 fS(){var t=SV,e=MV,n=TV,r=AV,o=EV,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=D_,f=Ca("start","zoom","end"),u,p,l,d=500,h=150,m=0,g=10;function x(M){M.property("__zoom",dL).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",I).filter(o).on("touchstart.zoom",A).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(M,C,N,L){var D=M.selection?M.selection():M;D.property("__zoom",dL),M!==D?_(M,C,N,L):D.interrupt().each(function(){v(this,arguments).event(L).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},x.scaleBy=function(M,C,N,L){x.scaleTo(M,function(){var D=this.__zoom.k,$=typeof C=="function"?C.apply(this,arguments):C;return D*$},N,L)},x.scaleTo=function(M,C,N,L){x.transform(M,function(){var D=e.apply(this,arguments),$=this.__zoom,P=N==null?w(D):typeof N=="function"?N.apply(this,arguments):N,F=$.invert(P),q=typeof C=="function"?C.apply(this,arguments):C;return n(b(y($,q),P,F),D,s)},N,L)},x.translateBy=function(M,C,N,L){x.transform(M,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof N=="function"?N.apply(this,arguments):N),e.apply(this,arguments),s)},null,L)},x.translateTo=function(M,C,N,L,D){x.transform(M,function(){var $=e.apply(this,arguments),P=this.__zoom,F=L==null?w($):typeof L=="function"?L.apply(this,arguments):L;return n(qd.translate(F[0],F[1]).scale(P.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof N=="function"?-N.apply(this,arguments):-N),$,s)},L,D)};function y(M,C){return C=Math.max(i[0],Math.min(i[1],C)),C===M.k?M:new ar(C,M.x,M.y)}function b(M,C,N){var L=C[0]-N[0]*M.k,D=C[1]-N[1]*M.k;return L===M.x&&D===M.y?M:new ar(M.k,L,D)}function w(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function _(M,C,N,L){M.on("start.zoom",function(){v(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(L).end()}).tween("zoom",function(){var D=this,$=arguments,P=v(D,$).event(L),F=e.apply(D,$),q=N==null?w(F):typeof N=="function"?N.apply(D,$):N,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),K=D.__zoom,et=typeof C=="function"?C.apply(D,$):C,rt=c(K.invert(q).concat(V/K.k),et.invert(q).concat(V/et.k));return function(j){if(j===1)j=et;else{var nt=rt(j),Y=V/nt[2];j=new ar(Y,q[0]-nt[0]*Y,q[1]-nt[1]*Y)}P.zoom(null,j)}})}function v(M,C,N){return!N&&M.__zooming||new S(M,C)}function S(M,C){this.that=M,this.args=C,this.active=0,this.sourceEvent=null,this.extent=e.apply(M,C),this.taps=0}S.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,C){return this.mouse&&M!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var C=Nt(this.that).datum();f.call(M,this.that,new aS(M,{sourceEvent:this.sourceEvent,target:x,type:M,transform:this.that.__zoom,dispatch:f}),C)}};function E(M,...C){if(!t.apply(this,arguments))return;var N=v(this,C).event(M),L=this.__zoom,D=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),$=hn(M);if(N.wheel)(N.mouse[0][0]!==$[0]||N.mouse[0][1]!==$[1])&&(N.mouse[1]=L.invert(N.mouse[0]=$)),clearTimeout(N.wheel);else{if(L.k===D)return;N.mouse=[$,L.invert($)],yo(this),N.start()}Jf(M),N.wheel=setTimeout(P,h),N.zoom("mouse",n(b(y(L,D),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function T(M,...C){if(l||!t.apply(this,arguments))return;var N=M.currentTarget,L=v(this,C,!0).event(M),D=Nt(M.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",V,!0),$=hn(M,N),P=M.clientX,F=M.clientY;mp(M.view),T1(M),L.mouse=[$,this.__zoom.invert($)],yo(this),L.start();function q(K){if(Jf(K),!L.moved){var et=K.clientX-P,rt=K.clientY-F;L.moved=et*et+rt*rt>m}L.event(K).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=hn(K,N),L.mouse[1]),L.extent,s))}function V(K){D.on("mousemove.zoom mouseup.zoom",null),gp(K.view,L.moved),Jf(K),L.event(K).end()}}function I(M,...C){if(t.apply(this,arguments)){var N=this.__zoom,L=hn(M.changedTouches?M.changedTouches[0]:M,this),D=N.invert(L),$=N.k*(M.shiftKey?.5:2),P=n(b(y(N,$),L,D),e.apply(this,C),s);Jf(M),a>0?Nt(this).transition().duration(a).call(_,P,L,M):Nt(this).call(x.transform,P,L,M)}}function A(M,...C){if(t.apply(this,arguments)){var N=M.touches,L=N.length,D=v(this,C,M.changedTouches.length===L).event(M),$,P,F,q;for(T1(M),P=0;P<L;++P)F=N[P],q=hn(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,$=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),$&&(D.taps<2&&(p=q[0],u=setTimeout(function(){u=null},d)),yo(this),D.start())}}function k(M,...C){if(this.__zooming){var N=v(this,C).event(M),L=M.changedTouches,D=L.length,$,P,F,q;for(Jf(M),$=0;$<D;++$)P=L[$],F=hn(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=F:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=F);if(P=N.that.__zoom,N.touch1){var V=N.touch0[0],K=N.touch0[1],et=N.touch1[0],rt=N.touch1[1],j=(j=et[0]-V[0])*j+(j=et[1]-V[1])*j,nt=(nt=rt[0]-K[0])*nt+(nt=rt[1]-K[1])*nt;P=y(P,Math.sqrt(j/nt)),F=[(V[0]+et[0])/2,(V[1]+et[1])/2],q=[(K[0]+rt[0])/2,(K[1]+rt[1])/2]}else if(N.touch0)F=N.touch0[0],q=N.touch0[1];else return;N.zoom("touch",n(b(P,F,q),N.extent,s))}}function O(M,...C){if(this.__zooming){var N=v(this,C).event(M),L=M.changedTouches,D=L.length,$,P;for(T1(M),l&&clearTimeout(l),l=setTimeout(function(){l=null},d),$=0;$<D;++$)P=L[$],N.touch0&&N.touch0[2]===P.identifier?delete N.touch0:N.touch1&&N.touch1[2]===P.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(P=hn(P,this),Math.hypot(p[0]-P[0],p[1]-P[1])<g)){var F=Nt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return x.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:Fd(+M),x):r},x.filter=function(M){return arguments.length?(t=typeof M=="function"?M:Fd(!!M),x):t},x.touchable=function(M){return arguments.length?(o=typeof M=="function"?M:Fd(!!M),x):o},x.extent=function(M){return arguments.length?(e=typeof M=="function"?M:Fd([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),x):e},x.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],x):[i[0],i[1]]},x.translateExtent=function(M){return arguments.length?(s[0][0]=+M[0][0],s[1][0]=+M[1][0],s[0][1]=+M[0][1],s[1][1]=+M[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(M){return arguments.length?(n=M,x):n},x.duration=function(M){return arguments.length?(a=+M,x):a},x.interpolate=function(M){return arguments.length?(c=M,x):c},x.on=function(){var M=f.on.apply(f,arguments);return M===f?x:M},x.clickDistance=function(M){return arguments.length?(m=(M=+M)*M,x):Math.sqrt(m)},x.tapDistance=function(M){return arguments.length?(g=+M,x):g},x}function oe(t){return t!=null&&!Number.isNaN(t)}function Ge(t,e){return+oe(e)-+oe(t)||yt(t,e)}function nc(t,e){return+oe(e)-+oe(t)||En(t,e)}function Bd(t){return t!=null&&`${t}`!=""}function Kf(t){return isFinite(t)?t:NaN}function Fn(t){return t>0&&isFinite(t)?t:NaN}function _s(t){return t<0&&isFinite(t)?t:NaN}function tu(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`${IV(t.getUTCFullYear(),4)}-${Ni(t.getUTCMonth()+1,2)}-${Ni(t.getUTCDate(),2)}${n||r||o||i?`T${Ni(n,2)}:${Ni(r,2)}${o||i?`:${Ni(o,2)}${i?`.${Ni(i,3)}`:""}`:""}Z`:""}`}function IV(t){return t<0?`-${Ni(-t,6)}`:t>9999?`+${Ni(t,6)}`:Ni(t,4)}function Ni(t,e){return`${t}`.padStart(e,"0")}var CV=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function zd(t,e){return CV.test(t+="")?new Date(t):typeof e=="function"?e(t):e}function ki(t){if(t==null)return;let e=t[0],n=t[t.length-1];return En(e,n)}var nu=1e3,Ms=nu*60,As=Ms*60,Lo=As*24,ko=Lo*7,rc=Lo*30,Ss=Lo*365,uS=[["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",nu],["5 seconds",5*nu],["15 seconds",15*nu],["30 seconds",30*nu],["minute",Ms],["5 minutes",5*Ms],["15 minutes",15*Ms],["30 minutes",30*Ms],["hour",As],["3 hours",3*As],["6 hours",6*As],["12 hours",12*As],["day",Lo],["2 days",2*Lo],["week",ko],["2 weeks",2*ko],["month",rc],["3 months",3*rc],["6 months",6*rc],["year",Ss],["2 years",2*Ss],["5 years",5*Ss],["10 years",10*Ss],["20 years",20*Ss],["50 years",50*Ss],["100 years",100*Ss]],lS=new Map([["second",nu],["minute",Ms],["hour",As],["day",Lo],["monday",ko],["tuesday",ko],["wednesday",ko],["thursday",ko],["friday",ko],["saturday",ko],["sunday",ko],["week",ko],["month",rc],["year",Ss]]),mL=new Map([["second",We],["minute",_i],["hour",Mi],["day",Nr],["monday",ws],["tuesday",Xx],["wednesday",Wx],["thursday",Io],["friday",Vx],["saturday",Gx],["sunday",ir],["week",ir],["month",Ei],["year",bn]]),pS=new Map([["second",We],["minute",Si],["hour",Ai],["day",Ja],["monday",vs],["tuesday",Hx],["wednesday",Qx],["thursday",Co],["friday",Zx],["saturday",Jx],["sunday",sr],["week",sr],["month",Ti],["year",wn]]),ru=Symbol("intervalDuration"),C1=Symbol("intervalType");for(let[t,e]of mL)e[ru]=lS.get(t),e[C1]="time";for(let[t,e]of pS)e[ru]=lS.get(t),e[C1]="utc";var Yd=[["year",wn,"utc"],["month",Ti,"utc"],["day",Ja,"utc",6*rc],["hour",Ai,"utc",3*Lo],["minute",Si,"utc",6*As],["second",We,"utc",30*Ms]],I1=[["year",bn,"time"],["month",Ei,"time"],["day",Nr,"time",6*rc],["hour",Mi,"time",3*Lo],["minute",_i,"time",6*As],["second",We,"time",30*Ms]],NV=[Yd[0],I1[0],Yd[1],I1[1],Yd[2],I1[2],...Yd.slice(3)];function N1(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=pS.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 Ud(t){return gL(N1(t),"time")}function oc(t){return gL(N1(t),"utc")}function gL([t,e],n){let r=(n==="time"?mL:pS).get(t);return e>1&&(r=r.every(e),r[ru]=lS.get(t)*e,r[C1]=n),r}function dS(t,e){if(!(e>1))return;let n=t[ru];if(!uS.some(([,o])=>o===n)||n%Lo===0&&Lo<n&&n<rc)return;let[r]=uS[Xr(([,o])=>Math.log(o)).center(uS,Math.log(n*e))];return(t[C1]==="time"?Ud:oc)(r)}function hL(t,e,n){let r=e==="time"?Uf:No;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=kV(n);switch(t){case"millisecond":return eu(r(".%L"),r(":%M:%S"),o);case"second":return eu(r(":%S"),r("%-I:%M"),o);case"minute":return eu(r("%-I:%M"),r("%p"),o);case"hour":return eu(r("%-I %p"),r("%b %-d"),o);case"day":return eu(r("%-d"),r("%b"),o);case"month":return eu(r("%b"),r("%Y"),o);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function kV(t){return t==="left"||t==="right"?(e,n)=>`
3
3
  ${e}
4
4
  ${n}`:t==="top"?(e,n)=>`${n}
5
5
  ${e}`:(e,n)=>`${e}
6
- ${n}`}function kV(t){return t==="time"?E1:t==="utc"?zd:NV}function mL(t,e,n){let r=kt(Sx(e,(o,i)=>Math.abs(i-o)));if(r<1e3)return pL("millisecond","utc",n);for(let[o,i,s,a]of kV(t)){if(r>a||o==="hour"&&!r)break;if(e.every(c=>i.floor(c)>=c))return pL(o,s,n)}}function Kf(t,e,n){return(r,o,i)=>{let s=t(r,o),a=e(r,o),c=o-Li(i);return o!==c&&i[c]!==void 0&&a===e(i[c],c)?s:n(s,a)}}var Ud=Object.getPrototypeOf(Uint8Array),LV=Object.prototype.toString;function Gn(t){return t instanceof Array||t instanceof Ud}function gL(t){return t instanceof Ud&&!RV(t)}function yL(t){return t?.prototype instanceof Ud&&!OV(t)}function RV(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function OV(t){return t===BigInt64Array||t===BigUint64Array}var dS=Symbol("reindex");function ut(t,e,n){let r=typeof e;return r==="string"?CL(t)?hS(t.getChild(e),n):xL(t,mS(e),n):r==="function"?xL(t,e,n):r==="number"||e instanceof Date||r==="boolean"?Et(t,ue(e),n):typeof e?.transform=="function"?pS(e.transform(t),n):$V(pS(e,n),t?.[dS])}function $V(t,e){return t!=null&&e?Xd(t,e):t}function xL(t,e,n){return Et(t,yL(n)?(r,o)=>xS(e(r,o)):e,n)}function pS(t,e){return e===void 0?cr(t):kL(t)?hS(t,e):t instanceof e?t:e.from(t,yL(e)&&!gL(t)?xS:void 0)}function hS(t,e){return t==null?t:(e===void 0||e===Array)&&FV(t.type)?gS(t.toArray()):pS(t.toArray(),e)}var Es=[null],mS=t=>e=>{let n=e[t];return n===void 0&&e.type==="Feature"?e.properties?.[t]:n},Zt={transform:Fn},W={transform:t=>t};var jd=()=>1,bL=()=>!0,be=t=>t==null?t:`${t}`,Dt=t=>t==null?t:+t;var ic=t=>t?t[0]:void 0,Is=t=>t?t[1]:void 0,wL=t=>t?t[2]:void 0,ue=t=>()=>t;function nu(t){let e=+`${t}`.slice(1)/100;return(n,r)=>In(n,e,r)}function Ne(t){return gL(t)?t:Et(t,xS,Float64Array)}function xS(t){return t==null?NaN:Number(t)}function gS(t){return Et(t,yS)}function yS(t){return t instanceof Date&&!isNaN(t)?t:typeof t=="string"?Bd(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function ce(t,e){return t===void 0&&(t=e),t===null?[void 0,"none"]:Ls(t)?[void 0,t]:[t,void 0]}function Ut(t,e){return t===void 0&&(t=e),t===null||typeof t=="number"?[void 0,t]:[t,void 0]}function bS(t,e,n){if(t!=null)return Oe(t,e,n)}function Oe(t,e,n){let r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function Ri(t){return CL(t)?t:cr(t)}function cr(t){if(t==null||Gn(t))return t;if(kL(t))return hS(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 Ns(t,e=Array){return t instanceof e?t.slice():e.from(t)}function wS({x:t,x1:e,x2:n}){return t!==void 0||e!==void 0||n!==void 0}function vS({y:t,y1:e,y2:n}){return t!==void 0||e!==void 0||n!==void 0}function Oi(t){return wS(t)||vS(t)||t.interval!==void 0}function Ve(t){return t?.toString===LV}function Ro(t){return Ve(t)&&(t.type!==void 0||t.domain!==void 0)}function fr(t){return Ve(t)&&typeof t.transform!="function"}function Oo(t){return fr(t)&&t.value===void 0&&t.channel===void 0}function _S(t,e,n,r=W){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 me(t,e){return t===void 0&&e===void 0?[ic,Is]:[t,e]}function vn({z:t,fill:e,stroke:n}={}){return t===void 0&&([t]=ce(e)),t===void 0&&([t]=ce(n)),t}function Cs(t){return Gn(t)?t.length:t?.numRows}function Fn(t){let e=Cs(t),n=new Uint32Array(e);for(let r=0;r<e;++r)n[r]=r;return n}function Xd(t,e){return Gn(t)?Et(e,n=>t[n],t.constructor):Et(e,n=>t.at(n))}function ru(t){return t.length===1?(e,n)=>t(Xd(n,e)):t}function $i(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function Or(t){return t!==null&&typeof t=="object"?t.valueOf():t}function C1(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 Ge(t){let e;return[{transform:()=>e,label:un(t)},n=>e=n]}function fn(t){return t==null?[t]:Ge(t)}function un(t,e){return typeof t=="string"?t:t&&t.label!==void 0?t.label:e}function ou(t,e){return{transform(n){let r=t.transform(n),o=e.transform(n);return fe(r)||fe(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 sc(t,e){let n=SS(e?.interval,e?.type);return n?Et(t,n):t}function SS(t,e){let n=iu(t,e);return n&&(r=>oe(r)?n.floor(r):r)}function iu(t,e){if(t!=null){if(typeof t=="number")return MS(t);if(typeof t=="string")return(e==="time"?Yd:oc)(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 MS(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)=>ye(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)=>ye(Math.ceil(n/e),r/e).map(o=>o*e)}}function $o(t,e){if(t=iu(t,e),t&&typeof t.range!="function")throw new Error("invalid interval: missing range method");return t}function vL(t,e){if(t=$o(t,e),t&&typeof t.ceil!="function")throw new Error("invalid interval: missing ceil method");return t}function _L(t){return ks(t)&&typeof t?.floor=="function"&&t.floor()instanceof Date}function ks(t){return typeof t?.range=="function"}function $r(t){return t===void 0||fr(t)?t:{value:t}}function SL(t){return t==null?null:{transform:e=>ut(e,t,Float64Array),label:un(t)}}function ML(t){if(!qn(t))return!1;for(let e of t)if(e!=null)return typeof e=="object"&&"0"in e&&"1"in e}function qn(t){return t&&typeof t[Symbol.iterator]=="function"}function k1(t){for(let e of t)if(e!=null)return typeof e!="object"||e instanceof Date}function ie(t){for(let e of t){if(e==null)continue;let n=typeof e;return n==="string"||n==="boolean"}}function fe(t){for(let e of t)if(e!=null)return e instanceof Date}function AL(t){for(let e of t)if(e!=null)return typeof e=="string"&&isNaN(e)&&Bd(e)}function TL(t){for(let e of t)if(e!=null){if(typeof e!="string")return!1;if(e.trim())return!isNaN(e)}}function Di(t){for(let e of t)if(e!=null)return typeof e=="number"}function L1(t,e){let n;for(let r of t)if(r!=null){if(!e(r))return!1;n=!0}return n}var DV=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 Ls(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)||DV.has(t))}function EL(t){return typeof t=="number"&&(0<=t&&t<=1||isNaN(t))}function zt(t){return t==null||Pi(t)}function Pi(t){return/^\s*none\s*$/i.test(t)}function IL(t){return/^\s*round\s*$/i.test(t)}function R1(t,e){return bS(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Do(t="middle"){return R1(t,"frameAnchor")}function NL(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 PV(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 Wd(t){return qn(t)?PV(t):t}function O1(t){return t===!0?t="frame":t===!1?t=null:t!=null&&(t=Oe(t,"clip",["frame","sphere"])),t}function CL(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}function kL(t){return t&&typeof t.toArray=="function"&&t.type}function FV(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var Dr=Symbol("position"),ur=Symbol("color"),ac=Symbol("radius"),cc=Symbol("length"),fc=Symbol("opacity"),su=Symbol("symbol"),LL=Symbol("projection"),Wt=new Map([["x",Dr],["y",Dr],["fx",Dr],["fy",Dr],["r",ac],["color",ur],["opacity",fc],["symbol",su],["length",cc],["projection",LL]]);function RL(t){return t===Dr||t===LL}function OL(t){return t===Dr||t===ac||t===cc||t===fc}var AS=Math.sqrt(3),TS=2/AS,qV={draw(t,e){let n=Math.sqrt(e/Math.PI),r=n*TS,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()}},ES=new Map([["asterisk",Md],["circle",Ci],["cross",Ad],["diamond",Td],["diamond2",Ed],["hexagon",qV],["plus",Id],["square",Nd],["square2",Cd],["star",kd],["times",Vf],["triangle",Ld],["triangle2",Rd],["wye",Od]]);function IS(t){return t&&typeof t.draw=="function"}function $L(t){return IS(t)?!0:typeof t!="string"?!1:ES.has(t.toLowerCase())}function au(t){if(t==null||IS(t))return t;let e=ES.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function DL(t){if(t==null||IS(t))return[void 0,t];if(typeof t=="string"){let e=ES.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}function Ce({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},s){if(r===void 0&&(t!=null&&(r=kS(t)),e!=null&&!Oo(e)&&(r=NS(r,RS(e))),n&&(r=NS(r,LS))),s!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(e===null||Oo(e))&&{sort:e},transform:NS(r,s)}}function Kt({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return r===void 0&&(t!=null&&(r=kS(t)),e!=null&&!Oo(e)&&(r=CS(r,RS(e))),n&&(r=CS(r,LS))),{...o,...(e===null||Oo(e))&&{sort:e},initializer:CS(r,i)}}function NS(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,Ri(n),r,o)}}function CS(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,u,p;return{data:a=n,facets:c=r,channels:s}=t.call(this,n,r,o,...i),{data:u=a,facets:p=c,channels:f}=e.call(this,a,c,{...o,...s},...i),{data:u,facets:p,channels:{...s,...f}}}}function $1(t,e){return(t.initializer!=null?Kt:Ce)(t,e)}function PL(t,e){return $1(e,kS(t))}function kS(t){return(e,n)=>{let r=ut(e,t);return{data:e,facets:n.map(o=>o.filter(i=>r[i]))}}}function FL({sort:t,...e}={}){return{...$1(e,LS),sort:Oo(t)?t:null}}function LS(t,e){return{data:t,facets:e.map(n=>n.slice().reverse())}}function qL({seed:t,sort:e,...n}={}){return{...$1(n,BL(t==null?Math.random:Wa(t))),sort:Oo(e)?e:null}}function D1(t,{sort:e,...n}={}){return{...(fr(t)&&t.channel!==void 0?Kt:$1)(n,RS(t)),sort:Oo(e)?e:null}}function RS(t){return(typeof t=="function"&&t.length!==1?BV:BL)(t)}function BV(t){return(e,n)=>{let r=Gn(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 BL(t){let e,n;({channel:e,value:t,order:n}={...$r(t)});let r=e?.startsWith("-");if(r&&(e=e.slice(1)),n===void 0&&(n=r?nc:We),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=We;break;case"descending":n=nc;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,u)=>n(a[f],a[u]);return{data:o,facets:i.map(f=>f.slice().sort(c))}}}function Gd(t,e){return P1(null,null,t,e)}function Rs(t={y:"count"},e={}){let{x:n=W}=e;if(n==null)throw new Error("missing channel: x");return P1(n,null,t,e)}function Os(t={x:"count"},e={}){let{y:n=W}=e;if(n==null)throw new Error("missing channel: y");return P1(null,n,t,e)}function Hd(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=me(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return P1(n,r,t,e)}function P1(t,e,{data:n=B1,filter:r,sort:o,reverse:i,...s}={},a={}){s=$S(s,a),n=XL(n,W),o=o==null?void 0:UL("sort",o,a),r=r==null?void 0:jL("filter",r,a);let[c,f]=fn(t),[u,p]=fn(e),{z:l,fill:d,stroke:h,x1:m,x2:x,y1:g,y2:y,...b}=a,[w,_]=fn(l),[v]=ce(d),[A]=ce(h),[T,E]=fn(v),[N,M]=fn(A);return{..."z"in a&&{z:w||l},..."fill"in a&&{fill:T||d},..."stroke"in a&&{stroke:N||h},...Ce(b,(k,O,S)=>{let I=sc(ut(k,t),S?.x),C=sc(ut(k,e),S?.y),L=ut(k,l),D=ut(k,v),$=ut(k,A),P=Qd(s,{z:L,fill:D,stroke:$}),F=[],q=[],V=I&&f([]),K=C&&p([]),et=L&&_([]),rt=D&&E([]),j=$&&M([]),nt=0;for(let Y of s)Y.initialize(k);o&&o.initialize(k),r&&r.initialize(k);for(let Y of O){let G=[];for(let tt of s)tt.scope("facet",Y);o&&o.scope("facet",Y),r&&r.scope("facet",Y);for(let[tt,B]of Po(Y,P))for(let[_t,ct]of Po(B,C))for(let[Ct,Lt]of Po(ct,I)){let Z={data:k};if(I&&(Z.x=Ct),C&&(Z.y=_t),P&&(Z.z=tt),!(r&&!r.reduce(Lt,Z))){G.push(nt++),q.push(n.reduceIndex(Lt,k,Z)),I&&V.push(Ct),C&&K.push(_t),L&&et.push(P===L?tt:L[Lt[0]]),D&&rt.push(P===D?tt:D[Lt[0]]),$&&j.push(P===$?tt:$[Lt[0]]);for(let jt of s)jt.reduce(Lt,Z);o&&o.reduce(Lt,Z)}}F.push(G)}return DS(F,o,i),{data:q,facets:F}}),...!Fo(s,"x")&&(c?{x:c}:{x1:m,x2:x}),...!Fo(s,"y")&&(u?{y:u}:{y1:g,y2:y}),...Object.fromEntries(s.map(({name:k,output:O})=>[k,O]))}}function Fo(t,...e){for(let{name:n}of t)if(e.includes(n))return!0;return!1}function OS(t,e,n=F1){let r=Object.entries(t);return e.title!=null&&t.title===void 0&&r.push(["title",WV]),e.href!=null&&t.href===void 0&&r.push(["href",z1]),r.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?zV(o):n(o,i,e))}function F1(t,e,n,r=q1){let o;Ve(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);let i=r(t,e,n),[s,a]=Ge(i.label),c;return{name:t,output:o===void 0?s:{value:s,scale:o},initialize(f){i.initialize(f),c=a([])},scope(f,u){i.scope(f,u)},reduce(f,u){c.push(i.reduce(f,u))}}}function zV(t){return{name:t,initialize(){},scope(){},reduce(){}}}function q1(t,e,n,r=cu){let o=C1(t,n),i=r(e,o),s,a;return{label:un(i===Vd?null:o,i.label),initialize(c){s=o===void 0?c:ut(c,o),i.scope==="data"&&(a=i.reduceIndex(Fn(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 Po(t,e){return e?rn(t,n=>e[n]):[[,t]]}function cu(t,e,n=YV){if(t==null)return n(t);if(typeof t.reduceIndex=="function")return t;if(typeof t.reduce=="function"&&Ve(t))return jV(t);if(typeof t=="function")return XV(t);if(/^p\d{2}$/i.test(t))return Fi(nu(t));switch(`${t}`.toLowerCase()){case"first":return z1;case"last":return VV;case"identity":return B1;case"count":return Vd;case"distinct":return GV;case"sum":return e==null?Vd:HV;case"proportion":return YL(e,"data");case"proportion-facet":return YL(e,"facet");case"deviation":return Fi(Mr);case"min":return Fi(It);case"min-index":return Fi(wx);case"max":return Fi(kt);case"max-index":return Fi(bx);case"mean":return zL(pi);case"median":return zL(Vr);case"variance":return Fi(as);case"mode":return Fi(lf)}return n(t)}function YV(t){throw new Error(`invalid reduce: ${t}`)}function $S(t,e){return OS(t,e,UL)}function UL(t,e,n){return F1(t,e,n,jL)}function jL(t,e,n){return q1(t,e,n,XL)}function XL(t,e){return cu(t,e,UV)}function UV(t){switch(`${t}`.toLowerCase()){case"x":return QV;case"y":return ZV;case"z":return PS}throw new Error(`invalid group reduce: ${t}`)}function Qd(t,e){for(let n in e){let r=e[n];if(r!==void 0&&!t.some(o=>o.name===n))return r}}function DS(t,e,n){if(e){let r=e.output.transform(),o=(i,s)=>We(r[i],r[s]);t.forEach(i=>i.sort(o))}n&&t.forEach(r=>r.reverse())}function jV(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function XV(t){return{reduceIndex(e,n,r){return t(Xd(n,e),r)}}}function Fi(t){return{reduceIndex(e,n){return t(e,r=>n[r])}}}function zL(t){return{reduceIndex(e,n){let r=t(e,o=>n[o]);return fe(n)?new Date(r):r}}}var B1={reduceIndex(t,e){return Xd(e,t)}},z1={reduceIndex(t,e){return e[t[0]]}},WV={reduceIndex(t,e){let r=ui(Wr(t,i=>i.length,i=>e[i]),Is),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`,sn(i,Is)]}return o.map(([i,s])=>`${i} (${s.toLocaleString("en-US")})`).join(`
7
- `)}},VV={reduceIndex(t,e){return e[t[t.length-1]]}},Vd={label:"Frequency",reduceIndex(t){return t.length}},GV={label:"Distinct",reduceIndex(t,e){let n=new En;for(let r of t)n.add(e[r]);return n.size}},HV=Fi(sn);function YL(t,e){return t==null?{scope:e,label:"Frequency",reduceIndex:(n,r,o=1)=>n.length/o}:{scope:e,reduceIndex:(n,r,o=1)=>sn(n,i=>r[i])/o}}var QV={reduceIndex(t,e,{x:n}){return n}},ZV={reduceIndex(t,e,{y:n}){return n}},PS={reduceIndex(t,e,{z:n}){return n}};function WL(t){if(typeof t!="function")throw new Error(`invalid test function: ${t}`);return{reduceIndex(e,n,{data:r}){return n[e.find(Gn(r)?o=>t(r[o],o,r):o=>t(r.get(o),o,r))]}}}function fu(t,{scale:e,type:n,value:r,filter:o,hint:i,label:s=un(r)},a){return i===void 0&&typeof r?.transform=="function"&&(i=r.hint),qS(a,{scale:e,type:n,value:ut(t,r),label:s,filter:o,hint:i})}function Y1(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,fu(e,r,n)]))}function uu(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 qS(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&&L1(r,Ls)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=n!==!0&&L1(r,EL)?null:"opacity",e.defaultScale="opacity";break;case"symbol":n!==!0&&L1(r,$L)?(e.scale=null,e.value=Et(r,au)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=Wt.has(t)?t:null;break}else if(n===!1)e.scale=null;else if(n!=null&&!Wt.has(n))throw new Error(`unknown scale: ${n}`);return e}function GL(t,e,n,r,o){let{order:i,reverse:s,reduce:a=!0,limit:c}=o;for(let f in o){if(!Wt.has(f))continue;let{value:u,order:p=i,reverse:l=s,reduce:d=a,limit:h=c}=$r(o[f]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),p=p===void 0?m!==(u==="width"||u==="height")?QL:HL:tG(p),d==null||d===!1)continue;let x=f==="fx"||f==="fy"?KV(e,r[f]):JV(n,f);if(!x)throw new Error(`missing channel for scale: ${f}`);let g=x.value,[y=0,b=1/0]=qn(h)?h:h<0?[h]:[0,h];if(u==null)x.domain=()=>{let w=Array.from(new En(g));return l&&(w=w.reverse()),(y!==0||b!==1/0)&&(w=w.slice(y,b)),w};else{let w=u==="data"?t:u==="height"?VL(n,"y1","y2"):u==="width"?VL(n,"x1","x2"):FS(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=cu(d===!0?"max":d,w);x.domain=()=>{let v=f_(Fn(g),A=>_.reduceIndex(A,w),A=>g[A]);return p&&v.sort(p),l&&v.reverse(),(y!==0||b!==1/0)&&(v=v.slice(y,b)),v.map(ic)}}}}function JV(t,e){for(let n in t){let r=t[n];if(r.scale===e)return r}}function KV(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 VL(t,e,n){let r=FS(t,e),o=FS(t,n);return Et(o,(i,s)=>Math.abs(i-r[s]),Float64Array)}function FS(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 tG(t){if(t==null||typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return HL;case"descending":return QL}throw new Error(`invalid order: ${t}`)}function HL([t,e],[n,r]){return We(e,r)||We(t,n)}function QL([t,e],[n,r]){return nc(e,r)||We(t,n)}function Zd(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var eR=new Map([["accent",M3],["category10",S3],["dark2",A3],["observable10",T3],["paired",E3],["pastel1",I3],["pastel2",N3],["set1",C3],["set2",k3],["set3",L3],["tableau10",R3]]);function nR(t){return t!=null&&eR.has(`${t}`.toLowerCase())}var ZL=new Map([...eR,["brbg",qi(iy,sy)],["prgn",qi(ay,cy)],["piyg",qi(fy,uy)],["puor",qi(ly,py)],["rdbu",qi(wd,Yf)],["rdgy",qi(dy,hy)],["rdylbu",qi(vd,Uf)],["rdylgn",qi(my,xy)],["spectral",qi(gy,yy)],["burd",JL(wd,Yf)],["buylrd",JL(vd,Uf)],["blues",He(Uy,jy)],["greens",He(Xy,Wy)],["greys",He(Vy,Gy)],["oranges",He(Ky,t1)],["purples",He(Hy,Qy)],["reds",He(Zy,Jy)],["turbo",Bi(f1)],["viridis",Bi(l1)],["magma",Bi(p1)],["inferno",Bi(d1)],["plasma",Bi(h1)],["cividis",Bi(e1)],["cubehelix",Bi(n1)],["warm",Bi(o1)],["cool",Bi(i1)],["bugn",He(by,wy)],["bupu",He(vy,_y)],["gnbu",He(Sy,My)],["orrd",He(Ay,Ty)],["pubu",He(Ny,Cy)],["pubugn",He(Ey,Iy)],["purd",He(ky,Ly)],["rdpu",He(Ry,Oy)],["ylgn",He(Py,Fy)],["ylgnbu",He($y,Dy)],["ylorbr",He(qy,By)],["ylorrd",He(zy,Yy)],["rainbow",KL(s1)],["sinebow",KL(c1)]]);function He(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?mn(e,n):t[n])}function qi(t,e){return({length:n})=>n===2?[t[3][0],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?mn(e,n):t[n])}function JL(t,e){return({length:n})=>n===2?[t[3][2],t[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?mn(r=>e(1-r),n):t[n].slice().reverse())}function Bi(t){return({length:e})=>mn(t,Math.max(2,Math.floor(e)))}function KL(t){return({length:e})=>mn(t,Math.floor(e)+1).slice(0,-1)}function BS(t){let e=`${t}`.toLowerCase();if(!ZL.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return ZL.get(e)}function Jd(t,e){let n=BS(t),r=typeof n=="function"?n({length:e}):n;return r.length!==e?r.slice(0,e):r}function rR(t,e="greys"){let n=new Set,[r,o]=Jd(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 tR=new Map([["brbg",sy],["prgn",cy],["piyg",uy],["puor",py],["rdbu",Yf],["rdgy",hy],["rdylbu",Uf],["rdylgn",xy],["spectral",yy],["burd",t=>Yf(1-t)],["buylrd",t=>Uf(1-t)],["blues",jy],["greens",Wy],["greys",Gy],["purples",Qy],["reds",Jy],["oranges",t1],["turbo",f1],["viridis",l1],["magma",p1],["inferno",d1],["plasma",h1],["cividis",e1],["cubehelix",n1],["warm",o1],["cool",i1],["bugn",wy],["bupu",_y],["gnbu",My],["orrd",Ty],["pubugn",Iy],["pubu",Cy],["purd",Ly],["rdpu",Oy],["ylgnbu",Dy],["ylgn",Fy],["ylorbr",By],["ylorrd",Yy],["rainbow",s1],["sinebow",c1]]);function lu(t){let e=`${t}`.toLowerCase();if(!tR.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return tR.get(e)}var eG=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function oR(t){return t!=null&&eG.has(`${t}`.toLowerCase())}var YS=t=>e=>t(1-e),zS=[0,1],iR=new Map([["number",ee],["rgb",Ar],["hsl",$_],["hcl",D_],["lab",Yx]]);function US(t){let e=`${t}`.toLowerCase();if(!iR.has(e))throw new Error(`unknown interpolator: ${e}`);return iR.get(e)}function du(t,e,n,{type:r,nice:o,clamp:i,zero:s,domain:a=dR(t,n),unknown:c,round:f,scheme:u,interval:p,range:l=Wt.get(t)===ac?iG(n,a):Wt.get(t)===cc?sG(n,a):Wt.get(t)===fc?zS:void 0,interpolate:d=Wt.get(t)===ur?u==null&&l!==void 0?Ar:lu(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):f?$a:ee,reverse:h}){if(p=$o(p,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=US(d)),h=!!h,l!==void 0){let m=(a=cr(a)).length,x=(l=cr(l)).length;if(m!==x){if(d.length===1)throw new Error("invalid piecewise interpolator");d=go(d,l),l=void 0}}if(d.length===1?(h&&(d=YS(d),h=!1),l===void 0&&(l=Float64Array.from(a,(m,x)=>x/(a.length-1)),l.length===2&&(l=zS)),e.interpolate((l===zS?ue:Kd)(d))):e.interpolate(d),s){let[m,x]=Ft(a);(m>0||x<0)&&(a=Ns(a),(Li(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return h&&(a=fs(a)),e.domain(a).unknown(c),o&&(e.nice(nG(o,r)),a=e.domain()),l!==void 0&&e.range(l),i&&e.clamp(i),{type:r,domain:a,range:l,scale:e,interpolate:d,interval:p}}function nG(t,e){return t===!0?void 0:typeof t=="number"?t:vL(t,e)}function sR(t,e,n){return du(t,_i(),e,n)}function aR(t,e,n){return jS(t,e,{...n,exponent:.5})}function jS(t,e,{exponent:n=1,...r}){return du(t,fd().exponent(n),e,{...r,type:"pow"})}function cR(t,e,{base:n=10,domain:r=aG(e),...o}){return du(t,ad().base(n),e,{...o,domain:r})}function fR(t,e,{constant:n=1,...r}){return du(t,cd().constant(n),e,r)}function uR(t,e,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:o=r,scheme:i="rdylbu",domain:s=cG(e),unknown:a,interpolate:c,reverse:f}){return n===void 0&&(n=c!==void 0?mn(c,o):Wt.get(t)===ur?Jd(i,o):void 0),s.length>0&&(s=ud(s,n===void 0?{length:o}:n).quantiles()),U1(t,e,{domain:s,range:n,reverse:f,unknown:a})}function lR(t,e,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:o="rdylbu",domain:i=dR(t,e),unknown:s,interpolate:a,reverse:c}){let[f,u]=Ft(i),p;return n===void 0?(p=on(f,u,r),p[0]<=f&&p.splice(0,1),p[p.length-1]>=u&&p.pop(),r=p.length+1,n=a!==void 0?mn(a,r):Wt.get(t)===ur?Jd(o,r):void 0):(p=mn(ee(f,u),r+1).slice(1,-1),f instanceof Date&&(p=p.map(l=>new Date(l)))),Li(cr(i))<0&&p.reverse(),U1(t,e,{domain:p,range:n,reverse:c,unknown:s})}function U1(t,e,{domain:n=[0],unknown:r,scheme:o="rdylbu",interpolate:i,range:s=i!==void 0?mn(i,n.length+1):Wt.get(t)===ur?Jd(o,n.length+1):void 0,reverse:a}){n=cr(n);let c=Li(n);if(!isNaN(c)&&!rG(n,c))throw new Error(`the ${t} scale has a non-monotonic domain`);return a&&(s=fs(s)),{type:"threshold",scale:ld(c<0?fs(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function rG(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 pR(t){return{type:"identity",scale:OL(Wt.get(t))?id():e=>e}}function pu(t,e=Zf){return t.length?[It(t,({value:n})=>n===void 0?n:It(n,e)),kt(t,({value:n})=>n===void 0?n:kt(n,e))]:[0,1]}function dR(t,e){let n=Wt.get(t);return(n===ac||n===fc||n===cc?oG:pu)(e)}function oG(t){return[0,t.length?kt(t,({value:e})=>e===void 0?e:kt(e,Zf)):1]}function iG(t,e){let n=t.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=In(t,.5,({value:s})=>s===void 0?NaN:In(s,.25,Pn)),o=e.map(s=>3*Math.sqrt(s/r)),i=30/kt(o);return i<1?o.map(s=>s*i):o}function sG(t,e){let n=Vr(t,({value:i})=>i===void 0?NaN:Vr(i,Math.abs)),r=e.map(i=>12*i/n),o=60/kt(r);return o<1?r.map(i=>i*o):r}function aG(t){for(let{value:e}of t)if(e!==void 0)for(let n of e){if(n>0)return pu(t,Pn);if(n<0)return pu(t,Ss)}return[1,10]}function cG(t){let e=[];for(let{value:n}of t)if(n!==void 0)for(let r of n)e.push(r);return e}function Kd(t){return(e,n)=>r=>t(e+r*(n-e))}var XS=0,WS;function hR(){let t=XS;return XS=0,WS=void 0,t}function _n(t){t!==WS&&(WS=t,console.warn(t),++XS)}function j1(t,e,n,r,{type:o,nice:i,clamp:s,domain:a=pu(r),unknown:c,pivot:f=0,scheme:u,range:p,symmetric:l=!0,interpolate:d=Wt.get(t)===ur?u==null&&p!==void 0?Ar:lu(u!==void 0?u:"rdbu"):ee,reverse:h}){f=+f,a=cr(a);let[m,x]=a;if(a.length>2&&_n(`Warning: the diverging ${t} scale domain contains extra elements.`),An(m,x)<0&&([m,x]=[x,m],h=!h),m=Math.min(m,f),x=Math.max(x,f),typeof d!="function"&&(d=US(d)),p!==void 0&&(d=d.length===1?Kd(d)(...p):go(d,p)),h&&(d=YS(d)),l){let g=n.apply(f),y=g-n.apply(m),b=n.apply(x)-g;y<b?m=n.invert(g-b):y>b&&(x=n.invert(g+y))}return e.domain([m,f,x]).unknown(c).interpolator(d),s&&e.clamp(s),i&&e.nice(i),{type:o,domain:[m,x],pivot:f,interpolate:d,scale:e}}function mR(t,e,n){return j1(t,bd(),fG,e,n)}function xR(t,e,n){return VS(t,e,{...n,exponent:.5})}function VS(t,e,{exponent:n=1,...r}){return j1(t,oy().exponent(n=+n),pG(n),e,{...r,type:"diverging-pow"})}function gR(t,e,{base:n=10,pivot:r=1,domain:o=pu(e,r<0?Ss:Pn),...i}){return j1(t,ny().base(n=+n),uG,e,{domain:o,pivot:r,...i})}function yR(t,e,{constant:n=1,...r}){return j1(t,ry().constant(n=+n),dG(n),e,r)}var fG={apply(t){return t},invert(t){return t}},uG={apply:Math.log,invert:Math.exp},lG={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function pG(t){return t===.5?lG:{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 dG(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 bR(t,e,n,r){return du(t,e,n,r)}function wR(t,e,n){return bR(t,Kg(),e,n)}function vR(t,e,n){return bR(t,ty(),e,n)}var hu=Symbol("ordinal");function SR(t,e,n,{type:r,interval:o,domain:i,range:s,reverse:a,hint:c}){return o=$o(o,r),i===void 0&&(i=IR(n,o,t)),(r==="categorical"||r===hu)&&(r="ordinal"),a&&(i=fs(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 MR(t,e,{type:n,interval:r,domain:o,range:i,scheme:s,unknown:a,...c}){r=$o(r,n),o===void 0&&(o=IR(e,r,t));let f;if(Wt.get(t)===su)f=hG(e),i=i===void 0?mG(f):Et(i,au);else if(Wt.get(t)===ur&&(i===void 0&&(n==="ordinal"||n===hu)&&(i=rR(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 u=lu(s),p=i[0],l=i[1]-i[0];i=({length:d})=>mn(h=>u(p+l*h),d)}else i=BS(s);if(a===rd)throw new Error(`implicit unknown on ${t} scale is not supported`);return SR(t,Va().unknown(a),e,{...c,type:n,domain:o,range:i,hint:f})}function AR(t,e,{align:n=.5,padding:r=.5,...o}){return ER(a3().align(n).padding(r),e,o,t)}function TR(t,e,{align:n=.5,padding:r=.1,paddingInner:o=r,paddingOuter:i=t==="fx"||t==="fy"?0:r,...s}){return ER(ws().align(n).paddingInner(o).paddingOuter(i),e,s,t)}function ER(t,e,n,r){let{round:o}=n;return o!==void 0&&t.round(o=!!o),t=SR(r,t,e,n),t.round=o,t}function IR(t,e,n){let r=new En;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]=Ft(r).map(e.floor,e);return e.range(o,e.offset(i))}if(r.size>1e4&&Wt.get(n)===Dr)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return ui(r,We)}function _R(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 hG(t){return{fill:_R(t,"fill"),stroke:_R(t,"stroke")}}function mG(t){return zt(t.fill)?B3:w1}function th(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:u,align:p,padding:l,projection:d,facet:{label:h=e}={},...m}={}){let x={};for(let[g,y]of t){let b=m[g],w=DR(g,y,{round:Wt.get(g)===Dr?a:void 0,nice:c,clamp:f,zero:u,align:p,padding:l,projection:d,...b});if(w){let{label:_=g==="fx"||g==="fy"?h:e,percent:v,transform:A,inset:T,insetTop:E=T!==void 0?T:g==="y"?r:0,insetRight:N=T!==void 0?T:g==="x"?o:0,insetBottom:M=T!==void 0?T:g==="y"?i:0,insetLeft:k=T!==void 0?T:g==="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?xG(y,w):_,w.transform=A,g==="x"||g==="fx"?(w.insetLeft=+k,w.insetRight=+N):(g==="y"||g==="fy")&&(w.insetTop=+E,w.insetBottom=+M),x[g]=w}}return x}function HS(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]=FR(o),n[r]=i,i.type=s,a!=null&&(i.interval=a),c!=null&&(i.label=c)}return n}function RR(t,e){let{x:n,y:r,fx:o,fy:i}=t,s=o||i?V1(e):e;o&&NR(o,s),i&&CR(i,s);let a=o||i?QS(t,e):e;n&&NR(n,a),r&&CR(r,a)}function xG(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!qo(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function W1(t){return Math.sign(Li(t.domain()))*Math.sign(Li(t.range()))}function V1(t){let{marginTop:e,marginRight:n,marginBottom:r,marginLeft:o,width:i,height:s,facet:{marginTop:a,marginRight:c,marginBottom:f,marginLeft:u}}=t;return{marginTop:Math.max(e,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,f),marginLeft:Math.max(o,u),width:i,height:s}}function QS({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=V1(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 NR(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)],qo(t)||(t.range=$R(t)),t.scale.range(t.range)}OR(t)}function CR(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],qo(t)?t.range.reverse():t.range=$R(t),t.scale.range(t.range)}OR(t)}function OR(t){t.round===void 0&&bG(t)&&gG(t)<=30&&t.scale.round(!0)}function gG({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 $R(t){let e=t.scale.domain().length+ZS(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 G1(t,e,n){return DR(t,n===void 0?void 0:[{hint:n}],{...e})}function DR(t,e=[],n={}){let r=yG(t,e,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&t!=="fx"&&t!=="fy"&&qo({type:r})){let o=e.map(({value:i})=>i).filter(i=>i!==void 0);o.some(fe)?_n(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${mu(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 "${mu(r)}".`):o.some(AL)?_n(`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 "${mu(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 "${mu(r)}".`):o.some(TL)&&_n(`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 "${mu(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 "${mu(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=X1(e,n,Ne);break;case"identity":switch(Wt.get(t)){case Dr:n=X1(e,n,Ne);break;case su:n=X1(e,n,wG);break}break;case"utc":case"time":n=X1(e,n,gS);break}switch(r){case"diverging":return mR(t,e,n);case"diverging-sqrt":return xR(t,e,n);case"diverging-pow":return VS(t,e,n);case"diverging-log":return gR(t,e,n);case"diverging-symlog":return yR(t,e,n);case"categorical":case"ordinal":case hu:return MR(t,e,n);case"cyclical":case"sequential":case"linear":return sR(t,e,n);case"sqrt":return aR(t,e,n);case"threshold":return U1(t,e,n);case"quantile":return uR(t,e,n);case"quantize":return lR(t,e,n);case"pow":return jS(t,e,n);case"log":return cR(t,e,n);case"symlog":return fR(t,e,n);case"utc":return vR(t,e,n);case"time":return wR(t,e,n);case"point":return AR(t,e,n);case"band":return TR(t,e,n);case"identity":return pR(t);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function mu(t){return typeof t=="symbol"?t.description:t}function kR(t){return typeof t=="string"?`${t}`.toLowerCase():t}var LR={toString:()=>"projection"};function yG(t,e,{type:n,domain:r,range:o,scheme:i,pivot:s,projection:a}){if(n=kR(n),t==="fx"||t==="fy")return"band";(t==="x"||t==="y")&&a!=null&&(n=LR);for(let f of e){let u=kR(f.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===LR)return;if(n!==void 0)return n;if(r===void 0&&!e.some(({value:f})=>f!==void 0))return;let c=Wt.get(t);if(c===ac)return"sqrt";if(c===fc||c===cc)return"linear";if(c===su)return"ordinal";if((r||o||[]).length>2)return GS(c);if(r!==void 0){if(ie(r))return GS(c);if(fe(r))return"utc"}else{let f=e.map(({value:u})=>u).filter(u=>u!==void 0);if(f.some(ie))return GS(c);if(f.some(fe))return"utc"}if(c===ur){if(s!=null||oR(i))return"diverging";if(nR(i))return"categorical"}return"linear"}function GS(t){switch(t){case Dr:return"point";case ur:return hu;default:return"ordinal"}}function qo({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===hu}function ZS({type:t}){return t==="threshold"}function bG({type:t}){return t==="point"||t==="band"}function lr(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 X1(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 wG(t){return Et(t,au)}function $s(t={}){let e;for(let n in t)if(Wt.has(n)&&Ro(t[n])){if(e!==void 0)throw new Error("ambiguous scale definition; multiple scales found");e=FR(G1(n,t[n]))}if(e===void 0)throw new Error("invalid scale definition; no scale found");return e}function PR(t){return e=>{if(!Wt.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}function FR({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:u=>u,invert:u=>u};let f=t.unknown?t.unknown():void 0;return{type:e,domain:Ns(n),...r!==void 0&&{range:Ns(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:u=>t(u),...t.invert&&{invert:u=>t.invert(u)}}}function BR(t,e){let{fx:n,fy:r}=th(t,e),o=n?.scale.domain(),i=r?.scale.domain();return o&&i?xx(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 zR(t,{x:e,y:n}){return e&&=n4(e),n&&=n4(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 Q1(t,{fx:e,fy:n}){let r=Fn(t),o=e?.value,i=n?.value;return e&&n?Wr(r,s=>(s.fx=o[s[0]],s.fy=i[s[0]],s),s=>o[s],s=>i[s]):e?Wr(r,s=>(s.fx=o[s[0]],s),s=>o[s]):Wr(r,s=>(s.fy=i[s[0]],s),s=>i[s])}function YR(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 UR(t){let e=[],n=new Uint32Array(sn(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 vG=new Map([["top",JS],["right",e4],["bottom",KS],["left",t4],["top-left",H1(JS,t4)],["top-right",H1(JS,e4)],["bottom-left",H1(KS,t4)],["bottom-right",H1(KS,e4)],["top-empty",SG],["right-empty",TG],["bottom-empty",MG],["left-empty",AG],["empty",EG]]);function jR(t){if(t==null)return null;let e=vG.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}var qR=new WeakMap;function n4(t){let e=qR.get(t);return e||qR.set(t,e=new Tn(Et(t,(n,r)=>[n,r]))),e}function Ds(t,e){return n4(t).get(e)}function _G(t,e,n){return e=Or(e),n=Or(n),t.find(r=>Object.is(Or(r.x),e)&&Object.is(Or(r.y),n))}function Z1(t,e,n){return _G(t,e,n)?.empty}function JS(t,{y:e},{y:n}){return e?Ds(e,n)===0:!0}function KS(t,{y:e},{y:n}){return e?Ds(e,n)===e.length-1:!0}function t4(t,{x:e},{x:n}){return e?Ds(e,n)===0:!0}function e4(t,{x:e},{x:n}){return e?Ds(e,n)===e.length-1:!0}function SG(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,r);if(i>0)return Z1(t,n,e[i-1])}function MG(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,r);if(i<e.length-1)return Z1(t,n,e[i+1])}function AG(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,n);if(i>0)return Z1(t,e[i-1],r)}function TG(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,n);if(i<e.length-1)return Z1(t,e[i+1],r)}function EG(t,e,{empty:n}){return n}function H1(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function J1(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 XR=Math.PI,zi=2*XR,r4=.618;function WR({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(Ve(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}=o4(t));let{width:u,height:p,marginLeft:l,marginRight:d,marginTop:h,marginBottom:m}=s,x=u-l-d-i-r,g=p-h-m-n-o;if(t=t?.({width:x,height:g,clip:f,...a}),t==null)return;f=IG(f,l,h,u-d,p-m);let y=l+i,b=h+n,w;if(c!=null){let[[_,v],[A,T]]=Ue(t).bounds(c),E=Math.min(x/(A-_),g/(T-v));E>0?(y-=(E*(_+A)-x)/2,b-=(E*(v+T)-g)/2,w=ja({point(N,M){this.stream.point(N*E+y,M*E+b)}})):_n("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=y===0&&b===0?VR():ja({point(_,v){this.stream.point(_+y,v+b)}}),{stream:_=>t.stream(w.stream(f(_)))}}function o4(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Zr($6,.7463,.4673);case"albers":return K1(Zp,.7463,.4673);case"azimuthal-equal-area":return Zr(P6,4,4);case"azimuthal-equidistant":return Zr(q6,zi,zi);case"conic-conformal":return K1(Y6,zi,zi);case"conic-equal-area":return K1(ys,6.1702,2.9781);case"conic-equidistant":return K1(j6,7.312,3.6282);case"equal-earth":return Zr(W6,5.4133,2.6347);case"equirectangular":return Zr(U6,zi,XR);case"gnomonic":return Zr(G6,3.4641,3.4641);case"identity":return{type:VR};case"reflect-y":return{type:NG};case"mercator":return Zr(B6,zi,zi);case"orthographic":return Zr(Q6,2,2);case"stereographic":return Zr(J6,2,2);case"transverse-mercator":return Zr(t3,zi,zi);default:throw new Error(`unknown projection type: ${t}`)}}function IG(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 Cf(e,n,r,o);default:throw new Error(`unknown projection clip type: ${t}`)}}function Zr(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 K1(t,e,n){let{type:r,aspectRatio:o}=Zr(t,e,n);return{type:i=>{let{parallels:s,domain:a,width:c,height:f}=i,u=r(i);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,f],{type:"Sphere"})),u},aspectRatio:o}}var VR=ue({stream:t=>t}),NG=ue(ja({point(t,e){this.stream.point(t,-e)}}));function i4(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,u=r.stream({point(p,l){a[f]=p,c[f]=l}});for(f=0;f<s;++f)u.point(o[f],i[f])}function GR({projection:t}={}){return t==null?!1:typeof t.stream=="function"?!0:(Ve(t)&&(t=t.type),t!=null)}function HR(t){if(typeof t?.stream=="function")return r4;if(Ve(t)){let e,n;if({domain:e,type:t,...n}=t,e!=null&&t!=null){let r=typeof t=="string"?o4(t).type:t,[[o,i],[s,a]]=Ue(r({...n,width:100,height:100})).bounds(e),c=(a-i)/(s-o);return c&&isFinite(c)?c<.2?.2:c>5?5:c:r4}}if(t!=null){if(typeof t!="function"){let{aspectRatio:e}=o4(t);if(e)return e}return r4}}function Bo(t,e,{projection:n}){let{x:r,y:o}=t,i={};return r&&(i.x=r),o&&(i.y=o),i=uu(i,e),n&&r?.scale==="x"&&o?.scale==="y"&&i4("x","y",i,n),r&&(i.x=Ne(i.x)),o&&(i.y=Ne(i.y)),i}function QR(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)or(s,i);return[r,o]}function Ps(t={}){let{document:e=typeof window<"u"?window.document:void 0,clip:n}=t;return{document:e,clip:O1(n)}}function ot(t,{document:e}){return Nt(hi(t).call(e.documentElement))}var tb=Symbol("unset");function Fs(t){return(t.length===1?CG:kG)(t)}function CG(t){let e,n=tb;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function kG(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 LG=Fs(t=>new Intl.NumberFormat(t)),RG=Fs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}})),OG=Fs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}}));function s4(t="en-US"){let e=LG(t);return n=>n!=null&&!isNaN(n)?e.format(n):void 0}function ZR(t="en-US",e="short"){let n=RG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function JR(t="en-US",e="short"){let n=OG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function a4(t){return Jf(t,"Invalid Date")}function $G(t="en-US"){let e=s4(t);return n=>(n instanceof Date?a4:typeof n=="number"?e:be)(n)}var zo=$G();var le=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,DG=0,PG=0;function c4(){return`plot-clip-${++DG}`}function KR(){return`plot-pattern-${++PG}`}function eb(t,{title:e,href:n,ariaLabel:r,ariaDescription:o,ariaHidden:i,target:s,fill:a,fillOpacity:c,stroke:f,strokeWidth:u,strokeOpacity:p,strokeLinejoin:l,strokeLinecap:d,strokeMiterlimit:h,strokeDasharray:m,strokeDashoffset:x,opacity:g,mixBlendMode:y,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:A},{ariaLabel:T,fill:E="currentColor",fillOpacity:N,stroke:M="none",strokeOpacity:k,strokeWidth:O,strokeLinecap:S,strokeLinejoin:I,strokeMiterlimit:C,paintOrder:L}){E===null&&(a=null,c=null),M===null&&(f=null,p=null),zt(E)?!zt(M)&&(!zt(a)||A?.fill)&&(M="none"):zt(M)&&(!zt(f)||A?.stroke)&&(E="none");let[D,$]=ce(a,E),[P,F]=Ut(c,N),[q,V]=ce(f,M),[K,et]=Ut(p,k),[rt,j]=Ut(g);Pi(V)||(u===void 0&&(u=O),d===void 0&&(d=S),l===void 0&&(l=I),h===void 0&&!IL(l)&&(h=C),!Pi($)&&w===void 0&&(w=L));let[nt,Y]=Ut(u);return E!==null&&(t.fill=te($,"currentColor"),t.fillOpacity=eh(F,1)),M!==null&&(t.stroke=te(V,"none"),t.strokeWidth=eh(Y,1),t.strokeOpacity=eh(et,1),t.strokeLinejoin=te(l,"miter"),t.strokeLinecap=te(d,"butt"),t.strokeMiterlimit=eh(h,4),t.strokeDasharray=te(m,"none"),t.strokeDashoffset=te(x,"0")),t.target=be(s),t.ariaLabel=be(T),t.ariaDescription=be(o),t.ariaHidden=be(i),t.opacity=eh(j,1),t.mixBlendMode=te(y,"normal"),t.imageFilter=te(b,"none"),t.paintOrder=te(w,"normal"),t.pointerEvents=te(_,"auto"),t.shapeRendering=te(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:K,scale:"auto",optional:!0},strokeWidth:{value:nt,optional:!0},opacity:{value:rt,scale:"auto",optional:!0}}}function FG(t,e){e&&t.filter(n=>qd(e[n])).append("title").call(BG,e)}function qG(t,e){e&&t.filter(([n])=>qd(e[n])).append("title").call(zG,e)}function BG(t,e){e&&t.text(n=>zo(e[n]))}function zG(t,e){e&&t.text(([n])=>zo(e[n]))}function Tt(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){r&&at(t,"aria-label",l=>r[l]),i&&at(t,"fill",l=>i[l]),s&&at(t,"fill-opacity",l=>s[l]),a&&at(t,"stroke",l=>a[l]),c&&at(t,"stroke-opacity",l=>c[l]),f&&at(t,"stroke-width",l=>f[l]),u&&at(t,"opacity",l=>u[l]),p&&eO(t,l=>p[l],e),n||FG(t,o)}function uc(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){r&&at(t,"aria-label",([l])=>r[l]),i&&at(t,"fill",([l])=>i[l]),s&&at(t,"fill-opacity",([l])=>s[l]),a&&at(t,"stroke",([l])=>a[l]),c&&at(t,"stroke-opacity",([l])=>c[l]),f&&at(t,"stroke-width",([l])=>f[l]),u&&at(t,"opacity",([l])=>u[l]),p&&eO(t,([l])=>p[l],e),n||qG(t,o)}function YG({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(u=>u!==void 0)}function nh(t,e,n){let r=rn(t,o=>e[o]);return n===void 0&&r.size>1+t.length>>1&&_n("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*nb(t,e,n,r){let{z:o}=n,{z:i}=r,s=YG(r,n),a=[...e,...s];for(let c of i?nh(t,i,o):[t]){let f,u;t:for(let p of c){for(let l of a)if(!oe(l[p])){u&&u.push(-1);continue t}if(f===void 0){u&&(yield u),f=s.map(l=>Or(l[p])),u=[p];continue}u.push(p);for(let l=0;l<s.length;++l)if(Or(s[l][p])!==f[l]){yield u,f=s.map(h=>Or(h[p])),u=[p];continue t}}u&&(yield u)}}function UG(t,e,n,r){let o,{clip:i=r.clip}=e;switch(i){case"frame":{t=ot("svg:g",r).each(function(){this.appendChild(t.node()),t.node=()=>this}),o=jG(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 tO(t){let e=new WeakMap;return(n,r)=>{let o=e.get(n);if(!o){let i=c4();Nt(n.ownerSVGElement).append("clipPath").attr("id",i).call(t,n,r),e.set(n,o=`url(#${i})`)}return o}}var jG=tO((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=tO((t,e)=>{let{projection:n}=e;if(!n)throw new Error('the "sphere" clip option requires a projection');t.append("path").attr("d",Ue(n)({type:"Sphere"}))});function wt(t,e,n,r){UG(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 ht(t,e){WG(t,"mix-blend-mode",e.mixBlendMode),at(t,"opacity",e.opacity)}function eO(t,e,n){t.each(function(r){let o=e(r);if(o!=null){let i=this.ownerDocument.createElementNS(Nn.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(Nn.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 WG(t,e,n){n!=null&&t.style(e,n)}function xt(t,e,{x:n,y:r},o=le,i=le){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 te(t,e){if((t=be(t))!==e)return t}function eh(t,e){if((t=Dt(t))!==e)return t}var VG=/^-?([_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 qs(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!VG.test(t))throw new Error(`invalid class name: ${t}`);return t}function xu(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 Qe({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 lt=class{constructor(e,n={},r={},o){let{facet:i="auto",facetAnchor:s,fx:a,fy:c,sort:f,dx:u=0,dy:p=0,margin:l=0,marginTop:d=l,marginRight:h=l,marginBottom:m=l,marginLeft:x=l,className:g,clip:y=o?.clip,channels:b,tip:w,render:_}=r;if(this.data=e,this.sort=Oo(f)?f:null,this.initializer=Kt(r).initializer,this.transform=this.initializer?r.transform:Ce(r).transform,i===null||i===!1?this.facet=null:(this.facet=Oe(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=e===Es&&typeof a=="string"?[a]:a,this.fy=e===Es&&typeof c=="string"?[c]:c),this.facetAnchor=jR(s),n=Wd(n),b!==void 0&&(n={...GG(b),...n}),o!==void 0&&(n={...eb(this,r,o),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,A])=>{if(fr(A.value)){let{value:T,label:E=A.label,scale:N=A.scale}=A.value;A={...A,label:E,scale:N,value:T}}if(e===Es&&typeof A.value=="string"){let{value:T}=A;A={...A,value:[T]}}return[v,A]}).filter(([v,{value:A,optional:T}])=>{if(A!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+p,this.marginTop=+d,this.marginRight=+h,this.marginBottom=+m,this.marginLeft=+x,this.clip=O1(y),this.tip=HG(w),this.className=g?qs(g):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=Yi(_,this.render))}initialize(e,n,r){let o=Ri(this.data);e===void 0&&o!=null&&(e=[Fn(o)]);let i=e;this.transform!=null&&({facets:e,data:o}=this.transform(o,e,r),o=Ri(o)),e!==void 0&&(e.original=i);let s=Y1(this.channels,o);return this.sort!=null&&GL(o,e,s,n,this.sort),{data:o,facets:e,channels:s}}filter(e,n,r){for(let o in n){let{filter:i=oe}=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"&&i4(o,i,n,r.projection)}}scale(e,n,r){let o=uu(e,n);return r.projection&&this.project(e,o,r),o}};function ke(...t){return t.plot=lt.prototype.plot,t}function Yi(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,u,p,l)=>e.call(this,c,f,u,p,l,a))}}function GG(t){return Object.fromEntries(Object.entries(Wd(t)).map(([e,n])=>(n=typeof n=="string"?{value:n,label:e}:$r(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[e,n])))}function HG(t){return t===!0?"xy":t===!1||t==null?null:typeof t=="string"?Oe(t,"tip",["x","y","xy"]):t}function Jr(t,e){return t?.tip===!0?{...t,tip:e}:Ve(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:e}}:t}function rO(t,e,n={}){let r=.5-le,o=.5+le,i=.5+le,s=.5-le;for(let{marginTop:m,marginRight:x,marginBottom:g,marginLeft:y}of e)m>r&&(r=m),x>o&&(o=x),g>i&&(i=g),y>s&&(s=y);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:f=a!==void 0?a:o,marginBottom:u=a!==void 0?a:i,marginLeft:p=a!==void 0?a:s}=n;c=+c,f=+f,u=+u,p=+p;let{width:l=640,height:d=QG(t,n,{width:l,marginTopDefault:r,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:s})+Math.max(0,c-r+u-i)}=n;l=+l,d=+d;let h={width:l,height:d,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p};if(t.fx||t.fy){let{margin:m,marginTop:x=m!==void 0?m:c,marginRight:g=m!==void 0?m:f,marginBottom:y=m!==void 0?m:u,marginLeft:b=m!==void 0?m:p}=n.facet??{};x=+x,g=+g,y=+y,b=+b,h.facet={marginTop:x,marginRight:g,marginBottom:y,marginLeft:b}}return h}function QG({x:t,y:e,fy:n,fx:r},{projection:o,aspectRatio:i},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:f,marginLeftDefault:u}){let p=n&&n.scale.domain().length||1,l=HR(o);if(l){let h=r?r.scale.domain().length:1,m=(1.1*p-.1)/(1.1*h-.1)*l,x=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*x+a+f)}let d=e?qo(e)?e.scale.domain().length||1:Math.max(7,17/p):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=nO("y",e)/(nO("x",t)*i),m=r?r.scale.bandwidth():1,x=n?n.scale.bandwidth():1,g=m*(s-u-c)-t.insetLeft-t.insetRight;return(h*g+e.insetTop+e.insetBottom)/x+a+f}return!!(e||n)*Math.max(1,Math.min(60,d*p))*20+!!r*30+60}function nO(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]=Ft(r);return Math.abs(o(s)-o(i))}var oO=new WeakMap;function f4(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:Yi(function(u,p,l,d,h,m){h={...h,pointerSticky:!1};let x=h.ownerSVGElement,{data:g}=h.getMarkState(this),y=oO.get(x);y||oO.set(x,y={sticky:!1,roots:[],renders:[]});let b=y.renders.push(V)-1,{x:w,y:_,fx:v,fy:A}=p,T=v?v(u.fx)-d.marginLeft:0,E=A?A(u.fy)-d.marginTop:0;w?.bandwidth&&(T+=w.bandwidth()/2),_?.bandwidth&&(E+=_.bandwidth()/2);let N=u.fi!=null,M;if(N){let j=y.facetStates;j||(y.facetStates=j=new Map),M=j.get(this),M||j.set(this,M=new Map)}let[k,O]=Qe(this,d),{px:S,py:I}=l,C=S?j=>S[j]:u4(l,k),L=I?j=>I[j]:l4(l,O),D,$,P,F;function q(j,nt){if(N)if(F&&(F=cancelAnimationFrame(F)),j==null)M.delete(u.fi);else{M.set(u.fi,nt),F=requestAnimationFrame(()=>{F=null;for(let[Y,G]of M)if(G<nt||G===nt&&Y<u.fi){j=null;break}V(j)});return}V(j)}function V(j){if(D===j&&P===y.sticky)return;D=j,P=h.pointerSticky=y.sticky;let nt=D==null?[]:[D];N&&(nt.fx=u.fx,nt.fy=u.fy,nt.fi=u.fi);let Y=m(nt,p,l,d,h);if($){if(N){let G=$.parentNode,tt=$.getAttribute("transform"),B=Y.getAttribute("transform");tt?Y.setAttribute("transform",tt):Y.removeAttribute("transform"),B?G.setAttribute("transform",B):G.removeAttribute("transform"),Y.removeAttribute("aria-label"),Y.removeAttribute("aria-description"),Y.removeAttribute("aria-hidden")}$.replaceWith(Y)}if(y.roots[b]=$=Y,!(D==null&&M?.size>1)){let G=D==null?null:Gn(g)?g[D]:g.get(D);h.dispatchValue(G)}return Y}function K(j){if(y.sticky||j.pointerType==="mouse"&&j.buttons===1)return;let[nt,Y]=hn(j);nt-=T,Y-=E;let G=nt<d.marginLeft||nt>d.width-d.marginRight?1:t,tt=Y<d.marginTop||Y>d.height-d.marginBottom?1:e,B=null,_t=s*s;for(let ct of u){let Ct=G*(C(ct)-nt),Lt=tt*(L(ct)-Y),Z=Ct*Ct+Lt*Lt;Z<=_t&&(B=ct,_t=Z)}if(B!=null&&(t!==1||e!==1)){let ct=C(B)-nt,Ct=L(B)-Y;_t=ct*ct+Ct*Ct}q(B,_t)}function et(j){j.pointerType==="mouse"&&D!=null&&(y.sticky&&y.roots.some(nt=>nt?.contains(j.target))||(y.sticky?(y.sticky=!1,y.renders.forEach(nt=>nt(null))):(y.sticky=!0,V(D)),j.stopImmediatePropagation()))}function rt(j){j.pointerType==="mouse"&&(y.sticky||q(null))}return x.addEventListener("pointerenter",K),x.addEventListener("pointermove",K),x.addEventListener("pointerdown",et),x.addEventListener("pointerleave",rt),V(null)},c)}}function Bs(t){return f4(1,1,t)}function zs(t){return f4(1,.01,t)}function Ui(t){return f4(.01,1,t)}function u4({x1:t,x2:e,x:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function l4({y1:t,y2:e,y:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function rb(t){return qo(t)&&t.interval===void 0?void 0:"tabular-nums"}function iO(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:u,ticks:p=(o-f-a)/64,tickFormat:l,fontVariant:d=rb(t),round:h=!0,opacity:m,className:x}=e,g=Ps(e);x=qs(x),m=Ut(m)[1],l===null&&(l=()=>null);let y=ot("svg",g).attr("class",`${x}-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(.${x}-ramp) {
6
+ ${n}`}function LV(t){return t==="time"?I1:t==="utc"?Yd:NV}function xL(t,e,n){let r=Tt(Mg(e,(o,i)=>Math.abs(i-o)));if(r<1e3)return hL("millisecond","utc",n);for(let[o,i,s,a]of LV(t)){if(r>a||o==="hour"&&!r)break;if(e.every(c=>i.floor(c)>=c))return hL(o,s,n)}}function eu(t,e,n){return(r,o,i)=>{let s=t(r,o),a=e(r,o),c=o-ki(i);return o!==c&&i[c]!==void 0&&a===e(i[c],c)?s:n(s,a)}}var jd=Object.getPrototypeOf(Uint8Array),RV=Object.prototype.toString;function Hn(t){return t instanceof Array||t instanceof jd}function bL(t){return t instanceof jd&&!OV(t)}function wL(t){return t?.prototype instanceof jd&&!$V(t)}function OV(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function $V(t){return t===BigInt64Array||t===BigUint64Array}var mS=Symbol("reindex");function ut(t,e,n){let r=typeof e;return r==="string"?LL(t)?gS(t.getChild(e),n):yL(t,xS(e),n):r==="function"?yL(t,e,n):r==="number"||e instanceof Date||r==="boolean"?It(t,ue(e),n):typeof e?.transform=="function"?hS(e.transform(t),n):DV(hS(e,n),t?.[mS])}function DV(t,e){return t!=null&&e?Wd(t,e):t}function yL(t,e,n){return It(t,wL(n)?(r,o)=>yS(e(r,o)):e,n)}function hS(t,e){return e===void 0?cr(t):RL(t)?gS(t,e):t instanceof e?t:e.from(t,wL(e)&&!bL(t)?yS:void 0)}function gS(t,e){return t==null?t:(e===void 0||e===Array)&&qV(t.type)?bS(t.toArray()):hS(t.toArray(),e)}var Es=[null],xS=t=>e=>{let n=e[t];return n===void 0&&e.type==="Feature"?e.properties?.[t]:n},Zt={transform:qn},W={transform:t=>t};var Xd=()=>1,vL=()=>!0,we=t=>t==null?t:`${t}`,Dt=t=>t==null?t:+t;var ic=t=>t?t[0]:void 0,Ts=t=>t?t[1]:void 0,_L=t=>t?t[2]:void 0,ue=t=>()=>t;function ou(t){let e=+`${t}`.slice(1)/100;return(n,r)=>Cn(n,e,r)}function Ce(t){return bL(t)?t:It(t,yS,Float64Array)}function yS(t){return t==null?NaN:Number(t)}function bS(t){return It(t,wS)}function wS(t){return t instanceof Date&&!isNaN(t)?t:typeof t=="string"?zd(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function ce(t,e){return t===void 0&&(t=e),t===null?[void 0,"none"]:ks(t)?[void 0,t]:[t,void 0]}function Ut(t,e){return t===void 0&&(t=e),t===null||typeof t=="number"?[void 0,t]:[t,void 0]}function vS(t,e,n){if(t!=null)return $e(t,e,n)}function $e(t,e,n){let r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function Li(t){return LL(t)?t:cr(t)}function cr(t){if(t==null||Hn(t))return t;if(RL(t))return gS(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 It(t,e,n=Array){return t==null?t:t instanceof n?t.map(e):n.from(t,e)}function Is(t,e=Array){return t instanceof e?t.slice():e.from(t)}function _S({x:t,x1:e,x2:n}){return t!==void 0||e!==void 0||n!==void 0}function SS({y:t,y1:e,y2:n}){return t!==void 0||e!==void 0||n!==void 0}function Ri(t){return _S(t)||SS(t)||t.interval!==void 0}function He(t){return t?.toString===RV}function Ro(t){return He(t)&&(t.type!==void 0||t.domain!==void 0)}function fr(t){return He(t)&&typeof t.transform!="function"}function Oo(t){return fr(t)&&t.value===void 0&&t.channel===void 0}function MS(t,e,n,r=W){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 ge(t,e){return t===void 0&&e===void 0?[ic,Ts]:[t,e]}function vn({z:t,fill:e,stroke:n}={}){return t===void 0&&([t]=ce(e)),t===void 0&&([t]=ce(n)),t}function Cs(t){return Hn(t)?t.length:t?.numRows}function qn(t){let e=Cs(t),n=new Uint32Array(e);for(let r=0;r<e;++r)n[r]=r;return n}function Wd(t,e){return Hn(t)?It(e,n=>t[n],t.constructor):It(e,n=>t.at(n))}function iu(t){return t.length===1?(e,n)=>t(Wd(n,e)):t}function Oi(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function Or(t){return t!==null&&typeof t=="object"?t.valueOf():t}function k1(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 Qe(t){let e;return[{transform:()=>e,label:ln(t)},n=>e=n]}function un(t){return t==null?[t]:Qe(t)}function ln(t,e){return typeof t=="string"?t:t&&t.label!==void 0?t.label:e}function su(t,e){return{transform(n){let r=t.transform(n),o=e.transform(n);return fe(r)||fe(o)?It(r,(i,s)=>new Date((+r[s]+ +o[s])/2)):It(r,(i,s)=>(+r[s]+ +o[s])/2,Float64Array)},label:t.label}}function sc(t,e){let n=AS(e?.interval,e?.type);return n?It(t,n):t}function AS(t,e){let n=au(t,e);return n&&(r=>oe(r)?n.floor(r):r)}function au(t,e){if(t!=null){if(typeof t=="number")return ES(t);if(typeof t=="string")return(e==="time"?Ud:oc)(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 ES(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)=>be(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)=>be(Math.ceil(n/e),r/e).map(o=>o*e)}}function $o(t,e){if(t=au(t,e),t&&typeof t.range!="function")throw new Error("invalid interval: missing range method");return t}function SL(t,e){if(t=$o(t,e),t&&typeof t.ceil!="function")throw new Error("invalid interval: missing ceil method");return t}function ML(t){return Ns(t)&&typeof t?.floor=="function"&&t.floor()instanceof Date}function Ns(t){return typeof t?.range=="function"}function $r(t){return t===void 0||fr(t)?t:{value:t}}function AL(t){return t==null?null:{transform:e=>ut(e,t,Float64Array),label:ln(t)}}function EL(t){if(!Bn(t))return!1;for(let e of t)if(e!=null)return typeof e=="object"&&"0"in e&&"1"in e}function Bn(t){return t&&typeof t[Symbol.iterator]=="function"}function L1(t){for(let e of t)if(e!=null)return typeof e!="object"||e instanceof Date}function ie(t){for(let e of t){if(e==null)continue;let n=typeof e;return n==="string"||n==="boolean"}}function fe(t){for(let e of t)if(e!=null)return e instanceof Date}function TL(t){for(let e of t)if(e!=null)return typeof e=="string"&&isNaN(e)&&zd(e)}function IL(t){for(let e of t)if(e!=null){if(typeof e!="string")return!1;if(e.trim())return!isNaN(e)}}function $i(t){for(let e of t)if(e!=null)return typeof e=="number"}function R1(t,e){let n;for(let r of t)if(r!=null){if(!e(r))return!1;n=!0}return n}var PV=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 ks(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)||PV.has(t))}function CL(t){return typeof t=="number"&&(0<=t&&t<=1||isNaN(t))}function zt(t){return t==null||Di(t)}function Di(t){return/^\s*none\s*$/i.test(t)}function NL(t){return/^\s*round\s*$/i.test(t)}function O1(t,e){return vS(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Do(t="middle"){return O1(t,"frameAnchor")}function kL(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 FV(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 Vd(t){return Bn(t)?FV(t):t}function $1(t){return t===!0?t="frame":t===!1?t=null:t!=null&&(t=$e(t,"clip",["frame","sphere"])),t}function LL(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}function RL(t){return t&&typeof t.toArray=="function"&&t.type}function qV(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var Dr=Symbol("position"),ur=Symbol("color"),ac=Symbol("radius"),cc=Symbol("length"),fc=Symbol("opacity"),cu=Symbol("symbol"),OL=Symbol("projection"),Wt=new Map([["x",Dr],["y",Dr],["fx",Dr],["fy",Dr],["r",ac],["color",ur],["opacity",fc],["symbol",cu],["length",cc],["projection",OL]]);function $L(t){return t===Dr||t===OL}function DL(t){return t===Dr||t===ac||t===cc||t===fc}var TS=Math.sqrt(3),IS=2/TS,BV={draw(t,e){let n=Math.sqrt(e/Math.PI),r=n*IS,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()}},CS=new Map([["asterisk",Ad],["circle",Ci],["cross",Ed],["diamond",Td],["diamond2",Id],["hexagon",BV],["plus",Cd],["square",Nd],["square2",kd],["star",Ld],["times",Hf],["triangle",Rd],["triangle2",Od],["wye",$d]]);function NS(t){return t&&typeof t.draw=="function"}function PL(t){return NS(t)?!0:typeof t!="string"?!1:CS.has(t.toLowerCase())}function fu(t){if(t==null||NS(t))return t;let e=CS.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function FL(t){if(t==null||NS(t))return[void 0,t];if(typeof t=="string"){let e=CS.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}function Ne({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},s){if(r===void 0&&(t!=null&&(r=RS(t)),e!=null&&!Oo(e)&&(r=kS(r,$S(e))),n&&(r=kS(r,OS))),s!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(e===null||Oo(e))&&{sort:e},transform:kS(r,s)}}function Kt({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return r===void 0&&(t!=null&&(r=RS(t)),e!=null&&!Oo(e)&&(r=LS(r,$S(e))),n&&(r=LS(r,OS))),{...o,...(e===null||Oo(e))&&{sort:e},initializer:LS(r,i)}}function kS(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,Li(n),r,o)}}function LS(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,u,p;return{data:a=n,facets:c=r,channels:s}=t.call(this,n,r,o,...i),{data:u=a,facets:p=c,channels:f}=e.call(this,a,c,{...o,...s},...i),{data:u,facets:p,channels:{...s,...f}}}}function D1(t,e){return(t.initializer!=null?Kt:Ne)(t,e)}function qL(t,e){return D1(e,RS(t))}function RS(t){return(e,n)=>{let r=ut(e,t);return{data:e,facets:n.map(o=>o.filter(i=>r[i]))}}}function BL({sort:t,...e}={}){return{...D1(e,OS),sort:Oo(t)?t:null}}function OS(t,e){return{data:t,facets:e.map(n=>n.slice().reverse())}}function zL({seed:t,sort:e,...n}={}){return{...D1(n,YL(t==null?Math.random:Wa(t))),sort:Oo(e)?e:null}}function P1(t,{sort:e,...n}={}){return{...(fr(t)&&t.channel!==void 0?Kt:D1)(n,$S(t)),sort:Oo(e)?e:null}}function $S(t){return(typeof t=="function"&&t.length!==1?zV:YL)(t)}function zV(t){return(e,n)=>{let r=Hn(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 YL(t){let e,n;({channel:e,value:t,order:n}={...$r(t)});let r=e?.startsWith("-");if(r&&(e=e.slice(1)),n===void 0&&(n=r?nc:Ge),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=Ge;break;case"descending":n=nc;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,u)=>n(a[f],a[u]);return{data:o,facets:i.map(f=>f.slice().sort(c))}}}function Hd(t,e){return F1(null,null,t,e)}function Ls(t={y:"count"},e={}){let{x:n=W}=e;if(n==null)throw new Error("missing channel: x");return F1(n,null,t,e)}function Rs(t={x:"count"},e={}){let{y:n=W}=e;if(n==null)throw new Error("missing channel: y");return F1(null,n,t,e)}function Qd(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=ge(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return F1(n,r,t,e)}function F1(t,e,{data:n=z1,filter:r,sort:o,reverse:i,...s}={},a={}){s=PS(s,a),n=VL(n,W),o=o==null?void 0:XL("sort",o,a),r=r==null?void 0:WL("filter",r,a);let[c,f]=un(t),[u,p]=un(e),{z:l,fill:d,stroke:h,x1:m,x2:g,y1:x,y2:y,...b}=a,[w,_]=un(l),[v]=ce(d),[S]=ce(h),[E,T]=un(v),[I,A]=un(S);return{..."z"in a&&{z:w||l},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:I||h},...Ne(b,(k,O,M)=>{let C=sc(ut(k,t),M?.x),N=sc(ut(k,e),M?.y),L=ut(k,l),D=ut(k,v),$=ut(k,S),P=Zd(s,{z:L,fill:D,stroke:$}),F=[],q=[],V=C&&f([]),K=N&&p([]),et=L&&_([]),rt=D&&T([]),j=$&&A([]),nt=0;for(let Y of s)Y.initialize(k);o&&o.initialize(k),r&&r.initialize(k);for(let Y of O){let G=[];for(let tt of s)tt.scope("facet",Y);o&&o.scope("facet",Y),r&&r.scope("facet",Y);for(let[tt,B]of Po(Y,P))for(let[_t,ct]of Po(B,N))for(let[kt,Lt]of Po(ct,C)){let Z={data:k};if(C&&(Z.x=kt),N&&(Z.y=_t),P&&(Z.z=tt),!(r&&!r.reduce(Lt,Z))){G.push(nt++),q.push(n.reduceIndex(Lt,k,Z)),C&&V.push(kt),N&&K.push(_t),L&&et.push(P===L?tt:L[Lt[0]]),D&&rt.push(P===D?tt:D[Lt[0]]),$&&j.push(P===$?tt:$[Lt[0]]);for(let jt of s)jt.reduce(Lt,Z);o&&o.reduce(Lt,Z)}}F.push(G)}return FS(F,o,i),{data:q,facets:F}}),...!Fo(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Fo(s,"y")&&(u?{y:u}:{y1:x,y2:y}),...Object.fromEntries(s.map(({name:k,output:O})=>[k,O]))}}function Fo(t,...e){for(let{name:n}of t)if(e.includes(n))return!0;return!1}function DS(t,e,n=q1){let r=Object.entries(t);return e.title!=null&&t.title===void 0&&r.push(["title",VV]),e.href!=null&&t.href===void 0&&r.push(["href",Y1]),r.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?YV(o):n(o,i,e))}function q1(t,e,n,r=B1){let o;He(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);let i=r(t,e,n),[s,a]=Qe(i.label),c;return{name:t,output:o===void 0?s:{value:s,scale:o},initialize(f){i.initialize(f),c=a([])},scope(f,u){i.scope(f,u)},reduce(f,u){c.push(i.reduce(f,u))}}}function YV(t){return{name:t,initialize(){},scope(){},reduce(){}}}function B1(t,e,n,r=uu){let o=k1(t,n),i=r(e,o),s,a;return{label:ln(i===Gd?null:o,i.label),initialize(c){s=o===void 0?c:ut(c,o),i.scope==="data"&&(a=i.reduceIndex(qn(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 Po(t,e){return e?sn(t,n=>e[n]):[[,t]]}function uu(t,e,n=UV){if(t==null)return n(t);if(typeof t.reduceIndex=="function")return t;if(typeof t.reduce=="function"&&He(t))return XV(t);if(typeof t=="function")return WV(t);if(/^p\d{2}$/i.test(t))return Pi(ou(t));switch(`${t}`.toLowerCase()){case"first":return Y1;case"last":return GV;case"identity":return z1;case"count":return Gd;case"distinct":return HV;case"sum":return e==null?Gd:QV;case"proportion":return jL(e,"data");case"proportion-facet":return jL(e,"facet");case"deviation":return Pi(Mr);case"min":return Pi(Ct);case"min-index":return Pi(vg);case"max":return Pi(Tt);case"max-index":return Pi(wg);case"mean":return UL(li);case"median":return UL(Vr);case"variance":return Pi(ss);case"mode":return Pi(df)}return n(t)}function UV(t){throw new Error(`invalid reduce: ${t}`)}function PS(t,e){return DS(t,e,XL)}function XL(t,e,n){return q1(t,e,n,WL)}function WL(t,e,n){return B1(t,e,n,VL)}function VL(t,e){return uu(t,e,jV)}function jV(t){switch(`${t}`.toLowerCase()){case"x":return ZV;case"y":return JV;case"z":return qS}throw new Error(`invalid group reduce: ${t}`)}function Zd(t,e){for(let n in e){let r=e[n];if(r!==void 0&&!t.some(o=>o.name===n))return r}}function FS(t,e,n){if(e){let r=e.output.transform(),o=(i,s)=>Ge(r[i],r[s]);t.forEach(i=>i.sort(o))}n&&t.forEach(r=>r.reverse())}function XV(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function WV(t){return{reduceIndex(e,n,r){return t(Wd(n,e),r)}}}function Pi(t){return{reduceIndex(e,n){return t(e,r=>n[r])}}}function UL(t){return{reduceIndex(e,n){let r=t(e,o=>n[o]);return fe(n)?new Date(r):r}}}var z1={reduceIndex(t,e){return Wd(e,t)}},Y1={reduceIndex(t,e){return e[t[0]]}},VV={reduceIndex(t,e){let r=fi(Wr(t,i=>i.length,i=>e[i]),Ts),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`,Le(i,Ts)]}return o.map(([i,s])=>`${i} (${s.toLocaleString("en-US")})`).join(`
7
+ `)}},GV={reduceIndex(t,e){return e[t[t.length-1]]}},Gd={label:"Frequency",reduceIndex(t){return t.length}},HV={label:"Distinct",reduceIndex(t,e){let n=new In;for(let r of t)n.add(e[r]);return n.size}},QV=Pi(Le);function jL(t,e){return t==null?{scope:e,label:"Frequency",reduceIndex:(n,r,o=1)=>n.length/o}:{scope:e,reduceIndex:(n,r,o=1)=>Le(n,i=>r[i])/o}}var ZV={reduceIndex(t,e,{x:n}){return n}},JV={reduceIndex(t,e,{y:n}){return n}},qS={reduceIndex(t,e,{z:n}){return n}};function GL(t){if(typeof t!="function")throw new Error(`invalid test function: ${t}`);return{reduceIndex(e,n,{data:r}){return n[e.find(Hn(r)?o=>t(r[o],o,r):o=>t(r.get(o),o,r))]}}}function lu(t,{scale:e,type:n,value:r,filter:o,hint:i,label:s=ln(r)},a){return i===void 0&&typeof r?.transform=="function"&&(i=r.hint),zS(a,{scale:e,type:n,value:ut(t,r),label:s,filter:o,hint:i})}function U1(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,lu(e,r,n)]))}function pu(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:It(i,s)]}));return n.channels=t,n}function zS(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&&R1(r,ks)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=n!==!0&&R1(r,CL)?null:"opacity",e.defaultScale="opacity";break;case"symbol":n!==!0&&R1(r,PL)?(e.scale=null,e.value=It(r,fu)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=Wt.has(t)?t:null;break}else if(n===!1)e.scale=null;else if(n!=null&&!Wt.has(n))throw new Error(`unknown scale: ${n}`);return e}function QL(t,e,n,r,o){let{order:i,reverse:s,reduce:a=!0,limit:c}=o;for(let f in o){if(!Wt.has(f))continue;let{value:u,order:p=i,reverse:l=s,reduce:d=a,limit:h=c}=$r(o[f]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),p=p===void 0?m!==(u==="width"||u==="height")?JL:ZL:eG(p),d==null||d===!1)continue;let g=f==="fx"||f==="fy"?tG(e,r[f]):KV(n,f);if(!g)throw new Error(`missing channel for scale: ${f}`);let x=g.value,[y=0,b=1/0]=Bn(h)?h:h<0?[h]:[0,h];if(u==null)g.domain=()=>{let w=Array.from(new In(x));return l&&(w=w.reverse()),(y!==0||b!==1/0)&&(w=w.slice(y,b)),w};else{let w=u==="data"?t:u==="height"?HL(n,"y1","y2"):u==="width"?HL(n,"x1","x2"):BS(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=uu(d===!0?"max":d,w);g.domain=()=>{let v=l_(qn(x),S=>_.reduceIndex(S,w),S=>x[S]);return p&&v.sort(p),l&&v.reverse(),(y!==0||b!==1/0)&&(v=v.slice(y,b)),v.map(ic)}}}}function KV(t,e){for(let n in t){let r=t[n];if(r.scale===e)return r}}function tG(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 HL(t,e,n){let r=BS(t,e),o=BS(t,n);return It(o,(i,s)=>Math.abs(i-r[s]),Float64Array)}function BS(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 eG(t){if(t==null||typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return ZL;case"descending":return JL}throw new Error(`invalid order: ${t}`)}function ZL([t,e],[n,r]){return Ge(e,r)||Ge(t,n)}function JL([t,e],[n,r]){return nc(e,r)||Ge(t,n)}function Jd(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var rR=new Map([["accent",E3],["category10",A3],["dark2",T3],["observable10",I3],["paired",C3],["pastel1",N3],["pastel2",k3],["set1",L3],["set2",R3],["set3",O3],["tableau10",$3]]);function oR(t){return t!=null&&rR.has(`${t}`.toLowerCase())}var KL=new Map([...rR,["brbg",Fi(sy,ay)],["prgn",Fi(cy,fy)],["piyg",Fi(uy,ly)],["puor",Fi(py,dy)],["rdbu",Fi(vd,jf)],["rdgy",Fi(hy,my)],["rdylbu",Fi(_d,Xf)],["rdylgn",Fi(gy,xy)],["spectral",Fi(yy,by)],["burd",tR(vd,jf)],["buylrd",tR(_d,Xf)],["blues",Ze(jy,Xy)],["greens",Ze(Wy,Vy)],["greys",Ze(Gy,Hy)],["oranges",Ze(t1,e1)],["purples",Ze(Qy,Zy)],["reds",Ze(Jy,Ky)],["turbo",qi(u1)],["viridis",qi(p1)],["magma",qi(d1)],["inferno",qi(h1)],["plasma",qi(m1)],["cividis",qi(n1)],["cubehelix",qi(r1)],["warm",qi(i1)],["cool",qi(s1)],["bugn",Ze(wy,vy)],["bupu",Ze(_y,Sy)],["gnbu",Ze(My,Ay)],["orrd",Ze(Ey,Ty)],["pubu",Ze(Ny,ky)],["pubugn",Ze(Iy,Cy)],["purd",Ze(Ly,Ry)],["rdpu",Ze(Oy,$y)],["ylgn",Ze(Fy,qy)],["ylgnbu",Ze(Dy,Py)],["ylorbr",Ze(By,zy)],["ylorrd",Ze(Yy,Uy)],["rainbow",eR(a1)],["sinebow",eR(f1)]]);function Ze(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?mn(e,n):t[n])}function Fi(t,e){return({length:n})=>n===2?[t[3][0],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?mn(e,n):t[n])}function tR(t,e){return({length:n})=>n===2?[t[3][2],t[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?mn(r=>e(1-r),n):t[n].slice().reverse())}function qi(t){return({length:e})=>mn(t,Math.max(2,Math.floor(e)))}function eR(t){return({length:e})=>mn(t,Math.floor(e)+1).slice(0,-1)}function YS(t){let e=`${t}`.toLowerCase();if(!KL.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return KL.get(e)}function Kd(t,e){let n=YS(t),r=typeof n=="function"?n({length:e}):n;return r.length!==e?r.slice(0,e):r}function iR(t,e="greys"){let n=new Set,[r,o]=Kd(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 nR=new Map([["brbg",ay],["prgn",fy],["piyg",ly],["puor",dy],["rdbu",jf],["rdgy",my],["rdylbu",Xf],["rdylgn",xy],["spectral",by],["burd",t=>jf(1-t)],["buylrd",t=>Xf(1-t)],["blues",Xy],["greens",Vy],["greys",Hy],["purples",Zy],["reds",Ky],["oranges",e1],["turbo",u1],["viridis",p1],["magma",d1],["inferno",h1],["plasma",m1],["cividis",n1],["cubehelix",r1],["warm",i1],["cool",s1],["bugn",vy],["bupu",Sy],["gnbu",Ay],["orrd",Ty],["pubugn",Cy],["pubu",ky],["purd",Ry],["rdpu",$y],["ylgnbu",Py],["ylgn",qy],["ylorbr",zy],["ylorrd",Uy],["rainbow",a1],["sinebow",f1]]);function du(t){let e=`${t}`.toLowerCase();if(!nR.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return nR.get(e)}var nG=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function sR(t){return t!=null&&nG.has(`${t}`.toLowerCase())}var jS=t=>e=>t(1-e),US=[0,1],aR=new Map([["number",ee],["rgb",Ar],["hsl",P_],["hcl",F_],["lab",Ug]]);function XS(t){let e=`${t}`.toLowerCase();if(!aR.has(e))throw new Error(`unknown interpolator: ${e}`);return aR.get(e)}function mu(t,e,n,{type:r,nice:o,clamp:i,zero:s,domain:a=mR(t,n),unknown:c,round:f,scheme:u,interval:p,range:l=Wt.get(t)===ac?sG(n,a):Wt.get(t)===cc?aG(n,a):Wt.get(t)===fc?US:void 0,interpolate:d=Wt.get(t)===ur?u==null&&l!==void 0?Ar:du(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):f?$a:ee,reverse:h}){if(p=$o(p,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=XS(d)),h=!!h,l!==void 0){let m=(a=cr(a)).length,g=(l=cr(l)).length;if(m!==g){if(d.length===1)throw new Error("invalid piecewise interpolator");d=xo(d,l),l=void 0}}if(d.length===1?(h&&(d=jS(d),h=!1),l===void 0&&(l=Float64Array.from(a,(m,g)=>g/(a.length-1)),l.length===2&&(l=US)),e.interpolate((l===US?ue:th)(d))):e.interpolate(d),s){let[m,g]=Ft(a);(m>0||g<0)&&(a=Is(a),(ki(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return h&&(a=cs(a)),e.domain(a).unknown(c),o&&(e.nice(rG(o,r)),a=e.domain()),l!==void 0&&e.range(l),i&&e.clamp(i),{type:r,domain:a,range:l,scale:e,interpolate:d,interval:p}}function rG(t,e){return t===!0?void 0:typeof t=="number"?t:SL(t,e)}function cR(t,e,n){return mu(t,vi(),e,n)}function fR(t,e,n){return WS(t,e,{...n,exponent:.5})}function WS(t,e,{exponent:n=1,...r}){return mu(t,ud().exponent(n),e,{...r,type:"pow"})}function uR(t,e,{base:n=10,domain:r=cG(e),...o}){return mu(t,cd().base(n),e,{...o,domain:r})}function lR(t,e,{constant:n=1,...r}){return mu(t,fd().constant(n),e,r)}function pR(t,e,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:o=r,scheme:i="rdylbu",domain:s=fG(e),unknown:a,interpolate:c,reverse:f}){return n===void 0&&(n=c!==void 0?mn(c,o):Wt.get(t)===ur?Kd(i,o):void 0),s.length>0&&(s=ld(s,n===void 0?{length:o}:n).quantiles()),j1(t,e,{domain:s,range:n,reverse:f,unknown:a})}function dR(t,e,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:o="rdylbu",domain:i=mR(t,e),unknown:s,interpolate:a,reverse:c}){let[f,u]=Ft(i),p;return n===void 0?(p=an(f,u,r),p[0]<=f&&p.splice(0,1),p[p.length-1]>=u&&p.pop(),r=p.length+1,n=a!==void 0?mn(a,r):Wt.get(t)===ur?Kd(o,r):void 0):(p=mn(ee(f,u),r+1).slice(1,-1),f instanceof Date&&(p=p.map(l=>new Date(l)))),ki(cr(i))<0&&p.reverse(),j1(t,e,{domain:p,range:n,reverse:c,unknown:s})}function j1(t,e,{domain:n=[0],unknown:r,scheme:o="rdylbu",interpolate:i,range:s=i!==void 0?mn(i,n.length+1):Wt.get(t)===ur?Kd(o,n.length+1):void 0,reverse:a}){n=cr(n);let c=ki(n);if(!isNaN(c)&&!oG(n,c))throw new Error(`the ${t} scale has a non-monotonic domain`);return a&&(s=cs(s)),{type:"threshold",scale:pd(c<0?cs(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function oG(t,e){for(let n=1,r=t.length,o=t[0];n<r;++n){let i=En(o,o=t[n]);if(i!==0&&i!==e)return!1}return!0}function hR(t){return{type:"identity",scale:DL(Wt.get(t))?sd():e=>e}}function hu(t,e=Kf){return t.length?[Ct(t,({value:n})=>n===void 0?n:Ct(n,e)),Tt(t,({value:n})=>n===void 0?n:Tt(n,e))]:[0,1]}function mR(t,e){let n=Wt.get(t);return(n===ac||n===fc||n===cc?iG:hu)(e)}function iG(t){return[0,t.length?Tt(t,({value:e})=>e===void 0?e:Tt(e,Kf)):1]}function sG(t,e){let n=t.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Cn(t,.5,({value:s})=>s===void 0?NaN:Cn(s,.25,Fn)),o=e.map(s=>3*Math.sqrt(s/r)),i=30/Tt(o);return i<1?o.map(s=>s*i):o}function aG(t,e){let n=Vr(t,({value:i})=>i===void 0?NaN:Vr(i,Math.abs)),r=e.map(i=>12*i/n),o=60/Tt(r);return o<1?r.map(i=>i*o):r}function cG(t){for(let{value:e}of t)if(e!==void 0)for(let n of e){if(n>0)return hu(t,Fn);if(n<0)return hu(t,_s)}return[1,10]}function fG(t){let e=[];for(let{value:n}of t)if(n!==void 0)for(let r of n)e.push(r);return e}function th(t){return(e,n)=>r=>t(e+r*(n-e))}var VS=0,GS;function gR(){let t=VS;return VS=0,GS=void 0,t}function _n(t){t!==GS&&(GS=t,console.warn(t),++VS)}function X1(t,e,n,r,{type:o,nice:i,clamp:s,domain:a=hu(r),unknown:c,pivot:f=0,scheme:u,range:p,symmetric:l=!0,interpolate:d=Wt.get(t)===ur?u==null&&p!==void 0?Ar:du(u!==void 0?u:"rdbu"):ee,reverse:h}){f=+f,a=cr(a);let[m,g]=a;if(a.length>2&&_n(`Warning: the diverging ${t} scale domain contains extra elements.`),En(m,g)<0&&([m,g]=[g,m],h=!h),m=Math.min(m,f),g=Math.max(g,f),typeof d!="function"&&(d=XS(d)),p!==void 0&&(d=d.length===1?th(d)(...p):xo(d,p)),h&&(d=jS(d)),l){let x=n.apply(f),y=x-n.apply(m),b=n.apply(g)-x;y<b?m=n.invert(x-b):y>b&&(g=n.invert(x+y))}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 xR(t,e,n){return X1(t,wd(),uG,e,n)}function yR(t,e,n){return HS(t,e,{...n,exponent:.5})}function HS(t,e,{exponent:n=1,...r}){return X1(t,iy().exponent(n=+n),dG(n),e,{...r,type:"diverging-pow"})}function bR(t,e,{base:n=10,pivot:r=1,domain:o=hu(e,r<0?_s:Fn),...i}){return X1(t,ry().base(n=+n),lG,e,{domain:o,pivot:r,...i})}function wR(t,e,{constant:n=1,...r}){return X1(t,oy().constant(n=+n),hG(n),e,r)}var uG={apply(t){return t},invert(t){return t}},lG={apply:Math.log,invert:Math.exp},pG={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function dG(t){return t===.5?pG:{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 hG(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 vR(t,e,n,r){return mu(t,e,n,r)}function _R(t,e,n){return vR(t,ty(),e,n)}function SR(t,e,n){return vR(t,ey(),e,n)}var gu=Symbol("ordinal");function AR(t,e,n,{type:r,interval:o,domain:i,range:s,reverse:a,hint:c}){return o=$o(o,r),i===void 0&&(i=NR(n,o,t)),(r==="categorical"||r===gu)&&(r="ordinal"),a&&(i=cs(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 ER(t,e,{type:n,interval:r,domain:o,range:i,scheme:s,unknown:a,...c}){r=$o(r,n),o===void 0&&(o=NR(e,r,t));let f;if(Wt.get(t)===cu)f=mG(e),i=i===void 0?gG(f):It(i,fu);else if(Wt.get(t)===ur&&(i===void 0&&(n==="ordinal"||n===gu)&&(i=iR(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 u=du(s),p=i[0],l=i[1]-i[0];i=({length:d})=>mn(h=>u(p+l*h),d)}else i=YS(s);if(a===od)throw new Error(`implicit unknown on ${t} scale is not supported`);return AR(t,Va().unknown(a),e,{...c,type:n,domain:o,range:i,hint:f})}function TR(t,e,{align:n=.5,padding:r=.5,...o}){return CR(f3().align(n).padding(r),e,o,t)}function IR(t,e,{align:n=.5,padding:r=.1,paddingInner:o=r,paddingOuter:i=t==="fx"||t==="fy"?0:r,...s}){return CR(bs().align(n).paddingInner(o).paddingOuter(i),e,s,t)}function CR(t,e,n,r){let{round:o}=n;return o!==void 0&&t.round(o=!!o),t=AR(r,t,e,n),t.round=o,t}function NR(t,e,n){let r=new In;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]=Ft(r).map(e.floor,e);return e.range(o,e.offset(i))}if(r.size>1e4&&Wt.get(n)===Dr)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return fi(r,Ge)}function MR(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 mG(t){return{fill:MR(t,"fill"),stroke:MR(t,"stroke")}}function gG(t){return zt(t.fill)?Y3:v1}function eh(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:u,align:p,padding:l,projection:d,facet:{label:h=e}={},...m}={}){let g={};for(let[x,y]of t){let b=m[x],w=FR(x,y,{round:Wt.get(x)===Dr?a:void 0,nice:c,clamp:f,zero:u,align:p,padding:l,projection:d,...b});if(w){let{label:_=x==="fx"||x==="fy"?h:e,percent:v,transform:S,inset:E,insetTop:T=E!==void 0?E:x==="y"?r:0,insetRight:I=E!==void 0?E:x==="x"?o:0,insetBottom:A=E!==void 0?E:x==="y"?i:0,insetLeft:k=E!==void 0?E:x==="x"?s:0}=b||{};if(S==null)S=void 0;else if(typeof S!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?xG(y,w):_,w.transform=S,x==="x"||x==="fx"?(w.insetLeft=+k,w.insetRight=+I):(x==="y"||x==="fy")&&(w.insetTop=+T,w.insetBottom=+A),g[x]=w}}return g}function ZS(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]=BR(o),n[r]=i,i.type=s,a!=null&&(i.interval=a),c!=null&&(i.label=c)}return n}function $R(t,e){let{x:n,y:r,fx:o,fy:i}=t,s=o||i?G1(e):e;o&&kR(o,s),i&&LR(i,s);let a=o||i?JS(t,e):e;n&&kR(n,a),r&&LR(r,a)}function xG(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!qo(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function V1(t){return Math.sign(ki(t.domain()))*Math.sign(ki(t.range()))}function G1(t){let{marginTop:e,marginRight:n,marginBottom:r,marginLeft:o,width:i,height:s,facet:{marginTop:a,marginRight:c,marginBottom:f,marginLeft:u}}=t;return{marginTop:Math.max(e,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,f),marginLeft:Math.max(o,u),width:i,height:s}}function JS({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=G1(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 kR(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)],qo(t)||(t.range=PR(t)),t.scale.range(t.range)}DR(t)}function LR(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],qo(t)?t.range.reverse():t.range=PR(t),t.scale.range(t.range)}DR(t)}function DR(t){t.round===void 0&&wG(t)&&yG(t)<=30&&t.scale.round(!0)}function yG({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 PR(t){let e=t.scale.domain().length+KS(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 H1(t,e,n){return FR(t,n===void 0?void 0:[{hint:n}],{...e})}function FR(t,e=[],n={}){let r=bG(t,e,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&t!=="fx"&&t!=="fy"&&qo({type:r})){let o=e.map(({value:i})=>i).filter(i=>i!==void 0);o.some(fe)?_n(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${xu(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 "${xu(r)}".`):o.some(TL)?_n(`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 "${xu(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 "${xu(r)}".`):o.some(IL)&&_n(`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 "${xu(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 "${xu(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=W1(e,n,Ce);break;case"identity":switch(Wt.get(t)){case Dr:n=W1(e,n,Ce);break;case cu:n=W1(e,n,vG);break}break;case"utc":case"time":n=W1(e,n,bS);break}switch(r){case"diverging":return xR(t,e,n);case"diverging-sqrt":return yR(t,e,n);case"diverging-pow":return HS(t,e,n);case"diverging-log":return bR(t,e,n);case"diverging-symlog":return wR(t,e,n);case"categorical":case"ordinal":case gu:return ER(t,e,n);case"cyclical":case"sequential":case"linear":return cR(t,e,n);case"sqrt":return fR(t,e,n);case"threshold":return j1(t,e,n);case"quantile":return pR(t,e,n);case"quantize":return dR(t,e,n);case"pow":return WS(t,e,n);case"log":return uR(t,e,n);case"symlog":return lR(t,e,n);case"utc":return SR(t,e,n);case"time":return _R(t,e,n);case"point":return TR(t,e,n);case"band":return IR(t,e,n);case"identity":return hR(t);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function xu(t){return typeof t=="symbol"?t.description:t}function RR(t){return typeof t=="string"?`${t}`.toLowerCase():t}var OR={toString:()=>"projection"};function bG(t,e,{type:n,domain:r,range:o,scheme:i,pivot:s,projection:a}){if(n=RR(n),t==="fx"||t==="fy")return"band";(t==="x"||t==="y")&&a!=null&&(n=OR);for(let f of e){let u=RR(f.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===OR)return;if(n!==void 0)return n;if(r===void 0&&!e.some(({value:f})=>f!==void 0))return;let c=Wt.get(t);if(c===ac)return"sqrt";if(c===fc||c===cc)return"linear";if(c===cu)return"ordinal";if((r||o||[]).length>2)return QS(c);if(r!==void 0){if(ie(r))return QS(c);if(fe(r))return"utc"}else{let f=e.map(({value:u})=>u).filter(u=>u!==void 0);if(f.some(ie))return QS(c);if(f.some(fe))return"utc"}if(c===ur){if(s!=null||sR(i))return"diverging";if(oR(i))return"categorical"}return"linear"}function QS(t){switch(t){case Dr:return"point";case ur:return gu;default:return"ordinal"}}function qo({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===gu}function KS({type:t}){return t==="threshold"}function wG({type:t}){return t==="point"||t==="band"}function lr(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 W1(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 vG(t){return It(t,fu)}function Os(t={}){let e;for(let n in t)if(Wt.has(n)&&Ro(t[n])){if(e!==void 0)throw new Error("ambiguous scale definition; multiple scales found");e=BR(H1(n,t[n]))}if(e===void 0)throw new Error("invalid scale definition; no scale found");return e}function qR(t){return e=>{if(!Wt.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}function BR({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:u=>u,invert:u=>u};let f=t.unknown?t.unknown():void 0;return{type:e,domain:Is(n),...r!==void 0&&{range:Is(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:u=>t(u),...t.invert&&{invert:u=>t.invert(u)}}}function YR(t,e){let{fx:n,fy:r}=eh(t,e),o=n?.scale.domain(),i=r?.scale.domain();return o&&i?xg(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 UR(t,{x:e,y:n}){return e&&=o4(e),n&&=o4(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 Z1(t,{fx:e,fy:n}){let r=qn(t),o=e?.value,i=n?.value;return e&&n?Wr(r,s=>(s.fx=o[s[0]],s.fy=i[s[0]],s),s=>o[s],s=>i[s]):e?Wr(r,s=>(s.fx=o[s[0]],s),s=>o[s]):Wr(r,s=>(s.fy=i[s[0]],s),s=>i[s])}function jR(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 XR(t){let e=[],n=new Uint32Array(Le(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 _G=new Map([["top",t4],["right",r4],["bottom",e4],["left",n4],["top-left",Q1(t4,n4)],["top-right",Q1(t4,r4)],["bottom-left",Q1(e4,n4)],["bottom-right",Q1(e4,r4)],["top-empty",MG],["right-empty",TG],["bottom-empty",AG],["left-empty",EG],["empty",IG]]);function WR(t){if(t==null)return null;let e=_G.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}var zR=new WeakMap;function o4(t){let e=zR.get(t);return e||zR.set(t,e=new Tn(It(t,(n,r)=>[n,r]))),e}function $s(t,e){return o4(t).get(e)}function SG(t,e,n){return e=Or(e),n=Or(n),t.find(r=>Object.is(Or(r.x),e)&&Object.is(Or(r.y),n))}function J1(t,e,n){return SG(t,e,n)?.empty}function t4(t,{y:e},{y:n}){return e?$s(e,n)===0:!0}function e4(t,{y:e},{y:n}){return e?$s(e,n)===e.length-1:!0}function n4(t,{x:e},{x:n}){return e?$s(e,n)===0:!0}function r4(t,{x:e},{x:n}){return e?$s(e,n)===e.length-1:!0}function MG(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=$s(e,r);if(i>0)return J1(t,n,e[i-1])}function AG(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=$s(e,r);if(i<e.length-1)return J1(t,n,e[i+1])}function EG(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=$s(e,n);if(i>0)return J1(t,e[i-1],r)}function TG(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=$s(e,n);if(i<e.length-1)return J1(t,e[i+1],r)}function IG(t,e,{empty:n}){return n}function Q1(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function K1(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 VR=Math.PI,Bi=2*VR,i4=.618;function GR({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(He(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}=s4(t));let{width:u,height:p,marginLeft:l,marginRight:d,marginTop:h,marginBottom:m}=s,g=u-l-d-i-r,x=p-h-m-n-o;if(t=t?.({width:g,height:x,clip:f,...a}),t==null)return;f=CG(f,l,h,u-d,p-m);let y=l+i,b=h+n,w;if(c!=null){let[[_,v],[S,E]]=Xe(t).bounds(c),T=Math.min(g/(S-_),x/(E-v));T>0?(y-=(T*(_+S)-g)/2,b-=(T*(v+E)-x)/2,w=ja({point(I,A){this.stream.point(I*T+y,A*T+b)}})):_n("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=y===0&&b===0?HR():ja({point(_,v){this.stream.point(_+y,v+b)}}),{stream:_=>t.stream(w.stream(f(_)))}}function s4(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Zr(P6,.7463,.4673);case"albers":return tb(Jp,.7463,.4673);case"azimuthal-equal-area":return Zr(q6,4,4);case"azimuthal-equidistant":return Zr(z6,Bi,Bi);case"conic-conformal":return tb(j6,Bi,Bi);case"conic-equal-area":return tb(xs,6.1702,2.9781);case"conic-equidistant":return tb(W6,7.312,3.6282);case"equal-earth":return Zr(G6,5.4133,2.6347);case"equirectangular":return Zr(X6,Bi,VR);case"gnomonic":return Zr(Q6,3.4641,3.4641);case"identity":return{type:HR};case"reflect-y":return{type:NG};case"mercator":return Zr(Y6,Bi,Bi);case"orthographic":return Zr(J6,2,2);case"stereographic":return Zr(t3,2,2);case"transverse-mercator":return Zr(n3,Bi,Bi);default:throw new Error(`unknown projection type: ${t}`)}}function CG(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 Lf(e,n,r,o);default:throw new Error(`unknown projection clip type: ${t}`)}}function Zr(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 tb(t,e,n){let{type:r,aspectRatio:o}=Zr(t,e,n);return{type:i=>{let{parallels:s,domain:a,width:c,height:f}=i,u=r(i);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,f],{type:"Sphere"})),u},aspectRatio:o}}var HR=ue({stream:t=>t}),NG=ue(ja({point(t,e){this.stream.point(t,-e)}}));function a4(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,u=r.stream({point(p,l){a[f]=p,c[f]=l}});for(f=0;f<s;++f)u.point(o[f],i[f])}function QR({projection:t}={}){return t==null?!1:typeof t.stream=="function"?!0:(He(t)&&(t=t.type),t!=null)}function ZR(t){if(typeof t?.stream=="function")return i4;if(He(t)){let e,n;if({domain:e,type:t,...n}=t,e!=null&&t!=null){let r=typeof t=="string"?s4(t).type:t,[[o,i],[s,a]]=Xe(r({...n,width:100,height:100})).bounds(e),c=(a-i)/(s-o);return c&&isFinite(c)?c<.2?.2:c>5?5:c:i4}}if(t!=null){if(typeof t!="function"){let{aspectRatio:e}=s4(t);if(e)return e}return i4}}function Bo(t,e,{projection:n}){let{x:r,y:o}=t,i={};return r&&(i.x=r),o&&(i.y=o),i=pu(i,e),n&&r?.scale==="x"&&o?.scale==="y"&&a4("x","y",i,n),r&&(i.x=Ce(i.x)),o&&(i.y=Ce(i.y)),i}function JR(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)or(s,i);return[r,o]}function Ds(t={}){let{document:e=typeof window<"u"?window.document:void 0,clip:n}=t;return{document:e,clip:$1(n)}}function ot(t,{document:e}){return Nt(di(t).call(e.documentElement))}var eb=Symbol("unset");function Ps(t){return(t.length===1?kG:LG)(t)}function kG(t){let e,n=eb;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function LG(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 RG=Ps(t=>new Intl.NumberFormat(t)),OG=Ps((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}})),$G=Ps((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}}));function c4(t="en-US"){let e=RG(t);return n=>n!=null&&!isNaN(n)?e.format(n):void 0}function KR(t="en-US",e="short"){let n=OG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function tO(t="en-US",e="short"){let n=$G(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function f4(t){return tu(t,"Invalid Date")}function DG(t="en-US"){let e=c4(t);return n=>(n instanceof Date?f4:typeof n=="number"?e:we)(n)}var zo=DG();var le=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,PG=0,FG=0;function u4(){return`plot-clip-${++PG}`}function eO(){return`plot-pattern-${++FG}`}function nb(t,{title:e,href:n,ariaLabel:r,ariaDescription:o,ariaHidden:i,target:s,fill:a,fillOpacity:c,stroke:f,strokeWidth:u,strokeOpacity:p,strokeLinejoin:l,strokeLinecap:d,strokeMiterlimit:h,strokeDasharray:m,strokeDashoffset:g,opacity:x,mixBlendMode:y,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:S},{ariaLabel:E,fill:T="currentColor",fillOpacity:I,stroke:A="none",strokeOpacity:k,strokeWidth:O,strokeLinecap:M,strokeLinejoin:C,strokeMiterlimit:N,paintOrder:L}){T===null&&(a=null,c=null),A===null&&(f=null,p=null),zt(T)?!zt(A)&&(!zt(a)||S?.fill)&&(A="none"):zt(A)&&(!zt(f)||S?.stroke)&&(T="none");let[D,$]=ce(a,T),[P,F]=Ut(c,I),[q,V]=ce(f,A),[K,et]=Ut(p,k),[rt,j]=Ut(x);Di(V)||(u===void 0&&(u=O),d===void 0&&(d=M),l===void 0&&(l=C),h===void 0&&!NL(l)&&(h=N),!Di($)&&w===void 0&&(w=L));let[nt,Y]=Ut(u);return T!==null&&(t.fill=te($,"currentColor"),t.fillOpacity=nh(F,1)),A!==null&&(t.stroke=te(V,"none"),t.strokeWidth=nh(Y,1),t.strokeOpacity=nh(et,1),t.strokeLinejoin=te(l,"miter"),t.strokeLinecap=te(d,"butt"),t.strokeMiterlimit=nh(h,4),t.strokeDasharray=te(m,"none"),t.strokeDashoffset=te(g,"0")),t.target=we(s),t.ariaLabel=we(E),t.ariaDescription=we(o),t.ariaHidden=we(i),t.opacity=nh(j,1),t.mixBlendMode=te(y,"normal"),t.imageFilter=te(b,"none"),t.paintOrder=te(w,"normal"),t.pointerEvents=te(_,"auto"),t.shapeRendering=te(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:K,scale:"auto",optional:!0},strokeWidth:{value:nt,optional:!0},opacity:{value:rt,scale:"auto",optional:!0}}}function qG(t,e){e&&t.filter(n=>Bd(e[n])).append("title").call(zG,e)}function BG(t,e){e&&t.filter(([n])=>Bd(e[n])).append("title").call(YG,e)}function zG(t,e){e&&t.text(n=>zo(e[n]))}function YG(t,e){e&&t.text(([n])=>zo(e[n]))}function Et(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){r&&at(t,"aria-label",l=>r[l]),i&&at(t,"fill",l=>i[l]),s&&at(t,"fill-opacity",l=>s[l]),a&&at(t,"stroke",l=>a[l]),c&&at(t,"stroke-opacity",l=>c[l]),f&&at(t,"stroke-width",l=>f[l]),u&&at(t,"opacity",l=>u[l]),p&&rO(t,l=>p[l],e),n||qG(t,o)}function uc(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){r&&at(t,"aria-label",([l])=>r[l]),i&&at(t,"fill",([l])=>i[l]),s&&at(t,"fill-opacity",([l])=>s[l]),a&&at(t,"stroke",([l])=>a[l]),c&&at(t,"stroke-opacity",([l])=>c[l]),f&&at(t,"stroke-width",([l])=>f[l]),u&&at(t,"opacity",([l])=>u[l]),p&&rO(t,([l])=>p[l],e),n||BG(t,o)}function UG({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(u=>u!==void 0)}function rh(t,e,n){let r=sn(t,o=>e[o]);return n===void 0&&r.size>1+t.length>>1&&_n("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*rb(t,e,n,r){let{z:o}=n,{z:i}=r,s=UG(r,n),a=[...e,...s];for(let c of i?rh(t,i,o):[t]){let f,u;t:for(let p of c){for(let l of a)if(!oe(l[p])){u&&u.push(-1);continue t}if(f===void 0){u&&(yield u),f=s.map(l=>Or(l[p])),u=[p];continue}u.push(p);for(let l=0;l<s.length;++l)if(Or(s[l][p])!==f[l]){yield u,f=s.map(h=>Or(h[p])),u=[p];continue t}}u&&(yield u)}}function jG(t,e,n,r){let o,{clip:i=r.clip}=e;switch(i){case"frame":{t=ot("svg:g",r).each(function(){this.appendChild(t.node()),t.node=()=>this}),o=XG(r,n);break}case"sphere":{o=WG(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 nO(t){let e=new WeakMap;return(n,r)=>{let o=e.get(n);if(!o){let i=u4();Nt(n.ownerSVGElement).append("clipPath").attr("id",i).call(t,n,r),e.set(n,o=`url(#${i})`)}return o}}var XG=nO((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)}),WG=nO((t,e)=>{let{projection:n}=e;if(!n)throw new Error('the "sphere" clip option requires a projection');t.append("path").attr("d",Xe(n)({type:"Sphere"}))});function wt(t,e,n,r){jG(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 ht(t,e){VG(t,"mix-blend-mode",e.mixBlendMode),at(t,"opacity",e.opacity)}function rO(t,e,n){t.each(function(r){let o=e(r);if(o!=null){let i=this.ownerDocument.createElementNS(Nn.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(Nn.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 VG(t,e,n){n!=null&&t.style(e,n)}function gt(t,e,{x:n,y:r},o=le,i=le){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 te(t,e){if((t=we(t))!==e)return t}function nh(t,e){if((t=Dt(t))!==e)return t}var GG=/^-?([_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}`,!GG.test(t))throw new Error(`invalid class name: ${t}`);return t}function yu(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 Je({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 lt=class{constructor(e,n={},r={},o){let{facet:i="auto",facetAnchor:s,fx:a,fy:c,sort:f,dx:u=0,dy:p=0,margin:l=0,marginTop:d=l,marginRight:h=l,marginBottom:m=l,marginLeft:g=l,className:x,clip:y=o?.clip,channels:b,tip:w,render:_}=r;if(this.data=e,this.sort=Oo(f)?f:null,this.initializer=Kt(r).initializer,this.transform=this.initializer?r.transform:Ne(r).transform,i===null||i===!1?this.facet=null:(this.facet=$e(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=e===Es&&typeof a=="string"?[a]:a,this.fy=e===Es&&typeof c=="string"?[c]:c),this.facetAnchor=WR(s),n=Vd(n),b!==void 0&&(n={...HG(b),...n}),o!==void 0&&(n={...nb(this,r,o),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,S])=>{if(fr(S.value)){let{value:E,label:T=S.label,scale:I=S.scale}=S.value;S={...S,label:T,scale:I,value:E}}if(e===Es&&typeof S.value=="string"){let{value:E}=S;S={...S,value:[E]}}return[v,S]}).filter(([v,{value:S,optional:E}])=>{if(S!=null)return!0;if(E)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+p,this.marginTop=+d,this.marginRight=+h,this.marginBottom=+m,this.marginLeft=+g,this.clip=$1(y),this.tip=QG(w),this.className=x?Fs(x):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:S}=n[v];if(!(S!=="x"&&S!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=zi(_,this.render))}initialize(e,n,r){let o=Li(this.data);e===void 0&&o!=null&&(e=[qn(o)]);let i=e;this.transform!=null&&({facets:e,data:o}=this.transform(o,e,r),o=Li(o)),e!==void 0&&(e.original=i);let s=U1(this.channels,o);return this.sort!=null&&QL(o,e,s,n,this.sort),{data:o,facets:e,channels:s}}filter(e,n,r){for(let o in n){let{filter:i=oe}=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"&&a4(o,i,n,r.projection)}}scale(e,n,r){let o=pu(e,n);return r.projection&&this.project(e,o,r),o}};function ke(...t){return t.plot=lt.prototype.plot,t}function zi(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,u,p,l)=>e.call(this,c,f,u,p,l,a))}}function HG(t){return Object.fromEntries(Object.entries(Vd(t)).map(([e,n])=>(n=typeof n=="string"?{value:n,label:e}:$r(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[e,n])))}function QG(t){return t===!0?"xy":t===!1||t==null?null:typeof t=="string"?$e(t,"tip",["x","y","xy"]):t}function Jr(t,e){return t?.tip===!0?{...t,tip:e}:He(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:e}}:t}function iO(t,e,n={}){let r=.5-le,o=.5+le,i=.5+le,s=.5-le;for(let{marginTop:m,marginRight:g,marginBottom:x,marginLeft:y}of e)m>r&&(r=m),g>o&&(o=g),x>i&&(i=x),y>s&&(s=y);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:f=a!==void 0?a:o,marginBottom:u=a!==void 0?a:i,marginLeft:p=a!==void 0?a:s}=n;c=+c,f=+f,u=+u,p=+p;let{width:l=640,height:d=ZG(t,n,{width:l,marginTopDefault:r,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:s})+Math.max(0,c-r+u-i)}=n;l=+l,d=+d;let h={width:l,height:d,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p};if(t.fx||t.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:x=m!==void 0?m:f,marginBottom:y=m!==void 0?m:u,marginLeft:b=m!==void 0?m:p}=n.facet??{};g=+g,x=+x,y=+y,b=+b,h.facet={marginTop:g,marginRight:x,marginBottom:y,marginLeft:b}}return h}function ZG({x:t,y:e,fy:n,fx:r},{projection:o,aspectRatio:i},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:f,marginLeftDefault:u}){let p=n&&n.scale.domain().length||1,l=ZR(o);if(l){let h=r?r.scale.domain().length:1,m=(1.1*p-.1)/(1.1*h-.1)*l,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+f)}let d=e?qo(e)?e.scale.domain().length||1:Math.max(7,17/p):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=oO("y",e)/(oO("x",t)*i),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,x=m*(s-u-c)-t.insetLeft-t.insetRight;return(h*x+e.insetTop+e.insetBottom)/g+a+f}return!!(e||n)*Math.max(1,Math.min(60,d*p))*20+!!r*30+60}function oO(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]=Ft(r);return Math.abs(o(s)-o(i))}var sO=new WeakMap;function l4(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:zi(function(u,p,l,d,h,m){h={...h,pointerSticky:!1};let g=h.ownerSVGElement,{data:x}=h.getMarkState(this),y=sO.get(g);y||sO.set(g,y={sticky:!1,roots:[],renders:[]});let b=y.renders.push(V)-1,{x:w,y:_,fx:v,fy:S}=p,E=v?v(u.fx)-d.marginLeft:0,T=S?S(u.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),_?.bandwidth&&(T+=_.bandwidth()/2);let I=u.fi!=null,A;if(I){let j=y.facetStates;j||(y.facetStates=j=new Map),A=j.get(this),A||j.set(this,A=new Map)}let[k,O]=Je(this,d),{px:M,py:C}=l,N=M?j=>M[j]:p4(l,k),L=C?j=>C[j]:d4(l,O),D,$,P,F;function q(j,nt){if(I)if(F&&(F=cancelAnimationFrame(F)),j==null)A.delete(u.fi);else{A.set(u.fi,nt),F=requestAnimationFrame(()=>{F=null;for(let[Y,G]of A)if(G<nt||G===nt&&Y<u.fi){j=null;break}V(j)});return}V(j)}function V(j){if(D===j&&P===y.sticky)return;D=j,P=h.pointerSticky=y.sticky;let nt=D==null?[]:[D];I&&(nt.fx=u.fx,nt.fy=u.fy,nt.fi=u.fi);let Y=m(nt,p,l,d,h);if($){if(I){let G=$.parentNode,tt=$.getAttribute("transform"),B=Y.getAttribute("transform");tt?Y.setAttribute("transform",tt):Y.removeAttribute("transform"),B?G.setAttribute("transform",B):G.removeAttribute("transform"),Y.removeAttribute("aria-label"),Y.removeAttribute("aria-description"),Y.removeAttribute("aria-hidden")}$.replaceWith(Y)}if(y.roots[b]=$=Y,!(D==null&&A?.size>1)){let G=D==null?null:Hn(x)?x[D]:x.get(D);h.dispatchValue(G)}return Y}function K(j){if(y.sticky||j.pointerType==="mouse"&&j.buttons===1)return;let[nt,Y]=hn(j);nt-=E,Y-=T;let G=nt<d.marginLeft||nt>d.width-d.marginRight?1:t,tt=Y<d.marginTop||Y>d.height-d.marginBottom?1:e,B=null,_t=s*s;for(let ct of u){let kt=G*(N(ct)-nt),Lt=tt*(L(ct)-Y),Z=kt*kt+Lt*Lt;Z<=_t&&(B=ct,_t=Z)}if(B!=null&&(t!==1||e!==1)){let ct=N(B)-nt,kt=L(B)-Y;_t=ct*ct+kt*kt}q(B,_t)}function et(j){j.pointerType==="mouse"&&D!=null&&(y.sticky&&y.roots.some(nt=>nt?.contains(j.target))||(y.sticky?(y.sticky=!1,y.renders.forEach(nt=>nt(null))):(y.sticky=!0,V(D)),j.stopImmediatePropagation()))}function rt(j){j.pointerType==="mouse"&&(y.sticky||q(null))}return g.addEventListener("pointerenter",K),g.addEventListener("pointermove",K),g.addEventListener("pointerdown",et),g.addEventListener("pointerleave",rt),V(null)},c)}}function qs(t){return l4(1,1,t)}function Bs(t){return l4(1,.01,t)}function Yi(t){return l4(.01,1,t)}function p4({x1:t,x2:e,x:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function d4({y1:t,y2:e,y:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function ob(t){return qo(t)&&t.interval===void 0?void 0:"tabular-nums"}function aO(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:u,ticks:p=(o-f-a)/64,tickFormat:l,fontVariant:d=ob(t),round:h=!0,opacity:m,className:g}=e,x=Ds(e);g=Fs(g),m=Ut(m)[1],l===null&&(l=()=>null);let y=ot("svg",x).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) {
8
8
  display: block;
9
9
  height: auto;
10
10
  height: intrinsic;
11
11
  max-width: 100%;
12
12
  overflow: visible;
13
13
  }
14
- :where(.${x}-ramp text) {
14
+ :where(.${g}-ramp text) {
15
15
  white-space: pre;
16
- }`)).call(xu,u),b=k=>k.selectAll(".tick line").attr("y1",s+c-i),w,_=h?(k,O)=>k.rangeRound(O):(k,O)=>k.range(O),{type:v,domain:A,range:T,interpolate:E,scale:N,pivot:M}=t;if(E){let k=T===void 0?E:go(E.length===1?Kd(E):E,T);w=_(N.copy(),mn(ee(f,o-a),Math.min(A.length+(M!==void 0),T===void 0?1/0:T.length)));let O=256,S=g.document.createElement("canvas");S.width=O,S.height=1;let I=S.getContext("2d");for(let C=0,L=O-1;C<O;++C)I.fillStyle=k(C/L),I.fillRect(C,0,1,1);y.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,O=l===void 0?S=>S:typeof l=="string"?Ir(l):l;w=_(_i().domain([-1,T.length-1]),[f,o-a]),y.append("g").attr("fill-opacity",m).selectAll().data(T).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),p=Et(k,(S,I)=>I),l=S=>O(k[S],S)}else w=_(ws().domain(A),[f,o-a]),y.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",N),b=()=>{};return y.append("g").attr("transform",`translate(0,${i-c})`).call(x_(w).ticks(Array.isArray(p)?null:p,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(r).tickValues(Array.isArray(p)?p:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",te(d,"normal")).call(b).call(k=>k.select(".domain").remove()),n!==void 0&&y.append("text").attr("x",f).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),y.node()}var gu=Math.PI/180;function Kr(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=p4(n),t.markerMid=p4(r),t.markerEnd=p4(o)}function p4(t){if(t==null||t===!1)return null;if(t===!0)return aO;if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return sO("auto");case"arrow-reverse":return sO("auto-start-reverse");case"dot":return ZG;case"circle":case"circle-fill":return aO;case"circle-stroke":return JG;case"tick":return d4("auto");case"tick-x":return d4(90);case"tick-y":return d4(0)}throw new Error(`invalid marker: ${t}`)}function sO(t){return(e,n)=>ot("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 ZG(t,e){return ot("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 aO(t,e){return ot("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 JG(t,e){return ot("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 d4(t){return(e,n)=>ot("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 KG=0;function ji(t,e,{stroke:n},r){return uO(t,e,n&&(o=>n[o]),null,r)}function cO(t,e,{stroke:n,z:r},o){return uO(t,e,n&&(([i])=>n[i]),r,o)}var h4=1,fO=2;function tH(t,e){let n=new Uint8Array(e.length),r=t.data().filter(i=>i.length>1),o=r.length;for(let i=0,s=tb;i<o;++i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=Or(e[c]))&&(n[c]|=h4)}}for(let i=o-1,s=tb;i>=0;--i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=Or(e[c]))&&(n[c]|=fO)}}return([i])=>n[i]}function uO(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=()=>o,s,a){if(!e&&!n&&!r)return;let c=new Map,f=s&&tH(t,s);function u(p,l,d){return function(h){if(d&&!d(h))return;let m=i(h),x=c.get(l);x||c.set(l,x=new Map);let g=x.get(m);if(!g){let y=this.parentNode.insertBefore(l(m,a),this),b=`plot-marker-${++KG}`;y.setAttribute("id",b),x.set(m,g=`url(#${b})`)}this.setAttribute(p,g)}}e&&t.each(u("marker-start",e,f&&(p=>f(p)&h4))),n&&f&&t.each(u("marker-start",n,p=>!(f(p)&h4))),n&&t.each(u("marker-mid",n)),r&&t.each(u("marker-end",r,f&&(p=>f(p)&fO)))}function lc({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=lO(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function pc({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=lO(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function lO(t,e,n){return t===void 0&&e===void 0&&n===void 0?le?[1,0]:[.5,.5]:[e,n]}function pO(t,{interval:e}){return t={...$r(t)},t.interval=iu(t.interval===void 0?e:t.interval),t}function ob(t,e,n,r){let{[t]:o,[`${t}1`]:i,[`${t}2`]:s}=n,{value:a,interval:c}=pO(o,n);if(a==null||c==null&&!r)return n;let f=un(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 u,p;function l(d){return p!==void 0&&d===u?p:p=Et(ut(u=d,a),h=>c.floor(h))}return e({...n,[t]:void 0,[`${t}1`]:i===void 0?{transform:l,label:f}:i,[`${t}2`]:s===void 0?{transform:d=>l(d).map(h=>c.offset(h)),label:f}:s})}function dO(t,e,n){let{[t]:r}=n,{value:o,interval:i}=pO(r,n);return o==null||i==null?n:e({...n,[t]:{label:un(r),transform:s=>{let a=Et(ut(s,o),f=>i.floor(f)),c=a.map(f=>i.offset(f));return a.map(fe(a)?(f,u)=>f==null||isNaN(f=+f)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((f+u)/2):(f,u)=>f==null||(u=c[u],u==null)?NaN:(+f+ +u)/2)}}})}function m4(t={}){return ob("x",lc,t,!0)}function x4(t={}){return ob("y",pc,t,!0)}function yu(t={}){return ob("x",lc,t)}function bu(t={}){return ob("y",pc,t)}function ib(t={}){return dO("x",lc,t)}function sb(t={}){return dO("y",pc,t)}var hO={ariaLabel:"rule",fill:null,stroke:"currentColor"},rh=class extends lt{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}},Jr(n,"x"),hO),this.insetTop=Dt(a),this.insetBottom=Dt(c),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y1:f,y2:u}=r,{width:p,height:l,marginTop:d,marginRight:h,marginLeft:m,marginBottom:x}=o,{insetTop:g,insetBottom:y}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s},le,0).call(b=>b.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",c?w=>c[w]:(m+p-h)/2).attr("x2",c?w=>c[w]:(m+p-h)/2).attr("y1",f&&!lr(a)?w=>f[w]+g:d+g).attr("y2",u&&!lr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-y:w=>u[w]-y:l-x-y).call(Tt,this,r).call(ji,this,r,i)).node()}},oh=class extends lt{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}},Jr(n,"y"),hO),this.insetRight=Dt(a),this.insetLeft=Dt(c),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{y:c,x1:f,x2:u}=r,{width:p,height:l,marginTop:d,marginRight:h,marginLeft:m,marginBottom:x}=o,{insetLeft:g,insetRight:y}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{y:c&&a},0,le).call(b=>b.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",f&&!lr(s)?w=>f[w]+g:m+g).attr("x2",u&&!lr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-y:w=>u[w]-y:p-h-y).attr("y1",c?w=>c[w]:(d+l-x)/2).attr("y2",c?w=>c[w]:(d+l-x)/2).call(Tt,this,r).call(ji,this,r,i)).node()}};function pr(t,e){let{x:n=W,y:r,y1:o,y2:i,...s}=bu(e);return[o,i]=mO(r,o,i),new rh(t,{...s,x:n,y1:o,y2:i})}function dr(t,e){let{y:n=W,x:r,x1:o,x2:i,...s}=yu(e);return[o,i]=mO(r,o,i),new oh(t,{...s,y:n,x1:o,x2:i})}function mO(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 to(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 eH={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},wO="\xAD",hc=class extends lt{constructor(e,n={}){let{x:r,y:o,text:i=qn(e)&&k1(e)?W:Zt,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:u=1/0,textOverflow:p,monospace:l,fontFamily:d=l?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:m,fontVariant:x,fontWeight:g,rotate:y}=n,[b,w]=Ut(y,0),[_,v]=iH(h);if(super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:SL(b),optional:!0},text:{value:i,filter:qd,optional:!0}},n,eH),this.rotate=w,this.textAnchor=te(a,"middle"),this.lineAnchor=Oe(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+f,this.lineWidth=+u,this.textOverflow=y4(p),this.monospace=!!l,this.fontFamily=be(d),this.fontSize=v,this.fontStyle=be(m),this.fontVariant=be(x),this.fontWeight=be(g),this.frameAnchor=Do(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=w4(this),this.clipLine=v4(this)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,rotate:u,text:p,title:l,fontSize:d}=r,{rotate:h}=this,[m,x]=Qe(this,o);return ot("svg:g",i).call(wt,this,o,i).call(b4,this,p,o).call(xt,this,{x:c&&s,y:f&&a}).call(g=>g.selectAll().data(e).enter().append("text").call(ht,this).call(nH,this,p,l).attr("transform",to`translate(${c?y=>c[y]:m},${f?y=>f[y]:x})${u?y=>` rotate(${u[y]})`:h?` rotate(${h})`:""}`).call(at,"font-size",d&&(y=>d[y])).call(Tt,this,r)).node()}};function y4(t){return t==null?null:Oe(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function nH(t,e,n,r){if(!n)return;let{lineAnchor:o,lineHeight:i,textOverflow:s,splitLines:a,clipLine:c}=e;t.each(function(f){let u=a(zo(n[f])??"").map(c),p=u.length,l=o==="top"?.71:o==="bottom"?1-p:(164-p*100)/200;if(p>1){let d=0;for(let h=0;h<p;++h){if(++d,!u[h])continue;let m=this.ownerDocument.createElementNS(Nn.svg,"tspan");m.setAttribute("x",0),h===d-1?m.setAttribute("y",`${(l+h)*i}em`):m.setAttribute("dy",`${d*i}em`),m.textContent=u[h],this.appendChild(m),d=0}}else l&&this.setAttribute("y",`${l*i}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[f]){let d=this.ownerDocument.createElementNS(Nn.svg,"title");d.textContent=n[f],this.appendChild(d)}})}function Yo(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new hc(t,{...r,x:e,y:n})}function ab(t,{x:e=W,...n}={}){return new hc(t,sb({...n,x:e}))}function cb(t,{y:e=W,...n}={}){return new hc(t,ib({...n,y:e}))}function b4(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?rH(n):e.fontVariant),at(t,"font-weight",e.fontWeight)}function rH(t){return t&&(Di(t)||fe(t))?"tabular-nums":void 0}var oH=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function iH(t){return t==null||typeof t=="number"?[void 0,t]:typeof t!="string"?[t,void 0]:(t=t.trim().toLowerCase(),oH.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}function sH(t,e,n){let r=[],o,i=0;for(let[s,a,c]of aH(t)){if(o===void 0&&(o=s),i>o&&n(t,o,a)>e&&(r.push(t.slice(o,i)+(t[i-1]===wO?"-":"")),o=s),c){r.push(t.slice(o,a)),o=void 0;continue}i=a}return r}function*aH(t){let e=0,n=0,r=t.length;for(;n<r;){let o=1;switch(t[n]){case wO: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]===`
16
+ }`)).call(yu,u),b=k=>k.selectAll(".tick line").attr("y1",s+c-i),w,_=h?(k,O)=>k.rangeRound(O):(k,O)=>k.range(O),{type:v,domain:S,range:E,interpolate:T,scale:I,pivot:A}=t;if(T){let k=E===void 0?T:xo(T.length===1?th(T):T,E);w=_(I.copy(),mn(ee(f,o-a),Math.min(S.length+(A!==void 0),E===void 0?1/0:E.length)));let O=256,M=x.document.createElement("canvas");M.width=O,M.height=1;let C=M.getContext("2d");for(let N=0,L=O-1;N<O;++N)C.fillStyle=k(N/L),C.fillRect(N,0,1,1);y.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",M.toDataURL())}else if(v==="threshold"){let k=S,O=l===void 0?M=>M:typeof l=="string"?Ir(l):l;w=_(vi().domain([-1,E.length-1]),[f,o-a]),y.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(M,C)=>w(C-1)).attr("y",s).attr("width",(M,C)=>w(C)-w(C-1)).attr("height",i-s-c).attr("fill",M=>M),p=It(k,(M,C)=>C),l=M=>O(k[M],M)}else w=_(bs().domain(S),[f,o-a]),y.append("g").attr("fill-opacity",m).selectAll().data(S).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",i-s-c).attr("fill",I),b=()=>{};return y.append("g").attr("transform",`translate(0,${i-c})`).call(y_(w).ticks(Array.isArray(p)?null:p,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(r).tickValues(Array.isArray(p)?p:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",te(d,"normal")).call(b).call(k=>k.select(".domain").remove()),n!==void 0&&y.append("text").attr("x",f).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),y.node()}var bu=Math.PI/180;function Kr(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=h4(n),t.markerMid=h4(r),t.markerEnd=h4(o)}function h4(t){if(t==null||t===!1)return null;if(t===!0)return fO;if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return cO("auto");case"arrow-reverse":return cO("auto-start-reverse");case"dot":return JG;case"circle":case"circle-fill":return fO;case"circle-stroke":return KG;case"tick":return m4("auto");case"tick-x":return m4(90);case"tick-y":return m4(0)}throw new Error(`invalid marker: ${t}`)}function cO(t){return(e,n)=>ot("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 JG(t,e){return ot("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 fO(t,e){return ot("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 KG(t,e){return ot("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 m4(t){return(e,n)=>ot("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 tH=0;function Ui(t,e,{stroke:n},r){return pO(t,e,n&&(o=>n[o]),null,r)}function uO(t,e,{stroke:n,z:r},o){return pO(t,e,n&&(([i])=>n[i]),r,o)}var g4=1,lO=2;function eH(t,e){let n=new Uint8Array(e.length),r=t.data().filter(i=>i.length>1),o=r.length;for(let i=0,s=eb;i<o;++i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=Or(e[c]))&&(n[c]|=g4)}}for(let i=o-1,s=eb;i>=0;--i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=Or(e[c]))&&(n[c]|=lO)}}return([i])=>n[i]}function pO(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=()=>o,s,a){if(!e&&!n&&!r)return;let c=new Map,f=s&&eH(t,s);function u(p,l,d){return function(h){if(d&&!d(h))return;let m=i(h),g=c.get(l);g||c.set(l,g=new Map);let x=g.get(m);if(!x){let y=this.parentNode.insertBefore(l(m,a),this),b=`plot-marker-${++tH}`;y.setAttribute("id",b),g.set(m,x=`url(#${b})`)}this.setAttribute(p,x)}}e&&t.each(u("marker-start",e,f&&(p=>f(p)&g4))),n&&f&&t.each(u("marker-start",n,p=>!(f(p)&g4))),n&&t.each(u("marker-mid",n)),r&&t.each(u("marker-end",r,f&&(p=>f(p)&lO)))}function lc({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=dO(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function pc({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=dO(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function dO(t,e,n){return t===void 0&&e===void 0&&n===void 0?le?[1,0]:[.5,.5]:[e,n]}function hO(t,{interval:e}){return t={...$r(t)},t.interval=au(t.interval===void 0?e:t.interval),t}function ib(t,e,n,r){let{[t]:o,[`${t}1`]:i,[`${t}2`]:s}=n,{value:a,interval:c}=hO(o,n);if(a==null||c==null&&!r)return n;let f=ln(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 u,p;function l(d){return p!==void 0&&d===u?p:p=It(ut(u=d,a),h=>c.floor(h))}return e({...n,[t]:void 0,[`${t}1`]:i===void 0?{transform:l,label:f}:i,[`${t}2`]:s===void 0?{transform:d=>l(d).map(h=>c.offset(h)),label:f}:s})}function mO(t,e,n){let{[t]:r}=n,{value:o,interval:i}=hO(r,n);return o==null||i==null?n:e({...n,[t]:{label:ln(r),transform:s=>{let a=It(ut(s,o),f=>i.floor(f)),c=a.map(f=>i.offset(f));return a.map(fe(a)?(f,u)=>f==null||isNaN(f=+f)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((f+u)/2):(f,u)=>f==null||(u=c[u],u==null)?NaN:(+f+ +u)/2)}}})}function x4(t={}){return ib("x",lc,t,!0)}function y4(t={}){return ib("y",pc,t,!0)}function wu(t={}){return ib("x",lc,t)}function vu(t={}){return ib("y",pc,t)}function sb(t={}){return mO("x",lc,t)}function ab(t={}){return mO("y",pc,t)}var gO={ariaLabel:"rule",fill:null,stroke:"currentColor"},oh=class extends lt{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}},Jr(n,"x"),gO),this.insetTop=Dt(a),this.insetBottom=Dt(c),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y1:f,y2:u}=r,{width:p,height:l,marginTop:d,marginRight:h,marginLeft:m,marginBottom:g}=o,{insetTop:x,insetBottom:y}=this;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s},le,0).call(b=>b.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",c?w=>c[w]:(m+p-h)/2).attr("x2",c?w=>c[w]:(m+p-h)/2).attr("y1",f&&!lr(a)?w=>f[w]+x:d+x).attr("y2",u&&!lr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-y:w=>u[w]-y:l-g-y).call(Et,this,r).call(Ui,this,r,i)).node()}},ih=class extends lt{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}},Jr(n,"y"),gO),this.insetRight=Dt(a),this.insetLeft=Dt(c),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{y:c,x1:f,x2:u}=r,{width:p,height:l,marginTop:d,marginRight:h,marginLeft:m,marginBottom:g}=o,{insetLeft:x,insetRight:y}=this;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{y:c&&a},0,le).call(b=>b.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",f&&!lr(s)?w=>f[w]+x:m+x).attr("x2",u&&!lr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-y:w=>u[w]-y:p-h-y).attr("y1",c?w=>c[w]:(d+l-g)/2).attr("y2",c?w=>c[w]:(d+l-g)/2).call(Et,this,r).call(Ui,this,r,i)).node()}};function pr(t,e){let{x:n=W,y:r,y1:o,y2:i,...s}=vu(e);return[o,i]=xO(r,o,i),new oh(t,{...s,x:n,y1:o,y2:i})}function dr(t,e){let{y:n=W,x:r,x1:o,x2:i,...s}=wu(e);return[o,i]=xO(r,o,i),new ih(t,{...s,y:n,x1:o,x2:i})}function xO(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 to(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 nH={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},_O="\xAD",hc=class extends lt{constructor(e,n={}){let{x:r,y:o,text:i=Bn(e)&&L1(e)?W:Zt,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:u=1/0,textOverflow:p,monospace:l,fontFamily:d=l?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:m,fontVariant:g,fontWeight:x,rotate:y}=n,[b,w]=Ut(y,0),[_,v]=sH(h);if(super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:AL(b),optional:!0},text:{value:i,filter:Bd,optional:!0}},n,nH),this.rotate=w,this.textAnchor=te(a,"middle"),this.lineAnchor=$e(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+f,this.lineWidth=+u,this.textOverflow=w4(p),this.monospace=!!l,this.fontFamily=we(d),this.fontSize=v,this.fontStyle=we(m),this.fontVariant=we(g),this.fontWeight=we(x),this.frameAnchor=Do(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=_4(this),this.clipLine=S4(this)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,rotate:u,text:p,title:l,fontSize:d}=r,{rotate:h}=this,[m,g]=Je(this,o);return ot("svg:g",i).call(wt,this,o,i).call(v4,this,p,o).call(gt,this,{x:c&&s,y:f&&a}).call(x=>x.selectAll().data(e).enter().append("text").call(ht,this).call(rH,this,p,l).attr("transform",to`translate(${c?y=>c[y]:m},${f?y=>f[y]:g})${u?y=>` rotate(${u[y]})`:h?` rotate(${h})`:""}`).call(at,"font-size",d&&(y=>d[y])).call(Et,this,r)).node()}};function w4(t){return t==null?null:$e(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function rH(t,e,n,r){if(!n)return;let{lineAnchor:o,lineHeight:i,textOverflow:s,splitLines:a,clipLine:c}=e;t.each(function(f){let u=a(zo(n[f])??"").map(c),p=u.length,l=o==="top"?.71:o==="bottom"?1-p:(164-p*100)/200;if(p>1){let d=0;for(let h=0;h<p;++h){if(++d,!u[h])continue;let m=this.ownerDocument.createElementNS(Nn.svg,"tspan");m.setAttribute("x",0),h===d-1?m.setAttribute("y",`${(l+h)*i}em`):m.setAttribute("dy",`${d*i}em`),m.textContent=u[h],this.appendChild(m),d=0}}else l&&this.setAttribute("y",`${l*i}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[f]){let d=this.ownerDocument.createElementNS(Nn.svg,"title");d.textContent=n[f],this.appendChild(d)}})}function Yo(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ge(e,n)),new hc(t,{...r,x:e,y:n})}function cb(t,{x:e=W,...n}={}){return new hc(t,ab({...n,x:e}))}function fb(t,{y:e=W,...n}={}){return new hc(t,sb({...n,y:e}))}function v4(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?oH(n):e.fontVariant),at(t,"font-weight",e.fontWeight)}function oH(t){return t&&($i(t)||fe(t))?"tabular-nums":void 0}var iH=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function sH(t){return t==null||typeof t=="number"?[void 0,t]:typeof t!="string"?[t,void 0]:(t=t.trim().toLowerCase(),iH.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}function aH(t,e,n){let r=[],o,i=0;for(let[s,a,c]of cH(t)){if(o===void 0&&(o=s),i>o&&n(t,o,a)>e&&(r.push(t.slice(o,i)+(t[i-1]===_O?"-":"")),o=s),c){r.push(t.slice(o,a)),o=void 0;continue}i=a}return r}function*cH(t){let e=0,n=0,r=t.length;for(;n<r;){let o=1;switch(t[n]){case _O: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
17
  `&&++o;case`
18
- `:yield[e,n,!0],n+=o,e=n;break;default:++n;break}}yield[e,n,!0]}var xO={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 fb(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=wu(t,o))r+=xO[t[o]]??(_O(t,o)?120:xO.e);return r}function ub(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=wu(t,o))r+=_O(t,o)?126:63;return r}function w4({monospace:t,lineWidth:e,textOverflow:n}){if(n!=null||e==1/0)return i=>i.split(/\r\n?|\n/g);let r=t?ub:fb,o=e*100;return i=>sH(i,o,r)}function v4({monospace:t,lineWidth:e,textOverflow:n}){if(n==null||e==1/0)return i=>i;let r=t?ub:fb,o=e*100;switch(n){case"clip-start":return i=>yO(i,o,r,"");case"clip-end":return i=>gO(i,o,r,"");case"ellipsis-start":return i=>yO(i,o,r,dc);case"ellipsis-middle":return i=>cH(i,o,r,dc);case"ellipsis-end":return i=>gO(i,o,r,dc)}}var dc="\u2026";function mc(t,e,n,r){let o=[],i=0;for(let s=0,a=0,c=t.length;s<c;s=a){a=wu(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 gO(t,e,n,r){t=t.trim();let o=n(r),[i]=mc(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function cH(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r)/2,[s,a]=mc(t,e/2,n,i),[c]=mc(t,o-e/2-a+i,n,-i);return c<0?r:t.slice(0,s).trimEnd()+r+t.slice(wu(t,c)).trimStart()}function yO(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r),[s]=mc(t,o-e+i,n,-i);return s<0?r:r+t.slice(wu(t,s)).trimStart()}var g4=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,bO=/\p{Extended_Pictographic}/uy;function wu(t,e){return e+=fH(t,e)?2:1,lH(t,e)&&(e=g4.lastIndex),uH(t,e)?wu(t,e+1):e}function vO(t,e){return t.charCodeAt(e)<128}function fH(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 uH(t,e){return t.charCodeAt(e)===8205}function lH(t,e){return vO(t,e)?!1:(g4.lastIndex=e,g4.test(t))}function _O(t,e){return vO(t,e)?!1:(bO.lastIndex=e,bO.test(t))}var SO={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},MO=3.5,pH=MO*5,AO={draw(t,e,n){let r=e*n/pH;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},TO={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},dH=new Map([["arrow",AO],["spike",TO]]);function hH(t){return t&&typeof t.draw=="function"}function mH(t){if(hH(t))return t;let e=dH.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}var xc=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i=MO,length:s,rotate:a,shape:c=AO,anchor:f="middle",frameAnchor:u}=n,[p,l]=Ut(s,12),[d,h]=Ut(a,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:p,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,SO),this.r=+i,this.length=l,this.rotate=h,this.shape=mH(c),this.anchor=Oe(f,"anchor",["start","middle","end"]),this.frameAnchor=Do(u)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,length:u,rotate:p}=r,{length:l,rotate:d,anchor:h,shape:m,r:x}=this,[g,y]=Qe(this,o);return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(b=>b.selectAll().data(e).enter().append("path").call(ht,this).attr("transform",to`translate(${c?w=>c[w]:g},${f?w=>f[w]:y})${p?w=>` rotate(${p[w]})`:d?` rotate(${d})`:""}${h==="start"?"":h==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${l})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${l/2})`}`).attr("d",u?w=>{let _=Ln();return m.draw(_,u[w],x),_}:(()=>{let w=Ln();return m.draw(w,l,x),w})()).call(Tt,this,r)).node()}};function _4(t,e={}){let{x:n,y:r,...o}=e;return e.frameAnchor===void 0&&([n,r]=me(n,r)),new xc(t,{...o,x:n,y:r})}function lb(t,e={}){let{x:n=W,...r}=e;return new xc(t,{...r,x:n})}function pb(t,e={}){let{y:n=W,...r}=e;return new xc(t,{...r,y:n})}function EO(t,e={}){let{shape:n=TO,stroke:r=SO.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:s=.3,anchor:a="start",...c}=e;return _4(t,{...c,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:s,anchor:a})}function Ys(t,e){return arguments.length<2&&!qn(t)&&(e=t,t=null),e===void 0&&(e={}),[t,e]}function db({anchor:t}={},e){return t===void 0?e[0]:Oe(t,"anchor",e)}function IO(t){return db(t,["left","right"])}function NO(t){return db(t,["right","left"])}function CO(t){return db(t,["bottom","top"])}function kO(t){return db(t,["top","bottom"])}function ih(){let[t,e]=Ys(...arguments);return LO("y",IO(e),t,e)}function hb(){let[t,e]=Ys(...arguments);return LO("fy",NO(e),t,e)}function sh(){let[t,e]=Ys(...arguments);return RO("x",CO(e),t,e)}function mb(){let[t,e]=Ys(...arguments);return RO("fx",kO(e),t,e)}function LO(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:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:d,tickSize:h=t==="y"?6:0,tickPadding:m,tickRotate:x,x:g,margin:y,marginTop:b=y===void 0?20:y,marginRight:w=y===void 0?e==="right"?40:0:y,marginBottom:_=y===void 0?20:y,marginLeft:v=y===void 0?e==="left"?40:0:y,label:A,labelAnchor:T,labelArrow:E,labelOffset:N,...M}){return h=Dt(h),m=Dt(m),x=Dt(x),T!==void 0&&(T=Oe(T,"labelAnchor",["center","top","bottom"])),E=zO(E),ke(h&&!zt(i)?xH(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:x,x:g,...M}):null,zt(c)?null:yH(t,e,n,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:d,textAnchor:u,tickSize:h,tickPadding:m,tickRotate:x,x:g,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!zt(c)&&A!==null?Yo([],PO({fill:c,fillOpacity:f,...M},function(k,O,S,I,C){let L=I[t],{marginTop:D,marginRight:$,marginBottom:P,marginLeft:F}=t==="y"&&C.inset||C,q=T??(L.bandwidth?"center":"top"),V=N??(e==="right"?$: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"?V:-V,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[BO(t,L,{anchor:e,label:A,labelAnchor:q,labelArrow:E})]}}}})):null)}function RO(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:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:d,tickSize:h=t==="x"?6:0,tickPadding:m,tickRotate:x,y:g,margin:y,marginTop:b=y===void 0?e==="top"?30:0:y,marginRight:w=y===void 0?20:y,marginBottom:_=y===void 0?e==="bottom"?30:0:y,marginLeft:v=y===void 0?20:y,label:A,labelAnchor:T,labelArrow:E,labelOffset:N,...M}){return h=Dt(h),m=Dt(m),x=Dt(x),T!==void 0&&(T=Oe(T,"labelAnchor",["center","left","right"])),E=zO(E),ke(h&&!zt(i)?gH(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:x,y:g,...M}):null,zt(c)?null:bH(t,e,n,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:d,textAnchor:u,tickSize:h,tickPadding:m,tickRotate:x,y:g,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!zt(c)&&A!==null?Yo([],PO({fill:c,fillOpacity:f,...M},function(k,O,S,I,C){let L=I[t],{marginTop:D,marginRight:$,marginBottom:P,marginLeft:F}=t==="x"&&C.inset||C,q=T??(L.bandwidth?"center":"right"),V=N??(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"?-V:V,this.dx=q==="right"?$-3:q==="left"?3-F:0,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[BO(t,L,{anchor:e,label:A,labelAnchor:q,labelArrow:E})]}}}})):null)}function xH(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:u=f,insetRight:p=f,dx:l=0,y:d=t==="y"?void 0:null,...h}){return vu(pb,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:s,frameAnchor:a,y:d,...h,dx:e==="left"?+l-le+ +u:+l+le-p,anchor:"start",length:c,shape:e==="left"?SH:MH})}function gH(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:u=f,insetBottom:p=f,dy:l=0,x:d=t==="x"?void 0:null,...h}){return vu(lb,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:s,frameAnchor:a,x:d,...h,dy:e==="bottom"?+l-le-p:+l+le+ +u,anchor:"start",length:c,shape:e==="bottom"?vH:_H})}function yH(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*gu):0),text:c,textAnchor:f=Math.abs(s)>60?"middle":e==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:p,inset:l=0,insetLeft:d=l,insetRight:h=l,dx:m=0,y:x=t==="y"?void 0:null,...g}){return vu(cb,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:s,y:x,...g,dx:e==="left"?+m-i-a+ +d:+m+ +i+ +a-h},function(y,b,w,_,v){p===void 0&&(this.fontVariant=qO(y)),c===void 0&&(v.text=FO(y,b,w,_,e))})}function bH(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*gu):0),text:c,textAnchor:f=Math.abs(s)>=10?s<0^e==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":e==="bottom"?"top":"bottom",fontVariant:p,inset:l=0,insetTop:d=l,insetBottom:h=l,dy:m=0,x=t==="x"?void 0:null,...g}){return vu(ab,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c===void 0?null:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:s,x,...g,dy:e==="bottom"?+m+ +i+ +a-h:+m-i-a+ +d},function(y,b,w,_,v){p===void 0&&(this.fontVariant=qO(y)),c===void 0&&(v.text=FO(y,b,w,_,e))})}function xb(){let[t,e]=Ys(...arguments);return OO("y",IO(e),t,e)}function gb(){let[t,e]=Ys(...arguments);return OO("fy",NO(e),t,e)}function yb(){let[t,e]=Ys(...arguments);return $O("x",CO(e),t,e)}function bb(){let[t,e]=Ys(...arguments);return $O("fx",kO(e),t,e)}function OO(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 vu(dr,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{y:r,x1:i,x2:s,...DO(a)})}function $O(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 vu(pr,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{x:r,y1:i,y2:s,...DO(a)})}function DO({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 PO({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:u=!1},p){return[,t]=ce(t),[,e]=Ut(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:u,initializer:p}}function vu(t,e,n,r,o,i){let s;function a(u,p,l,d,h,m){let x=u==null&&(e==="fx"||e==="fy"),{[e]:g}=d;if(!g)throw new Error(`missing scale: ${e}`);let y=g.domain(),{interval:b,ticks:w,tickFormat:_,tickSpacing:v=e==="x"?80:35}=o;if(typeof w=="string"&&YO(g)&&(b=w,w=void 0),w===void 0&&(w=$o(b,g.type)??wH(g,v)),u==null){if(qn(w))u=cr(w);else if(ks(w))u=S4(w,...Ft(y));else if(g.interval){let T=g.interval;if(g.ticks){let[E,N]=Ft(y),M=(N-E)/T[eu];T=lS(T,M/w)??T,u=S4(T,E,N)}else{u=y;let E=u.length;T=lS(T,E/w)??T,T!==g.interval&&(u=S4(T,...Ft(u)))}if(T===g.interval){let E=Math.round(u.length/w);E>1&&(u=u.filter((N,M)=>M%E===0))}}else g.ticks?u=g.ticks(w):u=y;if(!g.ticks&&u.length&&u!==y){let T=new En(y);u=u.filter(E=>T.has(E)),u.length||_n(`Warning: the ${e}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}e==="y"||e==="x"?p=[Fn(u)]:s[e]={scale:e,value:W}}i?.call(this,g,u,w,_,s);let A=Object.fromEntries(Object.entries(s).map(([T,E])=>[T,{...E,value:ut(u,E.value)}]));return x&&(p=m.filterFacets(u,A)),{data:u,facets:p,channels:A}}let c=Kt(o).initializer,f=t(n,Kt({...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 wH(t,e){let[n,r]=Ft(t.range());return(r-n)/e}function FO(t,e,n,r,o){return{value:ah(t,e,n,r,o)}}function ah(t,e,n,r,o){return typeof r=="function"&&!(t.type==="log"&&t.tickFormat)?r:r===void 0&&e&&fe(e)?mL(t.type,e,o)??zo:t.tickFormat?t.tickFormat(typeof n=="number"?n:null,r):r===void 0?zo:typeof r=="string"?(fe(t.domain())?Co:Ir)(r):ue(r)}function S4(t,e,n){return t.range(e,t.offset(t.floor(n)))}var vH={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},_H={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},SH={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},MH={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function qO(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function BO(t,e,{anchor:n,label:r=e.label,labelAnchor:o,labelArrow:i}={}){if(!(r==null||r.inferred&&YO(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=W1(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 zO(t="auto"){return zt(t)?!1:typeof t=="boolean"?t:Oe(t,"labelArrow",["auto","up","right","down","left"])}function YO(t){return fe(t.domain())}function UO(t,e){if(e==null)return e;let n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function jO(t,{opacity:e,...n}={}){if(!qo(t)&&!ZS(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return WO(t,n,(r,o,i,s)=>r.append("svg").attr("width",i).attr("height",s).attr("fill",o.scale).attr("fill-opacity",Ut(e)[1]).append("rect").attr("width","100%").attr("height","100%"))}function XO(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:zt(e)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:s=4.5,...a}={},c){let[f,u]=ce(e),[p,l]=ce(r),d=UO(c,f),h=UO(c,p),m=s*s*Math.PI;return n=Ut(n)[1],o=Ut(o)[1],i=Ut(i)[1],WO(t,a,(x,g,y,b)=>x.append("svg").attr("viewBox","-8 -8 16 16").attr("width",y).attr("height",b).attr("fill",f==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",p==="color"?w=>h.scale(w):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let _=Ln();return t.scale(w).draw(_,m),_}))}function WO(t,e={},n){let{columns:r,tickFormat:o,fontVariant:i=rb(t),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:f=0,className:u,style:p,width:l}=e,d=Ps(e);u=qs(u),o=ah(t.scale,t.domain,void 0,o);let h=ot("div",d).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
18
+ `:yield[e,n,!0],n+=o,e=n;break;default:++n;break}}yield[e,n,!0]}var yO={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 ub(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=_u(t,o))r+=yO[t[o]]??(MO(t,o)?120:yO.e);return r}function lb(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=_u(t,o))r+=MO(t,o)?126:63;return r}function _4({monospace:t,lineWidth:e,textOverflow:n}){if(n!=null||e==1/0)return i=>i.split(/\r\n?|\n/g);let r=t?lb:ub,o=e*100;return i=>aH(i,o,r)}function S4({monospace:t,lineWidth:e,textOverflow:n}){if(n==null||e==1/0)return i=>i;let r=t?lb:ub,o=e*100;switch(n){case"clip-start":return i=>wO(i,o,r,"");case"clip-end":return i=>bO(i,o,r,"");case"ellipsis-start":return i=>wO(i,o,r,dc);case"ellipsis-middle":return i=>fH(i,o,r,dc);case"ellipsis-end":return i=>bO(i,o,r,dc)}}var dc="\u2026";function mc(t,e,n,r){let o=[],i=0;for(let s=0,a=0,c=t.length;s<c;s=a){a=_u(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 bO(t,e,n,r){t=t.trim();let o=n(r),[i]=mc(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function fH(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r)/2,[s,a]=mc(t,e/2,n,i),[c]=mc(t,o-e/2-a+i,n,-i);return c<0?r:t.slice(0,s).trimEnd()+r+t.slice(_u(t,c)).trimStart()}function wO(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r),[s]=mc(t,o-e+i,n,-i);return s<0?r:r+t.slice(_u(t,s)).trimStart()}var b4=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,vO=/\p{Extended_Pictographic}/uy;function _u(t,e){return e+=uH(t,e)?2:1,pH(t,e)&&(e=b4.lastIndex),lH(t,e)?_u(t,e+1):e}function SO(t,e){return t.charCodeAt(e)<128}function uH(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 lH(t,e){return t.charCodeAt(e)===8205}function pH(t,e){return SO(t,e)?!1:(b4.lastIndex=e,b4.test(t))}function MO(t,e){return SO(t,e)?!1:(vO.lastIndex=e,vO.test(t))}var AO={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},EO=3.5,dH=EO*5,TO={draw(t,e,n){let r=e*n/dH;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},IO={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},hH=new Map([["arrow",TO],["spike",IO]]);function mH(t){return t&&typeof t.draw=="function"}function gH(t){if(mH(t))return t;let e=hH.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}var gc=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i=EO,length:s,rotate:a,shape:c=TO,anchor:f="middle",frameAnchor:u}=n,[p,l]=Ut(s,12),[d,h]=Ut(a,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:p,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,AO),this.r=+i,this.length=l,this.rotate=h,this.shape=gH(c),this.anchor=$e(f,"anchor",["start","middle","end"]),this.frameAnchor=Do(u)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,length:u,rotate:p}=r,{length:l,rotate:d,anchor:h,shape:m,r:g}=this,[x,y]=Je(this,o);return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s,y:f&&a}).call(b=>b.selectAll().data(e).enter().append("path").call(ht,this).attr("transform",to`translate(${c?w=>c[w]:x},${f?w=>f[w]:y})${p?w=>` rotate(${p[w]})`:d?` rotate(${d})`:""}${h==="start"?"":h==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${l})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${l/2})`}`).attr("d",u?w=>{let _=Rn();return m.draw(_,u[w],g),_}:(()=>{let w=Rn();return m.draw(w,l,g),w})()).call(Et,this,r)).node()}};function M4(t,e={}){let{x:n,y:r,...o}=e;return e.frameAnchor===void 0&&([n,r]=ge(n,r)),new gc(t,{...o,x:n,y:r})}function pb(t,e={}){let{x:n=W,...r}=e;return new gc(t,{...r,x:n})}function db(t,e={}){let{y:n=W,...r}=e;return new gc(t,{...r,y:n})}function CO(t,e={}){let{shape:n=IO,stroke:r=AO.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:s=.3,anchor:a="start",...c}=e;return M4(t,{...c,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:s,anchor:a})}function zs(t,e){return arguments.length<2&&!Bn(t)&&(e=t,t=null),e===void 0&&(e={}),[t,e]}function hb({anchor:t}={},e){return t===void 0?e[0]:$e(t,"anchor",e)}function NO(t){return hb(t,["left","right"])}function kO(t){return hb(t,["right","left"])}function LO(t){return hb(t,["bottom","top"])}function RO(t){return hb(t,["top","bottom"])}function sh(){let[t,e]=zs(...arguments);return OO("y",NO(e),t,e)}function mb(){let[t,e]=zs(...arguments);return OO("fy",kO(e),t,e)}function ah(){let[t,e]=zs(...arguments);return $O("x",LO(e),t,e)}function gb(){let[t,e]=zs(...arguments);return $O("fx",RO(e),t,e)}function OO(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:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:d,tickSize:h=t==="y"?6:0,tickPadding:m,tickRotate:g,x,margin:y,marginTop:b=y===void 0?20:y,marginRight:w=y===void 0?e==="right"?40:0:y,marginBottom:_=y===void 0?20:y,marginLeft:v=y===void 0?e==="left"?40:0:y,label:S,labelAnchor:E,labelArrow:T,labelOffset:I,...A}){return h=Dt(h),m=Dt(m),g=Dt(g),E!==void 0&&(E=$e(E,"labelAnchor",["center","top","bottom"])),T=UO(T),ke(h&&!zt(i)?xH(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:g,x,...A}):null,zt(c)?null:bH(t,e,n,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:d,textAnchor:u,tickSize:h,tickPadding:m,tickRotate:g,x,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...A}),!zt(c)&&S!==null?Yo([],qO({fill:c,fillOpacity:f,...A},function(k,O,M,C,N){let L=C[t],{marginTop:D,marginRight:$,marginBottom:P,marginLeft:F}=t==="y"&&N.inset||N,q=E??(L.bandwidth?"center":"top"),V=I??(e==="right"?$: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"?V:-V,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[YO(t,L,{anchor:e,label:S,labelAnchor:q,labelArrow:T})]}}}})):null)}function $O(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:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:d,tickSize:h=t==="x"?6:0,tickPadding:m,tickRotate:g,y:x,margin:y,marginTop:b=y===void 0?e==="top"?30:0:y,marginRight:w=y===void 0?20:y,marginBottom:_=y===void 0?e==="bottom"?30:0:y,marginLeft:v=y===void 0?20:y,label:S,labelAnchor:E,labelArrow:T,labelOffset:I,...A}){return h=Dt(h),m=Dt(m),g=Dt(g),E!==void 0&&(E=$e(E,"labelAnchor",["center","left","right"])),T=UO(T),ke(h&&!zt(i)?yH(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:g,y:x,...A}):null,zt(c)?null:wH(t,e,n,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:d,textAnchor:u,tickSize:h,tickPadding:m,tickRotate:g,y:x,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...A}),!zt(c)&&S!==null?Yo([],qO({fill:c,fillOpacity:f,...A},function(k,O,M,C,N){let L=C[t],{marginTop:D,marginRight:$,marginBottom:P,marginLeft:F}=t==="x"&&N.inset||N,q=E??(L.bandwidth?"center":"right"),V=I??(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"?-V:V,this.dx=q==="right"?$-3:q==="left"?3-F:0,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[YO(t,L,{anchor:e,label:S,labelAnchor:q,labelArrow:T})]}}}})):null)}function xH(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:u=f,insetRight:p=f,dx:l=0,y:d=t==="y"?void 0:null,...h}){return Su(db,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:s,frameAnchor:a,y:d,...h,dx:e==="left"?+l-le+ +u:+l+le-p,anchor:"start",length:c,shape:e==="left"?MH:AH})}function yH(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:u=f,insetBottom:p=f,dy:l=0,x:d=t==="x"?void 0:null,...h}){return Su(pb,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:s,frameAnchor:a,x:d,...h,dy:e==="bottom"?+l-le-p:+l+le+ +u,anchor:"start",length:c,shape:e==="bottom"?_H:SH})}function bH(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*bu):0),text:c,textAnchor:f=Math.abs(s)>60?"middle":e==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:p,inset:l=0,insetLeft:d=l,insetRight:h=l,dx:m=0,y:g=t==="y"?void 0:null,...x}){return Su(fb,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:s,y:g,...x,dx:e==="left"?+m-i-a+ +d:+m+ +i+ +a-h},function(y,b,w,_,v){p===void 0&&(this.fontVariant=zO(y)),c===void 0&&(v.text=BO(y,b,w,_,e))})}function wH(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*bu):0),text:c,textAnchor:f=Math.abs(s)>=10?s<0^e==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":e==="bottom"?"top":"bottom",fontVariant:p,inset:l=0,insetTop:d=l,insetBottom:h=l,dy:m=0,x:g=t==="x"?void 0:null,...x}){return Su(cb,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c===void 0?null:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:s,x:g,...x,dy:e==="bottom"?+m+ +i+ +a-h:+m-i-a+ +d},function(y,b,w,_,v){p===void 0&&(this.fontVariant=zO(y)),c===void 0&&(v.text=BO(y,b,w,_,e))})}function xb(){let[t,e]=zs(...arguments);return DO("y",NO(e),t,e)}function yb(){let[t,e]=zs(...arguments);return DO("fy",kO(e),t,e)}function bb(){let[t,e]=zs(...arguments);return PO("x",LO(e),t,e)}function wb(){let[t,e]=zs(...arguments);return PO("fx",RO(e),t,e)}function DO(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 Su(dr,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{y:r,x1:i,x2:s,...FO(a)})}function PO(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 Su(pr,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{x:r,y1:i,y2:s,...FO(a)})}function FO({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 qO({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:u=!1},p){return[,t]=ce(t),[,e]=Ut(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:u,initializer:p}}function Su(t,e,n,r,o,i){let s;function a(u,p,l,d,h,m){let g=u==null&&(e==="fx"||e==="fy"),{[e]:x}=d;if(!x)throw new Error(`missing scale: ${e}`);let y=x.domain(),{interval:b,ticks:w,tickFormat:_,tickSpacing:v=e==="x"?80:35}=o;if(typeof w=="string"&&jO(x)&&(b=w,w=void 0),w===void 0&&(w=$o(b,x.type)??vH(x,v)),u==null){if(Bn(w))u=cr(w);else if(Ns(w))u=A4(w,...Ft(y));else if(x.interval){let E=x.interval;if(x.ticks){let[T,I]=Ft(y),A=(I-T)/E[ru];E=dS(E,A/w)??E,u=A4(E,T,I)}else{u=y;let T=u.length;E=dS(E,T/w)??E,E!==x.interval&&(u=A4(E,...Ft(u)))}if(E===x.interval){let T=Math.round(u.length/w);T>1&&(u=u.filter((I,A)=>A%T===0))}}else x.ticks?u=x.ticks(w):u=y;if(!x.ticks&&u.length&&u!==y){let E=new In(y);u=u.filter(T=>E.has(T)),u.length||_n(`Warning: the ${e}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}e==="y"||e==="x"?p=[qn(u)]:s[e]={scale:e,value:W}}i?.call(this,x,u,w,_,s);let S=Object.fromEntries(Object.entries(s).map(([E,T])=>[E,{...T,value:ut(u,T.value)}]));return g&&(p=m.filterFacets(u,S)),{data:u,facets:p,channels:S}}let c=Kt(o).initializer,f=t(n,Kt({...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 vH(t,e){let[n,r]=Ft(t.range());return(r-n)/e}function BO(t,e,n,r,o){return{value:ch(t,e,n,r,o)}}function ch(t,e,n,r,o){return typeof r=="function"&&!(t.type==="log"&&t.tickFormat)?r:r===void 0&&e&&fe(e)?xL(t.type,e,o)??zo:t.tickFormat?t.tickFormat(typeof n=="number"?n:null,r):r===void 0?zo:typeof r=="string"?(fe(t.domain())?No:Ir)(r):ue(r)}function A4(t,e,n){return t.range(e,t.offset(t.floor(n)))}var _H={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},SH={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},MH={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},AH={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function zO(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function YO(t,e,{anchor:n,label:r=e.label,labelAnchor:o,labelArrow:i}={}){if(!(r==null||r.inferred&&jO(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=V1(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 UO(t="auto"){return zt(t)?!1:typeof t=="boolean"?t:$e(t,"labelArrow",["auto","up","right","down","left"])}function jO(t){return fe(t.domain())}function XO(t,e){if(e==null)return e;let n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function WO(t,{opacity:e,...n}={}){if(!qo(t)&&!KS(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return GO(t,n,(r,o,i,s)=>r.append("svg").attr("width",i).attr("height",s).attr("fill",o.scale).attr("fill-opacity",Ut(e)[1]).append("rect").attr("width","100%").attr("height","100%"))}function VO(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:zt(e)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:s=4.5,...a}={},c){let[f,u]=ce(e),[p,l]=ce(r),d=XO(c,f),h=XO(c,p),m=s*s*Math.PI;return n=Ut(n)[1],o=Ut(o)[1],i=Ut(i)[1],GO(t,a,(g,x,y,b)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",y).attr("height",b).attr("fill",f==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",p==="color"?w=>h.scale(w):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let _=Rn();return t.scale(w).draw(_,m),_}))}function GO(t,e={},n){let{columns:r,tickFormat:o,fontVariant:i=ob(t),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:f=0,className:u,style:p,width:l}=e,d=Ds(e);u=Fs(u),o=ch(t.scale,t.domain,void 0,o);let h=ot("div",d).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
19
19
  display: flex;
20
20
  align-items: center;
21
21
  break-inside: avoid;
@@ -28,7 +28,7 @@ ${n}`}function kV(t){return t==="time"?E1:t==="utc"?zd:NV}function mL(t,e,n){let
28
28
  white-space: nowrap;
29
29
  overflow: hidden;
30
30
  text-overflow: ellipsis;
31
- }`,h.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,t,a,c).call(x=>x.append("div").attr("class",`${u}-swatch-label`).attr("title",o).text(o))):(m=`:where(.${u}-swatches-wrap) {
31
+ }`,h.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,t,a,c).call(g=>g.append("div").attr("class",`${u}-swatch-label`).attr("title",o).text(o))):(m=`:where(.${u}-swatches-wrap) {
32
32
  display: flex;
33
33
  align-items: center;
34
34
  min-height: 33px;
@@ -38,7 +38,7 @@ ${n}`}function kV(t){return t==="time"?E1:t==="utc"?zd:NV}function mL(t,e,n){let
38
38
  display: inline-flex;
39
39
  align-items: center;
40
40
  margin-right: 1em;
41
- }`,h.selectAll().data(t.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,t,a,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(x=>x.insert("style","*").text(`:where(.${u}-swatches) {
41
+ }`,h.selectAll().data(t.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,t,a,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(g=>g.insert("style","*").text(`:where(.${u}-swatches) {
42
42
  font-family: system-ui, sans-serif;
43
43
  font-size: 10px;
44
44
  margin-bottom: 0.5em;
@@ -47,7 +47,7 @@ ${n}`}function kV(t){return t==="time"?E1:t==="utc"?zd:NV}function mL(t,e,n){let
47
47
  margin-right: 0.5em;
48
48
  overflow: visible;
49
49
  }
50
- ${m}`)).style("margin-left",f?`${+f}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",te(i,"normal")).call(xu,p).node()}var wb=new Map([["symbol",XO],["color",HO],["opacity",AH]]);function VO(t={}){for(let[e,n]of wb){let r=t[e];if(Ro(r)){let o=Ps(t),i;if(e==="symbol"){let{fill:s,stroke:a=s===void 0&&Ro(t.color)?"color":void 0}=t;i={fill:s,stroke:a}}return n(G1(e,r,i),M4(o,r,t),s=>Ro(t[s])?G1(s,t[s]):null)}}throw new Error("unknown legend type; no scale found")}function GO(t,e,n={}){return(r,o)=>{if(!wb.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return wb.get(r)(t[r],M4(e,n[r],o),i=>t[i])}}function M4({className:t,...e},{label:n,ticks:r,tickFormat:o}={},i){return NL(i,{className:t,...e},{label:n,ticks:r,tickFormat:o})}function HO(t,{legend:e=!0,...n}){if(e===!0&&(e=t.type==="ordinal"?"swatches":"ramp"),t.domain!==void 0)switch(`${e}`.toLowerCase()){case"swatches":return jO(t,n);case"ramp":return iO(t,n);default:throw new Error(`unknown legend type: ${e}`)}}function AH({type:t,interpolate:e,...n},{legend:r=!0,color:o=Le(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 HO({type:t,...n,interpolate:TH(o)},{legend:r,...i})}function TH(t){let{r:e,g:n,b:r}=Le(t)||Le(0,0,0);return o=>`rgba(${e},${n},${r},${o})`}function QO(t,e,n){let r=[];for(let[o,i]of wb){let s=n[o];if(s?.legend&&o in t){let a=i(t[o],M4(e,t[o],s),c=>t[c]);a!=null&&r.push(a)}}return r}function Us(t={}){return wS(t)?t:{...t,x:W}}function js(t={}){return vS(t)?t:{...t,y:W}}function vb(t,e){if(e.length===1)return{data:t,facets:e};let n=Cs(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=Ns(t);let i=t[dS]=new Uint32Array(n+o);e=e.map(a=>Ns(a,Uint32Array));let s=n;r.fill(0);for(let a of e)for(let c=0,f=a.length;c<f;++c){let u=a[c];r[u]?(a[c]=s,t[s]=t[u],i[s]=u,++s):i[u]=u,r[u]=1}return{data:t,facets:e}}function A4(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{y1:n,y:r=n,x:o,...i}=e,[s,a,c,f]=Su(r,o,"y","x",t,i);return{...s,y1:n,y:a,x1:c,x2:f,x:ou(c,f)}}function KO(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{y1:n,y:r=n,x:o}=e,[i,s,a]=Su(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function t$(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{y1:n,y:r=n,x:o}=e,[i,s,,a]=Su(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function T4(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{x1:n,x:r=n,y:o,...i}=e,[s,a,c,f]=Su(r,o,"x","y",t,i);return{...s,x1:n,x:a,y1:c,y2:f,y:ou(c,f)}}function e$(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{x1:n,x:r=n,y:o}=e,[i,s,a]=Su(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function n$(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{x1:n,x:r=n,y:o}=e,[i,s,,a]=Su(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function Xs({x:t,x1:e,x2:n,...r}={}){return r=Jr(r,"y"),e===void 0&&n===void 0?A4({x:t,...r}):([e,n]=_S(t,e,n),{...r,x1:e,x2:n})}function Ws({y:t,y1:e,y2:n,...r}={}){return r=Jr(r,"x"),e===void 0&&n===void 0?T4({y:t,...r}):([e,n]=_S(t,e,n),{...r,y1:e,y2:n})}function _u(t){let{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}var EH={length:!0};function Su(t,e=jd,n,r,{offset:o,order:i,reverse:s},a){if(e===null)throw new Error(`stack requires ${r}`);let c=vn(a),[f,u]=fn(t),[p,l]=Ge(e),[d,h]=Ge(e);return p.hint=d.hint=EH,o=IH(o),i=kH(i,o,r),[Ce(a,(m,x,g)=>{({data:m,facets:x}=vb(m,x));let y=t==null?void 0:u(sc(ut(m,t),g?.[n])),b=ut(m,e,Float64Array),w=ut(m,c),_=i&&i(m,y,b,w),v=Cs(m),A=l(new Float64Array(v)),T=h(new Float64Array(v)),E=[];for(let N of x){let M=y?Array.from(rn(N,k=>y[k]).values()):[N];if(_)for(let k of M)k.sort(_);for(let k of M){let O=0,S=0;s&&k.reverse();for(let I of k){let C=b[I];C<0?O=T[I]=(A[I]=O)+C:C>0?S=T[I]=(A[I]=S)+C:T[I]=A[I]=S}}E.push(M)}return o&&o(E,A,T,w),{data:m,facets:x}}),f,p,d]}function IH(t){if(t!=null){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return NH;case"center":case"silhouette":return CH;case"wiggle":return o$}throw new Error(`unknown offset: ${t}`)}}function r$(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 NH(t,e,n){for(let r of t)for(let o of r){let[i,s]=r$(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 CH(t,e,n){for(let r of t){for(let o of r){let[i,s]=r$(o,n);for(let a of o){let c=(s+i)/2;e[a]-=c,n[a]-=c}}i$(r,e,n)}s$(t,e,n)}function o$(t,e,n,r){for(let o of t){let i=new Tn,s=0;for(let a of o){let c=-1,f=a.map(d=>Math.abs(n[d]-e[d])),u=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}),p=[0,...gx(u)];for(let d of a)e[d]+=s,n[d]+=s;let l=sn(f);l&&(s-=sn(f,(d,h)=>(u[h]/2+p[h])*d)/l)}i$(o,e,n)}s$(t,e,n)}function i$(t,e,n){let r=It(t,o=>It(o,i=>e[i]));for(let o of t)for(let i of o)e[i]-=r,n[i]-=r}function s$(t,e,n){let r=t.length;if(r===1)return;let o=t.map(a=>a.flat()),i=o.map(a=>(It(a,c=>e[c])+kt(a,c=>n[c]))/2),s=It(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 kH(t,e,n){if(t===void 0&&e===o$)return ZO(We);if(t!=null){if(typeof t=="string"){let r=t.startsWith("-"),o=r?nc:We;switch((r?t.slice(1):t).toLowerCase()){case"value":case n:return LH(o);case"z":return RH(o);case"sum":return OH(o);case"appearance":return $H(o);case"inside-out":return ZO(o)}return JO(mS(t))}if(typeof t=="function")return(t.length===1?JO:DH)(t);if(Gn(t))return PH(t);throw new Error(`invalid order: ${t}`)}}function LH(t){return(e,n,r)=>(o,i)=>t(r[o],r[i])}function RH(t){return(e,n,r,o)=>(i,s)=>t(o[i],o[s])}function OH(t){return _b(t,(e,n,r,o)=>af(Fn(e),i=>sn(i,s=>r[s]),i=>o[i]))}function $H(t){return _b(t,(e,n,r,o)=>af(Fn(e),i=>n[Ia(i,s=>r[s])],i=>o[i]))}function ZO(t){return _b(t,(e,n,r,o)=>{let i=Fn(e),s=af(i,p=>n[Ia(p,l=>r[l])],p=>o[p]),a=Wr(i,p=>sn(p,l=>r[l]),p=>o[p]),c=[],f=[],u=0;for(let p of s)u<0?(u+=a.get(p),c.push(p)):(u-=a.get(p),f.push(p));return f.reverse().concat(c)})}function JO(t){return e=>{let n=ut(e,t);return(r,o)=>We(n[r],n[o])}}function DH(t){return e=>Gn(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function PH(t){return _b(We,()=>t)}function _b(t,e){return(n,r,o,i)=>{if(!i)throw new Error("missing channel: z");let s=new Tn(e(n,r,o,i).map((a,c)=>[a,c]));return(a,c)=>t(s.get(i[a]),s.get(i[c]))}}var FH={ariaLabel:"rect"},gc=class extends lt{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,FH),ch(this,n),fh(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x1:c,y1:f,x2:u,y2:p}=r,{marginTop:l,marginRight:d,marginBottom:h,marginLeft:m,width:x,height:g}=o,{projection:y}=i,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:A,ry:T,rx1y1:E,rx1y2:N,rx2y1:M,rx2y2:k}=this;(c||u)&&!y&&lr(s)&&(c=u=null),(f||p)&&!y&&lr(a)&&(f=p=null);let O=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{},0,0).call(I=>I.selectAll().data(e).enter().call(E||N||M||k?C=>C.append("path").call(ht,this).call(uh,c&&u?L=>c[L]+(u[L]<c[L]?-w:v):c?L=>c[L]+v:m+v,f&&p?L=>f[L]+(p[L]<f[L]?-_:b):f?L=>f[L]+b:l+b,c&&u?L=>u[L]-(u[L]<c[L]?-v:w):c?L=>c[L]+O-w:x-d-w,f&&p?L=>p[L]-(p[L]<f[L]?-b:_):f?L=>f[L]+S-_:g-h-_,this).call(Tt,this,r):C=>C.append("rect").call(ht,this).attr("x",c?u?L=>Math.min(c[L],u[L])+v:L=>c[L]+v:m+v).attr("y",f?p?L=>Math.min(f[L],p[L])+b:L=>f[L]+b:l+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+O-v-w):O-v-w:x-d-m-w-v).attr("height",f?p?L=>Math.max(0,Math.abs(f[L]-p[L])+S-b-_):S-b-_:g-l-h-b-_).call(at,"rx",A).call(at,"ry",T).call(Tt,this,r))).node()}};function ch(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={}){t.insetTop=Dt(n),t.insetRight=Dt(r),t.insetBottom=Dt(o),t.insetLeft=Dt(i)}function fh(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:u=s!==void 0?+s:i!==void 0?+i:0,rx2y2:p=s!==void 0?+s:a!==void 0?+a:0}={}){c||f||u||p?(t.rx1y1=c,t.rx1y2=f,t.rx2y1=u,t.rx2y2=p):(t.rx=te(n,"auto"),t.ry=te(r,"auto"))}function uh(t,e,n,r,o,i){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:f}=i;typeof e!="function"&&(e=ue(e)),typeof n!="function"&&(n=ue(n)),typeof r!="function"&&(r=ue(r)),typeof o!="function"&&(o=ue(o));let u=Math.max(Math.abs(s+c),Math.abs(a+f)),p=Math.max(Math.abs(s+a),Math.abs(c+f));t.attr("d",l=>{let d=e(l),h=n(l),m=r(l),x=o(l),g=d>m,y=h>x,b=g?m:d,w=g?d:m,_=y?x:h,v=y?h:x,A=Math.min(1,(w-b)/u,(v-_)/p),T=A*(g?y?f:c:y?a:s),E=A*(g?y?a:s:y?f:c),N=A*(g?y?s:a:y?c:f),M=A*(g?y?c:f:y?s:a);return`M${b},${_+Mb(T,M)}A${T},${T} 0 0 ${T<0?0:1} ${b+Sb(T,M)},${_}H${w-Sb(E,N)}A${E},${E} 0 0 ${E<0?0:1} ${w},${_+Mb(E,N)}V${v-Mb(N,E)}A${N},${N} 0 0 ${N<0?0:1} ${w-Sb(N,E)},${v}H${b+Sb(M,T)}A${M},${M} 0 0 ${M<0?0:1} ${b},${v-Mb(M,T)}Z`})}function Sb(t,e){return e<0?t:Math.abs(t)}function Mb(t,e){return e<0?Math.abs(t):t}function lh(t,e){return new gc(t,m4(x4(e)))}function Mu(t,e={}){return Oi(e)||(e={...e,y:Zt,x2:W,interval:1}),new gc(t,Xs(x4(Us(e))))}function Au(t,e={}){return Oi(e)||(e={...e,x:Zt,y2:W,interval:1}),new gc(t,Ws(m4(js(e))))}var qH={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},BH={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},ph=class extends lt{constructor(e={}){let{anchor:n=null}=e;super(Es,void 0,e,n==null?qH:BH),this.anchor=bS(n,"anchor",["top","right","bottom","left"]),ch(this,e),n||fh(this,e)}render(e,n,r,o,i){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:f,width:u,height:p}=o,{anchor:l,insetTop:d,insetRight:h,insetBottom:m,insetLeft:x}=this,{rx:g,ry:y,rx1y1:b,rx1y2:w,rx2y1:_,rx2y2:v}=this,A=f+x,T=u-a-h,E=s+d,N=p-c-m;return ot(l?"svg:line":b||w||_||v?"svg:path":"svg:rect",i).datum(0).call(wt,this,o,i).call(ht,this).call(Tt,this,r).call(xt,this,{}).call(l==="left"?M=>M.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",N):l==="right"?M=>M.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",N):l==="top"?M=>M.attr("x1",A).attr("x2",T).attr("y1",E).attr("y2",E):l==="bottom"?M=>M.attr("x1",A).attr("x2",T).attr("y1",N).attr("y2",N):b||w||_||v?M=>M.call(uh,A,E,T,N,this):M=>M.attr("x",A).attr("y",E).attr("width",T-A).attr("height",N-E).attr("rx",g).attr("ry",y)).node()}};function Tu(t){return new ph(t)}var E4={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},zH=new Set(["geometry","href","src","ariaLabel","scales"]),dh=class extends lt{constructor(e,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&qn(e)&&k1(e)&&(n={...n,title:W});let{x:r,y:o,x1:i,x2:s,y1:a,y2:c,anchor:f,preferredAnchor:u="bottom",monospace:p,fontFamily:l=p?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:h,fontVariant:m,fontWeight:x,lineHeight:g=1,lineWidth:y=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:A=8,title:T,pointerSize:E=12,pathFilter:N="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:T,optional:!0}},n,E4),this.anchor=R1(f,"anchor"),this.preferredAnchor=R1(u,"preferredAnchor"),this.frameAnchor=Do(b),this.textAnchor=te(_,"middle"),this.textPadding=+A,this.pointerSize=+E,this.pathFilter=be(N),this.lineHeight=+g,this.lineWidth=+y,this.textOverflow=y4(v),this.monospace=!!p,this.fontFamily=be(l),this.fontSize=Dt(d),this.fontStyle=be(h),this.fontVariant=be(m),this.fontWeight=be(x);for(let M in E4)M in this.channels&&(this[M]=E4[M]);this.splitLines=w4(this),this.clipLine=v4(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:u}=n,{ownerSVGElement:p,document:l}=i,{anchor:d,monospace:h,lineHeight:m,lineWidth:x}=this,{textPadding:g,pointerSize:y,pathFilter:b}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:A,x2:T,y2:E,x:N=v??T,y:M=A??E}=r,k=f?f(e.fx)-_:0,O=u?u(e.fy)-w:0,[S,I]=Qe(this,o),C=u4(r,S),L=l4(r,I),D=h?ub:fb,$=D(dc),P,F;"title"in r?(P=a$.call(this,{title:r.channels.title},n),F=XH):(P=a$.call(this,r.channels,n),F=WH);let q=ot("svg:g",i).call(wt,this,o,i).call(b4,this).call(xt,this,{x:N&&a,y:M&&c}).call(et=>et.selectAll().data(e).enter().append("g").attr("transform",rt=>`translate(${Math.round(C(rt))},${Math.round(L(rt))})`).call(ht,this).call(rt=>rt.append("path").attr("filter",b)).call(rt=>rt.append("text").each(function(j){let nt=Nt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let Y=F.call(s,j,e,P,n,r);if(typeof Y=="string")for(let G of s.splitLines(Y))V(nt,{value:s.clipLine(G)});else{let G=new Set;for(let tt of Y){let{label:B=""}=tt;B&&G.has(B)||(G.add(B),V(nt,tt))}}})));function V(et,{label:rt,value:j,color:nt,opacity:Y}){rt??="",j??="";let G=nt!=null||Y!=null,tt,B=x*100,[_t]=mc(rt,B,D,$);if(_t>=0)rt=rt.slice(0,_t).trimEnd()+dc,tt=j.trim(),j="";else{(rt||!j&&!G)&&(j=" "+j);let[Ct]=mc(j,B-D(rt),D,$);Ct>=0&&(tt=j.trim(),j=j.slice(0,Ct).trimEnd()+dc)}let ct=et.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");rt&&ct.append("tspan").attr("font-weight","bold").text(rt),j&&ct.append(()=>l.createTextNode(j)),G&&ct.append("tspan").text(" \u25A0").attr("fill",nt).attr("fill-opacity",Y).style("user-select","none"),tt&&ct.append("title").text(tt)}function K(){let{width:et,height:rt}=o.facet??o;q.selectChildren().each(function(j){let{x:nt,width:Y,height:G}=this.getBBox();Y=Math.round(Y),G=Math.round(G);let tt=d;if(tt===void 0){let ct=C(j)+k,Ct=L(j)+O,Lt=ct+Y+y+g*2<et,Z=ct-Y-y-g*2>0,jt=Ct+G+y+g*2<rt,Qn=Ct-G-y-g*2>0;tt=Lt&&Z?jt&&Qn?s.preferredAnchor:Qn?"bottom":"top":jt&&Qn?Lt?"left":"right":(Lt||Z)&&(jt||Qn)?`${Qn?"bottom":"top"}-${Lt?"left":"right"}`:s.preferredAnchor}let B=this.firstChild,_t=this.lastChild;if(B.setAttribute("d",jH(tt,y,g,Y,G)),nt)for(let ct of _t.childNodes)ct.setAttribute("x",-nt);_t.setAttribute("y",`${+YH(tt,_t.childNodes.length,m).toFixed(6)}em`),_t.setAttribute("transform",`translate(${UH(tt,y,g,Y,G)})`)}),q.attr("visibility",null)}return e.length&&(q.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(K):typeof requestAnimationFrame<"u"&&requestAnimationFrame(K)),q.node()}};function Tb(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new dh(t,{...r,x:e,y:n})}function YH(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}function UH(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 jH(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 a$(t,e){let n={},r=this.format;r=c$(r,t,"x"),r=c$(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=Zd(t,o);s&&(n[o]=s)}}for(let o in t){if(o in n||o in r||zH.has(o)||(o==="x"||o==="y")&&t.geometry)continue;let i=Zd(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]=(fe(s)?Co:Ir)(i)}else if(i===void 0||i===!0){let s=e[o];this.format[o]=s?.bandwidth?ah(s,s.domain()):zo}}return n}function c$(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 XH(t,e,{title:n}){return this.format.title(n.value[t],t)}function*WH(t,e,n,r,o){for(let i in n){if(i==="fx"||i==="fy"){yield{label:Ab(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:u$(r,n,"x"),value:f$(this.format.x2,n.x1,s,t)};else if(i==="y2"&&"y1"in n)yield{label:u$(r,n,"y"),value:f$(this.format.y2,n.y1,s,t)};else{let a=s.value[t],c=s.scale;if(!oe(a)&&c==null)continue;yield{label:Ab(r,n,i),value:this.format[i](a,t),color:c==="color"?o[i][t]:null,opacity:c==="opacity"?o[i][t]:null}}}}function f$(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 u$(t,e,n){let r=Ab(t,e,`${n}1`,n),o=Ab(t,e,`${n}2`,n);return r===o?r:`${r}\u2013${o}`}function Ab(t,e,n,r=n){let o=e[n],i=t[o?.scale??n];return String(i?.label??o?.label??r)}function Eu(t={}){let{facet:e,style:n,title:r,subtitle:o,caption:i,ariaLabel:s,ariaDescription:a}=t,c=qs(t.className),f=t.marks===void 0?[]:p$(t.marks);f.push(...JH(f));let u=QH(e,t),p=new Map;for(let $ of f){let P=d$($,u,t);P&&p.set($,P)}let l=new Map;u&&hh(l,[u],t),hh(l,p,t);let d=p$(KH(f,l,t));for(let $ of d){let P=d$($,u,t);P&&p.set($,P)}f.unshift(...d);let h=BR(l,t);if(h!==void 0){let $=u?J1(h,u):void 0;for(let F of f){if(F.facet===null||F.facet==="super")continue;let q=p.get(F);q!==void 0&&(q.facetsIndex=F.fx!=null||F.fy!=null?J1(h,q):$)}let P=new Set;for(let{facetsIndex:F}of p.values())F?.forEach((q,V)=>{q?.length>0&&P.add(V)});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=p.get(F);q!==void 0&&(q.facetsIndex=UR(q.facetsIndex))}}for(let $ of Wt.keys())Ro(t[$])&&$!=="fx"&&$!=="fy"&&l.set($,[]);let m=new Map;for(let $ of f){if(m.has($))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:F}=p.get($)??{},{data:q,facets:V,channels:K}=$.initialize(P,F,t);C4(K,t),m.set($,{data:q,facets:V,channels:K})}let x=th(hh(l,m,t),t),g=rO(x,f,t);RR(x,g);let y=HS(x),{fx:b,fy:w}=y,_=b||w?QS(x,g):g,v=b||w?sQ(y,g):g,A=Ps(t),T=A.document,E=hi("svg").call(T.documentElement),N=E;A.ownerSVGElement=E,A.className=c,A.projection=WR(t,_),A.filterFacets=($,P)=>J1(h,{channels:P,groups:Q1($,P)}),A.getMarkState=$=>{let P=m.get($),F=p.get($);return{...P,channels:{...P.channels,...F?.channels}}},A.dispatchValue=$=>{N.value!==$&&(N.value=$,N.dispatchEvent(new Event("input",{bubbles:!0})))};let M=new Set;for(let[$,P]of m)if($.initializer!=null){let F=$.facet==="super"?v:_,q=$.initializer(P.data,P.facets,P.channels,y,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:V,fy:K,...et}=q.channels;HH(et),Object.assign(P.channels,et);for(let rt of Object.values(et)){let{scale:j}=rt;j!=null&&!RL(Wt.get(j))&&(x$(rt,t),M.add(j))}(V!=null||K!=null)&&p.set($,!0)}}if(M.size){let $=new Map;hh($,m,t,V=>M.has(V)),hh(l,m,t,V=>M.has(V));let P=iQ(th($,t),x),{scales:F,...q}=HS(P);Object.assign(x,P),Object.assign(y,q),Object.assign(y.scales,F)}let k,O;h!==void 0&&(k={x:b?.domain(),y:w?.domain()},h=zR(h,k),O=YR(b,w,g));for(let[$,P]of m)P.values=$.scale(P.channels,y,A);let{width:S,height:I}=g;Nt(E).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",I).attr("viewBox",`0 0 ${S} ${I}`).attr("aria-label",s).attr("aria-description",a).call($=>$.append("style").text(`:where(.${c}) {
50
+ ${m}`)).style("margin-left",f?`${+f}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",te(i,"normal")).call(yu,p).node()}var vb=new Map([["symbol",VO],["color",ZO],["opacity",EH]]);function HO(t={}){for(let[e,n]of vb){let r=t[e];if(Ro(r)){let o=Ds(t),i;if(e==="symbol"){let{fill:s,stroke:a=s===void 0&&Ro(t.color)?"color":void 0}=t;i={fill:s,stroke:a}}return n(H1(e,r,i),E4(o,r,t),s=>Ro(t[s])?H1(s,t[s]):null)}}throw new Error("unknown legend type; no scale found")}function QO(t,e,n={}){return(r,o)=>{if(!vb.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return vb.get(r)(t[r],E4(e,n[r],o),i=>t[i])}}function E4({className:t,...e},{label:n,ticks:r,tickFormat:o}={},i){return kL(i,{className:t,...e},{label:n,ticks:r,tickFormat:o})}function ZO(t,{legend:e=!0,...n}){if(e===!0&&(e=t.type==="ordinal"?"swatches":"ramp"),t.domain!==void 0)switch(`${e}`.toLowerCase()){case"swatches":return WO(t,n);case"ramp":return aO(t,n);default:throw new Error(`unknown legend type: ${e}`)}}function EH({type:t,interpolate:e,...n},{legend:r=!0,color:o=Re(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 ZO({type:t,...n,interpolate:TH(o)},{legend:r,...i})}function TH(t){let{r:e,g:n,b:r}=Re(t)||Re(0,0,0);return o=>`rgba(${e},${n},${r},${o})`}function JO(t,e,n){let r=[];for(let[o,i]of vb){let s=n[o];if(s?.legend&&o in t){let a=i(t[o],E4(e,t[o],s),c=>t[c]);a!=null&&r.push(a)}}return r}function Ys(t={}){return _S(t)?t:{...t,x:W}}function Us(t={}){return SS(t)?t:{...t,y:W}}function _b(t,e){if(e.length===1)return{data:t,facets:e};let n=Cs(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=Is(t);let i=t[mS]=new Uint32Array(n+o);e=e.map(a=>Is(a,Uint32Array));let s=n;r.fill(0);for(let a of e)for(let c=0,f=a.length;c<f;++c){let u=a[c];r[u]?(a[c]=s,t[s]=t[u],i[s]=u,++s):i[u]=u,r[u]=1}return{data:t,facets:e}}function T4(t={},e={}){arguments.length===1&&([t,e]=Mu(t));let{y1:n,y:r=n,x:o,...i}=e,[s,a,c,f]=Au(r,o,"y","x",t,i);return{...s,y1:n,y:a,x1:c,x2:f,x:su(c,f)}}function e$(t={},e={}){arguments.length===1&&([t,e]=Mu(t));let{y1:n,y:r=n,x:o}=e,[i,s,a]=Au(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function n$(t={},e={}){arguments.length===1&&([t,e]=Mu(t));let{y1:n,y:r=n,x:o}=e,[i,s,,a]=Au(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function I4(t={},e={}){arguments.length===1&&([t,e]=Mu(t));let{x1:n,x:r=n,y:o,...i}=e,[s,a,c,f]=Au(r,o,"x","y",t,i);return{...s,x1:n,x:a,y1:c,y2:f,y:su(c,f)}}function r$(t={},e={}){arguments.length===1&&([t,e]=Mu(t));let{x1:n,x:r=n,y:o}=e,[i,s,a]=Au(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function o$(t={},e={}){arguments.length===1&&([t,e]=Mu(t));let{x1:n,x:r=n,y:o}=e,[i,s,,a]=Au(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function js({x:t,x1:e,x2:n,...r}={}){return r=Jr(r,"y"),e===void 0&&n===void 0?T4({x:t,...r}):([e,n]=MS(t,e,n),{...r,x1:e,x2:n})}function Xs({y:t,y1:e,y2:n,...r}={}){return r=Jr(r,"x"),e===void 0&&n===void 0?I4({y:t,...r}):([e,n]=MS(t,e,n),{...r,y1:e,y2:n})}function Mu(t){let{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}var IH={length:!0};function Au(t,e=Xd,n,r,{offset:o,order:i,reverse:s},a){if(e===null)throw new Error(`stack requires ${r}`);let c=vn(a),[f,u]=un(t),[p,l]=Qe(e),[d,h]=Qe(e);return p.hint=d.hint=IH,o=CH(o),i=LH(i,o,r),[Ne(a,(m,g,x)=>{({data:m,facets:g}=_b(m,g));let y=t==null?void 0:u(sc(ut(m,t),x?.[n])),b=ut(m,e,Float64Array),w=ut(m,c),_=i&&i(m,y,b,w),v=Cs(m),S=l(new Float64Array(v)),E=h(new Float64Array(v)),T=[];for(let I of g){let A=y?Array.from(sn(I,k=>y[k]).values()):[I];if(_)for(let k of A)k.sort(_);for(let k of A){let O=0,M=0;s&&k.reverse();for(let C of k){let N=b[C];N<0?O=E[C]=(S[C]=O)+N:N>0?M=E[C]=(S[C]=M)+N:E[C]=S[C]=M}}T.push(A)}return o&&o(T,S,E,w),{data:m,facets:g}}),f,p,d]}function CH(t){if(t!=null){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return NH;case"center":case"silhouette":return kH;case"wiggle":return s$}throw new Error(`unknown offset: ${t}`)}}function i$(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 NH(t,e,n){for(let r of t)for(let o of r){let[i,s]=i$(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 kH(t,e,n){for(let r of t){for(let o of r){let[i,s]=i$(o,n);for(let a of o){let c=(s+i)/2;e[a]-=c,n[a]-=c}}a$(r,e,n)}c$(t,e,n)}function s$(t,e,n,r){for(let o of t){let i=new Tn,s=0;for(let a of o){let c=-1,f=a.map(d=>Math.abs(n[d]-e[d])),u=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}),p=[0,...yg(u)];for(let d of a)e[d]+=s,n[d]+=s;let l=Le(f);l&&(s-=Le(f,(d,h)=>(u[h]/2+p[h])*d)/l)}a$(o,e,n)}c$(t,e,n)}function a$(t,e,n){let r=Ct(t,o=>Ct(o,i=>e[i]));for(let o of t)for(let i of o)e[i]-=r,n[i]-=r}function c$(t,e,n){let r=t.length;if(r===1)return;let o=t.map(a=>a.flat()),i=o.map(a=>(Ct(a,c=>e[c])+Tt(a,c=>n[c]))/2),s=Ct(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 LH(t,e,n){if(t===void 0&&e===s$)return KO(Ge);if(t!=null){if(typeof t=="string"){let r=t.startsWith("-"),o=r?nc:Ge;switch((r?t.slice(1):t).toLowerCase()){case"value":case n:return RH(o);case"z":return OH(o);case"sum":return $H(o);case"appearance":return DH(o);case"inside-out":return KO(o)}return t$(xS(t))}if(typeof t=="function")return(t.length===1?t$:PH)(t);if(Hn(t))return FH(t);throw new Error(`invalid order: ${t}`)}}function RH(t){return(e,n,r)=>(o,i)=>t(r[o],r[i])}function OH(t){return(e,n,r,o)=>(i,s)=>t(o[i],o[s])}function $H(t){return Sb(t,(e,n,r,o)=>ff(qn(e),i=>Le(i,s=>r[s]),i=>o[i]))}function DH(t){return Sb(t,(e,n,r,o)=>ff(qn(e),i=>n[Ia(i,s=>r[s])],i=>o[i]))}function KO(t){return Sb(t,(e,n,r,o)=>{let i=qn(e),s=ff(i,p=>n[Ia(p,l=>r[l])],p=>o[p]),a=Wr(i,p=>Le(p,l=>r[l]),p=>o[p]),c=[],f=[],u=0;for(let p of s)u<0?(u+=a.get(p),c.push(p)):(u-=a.get(p),f.push(p));return f.reverse().concat(c)})}function t$(t){return e=>{let n=ut(e,t);return(r,o)=>Ge(n[r],n[o])}}function PH(t){return e=>Hn(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function FH(t){return Sb(Ge,()=>t)}function Sb(t,e){return(n,r,o,i)=>{if(!i)throw new Error("missing channel: z");let s=new Tn(e(n,r,o,i).map((a,c)=>[a,c]));return(a,c)=>t(s.get(i[a]),s.get(i[c]))}}var qH={ariaLabel:"rect"},xc=class extends lt{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,qH),fh(this,n),uh(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x1:c,y1:f,x2:u,y2:p}=r,{marginTop:l,marginRight:d,marginBottom:h,marginLeft:m,width:g,height:x}=o,{projection:y}=i,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:S,ry:E,rx1y1:T,rx1y2:I,rx2y1:A,rx2y2:k}=this;(c||u)&&!y&&lr(s)&&(c=u=null),(f||p)&&!y&&lr(a)&&(f=p=null);let O=s?.bandwidth?s.bandwidth():0,M=a?.bandwidth?a.bandwidth():0;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{},0,0).call(C=>C.selectAll().data(e).enter().call(T||I||A||k?N=>N.append("path").call(ht,this).call(lh,c&&u?L=>c[L]+(u[L]<c[L]?-w:v):c?L=>c[L]+v:m+v,f&&p?L=>f[L]+(p[L]<f[L]?-_:b):f?L=>f[L]+b:l+b,c&&u?L=>u[L]-(u[L]<c[L]?-v:w):c?L=>c[L]+O-w:g-d-w,f&&p?L=>p[L]-(p[L]<f[L]?-b:_):f?L=>f[L]+M-_:x-h-_,this).call(Et,this,r):N=>N.append("rect").call(ht,this).attr("x",c?u?L=>Math.min(c[L],u[L])+v:L=>c[L]+v:m+v).attr("y",f?p?L=>Math.min(f[L],p[L])+b:L=>f[L]+b:l+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+O-v-w):O-v-w:g-d-m-w-v).attr("height",f?p?L=>Math.max(0,Math.abs(f[L]-p[L])+M-b-_):M-b-_:x-l-h-b-_).call(at,"rx",S).call(at,"ry",E).call(Et,this,r))).node()}};function fh(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={}){t.insetTop=Dt(n),t.insetRight=Dt(r),t.insetBottom=Dt(o),t.insetLeft=Dt(i)}function uh(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:u=s!==void 0?+s:i!==void 0?+i:0,rx2y2:p=s!==void 0?+s:a!==void 0?+a:0}={}){c||f||u||p?(t.rx1y1=c,t.rx1y2=f,t.rx2y1=u,t.rx2y2=p):(t.rx=te(n,"auto"),t.ry=te(r,"auto"))}function lh(t,e,n,r,o,i){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:f}=i;typeof e!="function"&&(e=ue(e)),typeof n!="function"&&(n=ue(n)),typeof r!="function"&&(r=ue(r)),typeof o!="function"&&(o=ue(o));let u=Math.max(Math.abs(s+c),Math.abs(a+f)),p=Math.max(Math.abs(s+a),Math.abs(c+f));t.attr("d",l=>{let d=e(l),h=n(l),m=r(l),g=o(l),x=d>m,y=h>g,b=x?m:d,w=x?d:m,_=y?g:h,v=y?h:g,S=Math.min(1,(w-b)/u,(v-_)/p),E=S*(x?y?f:c:y?a:s),T=S*(x?y?a:s:y?f:c),I=S*(x?y?s:a:y?c:f),A=S*(x?y?c:f:y?s:a);return`M${b},${_+Ab(E,A)}A${E},${E} 0 0 ${E<0?0:1} ${b+Mb(E,A)},${_}H${w-Mb(T,I)}A${T},${T} 0 0 ${T<0?0:1} ${w},${_+Ab(T,I)}V${v-Ab(I,T)}A${I},${I} 0 0 ${I<0?0:1} ${w-Mb(I,T)},${v}H${b+Mb(A,E)}A${A},${A} 0 0 ${A<0?0:1} ${b},${v-Ab(A,E)}Z`})}function Mb(t,e){return e<0?t:Math.abs(t)}function Ab(t,e){return e<0?Math.abs(t):t}function ph(t,e){return new xc(t,x4(y4(e)))}function Eu(t,e={}){return Ri(e)||(e={...e,y:Zt,x2:W,interval:1}),new xc(t,js(y4(Ys(e))))}function Tu(t,e={}){return Ri(e)||(e={...e,x:Zt,y2:W,interval:1}),new xc(t,Xs(x4(Us(e))))}var BH={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},zH={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},dh=class extends lt{constructor(e={}){let{anchor:n=null}=e;super(Es,void 0,e,n==null?BH:zH),this.anchor=vS(n,"anchor",["top","right","bottom","left"]),fh(this,e),n||uh(this,e)}render(e,n,r,o,i){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:f,width:u,height:p}=o,{anchor:l,insetTop:d,insetRight:h,insetBottom:m,insetLeft:g}=this,{rx:x,ry:y,rx1y1:b,rx1y2:w,rx2y1:_,rx2y2:v}=this,S=f+g,E=u-a-h,T=s+d,I=p-c-m;return ot(l?"svg:line":b||w||_||v?"svg:path":"svg:rect",i).datum(0).call(wt,this,o,i).call(ht,this).call(Et,this,r).call(gt,this,{}).call(l==="left"?A=>A.attr("x1",S).attr("x2",S).attr("y1",T).attr("y2",I):l==="right"?A=>A.attr("x1",E).attr("x2",E).attr("y1",T).attr("y2",I):l==="top"?A=>A.attr("x1",S).attr("x2",E).attr("y1",T).attr("y2",T):l==="bottom"?A=>A.attr("x1",S).attr("x2",E).attr("y1",I).attr("y2",I):b||w||_||v?A=>A.call(lh,S,T,E,I,this):A=>A.attr("x",S).attr("y",T).attr("width",E-S).attr("height",I-T).attr("rx",x).attr("ry",y)).node()}};function Iu(t){return new dh(t)}var C4={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},YH=new Set(["geometry","href","src","ariaLabel","scales"]),hh=class extends lt{constructor(e,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&Bn(e)&&L1(e)&&(n={...n,title:W});let{x:r,y:o,x1:i,x2:s,y1:a,y2:c,anchor:f,preferredAnchor:u="bottom",monospace:p,fontFamily:l=p?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:h,fontVariant:m,fontWeight:g,lineHeight:x=1,lineWidth:y=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:S=8,title:E,pointerSize:T=12,pathFilter:I="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,C4),this.anchor=O1(f,"anchor"),this.preferredAnchor=O1(u,"preferredAnchor"),this.frameAnchor=Do(b),this.textAnchor=te(_,"middle"),this.textPadding=+S,this.pointerSize=+T,this.pathFilter=we(I),this.lineHeight=+x,this.lineWidth=+y,this.textOverflow=w4(v),this.monospace=!!p,this.fontFamily=we(l),this.fontSize=Dt(d),this.fontStyle=we(h),this.fontVariant=we(m),this.fontWeight=we(g);for(let A in C4)A in this.channels&&(this[A]=C4[A]);this.splitLines=_4(this),this.clipLine=S4(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:u}=n,{ownerSVGElement:p,document:l}=i,{anchor:d,monospace:h,lineHeight:m,lineWidth:g}=this,{textPadding:x,pointerSize:y,pathFilter:b}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:S,x2:E,y2:T,x:I=v??E,y:A=S??T}=r,k=f?f(e.fx)-_:0,O=u?u(e.fy)-w:0,[M,C]=Je(this,o),N=p4(r,M),L=d4(r,C),D=h?lb:ub,$=D(dc),P,F;"title"in r?(P=f$.call(this,{title:r.channels.title},n),F=WH):(P=f$.call(this,r.channels,n),F=VH);let q=ot("svg:g",i).call(wt,this,o,i).call(v4,this).call(gt,this,{x:I&&a,y:A&&c}).call(et=>et.selectAll().data(e).enter().append("g").attr("transform",rt=>`translate(${Math.round(N(rt))},${Math.round(L(rt))})`).call(ht,this).call(rt=>rt.append("path").attr("filter",b)).call(rt=>rt.append("text").each(function(j){let nt=Nt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let Y=F.call(s,j,e,P,n,r);if(typeof Y=="string")for(let G of s.splitLines(Y))V(nt,{value:s.clipLine(G)});else{let G=new Set;for(let tt of Y){let{label:B=""}=tt;B&&G.has(B)||(G.add(B),V(nt,tt))}}})));function V(et,{label:rt,value:j,color:nt,opacity:Y}){rt??="",j??="";let G=nt!=null||Y!=null,tt,B=g*100,[_t]=mc(rt,B,D,$);if(_t>=0)rt=rt.slice(0,_t).trimEnd()+dc,tt=j.trim(),j="";else{(rt||!j&&!G)&&(j=" "+j);let[kt]=mc(j,B-D(rt),D,$);kt>=0&&(tt=j.trim(),j=j.slice(0,kt).trimEnd()+dc)}let ct=et.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");rt&&ct.append("tspan").attr("font-weight","bold").text(rt),j&&ct.append(()=>l.createTextNode(j)),G&&ct.append("tspan").text(" \u25A0").attr("fill",nt).attr("fill-opacity",Y).style("user-select","none"),tt&&ct.append("title").text(tt)}function K(){let{width:et,height:rt}=o.facet??o;q.selectChildren().each(function(j){let{x:nt,width:Y,height:G}=this.getBBox();Y=Math.round(Y),G=Math.round(G);let tt=d;if(tt===void 0){let ct=N(j)+k,kt=L(j)+O,Lt=ct+Y+y+x*2<et,Z=ct-Y-y-x*2>0,jt=kt+G+y+x*2<rt,Zn=kt-G-y-x*2>0;tt=Lt&&Z?jt&&Zn?s.preferredAnchor:Zn?"bottom":"top":jt&&Zn?Lt?"left":"right":(Lt||Z)&&(jt||Zn)?`${Zn?"bottom":"top"}-${Lt?"left":"right"}`:s.preferredAnchor}let B=this.firstChild,_t=this.lastChild;if(B.setAttribute("d",XH(tt,y,x,Y,G)),nt)for(let ct of _t.childNodes)ct.setAttribute("x",-nt);_t.setAttribute("y",`${+UH(tt,_t.childNodes.length,m).toFixed(6)}em`),_t.setAttribute("transform",`translate(${jH(tt,y,x,Y,G)})`)}),q.attr("visibility",null)}return e.length&&(q.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(K):typeof requestAnimationFrame<"u"&&requestAnimationFrame(K)),q.node()}};function Tb(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ge(e,n)),new hh(t,{...r,x:e,y:n})}function UH(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}function jH(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 XH(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 f$(t,e){let n={},r=this.format;r=u$(r,t,"x"),r=u$(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=Jd(t,o);s&&(n[o]=s)}}for(let o in t){if(o in n||o in r||YH.has(o)||(o==="x"||o==="y")&&t.geometry)continue;let i=Jd(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]=(fe(s)?No:Ir)(i)}else if(i===void 0||i===!0){let s=e[o];this.format[o]=s?.bandwidth?ch(s,s.domain()):zo}}return n}function u$(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 WH(t,e,{title:n}){return this.format.title(n.value[t],t)}function*VH(t,e,n,r,o){for(let i in n){if(i==="fx"||i==="fy"){yield{label:Eb(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:p$(r,n,"x"),value:l$(this.format.x2,n.x1,s,t)};else if(i==="y2"&&"y1"in n)yield{label:p$(r,n,"y"),value:l$(this.format.y2,n.y1,s,t)};else{let a=s.value[t],c=s.scale;if(!oe(a)&&c==null)continue;yield{label:Eb(r,n,i),value:this.format[i](a,t),color:c==="color"?o[i][t]:null,opacity:c==="opacity"?o[i][t]:null}}}}function l$(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 p$(t,e,n){let r=Eb(t,e,`${n}1`,n),o=Eb(t,e,`${n}2`,n);return r===o?r:`${r}\u2013${o}`}function Eb(t,e,n,r=n){let o=e[n],i=t[o?.scale??n];return String(i?.label??o?.label??r)}function Cu(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?[]:h$(t.marks);f.push(...KH(f));let u=ZH(e,t),p=new Map;for(let $ of f){let P=m$($,u,t);P&&p.set($,P)}let l=new Map;u&&mh(l,[u],t),mh(l,p,t);let d=h$(tQ(f,l,t));for(let $ of d){let P=m$($,u,t);P&&p.set($,P)}f.unshift(...d);let h=YR(l,t);if(h!==void 0){let $=u?K1(h,u):void 0;for(let F of f){if(F.facet===null||F.facet==="super")continue;let q=p.get(F);q!==void 0&&(q.facetsIndex=F.fx!=null||F.fy!=null?K1(h,q):$)}let P=new Set;for(let{facetsIndex:F}of p.values())F?.forEach((q,V)=>{q?.length>0&&P.add(V)});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=p.get(F);q!==void 0&&(q.facetsIndex=XR(q.facetsIndex))}}for(let $ of Wt.keys())Ro(t[$])&&$!=="fx"&&$!=="fy"&&l.set($,[]);let m=new Map;for(let $ of f){if(m.has($))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:F}=p.get($)??{},{data:q,facets:V,channels:K}=$.initialize(P,F,t);L4(K,t),m.set($,{data:q,facets:V,channels:K})}let g=eh(mh(l,m,t),t),x=iO(g,f,t);$R(g,x);let y=ZS(g),{fx:b,fy:w}=y,_=b||w?JS(g,x):x,v=b||w?aQ(y,x):x,S=Ds(t),E=S.document,T=di("svg").call(E.documentElement),I=T;S.ownerSVGElement=T,S.className=c,S.projection=GR(t,_),S.filterFacets=($,P)=>K1(h,{channels:P,groups:Z1($,P)}),S.getMarkState=$=>{let P=m.get($),F=p.get($);return{...P,channels:{...P.channels,...F?.channels}}},S.dispatchValue=$=>{I.value!==$&&(I.value=$,I.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[$,P]of m)if($.initializer!=null){let F=$.facet==="super"?v:_,q=$.initializer(P.data,P.facets,P.channels,y,F,S);if(q.data!==void 0&&(P.data=q.data),q.facets!==void 0&&(P.facets=q.facets),q.channels!==void 0){let{fx:V,fy:K,...et}=q.channels;QH(et),Object.assign(P.channels,et);for(let rt of Object.values(et)){let{scale:j}=rt;j!=null&&!$L(Wt.get(j))&&(y$(rt,t),A.add(j))}(V!=null||K!=null)&&p.set($,!0)}}if(A.size){let $=new Map;mh($,m,t,V=>A.has(V)),mh(l,m,t,V=>A.has(V));let P=sQ(eh($,t),g),{scales:F,...q}=ZS(P);Object.assign(g,P),Object.assign(y,q),Object.assign(y.scales,F)}let k,O;h!==void 0&&(k={x:b?.domain(),y:w?.domain()},h=UR(h,k),O=jR(b,w,x));for(let[$,P]of m)P.values=$.scale(P.channels,y,S);let{width:M,height:C}=x;Nt(T).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",M).attr("height",C).attr("viewBox",`0 0 ${M} ${C}`).attr("aria-label",s).attr("aria-description",a).call($=>$.append("style").text(`:where(.${c}) {
51
51
  --plot-background: white;
52
52
  display: block;
53
53
  height: auto;
@@ -57,24 +57,24 @@ ${m}`)).style("margin-left",f?`${+f}px`:null).style("width",l===void 0?null:`${+
57
57
  :where(.${c} text),
58
58
  :where(.${c} tspan) {
59
59
  white-space: pre;
60
- }`)).call(xu,n);for(let $ of f){let{channels:P,values:F,facets:q}=m.get($);if(h===void 0||$.facet==="super"){let V=null;if(q&&(V=q[0],V=$.filter(V,P,F),V.length===0))continue;let K=$.render(V,y,F,v,A);if(K==null)continue;E.appendChild(K)}else{let V;for(let K of h){if(!($.facetAnchor?.(h,k,K)??!K.empty))continue;let et=null;if(q){let j=p.has($);if(et=q[j?K.i:0],et=$.filter(et,P,F),et.length===0)continue;!j&&et===q[0]&&(et=$i(et)),et.fx=K.x,et.fy=K.y,et.fi=K.i}let rt=$.render(et,y,F,_,A);if(rt!=null){(V??=Nt(E).append("g")).append(()=>rt).datum(K);for(let j of["aria-label","aria-description","aria-hidden","transform"])rt.hasAttribute(j)&&(V.attr(j,rt.getAttribute(j)),rt.removeAttribute(j))}}V?.selectChildren().attr("transform",O)}}let C=QO(x,A,t),{figure:L=r!=null||o!=null||i!=null||C.length>0}=t;L&&(N=T.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",r!=null&&N.append(l$(T,r,"h2")),o!=null&&N.append(l$(T,o,"h3")),N.append(...C,E),i!=null&&N.append(VH(T,i)),"value"in E&&(N.value=E.value,delete E.value)),N.scale=PR(y.scales),N.legend=GO(x,A,t);let D=hR();return D>0&&Nt(E).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${D.toLocaleString("en-US")} warning${D===1?"":"s"}. Please check the console.`),N}function l$(t,e,n){if(e.ownerDocument)return e;let r=t.createElement(n);return r.append(e),r}function VH(t,e){let n=t.createElement("figcaption");return n.append(e),n}function p$(t){return t.flat(1/0).filter(e=>e!=null).map(GH)}function GH(t){return typeof t.render=="function"?t:new N4(t)}var N4=class extends lt{constructor(e){if(typeof e!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=e}render(){}};function C4(t,e){for(let n in t)x$(t[n],e);return t}function x$(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:SS(s,o)}=e[n]??{};a!=null&&(t.value=Et(t.value,a),t.transform=!1)}function HH(t){for(let e in t)qS(e,t[e])}function hh(t,e,n,r=bL){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(!GR(n)){let c=n.x?.domain===void 0,f=n.y?.domain===void 0;if(c||f){let[u,p]=QR(s);c&&I4(t,"x",u),f&&I4(t,"y",p)}}}else I4(t,a,s)}return t}function I4(t,e,n){let r=t.get(e);r!==void 0?r.push(n):t.set(e,[n])}function QH(t,e){if(t==null)return;let{x:n,y:r}=t;if(n==null&&r==null)return;let o=Ri(t.data);if(o==null)throw new Error("missing facet data");let i={};n!=null&&(i.fx=fu(o,{value:n,scale:"fx"})),r!=null&&(i.fy=fu(o,{value:r,scale:"fy"})),C4(i,e);let s=Q1(o,i);return{channels:i,groups:s,data:t.data}}function d$(t,e,n){if(t.facet===null||t.facet==="super")return;let{fx:r,fy:o}=t;if(r!=null||o!=null){let c=Ri(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=fu(c,{value:r,scale:"fx"})),o!=null&&(f.fy=fu(c,{value:o,scale:"fy"})),C4(f,n),{channels:f,groups:Q1(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)&&Cs(Ri(t.data))===Cs(a)&&_n(`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 ZH(t,e={}){return Kt({...e,x:null,y:null},(n,r,o,i,s,a)=>a.getMarkState(t))}function JH(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)?zs:/^y$/i.test(o)?Ui:Bs,r=o(ZH(n,r)),r.title=null,i===void 0&&(r.preferredAnchor=o===Ui?"left":"bottom");let s=Tb(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,e.push(s)}}return e}function KH(t,e,n){let{projection:r,x:o={},y:i={},fx:s={},fy:a={},axis:c,grid:f,facet:u={},facet:{axis:p=c,grid:l}=u,x:{axis:d=c,grid:h=d===null?null:f}=o,y:{axis:m=c,grid:x=m===null?null:f}=i,fx:{axis:g=p,grid:y=g===null?null:l}=s,fy:{axis:b=p,grid:w=b===null?null:l}=a}=n;(r||!Ro(o)&&!h$("x",t))&&(d=h=null),(r||!Ro(i)&&!h$("y",t))&&(m=x=null),e.has("fx")||(g=y=null),e.has("fy")||(b=w=null),d===void 0&&(d=!Nb(t,"x")),m===void 0&&(m=!Nb(t,"y")),g===void 0&&(g=!Nb(t,"fx")),b===void 0&&(b=!Nb(t,"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 Ib(_,w,gb,a),Eb(_,b,hb,"right","left",u,a),Ib(_,y,bb,s),Eb(_,g,mb,"top","bottom",u,s),Ib(_,x,xb,i),Eb(_,m,ih,"left","right",n,i),Ib(_,h,yb,o),Eb(_,d,sh,"bottom","top",n,o),_}function Eb(t,e,n,r,o,i,s){if(!e)return;let a=tQ(e);s=eQ(a?r:e,i,s);let{line:c}=s;(n===ih||n===sh)&&c&&!Pi(c)&&t.push(Tu(nQ(s))),t.push(n(s)),a&&t.push(n({...s,anchor:o,label:null}))}function Ib(t,e,n,r){!e||Pi(e)||t.push(n(rQ(e,r)))}function tQ(t){return/^\s*both\s*$/i.test(t)}function eQ(t,e,{line:n=e.line,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:u,ariaDescription:p,label:l=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:u,ariaDescription:p,label:l,labelAnchor:d,labelArrow:h,labelOffset:m}}function nQ(t){let{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:n===!0?void 0:n}}function rQ(t,{stroke:e=Ls(t)?t:void 0,ticks:n=oQ(t)?t:void 0,tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}function oQ(t){switch(typeof t){case"number":return!0;case"string":return!Ls(t)}return qn(t)||typeof t?.range=="function"}function Nb(t,e){let n=`${e}-axis `;return t.some(r=>r.ariaLabel?.startsWith(n))}function h$(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 iQ(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 sQ({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=V1(n),f=t&&m$(t),u=e&&m$(e);return{marginTop:e?u[0]:r,marginRight:t?a-f[1]:o,marginBottom:e?c-u[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 m$(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 aQ=new Map([["basis",z3],["basis-closed",Y3],["basis-open",U3],["bundle",j3],["bump-x",D3],["bump-y",P3],["cardinal",X3],["cardinal-closed",W3],["cardinal-open",V3],["catmull-rom",G3],["catmull-rom-closed",H3],["catmull-rom-open",Q3],["linear",Ni],["linear-closed",Z3],["monotone-x",K3],["monotone-y",tS],["natural",eS],["step",nS],["step-after",oS],["step-before",rS]]);function mh(t=Ni,e){if(typeof t=="function")return t;let n=aQ.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 Cb(t=Vs,e){return typeof t!="function"&&`${t}`.toLowerCase()==="auto"?Vs:mh(t,e)}function Vs(t){return Ni(t)}function Uo(t={y:"count"},e={}){[t,e]=L4(t,e);let{x:n,y:r}=e;return k4(kb(n,e,W),null,null,r,t,lc(e))}function jo(t={x:"count"},e={}){[t,e]=L4(t,e);let{x:n,y:r}=e;return k4(null,kb(r,e,W),n,null,t,pc(e))}function Xi(t={fill:"count"},e={}){[t,e]=L4(t,e);let{x:n,y:r}=cQ(e);return k4(n,r,null,null,t,lc(pc(e)))}function b$(t,e,n={}){if(n?.interval==null)return n;let{reduce:r=z1}=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 Iu(t={}){return b$(Uo,"y",Jr(t,"x"))}function Nu(t={}){return b$(jo,"x",Jr(t,"y"))}function k4(t,e,n,r,{data:o=B1,filter:i=Vd,sort:s,reverse:a,...c}={},f={}){t=g$(t),e=g$(e),c=fQ(c,f),o=_$(o,W),s=s==null?void 0:w$("sort",s,f),i=i==null?void 0:v$("filter",i,f),n!=null&&Fo(c,"x","x1","x2")&&(n=null),r!=null&&Fo(c,"y","y1","y2")&&(r=null);let[u,p]=fn(t),[l,d]=fn(t),[h,m]=fn(e),[x,g]=fn(e),[y,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=fn(y),{x:v,y:A,z:T,fill:E,stroke:N,x1:M,x2:k,y1:O,y2:S,domain:I,cumulative:C,thresholds:L,interval:D,...$}=f,[P,F]=fn(T),[q]=ce(E),[V]=ce(N),[K,et]=fn(q),[rt,j]=fn(V);return{..."z"in f&&{z:P||T},..."fill"in f&&{fill:K||E},..."stroke"in f&&{stroke:rt||N},...Ce($,(nt,Y,G)=>{let tt=sc(ut(nt,y),G?.[b]),B=ut(nt,T),_t=ut(nt,q),ct=ut(nt,V),Ct=Qd(c,{z:B,fill:_t,stroke:ct}),Lt=[],Z=[],jt=tt&&_([]),Qn=B&&F([]),ro=_t&&et([]),lq=ct&&j([]),w7=t&&p([]),pq=t&&d([]),v7=e&&m([]),dq=e&&g([]),hq=pQ(t,e,nt),mq=0;for(let $c of c)$c.initialize(nt);s&&s.initialize(nt),i&&i.initialize(nt);for(let $c of Y){let _7=[];for(let Dc of c)Dc.scope("facet",$c);s&&s.scope("facet",$c),i&&i.scope("facet",$c);for(let[Dc,xq]of Po($c,Ct))for(let[gq,Em]of Po(xq,tt))for(let[oo,Jo]of hq(Em))if(Ct&&(Jo.z=Dc),!(i&&!i.reduce(oo,Jo))){_7.push(mq++),Z.push(o.reduceIndex(oo,nt,Jo)),tt&&jt.push(gq),B&&Qn.push(Ct===B?Dc:B[(oo.length>0?oo:Em)[0]]),_t&&ro.push(Ct===_t?Dc:_t[(oo.length>0?oo:Em)[0]]),ct&&lq.push(Ct===ct?Dc:ct[(oo.length>0?oo:Em)[0]]),w7&&(w7.push(Jo.x1),pq.push(Jo.x2)),v7&&(v7.push(Jo.y1),dq.push(Jo.y2));for(let yq of c)yq.reduce(oo,Jo);s&&s.reduce(oo,Jo)}Lt.push(_7)}return DS(Lt,s,a),{data:Z,facets:Lt}}),...!Fo(c,"x")&&(u?{x1:u,x2:l,x:ou(u,l)}:{x:v,x1:M,x2:k}),...!Fo(c,"y")&&(h?{y1:h,y2:x,y:ou(h,x)}:{y:A,y1:O,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:nt,output:Y})=>[nt,Y]))}}function L4({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function kb(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return t={...$r(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=R4(t.thresholds,t.interval),t}function cQ(t){let{x:e,y:n}=t;return e=kb(e,t),n=kb(n,t),[e.value,n.value]=me(e.value,n.value),{x:e,y:n}}function g$(t){if(t==null)return;let{value:e,cumulative:n,domain:r=Ft,thresholds:o}=t,i=s=>{let a=ut(s,e),c;if(fe(a)||lQ(o)){a=Et(a,yS,Float64Array);let[u,p]=typeof r=="function"?r(a):r,l=typeof o=="function"&&!ks(o)?o(a,u,p):o;typeof l=="number"&&(l=hd(u,p,l)),ks(l)&&(r===Ft&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p))),c=l}else{a=Ne(a);let[u,p]=typeof r=="function"?r(a):r,l=typeof o=="function"&&!ks(o)?o(a,u,p):o;if(typeof l=="number")if(r===Ft){let d=li(u,p,l);if(isFinite(d))if(d>0){let h=Math.round(u/d),m=Math.round(p/d);h*d<=u||--h,m*d>p||++m;let x=m-h+1;l=new Float64Array(x);for(let g=0;g<x;++g)l[g]=(h+g)*d}else if(d<0){d=-d;let h=Math.round(u*d),m=Math.round(p*d);h/d<=u||--h,m/d>p||++m;let x=m-h+1;l=new Float64Array(x);for(let g=0;g<x;++g)l[g]=(h+g)/d}else l=[u];else l=[u]}else l=on(u,p,l);else ks(l)&&(r===Ft&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p)));c=l}let f=[];if(c.length===1)f.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)f.push([c[u-1],c[u]]);return f.bin=(n<0?hQ:n>0?dQ:O4)(f,c,a),f};return i.label=un(e),i}function R4(t,e,n=y$){if(t===void 0)return e===void 0?n:$o(e);if(typeof t=="string"){switch(t.toLowerCase()){case"freedman-diaconis":return _x;case"scott":return fp;case"sturges":return cs;case"auto":return y$}return oc(t)}return t}function fQ(t,e){return OS(t,e,w$)}function w$(t,e,n){return F1(t,e,n,v$)}function v$(t,e,n){return q1(t,e,n,_$)}function _$(t,e){return cu(t,e,uQ)}function uQ(t){switch(`${t}`.toLowerCase()){case"x":return mQ;case"x1":return gQ;case"x2":return yQ;case"y":return xQ;case"y1":return bQ;case"y2":return wQ;case"z":return PS}throw new Error(`invalid bin reduce: ${t}`)}function y$(t,e,n){return Math.min(200,fp(t,e,n))}function lQ(t){return _L(t)||qn(t)&&fe(t)}function pQ(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 u=o.bin(s[a]);for(let[p,[l,d]]of o.entries())yield[u[p],{data:n,x1:c,y1:l,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 O4(t,e,n){return e=Ne(e),r=>{let o=t.map(()=>[]);for(let i of r)o[fi(e,n[i])-1]?.push(i);return o}}function dQ(t,e,n){let r=O4(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 u of c)f.push(u)}return i}}function hQ(t,e,n){let r=O4(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 S$(t,e){let n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}var mQ={reduceIndex(t,e,{x1:n,x2:r}){return S$(n,r)}},xQ={reduceIndex(t,e,{y1:n,y2:r}){return S$(n,r)}},gQ={reduceIndex(t,e,{x1:n}){return n}},yQ={reduceIndex(t,e,{x2:n}){return n}},bQ={reduceIndex(t,e,{y1:n}){return n}},wQ={reduceIndex(t,e,{y2:n}){return n}};var vQ={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},yc=class extends lt{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:vn(n),optional:!0}},n,vQ),this.z=a,this.curve=mh(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 ot("svg:g",i).call(wt,this,o,i).call(xt,this,n,0,0).call(u=>u.selectAll().data(nb(e,[s,a,c,f],this,r)).enter().append("path").call(ht,this).call(uc,this,r).attr("d",Wf().curve(this.curve).defined(p=>p>=0).x0(p=>s[p]).y0(p=>a[p]).x1(p=>c[p]).y1(p=>f[p]))).node()}};function xh(t,e){return e===void 0?Wi(t,{x:ic,y:Is}):new yc(t,e)}function Gs(t,e){let{y:n=Zt,...r}=Nu(e);return new yc(t,Xs(Us({...r,y1:n,y2:void 0})))}function Wi(t,e){let{x:n=Zt,...r}=Iu(e);return new yc(t,Ws(js({...r,x1:n,x2:void 0})))}var _Q={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},gh=class extends lt{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,_Q),this.curve=Cb(a,c),Kr(this,n)}project(e,n,r){this.curve!==Vs&&super.project(e,n,r)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r,{curve:u}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(p=>p.selectAll().data(e).enter().append("path").call(ht,this).attr("d",u===Vs&&i.projection?SQ(i.projection,s,a,c,f):l=>{let d=Ln(),h=u(d);return h.lineStart(),h.point(s[l],a[l]),h.point(c[l],f[l]),h.lineEnd(),d}).call(Tt,this,r).call(ji,this,r,i)).node()}};function SQ(t,e,n,r,o){let i=Ue(t);return e=Ne(e),n=Ne(n),r=Ne(r),o=Ne(o),s=>i({type:"LineString",coordinates:[[e[s],n[s]],[r[s],o[s]]]})}function Lb(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=yh(e,n,r),[i,s]=yh(o,i,s),new gh(t,{...a,x1:n,x2:r,y1:i,y2:s})}function yh(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 MQ={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},bh=class extends lt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,bend:a=0,headAngle:c=60,headLength:f=8,inset:u=0,insetStart:p=u,insetEnd:l=u,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,MQ),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+f,this.insetStart=+p,this.insetEnd=+l,this.sweep=AQ(d)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a,SW:u}=r,{strokeWidth:p,bend:l,headAngle:d,headLength:h,insetStart:m,insetEnd:x}=this,g=u?w=>u[w]:ue(p===void 0?1:p),y=d*gu/2,b=h/1.5;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(w=>w.selectAll().data(e).enter().append("path").call(ht,this).attr("d",_=>{let v=s[_],A=a[_],T=c[_],E=f[_],N=Math.hypot(T-v,E-A);if(N<=m+x)return null;let M=Math.atan2(E-A,T-v),k=Math.min(b*g(_),N/3),O=this.sweep(v,A,T,E)*l*gu,S=Math.hypot(N/Math.tan(O),N)/2;if(m||x)if(S<1e5){let K=Math.sign(O),[et,rt]=TQ([v,A],[T,E],S,K);if(m&&([v,A]=M$([et,rt,S],[v,A,m],-K*Math.sign(m))),x){let[j,nt]=M$([et,rt,S],[T,E,x],K*Math.sign(x));M+=Math.atan2(nt-rt,j-et)-Math.atan2(E-rt,T-et),T=j,E=nt}}else{let K=T-v,et=E-A,rt=Math.hypot(K,et);m&&(v+=K/rt*m,A+=et/rt*m),x&&(T-=K/rt*x,E-=et/rt*x)}let I=M+O,C=I+y,L=I-y,D=T-k*Math.cos(C),$=E-k*Math.sin(C),P=T-k*Math.cos(L),F=E-k*Math.sin(L),q=S<1e5?`A${S},${S} 0,0,${O>0?1:0} `:"L",V=k?`M${D},${$}L${T},${E}L${P},${F}`:"";return`M${v},${A}${q}${T},${E}${V}`}).call(Tt,this,r)).node()}};function AQ(t=1){if(typeof t=="number")return ue(Math.sign(t));if(typeof t=="function")return(e,n,r,o)=>Math.sign(t(e,n,r,o));switch(Oe(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(e,n,r)=>yt(e,r);case"-x":return(e,n,r)=>An(e,r);case"+y":return(e,n,r,o)=>yt(n,o);case"-y":return(e,n,r,o)=>An(n,o)}}function TQ([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 M$([t,e,n],[r,o,i],s){let a=r-t,c=o-e,f=Math.hypot(a,c),u=(a*a+c*c-i*i+n*n)/(2*f),p=s*Math.sqrt(n*n-u*u);return[t+(a*u+c*p)/f,e+(c*u-a*p)/f]}function A$(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=yh(e,n,r),[i,s]=yh(o,i,s),new bh(t,{...a,x1:n,x2:r,y1:i,y2:s})}var EQ={ariaLabel:"bar"},Cu=class extends lt{constructor(e,n,r={},o=EQ){super(e,n,r,o),ch(this,r),fh(this,r)}render(e,n,r,o,i){let{rx:s,ry:a,rx1y1:c,rx1y2:f,rx2y1:u,rx2y2:p}=this,l=this._x(n,r,o),d=this._y(n,r,o),h=this._width(n,r,o),m=this._height(n,r,o);return ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(x=>x.selectAll().data(e).enter().call(c||f||u||p?g=>g.append("path").call(ht,this).call(uh,l,d,T$(l,h),T$(d,m),this).call(Tt,this,r):g=>g.append("rect").call(ht,this).attr("x",l).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 T$(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 bc=class extends Cu{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(xt,n,{x:r},0,0)}_x({x:e},{x1:n,x2:r},{marginLeft:o}){let{insetLeft:i}=this;return lr(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 lr(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}},wc=class extends Cu{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(xt,n,{y:r},0,0)}_y({y:e},{y1:n,y2:r},{marginTop:o}){let{insetTop:i}=this;return lr(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 lr(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}};function Xo(t,e={}){return Oi(e)||(e={...e,y:Zt,x2:W}),new bc(t,Xs(yu(Us(e))))}function Wo(t,e={}){return Oi(e)||(e={...e,x:Zt,y2:W}),new wc(t,Ws(bu(js(e))))}var IQ={ariaLabel:"cell"},vc=class extends Cu{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,IQ)}_transform(e,n){e.call(xt,n,{},0,0)}};function Hs(t,{x:e,y:n,...r}={}){return[e,n]=me(e,n),new vc(t,{...r,x:e,y:n})}function E$(t,{x:e=Zt,fill:n,stroke:r,...o}={}){return n===void 0&&ce(r)[0]===void 0&&(n=W),new vc(t,{...o,x:e,fill:n,stroke:r})}function I$(t,{y:e=Zt,fill:n,stroke:r,...o}={}){return n===void 0&&ce(r)[0]===void 0&&(n=W),new vc(t,{...o,y:e,fill:n,stroke:r})}var NQ={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function wh(t){return t.sort===void 0&&t.reverse===void 0?D1({channel:"-r"},t):t}var _c=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i,rotate:s,symbol:a=Ci,frameAnchor:c}=n,[f,u]=Ut(s,0),[p,l]=DL(a),[d,h]=Ut(i,p==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:Pn,optional:!0},rotate:{value:f,optional:!0},symbol:{value:p,scale:"auto",optional:!0}},wh(n),NQ),this.r=h,this.rotate=u,this.symbol=l,this.frameAnchor=Do(c);let{channels:m}=this,{symbol:x}=m;if(x){let{fill:g,stroke:y}=m;x.hint={fill:g?g.value===x.value?"color":"currentColor":this.fill??"currentColor",stroke:y?y.value===x.value?"color":"currentColor":this.stroke??"none"}}}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,r:u,rotate:p,symbol:l}=r,{r:d,rotate:h,symbol:m}=this,[x,g]=Qe(this,o),y=m===Ci,b=u?void 0:d*d*Math.PI;return Ss(d)&&(e=[]),ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(w=>w.selectAll().data(e).enter().append(y?"circle":"path").call(ht,this).call(y?_=>{_.attr("cx",c?v=>c[v]:x).attr("cy",f?v=>f[v]:g).attr("r",u?v=>u[v]:d)}:_=>{_.attr("transform",to`translate(${c?v=>c[v]:x},${f?v=>f[v]:g})${p?v=>` rotate(${p[v]})`:h?` rotate(${h})`:""}`).attr("d",u&&l?v=>{let A=Ln();return l[v].draw(A,u[v]*u[v]*Math.PI),A}:u?v=>{let A=Ln();return m.draw(A,u[v]*u[v]*Math.PI),A}:l?v=>{let A=Ln();return l[v].draw(A,b),A}:(()=>{let v=Ln();return m.draw(v,b),v})())}).call(Tt,this,r)).node()}};function Pr(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new _c(t,{...r,x:e,y:n})}function N$(t,{x:e=W,...n}={}){return new _c(t,sb({...n,x:e}))}function C$(t,{y:e=W,...n}={}){return new _c(t,ib({...n,y:e}))}function k$(t,e){return Pr(t,{...e,symbol:"circle"})}function L$(t,e){return Pr(t,{...e,symbol:"hexagon"})}var CQ={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Sc=class extends lt{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:vn(n),optional:!0}},n,CQ),this.z=i,this.curve=Cb(s,a),Kr(this,n)}filter(e){return e}project(e,n,r){this.curve!==Vs&&super.project(e,n,r)}render(e,n,r,o,i){let{x:s,y:a}=r,{curve:c}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(f=>f.selectAll().data(nb(e,[s,a],this,r)).enter().append("path").call(ht,this).call(uc,this,r).call(cO,this,r,i).attr("d",c===Vs&&i.projection?kQ(i.projection,s,a):Sd().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function kQ(t,e,n){let r=Ue(t);return e=Ne(e),n=Ne(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 Mc(t,{x:e,y:n,...r}={}){return[e,n]=me(e,n),new Sc(t,{...r,x:e,y:n})}function Qs(t,{x:e=W,y:n=Zt,...r}={}){return new Sc(t,Nu({...r,x:e,y:n}))}function Zs(t,{x:e=Zt,y:n=W,...r}={}){return new Sc(t,Iu({...r,x:e,y:n}))}function D4(t,e){e=LQ(e);let{x:n,y:r,color:o,size:i}=e,s=Rb(t,n),a=Rb(t,r),c=Rb(t,o),f=Rb(t,i),{fx:u,fy:p,x:{value:l,reduce:d,zero:h,...m},y:{value:x,reduce:g,zero:y,...b},color:{value:w,color:_,reduce:v},size:{value:A,reduce:T},mark:E}=e;if(d===void 0&&(d=g==null&&l==null&&A==null&&x!=null?"count":null),g===void 0&&(g=d==null&&x==null&&A==null&&l!=null?"count":null),T===void 0&&A==null&&v==null&&d==null&&g==null&&(l==null||ie(s))&&(x==null||ie(a))&&(T="count"),h===void 0&&(h=Ob(d)?!0:void 0),y===void 0&&(y=Ob(g)?!0:void 0),l==null&&x==null)throw new Error("must specify x or y");if(d!=null&&x==null)throw new Error("reducing x requires y");if(g!=null&&l==null)throw new Error("reducing y requires x");E===void 0&&(E=A!=null||T!=null?"dot":Ob(d)||Ob(g)||v!=null?"bar":l!=null&&x!=null?ie(s)||ie(a)||d==null&&g==null&&!vh(s)&&!vh(a)?"dot":"line":l!=null||x!=null?"rule":null);let N,M,k;switch(E){case"dot":k=Pr,M="stroke";break;case"line":k=s&&a||d!=null||g!=null?y||g!=null||s&&vh(s)?Zs:h||d!=null||a&&vh(a)?Qs:Mc:s?Qs:Zs,M="stroke",O$(c)&&(N=null);break;case"area":k=!(y||g!=null)&&(h||d!=null||a&&vh(a))?Gs:Wi,M="fill",O$(c)&&(N=null);break;case"rule":k=s?pr:dr,M="stroke";break;case"bar":k=d!=null?ie(a)?R$(d)&&s&&ie(s)?Hs:Xo:Mu:g!=null?ie(s)?R$(g)&&a&&ie(a)?Hs:Wo:Au:v!=null||T!=null?s&&ie(s)&&a&&ie(a)?Hs:s&&ie(s)?Wo:a&&ie(a)?Xo:lh:s&&Di(s)&&!(a&&Di(a))?Xo:a&&Di(a)&&!(s&&Di(s))?Wo:Hs,M="fill";break;default:throw new Error(`invalid mark: ${E}`)}let O={fx:u,fy:p,x:s??void 0,y:a??void 0,[M]:c??_,z:N,r:f??void 0,tip:!0},S,I={[M]:v??void 0,r:T??void 0};if(d!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(I.y=g,S=ie(s)?Rs:Uo):d!=null?(I.x=d,S=ie(a)?Os:jo):(v!=null||T!=null)&&(s&&a?S=ie(s)&&ie(a)?Hd:ie(s)?jo:ie(a)?Uo:Xi:s?S=ie(s)?Rs:Uo:a&&(S=ie(a)?Os:jo)),(S===Xi||S===Uo)&&(O.x={value:s,...m}),(S===Xi||S===jo)&&(O.y={value:a,...b}),h===void 0&&(h=s&&!(S===Xi||S===Uo)&&(k===Xo||k===Gs||k===Mu||k===dr)),y===void 0&&(y=a&&!(S===Xi||S===jo)&&(k===Wo||k===Wi||k===Au||k===pr)),{fx:u??null,fy:p??null,x:{value:l??null,reduce:d??null,zero:!!h,...m},y:{value:x??null,reduce:g??null,zero:!!y,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:A??null,reduce:T??null},mark:E,markImpl:$$[k],markOptions:O,transformImpl:$$[S],transformOptions:I,colorMode:M}}function D$(t,e){let n=D4(t,e),{fx:r,fy:o,x:{zero:i},y:{zero:s},markOptions:a,transformOptions:c,colorMode:f}=n,u=$4[n.markImpl],p=$4[n.transformImpl],l=r!=null||o!=null?Tu({strokeOpacity:.1}):null,d=[i?pr([0]):null,s?dr([0]):null],h=u(t,p?p(c,a):a);return f==="stroke"?ke(l,d,h):ke(l,h,d)}function vh(t){let e,n;for(let r of t){if(r==null)continue;if(e===void 0){e=r;continue}let o=Math.sign(yt(e,r));if(o){if(n!==void 0&&o!==n)return!1;e=r,n=o}}return!0}function LQ({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}={}){return fr(t)||(t=ku(t)),fr(e)||(e=ku(e)),fr(n)||(n=Ls(n)?{color:n}:ku(n)),fr(r)||(r=ku(r)),fr(o)&&({value:o}=ku(o)),fr(i)&&({value:i}=ku(i)),s!=null&&(s=`${s}`.toLowerCase()),{x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}}function Rb(t,e){let n=ut(t,e.value);return n&&(n.label=un(e.value)),n}function ku(t){return RQ(t)?{reduce:t}:{value:t}}function Ob(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function R$(t){return/^(?:first|last|mode)$/i.test(t)}function RQ(t){if(t==null)return!1;if(typeof t.reduceIndex=="function"||typeof t.reduce=="function"&&Ve(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 O$(t){return t?new En(t).size>t.length>>1:!1}var $4={dot:Pr,line:Mc,lineX:Qs,lineY:Zs,areaX:Gs,areaY:Wi,ruleX:pr,ruleY:dr,barX:Xo,barY:Wo,rect:lh,rectX:Mu,rectY:Au,cell:Hs,bin:Xi,binX:Uo,binY:jo,group:Hd,groupX:Rs,groupY:Os},$$=Object.fromEntries(Object.entries($4).map(([t,e])=>[e,t]));function Lu(t,e={}){let{x:n,x1:r,x2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,x:n=W});let i={};return n!=null&&(i.x=t),r!=null&&(i.x1=t),o!=null&&(i.x2=t),Hn(i,e)}function Ru(t,e={}){let{y:n,y1:r,y2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,y:n=W});let i={};return n!=null&&(i.y=t),r!=null&&(i.y1=t),o!=null&&(i.y2=t),Hn(i,e)}function Hn(t={},e={}){let n=vn(e),r=Object.entries(t).map(([o,i])=>{let s=C1(o,e);if(s==null)throw new Error(`missing channel: ${o}`);let[a,c]=Ge(s);return{key:o,input:s,output:a,setOutput:c,map:OQ(i)}});return{...Ce(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 u of s?rn(f,p=>s[p]).values():[f])r.forEach(({map:p},l)=>p.mapIndex(u,a[l],c[l]));return{data:o,facets:i}}),...Object.fromEntries(r.map(({key:o,output:i})=>[o,i]))}}function OQ(t){if(t==null)throw new Error("missing map");if(typeof t.mapIndex=="function")return t;if(typeof t.map=="function"&&Ve(t))return $Q(t);if(typeof t=="function")return P4(ru(t));switch(`${t}`.toLowerCase()){case"cumsum":return PQ;case"rank":return P4((e,n)=>up(e,r=>n[r]));case"quantile":return P4((e,n)=>DQ(e,r=>n[r]))}throw new Error(`invalid map: ${t}`)}function $Q(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}function DQ(t,e){let n=po(t,e)-1;return up(t,e).map(r=>r/n)}function P4(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 PQ={mapIndex(t,e,n){let r=0;for(let o of t)n[o]=r+=e[o]}};function P$(t={},e){return arguments.length===1&&(e=t),Lu(Ou(t),e)}function F$(t={},e){return arguments.length===1&&(e=t),Ru(Ou(t),e)}function Ou(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=qQ(r),_n(`Warning: the shift option is deprecated; please use anchor "${o}" instead.`)),!((e=Math.floor(e))>0))throw new Error(`invalid k: ${e}`);return BQ(n)(e,FQ(o,e),i)}function FQ(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 qQ(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}function BQ(t="mean"){if(typeof t=="string"){if(/^p\d{2}$/i.test(t))return $b(nu(t));switch(t.toLowerCase()){case"deviation":return $b(Mr);case"max":return Db((e,n)=>kt(e,r=>n[r]));case"mean":return zQ;case"median":return $b(Vr);case"min":return Db((e,n)=>It(e,r=>n[r]));case"mode":return Db((e,n)=>lf(e,r=>n[r]));case"sum":return q$;case"variance":return $b(as);case"difference":return jQ;case"ratio":return XQ;case"first":return WQ;case"last":return VQ}}if(typeof t!="function")throw new Error(`invalid reduce: ${t}`);return Db(ru(t))}function $b(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,u=o.length-e+1;f<u;++f)isNaN(a(f+e-1))&&++c,s[o[f+n]]=c===0?t($i(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($i(o,0,c+e),a);for(let c=0,f=o.length-n;c<f;++c)s[o[c+n]]=t($i(o,c,c+e),a)}}}function Db(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=0;for(let c=0;c<e-1;++c)a+=oe(i[o[c]]);for(let c=0,f=o.length-e+1;c<f;++c)a+=oe(i[o[c+e-1]]),a===e&&(s[o[c+n]]=t($i(o,c,c+e),i)),a-=oe(i[o[c]])}}:{mapIndex(o,i,s){for(let a=-n;a<0;++a)s[o[a+n]]=t($i(o,0,a+e),i);for(let a=0,c=o.length-n;a<c;++a)s[o[a+n]]=t($i(o,a,a+e),i)}}}function q$(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 u=o[r[c]],p=o[r[c+t-1]];p===null||isNaN(p)?++s:a+=+p,i[r[c+e]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{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 zQ(t,e,n){if(n){let r=q$(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,u=Math.min(c,t-e-1);f<u;++f){let p=o[r[f]];p!==null&&!isNaN(p=+p)&&(s+=p,++a)}for(let f=-e,u=c-e;f<u;++f){let p=o[r[f+t-1]],l=o[r[f]];p!==null&&!isNaN(p=+p)&&(s+=p,++a),i[r[f+e]]=s/a,l!==null&&!isNaN(l=+l)&&(s-=l,--a)}}}}function YQ(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(oe(i))return i}}function UQ(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(oe(i))return i}}function B$(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 z$(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 jQ(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]]=z$(o,r,s,t)-B$(o,r,s,t)}}}function XQ(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]]=z$(o,r,s,t)/B$(o,r,s,t)}}}function WQ(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]]=YQ(o,r,s,t)}}}function VQ(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]]=UQ(o,r,s,t)}}}var Vi={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Y$(t,{x:e=W,y:n,k:r=Vi.k,color:o=Vi.color,opacity:i=Vi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:u,...p}={}){return ke(zt(s)?null:Gs(t,Hn({x1:Js({k:-r,...p}),x2:Js({k:r,...p})},{x1:e,x2:e,y:n,fill:s,fillOpacity:a,...p})),zt(c)?null:Qs(t,Hn({x:Js(p)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:u,...p})))}function U$(t,{x:e,y:n=W,k:r=Vi.k,color:o=Vi.color,opacity:i=Vi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:u,...p}={}){return ke(zt(s)?null:Wi(t,Hn({y1:Js({k:-r,...p}),y2:Js({k:r,...p})},{x:e,y1:n,y2:n,fill:s,fillOpacity:a,...p})),zt(c)?null:Zs(t,Hn({y:Js(p)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:u,...p})))}function Js({n:t=Vi.n,k:e=0,strict:n=Vi.strict,anchor:r=Vi.anchor}={}){return Ou({k:t,reduce:o=>pi(o)+e*(Mr(o)||0),strict:n,anchor:r})}var GQ={ariaLabel:"tick",fill:null,stroke:"currentColor"},Pb=class extends lt{constructor(e,n,r){super(e,n,r,GQ),Kr(this,r)}render(e,n,r,o,i){return ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(s=>s.selectAll().data(e).enter().append("line").call(ht,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(ji,this,r,i)).node()}},_h=class extends Pb{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=Dt(s),this.insetBottom=Dt(a)}_transform(e,n,{x:r}){e.call(xt,n,{x:r},le,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}},Sh=class extends Pb{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=Dt(s),this.insetLeft=Dt(a)}_transform(e,n,{y:r}){e.call(xt,n,{y:r},0,le)}_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 Fb(t,{x:e=W,...n}={}){return new _h(t,{...n,x:e})}function qb(t,{y:e=W,...n}={}){return new Sh(t,{...n,y:e})}function j$(t,{x:e=W,y:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...u}={}){let p=n!=null?Os:Gd;return ke(dr(t,p({x1:F4,x2:q4},{x:e,y:n,stroke:s,strokeOpacity:a,...u})),Xo(t,p({x1:"p25",x2:"p75"},{x:e,y:n,fill:o,fillOpacity:i,...u})),Fb(t,p({x:"p50"},{x:e,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...u})),Pr(t,Hn({x:W$},{x:e,y:n,z:n,r,stroke:s,strokeOpacity:a,...u})))}function X$(t,{y:e=W,x:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...u}={}){let p=n!=null?Rs:Gd;return ke(pr(t,p({y1:F4,y2:q4},{x:n,y:e,stroke:s,strokeOpacity:a,...u})),Wo(t,p({y1:"p25",y2:"p75"},{x:n,y:e,fill:o,fillOpacity:i,...u})),qb(t,p({y:"p50"},{x:n,y:e,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...u})),Pr(t,Hn({y:W$},{x:n,y:e,z:n,r,stroke:s,strokeOpacity:a,...u})))}function W$(t){let e=F4(t),n=q4(t);return t.map(r=>r<e||r>n?r:NaN)}function F4(t){let e=V$(t)*2.5-G$(t)*1.5;return It(t,n=>n>=e?n:NaN)}function q4(t){let e=G$(t)*2.5-V$(t)*1.5;return kt(t,n=>n<=e?n:NaN)}function V$(t){return In(t,.25)}function G$(t){return In(t,.75)}var HQ={ariaLabel:"raster",stroke:null,pixelSize:1};function $u(t,e){let n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function H$(t,e){let n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}var Ah=class extends lt{constructor(e,n,r={},o){let{width:i,height:s,x:a,y:c,x1:f=a==null?0:void 0,y1:u=c==null?0:void 0,x2:p=a==null?i:void 0,y2:l=c==null?s:void 0,pixelSize:d=o.pixelSize,blur:h=0,interpolate:m}=r;if(i!=null&&(i=H$(i,"width")),s!=null&&(s=H$(s,"height")),f!=null&&(f=$u(f,"x1")),u!=null&&(u=$u(u,"y1")),p!=null&&(p=$u(p,"x2")),l!=null&&(l=$u(l,"y2")),a==null&&(f==null||p==null))throw new Error("missing x");if(c==null&&(u==null||l==null))throw new Error("missing y");e!=null&&i!=null&&s!=null&&(a===void 0&&f!=null&&p!=null&&(a=rZ(f,p,i,s)),c===void 0&&u!=null&&l!=null&&(c=oZ(u,l,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:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:p==null?null:[p],scale:"x",optional:!0,filter:null},y2:{value:l==null?null:[l],scale:"y",optional:!0,filter:null},...n},r,o),this.width=i,this.height=s,this.pixelSize=$u(d,"pixelSize"),this.blur=$u(h,"blur"),this.interpolate=a==null||c==null?null:QQ(m)}},Th=class extends Ah{constructor(e,n={}){let{imageRendering:r}=n;if(e==null){let{fill:o,fillOpacity:i}=n;Ut(i)[0]!==void 0&&(n=Bb("fillOpacity",n)),ce(o)[0]!==void 0&&(n=Bb("fill",n))}super(e,void 0,n,HQ),this.imageRendering=te(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,[u,p,l,d]=Z$(r,o,i),h=l-u,m=d-p,{pixelSize:x,width:g=Math.round(Math.abs(h)/x),height:y=Math.round(Math.abs(m)/x)}=this,b=g*y,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let I=g/h,C=y/m,L=Et(a,$=>($-u)*I,Float64Array),D=Et(c,$=>($-p)*C,Float64Array);w&&(w=this.interpolate(e,g,y,L,D,w)),_&&(_=this.interpolate(e,g,y,L,D,_))}else this.data==null&&e&&(v=e.fi*b);let A=f.createElement("canvas");A.width=g,A.height=y;let T=A.getContext("2d"),E=T.createImageData(g,y),N=E.data,{r:M,g:k,b:O}=Le(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 L=s(w[I+v]);if(L==null){N[C+3]=0;continue}({r:M,g:k,b:O}=Le(L))}_&&(S=_[I+v]*255),N[C+0]=M,N[C+1]=k,N[C+2]=O,N[C+3]=S}return this.blur>0&&a_(E,this.blur),T.putImageData(E,0,0),ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(I=>I.append("image").attr("transform",`translate(${u},${p}) scale(${Math.sign(l-u)},${Math.sign(d-p)})`).attr("width",Math.abs(h)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(at,"image-rendering",this.imageRendering).call(ht,this).attr("xlink:href",A.toDataURL())).node()}};function B4(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&&ML(e)&&(r=ic,o=Is,i===void 0&&(i=wL)),[e,{...s,x:r,y:o,[t]:i}]}function Q$(){let[t,e]=B4("fill",...arguments);return new Th(t,t==null||e.fill!==void 0||e.fillOpacity!==void 0?e:{...e,fill:W})}function Z$({x1:t,y1:e,x2:n,y2:r},o,{projection:i}){let{width:s,height:a,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p}=o;return[t&&i==null?t[0]:p,e&&i==null?e[0]:c,n&&i==null?n[0]:s-f,r&&i==null?r[0]:a-u]}function z4({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),Z$(uu(a,o),i,s)}function Bb(t,e={}){let{[t]:n}=e;if(typeof n!="function")throw new Error(`invalid ${t}: not a function`);return Kt({...e,[t]:void 0},function(r,o,i,s,a,c){let{x:f,y:u}=s;if(!f)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[p,l,d,h]=z4(i,s,a,c),m=d-p,x=h-l,{pixelSize:g}=this,{width:y=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(x)/g)}=e,w=new Array(y*b*(o?o.length:1)),_=m/y,v=x/b,A=0;for(let T of o??[void 0])for(let E=.5;E<b;++E)for(let N=.5;N<y;++N,++A)w[A]=n(f.invert(p+N*_),u.invert(l+E*v),T);return{data:w,facets:o,channels:{[t]:{value:w,scale:"auto"}}}})}function QQ(t){if(typeof t=="function")return t;if(t==null)return zb;switch(`${t}`.toLowerCase()){case"none":return zb;case"nearest":return Ih;case"barycentric":return Eh();case"random-walk":return Nh()}throw new Error(`invalid interpolate: ${t}`)}function zb(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 Eh({random:t=Wa(42)}={}){return(e,n,r,o,i,s)=>{let{points:a,triangles:c,hull:f}=Er.from(e,d=>o[d],d=>i[d]),u=new s.constructor(n*r).fill(NaN),p=new Uint8Array(n*r),l=nZ(s,t);for(let d=0;d<c.length;d+=3){let h=c[d],m=c[d+1],x=c[d+2],g=a[2*h],y=a[2*m],b=a[2*x],w=a[2*h+1],_=a[2*m+1],v=a[2*x+1],A=Math.min(g,y,b),T=Math.max(g,y,b),E=Math.min(w,_,v),N=Math.max(w,_,v),M=(_-v)*(g-b)+(w-v)*(b-y);if(!M)continue;let k=s[e[h]],O=s[e[m]],S=s[e[x]];for(let I=Math.floor(A);I<T;++I)for(let C=Math.floor(E);C<N;++C){if(I<0||I>=n||C<0||C>=r)continue;let L=I+.5,D=C+.5,$=Math.sign(M),P=(_-v)*(L-b)+(D-v)*(b-y);if(P*$<0)continue;let F=(v-w)*(L-b)+(D-v)*(g-b);if(F*$<0)continue;let q=M-(P+F);if(q*$<0)continue;let V=I+n*C;u[V]=l(k,P/M,O,F/M,S,q/M,I,C),p[V]=1}}return ZQ(u,p,o,i,s,n,r,f,e,l),u}}function ZQ(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 u=n.length,p=Array.from({length:u},(d,h)=>KQ(h,n,r)),l=0;for(let d=0;d<s;++d){let h=d+.5;for(let m=0;m<i;++m){let x=m+i*d;if(!e[x]){let g=m+.5;for(let y=0;y<u;++y){let b=(u+l+(y%2?(y+1)/2:-y/2))%u;if(p[b](g,h)){let w=JQ(n.at(b-1),r.at(b-1),n[b],r[b],g,h);t[x]=f(o.at(b-1),w,o[b],1-w,o[b],0,m,d),l=b;break}}}}}}function JQ(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 Mh(t,e,n,r){return t*r-n*e}function KQ(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],u=e.at(t+1-r),p=n.at(t+1-r),l=s-c,d=a-f,h=o-s,m=i-a,x=c-u,g=f-p,y=Math.hypot(l,d),b=Math.hypot(h,m),w=Math.hypot(x,g);return(_,v)=>{let A=_-s,T=v-a,E=_-c,N=v-f;return Mh(A,T,E,N)>-1e-6&&Mh(A,T,l,d)*b-Mh(A,T,h,m)*y>-1e-6&&Mh(E,N,x,g)*y-Mh(E,N,l,d)*w<=0}}function Ih(t,e,n,r,o,i){let s=new i.constructor(e*n),a=Er.from(t,u=>r[u],u=>o[u]),c,f;for(let u=.5,p=0;u<n;++u){f=c;for(let l=.5;l<e;++l,++p)f=a.find(l,u,f),l===.5&&(c=f),s[p]=i[t[f]]}return s}function Nh({random:t=Wa(42),minDistance:e=.5,maxSteps:n=2}={}){return(r,o,i,s,a,c)=>{let f=new c.constructor(o*i),u=Er.from(r,h=>s[h],h=>a[h]),p,l,d;for(let h=.5,m=0;h<i;++h){l=p;for(let x=.5;x<o;++x,++m){let g=x,y=h;d=l=u.find(g,y,l),x===.5&&(p=l);let b,w=0;for(;(b=Math.hypot(s[r[d]]-g,a[r[d]]-y))>e&&w<n;){let _=t(x,h,w)*2*Math.PI;g+=Math.cos(_)*b,y+=Math.sin(_)*b,d=u.find(g,y,d),++w}f[m]=c[r[d]]}}return f}}function tZ(t,e,n,r,o,i){return e*t+r*n+i*o}function eZ(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 nZ(t,e){return Di(t)||fe(t)?tZ:eZ(e)}function rZ(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 oZ(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 J$={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Ch=class extends Ah{constructor(e,{smooth:n=!0,value:r,...o}={}){let i=eb({},o,J$);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:un(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=Bb("value",{value:r,...o}),r=null}else{let{interpolate:a}=o;r===void 0&&(r=W),a===void 0&&(o.interpolate="nearest")}super(e,{value:{value:r,optional:!0}},iZ(o),J$);let s={geometry:{value:W}};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=Ue();return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(c=>{c.selectAll().data(e).enter().append("path").call(ht,this).attr("d",f=>a(s[f])).call(Tt,this,r)}).node()}};function iZ({thresholds:t,interval:e,...n}){return t=R4(t,e,cs),Kt(n,function(r,o,i,s,a,c){let[f,u,p,l]=z4(i,s,a,c),d=p-f,h=l-u,{pixelSize:m,width:x=Math.round(Math.abs(d)/m),height:g=Math.round(Math.abs(h)/m)}=this,y=x/d,b=g/h,w=i.value.value,_=[];if(this.interpolate){let{x:N,y:M}=Bo(i,s,c),k=Et(N,C=>(C-f)*y,Float64Array),O=Et(M,C=>(C-u)*b,Float64Array),S=[i.x,i.y,i.value],I=[k,O,w];for(let C of o){let L=this.filter(C,S,I);_.push(this.interpolate(L,x,g,k,O,w))}}else if(o){let N=x*g,M=o.length;for(let k=0;k<M;++k)_.push(w.slice(k*N,k*N+N))}else _.push(w);if(this.blur>0)for(let N of _)ip({data:N,width:x,height:g},this.blur);let v=sZ(t,w,...aZ(_));if(v===null)throw new Error(`unsupported thresholds: ${t}`);let{contour:A}=ms().size([x,g]).smooth(this.smooth),T=[],E=[];for(let N of _)E.push(ye(T.length,T.push(...Et(v,M=>A(N,M)))));for(let{coordinates:N}of T)for(let M of N)for(let k of M)for(let O of k)O[0]=O[0]/y+f,O[1]=O[1]/b+u;return{data:T,facets:E,channels:Y1(this.contourChannels,T)}})}function sZ(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 cr(t);let o=on(...ff(n,r,t),t);for(;o[o.length-1]>=r;)o.pop();for(;o[1]<n;)o.shift();return o}function tD(){return new Ch(...B4("value",...arguments))}function aZ(t){return[It(t,e=>It(e,K$)),kt(t,e=>kt(e,K$))]}function K$(t){return isFinite(t)?t:NaN}function rD(t,e){return Y4(Bs,t,e)}function oD(t,e={}){return Y4(zs,t,e)}function iD(t,e={}){return Y4(Ui,t,e)}function Y4(t,e,n={}){let{x:r,y:o,maxRadius:i}=n,s=t({px:r,py:o,maxRadius:i}),a=[];r!=null&&a.push(pr(e,eD("x",{...s,inset:-6},n))),o!=null&&a.push(dr(e,eD("y",{...s,inset:-6},n))),r!=null&&a.push(Yo(e,nD("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),o!=null&&a.push(Yo(e,nD("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return ke(...a)}function sD(t,{channels:e,...n},{facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:c,transform:f,initializer:u}){return{...n,facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:{...e,...c},transform:f,initializer:cZ(t,u)}}function cZ(t,e){return e==null?e:function(n,r,{x:o,y:i,px:s,py:a,...c},...f){let{channels:{x:u,y:p,...l}={},...d}=e.call(this,n,r,{...c,x:s,y:a},...f);return{channels:{...l,...u&&{px:u,...t==="x"&&{x:u}},...p&&{py:p,...t==="y"&&{y:p}}},...d}}}function eD(t,e,n){let{color:r="currentColor",opacity:o=.2,ruleStroke:i=r,ruleStrokeOpacity:s=o,ruleStrokeWidth:a}=n;return{...sD(t,e,n),stroke:i,strokeOpacity:s,strokeWidth:a}}function nD(t,e,n){let{color:r="currentColor",textFill:o=r,textFillOpacity:i,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...sD(t,e,fZ(t,n)),fill:o,fillOpacity:i,stroke:s,strokeOpacity:a,strokeWidth:c}}function fZ(t,e){return Kt(e,(n,r,o)=>({channels:{text:{value:Zd(o,t)?.value}}}))}var uZ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},lZ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},pZ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},dZ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},hZ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},U4=class extends lt{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,uZ),this.curve=mh(s,a),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:u}=r,{curve:p}=this,[l,d]=Qe(this,o),h=c?y=>c[y]:ue(l),m=f?y=>f[y]:ue(d),x=this;function g(y){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],A=[],T=[],E=[];function N(S,I){S=y[S],I=y[I],w.push(++b),v[b]=h(S),T[b]=m(S),A[b]=h(I),E[b]=m(I);for(let C in r)_[C].push(r[C][I])}let{halfedges:M,hull:k,triangles:O}=Er.from(y,h,m);for(let S=0;S<M.length;++S){let I=M[S];I>S&&N(O[S],O[I])}for(let S=0;S<k.length;++S)N(k[S],k[(S+1)%k.length]);Nt(this).selectAll().data(w).enter().append("path").call(ht,x).attr("d",S=>{let I=Ln(),C=p(I);return C.lineStart(),C.point(v[S],T[S]),C.point(A[S],E[S]),C.lineEnd(),I}).call(Tt,x,_).call(ji,x,_,i)}return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(u?y=>y.selectAll().data(rn(e,b=>u[b]).values()).enter().append("g").each(g):y=>y.datum(e).each(g)).node()}},kh=class extends lt{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:u}=r,[p,l]=Qe(this,o),d=c?g=>c[g]:ue(p),h=f?g=>f[g]:ue(l),m=this;function x(g){let y=Er.from(g,d,h);Nt(this).append("path").datum(g[0]).call(ht,m).attr("d",m._render(y,o)).call(Tt,m,r)}return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(u?g=>g.selectAll().data(rn(e,y=>u[y]).values()).enter().append("g").each(x):g=>g.datum(e).each(x)).node()}},j4=class extends kh{constructor(e,n={}){super(e,n,lZ),this.fill="none"}_render(e){return e.render()}},X4=class extends kh{constructor(e,n={}){super(e,n,pZ,vn)}_render(e){return e.renderHull()}},W4=class extends lt{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}},Kt(n,function(s,a,c,f,u,p){let{x:l,y:d,z:h}=c;({x:l,y:d}=Bo(c,f,p)),h=h?.value;let m=new Array((l??d).length).fill(null),[x,g]=Qe(this,u),y=l?w=>l[w]:ue(x),b=d?w=>d[w]:ue(g);for(let w of a){l&&(w=w.filter(_=>oe(y(_)))),d&&(w=w.filter(_=>oe(b(_))));for(let[,_]of Po(w,h)){let v=Er.from(_,y,b),A=aD(v,u);for(let T=0,E=_.length;T<E;++T)m[_[T]]=A.renderCell(T)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),dZ)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,cells:u}=r;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(p=>{p.selectAll().data(e).enter().append("path").call(ht,this).attr("d",l=>u[l]).call(Tt,this,r)}).node()}},V4=class extends kh{constructor(e,n){super(e,n,hZ),this.fill="none"}_render(e,n){return aD(e,n).render()}};function aD(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 Lh(t,e,{x:n,y:r,...o}={}){return[n,r]=me(n,r),new t(e,{...o,x:n,y:r})}function cD(t,e){return Lh(U4,t,e)}function fD(t,e){return Lh(j4,t,e)}function uD(t,e){return Lh(X4,t,e)}function lD(t,{x:e,y:n,initializer:r,...o}={}){return Lh(W4,t,{...Ce({...o,x:e,y:n},vb),initializer:r})}function pD(t,e){return Lh(V4,t,e)}var mZ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Rh=class extends lt{constructor(e,{x:n,y:r,z:o,weight:i,fill:s,stroke:a,...c}={}){let f=dD(s)&&(s="currentColor",!0),u=dD(a)&&(a="currentColor",!0);super(e,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:vn({z:o,fill:s,stroke:a}),optional:!0},weight:{value:i,optional:!0}},gZ({...c,fill:s,stroke:a},f,u),mZ),f&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=o}filter(e){return e}render(e,n,r,o,i){let{contours:s}=r,a=Ue();return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{}).call(c=>c.selectAll().data(e).enter().append("path").call(ht,this).call(Tt,this,r).attr("d",f=>a(s[f]))).node()}};function hD(t,{x:e,y:n,...r}={}){return[e,n]=me(e,n),new Rh(t,{...r,x:e,y:n})}var xZ=new Set(["x","y","z","weight"]);function gZ(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"?Ne(i):+i,Kt(t,function(s,a,c,f,u,p){let l=c.weight?Ne(c.weight.value):null,d=c.z?.value,{z:h}=this,[m,x]=Qe(this,u),{width:g,height:y}=u,{x:b,y:w}=Bo(c,f,p),_=Object.fromEntries(Object.entries(c).filter(([O])=>!xZ.has(O)).map(([O,S])=>[O,{...S,value:[]}])),v=e&&[],A=n&&[],T=H_().x(b?O=>b[O]:m).y(w?O=>w[O]:x).weight(l?O=>l[O]:1).size([g,y]).bandwidth(o),E=[];for(let O of a){let S=[];E.push(S);for(let I of d?nh(O,d,h):[O]){let C=T.contours(I);S.push([I,C])}}let N=i;if(!(N instanceof Ud)){let O=0;for(let S of E)for(let[,I]of S){let C=I.max;C>O&&(O=C)}N=Float64Array.from({length:i-1},(S,I)=>O*100*(I+1)/i)}let M=[],k=[];for(let O of E){let S=[];M.push(S);for(let[I,C]of O)for(let L of N){S.push(k.length),k.push(C(L/100)),v&&v.push(L),A&&A.push(L);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 dD(t){return/^density$/i.test(t)}function gD(t,e){return bD("x",t,e)}function yD(t,e){return bD("y",t,e)}function bD(t,e,{x1:n,x2:r,y1:o,y2:i,x:s=n===void 0&&r===void 0?t==="y"?Zt:W:void 0,y:a=o===void 0&&i===void 0?t==="x"?Zt:W:void 0,fill:c,positiveFill:f="#3ca951",negativeFill:u="#4269d0",fillOpacity:p=1,positiveFillOpacity:l=p,negativeFillOpacity:d=p,stroke:h,strokeOpacity:m,z:x=ce(h)[0],clip:g,tip:y,render:b,...w}={}){return[n,r]=mD(s,n,r),[o,i]=mD(a,o,i),n===r&&o===i&&(t==="y"?o=Gi(0):n=Gi(0)),{tip:y}=Jr({tip:y},t==="y"?"x":"y"),ke(zt(f)?null:Object.assign(xh(e,{x1:n,x2:r,y1:o,y2:i,z:x,fill:f,fillOpacity:l,render:Yi(b,xD(t,!0)),clip:g,...w}),{ariaLabel:"positive difference"}),zt(u)?null:Object.assign(xh(e,{x1:n,x2:r,y1:o,y2:i,z:x,fill:u,fillOpacity:d,render:Yi(b,xD(t,!1)),clip:g,...w}),{ariaLabel:"negative difference"}),Mc(e,{x:r,y:i,z:x,stroke:h,strokeOpacity:m,tip:y,clip:!0,...w}))}function mD(t,e,n){return e===void 0&&n===void 0?e=n=Gi(t):e===void 0?(n=Gi(n),e=t===void 0?n:Gi(t)):n===void 0?(e=Gi(e),n=t===void 0?e:Gi(t)):(e=Gi(e),n=Gi(n)),[e,n]}function Gi(t){let e,{value:n,label:r=un(n)}=$r(t);return{transform:o=>e||(e=ut(o,n)),label:r}}function xD(t,e){let n=t==="x"?"y":"x",r=`${n}1`,o=`${n}2`,i=`${t}1`,s=`${t}2`;return(a,c,f,u,p,l)=>{let{[r]:d,[o]:h}=f,m=new Float32Array(d.length),x=new Float32Array(h.length),g=u[t==="y"?"height":"width"];(e===W1(c[t])<0?m:x).fill(g);let y=l(a,c,{...f,[o]:d,[s]:x},u,p),b=l(a,c,{...f,[r]:h,[i]:m},u,p),w=y.querySelector("g")??y,_=b.querySelector("g")??b;for(let v=0;w.firstChild;v+=2){let A=c4(),T=ot("svg:clipPath",p).attr("id",A).node();T.appendChild(w.firstChild),_.childNodes[v].setAttribute("clip-path",`url(#${A})`),_.insertBefore(T,_.childNodes[v])}return b}}function Yb({geometry:t=W,...e}={}){let n=Fs(r=>ut(r,t));return Kt({...e,x:null,y:null,geometry:{transform:n}},(r,o,i,s,a,{projection:c})=>{let f=n(r),u=f.length,p=new Float64Array(u),l=new Float64Array(u),d=Ue(c);for(let h=0;h<u;++h)[p[h],l[h]]=d.centroid(f[h]);return{data:r,facets:o,channels:{x:{value:p,scale:c==null?"x":null,source:null},y:{value:l,scale:c==null?"y":null,source:null}}}})}function wD({geometry:t=W,...e}={}){let n=Fs(o=>ut(o,t)),r=Fs(o=>ut(n(o),l6));return{...e,x:{transform:o=>Float64Array.from(r(o),([i])=>i)},y:{transform:o=>Float64Array.from(r(o),([,i])=>i)},geometry:{transform:n}}}var yZ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Oh=class extends lt{constructor(e,n={}){let[r,o]=Ut(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:Pn,optional:!0},geometry:{value:n.geometry,scale:"projection"}},wh(n),yZ),this.r=o}render(e,n,r,o,i){let{geometry:s,r:a}=r,c=Ue(i.projection??bZ(n)),{r:f}=this;return Ss(f)?e=[]:f!==void 0&&c.pointRadius(f),ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(u=>{u.selectAll().data(e).enter().append("path").call(ht,this).attr("d",a?p=>c.pointRadius(a[p])(s[p]):p=>c(s[p])).call(Tt,this,r)}).node()}};function bZ({x:t,y:e}){if(t||e)return t??=n=>n,e??=n=>n,ja({point(n,r){this.stream.point(t(n),e(r))}})}function Ub(t,e={}){return e.tip&&e.x===void 0&&e.y===void 0?e=Yb(e):e.geometry===void 0&&(e={...e,geometry:W}),new Oh(t,e)}function vD({strokeWidth:t=1.5,...e}={}){return Ub({type:"Sphere"},{strokeWidth:t,...e})}function _D({strokeOpacity:t=.1,...e}={}){return Ub(g6(),{strokeOpacity:t,...e})}var Du=.5,Pu=0;function SD(t={fill:"count"},{binWidth:e,...n}={}){let{z:r}=n;return e=e===void 0?20:Dt(e),t=$S(t,n),Fo(t,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Fo(t,"r")&&(n.r=e/2),Kt(n,(o,i,s,a,c,f)=>{let{x:u,y:p,z:l,fill:d,stroke:h,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(p===void 0)throw new Error("missing channel: y");({x:u,y:p}=Bo(s,a,f)),l=l?l.value:ut(o,r),d=d?.value,h=h?.value,m=m?.value;let x=Qd(t,{z:l,fill:d,stroke:h,symbol:m}),g=l&&[],y=d&&[],b=h&&[],w=m&&[],_=[],v=[],A=[],T=-1;for(let k of t)k.initialize(o);for(let k of i){let O=[];for(let S of t)S.scope("facet",k);for(let[S,I]of Po(k,x))for(let{index:C,extent:L}of wZ(o,I,u,p,e)){O.push(++T),v.push(L.x),A.push(L.y),l&&g.push(x===l?S:l[C[0]]),d&&y.push(x===d?S:d[C[0]]),h&&b.push(x===h?S:h[C[0]]),m&&w.push(x===m?S:m[C[0]]);for(let D of t)D.reduce(C,L)}_.push(O)}let E=s.x.scale,N=s.y.scale,M={x:{value:v,source:a[E]?{value:Et(v,a[E].invert),scale:E}:null},y:{value:A,source:a[N]?{value:Et(A,a[N].invert),scale:N}:null},...l&&{z:{value:g}},...d&&{fill:{value:y,scale:"auto"}},...h&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(t.map(({name:k,output:O})=>[k,{scale:"auto",label:O.label,radius:k==="r"?e/2:void 0,value:O.transform()}]))};return{data:o,facets:_,channels:M}})}function wZ(t,e,n,r,o){let i=o*(1.5/AS),s=new Map;for(let a of e){let c=n[a],f=r[a];if(isNaN(c)||isNaN(f))continue;let u=Math.round(f=(f-Pu)/i),p=Math.round(c=(c-Du)/o-(u&1)/2),l=f-u;if(Math.abs(l)*3>1){let m=c-p,x=p+(c<p?-1:1)/2,g=u+(f<u?-1:1),y=c-x,b=f-g;m*m+l*l>y*y+b*b&&(p=x+(u&1?1:-1)/2,u=g)}let d=`${p},${u}`,h=s.get(d);h===void 0&&(h={index:[],extent:{data:t,x:(p+(u&1)/2)*o+Du,y:u*i+Pu}},s.set(d,h)),h.index.push(a)}return s.values()}var vZ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function MD(t){return new $h(t)}var $h=class extends lt{constructor({binWidth:e=20,clip:n=!0,...r}={}){super(Es,void 0,{clip:n,...r},vZ),this.binWidth=Dt(e)}render(e,n,r,o,i){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:f,marginLeft:u,width:p,height:l}=o,d=u-Du,h=p-c-Du,m=a-Pu,x=l-f-Pu,g=s/2,y=g*TS,b=y/2,w=g*2,_=y*1.5,v=Math.floor(d/w),A=Math.ceil(h/w),T=Math.floor((m+b)/_),E=Math.ceil((x-b)/_)+1,N=`m0,${Ks(-y)}l${Ks(g)},${Ks(b)}v${Ks(y)}l${Ks(-g)},${Ks(b)}`,M=N;for(let k=T;k<E;++k)for(let O=v;O<A;++O)M+=`M${Ks(O*w+(k&1)*g)},${Ks(k*_)}${N}`;return ot("svg:g",i).datum(0).call(wt,this,o,i).call(xt,this,{},le+Du,le+Pu).call(k=>k.append("path").call(ht,this).call(Tt,this,r).attr("d",M)).node()}};function Ks(t){return Math.round(t*1e3)/1e3}var _Z={ariaLabel:"image",fill:null,stroke:null};function SZ(t){return/^\.*\//.test(t)}function MZ(t){return/^(blob|data|file|http|https):/i.test(t)}function AZ(t){return typeof t=="string"&&(SZ(t)||MZ(t))?[void 0,t]:[t,void 0]}var Dh=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i,width:s,height:a,rotate:c,src:f,preserveAspectRatio:u,crossOrigin:p,frameAnchor:l,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]=AZ(f),[x,g]=Ut(i),[y,b]=Ut(s,g!==void 0?g*2:void 0),[w,_]=Ut(a,g!==void 0?g*2:void 0),[v,A]=Ut(c,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:x,scale:"r",filter:Pn,optional:!0},width:{value:y,filter:Pn,optional:!0},height:{value:w,filter:Pn,optional:!0},rotate:{value:v,optional:!0},src:{value:h,optional:!0}},wh(n),_Z),this.src=m,this.width=b,this.rotate=A,this.height=_,this.r=g,this.preserveAspectRatio=te(u,"xMidYMid"),this.crossOrigin=be(p),this.frameAnchor=Do(l),this.imageRendering=te(d,"auto")}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,width:u,height:p,r:l,rotate:d,src:h}=r,{r:m,width:x,height:g,rotate:y}=this,[b,w]=Qe(this,o);return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(_=>_.selectAll().data(e).enter().append("image").call(ht,this).attr("x",AD(c,u,l,b,x,m)).attr("y",AD(f,p,l,w,g,m)).attr("width",u?v=>u[v]:x!==void 0?x:l?v=>l[v]*2:m*2).attr("height",p?v=>p[v]:g!==void 0?g:l?v=>l[v]*2:m*2).attr("transform",d?v=>`rotate(${d[v]})`:y?`rotate(${y})`:null).attr("transform-origin",d||y?to`${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",l?v=>`circle(${l[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Tt,this,r)).node()}};function AD(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 TD(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new Dh(t,{...r,x:e,y:n})}function TZ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,u,p,l,d,h,m,x,g;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,u=Math.sqrt(-2*Math.log(f)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),x=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*x))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),u=Math.exp(e*a)/e,p=Math.exp(n*c)/n,x=u+p,t<u/x?d=Math.pow(e*x*t,1/e):d=1-Math.pow(n*x*(1-t),1/n)),g=-Fu(e)-Fu(n)+Fu(e+n);s<10;s++){if(d===0||d===1)return d;if(l=EZ(d,e,n)-t,u=Math.exp(o*Math.log(d)+i*Math.log(1-d)+g),p=l/u,d-=u=p/(1-.5*Math.min(1,p*(o/d-i/(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 EZ(t,e,n){var r=t===0||t===1?0:Math.exp(Fu(e+n)-Fu(e)-Fu(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?!1:t<(e+1)/(e+n+2)?r*ED(t,e,n)/e:1-r*ED(1-t,n,e)/n}function ED(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,u,p,l,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(u=2*o,p=o*(n-o)*t/((a+u)*(e+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,p=-(e+o)*(i+o)*t/((e+u)*(s+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,l=f*c,d*=l,!(Math.abs(l-1)<3e-7));o++);return d}function Fu(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 ID(t,e){var n=TZ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}var IZ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},jb=class extends lt{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:vn(n),optional:!0}},n,IZ),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 ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(u=>u.selectAll().data(c?nh(e,c,this.z):[e]).enter().call(p=>p.append("path").attr("fill","none").call(ht,this).call(uc,this,{...r,fill:null,fillOpacity:null}).attr("d",l=>this._renderLine(l,s,a)).call(f&&!Pi(this.fill)?l=>l.select(NZ).attr("stroke","none").call(ht,this).call(uc,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function NZ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Nn.svg,"path"),this)}var G4=class extends jb{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Ft(e,u=>r[u]),c=Xb(e,r,n),f=kD(e,r,n,(1-o)/2,c);return Wf().y(u=>u).x0(u=>f(u,-1)).x1(u=>f(u,1))(ye(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Ft(e,a=>r[a]),s=Xb(e,r,n);return`M${s(o)},${o}L${s(i)},${i}`}},H4=class extends jb{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Ft(e,u=>n[u]),c=Xb(e,n,r),f=kD(e,n,r,(1-o)/2,c);return Wf().x(u=>u).y0(u=>f(u,-1)).y1(u=>f(u,1))(ye(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Ft(e,a=>n[a]),s=Xb(e,n,r);return`M${o},${s(o)}L${i},${s(i)}`}};function ND(t,{y:e=Zt,x:n=W,stroke:r,fill:o=zt(r)?"currentColor":r,...i}={}){return new G4(t,Nu({...i,x:n,y:e,fill:o,stroke:r}))}function CD(t,{x:e=Zt,y:n=W,stroke:r,fill:o=zt(r)?"currentColor":r,...i}={}){return new H4(t,Iu({...i,x:e,y:n,fill:o,stroke:r}))}function Xb(t,e,n){let r=0,o=0,i=0,s=0;for(let u of t){let p=e[u],l=n[u];r+=p,o+=l,i+=p*l,s+=p*p}let a=t.length,c=(a*i-r*o)/(a*s-r*r),f=(o-c*r)/a;return u=>c*u+f}function kD(t,e,n,r,o){let i=sn(t,u=>e[u])/t.length,s=0,a=0;for(let u of t)s+=(e[u]-i)**2,a+=(n[u]-o(e[u]))**2;let c=Math.sqrt(a/(t.length-2)),f=ID(r,t.length-2);return(u,p)=>{let l=o(u),d=c*Math.sqrt(1/t.length+(u-i)**2/s);return l+p*f*d}}function Ph({path:t=W,delimiter:e,frameAnchor:n,treeLayout:r=Xa,treeSort:o,treeSeparation:i,treeAnchor:s,treeFilter:a,...c}={}){s=Hb(s),o=OD(o),a!=null&&(a=Z4(a)),n===void 0&&(n=s.frameAnchor);let f=$D(e),u=YD(c,Z4),[p,l]=Ge(),[d,h]=Ge();return{x:p,y:d,frameAnchor:n,...Ce(c,(m,x)=>{let g=f(ut(m,t)),y=l([]),b=h([]),w=-1,_=[],v=[],A=Yg().path(N=>g[N]),T=Gn(m)?N=>N.data=m[N.data]:N=>N.data=m.get(N.data),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&i!==void 0&&E.separation(i??jd);for(let N of u)N[Vb]=N[BD]([]);for(let N of x){let M=[],k=A(N.filter(O=>g[O]!=null)).each(T);o!=null&&k.sort(o),E(k);for(let O of k.descendants())if(!(a!=null&&!a(O))){M.push(++w),_[w]=O.data,s.position(O,w,y,b);for(let S of u)S[Vb][w]=S[zD](O)}v.push(M)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function Gb({path:t=W,delimiter:e,curve:n="bump-x",stroke:r="#555",strokeWidth:o=1.5,strokeOpacity:i=.5,treeLayout:s=Xa,treeSort:a,treeSeparation:c,treeAnchor:f,treeFilter:u,...p}={}){f=Hb(f),a=OD(a),u!=null&&(u=RD(u)),p={curve:n,stroke:r,strokeWidth:o,strokeOpacity:i,...p};let l=$D(e),d=YD(p,RD),[h,m]=Ge(),[x,g]=Ge(),[y,b]=Ge(),[w,_]=Ge();return{x1:h,x2:x,y1:y,y2:w,...Ce(p,(v,A)=>{let T=l(ut(v,t)),E=m([]),N=g([]),M=b([]),k=_([]),O=-1,S=[],I=[],C=Yg().path(D=>T[D]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??jd);for(let D of d)D[Vb]=D[BD]([]);for(let D of A){let $=[],P=C(D.filter(F=>T[F]!=null)).each(F=>F.data=v[F.data]);a!=null&&P.sort(a),L(P);for(let{source:F,target:q}of P.links())if(!(u!=null&&!u(q,F))){$.push(++O),S[O]=q.data,f.position(F,O,E,M),f.position(q,O,N,k);for(let V of d)V[Vb][O]=V[zD](q,F)}I.push($)}return{data:S,facets:I}}),...Object.fromEntries(d)}}function Hb(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return CZ;case"right":return kZ}throw new Error(`invalid tree anchor: ${t}`)}var CZ={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},kZ={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function OD(t){return t==null||typeof t=="function"?t:`${t}`.trim().toLowerCase().startsWith("node:")?LD(Z4(t)):LD(LZ(t))}function LD(t){return(e,n)=>We(t(e),t(n))}function LZ(t){return e=>e.data?.[t]}function $D(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=>RZ(r,e))}var Q4=92,DD=47;function RZ(t,e){if(e===Q4)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 Q4: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 DD: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 OZ(t){let e=!1;for(let n=0,r=t.length;n<r;++n){switch(t.charCodeAt(n)){case Q4:if(!e){e=!0;continue}case DD:e&&(t=t.slice(0,n-1)+t.slice(n),--n,--r);break}e=!1}return t}function PD(t){return Ve(t)&&typeof t.node=="function"}function $Z(t){return Ve(t)&&typeof t.link=="function"}function Z4(t){if(PD(t))return t.node;if(t=`${t}`.trim().toLowerCase(),!!t.startsWith("node:")){switch(t){case"node:name":return K4;case"node:path":return J4;case"node:internal":return FD;case"node:external":return qD;case"node:depth":return tM;case"node:height":return eM}throw new Error(`invalid node value: ${t}`)}}function RD(t){if(PD(t))return t.node;if($Z(t))return t.link;if(t=`${t}`.trim().toLowerCase(),!(!t.startsWith("node:")&&!t.startsWith("parent:"))){switch(t){case"parent:name":return Wb(K4);case"parent:path":return Wb(J4);case"parent:depth":return Wb(tM);case"parent:height":return Wb(eM);case"node:name":return K4;case"node:path":return J4;case"node:internal":return FD;case"node:external":return qD;case"node:depth":return tM;case"node:height":return eM}throw new Error(`invalid link value: ${t}`)}}function J4(t){return t.id}function K4(t){return DZ(t.id)}function tM(t){return t.depth}function eM(t){return t.height}function FD(t){return!!t.children}function qD(t){return!t.children}function Wb(t){return(e,n)=>n==null?void 0:t(n)}function DZ(t){let e=t.length;for(;--e>0&&!PZ(t,e););return OZ(t.slice(e+1))}function PZ(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}var BD=2,zD=3,Vb=4;function YD(t,e){let n=[];for(let r in t){let o=t[r],i=e(o);i!==void 0&&n.push([r,...Ge(o),i])}return n}function nM(t,{fill:e,stroke:n,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,marker:u,markerStart:p=u,markerEnd:l=u,dot:d=zt(p)&&zt(l),text:h="node:name",textStroke:m="var(--plot-background)",title:x="node:path",dx:g,dy:y,textAnchor:b,treeLayout:w=Xa,textLayout:_=w===Xa||w===Bg?"mirrored":"normal",tip:v,...A}={}){if(g===void 0&&(g=Hb(A.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=Oe(_,"textLayout",["mirrored","normal"]);function T(E){return Yo(t,Ph({treeLayout:w,text:h,fill:e===void 0?"currentColor":e,stroke:m,dx:g,dy:y,title:x,...E,...A}))}return ke(Lb(t,Gb({treeLayout:w,markerStart:p,markerEnd:l,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?Pr(t,Ph({treeLayout:w,fill:e===void 0?"node:internal":e,title:x,tip:v,...A})):null,h!=null?_==="mirrored"?[T({textAnchor:"start",treeFilter:"node:external"}),T({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:T():null)}function UD(t,e){return nM(t,{...e,treeLayout:Bg})}var XD={ariaLabel:"waffle"},Fh=class extends bc{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:Yi(i,WD("x"))},XD),this.unit=Math.max(0,n),this.gap=+r,this.round=VD(o),this.multiple=GD(s)}},qh=class extends wc{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:Yi(i,WD("y"))},XD),this.unit=Math.max(0,n),this.gap=+r,this.round=VD(o),this.multiple=GD(s)}};function WD(t){return function(e,n,r,o,i){let{unit:s,gap:a,rx:c,ry:f,round:u}=this,{document:p}=i,l=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),x=s*FZ(n.scales[t]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(h/x)))}=this,y=Math.min(h/g,x*g),b=x*g,w=t==="y"?([M,k])=>[M*y,-k*b]:([M,k])=>[k*b,M*y],_=(h-g*y)/2,v=typeof m=="function"?M=>m(M)+_:m+_,A=n[t](0),T=KR(),E=p.createElementNS(Nn.svg,"pattern");E.setAttribute("width",t==="y"?y:b),E.setAttribute("height",t==="y"?b:y),E.setAttribute("patternUnits","userSpaceOnUse");let N=E.appendChild(p.createElementNS(Nn.svg,"rect"));return N.setAttribute("x",a/2),N.setAttribute("y",a/2),N.setAttribute("width",(t==="y"?y:b)-a),N.setAttribute("height",(t==="y"?b:y)-a),c!=null&&N.setAttribute("rx",c),f!=null&&N.setAttribute("ry",f),ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(M=>M.selectAll().data(e).enter().append(()=>E.cloneNode(!0)).attr("id",k=>`${T}-${k}`).select("rect").call(ht,this).call(Tt,this,r)).call(M=>M.selectAll().data(e).enter().append("path").attr("transform",t==="y"?to`translate(${v},${A})`:to`translate(${A},${v})`).attr("d",k=>`M${rM(u(l[k]/s),u(d[k]/s),g).map(w).join("L")}Z`).attr("fill",k=>`url(#${T}-${k})`).attr("stroke",this.stroke==null?null:k=>`url(#${T}-${k})`)).node()}}function rM(t,e,n){if(t<0||e<0){let r=Math.ceil(-Math.min(t,e)/n);return rM(t+r*n,e+r*n,n).map(([o,i])=>[o,i-r])}return e<t?rM(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 VD(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 GD(t){return t===void 0?void 0:Math.max(1,Math.floor(t))}function FZ({domain:t,range:e}){return jD(e)/jD(t)}function jD(t){let[e,n]=Ft(t);return n-e}function HD(t,e={}){return Oi(e)||(e={...e,y:Zt,x2:W}),new Fh(t,Xs(yu(Us(e))))}function QD(t,e={}){return Oi(e)||(e={...e,x:Zt,y2:W}),new qh(t,Ws(bu(js(e))))}var aP=Aq(sP(),1);var WZ=({marginLeft:t})=>[1,t],VZ=({width:t,marginRight:e})=>[-1,t-e],GZ=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],HZ=({marginTop:t})=>[1,t],QZ=({height:t,marginBottom:e})=>[-1,t-e],ZZ=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function cP(t){return typeof t=="string"?{anchor:t}:t}function fP(t={},e={}){arguments.length===1&&([t,e]=lP(t));let{anchor:n="left",padding:r=1,r:o=e.r}=cP(t);switch(`${n}`.toLowerCase()){case"left":n=WZ;break;case"right":n=VZ;break;case"middle":n=GZ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return pP("x","y",n,Dt(r),o,e)}function uP(t={},e={}){arguments.length===1&&([t,e]=lP(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=cP(t);switch(`${n}`.toLowerCase()){case"top":n=HZ;break;case"bottom":n=QZ;break;case"middle":n=ZZ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return pP("y","x",n,Dt(r),o,e)}function lP(t){let{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function pP(t,e,n,r,o,i){if(o!=null&&typeof o!="number"){let{channels:s,sort:a,reverse:c}=i;s=Wd(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 Kt(i,function(s,a,c,f,u,p){let{[e]:l,r:d}=c;if(!c[e])throw new Error(`missing channel: ${e}`);({[e]:l}=Bo(c,f,p));let h=d?void 0:o!==void 0?Dt(o):this.r!==void 0?this.r:3;d&&(d=ut(d.value,f[d.scale]||W,Float64Array));let[m,x]=n(u),g=m?KZ:JZ,y=new Float64Array(l.length),b=d?w=>d[w]:()=>h;for(let w of a){let _=(0,aP.default)();w=w.filter(d?A=>Zf(l[A])&&Pn(d[A]):A=>Zf(l[A]));let v=new Float64Array(2*w.length+2);for(let A of w){let T=b(A),E=m?T+r:0,N=l[A]-T,M=l[A]+T,k=2;_.queryInterval(N-r,M+r,([,,S])=>{let I=y[S]-E,C=l[A]-l[S],L=r+(d?d[A]+d[S]:2*h),D=Math.sqrt(L*L-C*C);v[k++]=I-D,v[k++]=I+D});let O=v.slice(0,k);m&&(O=O.filter(S=>S>=0));t:for(let S of O.sort(g)){for(let I=0;I<k;I+=2)if(v[I]+1e-6<S&&S<v[I+1]-1e-6)continue t;y[A]=S+E;break}_.insert([N,M,A])}}m||(m=1);for(let w of a)for(let _ of w)y[_]=y[_]*m+x;return{data:s,facets:a,channels:{[t]:{value:y,source:null},[e]:{value:l,source:c[e]},...d&&{r:{value:d,source:c.r}}}}})}function JZ(t,e){return Math.abs(t)-Math.abs(e)}function KZ(t,e){return t-e}function hP(t,e){return arguments.length===1&&({basis:t,...e}=t),Lu(Jb(t),e)}function mP(t,e){return arguments.length===1&&({basis:t,...e}=t),Ru(Jb(t),e)}function Jb(t){if(t===void 0)return dP;if(typeof t=="function")return Kb(ru(t));if(/^p\d{2}$/i.test(t))return Yu(nu(t));switch(`${t}`.toLowerCase()){case"deviation":return nJ;case"first":return dP;case"last":return eJ;case"max":return rJ;case"mean":return oJ;case"median":return iJ;case"min":return sJ;case"sum":return aJ;case"extent":return tJ}throw new Error(`invalid basis: ${t}`)}function Kb(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 Yu(t){return Kb((e,n)=>t(e,r=>n[r]))}var tJ={mapIndex(t,e,n){let[r,o]=Ft(t,s=>e[s]),i=o-r;for(let s of t)n[s]=e[s]===null?NaN:(e[s]-r)/i}},dP=Kb((t,e)=>{for(let n=0;n<t.length;++n){let r=e[t[n]];if(oe(r))return r}}),eJ=Kb((t,e)=>{for(let n=t.length-1;n>=0;--n){let r=e[t[n]];if(oe(r))return r}}),nJ={mapIndex(t,e,n){let r=pi(t,i=>e[i]),o=Mr(t,i=>e[i]);for(let i of t)n[i]=e[i]===null?NaN:o?(e[i]-r)/o:0}},rJ=Yu(kt),oJ=Yu(pi),iJ=Yu(Vr),sJ=Yu(It),aJ=Yu(sn);function xP(t,e){return yP("x",t,e)}function gP(t,e){return yP("y",t,e)}function yP(t,e,n={}){let r,o=1;if(typeof e=="number")o=e,r=(f,u)=>+f+u;else{if(typeof e=="string"){let f=e.startsWith("-")?-1:1;[e,o]=N1(e.replace(/^[+-]/,"")),o*=f}e=iu(e),r=(f,u)=>e.offset(f,u)}let i=`${t}1`,s=`${t}2`,a=Hn({[i]:f=>f.map(u=>r(u,o)),[s]:f=>f},n),c=a[s].transform;return a[s].transform=()=>{let f=c(),[u,p]=Ft(f);return f.domain=o<0?[u,r(p,o)]:[r(u,o),p],f},a}function bP(t,e={}){if(typeof t=="string")switch(t.toLowerCase()){case"first":return Yh(e);case"last":return Uh(e)}if(typeof t=="function")return ta(null,t,e);let n,r;for(n in t){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=cJ(t[n])}if(r===void 0)throw new Error(`invalid selector: ${t}`);return ta(n,r,e)}function cJ(t){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"min":return fM;case"max":return uM}throw new Error(`unknown selector: ${t}`)}function Yh(t){return ta(null,fJ,t)}function Uh(t){return ta(null,uJ,t)}function t2(t){return ta("x",fM,t)}function e2(t){return ta("y",fM,t)}function n2(t){return ta("x",uM,t)}function r2(t){return ta("y",uM,t)}function*fJ(t){yield t[0]}function*uJ(t){yield t[t.length-1]}function*fM(t,e){yield Mx(t,n=>e[n])}function*uM(t,e){yield Ia(t,n=>e[n])}function ta(t,e,n){if(t!=null){if(n[t]==null)throw new Error(`missing channel: ${t}`);t=n[t]}let r=vn(n);return Ce(n,(o,i)=>{let s=ut(o,r),a=ut(o,t),c=[];for(let f of i){let u=[];for(let p of s?rn(f,l=>s[l]).values():[f])for(let l of e(p,a))u.push(l);c.push(u)}return{data:o,facets:c}})}lt.prototype.plot=function({marks:t=[],...e}={}){return Eu({...e,marks:[...t,this]})};var lJ=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 pJ(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 wP(t,e,n){for(let r in t){let o=lJ.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&&pJ(e,o.split("."),i)}}var dJ=new Set(["frame","hexgrid","sphere","graticule"]),hJ=new Map([["first",Yh],["last",Uh],["maxX",n2],["maxY",r2],["minX",t2],["minY",e2],["nearest",Bs],["nearestX",zs],["nearestXY",Ui]]);async function vP(t){let e={marks:[]},n=[],{attributes:r,marks:o}=t;wP(r,e,n);let i=[];for(let a of o)for(let{type:c,data:f,options:u}of a.plotSpecs()){let{select:p,...l}=u,d=hJ.get(p)?.(l)??l,h=dJ.has(c)?[d]:[f,d];e.marks.push(lM[c](...h)),i.push(a.index)}xJ(e,t);let s=Eu(e);yJ(s,i),mJ(t,s,r,n);for(let a of t.interactors)await a.init(s);return s}function mJ(t,e,n,r){r.forEach(o=>{let i=n[o];if(i===lo){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 xJ(t,e){let{marks:n}=e;o2("x",t,n),o2("y",t,n),o2("fx",t,n),o2("fy",t,n)}function o2(t,e,n){let r=e[t]||{};if(r.axis===null||r.label!==void 0)return;let o=n.map(s=>s.channelField(t)?.field);if(o.every(s=>s==null))return;let i;for(let s=0;s<o.length;++s){let a=_P(o[s]);a!==void 0&&(i===void 0?i=a:i!==a&&(i=void 0))}i!==void 0&&(e[t]={...r,label:i})}function _P(t){if(t){switch(t.type){case"COLUMN_REF":return t.column;case"CAST":return _P(t.expr);case"FUNCTION":if(t.name==="make_date")return"date";break}return gJ(t)}}function gJ(t){let e=`${t}`.replaceAll('"',"").replaceAll("(*)","()");return e.endsWith("()")?e.slice(0,-2):e}function yJ(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])}}var bJ={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},jh=class{constructor(e){this.attributes={...bJ},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=s_()}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=wJ(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 vP(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 np(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 wJ(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 i2(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),t==="none"||t==="currentcolor"||t.startsWith("url(")&&t.endsWith(")")||t.startsWith("var(")&&t.endsWith(")")||nr(t)!==null)}var vJ=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 SP(t){return vJ.has(t)}var _J=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function MP(t){return _J.has(`${t}`.toLowerCase())}var AP=t=>t==="stroke"||t==="fill",SJ=t=>/opacity$/i.test(t),MJ=t=>t==="symbol",AJ=(t,e)=>t!=="sort"&&t!=="tip"&&e!=null&&!Array.isArray(e),pM=(t,e)=>({channel:t,field:e,as:ts(e)?e.column:t}),dM=(t,e)=>({channel:t,value:e}),s2=t=>Array.isArray(t),$e=class extends Bn{constructor(e,n,r,o={}){super(n?.options?.filterBy),this.type=e,this.reqs=o,this.source=n;let i=this.channels=[],s=this.detail=new Set,a=this.params=new Set;s2(n)?this.data=Wn(n):_e(n?.table)&&a.add(n.table);let c=(f,u)=>{let p=typeof u;if(f==="channels")for(let l in u)s.add(l),c(l,u[l]);else if(p==="function"&&u[rp]){let l=u(this,f);for(let d in l)c(d,l[d])}else if(p==="string")SP(f)||AP(f)&&i2(u)||MJ(f)&&MP(u)?i.push(dM(f,u)):i.push(pM(f,oi(u)));else if(Yr(u)){let l=dM(f,u.value);i.push(l),u.addEventListener("value",d=>(l.value=d,this.update()))}else pn(u)?(Fv(u).forEach(l=>a.add(l)),i.push(pM(f,u))):p==="object"&&AJ(f,u)?i.push(pM(f,u)):u!==void 0&&i.push(dM(f,u))};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()}sourceTable(){let e=this.source?.table;return e?_e(e)?e.value:e:null}hasOwnData(){return this.source==null||s2(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{channels:e,reqs:n}=this,r=new Map;for(let{channel:i,field:s}of e){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,f=r.get(c)??r.set(c,new Set).get(c);a.forEach(u=>f.add(u)),n[i]?.forEach(u=>f.add(u))}let o=this.sourceTable();return Array.from(r,([i,s])=>({table:o,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=[]){return this.hasOwnData()?null:Xh(this.channels,this.sourceTable()).where(e)}queryPending(){return this.plot.pending(this),this}queryResult(e){return this.data=Wn(e),this}update(){return this.plot.update(this)}plotSpecs(){let{type:e,data:n,detail:r,channels:o}=this;return hM(e,r,o,n)}};function Sn(t,e){let n=e?.[t.as]??t.as;return Object.hasOwn(t,"value")?t.value:AP(t.channel)?{value:n,scale:"color"}:SJ(t.channel)?{value:n,scale:"opacity"}:n}function Xh(t,e,n=[]){let r=st.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(tr(c))i=!0;else{if(o.has(f))continue;o.add(f)}r.select({[f]:c})}}}return i&&r.groupby(Array.from(o)),r}function hM(t,e,n,r,o={}){let{numRows:i,values:s,columns:a}=r??{},c={};for(let p of n){let l=e.has(p.channel)?c:o;l[p.channel]=Sn(p,a)}return e.size&&(o.channels=c),[{type:t,data:s??(r?{length:i}:null),options:o}]}function Tc(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 Kl(o)}function hr(t,e,n,r,o=1,i){let{field:s}=t.channelField(e);i=i??s;let{type:a,apply:c,sqlApply:f}=Tc(t,e),u=!!t.plot.getAttribute(`${e}Reverse`),[p,l]=r.map(m=>c(m)),d=f(i),h=a==="time"||a==="utc"?d:i;return[Wv(d,p,l,n-o,u),h]}var mM={x:["min","max"]},xM={y:["min","max"]},a2={...mM,...xM};function TP(t,e,n,r,o){let{plot:i}=t,s=i.getAttribute(r),a=i.getAttribute(o);if(Array.isArray(s)&&!s[en])return s;{let{column:c,min:f,max:u}=t.channelField(n),p=gM(e,c)||(a?_i().domain([f,u]).nice().domain():[f,u]);return s!==lo&&(p[en]=!0),i.setAttribute(r,p,{silent:!0}),p}}function Vo(t,e){return TP(t,e,"x","xDomain","xNice")}function Go(t,e){return TP(t,e,"y","yDomain","yNice")}function gM(t,e){if(!t)return;let n,r;return[t].flat().forEach(o=>ao(o,i=>{if(i instanceof va&&`${i.expr}`===e){let s=(i.extent??[]).map(a=>a?.value??a);(n==null||s[0]<n)&&(n=s[0]),(r==null||s[1]>r)&&(r=s[1])}})),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Wh=class extends $e{constructor(e,n,r){let o=e.endsWith("X")?"y":e.endsWith("Y")?"x":null,i=o?{[o]:["count","min","max"]}:void 0;super(e,n,r,i),this.dim=o}query(e=[]){let{plot:n,dim:r,source:o}=this,i=o.options?.optimize,s=super.query(e);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:f,as:u,type:p,count:l,min:d,max:h}=this.channelField(r),m=p==="date"||p==="number",x=r==="x"?n.innerWidth():n.innerHeight();if(i??=l/x>10,i&&m&&c){let[g,y]=gM(e,f)||[d,h],[b]=hr(this,r,x,[g,y],1,u),w=s._select.map(_=>_.alias).filter(_=>_!==u&&_!==c);return Zv(s,b,u,c,w)}else return s.orderby(f)}};function EP(t,e=[]){return new e.constructor(t)}function IP(t,e,n){let r=EP(t,n),o=n.length;for(let i=0;i<o;++i)r[e[i]]=n[i];return r}function NP(t,e,n,r,o,i,s){let a=n.length,c=t*e,f=o.map(d=>r[d]),u={},p=[],l=new Int32Array(a);if(i?.length){let d=i.map(m=>r[m]),h={};for(let m=0;m<a;++m){let x=d.map(g=>g[m]);l[m]=h[x]??=p.push(x)-1}for(let m=0;m<i.length;++m)u[i[m]]=p.map(x=>x[m])}else p.push([]);if(s){let d=n.map(x=>x%t),h=n.map(x=>Math.floor(x/t)),m=p.map(()=>[]);for(let x=0;x<a;++x)m[l[x]].push(x);o.forEach((x,g)=>{let y=f[g];u[x]=p.map((b,w)=>s(m[w],t,e,d,h,y))})}else o.forEach((d,h)=>{let m=f[h],x=u[d]=p.map(()=>EP(c,m));for(let g=0;g<a;++g)x[l[g]][n[g]]=m[g]});return{numRows:p.length,columns:u}}function Vh(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 CP(t){let e=new En;return t.forEach(n=>{let r=n.length;for(let o=0;o<r;++o)e.add(n[o])}),Array.from(e).sort(yt)}function we(t,e){return _e(t)?(t.addEventListener("value",e),t.value):t}function Gh(t,e=!1){let n=new Float64Array(5),r=new Float64Array(4);TJ(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 TJ(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)),u=n*2.5066282746310007,p=Float64Array.of(o[0],o[1],0,0,0,0,0,0),l=Float64Array.of(1,0,f[0],f[1],0,0,0,0,0,0),d,h;for(h=2;h<8;h+=2){for(p[h]=f[h]*p[h-2]-f[h+1]*p[h-1],p[h+1]=f[h]*p[h-1]+f[h+1]*p[h-2],d=h-2;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(d=0;d<=h;d+=2)p[d]+=o[h]*l[d]-o[h+1]*l[d+1],p[d+1]+=o[h]*l[d+1]+o[h+1]*l[d];for(l[h+2]=f[h]*l[h]-f[h+1]*l[h+1],l[h+3]=f[h]*l[h+1]+f[h+1]*l[h],d=h;d>0;d-=2)l[d]+=f[h]*l[d-2]-f[h+1]*l[d-1],l[d+1]+=f[h]*l[d-1]+f[h+1]*l[d-2]}for(h=0;h<4;++h)d=h<<1,e[h]=p[d]/u,t[h+1]=l[d+2]}function kP(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,u=0;f<o;++f,u+=r){let p=c.subarray(u);c2(t,n.subarray(u),r,1,i,s,a,p)}for(let f=0;f<r;++f){let u=c.subarray(f);c2(e,u,o,r,i,s,a,u)}return c}function c2(t,e,n,r=1,o=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(5),a=o,c=EJ){let f=r*2,u=r*3,p=r*4,l=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=p;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-u]-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=l-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+u]+t.b_anticausal[4]*e[d+p]-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 EJ(t,e,n,r,o,i,s,a,c,f,u,p=.5){let l=Math.abs(r)*n,d=r<0?l+r:0,h,m,x;for(m=0;m<=a;++m)for(f[m]=m<=i?o[m]:0,x=1;x<=a&&x<=m;++x)f[m]-=s[x]*f[m-x];for(x=0;x<a;++x)for(t[x]=0,m=1;m<=x;++m)h=d+r*m,h>=0&&h<l&&(t[x]+=f[x-m]*e[h]);let g=e[d],y=Math.ceil(u*10);for(m=0;m<y;++m){for(x=0;x<a;++x)t[x]+=f[x]*g;if(c-=Math.abs(f[0]),c<=p)break;for(f[a]=m+a<=i?o[m+a]:0,x=1;x<=a;++x)f[a]-=s[x]*f[a-x];for(x=0;x<a;++x)f[x]=f[x+1]}}var eo="density",no=class extends $e{constructor(e,n,r){let{bandwidth:o=0,interpolate:i="none",pixelSize:s=1,pad:a=1,width:c,height:f,...u}=r,p=IJ(u);super(e,n,u,a2),this.densityMap=p,this.bandwidth=we(o,l=>(this.bandwidth=l,this.grids?this.convolve().update():null)),this.interpolate=we(i,l=>(this.interpolate=l,this.requestUpdate())),this.pixelSize=we(s,l=>(this.pixelSize=l,this.requestUpdate())),this.pad=we(a,l=>(this.pad=l,this.requestUpdate())),this.width=we(c,l=>(this.width=l,this.requestUpdate())),this.height=we(f,l=>(this.height=l,this.requestUpdate()))}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};e.addAttributeListener("xDomain",r),e.addAttributeListener("yDomain",r),super.setPlot(e,n)}get filterStable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[en]&&!n[en]}query(e=[]){let{interpolate:n,pad:r,channels:o,densityMap:i}=this,[s,a]=this.extentX=Vo(this,e),[c,f]=this.extentY=Go(this,e),[u,p]=this.bins=this.binDimensions(),[l,d]=hr(this,"x",u,[s,a],r),[h,m]=hr(this,"y",p,[c,f],r),x=r?[tn(d,[+s,+a]),tn(m,[+c,+f])]:[Kn(+s,d),ae(d,+a),Kn(+c,m),ae(m,+f)],g=st.from(this.sourceTable()).where(e.concat(x)),y=this.groupby=[],b={};for(let _ of o)if(Object.hasOwn(_,"field")){let{as:v,channel:A,field:T}=_;tr(T)?(b[A]=T,i[A]=!0):A==="weight"?b[eo]=Yt(T):A!=="x"&&A!=="y"&&(g.select({[v]:T}),y.push(v))}let w=this.aggr=Object.keys(b);if(b.density&&w.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(w.length||(w.push(eo),b[eo]=qe()),n==="linear"){if(w.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[eo])throw new Error("Linear binning not applicable to custom aggregates.");let _=nf(b[eo])[0];return Hv(g,l,h,_,u,y)}else return Vv(g,l,h,b,u,y)}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=NJ(this.interpolate),{columns:i}=Wn(e);return this.grids0=NP(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(eo)?eo:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.columns[s],c=i.innerWidth(),f=i.innerHeight(),[u,p]=r,l=a.some(m=>m.some(x=>x<0)),d=Gh(n*(u-1)/c,l),h=Gh(n*(p-1)/f,l);this.grids={numRows:o.numRows,columns:{...o.columns,[s]:a.map(m=>kP(d,h,m,r))}}}return this}};function IJ(t){let e={};for(let n in t)t[n]==="density"&&(delete t[n],e[n]=!0);return e}function NJ(t="none"){if(typeof t=="function")return t;switch(t.toLowerCase()){case"none":case"linear":return;case"nearest":return Ih;case"barycentric":return Eh();case"random-walk":return Nh()}throw new Error(`invalid interpolate: ${t}`)}var Hh=class extends no{constructor(e,n){let{thresholds:r=10,...o}=n;super("geo",e,{bandwidth:20,interpolate:"linear",pixelSize:2,...o}),this.thresholds=we(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]=Vh(a.density);f=Array.from({length:c-1},(k,O)=>M*(O+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,p]=e,[l,d]=i.getAttribute("xDomain"),[h,m]=i.getAttribute("yDomain"),x=(d-l)/u,g=(m-h)/p,y=+l,b=+h,w=M=>y+M*x,_=M=>b+M*g,v=ms().size(e),A=this.contourData=Array(s*f.length),{density:T,...E}=a,N=Object.entries(E);for(let M=0,k=0;M<s;++M){let O=T[M],S=N.reduce((I,[C,L])=>(I[C]=L[M],I),{});for(let I=0;I<f.length;++I,++k)A[k]=Object.assign(CJ(v.contour(O,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]=Sn(s))}for(let s in r)r[s]&&(i[s]=Sn({channel:s,as:"value"}));return[{type:e,data:o,options:i}]}};function CJ(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 Qh(t){return Array.from({length:t},(e,n)=>n)}function f2(t,e){let n=e.reduce((o,i,s)=>(o[i]=s,o),{}),r=Qh(t.length);return r.sort((o,i)=>n[t[o]]-n[t[i]]),r}function u2(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 LP(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 RP(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 OP(t={}){let{r:e=0,g:n=0,b:r=0,opacity:o=1}=typeof t=="string"?Le(t):t,i=new Uint8ClampedArray([e,n,r,255*o|0]);return(s,a,c)=>{for(let f=0,u=0;f<c;++f)for(let p=0;p<a;++p,u+=4)s[u+0]=i[0],s[u+1]=i[1],s[u+2]=i[2],s[u+3]=i[3]}}function $P(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:u,b:p,opacity:l=1}=typeof c=="string"?Le(c):c,d=a<<2;o[d+0]=f,o[d+1]=u,o[d+2]=p,o[d+3]=255*l|0,r[e[a]]=d}return(a,c,f,u)=>{if(u.map)for(let p=0,l=0;p<f;++p)for(let d=0,h=(f-p-1)*c;d<c;++d,l+=4){let m=r[u[d+h]];a[l+0]=o[m+0],a[l+1]=o[m+1],a[l+2]=o[m+2],a[l+3]=o[m+3]}else{let p=r[u];for(let l=0,d=0;l<f;++l)for(let h=0;h<c;++h,d+=4)a[d+0]=o[p+0],a[d+1]=o[p+1],a[d+2]=o[p+2],a[d+3]=o[p+3]}}}function DP(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:u,opacity:p=1}=typeof a=="string"?Le(a):a,l=s<<2;o[l+0]=c,o[l+1]=f,o[l+2]=u,o[l+3]=255*p|0}return(s,a,c,f)=>{for(let u=0,p=0;u<c;++u)for(let l=0,d=(c-u-1)*a;l<a;++l,p+=4){let h=i*n(f[l+d])<<2;s[p+0]=o[h+0],s[p+1]=o[h+1],s[p+2]=o[h+2],s[p+3]=o[h+3]}}}var ea=class extends no{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}=OJ(this,r,o),{alpha:u,alphaProp:p,color:l,colorProp:d}=yM(this),h=s[p]??[],m=s[d]??[],x=i>1&&d&&this.groupby?.includes(d)?f2(m,this.plot.getAttribute("colorDomain")):Qh(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(g,y)=>(l?.(f.data,r,o,m[x[y]]),u?.(f.data,r,o,h[x[y]]),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}]}},Zh=class extends ea{constructor(e,n){super(e,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function yM(t){let{aggr:e,densityMap:n,groupby:r,plot:o}=t,i=e.includes(eo),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":i2(a?.value)?a.value:i&&o.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||e.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:i&&f!=="grid"?"grid":void 0;if(f!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let p=a?.as??(f==="grid"?eo:null),l=c?.as??(u==="grid"?eo:null),d=f!=="grid"&&f!=="group"?OP(f):LJ(t,p),h=u!=="grid"?LP(u):kJ(t,l);return{alphaProp:l,colorProp:p,alpha:h,color:d}}function kJ(t,e){let{plot:n,grids:r}=t,o=n.getAttribute("opacityDomain"),i=o===lo,s=o?.[en],a=!i&&!s&&o||Vh(r.columns[e]);(i||s||!o)&&(i||(a[en]=!0),n.setAttribute("opacityDomain",a));let c=$s({opacity:{type:n.getAttribute("opacityScale"),domain:a,range:n.getAttribute("opacityRange"),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 RP(c)}function LJ(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===lo,f=a?.[en],u=!c&&!f&&a||(i?o.slice().sort(yt):s?CP(o):Vh(o));(c||f||!a)&&(c||(u[en]=!0),n.setAttribute("colorDomain",u));let p=$s({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 $P(p);{let l=$s({x:{type:RJ(p.type),domain:p.domain,reverse:p.reverse,range:[0,1],clamp:p.clamp,base:p.base,exponent:p.exponent,constant:p.constant}});return DP(1024,p,l.apply)}}function RJ(t){return t.endsWith("symlog")?"symlog":t.endsWith("log")?"log":t.endsWith("pow")?"pow":t.endsWith("sqrt")?"sqrt":t==="diverging"?"linear":t}function OJ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=u2(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 Jh=class extends ea{constructor(e,n){let{normalize:r=!0,...o}=n;super(e,o),this.normalize=we(r,i=>(this.normalize=i,this.requestUpdate()))}query(e=[]){let{channels:n,normalize:r,pad:o}=this,[i,s]=this.bins=this.binDimensions(),[a]=hr(this,"x",i,Vo(this,e),o),[c]=hr(this,"y",s,Go(this,e),o),f=st.from(this.sourceTable()).where($J(this,e));this.aggr=["density"];let u=this.groupby=[],p=[];for(let l of n)if(Object.hasOwn(l,"field")){let{channel:d,field:h}=l;d==="z"?(f.select({[d]:h}),p.push("z")):d!=="x"&&d!=="y"&&(f.select({[d]:h}),u.push(d))}return Qv(f,a,c,p,i,s,u,r)}};function $J(t,e){if(Array.isArray(e)&&!e.length)return e;let n=t.channelField("x").column,r=t.channelField("y").column,o=s=>{let a=`${s.expr}`;return s.type!=="BETWEEN"||a!==n&&a!==r},i=s=>s.op==="AND"?dn(s.clauses.filter(a=>o(a))):s;return Array.isArray(e)?e.filter(s=>o(s)).map(s=>i(s)):i(e)}var Uu=class extends $e{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"?mM:xM),this.dim=a,this.bins=we(o,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=we(i,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterStable(){let e=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(e);return n&&!n[en]}query(e=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:o}=this,i=this.extent=(o==="x"?Vo:Go)(this,e),[s,a]=hr(this,o,n,i),c=Xh(r,this.sourceTable(),[o]).where(e.concat(tn(a,i))),f=this.channelField("weight")?"weight":null;return Gv(c,s,f)}queryResult(e){let{columns:{index:n,density:r}}=Wn(e);return this.grid=IP(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(),u=Gh(n*(e-1)/f,c),p=c2(u,o,e),l=r==="x"?"y":"x",d=this.channelField(r).as,h=+s,m=(a-h)/(e-1),x=1/m,g=new Float64Array(e),y=new Float64Array(e);for(let b=0;b<e;++b)g[b]=h+b*m,y[b]=p[b]*x;return this.data={numRows:e,columns:{[d]:g,[l]:y}},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]=Sn(a,r);return[{type:e,data:{length:n},options:s}]}};var Kh=class extends no{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=Tc(this,"x"),c=Tc(this,"y"),[f,u]=r.map(x=>a.apply(x)),[p,l]=o.map(x=>c.apply(x)),d=(u-f)/(i-n),h=(l-p)/(s-n),m=n?0:.5;return this.data=DJ(this.grids,e,f,p,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]:Sn(a,i)}for(let a in r)r[a]&&(s[a]=i.density);return[{type:e,data:{length:o},options:s}]}};function DJ(t,e,n,r,o,i,s,a,c){let f=1/(o*i),[u,p]=e,l=u*p,d=l*t.numRows,h=new Float64Array(d),m=new Float64Array(d),x=new Float64Array(d),g={x:h,y:m,density:x},{density:y,...b}=t.columns;for(let _ in b)g[_]=new b[_].constructor(d);let w=0;for(let _=0;_<t.numRows;++_){for(let A in b)g[A].fill(b[A][_],w,w+l);let v=y[_];for(let A=0,T=0;T<p;++T)for(let E=0;E<u;++E,++w,++A)h[w]=s(n+(E+c)*o),m[w]=a(r+(T+c)*i),x[w]=v[A]*f}return{numRows:d,columns:g}}function PJ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,u,p,l,d,h,m,x,g;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,u=Math.sqrt(-2*Math.log(f)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),x=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*x))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),u=Math.exp(e*a)/e,p=Math.exp(n*c)/n,x=u+p,t<u/x?d=Math.pow(e*x*t,1/e):d=1-Math.pow(n*x*(1-t),1/n)),g=-ju(e)-ju(n)+ju(e+n);s<10;s++){if(d===0||d===1)return d;if(l=FJ(d,e,n)-t,u=Math.exp(o*Math.log(d)+i*Math.log(1-d)+g),p=l/u,d-=u=p/(1-.5*Math.min(1,p*(o/d-i/(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 FJ(t,e,n){var r=t===0||t===1?0:Math.exp(ju(e+n)-ju(e)-ju(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?0:t<(e+1)/(e+n+2)?r*PP(t,e,n)/e:1-r*PP(1-t,n,e)/n}function PP(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,u,p,l,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(u=2*o,p=o*(n-o)*t/((a+u)*(e+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,p=-(e+o)*(i+o)*t/((e+u)*(s+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,l=f*c,d*=l,!(Math.abs(l-1)<3e-7));o++);return d}function ju(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 FP(t,e){var n=PJ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}function qP(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 Xu=class extends $e{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=we(i,a=>(this.ci=a,this.update()))}query(e=[]){let{channels:n,field:r}=this,o=n.concat([{field:Ul(r),as:"__avg__"},{field:Pt(Wl(r),si(qe(r))),as:"__se__"}]);return Xh(o,this.sourceTable()).where(e)}queryResult(e){return this.data=Wn(e),this}plotSpecs(){let{type:e,dim:n,detail:r,data:o,ci:i,channels:s}=this,a=Math.SQRT2*qP(i),{columns:{__avg__:c,__se__:f}}=o,u={[`${n}1`]:c.map((p,l)=>p-a*f[l]),[`${n}2`]:c.map((p,l)=>p+a*f[l])};return hM(e,r,s,o,u)}};var qJ="geom",tm=class extends $e{constructor(e,n={},r){!s2(e)&&!n?.geometry&&(n.geometry=Hl(qJ)),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 em=class extends $e{constructor(e,n){let{type:r="hexagon",binWidth:o=20,...i}=n;super(r,e,{r:o/2,clip:!0,...i},a2),this.binWidth=we(o,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[en]&&!n[en]}query(e=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:o}=this,i,s,a=new Set,c={};for(let N of o)if(N.channel!=="orderby"){if(N.channel==="x")i=N;else if(N.channel==="y")s=N;else if(Object.hasOwn(N,"field")){let{as:M,field:k}=N;c[M]=k,tr(k)||a.add(M)}}let[f,u]=Vo(this,e),[p,l]=Go(this,e),d=.5-n.getAttribute("marginLeft"),h=0-n.getAttribute("marginTop"),m=pe(r),x=pe(r*(1.5/Math.sqrt(3))),g=pe(n.innerWidth()/(u-f)),y=pe(n.innerHeight()/(l-p)),b="_x",w="_y",_="_px",v="_py",A="_pi",T="_pj",E="_tt";return st.select({[i.as]:Rt(pe(f),Pt(Rt(mt(Rt(b,mt(.5,Vl(w,1))),m),d),g)),[s.as]:dt(pe(l),Pt(Rt(mt(w,x),h),y)),...c}).groupby(b,w,...a).from(st.select({[v]:Pt(dt(mt(y,dt(l,s.field)),h),x),[T]:Gt(ai(v)),[_]:dt(Pt(dt(mt(g,dt(i.field,f)),d),m),mt(.5,Vl(T,1))),[A]:Gt(ai(_)),[E]:dn(_r(mt(Be(dt(v,T)),3),1),_r(Rt(ve(dt(_,A),2),ve(dt(v,T),2)),Rt(ve(dt(dt(_,A),mt(.5,ii(ae(_,A),-1,1))),2),ve(dt(dt(v,T),ii(ae(v,T),-1,1)),2)))),[b]:ii(E,Gt(Rt(Rt(A,ii(ae(_,A),-.5,.5)),ii(jr(Vl(T,1),0),.5,-.5))),A),[w]:ii(E,Gt(Rt(T,ii(ae(v,T),-1,1))),T)},"*").from(this.sourceTable()).where(vr(i.field),vr(s.field),e))}};var nm=class extends no{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}=this,[[s,a],[c,f]]=e,[u,p]=this.bins,[l,d]=hr(this,"x",u,[s,a],r),[h,m]=hr(this,"y",p,[c,f],r),x=r?[tn(d,[+s,+a]),tn(m,[+c,+f])]:[Kn(+s,d),ae(d,+a),Kn(+c,m),ae(m,+f)],g=st.from(this.sourceTable()).where(x),y=this.groupby=[],b={};for(let _ of o)if(Object.hasOwn(_,"field")){let{as:v,channel:A,field:T}=_;T.aggregate?(b[A]=T,i[A]=!0):A==="weight"?b.density=Yt(T):A!=="x"&&A!=="y"&&(g.select({[v]:T}),y.push(v))}let w=this.aggr=Object.keys(b);if(b.density&&w.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(w.length||(w.push("density"),b.density=qe()),n==="linear"){if(w.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b.density)throw new Error("Linear binning not applicable to custom aggregates.");return jJ(g,l,h,b.density,u,y)}else return UJ(g,l,h,b,u,y)}async requestTiles(){let e=Sr();this.prefetch&&e.cancel(this.prefetch);let{pad:n,tileX:r,tileY:o,origin:[i,s]}=this,[a,c]=this.bins=this.binDimensions(),[f,u]=Vo(this,this._filter),[p,l]=Go(this,this._filter),d=u-f,h=l-p,m=Math.floor((f-i)*(a-n)/d),x=Math.floor((p-s)*(c-n)/h),g=(M,k)=>[[i+M*d,i+(M+1)*d],[s+k*h,s+(k+1)*h]],y=Math.floor((f-i)/d),b=r?BP((u-i)/d):y,w=Math.floor((p-s)/h),_=o?BP((l-s)/h):w,v=[];for(let M=y;M<=b;++M)for(let k=w;k<=_;++k)v.push([M,k]);let A=v.map(([M,k])=>e.query(this.tileQuery(g(M,k)))),T=[];if(r)for(let M=w;M<=_;++M)T.push([b+1,M]),T.push([y-1,M]);if(o){let M=r?y-1:y,k=r?b+1:b;for(let O=M;O<=k;++O)T.push([O,_+1]),T.push([O,w-1])}this.prefetch=T.map(([M,k])=>e.prefetch(this.tileQuery(g(M,k))));let E=await Promise.all(A),N=BJ(a,c,m,x,v,E);this.grids0={numRows:N.length,columns:{density:[N]}},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}=YJ(this,r,o),{alpha:u,alphaProp:p,color:l,colorProp:d}=yM(this),h=s[p]??[],m=s[d]??[],x=i>1&&d&&this.groupby?.includes(d)?f2(m,this.plot.getAttribute("colorDomain")):Qh(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(g,y)=>(l?.(f.data,r,o,m[x[y]]),u?.(f.data,r,o,h[x[y]]),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 BJ(t,e,n,r,o,i){let s=new Float64Array(t*e);return i.forEach((a,c)=>{let[f,u]=o[c],p=f*t-n,l=u*e-r;zJ(t,e,s,a,p,l)}),s}function zJ(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 u=a[f],p=o+u%t,l=i+Math.floor(u/t);0<=p&&p<t&&0<=l&&l<e&&(n[p+l*t]=c[f])}}function YJ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=u2(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 UJ(t,e,n,r,o,i){return t.select({index:ge`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function jJ(t,e,n,r,o,i){let s=r.column?`* ${r.column}`:"",a=(l,d)=>t.clone().select({xp:e,yp:n,i:l,w:d}),c=a(ge`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,ge`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(ge`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,ge`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(ge`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,ge`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),p=a(ge`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,ge`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return st.from(st.unionAll(c,f,u,p)).select({index:"i",density:Yt("w")},i).groupby("index",i).having(jr("density",0))}function BP(t){let e=Math.floor(t);return e===t?e-1:e}var rm=class extends $e{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=we(r,a=>(this.ci=a,s())),this.precision=we(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 st.from(super.query(e)).select({intercept:Qw(r,n),slope:Kw(r,n),n:Xl(r,n),ssy:Jw(r,n),ssx:Zw(r,n),xm:jl(r,n),x0:pe(jn(n).where(vr(r))),x1:pe(Ke(n).where(vr(r)))}).select(o).groupby(o)}queryResult(e){return this.modelFit=Wn(e),this.lineData=XJ(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:e,modelFit:n,precision:r,plot:o}=this,i=o.innerWidth();return this.areaData=e?WJ(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=Sn(f,s);break;case"stroke":a.stroke=Sn(f,i),c.fill=Sn(f,s);break;case"strokeOpacity":a.strokeOpacity=Sn(f,i);break;case"fillOpacity":c.fillOpacity=Sn(f,s);break;default:a[f.channel]=Sn(f,i),c[f.channel]=Sn(f,s);break}return[...o?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:e.numRows},options:a}]}};function bM(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 XJ(t){let{x0:e=[],x1:n=[],xm:r,intercept:o,slope:i,n:s,ssx:a,ssy:c,...f}=t.columns,u=(d,h)=>o[h]+d*i[h],p=bM(e,n),l=bM(e.map(u),n.map(u));for(let d in f)f[d]=bM(f[d],f[d]);return{numRows:p.length,columns:{x:p,y:l,...f}}}function WJ(t,e,n,r){let o=t.numRows,{x0:i,x1:s,xm:a,intercept:c,slope:f,n:u,ssx:p,ssy:l,...d}=t.columns,h=Object.keys(d),m={x:[],y1:[],y2:[]};h.forEach(x=>m[x]=[]);for(let x=0;x<o;++x){let g=n*(s[x]-i[x])/r,y=FP((1-e)/2,u[x]-2)*Math.sqrt(l[x]/(u[x]-2));ye(i[x],s[x]-g/2,g).concat(s[x]).forEach(b=>{let w=c[x]+b*f[x],_=y*Math.sqrt(1/u[x]+(b-a[x])**2/p[x]);m.x.push(b),m.y1.push(w-_),m.y2.push(w+_),h.forEach(v=>m[v].push(d[v][x]))})}return{numRows:m.x.length,columns:m}}function Wu(t){t.tagName==="a"&&(t=t.children[0]);let e=t.__data__;return Array.isArray(e)?e[0]:e}function zP(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 na(t){let e={};for(let n in t)e[zP(n)]=t[n];return e}function VJ(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(tr(a))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 om=class{constructor(e,{selection:n,channels:r={}}){this.mark=VJ(e),this.selection=n;let o=Object.entries(na(r));this.channels=o.length?o:[["opacity",.2]],this.selection.addEventListener("value",il(()=>this.update()))}init(e){this.svg=e;let n=this.values=[],o=`g[data-index="${this.mark.index}"]`,i=`${o} > *:not(g), ${o} > g > *`,s=this.nodes=e.querySelectorAll(i),{channels:a}=this;for(let c=0;c<s.length;++c){let f=s[c];n.push(a.map(u=>f.getAttribute(u[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 GJ(i,s);for(let c=0;c<n.length;++c){let f=n[c],u=o[c],p=a(Wu(f));for(let l=0;l<r.length;++l){let[d,h]=r[l];f.setAttribute(d,p?u[l]:h)}}}};async function GJ(t,e){let n=e?.predicate(t);if(!n||n.length===0)return()=>!0;let r=t.filterBy?.predicate(t,!0),o={__:dn(n)},i=t.query(r);(i.queries||[i]).forEach(c=>{c._groupby.length?c.select(o):c.setSelect(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 l2(){let t=this,e=t.getScreenCTM,n;t.getScreenCTM=()=>t.isConnected?n=e.call(t):n}function wM(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 p2(){return wM(j_())}function YP(){return wM(Y_())}function UP(){return wM(U_())}function d2(t,e,n,r,o){let i=Nt(e??t).append("g").attr("class",o),s=t.scale("fx"),a=t.scale("fy");if(s||a){let c=s?.domain.map(u=>s.apply(u)-n),f=a?.domain.map(u=>a.apply(u)-r);if(c&&f)for(let u=0;u<c.length;++u)for(let p=0;p<f.length;++p)i.append("g").attr("transform",`translate(${c[u]}, ${f[p]})`);else if(c)for(let u=0;u<c.length;++u)i.append("g").attr("transform",`translate(${c[u]}, 0})`);else if(f)for(let u=0;u<f.length;++u)i.append("g").attr("transform",`translate(0, ${f[u]})`);i=i.selectAll("g")}return i.each(l2)}function im(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 jP(t){if(pn(t)){if(t.type==="COLUMN_REF")return t.column;if(t.type==="AGGREGATE")return t.args[0]??t}return t}function Ho(t,e){return jP(t.channelField(e)?.field)}function XP(t,e){let n=[],r=[];return e.forEach(o=>{let i=o==="color"?["color","fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let s=0;s<i.length;++s){let a=t.channelField(i[s],{exact:!0});if(a){n.push(jP(a.field)),r.push(a.as);return}}throw new Error(`Missing channel: ${o}`)}),{fields:n,as:r}}function sm(t,e,n=1){return e.invert(n*Math.floor(t/n))}var ra=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||Ho(e,n),this.style=a&&na(a),this.brush=n==="y"?UP():YP(),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=>sm(r,this.scale,this.pixelSize)).sort((r,o)=>r-o)),im(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 Ta(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=this.value?.map(this.scale.apply).sort(yt),a=e.scale("x").range,c=e.scale("y").range;if(r.extent([[It(a),It(c)],[kt(a),kt(c)]]),this.g=d2(e,n,It(a),It(c),`interval-${o}`).call(r).call(r.moveSilent,s),i){let f=this.g.selectAll("rect.selection");for(let u in i)f.attr(u,i[u])}e.addEventListener("pointerenter",f=>{f.buttons||this.activate()})}};var am=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||Ho(e,"x"),this.yfield=o||Ho(e,"y"),this.style=a&&na(a),this.brush=p2(),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(u=>sm(u,o,r)).sort(yt),a=[c[1],f[1]].map(u=>sm(u,i,r)).sort(yt)}(!im(s,n?.[0])||!im(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 r_([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,value:o}=this,i=this.xscale=e.scale("x"),s=this.yscale=e.scale("y"),a=i.range,c=s.range;if(n.extent([[It(a),It(c)],[kt(a),kt(c)]]),this.g=d2(e,null,It(a),It(c),"interval-xy").call(n),r){let f=this.g.selectAll("rect.selection");for(let u in r)f.attr(u,r[u])}if(o){let[f,u]=o[0].map(i.apply).sort(yt),[p,l]=o[1].map(s.apply).sort(yt);this.g.call(n.moveSilent,[[f,p],[u,l]])}e.addEventListener("pointerenter",f=>{f.buttons||this.activate()})}};var Ec=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=>Ho(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?ci(r,e&&[e],o):ss(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(m=>r.channelField(m).as),f=!er(i),[u,p]=HJ(e,r),l=this.pointer==="y"?.01:1,d=this.pointer==="x"?.01:1,h=Nt(e);h.on("pointerenter pointerdown pointermove",function(m){let[x,g]=hn(m,this),y=QJ(u,p,x,g,l,d,s);if(y!==this.valueIndex){this.valueIndex=y;let b=y<0?void 0:c.map(w=>a[w][y]);i.update(f?!b||b.length>1?b:b[0]:n.clause(b))}}),!f&&(h.on("pointerleave",()=>{i.update(n.clause(void 0))}),e.addEventListener("pointerenter",m=>{if(!m.buttons){let x=this.channels.map(()=>0);i.activate(this.clause(x))}}))}};function HJ(t,e){let{data:{columns:n}}=e,r=p=>n[e.channelField(p)?.as],o=p=>t.scale(p),i=t.scale("x"),s=t.scale("y"),a=o("fx")?.apply,c=o("fy")?.apply,f=Array.from(r("x"),i.apply),u=Array.from(r("y"),s.apply);if(a){let p=It(i.range),l=r("fx");for(let d=0;d<l.length;++d)f[d]+=a(l[d])-p}if(c){let p=It(s.range),l=r("fy");for(let d=0;d<l.length;++d)u[d]+=c(l[d])-p}return[f,u]}function QJ(t,e,n,r,o,i,s){let a=s*s,c=-1;for(let f=0;f<t.length;++f){let u=o*(t[f]-n),p=i*(e[f]-r),l=u*u+p*p;l<=a&&(a=l,c=f)}return c}var WP=(t,e)=>t-e,cm=class{constructor(e,{x:n=new uo,y:r=new uo,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||Ho(e,"x"),this.yfield=i||Ho(e,"y"),this.zoom=vM(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",u=>{f.setAttribute("xDomain",u)&&f.update()}),c&&this.ysel.addEventListener("value",u=>{f.setAttribute("yDomain",u)&&f.update()})}publish(e){if(this.panx){let n=ZJ(e,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=JJ(e,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(e,n,r){return Ta(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(WP),c=this.yscale.range.slice().sort(WP),f=vM(n,[-1/0,1/0],a),u=vM(r,[-1/0,1/0],c),p=aS().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[f[0],u[0]],[f[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>o.__zoom=new ar(1,0,0)).on("zoom",({transform:l})=>this.publish(l));if(Nt(o).call(p),n||r){let l=!1;o.addEventListener("pointerenter",d=>{if(!l&&(l=!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",()=>l=!1)}}};function vM(t,e,n){return t?Array.isArray(t)?t:e:n}function ZJ(t,e){return e.range.map(t.invertX,t).map(e.invert,e)}function JJ(t,e){return e.range.map(t.invertY,t).map(e.invert,e)}var KJ={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},tK=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,eK=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,nK=/^((\s+,?\s*)|(,\s*))/,rK=/^[01]/,VP=t=>`Invalid SVG path, incorrect parameter ${t}`;function GP(t){let e=[];return(t.match(tK)||[]).forEach(r=>{let o=r[0],i=o.toLowerCase(),s=KJ[i],a=oK(i,s,r.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(VP("count"));if(e.push([o,...a.slice(0,s)]),c!==s){i==="m"&&(o=o==="M"?"L":"l");for(let f=s;f<c;f+=s)e.push([o,...a.slice(f,f+s)])}}),e}function oK(t,e,n){let r=[];for(let o=0;e&&o<n.length;)for(let i=0;i<e;++i){let s=t==="a"&&(i===3||i===4)?rK:eK,a=n.slice(o).match(s);if(a===null)throw new Error(VP("type"));o+=a[0].length,r.push(+a[0]);let c=n.slice(o).match(nK);c!==null&&(o+=c[0].length)}return r}function KP(t,e,n){let{x:r,y:o}=t.getBoundingClientRect(),i=t.createSVGMatrix(),s=[];for(let a of e.children)if(a.tagName==="g"){let c=tF(a)??i;for(let f of a.children)HP(n,r,o,f,c)&&s.push(f)}else HP(n,r,o,a,i)&&s.push(a);return s}function HP(t,e,n,r,o){let[[i,s],[a,c]]=t,{e:f,f:u}=o,p=r.getBoundingClientRect(),l=p.left-e,d=p.right-e,h=p.top-n,m=p.bottom-n;if(l>=i&&d<=a&&h>=s&&m<=c)return!0;if(l<=a&&d>=i&&h<=c&&m>=s){let x=r.tagName;if(x==="a"&&(r=r.children[0],x=r.tagName),x==="rect"||x==="text"||x==="image")return!0;switch(i-=f,s-=u,a-=f,c-=u,x){case"circle":return eF(i,s,a,c,Ic(r.cx),Ic(r.cy),Ic(r.r));case"line":return nF(i,s,a,c,Ic(r.x1),Ic(r.y1),Ic(r.x2),Ic(r.y2));case"path":return iK(i,s,a,c,r)}}return!1}function Ic(t){return t.baseVal.value}function tF(t){let e=t.transform.baseVal,n=e.length,r=e[0]?.matrix;for(let o=1;o<n;++o)r=r.multiply(e[o].matrix);return r}function eF(t,e,n,r,o,i,s){let a=t<=o&&o<=n,c=e<=i&&i<=r;if(a&&c)return!0;let f=Math.min(Math.abs(t-o),Math.abs(n-o));if(c&&f<=s)return!0;let u=Math.min(Math.abs(e-i),Math.abs(r-i));return a&&u<=s||f*f+u*u<=s*s}function nF(t,e,n,r,o,i,s,a){let c=Math.max(Math.min(o,s),t),f=Math.min(Math.max(o,s),n);if(c>f)return!1;let u=i,p=a,l=s-o;if(Math.abs(l)>1e-8){let m=(a-i)/l,x=i-m*o;u=m*c+x,p=m*f+x}let d=Math.max(Math.min(u,p),e),h=Math.min(Math.max(u,p),r);return d<=h}function iK(t,e,n,r,o){let i=o.__path__||(o.__path__=GP(o.getAttribute("d"))),s=0,a=0,c=0,f=0,u=!1,p=[0,0],l=2,d=tF(o),h=(y,b)=>{p.length=l=2,p[0]=c=s=y,p[1]=f=a=b},m=d?(y,b)=>h(QP(d,y,b),ZP(d,y,b)):(y,b)=>h(y,b),x=(y,b)=>(p[l]=y,p[l+1]=b,l+=2,nF(t,e,n,r,p[l-4],p[l-3],y,b)),g=d?(y,b)=>{u=x(QP(d,c=y,f=b),ZP(d,y,b))}:(y,b)=>{u=x(c=y,f=b)};for(let y=0;y<i.length;++y){let b=i[y];switch(b[0]){case"M":m(b[1],b[2]);break;case"m":m(c+b[1],f+b[2]);break;case"L":case"T":g(b[1],b[2]);break;case"H":g(b[1],f);break;case"V":g(c,b[1]);break;case"l":case"t":g(c+b[1],f+b[2]);break;case"h":g(c+b[1],f);break;case"v":g(c,f+b[1]);break;case"C":g(b[5],b[6]);break;case"c":g(c+b[5],f+b[6]);break;case"S":case"Q":g(b[3],b[4]);break;case"s":case"q":g(c+b[3],f+b[4]);break;case"A":g(b[6],b[7]);break;case"a":if(sK(i,y))return eF(t,e,n,r,c,f-b[2],b[2]);g(c+b[6],c+b[7]);break;case"z":case"Z":if(g(s,a),aK(t,e,p)>0)return!0;m(s,a);break;default:return console.warn("SVG path command not supported: ",b[0]),!1}if(u)return!0}return!1}function QP(t,e,n){return t.a*e+t.c*n+t.e}function ZP(t,e,n){return t.b*e+t.d*n+t.f}function sK(t,e){let n=t[e],r=t[e+1];return r&&r[0]==="a"&&t[e+2]?.[0]==="z"&&n[1]===n[2]&&r[1]===r[2]&&n[1]===r[1]&&n[7]===-r[7]}function aK(t,e,n){let r=0,o=n.length-2;for(let i=0;i<o;i+=2)n[i+1]<=e?n[i+3]>e&&JP(t,e,n,i)>0&&++r:n[i+3]<=e&&JP(t,e,n[i])<0&&--r;return r}function JP(t,e,n,r){return(n[r+2]-n[r])*(e-n[r+1])-(t-n[r])*(n[r+3]-n[r+1])}function h2(t,e){return t==null||e==null?t!=null||e!=null:t.length!==e.length||t.some((n,r)=>m2(n,e[r]))}function m2(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 fm=class{constructor(e,{channels:n,selection:r,peers:o=!0,brush:i={fill:"none",stroke:"currentColor",strokeDasharray:"1,1"}}){this.mark=e,this.selection=r,this.peers=o,this.style=i&&na(i),this.brush=p2(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=XP(e,n);this.fields=s,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(e){let{fields:n,mark:r}=this;return ci(n,e,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}publish(e){let{as:n,group:r,mark:o,svg:i}=this,s;if(e){let{data:{columns:a={}}={}}=o,c=new Map;KP(i,r,e).forEach(f=>{let u=Wu(f),p=n.map(l=>a[l][u]);c.set(p.join("|"),p)}),s=Array.from(c.values())}this.extent=e,h2(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(e){let{brush:n,extent:r,mark:o,style:i}=this;this.svg=e;let s=e.width.baseVal.value,a=e.height.baseVal.value;if(n.extent([[0,0],[s,a]]),this.group=e.querySelector(`[data-index="${o.index}"]`),this.g=Nt(e).append("g").attr("class","region-xy").each(l2).call(n).call(n.moveSilent,r),i){let c=this.g.selectAll("rect.selection");for(let f in i)c.attr(f,i[f])}e.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}};var Nc=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 u=e.channelField(c[f],{exact:!0});if(u){i.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(e){let{fields:n,mark:r}=this;return ci(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(u=>a[u][Wu(f)]),n??=`[data-index="${o.index}"]`;let c=Array.from(e.querySelectorAll(n));e.addEventListener("pointerdown",f=>{let u=s.single?s.value:this.value,p=f.target,l=null;if(cK(c,p)){let d=r(p);(f.shiftKey||f.metaKey)&&u?.length?(l=u.filter(h=>m2(h,d)),l.length===u.length&&l.push(d)):u?.length===1&&!m2(u[0],d)?l=null:l=[d]}this.value=l,h2(u,l)&&s.update(this.clause(l))}),e.addEventListener("pointerenter",f=>{f.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function cK(t,e){return t.some(n=>n.contains(e))}var oF=":scope > div, :scope > span",x2="swatch",rF="ramp",Vu=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=fK(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(oF);for(let c of a){let f=s?s.has(c.__data__):!0;c.style.opacity=f?1:.2}}};function fK(t,e){let{channel:n,plot:r,selection:o}=t,i=e.scale(n),s=i.type==="ordinal"?x2:rF,a={label:r.getAttribute(`${n}Label`)??null,...t.options},c=s===x2?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},f=e.legend(n,c);t.legend=f;let u=!!o;if(u&&s===rF){let p=c.width??240,l=dK(i,p);l?f.scale=function(d){return d==="x"?{range:[0,p]}:d==="y"?{range:[-10,0]}:d===n?l:void 0}:u=!1}if(u){let p=uK(t,s);s===x2?(p.init(f,oF,l=>[l.__data__]),t.update()):p.init(f,f.querySelector("g:last-of-type"))}return f}function uK(t,e){let{channel:n,handler:r,selection:o}=t;if(r)return r;let i=lK(t);return e===x2?(t.handler=new Nc(i,{selection:o,channels:[n],peers:!1}),o.addEventListener("value",()=>t.update())):t.handler=new ra(i,{selection:o,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),t.handler}function lK(t){let{channel:e,plot:n}=t,r=t.field??pK(n.marks,e)??"value";if(r){let o={field:r};return{plot:n,channelField:i=>e===i?o:void 0}}}function pK(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 dK(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 $s({x:{...i,type:a,range:[0,e]}})}function g2(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 iF(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||g2(a,o||25,i,c);let f=Math.log(r),u=f>=0?0:~~(-f/c)+1,p=Math.pow(10,-u-1);f=Math.floor(t/r+p)*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 fF="year",sF="month",aF="day",y2="hour",b2="minute",w2="second",hK="millisecond",lm=1e3,pm=lm*60,dm=pm*60,v2=dm*24,mK=v2*7,cF=v2*30,uF=v2*365,um=[[w2,1,lm],[w2,5,5*lm],[w2,15,15*lm],[w2,30,30*lm],[b2,1,pm],[b2,5,5*pm],[b2,15,15*pm],[b2,30,30*pm],[y2,1,dm],[y2,3,3*dm],[y2,6,6*dm],[y2,12,12*dm],[aF,1,v2],[aF,7,mK],[sF,1,cF],[sF,3,3*cF],[fF,1,uF]];function lF(t,e,n){let r=e-t,o=r/n,i=Xr(s=>s[2]).right(um,o);return i===um.length?{interval:fF,step:g2(r/uF,n)}:i?(i=um[o/um[i-1][2]<um[i][2]/o?i-1:i],{interval:i[0],step:i[1]}):{interval:hK,step:g2(r,n,1)}}var xK=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function gK(t,e){return xK.has(`${t.type}-${e}`)}function MM(t,e={}){let n=(r,o)=>gK(r,o)?{[`${o}1`]:_M(r,o,t,e),[`${o}2`]:_M(r,o,t,{...e,offset:1})}:{[o]:_M(r,o,t,e)};return n[rp]=!0,n}function _M(t,e,n,r){return new SM(n,t,e,r)}function yK(t,e){let n=t.plot.getAttribute(`${e}Scale`);return n==="utc"||n==="time"}var SM=class extends vt{constructor(e,n,r,o){super("COLUMN_REF"),this.column=e,this.mark=n,this.channel=r,this.options=o}get stats(){return{column:this.column,stats:["min","max"]}}toString(){let{mark:e,channel:n,column:r,options:o}=this,{type:i,min:s,max:a}=e.channelField(n),{interval:c,steps:f,offset:u=0}=o,p=c??(i==="date"||yK(e,n)?"date":"number"),l;if(p==="number"){let{apply:d,sqlApply:h,sqlInvert:m}=Tc(e,n),x=iF(d(s),d(a),o),g=h(r),y=pe((x.max-x.min)/x.steps),b=ze(Pt(x.min===0?g:dt(g,x.min),y)),w=Rt(x.min,mt(y,u?Rt(u,b):b));l=m(w)}else{let{interval:d,step:h=1}=p==="date"?lF(s,a,f||40):o,m=av(r,d,h);l=u?Rt(m,Z0(d,u*h)):m}return`${l}`}};var bK=t=>t&&typeof t=="object"&&!Array.isArray(t);var hm=class extends Bn{constructor({element:e,filterBy:n,from:r,column:o,label:i=o,format:s=p=>p,options:a,value:c,field:f=o,as:u}={}){super(n),this.from=r,this.column=o,this.format=s,this.field=f;let p=this.selection=u;this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let l=document.createElement("label");if(l.innerText=i||o,this.element.appendChild(l),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(d=>bK(d)?d:{value:d}),this.selectedValue(c??""),this.update()),p){let d=!er(p);c!=null&&(!d||p.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)}):(this.select.addEventListener("pointerenter",h=>{h.buttons||this.activate()}),this.select.addEventListener("focus",()=>this.activate()))}}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}activate(){this.selection.activate(ss(this.field,0,{source:this}))}publish(e){let{selection:n,field:r}=this;if(er(n)){e===""&&(e=void 0);let o=ss(r,e,{source:this});n.update(o)}else _e(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?st.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=er(o)?o.valueFor(this):o.value;this.selectedValue(i??"")}return this}};var wK=0;var mm=class extends Bn{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_"+ ++wK,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)}),er(this.selection)?(this.searchbox.addEventListener("pointerenter",f=>{f.buttons||this.activate()}),this.searchbox.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",f=>{f!==this.searchbox.value&&(this.searchbox.value=f)}))}reset(){this.searchbox.value=""}clause(e){let{field:n,type:r}=this;return o_(n,e,{source:this,method:r})}activate(){this.selection.activate(this.clause(""))}publish(e){let{selection:n}=this;er(n)?n.update(this.clause(e)):_e(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?st.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 vK=0;var xm=class extends Bn{constructor({element:e,filterBy:n,as:r,min:o,max:i,step:s,from:a,column:c,label:f=c,value:u=r?.value,select:p="point",field:l=c,width:d}={}){if(super(n),this.id="slider_"+ ++vK,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=p,this.field=l,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),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:h}=this.slider;this.curval.innerText=h,this.selection&&this.publish(+h)}),this.selection&&(er(this.selection)?(this.slider.addEventListener("pointerenter",h=>{h.buttons||this.activate()}),this.slider.addEventListener("focus",()=>this.activate())):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:st.select({min:jn(r),max:Ke(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}clause(e){let{field:n,selectionType:r}=this;if(r==="interval"){let o=[this.min??0,e];return Ta(n,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step})}else return ss(n,e,{source:this})}activate(){this.selection.activate(this.clause(0))}publish(e){let{selection:n}=this;er(n)?n.update(this.clause(e)):_e(this.selection)&&n.update(e)}};var TM=pF(t=>{let e=_2(t);return n=>n==null?"":typeof n=="number"?e(n):n instanceof Date?EM(n):`${n}`}),_2=pF(t=>e=>e===0?"0":e.toLocaleString(t)),bUt=TM(),wUt=_2();function EM(t){return Jf(t,"Invalid Date")}function pF(t){let e=null,n;return(r="en")=>r===e?n:n=t(e=r)}var _K=-1;var gm=class extends Bn{constructor({element:e,filterBy:n,from:r,columns:o=["*"],align:i={},format:s,width:a,maxWidth:c,height:f=500,rowBatch:u=100,as:p}={}){super(n),this.id=`table-${++_K}`,this.from=r,this.columns=o,this.format=s,this.align=i,this.widths=typeof a=="object"?a:{},_e(r)&&r.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.pending=!1,this.selection=p,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 l=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:m}=this,{scrollHeight:x,scrollTop:g,clientHeight:y}=d.target,b=g<l;l=g,!(b||h||m)&&x-g<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",d=>{let h=SK(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)}sourceTable(){return _e(this.from)?this.from.value:this.from}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 ci(i,s,{source:this})}requestData(e=0){this.offset=e;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Sr().prefetch(n.clone().offset(e+this.limit))}fields(){let e=this.sourceTable();return this.columns.map(n=>oi(n,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=MK(this.format,e),this.style.innerText=EK(this.id,AK(this.align,e),TK(this.widths,e)),this}query(e=[]){let{limit:n,offset:r,schema:o,sortColumn:i,sortDesc:s}=this;return st.from(this.sourceTable()).select(o.map(a=>a.column)).where(e).orderby(i?s?wv(i):i:[]).limit(n).offset(r)}queryResult(e){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Wn(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:u}=r[a],p=o.map(l=>u[l.column]);for(let l=0;l<f;++l){let d=document.createElement("tr");Object.assign(d,{__row__:c+l});for(let h=0;h<s;++h){let m=p[h][l],x=document.createElement("td");x.innerText=m==null?"":n[h](m),d.appendChild(x)}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 SK(t){let e=t.parentElement;return Object.hasOwn(e,"__row__")?+e.__row__:-1}function MK(t={},e,n){return e.map(({column:r,type:o})=>{if(r in t)return t[r];switch(o){case"number":return _2(n);case"date":return EM;default:return TM(n)}})}function AK(t={},e){return e.map(({column:n,type:r})=>n in t?t[n]:r==="number"?"right":"left")}function TK(t={},e){return e.map(({column:n})=>t[n])}function EK(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 ym(t,...e){let n=t?.context?.coordinator??Sr();for(let r of e)n.connect(r)}function S2(t,e,n){let r=new e(n);return ym(t,r),r.element}function dF(t){return S2(this,hm,t)}function hF(t){return S2(this,mm,t)}function mF(t){return S2(this,xm,t)}function xF(t){return S2(this,gm,t)}function gF({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 yF(...t){return gF({direction:"vertical"},t.flat())}function bF(...t){return gF({direction:"horizontal"},t.flat())}function wF({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 vF(t){return wF({dim:"height",size:t})}function _F(t){return wF({dim:"width",size:t})}var M2={};Pc(M2,{align:()=>YM,ariaDescription:()=>QM,ariaLabel:()=>HM,aspectRatio:()=>UM,axis:()=>jM,clip:()=>VM,colorBase:()=>R8,colorClamp:()=>v8,colorConstant:()=>$8,colorDomain:()=>b8,colorExponent:()=>O8,colorInterpolate:()=>A8,colorLabel:()=>I8,colorN:()=>_8,colorNice:()=>S8,colorPercent:()=>N8,colorPivot:()=>T8,colorRange:()=>w8,colorReverse:()=>C8,colorScale:()=>y8,colorScheme:()=>M8,colorSymmetric:()=>E8,colorTickFormat:()=>L8,colorZero:()=>k8,facetGrid:()=>yA,facetLabel:()=>bA,facetMargin:()=>dA,facetMarginBottom:()=>mA,facetMarginLeft:()=>xA,facetMarginRight:()=>gA,facetMarginTop:()=>hA,fxAlign:()=>TA,fxAriaDescription:()=>jA,fxAriaLabel:()=>UA,fxAxis:()=>CA,fxDomain:()=>wA,fxFontVariant:()=>YA,fxGrid:()=>PA,fxInset:()=>_A,fxInsetLeft:()=>SA,fxInsetRight:()=>MA,fxLabel:()=>qA,fxLabelAnchor:()=>BA,fxLabelOffset:()=>zA,fxLine:()=>FA,fxPadding:()=>EA,fxPaddingInner:()=>IA,fxPaddingOuter:()=>NA,fxRange:()=>vA,fxReverse:()=>XA,fxRound:()=>AA,fxTickFormat:()=>$A,fxTickPadding:()=>OA,fxTickRotate:()=>DA,fxTickSize:()=>LA,fxTickSpacing:()=>RA,fxTicks:()=>kA,fyAlign:()=>JA,fyAriaDescription:()=>x8,fyAriaLabel:()=>m8,fyAxis:()=>n8,fyDomain:()=>WA,fyFontVariant:()=>h8,fyGrid:()=>f8,fyInset:()=>GA,fyInsetBottom:()=>QA,fyInsetTop:()=>HA,fyLabel:()=>l8,fyLabelAnchor:()=>p8,fyLabelOffset:()=>d8,fyLine:()=>u8,fyPadding:()=>KA,fyPaddingInner:()=>t8,fyPaddingOuter:()=>e8,fyRange:()=>VA,fyReverse:()=>g8,fyRound:()=>ZA,fyTickFormat:()=>a8,fyTickPadding:()=>s8,fyTickRotate:()=>c8,fyTickSize:()=>o8,fyTickSpacing:()=>i8,fyTicks:()=>r8,grid:()=>WM,height:()=>PM,inset:()=>XM,lengthBase:()=>xT,lengthClamp:()=>pT,lengthConstant:()=>yT,lengthDomain:()=>uT,lengthExponent:()=>gT,lengthNice:()=>dT,lengthPercent:()=>hT,lengthRange:()=>lT,lengthScale:()=>fT,lengthZero:()=>mT,margin:()=>RM,marginBottom:()=>zM,marginLeft:()=>FM,marginRight:()=>qM,marginTop:()=>BM,margins:()=>LM,name:()=>CM,opacityBase:()=>W8,opacityClamp:()=>q8,opacityConstant:()=>G8,opacityDomain:()=>P8,opacityExponent:()=>V8,opacityLabel:()=>z8,opacityNice:()=>B8,opacityPercent:()=>Y8,opacityRange:()=>F8,opacityReverse:()=>U8,opacityScale:()=>D8,opacityTickFormat:()=>X8,opacityZero:()=>j8,padding:()=>GM,projectionClip:()=>NT,projectionDomain:()=>ST,projectionInset:()=>MT,projectionInsetBottom:()=>IT,projectionInsetLeft:()=>AT,projectionInsetRight:()=>TT,projectionInsetTop:()=>ET,projectionParallels:()=>wT,projectionPrecision:()=>vT,projectionRotate:()=>_T,projectionType:()=>bT,rBase:()=>sT,rClamp:()=>eT,rConstant:()=>cT,rDomain:()=>K8,rExponent:()=>aT,rLabel:()=>rT,rNice:()=>nT,rPercent:()=>oT,rRange:()=>tT,rScale:()=>J8,rZero:()=>iT,style:()=>$M,symbolDomain:()=>Q8,symbolRange:()=>Z8,symbolScale:()=>H8,width:()=>DM,xAlign:()=>s5,xAriaDescription:()=>A5,xAriaLabel:()=>M5,xAxis:()=>u5,xBase:()=>N5,xClamp:()=>o5,xConstant:()=>k5,xDomain:()=>JM,xExponent:()=>C5,xFontVariant:()=>S5,xGrid:()=>g5,xInset:()=>e5,xInsetLeft:()=>n5,xInsetRight:()=>r5,xLabel:()=>b5,xLabelAnchor:()=>w5,xLabelArrow:()=>v5,xLabelOffset:()=>_5,xLine:()=>y5,xNice:()=>t5,xPadding:()=>a5,xPaddingInner:()=>c5,xPaddingOuter:()=>f5,xPercent:()=>T5,xRange:()=>KM,xReverse:()=>E5,xRound:()=>i5,xScale:()=>ZM,xTickFormat:()=>m5,xTickPadding:()=>h5,xTickRotate:()=>x5,xTickSize:()=>p5,xTickSpacing:()=>d5,xTicks:()=>l5,xZero:()=>I5,xyDomain:()=>OM,yAlign:()=>z5,yAriaDescription:()=>sA,yAriaLabel:()=>iA,yAxis:()=>X5,yBase:()=>uA,yClamp:()=>q5,yConstant:()=>pA,yDomain:()=>R5,yExponent:()=>lA,yFontVariant:()=>oA,yGrid:()=>J5,yInset:()=>D5,yInsetBottom:()=>F5,yInsetTop:()=>P5,yLabel:()=>tA,yLabelAnchor:()=>eA,yLabelArrow:()=>nA,yLabelOffset:()=>rA,yLine:()=>K5,yNice:()=>$5,yPadding:()=>Y5,yPaddingInner:()=>U5,yPaddingOuter:()=>j5,yPercent:()=>aA,yRange:()=>O5,yReverse:()=>cA,yRound:()=>B5,yScale:()=>L5,yTickFormat:()=>Q5,yTickPadding:()=>H5,yTickRotate:()=>Z5,yTickSize:()=>V5,yTickSpacing:()=>G5,yTicks:()=>W5,yZero:()=>fA});var bm=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()}},IM=new bm;function NM(t,e,n){(t?.context?.namedPlots??IM).request(e,n)}function SF(t,e,n){(t?.context?.namedPlots??IM).set(e,n)}function CM(t){return e=>SF(this,t,e)}function MF(t,e,n){_e(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 IK(t,e){return n=>{MF(n,t,e)}}function kM(t){return e=>{for(let[n,r]of Object.entries(t))MF(e,n,r)}}function LM(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),kM(i)}function RM(t){return kM({marginTop:t,marginBottom:t,marginLeft:t,marginRight:t})}function OM(t){return kM({xDomain:t,yDomain:t})}var R=t=>e=>IK(t,e),$M=R("style"),DM=R("width"),PM=R("height"),FM=R("marginLeft"),qM=R("marginRight"),BM=R("marginTop"),zM=R("marginBottom"),YM=R("align"),UM=R("aspectRatio"),jM=R("axis"),XM=R("inset"),WM=R("grid"),VM=R("clip"),GM=R("padding"),HM=R("ariaLabel"),QM=R("ariaDescription"),ZM=R("xScale"),JM=R("xDomain"),KM=R("xRange"),t5=R("xNice"),e5=R("xInset"),n5=R("xInsetLeft"),r5=R("xInsetRight"),o5=R("xClamp"),i5=R("xRound"),s5=R("xAlign"),a5=R("xPadding"),c5=R("xPaddingInner"),f5=R("xPaddingOuter"),u5=R("xAxis"),l5=R("xTicks"),p5=R("xTickSize"),d5=R("xTickSpacing"),h5=R("xTickPadding"),m5=R("xTickFormat"),x5=R("xTickRotate"),g5=R("xGrid"),y5=R("xLine"),b5=R("xLabel"),w5=R("xLabelAnchor"),v5=R("xLabelArrow"),_5=R("xLabelOffset"),S5=R("xFontVariant"),M5=R("xAriaLabel"),A5=R("xAriaDescription"),T5=R("xPercent"),E5=R("xReverse"),I5=R("xZero"),N5=R("xBase"),C5=R("xExponent"),k5=R("xConstant"),L5=R("yScale"),R5=R("yDomain"),O5=R("yRange"),$5=R("yNice"),D5=R("yInset"),P5=R("yInsetTop"),F5=R("yInsetBottom"),q5=R("yClamp"),B5=R("yRound"),z5=R("yAlign"),Y5=R("yPadding"),U5=R("yPaddingInner"),j5=R("yPaddingOuter"),X5=R("yAxis"),W5=R("yTicks"),V5=R("yTickSize"),G5=R("yTickSpacing"),H5=R("yTickPadding"),Q5=R("yTickFormat"),Z5=R("yTickRotate"),J5=R("yGrid"),K5=R("yLine"),tA=R("yLabel"),eA=R("yLabelAnchor"),nA=R("yLabelArrow"),rA=R("yLabelOffset"),oA=R("yFontVariant"),iA=R("yAriaLabel"),sA=R("yAriaDescription"),aA=R("yPercent"),cA=R("yReverse"),fA=R("yZero"),uA=R("yBase"),lA=R("yExponent"),pA=R("yConstant"),dA=R("facetMargin"),hA=R("facetMarginTop"),mA=R("facetMarginBottom"),xA=R("facetMarginLeft"),gA=R("facetMarginRight"),yA=R("facetGrid"),bA=R("facetLabel"),wA=R("fxDomain"),vA=R("fxRange"),_A=R("fxInset"),SA=R("fxInsetLeft"),MA=R("fxInsetRight"),AA=R("fxRound"),TA=R("fxAlign"),EA=R("fxPadding"),IA=R("fxPaddingInner"),NA=R("fxPaddingOuter"),CA=R("fxAxis"),kA=R("fxTicks"),LA=R("fxTickSize"),RA=R("fxTickSpacing"),OA=R("fxTickPadding"),$A=R("fxTickFormat"),DA=R("fxTickRotate"),PA=R("fxGrid"),FA=R("fxLine"),qA=R("fxLabel"),BA=R("fxLabelAnchor"),zA=R("fxLabelOffset"),YA=R("fxFontVariant"),UA=R("fxAriaLabel"),jA=R("fxAriaDescription"),XA=R("fxReverse"),WA=R("fyDomain"),VA=R("fyRange"),GA=R("fyInset"),HA=R("fyInsetTop"),QA=R("fyInsetBottom"),ZA=R("fyRound"),JA=R("fyAlign"),KA=R("fyPadding"),t8=R("fyPaddingInner"),e8=R("fyPaddingOuter"),n8=R("fyAxis"),r8=R("fyTicks"),o8=R("fyTickSize"),i8=R("fyTickSpacing"),s8=R("fyTickPadding"),a8=R("fyTickFormat"),c8=R("fyTickRotate"),f8=R("fyGrid"),u8=R("fyLine"),l8=R("fyLabel"),p8=R("fyLabelAnchor"),d8=R("fyLabelOffset"),h8=R("fyFontVariant"),m8=R("fyAriaLabel"),x8=R("fyAriaDescription"),g8=R("fyReverse"),y8=R("colorScale"),b8=R("colorDomain"),w8=R("colorRange"),v8=R("colorClamp"),_8=R("colorN"),S8=R("colorNice"),M8=R("colorScheme"),A8=R("colorInterpolate"),T8=R("colorPivot"),E8=R("colorSymmetric"),I8=R("colorLabel"),N8=R("colorPercent"),C8=R("colorReverse"),k8=R("colorZero"),L8=R("colorTickFormat"),R8=R("colorBase"),O8=R("colorExponent"),$8=R("colorConstant"),D8=R("opacityScale"),P8=R("opacityDomain"),F8=R("opacityRange"),q8=R("opacityClamp"),B8=R("opacityNice"),z8=R("opacityLabel"),Y8=R("opacityPercent"),U8=R("opacityReverse"),j8=R("opacityZero"),X8=R("opacityTickFormat"),W8=R("opacityBase"),V8=R("opacityExponent"),G8=R("opacityConstant"),H8=R("symbolScale"),Q8=R("symbolDomain"),Z8=R("symbolRange"),J8=R("rScale"),K8=R("rDomain"),tT=R("rRange"),eT=R("rClamp"),nT=R("rNice"),rT=R("rLabel"),oT=R("rPercent"),iT=R("rZero"),sT=R("rBase"),aT=R("rExponent"),cT=R("rConstant"),fT=R("lengthScale"),uT=R("lengthDomain"),lT=R("lengthRange"),pT=R("lengthClamp"),dT=R("lengthNice"),hT=R("lengthPercent"),mT=R("lengthZero"),xT=R("lengthBase"),gT=R("lengthExponent"),yT=R("lengthConstant"),bT=R("projectionType"),wT=R("projectionParallels"),vT=R("projectionPrecision"),_T=R("projectionRotate"),ST=R("projectionDomain"),MT=R("projectionInset"),AT=R("projectionInsetLeft"),TT=R("projectionInsetRight"),ET=R("projectionInsetTop"),IT=R("projectionInsetBottom"),NT=R("projectionClip");function AF(t,e){return{table:t,options:e}}var T2={};Pc(T2,{area:()=>CT,areaX:()=>kT,areaY:()=>LT,arrow:()=>AE,axisFx:()=>CE,axisFy:()=>kE,axisX:()=>IE,axisY:()=>NE,barX:()=>DT,barY:()=>PT,cell:()=>FT,cellX:()=>qT,cellY:()=>BT,circle:()=>VT,contour:()=>lE,delaunayLink:()=>_E,delaunayMesh:()=>SE,denseLine:()=>uE,density:()=>fE,densityX:()=>aE,densityY:()=>cE,dot:()=>jT,dotX:()=>XT,dotY:()=>WT,errorbarX:()=>yE,errorbarY:()=>bE,frame:()=>EE,geo:()=>DE,graticule:()=>FE,gridFx:()=>OE,gridFy:()=>$E,gridX:()=>LE,gridY:()=>RE,heatmap:()=>pE,hexagon:()=>GT,hexbin:()=>mE,hexgrid:()=>xE,hull:()=>ME,image:()=>sE,line:()=>RT,lineX:()=>OT,lineY:()=>$T,link:()=>TE,raster:()=>dE,rasterTile:()=>hE,rect:()=>zT,rectX:()=>YT,rectY:()=>UT,regressionY:()=>gE,ruleX:()=>JT,ruleY:()=>KT,sphere:()=>PE,spike:()=>iE,text:()=>HT,textX:()=>QT,textY:()=>ZT,tickX:()=>tE,tickY:()=>eE,vector:()=>nE,vectorX:()=>rE,vectorY:()=>oE,voronoi:()=>wE,voronoiMesh:()=>vE,waffleX:()=>qE,waffleY:()=>BE});var NK=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function pt(t,e,n={}){arguments.length===2&&!Array.isArray(e)&&(n=e,e=NK.has(t)?null:[{}]);let r=t.startsWith("area")||t.startsWith("line")?Wh:$e;return A2(r,t,e,n)}function A2(t,e,n,r){return o=>{o.addMark(new t(e,n,r))}}function Qo(t,e,n){return r=>{r.addMark(new t(e,n))}}var CT=(...t)=>pt("area",...t),kT=(...t)=>pt("areaX",...t),LT=(...t)=>pt("areaY",...t),RT=(...t)=>pt("line",...t),OT=(...t)=>pt("lineX",...t),$T=(...t)=>pt("lineY",...t),DT=(...t)=>pt("barX",...t),PT=(...t)=>pt("barY",...t),FT=(...t)=>pt("cell",...t),qT=(...t)=>pt("cellX",...t),BT=(...t)=>pt("cellY",...t),zT=(...t)=>pt("rect",...t),YT=(...t)=>pt("rectX",...t),UT=(...t)=>pt("rectY",...t),jT=(...t)=>pt("dot",...t),XT=(...t)=>pt("dotX",...t),WT=(...t)=>pt("dotY",...t),VT=(...t)=>pt("circle",...t),GT=(...t)=>pt("hexagon",...t),HT=(...t)=>pt("text",...t),QT=(...t)=>pt("textX",...t),ZT=(...t)=>pt("textY",...t),JT=(...t)=>pt("ruleX",...t),KT=(...t)=>pt("ruleY",...t),tE=(...t)=>pt("tickX",...t),eE=(...t)=>pt("tickY",...t),nE=(...t)=>pt("vector",...t),rE=(...t)=>pt("vectoX",...t),oE=(...t)=>pt("vectorY",...t),iE=(...t)=>pt("spike",...t),sE=(...t)=>pt("image",...t),aE=(...t)=>A2(Uu,"areaX",...t),cE=(...t)=>A2(Uu,"areaY",...t),fE=(...t)=>Qo(Kh,...t),uE=(...t)=>Qo(Jh,...t),lE=(...t)=>Qo(Hh,...t),pE=(...t)=>Qo(Zh,...t),dE=(...t)=>Qo(ea,...t),hE=(...t)=>Qo(nm,...t),mE=(...t)=>Qo(em,...t),xE=(...t)=>pt("hexgrid",...t),gE=(...t)=>Qo(rm,...t),yE=(...t)=>A2(Xu,"ruleY",...t),bE=(...t)=>Qo(Xu,"ruleX",...t),wE=(...t)=>pt("voronoi",...t),vE=(...t)=>pt("voronoiMesh",...t),_E=(...t)=>pt("delaunayLink",...t),SE=(...t)=>pt("delaunayMesh",...t),ME=(...t)=>pt("hull",...t),AE=(...t)=>pt("arrow",...t),TE=(...t)=>pt("link",...t),EE=(...t)=>pt("frame",...t),IE=(...t)=>pt("axisX",...t),NE=(...t)=>pt("axisY",...t),CE=(...t)=>pt("axisFx",...t),kE=(...t)=>pt("axisFy",...t),LE=(...t)=>pt("gridX",...t),RE=(...t)=>pt("gridY",...t),OE=(...t)=>pt("gridFx",...t),$E=(...t)=>pt("gridFy",...t),DE=(...t)=>Qo(tm,...t),PE=(...t)=>pt("sphere",...t),FE=(...t)=>pt("graticule",...t),qE=(...t)=>pt("waffleX",...t),BE=(...t)=>pt("waffleY",...t);var E2={};Pc(E2,{highlight:()=>zE,intervalX:()=>YE,intervalXY:()=>jE,intervalY:()=>UE,nearest:()=>XE,nearestX:()=>WE,nearestY:()=>VE,pan:()=>KE,panX:()=>t7,panY:()=>e7,panZoom:()=>n7,panZoomX:()=>r7,panZoomY:()=>o7,region:()=>GE,toggle:()=>Cc,toggleColor:()=>JE,toggleX:()=>HE,toggleY:()=>QE,toggleZ:()=>ZE});function Zo(t,e){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new t(r,e))}}function zE({by:t,...e}){return Zo(om,{selection:t,channels:e})}function YE({as:t,...e}){return Zo(ra,{...e,selection:t,channel:"x"})}function UE({as:t,...e}){return Zo(ra,{...e,selection:t,channel:"y"})}function jE({as:t,...e}){return Zo(am,{...e,selection:t})}function XE({as:t,...e}){return Zo(Ec,{...e,selection:t,pointer:"xy"})}function WE({as:t,...e}){return Zo(Ec,{...e,selection:t,pointer:"x"})}function VE({as:t,...e}){return Zo(Ec,{...e,selection:t,pointer:"y"})}function GE({as:t,...e}){return Zo(fm,{...e,selection:t})}function Cc({as:t,...e}){return Zo(Nc,{...e,selection:t})}function HE(t){return Cc({...t,channels:["x"]})}function QE(t){return Cc({...t,channels:["y"]})}function ZE(t){return Cc({...t,channels:["z"]})}function JE(t){return Cc({...t,channels:["color"]})}function Gu(t){return Zo(cm,t)}function KE(t={}){return Gu({...t,zoom:!1})}function t7(t={}){return Gu({...t,zoom:!1,pany:!1})}function e7(t={}){return Gu({...t,zoom:!1,panx:!1})}function n7(t={}){return Gu(t)}function r7(t={}){return Gu({...t,pany:!1})}function o7(t={}){return Gu({...t,panx:!1})}var I2={};Pc(I2,{colorLegend:()=>s7,opacityLegend:()=>a7,symbolLegend:()=>c7});function i7(t,e={}){if(e.for){let{for:n,...r}=e,o=new Vu(t,r),i=typeof n,s=a=>a.addLegend(o,!1);return i==="string"?NM(this,n,s):n.value&&s(n.value),o.element}else return n=>n.addLegend(new Vu(t,e))}function s7(t){return i7.call(this,"color",t)}function a7(t){return i7.call(this,"opacity",t)}function c7(t){return i7.call(this,"symbol",t)}function TF(...t){let e=new jh;return t.flat().forEach(n=>n(e)),ym(this,...e.marks),e.update(),e.element}function u7({coordinator:t=Sr(),namedPlots:e=new bm,extensions:n=null,...r}={}){return{...f7,...n,context:{coordinator:t,namedPlots:e,...r}}}var EF="spec",N2="literal",vjt="dataref",IF="options",NF="selection",CF="paramref",kF="columnparamref",LF="param",RF="include",l7="select",C2="value",OF="crossfilter",k2="intersect",$F="union",DF="single",PF="data",FF="expression",kc="sql",wm="input",Hu="hconcat",Qu="vconcat",Zu="hspace",Ju="vspace",L2="mark",p7="from",Ku="plot",vm="legend",qF="attribute",d7="transform",BF="interactor",_m="Fixed";var gt=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 Sm=class extends gt{constructor(e,n,r,o,i,s){super(EF,[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,u]of i)c[f]=u.toJSON()}if(s?.size){let c=a.params={};for(let[f,u]of s)c[f]=u.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 Mm(t){let e=typeof t;return e==="object"?t?.param:e==="string"?CK(t):null}function CK(t){return t?.[0]==="$"?t.slice(1):null}function Am(t){return`$${t}`}function tl(t){return[t].flat()}function Fr(t){return Array.isArray(t)}function el(t){return t!==null&&typeof t=="object"&&!Fr(t)}function oa(t){return typeof t=="string"}function nl(t,e){throw Object.assign(Error(t),{data:e})}var kK=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function zF(t,e){return kK.test(t+="")?new Date(t):e}function Ze(t,e){let n={};for(let r in t)n[r]=e.maybeSelection(t[r]);return new ia(n)}var ia=class t extends gt{constructor(e){super(IF),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 jF="table",XF="parquet",WF="csv",h7="json",B2="spatial",YF=new Map([[jF,$K],[XF,DK],[WF,PK],[h7,FK],[B2,qK]]);function VF(t,e,n){let r=LK(e);if(YF.has(r.type))return YF.get(r.type)(t,r,n);n.error("Unrecognized data format type.",e)}function LK(t){return Fr(t)&&(t={type:"json",data:t}),oa(t)&&(t={type:"table",query:t}),{...t,type:RK(t)}}function RK(t){return t.type||OK(t.file)||"table"}function OK(t){let e=t?.lastIndexOf(".");return e>0?t.slice(e+1):null}function $K(t,e,n){let{query:r,type:o,...i}=e;return new O2(t,r,Ze(i,n))}function DK(t,e,n){let{file:r,type:o,...i}=e;return new D2(t,r,Ze(i,n))}function PK(t,e,n){let{file:r,type:o,...i}=e;return new P2(t,r,Ze(i,n))}function FK(t,e,n){let{data:r,file:o,type:i,...s}=e,a=Ze(s,n);return r?new q2(t,r,a):new F2(t,o,a)}function qK(t,e,n){let{file:r,type:o,...i}=e;return new $2(t,r,Ze(i,n))}function UF(t,e){return e?new URL(t,e).toString():t}function BK(t,e){let n=t?.codegen(e);return n?`, ${n}`:""}var R2=class extends gt{constructor(e,n){super(PF),this.name=e,this.format=n}},rl=class extends R2{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}},O2=class extends rl{constructor(e,n,r){super(e,jF),this.query=n?.trim(),this.options=r}instantiateQuery(e){let{name:n,query:r,options:o}=this;if(r)return e.api.createTable(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,query:r,options:o}=this;if(r)return`\`${co(n,r,o.instantiate(e))}\``}toJSON(){let{format:e,query:n,options:r}=this;return{type:e,query:n,...r.toJSON()}}},Lc=class extends rl{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=UF(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=UF(o,e.baseURL),a=BK(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()}}},$2=class extends Lc{constructor(e,n,r){super(e,B2,"loadSpatial",n,r)}},D2=class extends Lc{constructor(e,n,r){super(e,XF,"loadParquet",n,r)}},P2=class extends Lc{constructor(e,n,r){super(e,WF,"loadCSV",n,r)}},F2=class extends Lc{constructor(e,n,r){super(e,h7,"loadJSON",n,r)}},q2=class extends rl{constructor(e,n,r){super(e,h7),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=`[
60
+ }`)).call(yu,n);for(let $ of f){let{channels:P,values:F,facets:q}=m.get($);if(h===void 0||$.facet==="super"){let V=null;if(q&&(V=q[0],V=$.filter(V,P,F),V.length===0))continue;let K=$.render(V,y,F,v,S);if(K==null)continue;T.appendChild(K)}else{let V;for(let K of h){if(!($.facetAnchor?.(h,k,K)??!K.empty))continue;let et=null;if(q){let j=p.has($);if(et=q[j?K.i:0],et=$.filter(et,P,F),et.length===0)continue;!j&&et===q[0]&&(et=Oi(et)),et.fx=K.x,et.fy=K.y,et.fi=K.i}let rt=$.render(et,y,F,_,S);if(rt!=null){(V??=Nt(T).append("g")).append(()=>rt).datum(K);for(let j of["aria-label","aria-description","aria-hidden","transform"])rt.hasAttribute(j)&&(V.attr(j,rt.getAttribute(j)),rt.removeAttribute(j))}}V?.selectChildren().attr("transform",O)}}let N=JO(g,S,t),{figure:L=r!=null||o!=null||i!=null||N.length>0}=t;L&&(I=E.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(d$(E,r,"h2")),o!=null&&I.append(d$(E,o,"h3")),I.append(...N,T),i!=null&&I.append(GH(E,i)),"value"in T&&(I.value=T.value,delete T.value)),I.scale=qR(y.scales),I.legend=QO(g,S,t);let D=gR();return D>0&&Nt(T).append("text").attr("x",M).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.`),I}function d$(t,e,n){if(e.ownerDocument)return e;let r=t.createElement(n);return r.append(e),r}function GH(t,e){let n=t.createElement("figcaption");return n.append(e),n}function h$(t){return t.flat(1/0).filter(e=>e!=null).map(HH)}function HH(t){return typeof t.render=="function"?t:new k4(t)}var k4=class extends lt{constructor(e){if(typeof e!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=e}render(){}};function L4(t,e){for(let n in t)y$(t[n],e);return t}function y$(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:AS(s,o)}=e[n]??{};a!=null&&(t.value=It(t.value,a),t.transform=!1)}function QH(t){for(let e in t)zS(e,t[e])}function mh(t,e,n,r=vL){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(!QR(n)){let c=n.x?.domain===void 0,f=n.y?.domain===void 0;if(c||f){let[u,p]=JR(s);c&&N4(t,"x",u),f&&N4(t,"y",p)}}}else N4(t,a,s)}return t}function N4(t,e,n){let r=t.get(e);r!==void 0?r.push(n):t.set(e,[n])}function ZH(t,e){if(t==null)return;let{x:n,y:r}=t;if(n==null&&r==null)return;let o=Li(t.data);if(o==null)throw new Error("missing facet data");let i={};n!=null&&(i.fx=lu(o,{value:n,scale:"fx"})),r!=null&&(i.fy=lu(o,{value:r,scale:"fy"})),L4(i,e);let s=Z1(o,i);return{channels:i,groups:s,data:t.data}}function m$(t,e,n){if(t.facet===null||t.facet==="super")return;let{fx:r,fy:o}=t;if(r!=null||o!=null){let c=Li(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=lu(c,{value:r,scale:"fx"})),o!=null&&(f.fy=lu(c,{value:o,scale:"fy"})),L4(f,n),{channels:f,groups:Z1(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)&&Cs(Li(t.data))===Cs(a)&&_n(`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 JH(t,e={}){return Kt({...e,x:null,y:null},(n,r,o,i,s,a)=>a.getMarkState(t))}function KH(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)?Bs:/^y$/i.test(o)?Yi:qs,r=o(JH(n,r)),r.title=null,i===void 0&&(r.preferredAnchor=o===Yi?"left":"bottom");let s=Tb(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,e.push(s)}}return e}function tQ(t,e,n){let{projection:r,x:o={},y:i={},fx:s={},fy:a={},axis:c,grid:f,facet:u={},facet:{axis:p=c,grid:l}=u,x:{axis:d=c,grid:h=d===null?null:f}=o,y:{axis:m=c,grid:g=m===null?null:f}=i,fx:{axis:x=p,grid:y=x===null?null:l}=s,fy:{axis:b=p,grid:w=b===null?null:l}=a}=n;(r||!Ro(o)&&!g$("x",t))&&(d=h=null),(r||!Ro(i)&&!g$("y",t))&&(m=g=null),e.has("fx")||(x=y=null),e.has("fy")||(b=w=null),d===void 0&&(d=!Nb(t,"x")),m===void 0&&(m=!Nb(t,"y")),x===void 0&&(x=!Nb(t,"fx")),b===void 0&&(b=!Nb(t,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),x===!0&&(x=d==="top"||d===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return Cb(_,w,yb,a),Ib(_,b,mb,"right","left",u,a),Cb(_,y,wb,s),Ib(_,x,gb,"top","bottom",u,s),Cb(_,g,xb,i),Ib(_,m,sh,"left","right",n,i),Cb(_,h,bb,o),Ib(_,d,ah,"bottom","top",n,o),_}function Ib(t,e,n,r,o,i,s){if(!e)return;let a=eQ(e);s=nQ(a?r:e,i,s);let{line:c}=s;(n===sh||n===ah)&&c&&!Di(c)&&t.push(Iu(rQ(s))),t.push(n(s)),a&&t.push(n({...s,anchor:o,label:null}))}function Cb(t,e,n,r){!e||Di(e)||t.push(n(oQ(e,r)))}function eQ(t){return/^\s*both\s*$/i.test(t)}function nQ(t,e,{line:n=e.line,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:u,ariaDescription:p,label:l=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:u,ariaDescription:p,label:l,labelAnchor:d,labelArrow:h,labelOffset:m}}function rQ(t){let{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:n===!0?void 0:n}}function oQ(t,{stroke:e=ks(t)?t:void 0,ticks:n=iQ(t)?t:void 0,tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}function iQ(t){switch(typeof t){case"number":return!0;case"string":return!ks(t)}return Bn(t)||typeof t?.range=="function"}function Nb(t,e){let n=`${e}-axis `;return t.some(r=>r.ariaLabel?.startsWith(n))}function g$(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 sQ(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 aQ({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=G1(n),f=t&&x$(t),u=e&&x$(e);return{marginTop:e?u[0]:r,marginRight:t?a-f[1]:o,marginBottom:e?c-u[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 x$(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 cQ=new Map([["basis",U3],["basis-closed",j3],["basis-open",X3],["bundle",W3],["bump-x",F3],["bump-y",q3],["cardinal",V3],["cardinal-closed",G3],["cardinal-open",H3],["catmull-rom",Q3],["catmull-rom-closed",Z3],["catmull-rom-open",J3],["linear",Ii],["linear-closed",K3],["monotone-x",eS],["monotone-y",nS],["natural",rS],["step",oS],["step-after",sS],["step-before",iS]]);function gh(t=Ii,e){if(typeof t=="function")return t;let n=cQ.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 kb(t=Ws,e){return typeof t!="function"&&`${t}`.toLowerCase()==="auto"?Ws:gh(t,e)}function Ws(t){return Ii(t)}function Uo(t={y:"count"},e={}){[t,e]=O4(t,e);let{x:n,y:r}=e;return R4(Lb(n,e,W),null,null,r,t,lc(e))}function jo(t={x:"count"},e={}){[t,e]=O4(t,e);let{x:n,y:r}=e;return R4(null,Lb(r,e,W),n,null,t,pc(e))}function ji(t={fill:"count"},e={}){[t,e]=O4(t,e);let{x:n,y:r}=fQ(e);return R4(n,r,null,null,t,lc(pc(e)))}function v$(t,e,n={}){if(n?.interval==null)return n;let{reduce:r=Y1}=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 Nu(t={}){return v$(Uo,"y",Jr(t,"x"))}function ku(t={}){return v$(jo,"x",Jr(t,"y"))}function R4(t,e,n,r,{data:o=z1,filter:i=Gd,sort:s,reverse:a,...c}={},f={}){t=b$(t),e=b$(e),c=uQ(c,f),o=M$(o,W),s=s==null?void 0:_$("sort",s,f),i=i==null?void 0:S$("filter",i,f),n!=null&&Fo(c,"x","x1","x2")&&(n=null),r!=null&&Fo(c,"y","y1","y2")&&(r=null);let[u,p]=un(t),[l,d]=un(t),[h,m]=un(e),[g,x]=un(e),[y,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=un(y),{x:v,y:S,z:E,fill:T,stroke:I,x1:A,x2:k,y1:O,y2:M,domain:C,cumulative:N,thresholds:L,interval:D,...$}=f,[P,F]=un(E),[q]=ce(T),[V]=ce(I),[K,et]=un(q),[rt,j]=un(V);return{..."z"in f&&{z:P||E},..."fill"in f&&{fill:K||T},..."stroke"in f&&{stroke:rt||I},...Ne($,(nt,Y,G)=>{let tt=sc(ut(nt,y),G?.[b]),B=ut(nt,E),_t=ut(nt,q),ct=ut(nt,V),kt=Zd(c,{z:B,fill:_t,stroke:ct}),Lt=[],Z=[],jt=tt&&_([]),Zn=B&&F([]),ro=_t&&et([]),pq=ct&&j([]),S7=t&&p([]),dq=t&&d([]),M7=e&&m([]),hq=e&&x([]),mq=dQ(t,e,nt),gq=0;for(let $c of c)$c.initialize(nt);s&&s.initialize(nt),i&&i.initialize(nt);for(let $c of Y){let A7=[];for(let Dc of c)Dc.scope("facet",$c);s&&s.scope("facet",$c),i&&i.scope("facet",$c);for(let[Dc,xq]of Po($c,kt))for(let[yq,Im]of Po(xq,tt))for(let[oo,Jo]of mq(Im))if(kt&&(Jo.z=Dc),!(i&&!i.reduce(oo,Jo))){A7.push(gq++),Z.push(o.reduceIndex(oo,nt,Jo)),tt&&jt.push(yq),B&&Zn.push(kt===B?Dc:B[(oo.length>0?oo:Im)[0]]),_t&&ro.push(kt===_t?Dc:_t[(oo.length>0?oo:Im)[0]]),ct&&pq.push(kt===ct?Dc:ct[(oo.length>0?oo:Im)[0]]),S7&&(S7.push(Jo.x1),dq.push(Jo.x2)),M7&&(M7.push(Jo.y1),hq.push(Jo.y2));for(let bq of c)bq.reduce(oo,Jo);s&&s.reduce(oo,Jo)}Lt.push(A7)}return FS(Lt,s,a),{data:Z,facets:Lt}}),...!Fo(c,"x")&&(u?{x1:u,x2:l,x:su(u,l)}:{x:v,x1:A,x2:k}),...!Fo(c,"y")&&(h?{y1:h,y2:g,y:su(h,g)}:{y:S,y1:O,y2:M}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:nt,output:Y})=>[nt,Y]))}}function O4({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function Lb(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return t={...$r(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=$4(t.thresholds,t.interval),t}function fQ(t){let{x:e,y:n}=t;return e=Lb(e,t),n=Lb(n,t),[e.value,n.value]=ge(e.value,n.value),{x:e,y:n}}function b$(t){if(t==null)return;let{value:e,cumulative:n,domain:r=Ft,thresholds:o}=t,i=s=>{let a=ut(s,e),c;if(fe(a)||pQ(o)){a=It(a,wS,Float64Array);let[u,p]=typeof r=="function"?r(a):r,l=typeof o=="function"&&!Ns(o)?o(a,u,p):o;typeof l=="number"&&(l=md(u,p,l)),Ns(l)&&(r===Ft&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p))),c=l}else{a=Ce(a);let[u,p]=typeof r=="function"?r(a):r,l=typeof o=="function"&&!Ns(o)?o(a,u,p):o;if(typeof l=="number")if(r===Ft){let d=ui(u,p,l);if(isFinite(d))if(d>0){let h=Math.round(u/d),m=Math.round(p/d);h*d<=u||--h,m*d>p||++m;let g=m-h+1;l=new Float64Array(g);for(let x=0;x<g;++x)l[x]=(h+x)*d}else if(d<0){d=-d;let h=Math.round(u*d),m=Math.round(p*d);h/d<=u||--h,m/d>p||++m;let g=m-h+1;l=new Float64Array(g);for(let x=0;x<g;++x)l[x]=(h+x)/d}else l=[u];else l=[u]}else l=an(u,p,l);else Ns(l)&&(r===Ft&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p)));c=l}let f=[];if(c.length===1)f.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)f.push([c[u-1],c[u]]);return f.bin=(n<0?mQ:n>0?hQ:D4)(f,c,a),f};return i.label=ln(e),i}function $4(t,e,n=w$){if(t===void 0)return e===void 0?n:$o(e);if(typeof t=="string"){switch(t.toLowerCase()){case"freedman-diaconis":return Sg;case"scott":return up;case"sturges":return as;case"auto":return w$}return oc(t)}return t}function uQ(t,e){return DS(t,e,_$)}function _$(t,e,n){return q1(t,e,n,S$)}function S$(t,e,n){return B1(t,e,n,M$)}function M$(t,e){return uu(t,e,lQ)}function lQ(t){switch(`${t}`.toLowerCase()){case"x":return gQ;case"x1":return yQ;case"x2":return bQ;case"y":return xQ;case"y1":return wQ;case"y2":return vQ;case"z":return qS}throw new Error(`invalid bin reduce: ${t}`)}function w$(t,e,n){return Math.min(200,up(t,e,n))}function pQ(t){return ML(t)||Bn(t)&&fe(t)}function dQ(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 u=o.bin(s[a]);for(let[p,[l,d]]of o.entries())yield[u[p],{data:n,x1:c,y1:l,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 D4(t,e,n){return e=Ce(e),r=>{let o=t.map(()=>[]);for(let i of r)o[ci(e,n[i])-1]?.push(i);return o}}function hQ(t,e,n){let r=D4(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 u of c)f.push(u)}return i}}function mQ(t,e,n){let r=D4(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 A$(t,e){let n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}var gQ={reduceIndex(t,e,{x1:n,x2:r}){return A$(n,r)}},xQ={reduceIndex(t,e,{y1:n,y2:r}){return A$(n,r)}},yQ={reduceIndex(t,e,{x1:n}){return n}},bQ={reduceIndex(t,e,{x2:n}){return n}},wQ={reduceIndex(t,e,{y1:n}){return n}},vQ={reduceIndex(t,e,{y2:n}){return n}};var _Q={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},yc=class extends lt{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:vn(n),optional:!0}},n,_Q),this.z=a,this.curve=gh(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 ot("svg:g",i).call(wt,this,o,i).call(gt,this,n,0,0).call(u=>u.selectAll().data(rb(e,[s,a,c,f],this,r)).enter().append("path").call(ht,this).call(uc,this,r).attr("d",Gf().curve(this.curve).defined(p=>p>=0).x0(p=>s[p]).y0(p=>a[p]).x1(p=>c[p]).y1(p=>f[p]))).node()}};function xh(t,e){return e===void 0?Xi(t,{x:ic,y:Ts}):new yc(t,e)}function Vs(t,e){let{y:n=Zt,...r}=ku(e);return new yc(t,js(Ys({...r,y1:n,y2:void 0})))}function Xi(t,e){let{x:n=Zt,...r}=Nu(e);return new yc(t,Xs(Us({...r,x1:n,x2:void 0})))}var SQ={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},yh=class extends lt{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,SQ),this.curve=kb(a,c),Kr(this,n)}project(e,n,r){this.curve!==Ws&&super.project(e,n,r)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r,{curve:u}=this;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(p=>p.selectAll().data(e).enter().append("path").call(ht,this).attr("d",u===Ws&&i.projection?MQ(i.projection,s,a,c,f):l=>{let d=Rn(),h=u(d);return h.lineStart(),h.point(s[l],a[l]),h.point(c[l],f[l]),h.lineEnd(),d}).call(Et,this,r).call(Ui,this,r,i)).node()}};function MQ(t,e,n,r,o){let i=Xe(t);return e=Ce(e),n=Ce(n),r=Ce(r),o=Ce(o),s=>i({type:"LineString",coordinates:[[e[s],n[s]],[r[s],o[s]]]})}function Rb(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=bh(e,n,r),[i,s]=bh(o,i,s),new yh(t,{...a,x1:n,x2:r,y1:i,y2:s})}function bh(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 AQ={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},wh=class extends lt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,bend:a=0,headAngle:c=60,headLength:f=8,inset:u=0,insetStart:p=u,insetEnd:l=u,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,AQ),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+f,this.insetStart=+p,this.insetEnd=+l,this.sweep=EQ(d)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a,SW:u}=r,{strokeWidth:p,bend:l,headAngle:d,headLength:h,insetStart:m,insetEnd:g}=this,x=u?w=>u[w]:ue(p===void 0?1:p),y=d*bu/2,b=h/1.5;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(w=>w.selectAll().data(e).enter().append("path").call(ht,this).attr("d",_=>{let v=s[_],S=a[_],E=c[_],T=f[_],I=Math.hypot(E-v,T-S);if(I<=m+g)return null;let A=Math.atan2(T-S,E-v),k=Math.min(b*x(_),I/3),O=this.sweep(v,S,E,T)*l*bu,M=Math.hypot(I/Math.tan(O),I)/2;if(m||g)if(M<1e5){let K=Math.sign(O),[et,rt]=TQ([v,S],[E,T],M,K);if(m&&([v,S]=E$([et,rt,M],[v,S,m],-K*Math.sign(m))),g){let[j,nt]=E$([et,rt,M],[E,T,g],K*Math.sign(g));A+=Math.atan2(nt-rt,j-et)-Math.atan2(T-rt,E-et),E=j,T=nt}}else{let K=E-v,et=T-S,rt=Math.hypot(K,et);m&&(v+=K/rt*m,S+=et/rt*m),g&&(E-=K/rt*g,T-=et/rt*g)}let C=A+O,N=C+y,L=C-y,D=E-k*Math.cos(N),$=T-k*Math.sin(N),P=E-k*Math.cos(L),F=T-k*Math.sin(L),q=M<1e5?`A${M},${M} 0,0,${O>0?1:0} `:"L",V=k?`M${D},${$}L${E},${T}L${P},${F}`:"";return`M${v},${S}${q}${E},${T}${V}`}).call(Et,this,r)).node()}};function EQ(t=1){if(typeof t=="number")return ue(Math.sign(t));if(typeof t=="function")return(e,n,r,o)=>Math.sign(t(e,n,r,o));switch($e(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(e,n,r)=>yt(e,r);case"-x":return(e,n,r)=>En(e,r);case"+y":return(e,n,r,o)=>yt(n,o);case"-y":return(e,n,r,o)=>En(n,o)}}function TQ([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 E$([t,e,n],[r,o,i],s){let a=r-t,c=o-e,f=Math.hypot(a,c),u=(a*a+c*c-i*i+n*n)/(2*f),p=s*Math.sqrt(n*n-u*u);return[t+(a*u+c*p)/f,e+(c*u-a*p)/f]}function T$(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=bh(e,n,r),[i,s]=bh(o,i,s),new wh(t,{...a,x1:n,x2:r,y1:i,y2:s})}var IQ={ariaLabel:"bar"},Lu=class extends lt{constructor(e,n,r={},o=IQ){super(e,n,r,o),fh(this,r),uh(this,r)}render(e,n,r,o,i){let{rx:s,ry:a,rx1y1:c,rx1y2:f,rx2y1:u,rx2y2:p}=this,l=this._x(n,r,o),d=this._y(n,r,o),h=this._width(n,r,o),m=this._height(n,r,o);return ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(g=>g.selectAll().data(e).enter().call(c||f||u||p?x=>x.append("path").call(ht,this).call(lh,l,d,I$(l,h),I$(d,m),this).call(Et,this,r):x=>x.append("rect").call(ht,this).attr("x",l).attr("width",h).attr("y",d).attr("height",m).call(at,"rx",s).call(at,"ry",a).call(Et,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 I$(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 bc=class extends Lu{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(gt,n,{x:r},0,0)}_x({x:e},{x1:n,x2:r},{marginLeft:o}){let{insetLeft:i}=this;return lr(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 lr(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}},wc=class extends Lu{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(gt,n,{y:r},0,0)}_y({y:e},{y1:n,y2:r},{marginTop:o}){let{insetTop:i}=this;return lr(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 lr(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}};function Xo(t,e={}){return Ri(e)||(e={...e,y:Zt,x2:W}),new bc(t,js(wu(Ys(e))))}function Wo(t,e={}){return Ri(e)||(e={...e,x:Zt,y2:W}),new wc(t,Xs(vu(Us(e))))}var CQ={ariaLabel:"cell"},vc=class extends Lu{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,CQ)}_transform(e,n){e.call(gt,n,{},0,0)}};function Gs(t,{x:e,y:n,...r}={}){return[e,n]=ge(e,n),new vc(t,{...r,x:e,y:n})}function C$(t,{x:e=Zt,fill:n,stroke:r,...o}={}){return n===void 0&&ce(r)[0]===void 0&&(n=W),new vc(t,{...o,x:e,fill:n,stroke:r})}function N$(t,{y:e=Zt,fill:n,stroke:r,...o}={}){return n===void 0&&ce(r)[0]===void 0&&(n=W),new vc(t,{...o,y:e,fill:n,stroke:r})}var NQ={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function vh(t){return t.sort===void 0&&t.reverse===void 0?P1({channel:"-r"},t):t}var _c=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i,rotate:s,symbol:a=Ci,frameAnchor:c}=n,[f,u]=Ut(s,0),[p,l]=FL(a),[d,h]=Ut(i,p==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:Fn,optional:!0},rotate:{value:f,optional:!0},symbol:{value:p,scale:"auto",optional:!0}},vh(n),NQ),this.r=h,this.rotate=u,this.symbol=l,this.frameAnchor=Do(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:x,stroke:y}=m;g.hint={fill:x?x.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:y?y.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:u,rotate:p,symbol:l}=r,{r:d,rotate:h,symbol:m}=this,[g,x]=Je(this,o),y=m===Ci,b=u?void 0:d*d*Math.PI;return _s(d)&&(e=[]),ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s,y:f&&a}).call(w=>w.selectAll().data(e).enter().append(y?"circle":"path").call(ht,this).call(y?_=>{_.attr("cx",c?v=>c[v]:g).attr("cy",f?v=>f[v]:x).attr("r",u?v=>u[v]:d)}:_=>{_.attr("transform",to`translate(${c?v=>c[v]:g},${f?v=>f[v]:x})${p?v=>` rotate(${p[v]})`:h?` rotate(${h})`:""}`).attr("d",u&&l?v=>{let S=Rn();return l[v].draw(S,u[v]*u[v]*Math.PI),S}:u?v=>{let S=Rn();return m.draw(S,u[v]*u[v]*Math.PI),S}:l?v=>{let S=Rn();return l[v].draw(S,b),S}:(()=>{let v=Rn();return m.draw(v,b),v})())}).call(Et,this,r)).node()}};function Pr(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ge(e,n)),new _c(t,{...r,x:e,y:n})}function k$(t,{x:e=W,...n}={}){return new _c(t,ab({...n,x:e}))}function L$(t,{y:e=W,...n}={}){return new _c(t,sb({...n,y:e}))}function R$(t,e){return Pr(t,{...e,symbol:"circle"})}function O$(t,e){return Pr(t,{...e,symbol:"hexagon"})}var kQ={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Sc=class extends lt{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:vn(n),optional:!0}},n,kQ),this.z=i,this.curve=kb(s,a),Kr(this,n)}filter(e){return e}project(e,n,r){this.curve!==Ws&&super.project(e,n,r)}render(e,n,r,o,i){let{x:s,y:a}=r,{curve:c}=this;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(f=>f.selectAll().data(rb(e,[s,a],this,r)).enter().append("path").call(ht,this).call(uc,this,r).call(uO,this,r,i).attr("d",c===Ws&&i.projection?LQ(i.projection,s,a):Md().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function LQ(t,e,n){let r=Xe(t);return e=Ce(e),n=Ce(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 Mc(t,{x:e,y:n,...r}={}){return[e,n]=ge(e,n),new Sc(t,{...r,x:e,y:n})}function Hs(t,{x:e=W,y:n=Zt,...r}={}){return new Sc(t,ku({...r,x:e,y:n}))}function Qs(t,{x:e=Zt,y:n=W,...r}={}){return new Sc(t,Nu({...r,x:e,y:n}))}function F4(t,e){e=RQ(e);let{x:n,y:r,color:o,size:i}=e,s=Ob(t,n),a=Ob(t,r),c=Ob(t,o),f=Ob(t,i),{fx:u,fy:p,x:{value:l,reduce:d,zero:h,...m},y:{value:g,reduce:x,zero:y,...b},color:{value:w,color:_,reduce:v},size:{value:S,reduce:E},mark:T}=e;if(d===void 0&&(d=x==null&&l==null&&S==null&&g!=null?"count":null),x===void 0&&(x=d==null&&g==null&&S==null&&l!=null?"count":null),E===void 0&&S==null&&v==null&&d==null&&x==null&&(l==null||ie(s))&&(g==null||ie(a))&&(E="count"),h===void 0&&(h=$b(d)?!0:void 0),y===void 0&&(y=$b(x)?!0:void 0),l==null&&g==null)throw new Error("must specify x or y");if(d!=null&&g==null)throw new Error("reducing x requires y");if(x!=null&&l==null)throw new Error("reducing y requires x");T===void 0&&(T=S!=null||E!=null?"dot":$b(d)||$b(x)||v!=null?"bar":l!=null&&g!=null?ie(s)||ie(a)||d==null&&x==null&&!_h(s)&&!_h(a)?"dot":"line":l!=null||g!=null?"rule":null);let I,A,k;switch(T){case"dot":k=Pr,A="stroke";break;case"line":k=s&&a||d!=null||x!=null?y||x!=null||s&&_h(s)?Qs:h||d!=null||a&&_h(a)?Hs:Mc:s?Hs:Qs,A="stroke",D$(c)&&(I=null);break;case"area":k=!(y||x!=null)&&(h||d!=null||a&&_h(a))?Vs:Xi,A="fill",D$(c)&&(I=null);break;case"rule":k=s?pr:dr,A="stroke";break;case"bar":k=d!=null?ie(a)?$$(d)&&s&&ie(s)?Gs:Xo:Eu:x!=null?ie(s)?$$(x)&&a&&ie(a)?Gs:Wo:Tu:v!=null||E!=null?s&&ie(s)&&a&&ie(a)?Gs:s&&ie(s)?Wo:a&&ie(a)?Xo:ph:s&&$i(s)&&!(a&&$i(a))?Xo:a&&$i(a)&&!(s&&$i(s))?Wo:Gs,A="fill";break;default:throw new Error(`invalid mark: ${T}`)}let O={fx:u,fy:p,x:s??void 0,y:a??void 0,[A]:c??_,z:I,r:f??void 0,tip:!0},M,C={[A]:v??void 0,r:E??void 0};if(d!=null&&x!=null)throw new Error("cannot reduce both x and y");return x!=null?(C.y=x,M=ie(s)?Ls:Uo):d!=null?(C.x=d,M=ie(a)?Rs:jo):(v!=null||E!=null)&&(s&&a?M=ie(s)&&ie(a)?Qd:ie(s)?jo:ie(a)?Uo:ji:s?M=ie(s)?Ls:Uo:a&&(M=ie(a)?Rs:jo)),(M===ji||M===Uo)&&(O.x={value:s,...m}),(M===ji||M===jo)&&(O.y={value:a,...b}),h===void 0&&(h=s&&!(M===ji||M===Uo)&&(k===Xo||k===Vs||k===Eu||k===dr)),y===void 0&&(y=a&&!(M===ji||M===jo)&&(k===Wo||k===Xi||k===Tu||k===pr)),{fx:u??null,fy:p??null,x:{value:l??null,reduce:d??null,zero:!!h,...m},y:{value:g??null,reduce:x??null,zero:!!y,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:S??null,reduce:E??null},mark:T,markImpl:P$[k],markOptions:O,transformImpl:P$[M],transformOptions:C,colorMode:A}}function F$(t,e){let n=F4(t,e),{fx:r,fy:o,x:{zero:i},y:{zero:s},markOptions:a,transformOptions:c,colorMode:f}=n,u=P4[n.markImpl],p=P4[n.transformImpl],l=r!=null||o!=null?Iu({strokeOpacity:.1}):null,d=[i?pr([0]):null,s?dr([0]):null],h=u(t,p?p(c,a):a);return f==="stroke"?ke(l,d,h):ke(l,h,d)}function _h(t){let e,n;for(let r of t){if(r==null)continue;if(e===void 0){e=r;continue}let o=Math.sign(yt(e,r));if(o){if(n!==void 0&&o!==n)return!1;e=r,n=o}}return!0}function RQ({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}={}){return fr(t)||(t=Ru(t)),fr(e)||(e=Ru(e)),fr(n)||(n=ks(n)?{color:n}:Ru(n)),fr(r)||(r=Ru(r)),fr(o)&&({value:o}=Ru(o)),fr(i)&&({value:i}=Ru(i)),s!=null&&(s=`${s}`.toLowerCase()),{x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}}function Ob(t,e){let n=ut(t,e.value);return n&&(n.label=ln(e.value)),n}function Ru(t){return OQ(t)?{reduce:t}:{value:t}}function $b(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function $$(t){return/^(?:first|last|mode)$/i.test(t)}function OQ(t){if(t==null)return!1;if(typeof t.reduceIndex=="function"||typeof t.reduce=="function"&&He(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 D$(t){return t?new In(t).size>t.length>>1:!1}var P4={dot:Pr,line:Mc,lineX:Hs,lineY:Qs,areaX:Vs,areaY:Xi,ruleX:pr,ruleY:dr,barX:Xo,barY:Wo,rect:ph,rectX:Eu,rectY:Tu,cell:Gs,bin:ji,binX:Uo,binY:jo,group:Qd,groupX:Ls,groupY:Rs},P$=Object.fromEntries(Object.entries(P4).map(([t,e])=>[e,t]));function Ou(t,e={}){let{x:n,x1:r,x2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,x:n=W});let i={};return n!=null&&(i.x=t),r!=null&&(i.x1=t),o!=null&&(i.x2=t),Qn(i,e)}function $u(t,e={}){let{y:n,y1:r,y2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,y:n=W});let i={};return n!=null&&(i.y=t),r!=null&&(i.y1=t),o!=null&&(i.y2=t),Qn(i,e)}function Qn(t={},e={}){let n=vn(e),r=Object.entries(t).map(([o,i])=>{let s=k1(o,e);if(s==null)throw new Error(`missing channel: ${o}`);let[a,c]=Qe(s);return{key:o,input:s,output:a,setOutput:c,map:$Q(i)}});return{...Ne(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 u of s?sn(f,p=>s[p]).values():[f])r.forEach(({map:p},l)=>p.mapIndex(u,a[l],c[l]));return{data:o,facets:i}}),...Object.fromEntries(r.map(({key:o,output:i})=>[o,i]))}}function $Q(t){if(t==null)throw new Error("missing map");if(typeof t.mapIndex=="function")return t;if(typeof t.map=="function"&&He(t))return DQ(t);if(typeof t=="function")return q4(iu(t));switch(`${t}`.toLowerCase()){case"cumsum":return FQ;case"rank":return q4((e,n)=>lp(e,r=>n[r]));case"quantile":return q4((e,n)=>PQ(e,r=>n[r]))}throw new Error(`invalid map: ${t}`)}function DQ(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}function PQ(t,e){let n=po(t,e)-1;return lp(t,e).map(r=>r/n)}function q4(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 FQ={mapIndex(t,e,n){let r=0;for(let o of t)n[o]=r+=e[o]}};function q$(t={},e){return arguments.length===1&&(e=t),Ou(Du(t),e)}function B$(t={},e){return arguments.length===1&&(e=t),$u(Du(t),e)}function Du(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=BQ(r),_n(`Warning: the shift option is deprecated; please use anchor "${o}" instead.`)),!((e=Math.floor(e))>0))throw new Error(`invalid k: ${e}`);return zQ(n)(e,qQ(o,e),i)}function qQ(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 BQ(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}function zQ(t="mean"){if(typeof t=="string"){if(/^p\d{2}$/i.test(t))return Db(ou(t));switch(t.toLowerCase()){case"deviation":return Db(Mr);case"max":return Pb((e,n)=>Tt(e,r=>n[r]));case"mean":return YQ;case"median":return Db(Vr);case"min":return Pb((e,n)=>Ct(e,r=>n[r]));case"mode":return Pb((e,n)=>df(e,r=>n[r]));case"sum":return z$;case"variance":return Db(ss);case"difference":return XQ;case"ratio":return WQ;case"first":return VQ;case"last":return GQ}}if(typeof t!="function")throw new Error(`invalid reduce: ${t}`);return Pb(iu(t))}function Db(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,u=o.length-e+1;f<u;++f)isNaN(a(f+e-1))&&++c,s[o[f+n]]=c===0?t(Oi(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(Oi(o,0,c+e),a);for(let c=0,f=o.length-n;c<f;++c)s[o[c+n]]=t(Oi(o,c,c+e),a)}}}function Pb(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=0;for(let c=0;c<e-1;++c)a+=oe(i[o[c]]);for(let c=0,f=o.length-e+1;c<f;++c)a+=oe(i[o[c+e-1]]),a===e&&(s[o[c+n]]=t(Oi(o,c,c+e),i)),a-=oe(i[o[c]])}}:{mapIndex(o,i,s){for(let a=-n;a<0;++a)s[o[a+n]]=t(Oi(o,0,a+e),i);for(let a=0,c=o.length-n;a<c;++a)s[o[a+n]]=t(Oi(o,a,a+e),i)}}}function z$(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 u=o[r[c]],p=o[r[c+t-1]];p===null||isNaN(p)?++s:a+=+p,i[r[c+e]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{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 YQ(t,e,n){if(n){let r=z$(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,u=Math.min(c,t-e-1);f<u;++f){let p=o[r[f]];p!==null&&!isNaN(p=+p)&&(s+=p,++a)}for(let f=-e,u=c-e;f<u;++f){let p=o[r[f+t-1]],l=o[r[f]];p!==null&&!isNaN(p=+p)&&(s+=p,++a),i[r[f+e]]=s/a,l!==null&&!isNaN(l=+l)&&(s-=l,--a)}}}}function UQ(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(oe(i))return i}}function jQ(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(oe(i))return i}}function Y$(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 U$(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 XQ(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]]=U$(o,r,s,t)-Y$(o,r,s,t)}}}function WQ(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]]=U$(o,r,s,t)/Y$(o,r,s,t)}}}function VQ(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]]=UQ(o,r,s,t)}}}function GQ(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]]=jQ(o,r,s,t)}}}var Wi={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function j$(t,{x:e=W,y:n,k:r=Wi.k,color:o=Wi.color,opacity:i=Wi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:u,...p}={}){return ke(zt(s)?null:Vs(t,Qn({x1:Zs({k:-r,...p}),x2:Zs({k:r,...p})},{x1:e,x2:e,y:n,fill:s,fillOpacity:a,...p})),zt(c)?null:Hs(t,Qn({x:Zs(p)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:u,...p})))}function X$(t,{x:e,y:n=W,k:r=Wi.k,color:o=Wi.color,opacity:i=Wi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:u,...p}={}){return ke(zt(s)?null:Xi(t,Qn({y1:Zs({k:-r,...p}),y2:Zs({k:r,...p})},{x:e,y1:n,y2:n,fill:s,fillOpacity:a,...p})),zt(c)?null:Qs(t,Qn({y:Zs(p)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:u,...p})))}function Zs({n:t=Wi.n,k:e=0,strict:n=Wi.strict,anchor:r=Wi.anchor}={}){return Du({k:t,reduce:o=>li(o)+e*(Mr(o)||0),strict:n,anchor:r})}var HQ={ariaLabel:"tick",fill:null,stroke:"currentColor"},Fb=class extends lt{constructor(e,n,r){super(e,n,r,HQ),Kr(this,r)}render(e,n,r,o,i){return ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(s=>s.selectAll().data(e).enter().append("line").call(ht,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(Et,this,r).call(Ui,this,r,i)).node()}},Sh=class extends Fb{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=Dt(s),this.insetBottom=Dt(a)}_transform(e,n,{x:r}){e.call(gt,n,{x:r},le,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}},Mh=class extends Fb{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=Dt(s),this.insetLeft=Dt(a)}_transform(e,n,{y:r}){e.call(gt,n,{y:r},0,le)}_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 qb(t,{x:e=W,...n}={}){return new Sh(t,{...n,x:e})}function Bb(t,{y:e=W,...n}={}){return new Mh(t,{...n,y:e})}function W$(t,{x:e=W,y:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...u}={}){let p=n!=null?Rs:Hd;return ke(dr(t,p({x1:B4,x2:z4},{x:e,y:n,stroke:s,strokeOpacity:a,...u})),Xo(t,p({x1:"p25",x2:"p75"},{x:e,y:n,fill:o,fillOpacity:i,...u})),qb(t,p({x:"p50"},{x:e,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...u})),Pr(t,Qn({x:G$},{x:e,y:n,z:n,r,stroke:s,strokeOpacity:a,...u})))}function V$(t,{y:e=W,x:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...u}={}){let p=n!=null?Ls:Hd;return ke(pr(t,p({y1:B4,y2:z4},{x:n,y:e,stroke:s,strokeOpacity:a,...u})),Wo(t,p({y1:"p25",y2:"p75"},{x:n,y:e,fill:o,fillOpacity:i,...u})),Bb(t,p({y:"p50"},{x:n,y:e,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...u})),Pr(t,Qn({y:G$},{x:n,y:e,z:n,r,stroke:s,strokeOpacity:a,...u})))}function G$(t){let e=B4(t),n=z4(t);return t.map(r=>r<e||r>n?r:NaN)}function B4(t){let e=H$(t)*2.5-Q$(t)*1.5;return Ct(t,n=>n>=e?n:NaN)}function z4(t){let e=Q$(t)*2.5-H$(t)*1.5;return Tt(t,n=>n<=e?n:NaN)}function H$(t){return Cn(t,.25)}function Q$(t){return Cn(t,.75)}var QQ={ariaLabel:"raster",stroke:null,pixelSize:1};function Pu(t,e){let n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function Z$(t,e){let n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}var Eh=class extends lt{constructor(e,n,r={},o){let{width:i,height:s,x:a,y:c,x1:f=a==null?0:void 0,y1:u=c==null?0:void 0,x2:p=a==null?i:void 0,y2:l=c==null?s:void 0,pixelSize:d=o.pixelSize,blur:h=0,interpolate:m}=r;if(i!=null&&(i=Z$(i,"width")),s!=null&&(s=Z$(s,"height")),f!=null&&(f=Pu(f,"x1")),u!=null&&(u=Pu(u,"y1")),p!=null&&(p=Pu(p,"x2")),l!=null&&(l=Pu(l,"y2")),a==null&&(f==null||p==null))throw new Error("missing x");if(c==null&&(u==null||l==null))throw new Error("missing y");e!=null&&i!=null&&s!=null&&(a===void 0&&f!=null&&p!=null&&(a=oZ(f,p,i,s)),c===void 0&&u!=null&&l!=null&&(c=iZ(u,l,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:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:p==null?null:[p],scale:"x",optional:!0,filter:null},y2:{value:l==null?null:[l],scale:"y",optional:!0,filter:null},...n},r,o),this.width=i,this.height=s,this.pixelSize=Pu(d,"pixelSize"),this.blur=Pu(h,"blur"),this.interpolate=a==null||c==null?null:ZQ(m)}},Th=class extends Eh{constructor(e,n={}){let{imageRendering:r}=n;if(e==null){let{fill:o,fillOpacity:i}=n;Ut(i)[0]!==void 0&&(n=zb("fillOpacity",n)),ce(o)[0]!==void 0&&(n=zb("fill",n))}super(e,void 0,n,QQ),this.imageRendering=te(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]??(C=>C),{x:a,y:c}=r,{document:f}=i,[u,p,l,d]=K$(r,o,i),h=l-u,m=d-p,{pixelSize:g,width:x=Math.round(Math.abs(h)/g),height:y=Math.round(Math.abs(m)/g)}=this,b=x*y,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let C=x/h,N=y/m,L=It(a,$=>($-u)*C,Float64Array),D=It(c,$=>($-p)*N,Float64Array);w&&(w=this.interpolate(e,x,y,L,D,w)),_&&(_=this.interpolate(e,x,y,L,D,_))}else this.data==null&&e&&(v=e.fi*b);let S=f.createElement("canvas");S.width=x,S.height=y;let E=S.getContext("2d"),T=E.createImageData(x,y),I=T.data,{r:A,g:k,b:O}=Re(this.fill)??{r:0,g:0,b:0},M=(this.fillOpacity??1)*255;for(let C=0;C<b;++C){let N=C<<2;if(w){let L=s(w[C+v]);if(L==null){I[N+3]=0;continue}({r:A,g:k,b:O}=Re(L))}_&&(M=_[C+v]*255),I[N+0]=A,I[N+1]=k,I[N+2]=O,I[N+3]=M}return this.blur>0&&f_(T,this.blur),E.putImageData(T,0,0),ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(C=>C.append("image").attr("transform",`translate(${u},${p}) scale(${Math.sign(l-u)},${Math.sign(d-p)})`).attr("width",Math.abs(h)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(at,"image-rendering",this.imageRendering).call(ht,this).attr("xlink:href",S.toDataURL())).node()}};function Y4(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&&EL(e)&&(r=ic,o=Ts,i===void 0&&(i=_L)),[e,{...s,x:r,y:o,[t]:i}]}function J$(){let[t,e]=Y4("fill",...arguments);return new Th(t,t==null||e.fill!==void 0||e.fillOpacity!==void 0?e:{...e,fill:W})}function K$({x1:t,y1:e,x2:n,y2:r},o,{projection:i}){let{width:s,height:a,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p}=o;return[t&&i==null?t[0]:p,e&&i==null?e[0]:c,n&&i==null?n[0]:s-f,r&&i==null?r[0]:a-u]}function U4({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),K$(pu(a,o),i,s)}function zb(t,e={}){let{[t]:n}=e;if(typeof n!="function")throw new Error(`invalid ${t}: not a function`);return Kt({...e,[t]:void 0},function(r,o,i,s,a,c){let{x:f,y:u}=s;if(!f)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[p,l,d,h]=U4(i,s,a,c),m=d-p,g=h-l,{pixelSize:x}=this,{width:y=Math.round(Math.abs(m)/x),height:b=Math.round(Math.abs(g)/x)}=e,w=new Array(y*b*(o?o.length:1)),_=m/y,v=g/b,S=0;for(let E of o??[void 0])for(let T=.5;T<b;++T)for(let I=.5;I<y;++I,++S)w[S]=n(f.invert(p+I*_),u.invert(l+T*v),E);return{data:w,facets:o,channels:{[t]:{value:w,scale:"auto"}}}})}function ZQ(t){if(typeof t=="function")return t;if(t==null)return Yb;switch(`${t}`.toLowerCase()){case"none":return Yb;case"nearest":return Ch;case"barycentric":return Ih();case"random-walk":return Nh()}throw new Error(`invalid interpolate: ${t}`)}function Yb(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 Ih({random:t=Wa(42)}={}){return(e,n,r,o,i,s)=>{let{points:a,triangles:c,hull:f}=Tr.from(e,d=>o[d],d=>i[d]),u=new s.constructor(n*r).fill(NaN),p=new Uint8Array(n*r),l=rZ(s,t);for(let d=0;d<c.length;d+=3){let h=c[d],m=c[d+1],g=c[d+2],x=a[2*h],y=a[2*m],b=a[2*g],w=a[2*h+1],_=a[2*m+1],v=a[2*g+1],S=Math.min(x,y,b),E=Math.max(x,y,b),T=Math.min(w,_,v),I=Math.max(w,_,v),A=(_-v)*(x-b)+(w-v)*(b-y);if(!A)continue;let k=s[e[h]],O=s[e[m]],M=s[e[g]];for(let C=Math.floor(S);C<E;++C)for(let N=Math.floor(T);N<I;++N){if(C<0||C>=n||N<0||N>=r)continue;let L=C+.5,D=N+.5,$=Math.sign(A),P=(_-v)*(L-b)+(D-v)*(b-y);if(P*$<0)continue;let F=(v-w)*(L-b)+(D-v)*(x-b);if(F*$<0)continue;let q=A-(P+F);if(q*$<0)continue;let V=C+n*N;u[V]=l(k,P/A,O,F/A,M,q/A,C,N),p[V]=1}}return JQ(u,p,o,i,s,n,r,f,e,l),u}}function JQ(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 u=n.length,p=Array.from({length:u},(d,h)=>tZ(h,n,r)),l=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 x=m+.5;for(let y=0;y<u;++y){let b=(u+l+(y%2?(y+1)/2:-y/2))%u;if(p[b](x,h)){let w=KQ(n.at(b-1),r.at(b-1),n[b],r[b],x,h);t[g]=f(o.at(b-1),w,o[b],1-w,o[b],0,m,d),l=b;break}}}}}}function KQ(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 Ah(t,e,n,r){return t*r-n*e}function tZ(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],u=e.at(t+1-r),p=n.at(t+1-r),l=s-c,d=a-f,h=o-s,m=i-a,g=c-u,x=f-p,y=Math.hypot(l,d),b=Math.hypot(h,m),w=Math.hypot(g,x);return(_,v)=>{let S=_-s,E=v-a,T=_-c,I=v-f;return Ah(S,E,T,I)>-1e-6&&Ah(S,E,l,d)*b-Ah(S,E,h,m)*y>-1e-6&&Ah(T,I,g,x)*y-Ah(T,I,l,d)*w<=0}}function Ch(t,e,n,r,o,i){let s=new i.constructor(e*n),a=Tr.from(t,u=>r[u],u=>o[u]),c,f;for(let u=.5,p=0;u<n;++u){f=c;for(let l=.5;l<e;++l,++p)f=a.find(l,u,f),l===.5&&(c=f),s[p]=i[t[f]]}return s}function Nh({random:t=Wa(42),minDistance:e=.5,maxSteps:n=2}={}){return(r,o,i,s,a,c)=>{let f=new c.constructor(o*i),u=Tr.from(r,h=>s[h],h=>a[h]),p,l,d;for(let h=.5,m=0;h<i;++h){l=p;for(let g=.5;g<o;++g,++m){let x=g,y=h;d=l=u.find(x,y,l),g===.5&&(p=l);let b,w=0;for(;(b=Math.hypot(s[r[d]]-x,a[r[d]]-y))>e&&w<n;){let _=t(g,h,w)*2*Math.PI;x+=Math.cos(_)*b,y+=Math.sin(_)*b,d=u.find(x,y,d),++w}f[m]=c[r[d]]}}return f}}function eZ(t,e,n,r,o,i){return e*t+r*n+i*o}function nZ(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 rZ(t,e){return $i(t)||fe(t)?eZ:nZ(e)}function oZ(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 iZ(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 tD={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},kh=class extends Eh{constructor(e,{smooth:n=!0,value:r,...o}={}){let i=nb({},o,tD);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:ln(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=zb("value",{value:r,...o}),r=null}else{let{interpolate:a}=o;r===void 0&&(r=W),a===void 0&&(o.interpolate="nearest")}super(e,{value:{value:r,optional:!0}},sZ(o),tD);let s={geometry:{value:W}};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=Xe();return ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(c=>{c.selectAll().data(e).enter().append("path").call(ht,this).attr("d",f=>a(s[f])).call(Et,this,r)}).node()}};function sZ({thresholds:t,interval:e,...n}){return t=$4(t,e,as),Kt(n,function(r,o,i,s,a,c){let[f,u,p,l]=U4(i,s,a,c),d=p-f,h=l-u,{pixelSize:m,width:g=Math.round(Math.abs(d)/m),height:x=Math.round(Math.abs(h)/m)}=this,y=g/d,b=x/h,w=i.value.value,_=[];if(this.interpolate){let{x:I,y:A}=Bo(i,s,c),k=It(I,N=>(N-f)*y,Float64Array),O=It(A,N=>(N-u)*b,Float64Array),M=[i.x,i.y,i.value],C=[k,O,w];for(let N of o){let L=this.filter(N,M,C);_.push(this.interpolate(L,g,x,k,O,w))}}else if(o){let I=g*x,A=o.length;for(let k=0;k<A;++k)_.push(w.slice(k*I,k*I+I))}else _.push(w);if(this.blur>0)for(let I of _)sp({data:I,width:g,height:x},this.blur);let v=aZ(t,w,...cZ(_));if(v===null)throw new Error(`unsupported thresholds: ${t}`);let{contour:S}=hs().size([g,x]).smooth(this.smooth),E=[],T=[];for(let I of _)T.push(be(E.length,E.push(...It(v,A=>S(I,A)))));for(let{coordinates:I}of E)for(let A of I)for(let k of A)for(let O of k)O[0]=O[0]/y+f,O[1]=O[1]/b+u;return{data:E,facets:T,channels:U1(this.contourChannels,E)}})}function aZ(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 cr(t);let o=an(...lf(n,r,t),t);for(;o[o.length-1]>=r;)o.pop();for(;o[1]<n;)o.shift();return o}function nD(){return new kh(...Y4("value",...arguments))}function cZ(t){return[Ct(t,e=>Ct(e,eD)),Tt(t,e=>Tt(e,eD))]}function eD(t){return isFinite(t)?t:NaN}function iD(t,e){return j4(qs,t,e)}function sD(t,e={}){return j4(Bs,t,e)}function aD(t,e={}){return j4(Yi,t,e)}function j4(t,e,n={}){let{x:r,y:o,maxRadius:i}=n,s=t({px:r,py:o,maxRadius:i}),a=[];r!=null&&a.push(pr(e,rD("x",{...s,inset:-6},n))),o!=null&&a.push(dr(e,rD("y",{...s,inset:-6},n))),r!=null&&a.push(Yo(e,oD("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),o!=null&&a.push(Yo(e,oD("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return ke(...a)}function cD(t,{channels:e,...n},{facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:c,transform:f,initializer:u}){return{...n,facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:{...e,...c},transform:f,initializer:fZ(t,u)}}function fZ(t,e){return e==null?e:function(n,r,{x:o,y:i,px:s,py:a,...c},...f){let{channels:{x:u,y:p,...l}={},...d}=e.call(this,n,r,{...c,x:s,y:a},...f);return{channels:{...l,...u&&{px:u,...t==="x"&&{x:u}},...p&&{py:p,...t==="y"&&{y:p}}},...d}}}function rD(t,e,n){let{color:r="currentColor",opacity:o=.2,ruleStroke:i=r,ruleStrokeOpacity:s=o,ruleStrokeWidth:a}=n;return{...cD(t,e,n),stroke:i,strokeOpacity:s,strokeWidth:a}}function oD(t,e,n){let{color:r="currentColor",textFill:o=r,textFillOpacity:i,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...cD(t,e,uZ(t,n)),fill:o,fillOpacity:i,stroke:s,strokeOpacity:a,strokeWidth:c}}function uZ(t,e){return Kt(e,(n,r,o)=>({channels:{text:{value:Jd(o,t)?.value}}}))}var lZ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},pZ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},dZ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},hZ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},mZ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},X4=class extends lt{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,lZ),this.curve=gh(s,a),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:u}=r,{curve:p}=this,[l,d]=Je(this,o),h=c?y=>c[y]:ue(l),m=f?y=>f[y]:ue(d),g=this;function x(y){let b=-1,w=[],_={};for(let M in r)_[M]=[];let v=[],S=[],E=[],T=[];function I(M,C){M=y[M],C=y[C],w.push(++b),v[b]=h(M),E[b]=m(M),S[b]=h(C),T[b]=m(C);for(let N in r)_[N].push(r[N][C])}let{halfedges:A,hull:k,triangles:O}=Tr.from(y,h,m);for(let M=0;M<A.length;++M){let C=A[M];C>M&&I(O[M],O[C])}for(let M=0;M<k.length;++M)I(k[M],k[(M+1)%k.length]);Nt(this).selectAll().data(w).enter().append("path").call(ht,g).attr("d",M=>{let C=Rn(),N=p(C);return N.lineStart(),N.point(v[M],E[M]),N.point(S[M],T[M]),N.lineEnd(),C}).call(Et,g,_).call(Ui,g,_,i)}return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s,y:f&&a}).call(u?y=>y.selectAll().data(sn(e,b=>u[b]).values()).enter().append("g").each(x):y=>y.datum(e).each(x)).node()}},Lh=class extends lt{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:u}=r,[p,l]=Je(this,o),d=c?x=>c[x]:ue(p),h=f?x=>f[x]:ue(l),m=this;function g(x){let y=Tr.from(x,d,h);Nt(this).append("path").datum(x[0]).call(ht,m).attr("d",m._render(y,o)).call(Et,m,r)}return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s,y:f&&a}).call(u?x=>x.selectAll().data(sn(e,y=>u[y]).values()).enter().append("g").each(g):x=>x.datum(e).each(g)).node()}},W4=class extends Lh{constructor(e,n={}){super(e,n,pZ),this.fill="none"}_render(e){return e.render()}},V4=class extends Lh{constructor(e,n={}){super(e,n,dZ,vn)}_render(e){return e.renderHull()}},G4=class extends lt{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}},Kt(n,function(s,a,c,f,u,p){let{x:l,y:d,z:h}=c;({x:l,y:d}=Bo(c,f,p)),h=h?.value;let m=new Array((l??d).length).fill(null),[g,x]=Je(this,u),y=l?w=>l[w]:ue(g),b=d?w=>d[w]:ue(x);for(let w of a){l&&(w=w.filter(_=>oe(y(_)))),d&&(w=w.filter(_=>oe(b(_))));for(let[,_]of Po(w,h)){let v=Tr.from(_,y,b),S=fD(v,u);for(let E=0,T=_.length;E<T;++E)m[_[E]]=S.renderCell(E)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),hZ)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,cells:u}=r;return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s,y:f&&a}).call(p=>{p.selectAll().data(e).enter().append("path").call(ht,this).attr("d",l=>u[l]).call(Et,this,r)}).node()}},H4=class extends Lh{constructor(e,n){super(e,n,mZ),this.fill="none"}_render(e,n){return fD(e,n).render()}};function fD(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 Rh(t,e,{x:n,y:r,...o}={}){return[n,r]=ge(n,r),new t(e,{...o,x:n,y:r})}function uD(t,e){return Rh(X4,t,e)}function lD(t,e){return Rh(W4,t,e)}function pD(t,e){return Rh(V4,t,e)}function dD(t,{x:e,y:n,initializer:r,...o}={}){return Rh(G4,t,{...Ne({...o,x:e,y:n},_b),initializer:r})}function hD(t,e){return Rh(H4,t,e)}var gZ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Oh=class extends lt{constructor(e,{x:n,y:r,z:o,weight:i,fill:s,stroke:a,...c}={}){let f=mD(s)&&(s="currentColor",!0),u=mD(a)&&(a="currentColor",!0);super(e,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:vn({z:o,fill:s,stroke:a}),optional:!0},weight:{value:i,optional:!0}},yZ({...c,fill:s,stroke:a},f,u),gZ),f&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=o}filter(e){return e}render(e,n,r,o,i){let{contours:s}=r,a=Xe();return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{}).call(c=>c.selectAll().data(e).enter().append("path").call(ht,this).call(Et,this,r).attr("d",f=>a(s[f]))).node()}};function gD(t,{x:e,y:n,...r}={}){return[e,n]=ge(e,n),new Oh(t,{...r,x:e,y:n})}var xZ=new Set(["x","y","z","weight"]);function yZ(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"?Ce(i):+i,Kt(t,function(s,a,c,f,u,p){let l=c.weight?Ce(c.weight.value):null,d=c.z?.value,{z:h}=this,[m,g]=Je(this,u),{width:x,height:y}=u,{x:b,y:w}=Bo(c,f,p),_=Object.fromEntries(Object.entries(c).filter(([O])=>!xZ.has(O)).map(([O,M])=>[O,{...M,value:[]}])),v=e&&[],S=n&&[],E=Z_().x(b?O=>b[O]:m).y(w?O=>w[O]:g).weight(l?O=>l[O]:1).size([x,y]).bandwidth(o),T=[];for(let O of a){let M=[];T.push(M);for(let C of d?rh(O,d,h):[O]){let N=E.contours(C);M.push([C,N])}}let I=i;if(!(I instanceof jd)){let O=0;for(let M of T)for(let[,C]of M){let N=C.max;N>O&&(O=N)}I=Float64Array.from({length:i-1},(M,C)=>O*100*(C+1)/i)}let A=[],k=[];for(let O of T){let M=[];A.push(M);for(let[C,N]of O)for(let L of I){M.push(k.length),k.push(N(L/100)),v&&v.push(L),S&&S.push(L);for(let D in _)_[D].value.push(c[D].value[C[0]])}}return v&&v.push(0),S&&S.push(0),{data:s,facets:A,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...S&&{stroke:{value:S,scale:"color"}},contours:{value:k}}}})}function mD(t){return/^density$/i.test(t)}function bD(t,e){return vD("x",t,e)}function wD(t,e){return vD("y",t,e)}function vD(t,e,{x1:n,x2:r,y1:o,y2:i,x:s=n===void 0&&r===void 0?t==="y"?Zt:W:void 0,y:a=o===void 0&&i===void 0?t==="x"?Zt:W:void 0,fill:c,positiveFill:f="#3ca951",negativeFill:u="#4269d0",fillOpacity:p=1,positiveFillOpacity:l=p,negativeFillOpacity:d=p,stroke:h,strokeOpacity:m,z:g=ce(h)[0],clip:x,tip:y,render:b,...w}={}){return[n,r]=xD(s,n,r),[o,i]=xD(a,o,i),n===r&&o===i&&(t==="y"?o=Vi(0):n=Vi(0)),{tip:y}=Jr({tip:y},t==="y"?"x":"y"),ke(zt(f)?null:Object.assign(xh(e,{x1:n,x2:r,y1:o,y2:i,z:g,fill:f,fillOpacity:l,render:zi(b,yD(t,!0)),clip:x,...w}),{ariaLabel:"positive difference"}),zt(u)?null:Object.assign(xh(e,{x1:n,x2:r,y1:o,y2:i,z:g,fill:u,fillOpacity:d,render:zi(b,yD(t,!1)),clip:x,...w}),{ariaLabel:"negative difference"}),Mc(e,{x:r,y:i,z:g,stroke:h,strokeOpacity:m,tip:y,clip:!0,...w}))}function xD(t,e,n){return e===void 0&&n===void 0?e=n=Vi(t):e===void 0?(n=Vi(n),e=t===void 0?n:Vi(t)):n===void 0?(e=Vi(e),n=t===void 0?e:Vi(t)):(e=Vi(e),n=Vi(n)),[e,n]}function Vi(t){let e,{value:n,label:r=ln(n)}=$r(t);return{transform:o=>e||(e=ut(o,n)),label:r}}function yD(t,e){let n=t==="x"?"y":"x",r=`${n}1`,o=`${n}2`,i=`${t}1`,s=`${t}2`;return(a,c,f,u,p,l)=>{let{[r]:d,[o]:h}=f,m=new Float32Array(d.length),g=new Float32Array(h.length),x=u[t==="y"?"height":"width"];(e===V1(c[t])<0?m:g).fill(x);let y=l(a,c,{...f,[o]:d,[s]:g},u,p),b=l(a,c,{...f,[r]:h,[i]:m},u,p),w=y.querySelector("g")??y,_=b.querySelector("g")??b;for(let v=0;w.firstChild;v+=2){let S=u4(),E=ot("svg:clipPath",p).attr("id",S).node();E.appendChild(w.firstChild),_.childNodes[v].setAttribute("clip-path",`url(#${S})`),_.insertBefore(E,_.childNodes[v])}return b}}function Ub({geometry:t=W,...e}={}){let n=Ps(r=>ut(r,t));return Kt({...e,x:null,y:null,geometry:{transform:n}},(r,o,i,s,a,{projection:c})=>{let f=n(r),u=f.length,p=new Float64Array(u),l=new Float64Array(u),d=Xe(c);for(let h=0;h<u;++h)[p[h],l[h]]=d.centroid(f[h]);return{data:r,facets:o,channels:{x:{value:p,scale:c==null?"x":null,source:null},y:{value:l,scale:c==null?"y":null,source:null}}}})}function _D({geometry:t=W,...e}={}){let n=Ps(o=>ut(o,t)),r=Ps(o=>ut(n(o),d6));return{...e,x:{transform:o=>Float64Array.from(r(o),([i])=>i)},y:{transform:o=>Float64Array.from(r(o),([,i])=>i)},geometry:{transform:n}}}var bZ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},$h=class extends lt{constructor(e,n={}){let[r,o]=Ut(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:Fn,optional:!0},geometry:{value:n.geometry,scale:"projection"}},vh(n),bZ),this.r=o}render(e,n,r,o,i){let{geometry:s,r:a}=r,c=Xe(i.projection??wZ(n)),{r:f}=this;return _s(f)?e=[]:f!==void 0&&c.pointRadius(f),ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(u=>{u.selectAll().data(e).enter().append("path").call(ht,this).attr("d",a?p=>c.pointRadius(a[p])(s[p]):p=>c(s[p])).call(Et,this,r)}).node()}};function wZ({x:t,y:e}){if(t||e)return t??=n=>n,e??=n=>n,ja({point(n,r){this.stream.point(t(n),e(r))}})}function jb(t,e={}){return e.tip&&e.x===void 0&&e.y===void 0?e=Ub(e):e.geometry===void 0&&(e={...e,geometry:W}),new $h(t,e)}function SD({strokeWidth:t=1.5,...e}={}){return jb({type:"Sphere"},{strokeWidth:t,...e})}function MD({strokeOpacity:t=.1,...e}={}){return jb(b6(),{strokeOpacity:t,...e})}var Fu=.5,qu=0;function AD(t={fill:"count"},{binWidth:e,...n}={}){let{z:r}=n;return e=e===void 0?20:Dt(e),t=PS(t,n),Fo(t,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Fo(t,"r")&&(n.r=e/2),Kt(n,(o,i,s,a,c,f)=>{let{x:u,y:p,z:l,fill:d,stroke:h,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(p===void 0)throw new Error("missing channel: y");({x:u,y:p}=Bo(s,a,f)),l=l?l.value:ut(o,r),d=d?.value,h=h?.value,m=m?.value;let g=Zd(t,{z:l,fill:d,stroke:h,symbol:m}),x=l&&[],y=d&&[],b=h&&[],w=m&&[],_=[],v=[],S=[],E=-1;for(let k of t)k.initialize(o);for(let k of i){let O=[];for(let M of t)M.scope("facet",k);for(let[M,C]of Po(k,g))for(let{index:N,extent:L}of vZ(o,C,u,p,e)){O.push(++E),v.push(L.x),S.push(L.y),l&&x.push(g===l?M:l[N[0]]),d&&y.push(g===d?M:d[N[0]]),h&&b.push(g===h?M:h[N[0]]),m&&w.push(g===m?M:m[N[0]]);for(let D of t)D.reduce(N,L)}_.push(O)}let T=s.x.scale,I=s.y.scale,A={x:{value:v,source:a[T]?{value:It(v,a[T].invert),scale:T}:null},y:{value:S,source:a[I]?{value:It(S,a[I].invert),scale:I}:null},...l&&{z:{value:x}},...d&&{fill:{value:y,scale:"auto"}},...h&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(t.map(({name:k,output:O})=>[k,{scale:"auto",label:O.label,radius:k==="r"?e/2:void 0,value:O.transform()}]))};return{data:o,facets:_,channels:A}})}function vZ(t,e,n,r,o){let i=o*(1.5/TS),s=new Map;for(let a of e){let c=n[a],f=r[a];if(isNaN(c)||isNaN(f))continue;let u=Math.round(f=(f-qu)/i),p=Math.round(c=(c-Fu)/o-(u&1)/2),l=f-u;if(Math.abs(l)*3>1){let m=c-p,g=p+(c<p?-1:1)/2,x=u+(f<u?-1:1),y=c-g,b=f-x;m*m+l*l>y*y+b*b&&(p=g+(u&1?1:-1)/2,u=x)}let d=`${p},${u}`,h=s.get(d);h===void 0&&(h={index:[],extent:{data:t,x:(p+(u&1)/2)*o+Fu,y:u*i+qu}},s.set(d,h)),h.index.push(a)}return s.values()}var _Z={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function ED(t){return new Dh(t)}var Dh=class extends lt{constructor({binWidth:e=20,clip:n=!0,...r}={}){super(Es,void 0,{clip:n,...r},_Z),this.binWidth=Dt(e)}render(e,n,r,o,i){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:f,marginLeft:u,width:p,height:l}=o,d=u-Fu,h=p-c-Fu,m=a-qu,g=l-f-qu,x=s/2,y=x*IS,b=y/2,w=x*2,_=y*1.5,v=Math.floor(d/w),S=Math.ceil(h/w),E=Math.floor((m+b)/_),T=Math.ceil((g-b)/_)+1,I=`m0,${Js(-y)}l${Js(x)},${Js(b)}v${Js(y)}l${Js(-x)},${Js(b)}`,A=I;for(let k=E;k<T;++k)for(let O=v;O<S;++O)A+=`M${Js(O*w+(k&1)*x)},${Js(k*_)}${I}`;return ot("svg:g",i).datum(0).call(wt,this,o,i).call(gt,this,{},le+Fu,le+qu).call(k=>k.append("path").call(ht,this).call(Et,this,r).attr("d",A)).node()}};function Js(t){return Math.round(t*1e3)/1e3}var SZ={ariaLabel:"image",fill:null,stroke:null};function MZ(t){return/^\.*\//.test(t)}function AZ(t){return/^(blob|data|file|http|https):/i.test(t)}function EZ(t){return typeof t=="string"&&(MZ(t)||AZ(t))?[void 0,t]:[t,void 0]}var Ph=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i,width:s,height:a,rotate:c,src:f,preserveAspectRatio:u,crossOrigin:p,frameAnchor:l,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]=EZ(f),[g,x]=Ut(i),[y,b]=Ut(s,x!==void 0?x*2:void 0),[w,_]=Ut(a,x!==void 0?x*2:void 0),[v,S]=Ut(c,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:g,scale:"r",filter:Fn,optional:!0},width:{value:y,filter:Fn,optional:!0},height:{value:w,filter:Fn,optional:!0},rotate:{value:v,optional:!0},src:{value:h,optional:!0}},vh(n),SZ),this.src=m,this.width=b,this.rotate=S,this.height=_,this.r=x,this.preserveAspectRatio=te(u,"xMidYMid"),this.crossOrigin=we(p),this.frameAnchor=Do(l),this.imageRendering=te(d,"auto")}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,width:u,height:p,r:l,rotate:d,src:h}=r,{r:m,width:g,height:x,rotate:y}=this,[b,w]=Je(this,o);return ot("svg:g",i).call(wt,this,o,i).call(gt,this,{x:c&&s,y:f&&a}).call(_=>_.selectAll().data(e).enter().append("image").call(ht,this).attr("x",TD(c,u,l,b,g,m)).attr("y",TD(f,p,l,w,x,m)).attr("width",u?v=>u[v]:g!==void 0?g:l?v=>l[v]*2:m*2).attr("height",p?v=>p[v]:x!==void 0?x:l?v=>l[v]*2:m*2).attr("transform",d?v=>`rotate(${d[v]})`:y?`rotate(${y})`:null).attr("transform-origin",d||y?to`${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",l?v=>`circle(${l[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Et,this,r)).node()}};function TD(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 ID(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ge(e,n)),new Ph(t,{...r,x:e,y:n})}function TZ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,u,p,l,d,h,m,g,x;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,u=Math.sqrt(-2*Math.log(f)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,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)),u=Math.exp(e*a)/e,p=Math.exp(n*c)/n,g=u+p,t<u/g?d=Math.pow(e*g*t,1/e):d=1-Math.pow(n*g*(1-t),1/n)),x=-Bu(e)-Bu(n)+Bu(e+n);s<10;s++){if(d===0||d===1)return d;if(l=IZ(d,e,n)-t,u=Math.exp(o*Math.log(d)+i*Math.log(1-d)+x),p=l/u,d-=u=p/(1-.5*Math.min(1,p*(o/d-i/(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 IZ(t,e,n){var r=t===0||t===1?0:Math.exp(Bu(e+n)-Bu(e)-Bu(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?!1:t<(e+1)/(e+n+2)?r*CD(t,e,n)/e:1-r*CD(1-t,n,e)/n}function CD(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,u,p,l,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(u=2*o,p=o*(n-o)*t/((a+u)*(e+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,p=-(e+o)*(i+o)*t/((e+u)*(s+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,l=f*c,d*=l,!(Math.abs(l-1)<3e-7));o++);return d}function Bu(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 ND(t,e){var n=TZ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}var CZ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Xb=class extends lt{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:vn(n),optional:!0}},n,CZ),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 ot("svg:g",i).call(wt,this,o,i).call(gt,this,n).call(u=>u.selectAll().data(c?rh(e,c,this.z):[e]).enter().call(p=>p.append("path").attr("fill","none").call(ht,this).call(uc,this,{...r,fill:null,fillOpacity:null}).attr("d",l=>this._renderLine(l,s,a)).call(f&&!Di(this.fill)?l=>l.select(NZ).attr("stroke","none").call(ht,this).call(uc,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function NZ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Nn.svg,"path"),this)}var Q4=class extends Xb{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Ft(e,u=>r[u]),c=Wb(e,r,n),f=RD(e,r,n,(1-o)/2,c);return Gf().y(u=>u).x0(u=>f(u,-1)).x1(u=>f(u,1))(be(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Ft(e,a=>r[a]),s=Wb(e,r,n);return`M${s(o)},${o}L${s(i)},${i}`}},Z4=class extends Xb{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Ft(e,u=>n[u]),c=Wb(e,n,r),f=RD(e,n,r,(1-o)/2,c);return Gf().x(u=>u).y0(u=>f(u,-1)).y1(u=>f(u,1))(be(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Ft(e,a=>n[a]),s=Wb(e,n,r);return`M${o},${s(o)}L${i},${s(i)}`}};function kD(t,{y:e=Zt,x:n=W,stroke:r,fill:o=zt(r)?"currentColor":r,...i}={}){return new Q4(t,ku({...i,x:n,y:e,fill:o,stroke:r}))}function LD(t,{x:e=Zt,y:n=W,stroke:r,fill:o=zt(r)?"currentColor":r,...i}={}){return new Z4(t,Nu({...i,x:e,y:n,fill:o,stroke:r}))}function Wb(t,e,n){let r=0,o=0,i=0,s=0;for(let u of t){let p=e[u],l=n[u];r+=p,o+=l,i+=p*l,s+=p*p}let a=t.length,c=(a*i-r*o)/(a*s-r*r),f=(o-c*r)/a;return u=>c*u+f}function RD(t,e,n,r,o){let i=Le(t,u=>e[u])/t.length,s=0,a=0;for(let u of t)s+=(e[u]-i)**2,a+=(n[u]-o(e[u]))**2;let c=Math.sqrt(a/(t.length-2)),f=ND(r,t.length-2);return(u,p)=>{let l=o(u),d=c*Math.sqrt(1/t.length+(u-i)**2/s);return l+p*f*d}}function Fh({path:t=W,delimiter:e,frameAnchor:n,treeLayout:r=Xa,treeSort:o,treeSeparation:i,treeAnchor:s,treeFilter:a,...c}={}){s=Qb(s),o=DD(o),a!=null&&(a=K4(a)),n===void 0&&(n=s.frameAnchor);let f=PD(e),u=jD(c,K4),[p,l]=Qe(),[d,h]=Qe();return{x:p,y:d,frameAnchor:n,...Ne(c,(m,g)=>{let x=f(ut(m,t)),y=l([]),b=h([]),w=-1,_=[],v=[],S=Ux().path(I=>x[I]),E=Hn(m)?I=>I.data=m[I.data]:I=>I.data=m.get(I.data),T=r();T.nodeSize&&T.nodeSize([1,1]),T.separation&&i!==void 0&&T.separation(i??Xd);for(let I of u)I[Gb]=I[YD]([]);for(let I of g){let A=[],k=S(I.filter(O=>x[O]!=null)).each(E);o!=null&&k.sort(o),T(k);for(let O of k.descendants())if(!(a!=null&&!a(O))){A.push(++w),_[w]=O.data,s.position(O,w,y,b);for(let M of u)M[Gb][w]=M[UD](O)}v.push(A)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function Hb({path:t=W,delimiter:e,curve:n="bump-x",stroke:r="#555",strokeWidth:o=1.5,strokeOpacity:i=.5,treeLayout:s=Xa,treeSort:a,treeSeparation:c,treeAnchor:f,treeFilter:u,...p}={}){f=Qb(f),a=DD(a),u!=null&&(u=$D(u)),p={curve:n,stroke:r,strokeWidth:o,strokeOpacity:i,...p};let l=PD(e),d=jD(p,$D),[h,m]=Qe(),[g,x]=Qe(),[y,b]=Qe(),[w,_]=Qe();return{x1:h,x2:g,y1:y,y2:w,...Ne(p,(v,S)=>{let E=l(ut(v,t)),T=m([]),I=x([]),A=b([]),k=_([]),O=-1,M=[],C=[],N=Ux().path(D=>E[D]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Xd);for(let D of d)D[Gb]=D[YD]([]);for(let D of S){let $=[],P=N(D.filter(F=>E[F]!=null)).each(F=>F.data=v[F.data]);a!=null&&P.sort(a),L(P);for(let{source:F,target:q}of P.links())if(!(u!=null&&!u(q,F))){$.push(++O),M[O]=q.data,f.position(F,O,T,A),f.position(q,O,I,k);for(let V of d)V[Gb][O]=V[UD](q,F)}C.push($)}return{data:M,facets:C}}),...Object.fromEntries(d)}}function Qb(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return kZ;case"right":return LZ}throw new Error(`invalid tree anchor: ${t}`)}var kZ={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},LZ={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function DD(t){return t==null||typeof t=="function"?t:`${t}`.trim().toLowerCase().startsWith("node:")?OD(K4(t)):OD(RZ(t))}function OD(t){return(e,n)=>Ge(t(e),t(n))}function RZ(t){return e=>e.data?.[t]}function PD(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=>OZ(r,e))}var J4=92,FD=47;function OZ(t,e){if(e===J4)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 J4: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 FD: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 $Z(t){let e=!1;for(let n=0,r=t.length;n<r;++n){switch(t.charCodeAt(n)){case J4:if(!e){e=!0;continue}case FD:e&&(t=t.slice(0,n-1)+t.slice(n),--n,--r);break}e=!1}return t}function qD(t){return He(t)&&typeof t.node=="function"}function DZ(t){return He(t)&&typeof t.link=="function"}function K4(t){if(qD(t))return t.node;if(t=`${t}`.trim().toLowerCase(),!!t.startsWith("node:")){switch(t){case"node:name":return eM;case"node:path":return tM;case"node:internal":return BD;case"node:external":return zD;case"node:depth":return nM;case"node:height":return rM}throw new Error(`invalid node value: ${t}`)}}function $D(t){if(qD(t))return t.node;if(DZ(t))return t.link;if(t=`${t}`.trim().toLowerCase(),!(!t.startsWith("node:")&&!t.startsWith("parent:"))){switch(t){case"parent:name":return Vb(eM);case"parent:path":return Vb(tM);case"parent:depth":return Vb(nM);case"parent:height":return Vb(rM);case"node:name":return eM;case"node:path":return tM;case"node:internal":return BD;case"node:external":return zD;case"node:depth":return nM;case"node:height":return rM}throw new Error(`invalid link value: ${t}`)}}function tM(t){return t.id}function eM(t){return PZ(t.id)}function nM(t){return t.depth}function rM(t){return t.height}function BD(t){return!!t.children}function zD(t){return!t.children}function Vb(t){return(e,n)=>n==null?void 0:t(n)}function PZ(t){let e=t.length;for(;--e>0&&!FZ(t,e););return $Z(t.slice(e+1))}function FZ(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}var YD=2,UD=3,Gb=4;function jD(t,e){let n=[];for(let r in t){let o=t[r],i=e(o);i!==void 0&&n.push([r,...Qe(o),i])}return n}function oM(t,{fill:e,stroke:n,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,marker:u,markerStart:p=u,markerEnd:l=u,dot:d=zt(p)&&zt(l),text:h="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:x,dy:y,textAnchor:b,treeLayout:w=Xa,textLayout:_=w===Xa||w===zx?"mirrored":"normal",tip:v,...S}={}){if(x===void 0&&(x=Qb(S.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=$e(_,"textLayout",["mirrored","normal"]);function E(T){return Yo(t,Fh({treeLayout:w,text:h,fill:e===void 0?"currentColor":e,stroke:m,dx:x,dy:y,title:g,...T,...S}))}return ke(Rb(t,Hb({treeLayout:w,markerStart:p,markerEnd:l,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,...S})),d?Pr(t,Fh({treeLayout:w,fill:e===void 0?"node:internal":e,title:g,tip:v,...S})):null,h!=null?_==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-x})]:E():null)}function XD(t,e){return oM(t,{...e,treeLayout:zx})}var VD={ariaLabel:"waffle"},qh=class extends bc{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:zi(i,GD("x"))},VD),this.unit=Math.max(0,n),this.gap=+r,this.round=HD(o),this.multiple=QD(s)}},Bh=class extends wc{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:zi(i,GD("y"))},VD),this.unit=Math.max(0,n),this.gap=+r,this.round=HD(o),this.multiple=QD(s)}};function GD(t){return function(e,n,r,o,i){let{unit:s,gap:a,rx:c,ry:f,round:u}=this,{document:p}=i,l=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*qZ(n.scales[t]),{multiple:x=Math.max(1,Math.floor(Math.sqrt(h/g)))}=this,y=Math.min(h/x,g*x),b=g*x,w=t==="y"?([A,k])=>[A*y,-k*b]:([A,k])=>[k*b,A*y],_=(h-x*y)/2,v=typeof m=="function"?A=>m(A)+_:m+_,S=n[t](0),E=eO(),T=p.createElementNS(Nn.svg,"pattern");T.setAttribute("width",t==="y"?y:b),T.setAttribute("height",t==="y"?b:y),T.setAttribute("patternUnits","userSpaceOnUse");let I=T.appendChild(p.createElementNS(Nn.svg,"rect"));return I.setAttribute("x",a/2),I.setAttribute("y",a/2),I.setAttribute("width",(t==="y"?y:b)-a),I.setAttribute("height",(t==="y"?b:y)-a),c!=null&&I.setAttribute("rx",c),f!=null&&I.setAttribute("ry",f),ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(A=>A.selectAll().data(e).enter().append(()=>T.cloneNode(!0)).attr("id",k=>`${E}-${k}`).select("rect").call(ht,this).call(Et,this,r)).call(A=>A.selectAll().data(e).enter().append("path").attr("transform",t==="y"?to`translate(${v},${S})`:to`translate(${S},${v})`).attr("d",k=>`M${iM(u(l[k]/s),u(d[k]/s),x).map(w).join("L")}Z`).attr("fill",k=>`url(#${E}-${k})`).attr("stroke",this.stroke==null?null:k=>`url(#${E}-${k})`)).node()}}function iM(t,e,n){if(t<0||e<0){let r=Math.ceil(-Math.min(t,e)/n);return iM(t+r*n,e+r*n,n).map(([o,i])=>[o,i-r])}return e<t?iM(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 HD(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 QD(t){return t===void 0?void 0:Math.max(1,Math.floor(t))}function qZ({domain:t,range:e}){return WD(e)/WD(t)}function WD(t){let[e,n]=Ft(t);return n-e}function ZD(t,e={}){return Ri(e)||(e={...e,y:Zt,x2:W}),new qh(t,js(wu(Ys(e))))}function JD(t,e={}){return Ri(e)||(e={...e,x:Zt,y2:W}),new Bh(t,Xs(vu(Us(e))))}var fP=Eq(cP(),1);var VZ=({marginLeft:t})=>[1,t],GZ=({width:t,marginRight:e})=>[-1,t-e],HZ=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],QZ=({marginTop:t})=>[1,t],ZZ=({height:t,marginBottom:e})=>[-1,t-e],JZ=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function uP(t){return typeof t=="string"?{anchor:t}:t}function lP(t={},e={}){arguments.length===1&&([t,e]=dP(t));let{anchor:n="left",padding:r=1,r:o=e.r}=uP(t);switch(`${n}`.toLowerCase()){case"left":n=VZ;break;case"right":n=GZ;break;case"middle":n=HZ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return hP("x","y",n,Dt(r),o,e)}function pP(t={},e={}){arguments.length===1&&([t,e]=dP(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=uP(t);switch(`${n}`.toLowerCase()){case"top":n=QZ;break;case"bottom":n=ZZ;break;case"middle":n=JZ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return hP("y","x",n,Dt(r),o,e)}function dP(t){let{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function hP(t,e,n,r,o,i){if(o!=null&&typeof o!="number"){let{channels:s,sort:a,reverse:c}=i;s=Vd(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 Kt(i,function(s,a,c,f,u,p){let{[e]:l,r:d}=c;if(!c[e])throw new Error(`missing channel: ${e}`);({[e]:l}=Bo(c,f,p));let h=d?void 0:o!==void 0?Dt(o):this.r!==void 0?this.r:3;d&&(d=ut(d.value,f[d.scale]||W,Float64Array));let[m,g]=n(u),x=m?tJ:KZ,y=new Float64Array(l.length),b=d?w=>d[w]:()=>h;for(let w of a){let _=(0,fP.default)();w=w.filter(d?S=>Kf(l[S])&&Fn(d[S]):S=>Kf(l[S]));let v=new Float64Array(2*w.length+2);for(let S of w){let E=b(S),T=m?E+r:0,I=l[S]-E,A=l[S]+E,k=2;_.queryInterval(I-r,A+r,([,,M])=>{let C=y[M]-T,N=l[S]-l[M],L=r+(d?d[S]+d[M]:2*h),D=Math.sqrt(L*L-N*N);v[k++]=C-D,v[k++]=C+D});let O=v.slice(0,k);m&&(O=O.filter(M=>M>=0));t:for(let M of O.sort(x)){for(let C=0;C<k;C+=2)if(v[C]+1e-6<M&&M<v[C+1]-1e-6)continue t;y[S]=M+T;break}_.insert([I,A,S])}}m||(m=1);for(let w of a)for(let _ of w)y[_]=y[_]*m+g;return{data:s,facets:a,channels:{[t]:{value:y,source:null},[e]:{value:l,source:c[e]},...d&&{r:{value:d,source:c.r}}}}})}function KZ(t,e){return Math.abs(t)-Math.abs(e)}function tJ(t,e){return t-e}function gP(t,e){return arguments.length===1&&({basis:t,...e}=t),Ou(Kb(t),e)}function xP(t,e){return arguments.length===1&&({basis:t,...e}=t),$u(Kb(t),e)}function Kb(t){if(t===void 0)return mP;if(typeof t=="function")return t2(iu(t));if(/^p\d{2}$/i.test(t))return ju(ou(t));switch(`${t}`.toLowerCase()){case"deviation":return rJ;case"first":return mP;case"last":return nJ;case"max":return oJ;case"mean":return iJ;case"median":return sJ;case"min":return aJ;case"sum":return cJ;case"extent":return eJ}throw new Error(`invalid basis: ${t}`)}function t2(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 ju(t){return t2((e,n)=>t(e,r=>n[r]))}var eJ={mapIndex(t,e,n){let[r,o]=Ft(t,s=>e[s]),i=o-r;for(let s of t)n[s]=e[s]===null?NaN:(e[s]-r)/i}},mP=t2((t,e)=>{for(let n=0;n<t.length;++n){let r=e[t[n]];if(oe(r))return r}}),nJ=t2((t,e)=>{for(let n=t.length-1;n>=0;--n){let r=e[t[n]];if(oe(r))return r}}),rJ={mapIndex(t,e,n){let r=li(t,i=>e[i]),o=Mr(t,i=>e[i]);for(let i of t)n[i]=e[i]===null?NaN:o?(e[i]-r)/o:0}},oJ=ju(Tt),iJ=ju(li),sJ=ju(Vr),aJ=ju(Ct),cJ=ju(Le);function yP(t,e){return wP("x",t,e)}function bP(t,e){return wP("y",t,e)}function wP(t,e,n={}){let r,o=1;if(typeof e=="number")o=e,r=(f,u)=>+f+u;else{if(typeof e=="string"){let f=e.startsWith("-")?-1:1;[e,o]=N1(e.replace(/^[+-]/,"")),o*=f}e=au(e),r=(f,u)=>e.offset(f,u)}let i=`${t}1`,s=`${t}2`,a=Qn({[i]:f=>f.map(u=>r(u,o)),[s]:f=>f},n),c=a[s].transform;return a[s].transform=()=>{let f=c(),[u,p]=Ft(f);return f.domain=o<0?[u,r(p,o)]:[r(u,o),p],f},a}function vP(t,e={}){if(typeof t=="string")switch(t.toLowerCase()){case"first":return Uh(e);case"last":return jh(e)}if(typeof t=="function")return Ks(null,t,e);let n,r;for(n in t){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=fJ(t[n])}if(r===void 0)throw new Error(`invalid selector: ${t}`);return Ks(n,r,e)}function fJ(t){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"min":return lM;case"max":return pM}throw new Error(`unknown selector: ${t}`)}function Uh(t){return Ks(null,uJ,t)}function jh(t){return Ks(null,lJ,t)}function e2(t){return Ks("x",lM,t)}function n2(t){return Ks("y",lM,t)}function r2(t){return Ks("x",pM,t)}function o2(t){return Ks("y",pM,t)}function*uJ(t){yield t[0]}function*lJ(t){yield t[t.length-1]}function*lM(t,e){yield Ag(t,n=>e[n])}function*pM(t,e){yield Ia(t,n=>e[n])}function Ks(t,e,n){if(t!=null){if(n[t]==null)throw new Error(`missing channel: ${t}`);t=n[t]}let r=vn(n);return Ne(n,(o,i)=>{let s=ut(o,r),a=ut(o,t),c=[];for(let f of i){let u=[];for(let p of s?sn(f,l=>s[l]).values():[f])for(let l of e(p,a))u.push(l);c.push(u)}return{data:o,facets:c}})}lt.prototype.plot=function({marks:t=[],...e}={}){return Cu({...e,marks:[...t,this]})};var pJ=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 dJ(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 _P(t,e,n){for(let r in t){let o=pJ.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&&dJ(e,o.split("."),i)}}var hJ=new Set(["frame","hexgrid","sphere","graticule"]),mJ=new Map([["first",Uh],["last",jh],["maxX",r2],["maxY",o2],["minX",e2],["minY",n2],["nearest",qs],["nearestX",Bs],["nearestXY",Yi]]);async function SP(t){let e={marks:[]},n=[],{attributes:r,marks:o}=t;_P(r,e,n);let i=[];for(let a of o)for(let{type:c,data:f,options:u}of a.plotSpecs()){let{select:p,...l}=u,d=mJ.get(p)?.(l)??l,h=hJ.has(c)?[d]:[f,d];e.marks.push(dM[c](...h)),i.push(a.index)}xJ(e,t);let s=Cu(e);bJ(s,i),gJ(t,s,r,n);for(let a of t.interactors)await a.init(s);return s}function gJ(t,e,n,r){r.forEach(o=>{let i=n[o];if(i===lo){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 xJ(t,e){let{marks:n}=e;i2("x",t,n),i2("y",t,n),i2("fx",t,n),i2("fy",t,n)}function i2(t,e,n){let r=e[t]||{};if(r.axis===null||r.label!==void 0)return;let o=n.map(s=>s.channelField(t)?.field);if(o.every(s=>s==null))return;let i;for(let s=0;s<o.length;++s){let a=MP(o[s]);a!==void 0&&(i===void 0?i=a:i!==a&&(i=void 0))}i!==void 0&&(e[t]={...r,label:i})}function MP(t){if(t){switch(t.type){case"COLUMN_REF":return t.column;case"CAST":return MP(t.expr);case"FUNCTION":if(t.name==="make_date")return"date";break}return yJ(t)}}function yJ(t){let e=`${t}`.replaceAll('"',"").replaceAll("(*)","()");return e.endsWith("()")?e.slice(0,-2):e}function bJ(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])}}var wJ={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Xh=class{constructor(e){this.attributes={...wJ},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=c_()}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=vJ(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 SP(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 rp(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 vJ(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 s2(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),t==="none"||t==="currentcolor"||t.startsWith("url(")&&t.endsWith(")")||t.startsWith("var(")&&t.endsWith(")")||nr(t)!==null)}var _J=new Set(["offset","order","reverse","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function AP(t){return _J.has(t)}var SJ=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function EP(t){return SJ.has(`${t}`.toLowerCase())}var TP=t=>t==="stroke"||t==="fill",MJ=t=>/opacity$/i.test(t),AJ=t=>t==="symbol",EJ=(t,e)=>t!=="sort"&&t!=="tip"&&e!=null&&!Array.isArray(e),hM=(t,e)=>({channel:t,field:e,as:Ki(e)&&!$w(e)?e.column:t}),mM=(t,e)=>({channel:t,value:e}),a2=t=>Array.isArray(t),De=class extends zn{constructor(e,n,r,o={}){super(n?.options?.filterBy),this.type=e,this.reqs=o,this.source=n;let i=this.channels=[],s=this.detail=new Set,a=this.params=new Set;a2(n)?this.data=Vn(n):_e(n?.table)&&a.add(n.table);let c=(f,u)=>{let p=typeof u;if(f==="channels")for(let l in u)s.add(l),c(l,u[l]);else if(p==="function"&&u[op]){let l=u(this,f);for(let d in l)c(d,l[d])}else if(p==="string")AP(f)||TP(f)&&s2(u)||AJ(f)&&EP(u)?i.push(mM(f,u)):i.push(hM(f,ga(u)));else if(Yr(u)){let l=mM(f,u.value);i.push(l),u.addEventListener("value",d=>(l.value=d,this.update()))}else qe(u)?(Bv(u).forEach(l=>a.add(l)),i.push(hM(f,u))):p==="object"&&EJ(f,u)?i.push(hM(f,u)):u!==void 0&&i.push(mM(f,u))};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()}sourceTable(){let e=this.source?.table;return e?_e(e)?e.value:e:null}hasOwnData(){return this.source==null||a2(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{channels:e,reqs:n}=this,r=new Map;for(let{channel:i,field:s}of e){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,f=r.get(c)??r.set(c,new Set).get(c);a.forEach(u=>f.add(u)),n[i]?.forEach(u=>f.add(u))}let o=this.sourceTable();return Array.from(r,([i,s])=>({table:o,column:i,stats:Array.from(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=[]){return this.hasOwnData()?null:Wh(this.channels,this.sourceTable()).where(e)}queryPending(){return this.plot.pending(this),this}queryResult(e){return this.data=Vn(e),this}update(){return this.plot.update(this)}plotSpecs(){let{type:e,data:n,detail:r,channels:o}=this;return gM(e,r,o,n)}};function Sn(t,e){let n=e?.[t.as]??t.as;return Object.hasOwn(t,"value")?t.value:TP(t.channel)?{value:n,scale:"color"}:MJ(t.channel)?{value:n,scale:"opacity"}:n}function Wh(t,e,n=[]){let r=st.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(Mn(c))i=!0;else{if(o.has(f))continue;o.add(f)}r.select({[f]:c})}}}return i&&r.groupby(Array.from(o)),r}function gM(t,e,n,r,o={}){let{numRows:i,values:s,columns:a}=r??{},c={};for(let p of n){let l=e.has(p.channel)?c:o;l[p.channel]=Sn(p,a)}return e.size&&(o.channels=c),[{type:t,data:s??(r?{length:i}:null),options:o}]}function Ec(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 tp(o)}function hr(t,e,n,r,o=1,i){let{field:s}=t.channelField(e);i=i??s;let{type:a,apply:c,sqlApply:f}=Ec(t,e),u=!!t.plot.getAttribute(`${e}Reverse`),[p,l]=r.map(m=>c(m)),d=f(i),h=a==="time"||a==="utc"?d:i;return[Gv(d,p,l,n-o,u),h]}var xM={x:["min","max"]},yM={y:["min","max"]},c2={...xM,...yM};function IP(t,e,n,r,o){let{plot:i}=t,s=i.getAttribute(r),a=i.getAttribute(o);if(Array.isArray(s)&&!s[rn])return s;{let{column:c,min:f,max:u}=t.channelField(n),p=bM(e,c)||(a?vi().domain([f,u]).nice().domain():[f,u]);return s!==lo&&(p[rn]=!0),i.setAttribute(r,p,{silent:!0}),p}}function Vo(t,e){return IP(t,e,"x","xDomain","xNice")}function Go(t,e){return IP(t,e,"y","yDomain","yNice")}function bM(t,e){if(!t)return;let n,r;return[t].flat().forEach(o=>ao(o,i=>{if(i instanceof va&&`${i.expr}`===e){let s=(i.extent??[]).map(a=>a?.value??a);(n==null||s[0]<n)&&(n=s[0]),(r==null||s[1]>r)&&(r=s[1])}})),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Vh=class extends De{constructor(e,n,r){let o=e.endsWith("X")?"y":e.endsWith("Y")?"x":null,i=o?{[o]:["count","min","max"]}:void 0;super(e,n,r,i),this.dim=o}query(e=[]){let{plot:n,dim:r,source:o}=this,i=o.options?.optimize,s=super.query(e);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:f,as:u,type:p,count:l,min:d,max:h}=this.channelField(r),m=p==="date"||p==="number",g=r==="x"?n.innerWidth():n.innerHeight();if(i??=l/g>10,i&&m&&c){let[x,y]=bM(e,f)||[d,h],[b]=hr(this,r,g,[x,y],1,u),w=s._select.map(_=>_.alias).filter(_=>_!==u&&_!==c);return Kv(s,b,u,c,w)}else return s.orderby(f)}};function wM(t,e=[]){return new e.constructor(t)}function CP(t,e,n,r,o){let i=e.length,s={},a=[];if(o?.length){let c=new Int32Array(i),f=o.map(l=>r[l]),u={};for(let l=0;l<i;++l){let d=f.map(h=>h[l]);c[l]=u[d]??=a.push(d)-1}for(let l=0;l<o.length;++l)s[o[l]]=a.map(d=>d[l]);let p=s._grid=a.map(()=>wM(t,n));for(let l=0;l<i;++l)p[c[l]][e[l]]=n[l]}else{a.push([]);let[c]=s._grid=[wM(t,n)];for(let f=0;f<i;++f)c[e[f]]=n[f]}return{numRows:a.length,columns:s}}function NP(t,e,n,r,o,i,s){let a=n.length,c=t*e,f=o.map(d=>r[d]),u={},p=[],l=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(x=>x[m]);l[m]=h[g]??=p.push(g)-1}for(let m=0;m<i.length;++m)u[i[m]]=p.map(g=>g[m])}else p.push([]);if(s){let d=n.map(g=>g%t),h=n.map(g=>Math.floor(g/t)),m=p.map(()=>[]);for(let g=0;g<a;++g)m[l[g]].push(g);o.forEach((g,x)=>{let y=f[x];u[g]=p.map((b,w)=>s(m[w],t,e,d,h,y))})}else o.forEach((d,h)=>{let m=f[h],g=u[d]=p.map(()=>wM(c,m));for(let x=0;x<a;++x)g[l[x]][n[x]]=m[x]});return{numRows:p.length,columns:u}}function Gh(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 kP(t){let e=new In;return t.forEach(n=>{let r=n.length;for(let o=0;o<r;++o)e.add(n[o])}),Array.from(e).sort(yt)}function pe(t,e){return _e(t)?(t.addEventListener("value",e),t.value):t}function Hh(t,e=!1){let n=new Float64Array(5),r=new Float64Array(4);TJ(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 TJ(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)),u=n*2.5066282746310007,p=Float64Array.of(o[0],o[1],0,0,0,0,0,0),l=Float64Array.of(1,0,f[0],f[1],0,0,0,0,0,0),d,h;for(h=2;h<8;h+=2){for(p[h]=f[h]*p[h-2]-f[h+1]*p[h-1],p[h+1]=f[h]*p[h-1]+f[h+1]*p[h-2],d=h-2;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(d=0;d<=h;d+=2)p[d]+=o[h]*l[d]-o[h+1]*l[d+1],p[d+1]+=o[h]*l[d+1]+o[h+1]*l[d];for(l[h+2]=f[h]*l[h]-f[h+1]*l[h+1],l[h+3]=f[h]*l[h+1]+f[h+1]*l[h],d=h;d>0;d-=2)l[d]+=f[h]*l[d-2]-f[h+1]*l[d-1],l[d+1]+=f[h]*l[d-1]+f[h+1]*l[d-2]}for(h=0;h<4;++h)d=h<<1,e[h]=p[d]/u,t[h+1]=l[d+2]}function LP(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,u=0;f<o;++f,u+=r){let p=c.subarray(u);f2(t,n.subarray(u),r,1,i,s,a,p)}for(let f=0;f<r;++f){let u=c.subarray(f);f2(e,u,o,r,i,s,a,u)}return c}function f2(t,e,n,r=1,o=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(5),a=o,c=IJ){let f=r*2,u=r*3,p=r*4,l=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=p;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-u]-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=l-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+u]+t.b_anticausal[4]*e[d+p]-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 IJ(t,e,n,r,o,i,s,a,c,f,u,p=.5){let l=Math.abs(r)*n,d=r<0?l+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<l&&(t[g]+=f[g-m]*e[h]);let x=e[d],y=Math.ceil(u*10);for(m=0;m<y;++m){for(g=0;g<a;++g)t[g]+=f[g]*x;if(c-=Math.abs(f[0]),c<=p)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 eo="density",no=class extends De{constructor(e,n,r){let{bandwidth:o=0,interpolate:i="none",pixelSize:s=1,pad:a=1,width:c,height:f,...u}=r,p=CJ(u);super(e,n,u,c2),this.densityMap=p,this.bandwidth=pe(o,l=>(this.bandwidth=l,this.grids?this.convolve().update():null)),this.interpolate=pe(i,l=>(this.interpolate=l,this.requestUpdate())),this.pixelSize=pe(s,l=>(this.pixelSize=l,this.requestUpdate())),this.pad=pe(a,l=>(this.pad=l,this.requestUpdate())),this.width=pe(c,l=>(this.width=l,this.requestUpdate())),this.height=pe(f,l=>(this.height=l,this.requestUpdate()))}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};e.addAttributeListener("xDomain",r),e.addAttributeListener("yDomain",r),super.setPlot(e,n)}get filterStable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[rn]&&!n[rn]}query(e=[]){let{interpolate:n,pad:r,channels:o,densityMap:i}=this,[s,a]=this.extentX=Vo(this,e),[c,f]=this.extentY=Go(this,e),[u,p]=this.bins=this.binDimensions(),[l,d]=hr(this,"x",u,[s,a],r),[h,m]=hr(this,"y",p,[c,f],r),g=r?[nn(d,[+s,+a]),nn(m,[+c,+f])]:[tr(+s,d),ae(d,+a),tr(+c,m),ae(m,+f)],x=st.from(this.sourceTable()).where(e.concat(g)),y=this.groupby=[],b={};for(let _ of o)if(Object.hasOwn(_,"field")){let{as:v,channel:S,field:E}=_;Mn(E)?(b[S]=E,i[S]=!0):S==="weight"?b[eo]=Yt(E):S!=="x"&&S!=="y"&&(x.select({[v]:E}),y.push(v))}let w=this.aggr=Object.keys(b);if(b.density&&w.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(w.length||(w.push(eo),b[eo]=ze()),n==="linear"){if(w.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[eo])throw new Error("Linear binning not applicable to custom aggregates.");let _=of(b[eo])[0];return Zv(x,l,h,_,u,y)}else return Hv(x,l,h,b,u,y)}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=NJ(this.interpolate),{columns:i}=Vn(e);return this.grids0=NP(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(eo)?eo:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.columns[s],c=i.innerWidth(),f=i.innerHeight(),[u,p]=r,l=a.some(m=>m.some(g=>g<0)),d=Hh(n*(u-1)/c,l),h=Hh(n*(p-1)/f,l);this.grids={numRows:o.numRows,columns:{...o.columns,[s]:a.map(m=>LP(d,h,m,r))}}}return this}};function CJ(t){let e={};for(let n in t)t[n]==="density"&&(delete t[n],e[n]=!0);return e}function NJ(t="none"){if(typeof t=="function")return t;switch(t.toLowerCase()){case"none":case"linear":return;case"nearest":return Ch;case"barycentric":return Ih();case"random-walk":return Nh()}throw new Error(`invalid interpolate: ${t}`)}var Qh=class extends no{constructor(e,n){let{thresholds:r=10,...o}=n;super("geo",e,{bandwidth:20,interpolate:"linear",pixelSize:2,...o}),this.thresholds=pe(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[,A]=Gh(a.density);f=Array.from({length:c-1},(k,O)=>A*(O+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,p]=e,[l,d]=i.getAttribute("xDomain"),[h,m]=i.getAttribute("yDomain"),g=(d-l)/u,x=(m-h)/p,y=+l,b=+h,w=A=>y+A*g,_=A=>b+A*x,v=hs().size(e),S=this.contourData=Array(s*f.length),{density:E,...T}=a,I=Object.entries(T);for(let A=0,k=0;A<s;++A){let O=E[A],M=I.reduce((C,[N,L])=>(C[N]=L[A],C),{});for(let C=0;C<f.length;++C,++k)S[k]=Object.assign(kJ(v.contour(O,f[C]),w,_),M)}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]=Sn(s))}for(let s in r)r[s]&&(i[s]=Sn({channel:s,as:"value"}));return[{type:e,data:o,options:i}]}};function kJ(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 Zh(t){return Array.from({length:t},(e,n)=>n)}function u2(t,e){let n=e.reduce((o,i,s)=>(o[i]=s,o),{}),r=Zh(t.length);return r.sort((o,i)=>n[t[o]]-n[t[i]]),r}function l2(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 RP(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 OP(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 $P(t={}){let{r:e=0,g:n=0,b:r=0,opacity:o=1}=typeof t=="string"?Re(t):t,i=new Uint8ClampedArray([e,n,r,255*o|0]);return(s,a,c)=>{for(let f=0,u=0;f<c;++f)for(let p=0;p<a;++p,u+=4)s[u+0]=i[0],s[u+1]=i[1],s[u+2]=i[2],s[u+3]=i[3]}}function DP(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:u,b:p,opacity:l=1}=typeof c=="string"?Re(c):c,d=a<<2;o[d+0]=f,o[d+1]=u,o[d+2]=p,o[d+3]=255*l|0,r[e[a]]=d}return(a,c,f,u)=>{if(u.map)for(let p=0,l=0;p<f;++p)for(let d=0,h=(f-p-1)*c;d<c;++d,l+=4){let m=r[u[d+h]];a[l+0]=o[m+0],a[l+1]=o[m+1],a[l+2]=o[m+2],a[l+3]=o[m+3]}else{let p=r[u];for(let l=0,d=0;l<f;++l)for(let h=0;h<c;++h,d+=4)a[d+0]=o[p+0],a[d+1]=o[p+1],a[d+2]=o[p+2],a[d+3]=o[p+3]}}}function PP(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:u,opacity:p=1}=typeof a=="string"?Re(a):a,l=s<<2;o[l+0]=c,o[l+1]=f,o[l+2]=u,o[l+3]=255*p|0}return(s,a,c,f)=>{for(let u=0,p=0;u<c;++u)for(let l=0,d=(c-u-1)*a;l<a;++l,p+=4){let h=i*n(f[l+d])<<2;s[p+0]=o[h+0],s[p+1]=o[h+1],s[p+2]=o[h+2],s[p+3]=o[h+3]}}}var ta=class extends no{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}=$J(this,r,o),{alpha:u,alphaProp:p,color:l,colorProp:d}=vM(this),h=s[p]??[],m=s[d]??[],g=i>1&&d&&this.groupby?.includes(d)?u2(m,this.plot.getAttribute("colorDomain")):Zh(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(x,y)=>(l?.(f.data,r,o,m[g[y]]),u?.(f.data,r,o,h[g[y]]),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}]}},Jh=class extends ta{constructor(e,n){super(e,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function vM(t){let{aggr:e,densityMap:n,groupby:r,plot:o}=t,i=e.includes(eo),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":s2(a?.value)?a.value:i&&o.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||e.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:i&&f!=="grid"?"grid":void 0;if(f!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let p=a?.as??(f==="grid"?eo:null),l=c?.as??(u==="grid"?eo:null),d=f!=="grid"&&f!=="group"?$P(f):RJ(t,p),h=u!=="grid"?RP(u):LJ(t,l);return{alphaProp:l,colorProp:p,alpha:h,color:d}}function LJ(t,e){let{plot:n,grids:r}=t,o=n.getAttribute("opacityDomain"),i=o===lo,s=o?.[rn],a=!i&&!s&&o||Gh(r.columns[e]);(i||s||!o)&&(i||(a[rn]=!0),n.setAttribute("opacityDomain",a));let c=Os({opacity:{type:n.getAttribute("opacityScale"),domain:a,range:n.getAttribute("opacityRange"),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 OP(c)}function RJ(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===lo,f=a?.[rn],u=!c&&!f&&a||(i?o.slice().sort(yt):s?kP(o):Gh(o));(c||f||!a)&&(c||(u[rn]=!0),n.setAttribute("colorDomain",u));let p=Os({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 DP(p);{let l=Os({x:{type:OJ(p.type),domain:p.domain,reverse:p.reverse,range:[0,1],clamp:p.clamp,base:p.base,exponent:p.exponent,constant:p.constant}});return PP(1024,p,l.apply)}}function OJ(t){return t.endsWith("symlog")?"symlog":t.endsWith("log")?"log":t.endsWith("pow")?"pow":t.endsWith("sqrt")?"sqrt":t==="diverging"?"linear":t}function $J(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=l2(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 Kh=class extends ta{constructor(e,n){let{normalize:r=!0,...o}=n;super(e,o),this.normalize=pe(r,i=>(this.normalize=i,this.requestUpdate()))}query(e=[]){let{channels:n,normalize:r,pad:o}=this,[i,s]=this.bins=this.binDimensions(),[a]=hr(this,"x",i,Vo(this,e),o),[c]=hr(this,"y",s,Go(this,e),o),f=st.from(this.sourceTable()).where(DJ(this,e));this.aggr=["density"];let u=this.groupby=[],p=[];for(let l of n)if(Object.hasOwn(l,"field")){let{channel:d,field:h}=l;d==="z"?(f.select({[d]:h}),p.push("z")):d!=="x"&&d!=="y"&&(f.select({[d]:h}),u.push(d))}return Jv(f,a,c,p,i,s,u,r)}};function DJ(t,e){if(Array.isArray(e)&&!e.length)return e;let n=t.channelField("x").column,r=t.channelField("y").column,o=s=>{let a=`${s.expr}`;return s.type!=="BETWEEN"||a!==n&&a!==r},i=s=>s.op==="AND"?dn(s.clauses.filter(a=>o(a))):s;return Array.isArray(e)?e.filter(s=>o(s)).map(s=>i(s)):i(e)}var PJ={fill:1,stroke:1,z:1},Xu=class extends De{constructor(e,n,r){let{bins:o=1024,bandwidth:i=20,normalize:s=!1,stack:a=!1,...c}=r,f=e.endsWith("X")?"y":"x";super(e,n,c,f==="x"?xM:yM),this.dim=f,this.bins=pe(o,u=>(this.bins=u,this.requestUpdate())),this.bandwidth=pe(i,u=>(this.bandwidth=u,this.grids?this.convolve().update():null)),this.normalize=pe(s,u=>(this.normalize=u,this.convolve().update())),this.stack=pe(a,u=>(this.stack=u,this.update()))}get filterStable(){let e=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(e);return n&&!n[rn]}query(e=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:o}=this,i=this.extent=(o==="x"?Vo:Go)(this,e),[s,a]=hr(this,o,n,i),c=Wh(r,this.sourceTable(),[o]).where(e.concat(nn(a,i))),f=this.channelField("weight")?"weight":null,u=this.groupby=r.flatMap(p=>PJ[p.channel]&&p.field?p.as:[]);return Qv(c,s,f,u)}queryResult(e){let n=Vn(e).columns;return this.grids=CP(this.bins,n.index,n.density,n,this.groupby),this.convolve()}convolve(){let{bins:e,bandwidth:n,normalize:r,dim:o,grids:i,groupby:s,plot:a,extent:[c,f]}=this,u=i.columns,p=i.numRows,l=this.channelField(o).as,d=o==="x"?"y":"x",h=o==="x"?a.innerWidth():a.innerHeight(),m=u._grid.some(S=>S.some(E=>E<0)),g=Hh(n*(e-1)/h,m),x=+c,y=(f-x)/(e-1),b=e*p,w=new Float64Array(b),_=new Float64Array(b),v=s.reduce((S,E)=>(S[E]=Array(b),S),{});for(let S=0,E=0;E<p;++E){s.forEach(k=>v[k].fill(u[k][E],S,S+e));let T=u._grid[E],I=f2(g,T,e),A=1/FJ(T,I,y,r);for(let k=0;k<e;++k,++S)w[S]=x+k*y,_[S]=I[k]*A}return this.data={numRows:b,columns:{[l]:w,[d]:_,...v}},this}plotSpecs(){let{type:e,data:{numRows:n,columns:r},channels:o,dim:i,stack:s}=this,a=e.startsWith("area")&&!s?"2":"",c=i==="x"?{[`y${a}`]:r.y}:{[`x${a}`]:r.x};for(let f of o)c[f.channel]=Sn(f,r);return[{type:e,data:{length:n},options:c}]}};function FJ(t,e,n,r){return(r===!0||r==="sum"?Le(t):r==="max"?Tt(e):n)||1}var tm=class extends no{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=Ec(this,"x"),c=Ec(this,"y"),[f,u]=r.map(g=>a.apply(g)),[p,l]=o.map(g=>c.apply(g)),d=(u-f)/(i-n),h=(l-p)/(s-n),m=n?0:.5;return this.data=qJ(this.grids,e,f,p,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]:Sn(a,i)}for(let a in r)r[a]&&(s[a]=i.density);return[{type:e,data:{length:o},options:s}]}};function qJ(t,e,n,r,o,i,s,a,c){let f=1/(o*i),[u,p]=e,l=u*p,d=l*t.numRows,h=new Float64Array(d),m=new Float64Array(d),g=new Float64Array(d),x={x:h,y:m,density:g},{density:y,...b}=t.columns;for(let _ in b)x[_]=new b[_].constructor(d);let w=0;for(let _=0;_<t.numRows;++_){for(let S in b)x[S].fill(b[S][_],w,w+l);let v=y[_];for(let S=0,E=0;E<p;++E)for(let T=0;T<u;++T,++w,++S)h[w]=s(n+(T+c)*o),m[w]=a(r+(E+c)*i),g[w]=v[S]*f}return{numRows:d,columns:x}}function BJ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,u,p,l,d,h,m,g,x;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,u=Math.sqrt(-2*Math.log(f)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,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)),u=Math.exp(e*a)/e,p=Math.exp(n*c)/n,g=u+p,t<u/g?d=Math.pow(e*g*t,1/e):d=1-Math.pow(n*g*(1-t),1/n)),x=-Wu(e)-Wu(n)+Wu(e+n);s<10;s++){if(d===0||d===1)return d;if(l=zJ(d,e,n)-t,u=Math.exp(o*Math.log(d)+i*Math.log(1-d)+x),p=l/u,d-=u=p/(1-.5*Math.min(1,p*(o/d-i/(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 zJ(t,e,n){var r=t===0||t===1?0:Math.exp(Wu(e+n)-Wu(e)-Wu(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?0:t<(e+1)/(e+n+2)?r*FP(t,e,n)/e:1-r*FP(1-t,n,e)/n}function FP(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,u,p,l,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(u=2*o,p=o*(n-o)*t/((a+u)*(e+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,p=-(e+o)*(i+o)*t/((e+u)*(s+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,l=f*c,d*=l,!(Math.abs(l-1)<3e-7));o++);return d}function Wu(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 qP(t,e){var n=BJ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}function BP(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 Vu=class extends De{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=pe(i,a=>(this.ci=a,this.update()))}query(e=[]){let{channels:n,field:r}=this,o=n.concat([{field:jl(r),as:"__avg__"},{field:Pt(Vl(r),ii(ze(r))),as:"__se__"}]);return Wh(o,this.sourceTable()).where(e)}queryResult(e){return this.data=Vn(e),this}plotSpecs(){let{type:e,dim:n,detail:r,data:o,ci:i,channels:s}=this,a=Math.SQRT2*BP(i),{columns:{__avg__:c,__se__:f}}=o,u={[`${n}1`]:c.map((p,l)=>p-a*f[l]),[`${n}2`]:c.map((p,l)=>p+a*f[l])};return gM(e,r,s,o,u)}};var YJ="geom",em=class extends De{constructor(e,n={},r){!a2(e)&&!n?.geometry&&(n.geometry=Ql(YJ)),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 nm=class extends De{constructor(e,n){let{type:r="hexagon",binWidth:o=20,...i}=n;super(r,e,{r:o/2,clip:!0,...i},c2),this.binWidth=pe(o,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[rn]&&!n[rn]}query(e=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:o}=this,i,s,a=new Set,c={};for(let I of o)if(I.channel!=="orderby"){if(I.channel==="x")i=I;else if(I.channel==="y")s=I;else if(Object.hasOwn(I,"field")){let{as:A,field:k}=I;c[A]=k,Mn(k)||a.add(A)}}let[f,u]=Vo(this,e),[p,l]=Go(this,e),d=.5-n.getAttribute("marginLeft"),h=0-n.getAttribute("marginTop"),m=de(r),g=de(r*(1.5/Math.sqrt(3))),x=de(n.innerWidth()/(u-f)),y=de(n.innerHeight()/(l-p)),b="_x",w="_y",_="_px",v="_py",S="_pi",E="_pj",T="_tt";return st.select({[i.as]:Rt(de(f),Pt(Rt(mt(Rt(b,mt(.5,Gl(w,1))),m),d),x)),[s.as]:dt(de(l),Pt(Rt(mt(w,g),h),y)),...c}).groupby(b,w,...a).from(st.select({[v]:Pt(dt(mt(y,dt(l,s.field)),h),g),[E]:Gt(si(v)),[_]:dt(Pt(dt(mt(x,dt(i.field,f)),d),m),mt(.5,Gl(E,1))),[S]:Gt(si(_)),[T]:dn(_r(mt(Ye(dt(v,E)),3),1),_r(Rt(ve(dt(_,S),2),ve(dt(v,E),2)),Rt(ve(dt(dt(_,S),mt(.5,oi(ae(_,S),-1,1))),2),ve(dt(dt(v,E),oi(ae(v,E),-1,1)),2)))),[b]:oi(T,Gt(Rt(Rt(S,oi(ae(_,S),-.5,.5)),oi(jr(Gl(E,1),0),.5,-.5))),S),[w]:oi(T,Gt(Rt(E,oi(ae(v,E),-1,1))),E)},"*").from(this.sourceTable()).where(vr(i.field),vr(s.field),e))}};var rm=class extends no{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}=this,[[s,a],[c,f]]=e,[u,p]=this.bins,[l,d]=hr(this,"x",u,[s,a],r),[h,m]=hr(this,"y",p,[c,f],r),g=r?[nn(d,[+s,+a]),nn(m,[+c,+f])]:[tr(+s,d),ae(d,+a),tr(+c,m),ae(m,+f)],x=st.from(this.sourceTable()).where(g),y=this.groupby=[],b={};for(let _ of o)if(Object.hasOwn(_,"field")){let{as:v,channel:S,field:E}=_;E.aggregate?(b[S]=E,i[S]=!0):S==="weight"?b.density=Yt(E):S!=="x"&&S!=="y"&&(x.select({[v]:E}),y.push(v))}let w=this.aggr=Object.keys(b);if(b.density&&w.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(w.length||(w.push("density"),b.density=ze()),n==="linear"){if(w.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b.density)throw new Error("Linear binning not applicable to custom aggregates.");return VJ(x,l,h,b.density,u,y)}else return WJ(x,l,h,b,u,y)}async requestTiles(){let e=Sr();this.prefetch&&e.cancel(this.prefetch);let{pad:n,tileX:r,tileY:o,origin:[i,s]}=this,[a,c]=this.bins=this.binDimensions(),[f,u]=Vo(this,this._filter),[p,l]=Go(this,this._filter),d=u-f,h=l-p,m=Math.floor((f-i)*(a-n)/d),g=Math.floor((p-s)*(c-n)/h),x=(A,k)=>[[i+A*d,i+(A+1)*d],[s+k*h,s+(k+1)*h]],y=Math.floor((f-i)/d),b=r?zP((u-i)/d):y,w=Math.floor((p-s)/h),_=o?zP((l-s)/h):w,v=[];for(let A=y;A<=b;++A)for(let k=w;k<=_;++k)v.push([A,k]);let S=v.map(([A,k])=>e.query(this.tileQuery(x(A,k)))),E=[];if(r)for(let A=w;A<=_;++A)E.push([b+1,A]),E.push([y-1,A]);if(o){let A=r?y-1:y,k=r?b+1:b;for(let O=A;O<=k;++O)E.push([O,_+1]),E.push([O,w-1])}this.prefetch=E.map(([A,k])=>e.prefetch(this.tileQuery(x(A,k))));let T=await Promise.all(S),I=UJ(a,c,m,g,v,T);this.grids0={numRows:I.length,columns:{density:[I]}},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}=XJ(this,r,o),{alpha:u,alphaProp:p,color:l,colorProp:d}=vM(this),h=s[p]??[],m=s[d]??[],g=i>1&&d&&this.groupby?.includes(d)?u2(m,this.plot.getAttribute("colorDomain")):Zh(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(x,y)=>(l?.(f.data,r,o,m[g[y]]),u?.(f.data,r,o,h[g[y]]),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 UJ(t,e,n,r,o,i){let s=new Float64Array(t*e);return i.forEach((a,c)=>{let[f,u]=o[c],p=f*t-n,l=u*e-r;jJ(t,e,s,a,p,l)}),s}function jJ(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 u=a[f],p=o+u%t,l=i+Math.floor(u/t);0<=p&&p<t&&0<=l&&l<e&&(n[p+l*t]=c[f])}}function XJ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=l2(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 WJ(t,e,n,r,o,i){return t.select({index:ye`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function VJ(t,e,n,r,o,i){let s=r.column?`* ${r.column}`:"",a=(l,d)=>t.clone().select({xp:e,yp:n,i:l,w:d}),c=a(ye`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,ye`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(ye`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,ye`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(ye`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,ye`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),p=a(ye`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,ye`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return st.from(st.unionAll(c,f,u,p)).select({index:"i",density:Yt("w")},i).groupby("index",i).having(jr("density",0))}function zP(t){let e=Math.floor(t);return e===t?e-1:e}var om=class extends De{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=pe(r,a=>(this.ci=a,s())),this.precision=pe(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 st.from(super.query(e)).select({intercept:Jw(r,n),slope:ev(r,n),n:Wl(r,n),ssy:tv(r,n),ssx:Kw(r,n),xm:Xl(r,n),x0:de(Xn(n).where(vr(r))),x1:de(en(n).where(vr(r)))}).select(o).groupby(o)}queryResult(e){return this.modelFit=Vn(e),this.lineData=GJ(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:e,modelFit:n,precision:r,plot:o}=this,i=o.innerWidth();return this.areaData=e?HJ(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=Sn(f,s);break;case"stroke":a.stroke=Sn(f,i),c.fill=Sn(f,s);break;case"strokeOpacity":a.strokeOpacity=Sn(f,i);break;case"fillOpacity":c.fillOpacity=Sn(f,s);break;default:a[f.channel]=Sn(f,i),c[f.channel]=Sn(f,s);break}return[...o?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:e.numRows},options:a}]}};function _M(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 GJ(t){let{x0:e=[],x1:n=[],xm:r,intercept:o,slope:i,n:s,ssx:a,ssy:c,...f}=t.columns,u=(d,h)=>o[h]+d*i[h],p=_M(e,n),l=_M(e.map(u),n.map(u));for(let d in f)f[d]=_M(f[d],f[d]);return{numRows:p.length,columns:{x:p,y:l,...f}}}function HJ(t,e,n,r){let o=t.numRows,{x0:i,x1:s,xm:a,intercept:c,slope:f,n:u,ssx:p,ssy:l,...d}=t.columns,h=Object.keys(d),m={x:[],y1:[],y2:[]};h.forEach(g=>m[g]=[]);for(let g=0;g<o;++g){let x=n*(s[g]-i[g])/r,y=qP((1-e)/2,u[g]-2)*Math.sqrt(l[g]/(u[g]-2));be(i[g],s[g]-x/2,x).concat(s[g]).forEach(b=>{let w=c[g]+b*f[g],_=y*Math.sqrt(1/u[g]+(b-a[g])**2/p[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 Gu(t){t.tagName==="a"&&(t=t.children[0]);let e=t.__data__;return Array.isArray(e)?e[0]:e}function YP(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 ea(t){let e={};for(let n in t)e[YP(n)]=t[n];return e}function QJ(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(Mn(a))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 im=class{constructor(e,{selection:n,channels:r={}}){this.mark=QJ(e),this.selection=n;let o=Object.entries(ea(r));this.channels=o.length?o:[["opacity",.2]],this.selection.addEventListener("value",al(()=>this.update()))}init(e){this.svg=e;let n=this.values=[],o=`g[data-index="${this.mark.index}"]`,i=`${o} > *:not(g), ${o} > g > *`,s=this.nodes=e.querySelectorAll(i),{channels:a}=this;for(let c=0;c<s.length;++c){let f=s[c];n.push(a.map(u=>f.getAttribute(u[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 ZJ(i,s);for(let c=0;c<n.length;++c){let f=n[c],u=o[c],p=a(Gu(f));for(let l=0;l<r.length;++l){let[d,h]=r[l];f.setAttribute(d,p?u[l]:h)}}}};async function ZJ(t,e){let n=e?.predicate(t);if(!n||n.length===0)return()=>!0;let r=t.filterBy?.predicate(t,!0),o={__:dn(n)},i=t.query(r);(i.queries||[i]).forEach(c=>{c._groupby.length?c.select(o):c.setSelect(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 p2(){let t=this,e=t.getScreenCTM,n;t.getScreenCTM=()=>t.isConnected?n=e.call(t):n}function SM(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 d2(){return SM(W_())}function UP(){return SM(j_())}function jP(){return SM(X_())}function h2(t,e,n,r,o){let i=Nt(e??t).append("g").attr("class",o),s=t.scale("fx"),a=t.scale("fy");if(s||a){let c=s?.domain.map(u=>s.apply(u)-n),f=a?.domain.map(u=>a.apply(u)-r);if(c&&f)for(let u=0;u<c.length;++u)for(let p=0;p<f.length;++p)i.append("g").attr("transform",`translate(${c[u]}, ${f[p]})`);else if(c)for(let u=0;u<c.length;++u)i.append("g").attr("transform",`translate(${c[u]}, 0})`);else if(f)for(let u=0;u<f.length;++u)i.append("g").attr("transform",`translate(0, ${f[u]})`);i=i.selectAll("g")}return i.each(p2)}function sm(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 XP(t){if(qe(t)){if(t.type==="COLUMN_REF")return t.column;if(t.type==="AGGREGATE")return t.args[0]??t}return t}function Ho(t,e){return XP(t.channelField(e)?.field)}function WP(t,e){let n=[],r=[];return e.forEach(o=>{let i=o==="color"?["color","fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let s=0;s<i.length;++s){let a=t.channelField(i[s],{exact:!0});if(a){n.push(XP(a.field)),r.push(a.as);return}}throw new Error(`Missing channel: ${o}`)}),{fields:n,as:r}}function am(t,e,n=1){return e.invert(n*Math.floor(t/n))}var na=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||Ho(e,n),this.style=a&&ea(a),this.brush=n==="y"?jP():UP(),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=>am(r,this.scale,this.pixelSize)).sort((r,o)=>r-o)),sm(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 Ea(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=this.value?.map(this.scale.apply).sort(yt),a=e.scale("x").range,c=e.scale("y").range;if(r.extent([[Ct(a),Ct(c)],[Tt(a),Tt(c)]]),this.g=h2(e,n,Ct(a),Ct(c),`interval-${o}`).call(r).call(r.moveSilent,s),i){let f=this.g.selectAll("rect.selection");for(let u in i)f.attr(u,i[u])}e.addEventListener("pointerenter",f=>{f.buttons||this.activate()})}};var cm=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||Ho(e,"x"),this.yfield=o||Ho(e,"y"),this.style=a&&ea(a),this.brush=d2(),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(u=>am(u,o,r)).sort(yt),a=[c[1],f[1]].map(u=>am(u,i,r)).sort(yt)}(!sm(s,n?.[0])||!sm(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 i_([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,value:o}=this,i=this.xscale=e.scale("x"),s=this.yscale=e.scale("y"),a=i.range,c=s.range;if(n.extent([[Ct(a),Ct(c)],[Tt(a),Tt(c)]]),this.g=h2(e,null,Ct(a),Ct(c),"interval-xy").call(n),r){let f=this.g.selectAll("rect.selection");for(let u in r)f.attr(u,r[u])}if(o){let[f,u]=o[0].map(i.apply).sort(yt),[p,l]=o[1].map(s.apply).sort(yt);this.g.call(n.moveSilent,[[f,p],[u,l]])}e.addEventListener("pointerenter",f=>{f.buttons||this.activate()})}};var Tc=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=>Ho(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?ai(r,e&&[e],o):is(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(m=>r.channelField(m).as),f=!er(i),[u,p]=JJ(e,r),l=this.pointer==="y"?.01:1,d=this.pointer==="x"?.01:1,h=Nt(e);h.on("pointerenter pointerdown pointermove",function(m){let[g,x]=hn(m,this),y=KJ(u,p,g,x,l,d,s);if(y!==this.valueIndex){this.valueIndex=y;let b=y<0?void 0:c.map(w=>a[w][y]);i.update(f?!b||b.length>1?b:b[0]:n.clause(b))}}),!f&&(h.on("pointerleave",()=>{i.update(n.clause(void 0))}),e.addEventListener("pointerenter",m=>{if(!m.buttons){let g=this.channels.map(()=>0);i.activate(this.clause(g))}}))}};function JJ(t,e){let{data:{columns:n}}=e,r=p=>n[e.channelField(p)?.as],o=p=>t.scale(p),i=t.scale("x"),s=t.scale("y"),a=o("fx")?.apply,c=o("fy")?.apply,f=Array.from(r("x"),i.apply),u=Array.from(r("y"),s.apply);if(a){let p=Ct(i.range),l=r("fx");for(let d=0;d<l.length;++d)f[d]+=a(l[d])-p}if(c){let p=Ct(s.range),l=r("fy");for(let d=0;d<l.length;++d)u[d]+=c(l[d])-p}return[f,u]}function KJ(t,e,n,r,o,i,s){let a=s*s,c=-1;for(let f=0;f<t.length;++f){let u=o*(t[f]-n),p=i*(e[f]-r),l=u*u+p*p;l<=a&&(a=l,c=f)}return c}var VP=(t,e)=>t-e,fm=class{constructor(e,{x:n=new uo,y:r=new uo,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||Ho(e,"x"),this.yfield=i||Ho(e,"y"),this.zoom=MM(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",u=>{f.setAttribute("xDomain",u)&&f.update()}),c&&this.ysel.addEventListener("value",u=>{f.setAttribute("yDomain",u)&&f.update()})}publish(e){if(this.panx){let n=tK(e,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=eK(e,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(e,n,r){return Ea(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(VP),c=this.yscale.range.slice().sort(VP),f=MM(n,[-1/0,1/0],a),u=MM(r,[-1/0,1/0],c),p=fS().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[f[0],u[0]],[f[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>o.__zoom=new ar(1,0,0)).on("zoom",({transform:l})=>this.publish(l));if(Nt(o).call(p),n||r){let l=!1;o.addEventListener("pointerenter",d=>{if(!l&&(l=!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",()=>l=!1)}}};function MM(t,e,n){return t?Array.isArray(t)?t:e:n}function tK(t,e){return e.range.map(t.invertX,t).map(e.invert,e)}function eK(t,e){return e.range.map(t.invertY,t).map(e.invert,e)}var nK={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},rK=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,oK=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,iK=/^((\s+,?\s*)|(,\s*))/,sK=/^[01]/,GP=t=>`Invalid SVG path, incorrect parameter ${t}`;function HP(t){let e=[];return(t.match(rK)||[]).forEach(r=>{let o=r[0],i=o.toLowerCase(),s=nK[i],a=aK(i,s,r.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(GP("count"));if(e.push([o,...a.slice(0,s)]),c!==s){i==="m"&&(o=o==="M"?"L":"l");for(let f=s;f<c;f+=s)e.push([o,...a.slice(f,f+s)])}}),e}function aK(t,e,n){let r=[];for(let o=0;e&&o<n.length;)for(let i=0;i<e;++i){let s=t==="a"&&(i===3||i===4)?sK:oK,a=n.slice(o).match(s);if(a===null)throw new Error(GP("type"));o+=a[0].length,r.push(+a[0]);let c=n.slice(o).match(iK);c!==null&&(o+=c[0].length)}return r}function tF(t,e,n){let{x:r,y:o}=t.getBoundingClientRect(),i=t.createSVGMatrix(),s=[];for(let a of e.children)if(a.tagName==="g"){let c=eF(a)??i;for(let f of a.children)QP(n,r,o,f,c)&&s.push(f)}else QP(n,r,o,a,i)&&s.push(a);return s}function QP(t,e,n,r,o){let[[i,s],[a,c]]=t,{e:f,f:u}=o,p=r.getBoundingClientRect(),l=p.left-e,d=p.right-e,h=p.top-n,m=p.bottom-n;if(l>=i&&d<=a&&h>=s&&m<=c)return!0;if(l<=a&&d>=i&&h<=c&&m>=s){let g=r.tagName;if(g==="a"&&(r=r.children[0],g=r.tagName),g==="rect"||g==="text"||g==="image")return!0;switch(i-=f,s-=u,a-=f,c-=u,g){case"circle":return nF(i,s,a,c,Ic(r.cx),Ic(r.cy),Ic(r.r));case"line":return rF(i,s,a,c,Ic(r.x1),Ic(r.y1),Ic(r.x2),Ic(r.y2));case"path":return cK(i,s,a,c,r)}}return!1}function Ic(t){return t.baseVal.value}function eF(t){let e=t.transform.baseVal,n=e.length,r=e[0]?.matrix;for(let o=1;o<n;++o)r=r.multiply(e[o].matrix);return r}function nF(t,e,n,r,o,i,s){let a=t<=o&&o<=n,c=e<=i&&i<=r;if(a&&c)return!0;let f=Math.min(Math.abs(t-o),Math.abs(n-o));if(c&&f<=s)return!0;let u=Math.min(Math.abs(e-i),Math.abs(r-i));return a&&u<=s||f*f+u*u<=s*s}function rF(t,e,n,r,o,i,s,a){let c=Math.max(Math.min(o,s),t),f=Math.min(Math.max(o,s),n);if(c>f)return!1;let u=i,p=a,l=s-o;if(Math.abs(l)>1e-8){let m=(a-i)/l,g=i-m*o;u=m*c+g,p=m*f+g}let d=Math.max(Math.min(u,p),e),h=Math.min(Math.max(u,p),r);return d<=h}function cK(t,e,n,r,o){let i=o.__path__||(o.__path__=HP(o.getAttribute("d"))),s=0,a=0,c=0,f=0,u=!1,p=[0,0],l=2,d=eF(o),h=(y,b)=>{p.length=l=2,p[0]=c=s=y,p[1]=f=a=b},m=d?(y,b)=>h(ZP(d,y,b),JP(d,y,b)):(y,b)=>h(y,b),g=(y,b)=>(p[l]=y,p[l+1]=b,l+=2,rF(t,e,n,r,p[l-4],p[l-3],y,b)),x=d?(y,b)=>{u=g(ZP(d,c=y,f=b),JP(d,y,b))}:(y,b)=>{u=g(c=y,f=b)};for(let y=0;y<i.length;++y){let b=i[y];switch(b[0]){case"M":m(b[1],b[2]);break;case"m":m(c+b[1],f+b[2]);break;case"L":case"T":x(b[1],b[2]);break;case"H":x(b[1],f);break;case"V":x(c,b[1]);break;case"l":case"t":x(c+b[1],f+b[2]);break;case"h":x(c+b[1],f);break;case"v":x(c,f+b[1]);break;case"C":x(b[5],b[6]);break;case"c":x(c+b[5],f+b[6]);break;case"S":case"Q":x(b[3],b[4]);break;case"s":case"q":x(c+b[3],f+b[4]);break;case"A":x(b[6],b[7]);break;case"a":if(fK(i,y))return nF(t,e,n,r,c,f-b[2],b[2]);x(c+b[6],c+b[7]);break;case"z":case"Z":if(x(s,a),uK(t,e,p)>0)return!0;m(s,a);break;default:return console.warn("SVG path command not supported: ",b[0]),!1}if(u)return!0}return!1}function ZP(t,e,n){return t.a*e+t.c*n+t.e}function JP(t,e,n){return t.b*e+t.d*n+t.f}function fK(t,e){let n=t[e],r=t[e+1];return r&&r[0]==="a"&&t[e+2]?.[0]==="z"&&n[1]===n[2]&&r[1]===r[2]&&n[1]===r[1]&&n[7]===-r[7]}function uK(t,e,n){let r=0,o=n.length-2;for(let i=0;i<o;i+=2)n[i+1]<=e?n[i+3]>e&&KP(t,e,n,i)>0&&++r:n[i+3]<=e&&KP(t,e,n[i])<0&&--r;return r}function KP(t,e,n,r){return(n[r+2]-n[r])*(e-n[r+1])-(t-n[r])*(n[r+3]-n[r+1])}function m2(t,e){return t==null||e==null?t!=null||e!=null:t.length!==e.length||t.some((n,r)=>g2(n,e[r]))}function g2(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 um=class{constructor(e,{channels:n,selection:r,peers:o=!0,brush:i={fill:"none",stroke:"currentColor",strokeDasharray:"1,1"}}){this.mark=e,this.selection=r,this.peers=o,this.style=i&&ea(i),this.brush=d2(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=WP(e,n);this.fields=s,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(e){let{fields:n,mark:r}=this;return ai(n,e,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}publish(e){let{as:n,group:r,mark:o,svg:i}=this,s;if(e){let{data:{columns:a={}}={}}=o,c=new Map;tF(i,r,e).forEach(f=>{let u=Gu(f),p=n.map(l=>a[l][u]);c.set(p.join("|"),p)}),s=Array.from(c.values())}this.extent=e,m2(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(e){let{brush:n,extent:r,mark:o,style:i}=this;this.svg=e;let s=e.width.baseVal.value,a=e.height.baseVal.value;if(n.extent([[0,0],[s,a]]),this.group=e.querySelector(`[data-index="${o.index}"]`),this.g=Nt(e).append("g").attr("class","region-xy").each(p2).call(n).call(n.moveSilent,r),i){let c=this.g.selectAll("rect.selection");for(let f in i)c.attr(f,i[f])}e.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}};var Cc=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 u=e.channelField(c[f],{exact:!0});if(u){i.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(e){let{fields:n,mark:r}=this;return ai(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(u=>a[u][Gu(f)]),n??=`[data-index="${o.index}"]`;let c=Array.from(e.querySelectorAll(n));e.addEventListener("pointerdown",f=>{let u=s.single?s.value:this.value,p=f.target,l=null;if(lK(c,p)){let d=r(p);(f.shiftKey||f.metaKey)&&u?.length?(l=u.filter(h=>g2(h,d)),l.length===u.length&&l.push(d)):u?.length===1&&!g2(u[0],d)?l=null:l=[d]}this.value=l,m2(u,l)&&s.update(this.clause(l))}),e.addEventListener("pointerenter",f=>{f.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function lK(t,e){return t.some(n=>n.contains(e))}var iF=":scope > div, :scope > span",x2="swatch",oF="ramp",Hu=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=pK(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(iF);for(let c of a){let f=s?s.has(c.__data__):!0;c.style.opacity=f?1:.2}}};function pK(t,e){let{channel:n,plot:r,selection:o}=t,i=e.scale(n),s=i.type==="ordinal"?x2:oF,a={label:r.getAttribute(`${n}Label`)??null,...t.options},c=s===x2?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},f=e.legend(n,c);t.legend=f;let u=!!o;if(u&&s===oF){let p=c.width??240,l=gK(i,p);l?f.scale=function(d){return d==="x"?{range:[0,p]}:d==="y"?{range:[-10,0]}:d===n?l:void 0}:u=!1}if(u){let p=dK(t,s);s===x2?(p.init(f,iF,l=>[l.__data__]),t.update()):p.init(f,f.querySelector("g:last-of-type"))}return f}function dK(t,e){let{channel:n,handler:r,selection:o}=t;if(r)return r;let i=hK(t);return e===x2?(t.handler=new Cc(i,{selection:o,channels:[n],peers:!1}),o.addEventListener("value",()=>t.update())):t.handler=new na(i,{selection:o,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),t.handler}function hK(t){let{channel:e,plot:n}=t,r=t.field??mK(n.marks,e)??"value";if(r){let o={field:r};return{plot:n,channelField:i=>e===i?o:void 0}}}function mK(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 gK(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 Os({x:{...i,type:a,range:[0,e]}})}function y2(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 sF(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||y2(a,o||25,i,c);let f=Math.log(r),u=f>=0?0:~~(-f/c)+1,p=Math.pow(10,-u-1);f=Math.floor(t/r+p)*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 uF="year",aF="month",cF="day",b2="hour",w2="minute",v2="second",xK="millisecond",pm=1e3,dm=pm*60,hm=dm*60,_2=hm*24,yK=_2*7,fF=_2*30,lF=_2*365,lm=[[v2,1,pm],[v2,5,5*pm],[v2,15,15*pm],[v2,30,30*pm],[w2,1,dm],[w2,5,5*dm],[w2,15,15*dm],[w2,30,30*dm],[b2,1,hm],[b2,3,3*hm],[b2,6,6*hm],[b2,12,12*hm],[cF,1,_2],[cF,7,yK],[aF,1,fF],[aF,3,3*fF],[uF,1,lF]];function pF(t,e,n){let r=e-t,o=r/n,i=Xr(s=>s[2]).right(lm,o);return i===lm.length?{interval:uF,step:y2(r/lF,n)}:i?(i=lm[o/lm[i-1][2]<lm[i][2]/o?i-1:i],{interval:i[0],step:i[1]}):{interval:xK,step:y2(r,n,1)}}var bK=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function wK(t,e){return bK.has(`${t.type}-${e}`)}function TM(t,e={}){let n=(r,o)=>wK(r,o)?{[`${o}1`]:AM(r,o,t,e),[`${o}2`]:AM(r,o,t,{...e,offset:1})}:{[o]:AM(r,o,t,e)};return n[op]=!0,n}function AM(t,e,n,r){return new EM(n,t,e,r)}function vK(t,e){let n=t.plot.getAttribute(`${e}Scale`);return n==="utc"||n==="time"}var EM=class extends vt{constructor(e,n,r,o){super("COLUMN_REF"),this.column=e,this.mark=n,this.channel=r,this.options=o}get stats(){return{column:this.column,stats:["min","max"]}}toString(){let{mark:e,channel:n,column:r,options:o}=this,{type:i,min:s,max:a}=e.channelField(n),{interval:c,steps:f,offset:u=0}=o,p=c??(i==="date"||vK(e,n)?"date":"number"),l;if(p==="number"){let{apply:d,sqlApply:h,sqlInvert:m}=Ec(e,n),g=sF(d(s),d(a),o),x=h(r),y=de((g.max-g.min)/g.steps),b=Ue(Pt(g.min===0?x:dt(x,g.min),y)),w=Rt(g.min,mt(y,u?Rt(u,b):b));l=m(w)}else{let{interval:d,step:h=1}=p==="date"?pF(s,a,f||40):o,m=fv(r,d,h);l=u?Rt(m,Z0(d,u*h)):m}return`${l}`}};var _K=t=>t&&typeof t=="object"&&!Array.isArray(t);var mm=class extends zn{constructor({element:e,filterBy:n,as:r,from:o,column:i,label:s=i,format:a=p=>p,options:c,value:f,field:u=i}={}){super(n),this.from=o,this.column=i,this.format=a,this.field=u;let p=this.selection=r;this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let l=document.createElement("label");if(l.innerText=s||i,this.element.appendChild(l),this.select=document.createElement("select"),this.element.appendChild(this.select),c&&(this.data=c.map(d=>_K(d)?d:{value:d}),this.selectedValue(f===void 0?"":f),this.update()),p){let d=!er(p);f!=null&&(!d||p.value===void 0)&&this.publish(f),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),d?this.selection.addEventListener("value",h=>{h!==this.select.value&&this.selectedValue(h)}):(this.select.addEventListener("pointerenter",h=>{h.buttons||this.activate()}),this.select.addEventListener("focus",()=>this.activate()))}}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}activate(){this.selection.activate(is(this.field,0,{source:this}))}publish(e){let{selection:n,field:r}=this;if(er(n)){e===""&&(e=void 0);let o=is(r,e,{source:this});n.update(o)}else _e(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?st.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=er(o)?o.valueFor(this):o.value;this.selectedValue(i===void 0?"":i)}return this}};var SK=0;var gm=class extends zn{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_"+ ++SK,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)}),er(this.selection)?(this.searchbox.addEventListener("pointerenter",f=>{f.buttons||this.activate()}),this.searchbox.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",f=>{f!==this.searchbox.value&&(this.searchbox.value=f)}))}reset(){this.searchbox.value=""}clause(e){let{field:n,type:r}=this;return s_(n,e,{source:this,method:r})}activate(){this.selection.activate(this.clause(""))}publish(e){let{selection:n}=this;er(n)?n.update(this.clause(e)):_e(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?st.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 MK=0;var xm=class extends zn{constructor({element:e,filterBy:n,as:r,min:o,max:i,step:s,from:a,column:c,label:f=c,value:u=r?.value,select:p="point",field:l=c,width:d}={}){if(super(n),this.id="slider_"+ ++MK,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=p,this.field=l,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),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:h}=this.slider;this.curval.innerText=h,this.selection&&this.publish(+h)}),this.selection&&(er(this.selection)?(this.slider.addEventListener("pointerenter",h=>{h.buttons||this.activate()}),this.slider.addEventListener("focus",()=>this.activate())):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:st.select({min:Xn(r),max:en(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}clause(e){let{field:n,selectionType:r}=this;if(r==="interval"){let o=[this.min??0,e];return Ea(n,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step})}else return is(n,e,{source:this})}activate(){this.selection.activate(this.clause(0))}publish(e){let{selection:n}=this;er(n)?n.update(this.clause(e)):_e(this.selection)&&n.update(e)}};var CM=dF(t=>{let e=S2(t);return n=>n==null?"":typeof n=="number"?e(n):n instanceof Date?NM(n):`${n}`}),S2=dF(t=>e=>e===0?"0":e.toLocaleString(t)),AUt=CM(),EUt=S2();function NM(t){return tu(t,"Invalid Date")}function dF(t){let e=null,n;return(r="en")=>r===e?n:n=t(e=r)}var AK=-1;var ym=class extends zn{constructor({element:e,filterBy:n,from:r,columns:o=["*"],align:i={},format:s,width:a,maxWidth:c,height:f=500,rowBatch:u=100,as:p}={}){super(n),this.id=`table-${++AK}`,this.from=r,this.columns=o,this.format=s,this.align=i,this.widths=typeof a=="object"?a:{},_e(r)&&r.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.pending=!1,this.selection=p,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 l=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:m}=this,{scrollHeight:g,scrollTop:x,clientHeight:y}=d.target,b=x<l;l=x,!(b||h||m)&&g-x<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",d=>{let h=EK(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)}sourceTable(){return _e(this.from)?this.from.value:this.from}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 ai(i,s,{source:this})}requestData(e=0){this.offset=e;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Sr().prefetch(n.clone().offset(e+this.limit))}fields(){let e=this.sourceTable();return this.columns.map(n=>({column:n,table: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=TK(this.format,e),this.style.innerText=NK(this.id,IK(this.align,e),CK(this.widths,e)),this}query(e=[]){let{limit:n,offset:r,schema:o,sortColumn:i,sortDesc:s}=this;return st.from(this.sourceTable()).select(o.map(a=>a.column)).where(e).orderby(i?s?_v(i):i:[]).limit(n).offset(r)}queryResult(e){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Vn(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:u}=r[a],p=o.map(l=>u[l.column]);for(let l=0;l<f;++l){let d=document.createElement("tr");Object.assign(d,{__row__:c+l});for(let h=0;h<s;++h){let m=p[h][l],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 EK(t){let e=t.parentElement;return Object.hasOwn(e,"__row__")?+e.__row__:-1}function TK(t={},e,n){return e.map(({column:r,type:o})=>{if(r in t)return t[r];switch(o){case"number":return S2(n);case"date":return NM;default:return CM(n)}})}function IK(t={},e){return e.map(({column:n,type:r})=>n in t?t[n]:r==="number"?"right":"left")}function CK(t={},e){return e.map(({column:n})=>t[n])}function NK(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 bm(t,...e){let n=t?.context?.coordinator??Sr();for(let r of e)n.connect(r)}function M2(t,e,n){let r=new e(n);return bm(t,r),r.element}function hF(t){return M2(this,mm,t)}function mF(t){return M2(this,gm,t)}function gF(t){return M2(this,xm,t)}function xF(t){return M2(this,ym,t)}function yF({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 bF(...t){return yF({direction:"vertical"},t.flat())}function wF(...t){return yF({direction:"horizontal"},t.flat())}function vF({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 _F(t){return vF({dim:"height",size:t})}function SF(t){return vF({dim:"width",size:t})}var A2={};Pc(A2,{align:()=>XM,ariaDescription:()=>KM,ariaLabel:()=>JM,aspectRatio:()=>WM,axis:()=>VM,clip:()=>QM,colorBase:()=>D8,colorClamp:()=>M8,colorConstant:()=>F8,colorDomain:()=>_8,colorExponent:()=>P8,colorInterpolate:()=>I8,colorLabel:()=>k8,colorN:()=>A8,colorNice:()=>E8,colorPercent:()=>L8,colorPivot:()=>C8,colorRange:()=>S8,colorReverse:()=>R8,colorScale:()=>v8,colorScheme:()=>T8,colorSymmetric:()=>N8,colorTickFormat:()=>$8,colorZero:()=>O8,facetGrid:()=>vA,facetLabel:()=>_A,facetMargin:()=>gA,facetMarginBottom:()=>yA,facetMarginLeft:()=>bA,facetMarginRight:()=>wA,facetMarginTop:()=>xA,fxAlign:()=>CA,fxAriaDescription:()=>VA,fxAriaLabel:()=>WA,fxAxis:()=>RA,fxDomain:()=>SA,fxFontVariant:()=>XA,fxGrid:()=>BA,fxInset:()=>AA,fxInsetLeft:()=>EA,fxInsetRight:()=>TA,fxLabel:()=>YA,fxLabelAnchor:()=>UA,fxLabelOffset:()=>jA,fxLine:()=>zA,fxPadding:()=>NA,fxPaddingInner:()=>kA,fxPaddingOuter:()=>LA,fxRange:()=>MA,fxReverse:()=>GA,fxRound:()=>IA,fxTickFormat:()=>FA,fxTickPadding:()=>PA,fxTickRotate:()=>qA,fxTickSize:()=>$A,fxTickSpacing:()=>DA,fxTicks:()=>OA,fyAlign:()=>e8,fyAriaDescription:()=>b8,fyAriaLabel:()=>y8,fyAxis:()=>i8,fyDomain:()=>HA,fyFontVariant:()=>x8,fyGrid:()=>p8,fyInset:()=>ZA,fyInsetBottom:()=>KA,fyInsetTop:()=>JA,fyLabel:()=>h8,fyLabelAnchor:()=>m8,fyLabelOffset:()=>g8,fyLine:()=>d8,fyPadding:()=>n8,fyPaddingInner:()=>r8,fyPaddingOuter:()=>o8,fyRange:()=>QA,fyReverse:()=>w8,fyRound:()=>t8,fyTickFormat:()=>u8,fyTickPadding:()=>f8,fyTickRotate:()=>l8,fyTickSize:()=>a8,fyTickSpacing:()=>c8,fyTicks:()=>s8,grid:()=>HM,height:()=>BM,inset:()=>GM,lengthBase:()=>bE,lengthClamp:()=>mE,lengthConstant:()=>vE,lengthDomain:()=>dE,lengthExponent:()=>wE,lengthNice:()=>gE,lengthPercent:()=>xE,lengthRange:()=>hE,lengthScale:()=>pE,lengthZero:()=>yE,margin:()=>DM,marginBottom:()=>jM,marginLeft:()=>zM,marginRight:()=>YM,marginTop:()=>UM,margins:()=>$M,name:()=>RM,opacityBase:()=>H8,opacityClamp:()=>Y8,opacityConstant:()=>Z8,opacityDomain:()=>B8,opacityExponent:()=>Q8,opacityLabel:()=>j8,opacityNice:()=>U8,opacityPercent:()=>X8,opacityRange:()=>z8,opacityReverse:()=>W8,opacityScale:()=>q8,opacityTickFormat:()=>G8,opacityZero:()=>V8,padding:()=>ZM,projectionClip:()=>LE,projectionDomain:()=>EE,projectionInset:()=>TE,projectionInsetBottom:()=>kE,projectionInsetLeft:()=>IE,projectionInsetRight:()=>CE,projectionInsetTop:()=>NE,projectionParallels:()=>SE,projectionPrecision:()=>ME,projectionRotate:()=>AE,projectionType:()=>_E,rBase:()=>fE,rClamp:()=>oE,rConstant:()=>lE,rDomain:()=>nE,rExponent:()=>uE,rLabel:()=>sE,rNice:()=>iE,rPercent:()=>aE,rRange:()=>rE,rScale:()=>eE,rZero:()=>cE,style:()=>FM,symbolDomain:()=>K8,symbolRange:()=>tE,symbolScale:()=>J8,width:()=>qM,xAlign:()=>f5,xAriaDescription:()=>I5,xAriaLabel:()=>T5,xAxis:()=>d5,xBase:()=>L5,xClamp:()=>a5,xConstant:()=>O5,xDomain:()=>e5,xExponent:()=>R5,xFontVariant:()=>E5,xGrid:()=>w5,xInset:()=>o5,xInsetLeft:()=>i5,xInsetRight:()=>s5,xLabel:()=>_5,xLabelAnchor:()=>S5,xLabelArrow:()=>M5,xLabelOffset:()=>A5,xLine:()=>v5,xNice:()=>r5,xPadding:()=>u5,xPaddingInner:()=>l5,xPaddingOuter:()=>p5,xPercent:()=>C5,xRange:()=>n5,xReverse:()=>N5,xRound:()=>c5,xScale:()=>t5,xTickFormat:()=>y5,xTickPadding:()=>x5,xTickRotate:()=>b5,xTickSize:()=>m5,xTickSpacing:()=>g5,xTicks:()=>h5,xZero:()=>k5,xyDomain:()=>PM,yAlign:()=>j5,yAriaDescription:()=>fA,yAriaLabel:()=>cA,yAxis:()=>G5,yBase:()=>dA,yClamp:()=>Y5,yConstant:()=>mA,yDomain:()=>D5,yExponent:()=>hA,yFontVariant:()=>aA,yGrid:()=>eA,yInset:()=>q5,yInsetBottom:()=>z5,yInsetTop:()=>B5,yLabel:()=>rA,yLabelAnchor:()=>oA,yLabelArrow:()=>iA,yLabelOffset:()=>sA,yLine:()=>nA,yNice:()=>F5,yPadding:()=>X5,yPaddingInner:()=>W5,yPaddingOuter:()=>V5,yPercent:()=>uA,yRange:()=>P5,yReverse:()=>lA,yRound:()=>U5,yScale:()=>$5,yTickFormat:()=>K5,yTickPadding:()=>J5,yTickRotate:()=>tA,yTickSize:()=>Q5,yTickSpacing:()=>Z5,yTicks:()=>H5,yZero:()=>pA});var wm=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()}},kM=new wm;function LM(t,e,n){(t?.context?.namedPlots??kM).request(e,n)}function MF(t,e,n){(t?.context?.namedPlots??kM).set(e,n)}function RM(t){return e=>MF(this,t,e)}function AF(t,e,n){_e(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 kK(t,e){return n=>{AF(n,t,e)}}function OM(t){return e=>{for(let[n,r]of Object.entries(t))AF(e,n,r)}}function $M(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),OM(i)}function DM(t){return OM({marginTop:t,marginBottom:t,marginLeft:t,marginRight:t})}function PM(t){return OM({xDomain:t,yDomain:t})}var R=t=>e=>kK(t,e),FM=R("style"),qM=R("width"),BM=R("height"),zM=R("marginLeft"),YM=R("marginRight"),UM=R("marginTop"),jM=R("marginBottom"),XM=R("align"),WM=R("aspectRatio"),VM=R("axis"),GM=R("inset"),HM=R("grid"),QM=R("clip"),ZM=R("padding"),JM=R("ariaLabel"),KM=R("ariaDescription"),t5=R("xScale"),e5=R("xDomain"),n5=R("xRange"),r5=R("xNice"),o5=R("xInset"),i5=R("xInsetLeft"),s5=R("xInsetRight"),a5=R("xClamp"),c5=R("xRound"),f5=R("xAlign"),u5=R("xPadding"),l5=R("xPaddingInner"),p5=R("xPaddingOuter"),d5=R("xAxis"),h5=R("xTicks"),m5=R("xTickSize"),g5=R("xTickSpacing"),x5=R("xTickPadding"),y5=R("xTickFormat"),b5=R("xTickRotate"),w5=R("xGrid"),v5=R("xLine"),_5=R("xLabel"),S5=R("xLabelAnchor"),M5=R("xLabelArrow"),A5=R("xLabelOffset"),E5=R("xFontVariant"),T5=R("xAriaLabel"),I5=R("xAriaDescription"),C5=R("xPercent"),N5=R("xReverse"),k5=R("xZero"),L5=R("xBase"),R5=R("xExponent"),O5=R("xConstant"),$5=R("yScale"),D5=R("yDomain"),P5=R("yRange"),F5=R("yNice"),q5=R("yInset"),B5=R("yInsetTop"),z5=R("yInsetBottom"),Y5=R("yClamp"),U5=R("yRound"),j5=R("yAlign"),X5=R("yPadding"),W5=R("yPaddingInner"),V5=R("yPaddingOuter"),G5=R("yAxis"),H5=R("yTicks"),Q5=R("yTickSize"),Z5=R("yTickSpacing"),J5=R("yTickPadding"),K5=R("yTickFormat"),tA=R("yTickRotate"),eA=R("yGrid"),nA=R("yLine"),rA=R("yLabel"),oA=R("yLabelAnchor"),iA=R("yLabelArrow"),sA=R("yLabelOffset"),aA=R("yFontVariant"),cA=R("yAriaLabel"),fA=R("yAriaDescription"),uA=R("yPercent"),lA=R("yReverse"),pA=R("yZero"),dA=R("yBase"),hA=R("yExponent"),mA=R("yConstant"),gA=R("facetMargin"),xA=R("facetMarginTop"),yA=R("facetMarginBottom"),bA=R("facetMarginLeft"),wA=R("facetMarginRight"),vA=R("facetGrid"),_A=R("facetLabel"),SA=R("fxDomain"),MA=R("fxRange"),AA=R("fxInset"),EA=R("fxInsetLeft"),TA=R("fxInsetRight"),IA=R("fxRound"),CA=R("fxAlign"),NA=R("fxPadding"),kA=R("fxPaddingInner"),LA=R("fxPaddingOuter"),RA=R("fxAxis"),OA=R("fxTicks"),$A=R("fxTickSize"),DA=R("fxTickSpacing"),PA=R("fxTickPadding"),FA=R("fxTickFormat"),qA=R("fxTickRotate"),BA=R("fxGrid"),zA=R("fxLine"),YA=R("fxLabel"),UA=R("fxLabelAnchor"),jA=R("fxLabelOffset"),XA=R("fxFontVariant"),WA=R("fxAriaLabel"),VA=R("fxAriaDescription"),GA=R("fxReverse"),HA=R("fyDomain"),QA=R("fyRange"),ZA=R("fyInset"),JA=R("fyInsetTop"),KA=R("fyInsetBottom"),t8=R("fyRound"),e8=R("fyAlign"),n8=R("fyPadding"),r8=R("fyPaddingInner"),o8=R("fyPaddingOuter"),i8=R("fyAxis"),s8=R("fyTicks"),a8=R("fyTickSize"),c8=R("fyTickSpacing"),f8=R("fyTickPadding"),u8=R("fyTickFormat"),l8=R("fyTickRotate"),p8=R("fyGrid"),d8=R("fyLine"),h8=R("fyLabel"),m8=R("fyLabelAnchor"),g8=R("fyLabelOffset"),x8=R("fyFontVariant"),y8=R("fyAriaLabel"),b8=R("fyAriaDescription"),w8=R("fyReverse"),v8=R("colorScale"),_8=R("colorDomain"),S8=R("colorRange"),M8=R("colorClamp"),A8=R("colorN"),E8=R("colorNice"),T8=R("colorScheme"),I8=R("colorInterpolate"),C8=R("colorPivot"),N8=R("colorSymmetric"),k8=R("colorLabel"),L8=R("colorPercent"),R8=R("colorReverse"),O8=R("colorZero"),$8=R("colorTickFormat"),D8=R("colorBase"),P8=R("colorExponent"),F8=R("colorConstant"),q8=R("opacityScale"),B8=R("opacityDomain"),z8=R("opacityRange"),Y8=R("opacityClamp"),U8=R("opacityNice"),j8=R("opacityLabel"),X8=R("opacityPercent"),W8=R("opacityReverse"),V8=R("opacityZero"),G8=R("opacityTickFormat"),H8=R("opacityBase"),Q8=R("opacityExponent"),Z8=R("opacityConstant"),J8=R("symbolScale"),K8=R("symbolDomain"),tE=R("symbolRange"),eE=R("rScale"),nE=R("rDomain"),rE=R("rRange"),oE=R("rClamp"),iE=R("rNice"),sE=R("rLabel"),aE=R("rPercent"),cE=R("rZero"),fE=R("rBase"),uE=R("rExponent"),lE=R("rConstant"),pE=R("lengthScale"),dE=R("lengthDomain"),hE=R("lengthRange"),mE=R("lengthClamp"),gE=R("lengthNice"),xE=R("lengthPercent"),yE=R("lengthZero"),bE=R("lengthBase"),wE=R("lengthExponent"),vE=R("lengthConstant"),_E=R("projectionType"),SE=R("projectionParallels"),ME=R("projectionPrecision"),AE=R("projectionRotate"),EE=R("projectionDomain"),TE=R("projectionInset"),IE=R("projectionInsetLeft"),CE=R("projectionInsetRight"),NE=R("projectionInsetTop"),kE=R("projectionInsetBottom"),LE=R("projectionClip");function EF(t,e){return{table:t,options:e}}var T2={};Pc(T2,{area:()=>RE,areaX:()=>OE,areaY:()=>$E,arrow:()=>IT,axisFx:()=>RT,axisFy:()=>OT,axisX:()=>kT,axisY:()=>LT,barX:()=>qE,barY:()=>BE,cell:()=>zE,cellX:()=>YE,cellY:()=>UE,circle:()=>QE,contour:()=>hT,delaunayLink:()=>AT,delaunayMesh:()=>ET,denseLine:()=>dT,density:()=>pT,densityX:()=>uT,densityY:()=>lT,dot:()=>VE,dotX:()=>GE,dotY:()=>HE,errorbarX:()=>vT,errorbarY:()=>_T,frame:()=>NT,geo:()=>qT,graticule:()=>zT,gridFx:()=>PT,gridFy:()=>FT,gridX:()=>$T,gridY:()=>DT,heatmap:()=>mT,hexagon:()=>ZE,hexbin:()=>yT,hexgrid:()=>bT,hull:()=>TT,image:()=>fT,line:()=>DE,lineX:()=>PE,lineY:()=>FE,link:()=>CT,raster:()=>gT,rasterTile:()=>xT,rect:()=>jE,rectX:()=>XE,rectY:()=>WE,regressionY:()=>wT,ruleX:()=>eT,ruleY:()=>nT,sphere:()=>BT,spike:()=>cT,text:()=>JE,textX:()=>KE,textY:()=>tT,tickX:()=>rT,tickY:()=>oT,vector:()=>iT,vectorX:()=>sT,vectorY:()=>aT,voronoi:()=>ST,voronoiMesh:()=>MT,waffleX:()=>YT,waffleY:()=>UT});var LK=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function pt(t,e,n={}){arguments.length===2&&!Array.isArray(e)&&(n=e,e=LK.has(t)?null:[{}]);let r=t.startsWith("area")||t.startsWith("line")?Vh:De;return E2(r,t,e,n)}function E2(t,e,n,r){return o=>{o.addMark(new t(e,n,r))}}function Qo(t,e,n){return r=>{r.addMark(new t(e,n))}}var RE=(...t)=>pt("area",...t),OE=(...t)=>pt("areaX",...t),$E=(...t)=>pt("areaY",...t),DE=(...t)=>pt("line",...t),PE=(...t)=>pt("lineX",...t),FE=(...t)=>pt("lineY",...t),qE=(...t)=>pt("barX",...t),BE=(...t)=>pt("barY",...t),zE=(...t)=>pt("cell",...t),YE=(...t)=>pt("cellX",...t),UE=(...t)=>pt("cellY",...t),jE=(...t)=>pt("rect",...t),XE=(...t)=>pt("rectX",...t),WE=(...t)=>pt("rectY",...t),VE=(...t)=>pt("dot",...t),GE=(...t)=>pt("dotX",...t),HE=(...t)=>pt("dotY",...t),QE=(...t)=>pt("circle",...t),ZE=(...t)=>pt("hexagon",...t),JE=(...t)=>pt("text",...t),KE=(...t)=>pt("textX",...t),tT=(...t)=>pt("textY",...t),eT=(...t)=>pt("ruleX",...t),nT=(...t)=>pt("ruleY",...t),rT=(...t)=>pt("tickX",...t),oT=(...t)=>pt("tickY",...t),iT=(...t)=>pt("vector",...t),sT=(...t)=>pt("vectoX",...t),aT=(...t)=>pt("vectorY",...t),cT=(...t)=>pt("spike",...t),fT=(...t)=>pt("image",...t),uT=(...t)=>E2(Xu,"areaX",...t),lT=(...t)=>E2(Xu,"areaY",...t),pT=(...t)=>Qo(tm,...t),dT=(...t)=>Qo(Kh,...t),hT=(...t)=>Qo(Qh,...t),mT=(...t)=>Qo(Jh,...t),gT=(...t)=>Qo(ta,...t),xT=(...t)=>Qo(rm,...t),yT=(...t)=>Qo(nm,...t),bT=(...t)=>pt("hexgrid",...t),wT=(...t)=>Qo(om,...t),vT=(...t)=>E2(Vu,"ruleY",...t),_T=(...t)=>Qo(Vu,"ruleX",...t),ST=(...t)=>pt("voronoi",...t),MT=(...t)=>pt("voronoiMesh",...t),AT=(...t)=>pt("delaunayLink",...t),ET=(...t)=>pt("delaunayMesh",...t),TT=(...t)=>pt("hull",...t),IT=(...t)=>pt("arrow",...t),CT=(...t)=>pt("link",...t),NT=(...t)=>pt("frame",...t),kT=(...t)=>pt("axisX",...t),LT=(...t)=>pt("axisY",...t),RT=(...t)=>pt("axisFx",...t),OT=(...t)=>pt("axisFy",...t),$T=(...t)=>pt("gridX",...t),DT=(...t)=>pt("gridY",...t),PT=(...t)=>pt("gridFx",...t),FT=(...t)=>pt("gridFy",...t),qT=(...t)=>Qo(em,...t),BT=(...t)=>pt("sphere",...t),zT=(...t)=>pt("graticule",...t),YT=(...t)=>pt("waffleX",...t),UT=(...t)=>pt("waffleY",...t);var I2={};Pc(I2,{highlight:()=>jT,intervalX:()=>XT,intervalXY:()=>VT,intervalY:()=>WT,nearest:()=>GT,nearestX:()=>HT,nearestY:()=>QT,pan:()=>n7,panX:()=>r7,panY:()=>o7,panZoom:()=>i7,panZoomX:()=>s7,panZoomY:()=>a7,region:()=>ZT,toggle:()=>Nc,toggleColor:()=>e7,toggleX:()=>JT,toggleY:()=>KT,toggleZ:()=>t7});function Zo(t,e){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new t(r,e))}}function jT({by:t,...e}){return Zo(im,{selection:t,channels:e})}function XT({as:t,...e}){return Zo(na,{...e,selection:t,channel:"x"})}function WT({as:t,...e}){return Zo(na,{...e,selection:t,channel:"y"})}function VT({as:t,...e}){return Zo(cm,{...e,selection:t})}function GT({as:t,...e}){return Zo(Tc,{...e,selection:t,pointer:"xy"})}function HT({as:t,...e}){return Zo(Tc,{...e,selection:t,pointer:"x"})}function QT({as:t,...e}){return Zo(Tc,{...e,selection:t,pointer:"y"})}function ZT({as:t,...e}){return Zo(um,{...e,selection:t})}function Nc({as:t,...e}){return Zo(Cc,{...e,selection:t})}function JT(t){return Nc({...t,channels:["x"]})}function KT(t){return Nc({...t,channels:["y"]})}function t7(t){return Nc({...t,channels:["z"]})}function e7(t){return Nc({...t,channels:["color"]})}function Qu(t){return Zo(fm,t)}function n7(t={}){return Qu({...t,zoom:!1})}function r7(t={}){return Qu({...t,zoom:!1,pany:!1})}function o7(t={}){return Qu({...t,zoom:!1,panx:!1})}function i7(t={}){return Qu(t)}function s7(t={}){return Qu({...t,pany:!1})}function a7(t={}){return Qu({...t,panx:!1})}var C2={};Pc(C2,{colorLegend:()=>f7,opacityLegend:()=>u7,symbolLegend:()=>l7});function c7(t,e={}){if(e.for){let{for:n,...r}=e,o=new Hu(t,r),i=typeof n,s=a=>a.addLegend(o,!1);return i==="string"?LM(this,n,s):n.value&&s(n.value),o.element}else return n=>n.addLegend(new Hu(t,e))}function f7(t){return c7.call(this,"color",t)}function u7(t){return c7.call(this,"opacity",t)}function l7(t){return c7.call(this,"symbol",t)}function TF(...t){let e=new Xh;return t.flat().forEach(n=>n(e)),bm(this,...e.marks),e.update(),e.element}function d7({coordinator:t=Sr(),namedPlots:e=new wm,extensions:n=null,...r}={}){return{...p7,...n,context:{coordinator:t,namedPlots:e,...r}}}var IF="spec",N2="literal",Tjt="dataref",CF="options",NF="selection",kF="paramref",LF="columnparamref",RF="param",OF="include",h7="select",k2="value",$F="crossfilter",L2="intersect",DF="union",PF="single",FF="data",qF="expression",kc="sql",vm="input",Zu="hconcat",Ju="vconcat",Ku="hspace",tl="vspace",R2="mark",m7="from",el="plot",_m="legend",BF="attribute",g7="transform",zF="interactor",Sm="Fixed";var xt=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 Mm=class extends xt{constructor(e,n,r,o,i,s){super(IF,[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,u]of i)c[f]=u.toJSON()}if(s?.size){let c=a.params={};for(let[f,u]of s)c[f]=u.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 Am(t){let e=typeof t;return e==="object"?t?.param:e==="string"?RK(t):null}function RK(t){return t?.[0]==="$"?t.slice(1):null}function Em(t){return`$${t}`}function nl(t){return[t].flat()}function Fr(t){return Array.isArray(t)}function rl(t){return t!==null&&typeof t=="object"&&!Fr(t)}function ra(t){return typeof t=="string"}function ol(t,e){throw Object.assign(Error(t),{data:e})}var OK=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function YF(t,e){return OK.test(t+="")?new Date(t):e}function Ke(t,e){let n={};for(let r in t)n[r]=e.maybeSelection(t[r]);return new oa(n)}var oa=class t extends xt{constructor(e){super(CF),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 XF="table",WF="parquet",VF="csv",x7="json",z2="spatial",UF=new Map([[XF,FK],[WF,qK],[VF,BK],[x7,zK],[z2,YK]]);function GF(t,e,n){let r=$K(e);if(UF.has(r.type))return UF.get(r.type)(t,r,n);n.error("Unrecognized data format type.",e)}function $K(t){return Fr(t)&&(t={type:"json",data:t}),ra(t)&&(t={type:"table",query:t}),{...t,type:DK(t)}}function DK(t){return t.type||PK(t.file)||"table"}function PK(t){let e=t?.lastIndexOf(".");return e>0?t.slice(e+1):null}function FK(t,e,n){let{query:r,type:o,...i}=e;return new $2(t,r,Ke(i,n))}function qK(t,e,n){let{file:r,type:o,...i}=e;return new P2(t,r,Ke(i,n))}function BK(t,e,n){let{file:r,type:o,...i}=e;return new F2(t,r,Ke(i,n))}function zK(t,e,n){let{data:r,file:o,type:i,...s}=e,a=Ke(s,n);return r?new B2(t,r,a):new q2(t,o,a)}function YK(t,e,n){let{file:r,type:o,...i}=e;return new D2(t,r,Ke(i,n))}function jF(t,e){return e?new URL(t,e).toString():t}function UK(t,e){let n=t?.codegen(e);return n?`, ${n}`:""}var O2=class extends xt{constructor(e,n){super(FF),this.name=e,this.format=n}},il=class extends O2{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}},$2=class extends il{constructor(e,n,r){super(e,XF),this.query=n?.trim(),this.options=r}instantiateQuery(e){let{name:n,query:r,options:o}=this;if(r)return e.api.createTable(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,query:r,options:o}=this;if(r)return`\`${co(n,r,o.instantiate(e))}\``}toJSON(){let{format:e,query:n,options:r}=this;return{type:e,query:n,...r.toJSON()}}},Lc=class extends il{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=jF(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=jF(o,e.baseURL),a=UK(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()}}},D2=class extends Lc{constructor(e,n,r){super(e,z2,"loadSpatial",n,r)}},P2=class extends Lc{constructor(e,n,r){super(e,WF,"loadParquet",n,r)}},F2=class extends Lc{constructor(e,n,r){super(e,VF,"loadCSV",n,r)}},q2=class extends Lc{constructor(e,n,r){super(e,x7,"loadJSON",n,r)}},B2=class extends il{constructor(e,n,r){super(e,x7),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=`[
61
61
  `+r.map(a=>JSON.stringify(a)).join(`,
62
62
  `)+`
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 z2(t){let e=t.config?.extensions,n=new Set(e?tl(e):[]);for(let r of Object.values(t.data))r.format===B2&&n.add("spatial");return n}async function zK(t,e){let{data:n,params:r,plotDefaults:o}=t,i=new Y2({plotDefaults:o,...e}),s=[],a=z2(t);s.push(...Array.from(a).map(c=>Jl(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 u=f.instantiate(i);i.activeParams.set(c,u)}return{element:t.root.instantiate(i),params:i.activeParams}}var Y2=class{constructor({api:e=u7(),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){nl(e,n)}};function YK(t,e={}){let{root:n,data:r,params:o,plotDefaults:i}=t,{preamble:s,...a}=e,c=new U2({plotDefaults:i,...a}),f=[];for(let[y,b]of c.imports)f.push(oa(b)?`import ${b} from "${y}";`:`import { ${b.join(", ")} } from "${y}";`);let u=s?tl(s).map(y=>`${c.tab()}${y}`):[],p=[];if(c.connector){let y=`${c.ns()}${c.connector}Connector()`;p.push(`${c.tab()}${c.ns()}coordinator().databaseConnector(${y});`)}let l=[];for(let y of z2(t))l.push(`${c.ns()}loadExtension("${y}")`);for(let y of Object.values(r)){let b=y.codegen(c);b&&l.push(b)}let d=[];l.length&&(d.push(`${c.tab()}await ${c.ns()}coordinator().exec([`),c.indent(),d.push(l.map(y=>`${c.tab()}${y}`).join(`,
64
- `)),c.undent(),d.push(`${c.tab()}]);`));let h=[];for(let[y,b]of Object.entries(o))h.push(`const ${Am(y)} = ${b.codegen(c)};`);let m=[],x=i;x.length&&(m=["const defaultAttributes = [",x.map(y=>" "+y.codegen(c)).join(`,
65
- `),"];"]);let g=[`export default ${n.codegen(c)};`];return[...f,...ol(f),...u,...ol(u),...p,...ol(p),...d,...ol(d),...h,...ol(h),...m,...ol(m),...g].join(`
66
- `)}var U2=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(Fr(e)){let n=e.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(el(e)){let n=Object.entries(e).map(([r,o])=>`${UK(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=>`
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 Y2(t){let e=t.config?.extensions,n=new Set(e?nl(e):[]);for(let r of Object.values(t.data))r.format===z2&&n.add("spatial");return n}async function jK(t,e){let{data:n,params:r,plotDefaults:o}=t,i=new U2({plotDefaults:o,...e}),s=[],a=Y2(t);s.push(...Array.from(a).map(c=>Kl(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 u=f.instantiate(i);i.activeParams.set(c,u)}return{element:t.root.instantiate(i),params:i.activeParams}}var U2=class{constructor({api:e=d7(),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){ol(e,n)}};function XK(t,e={}){let{root:n,data:r,params:o,plotDefaults:i}=t,{preamble:s,...a}=e,c=new j2({plotDefaults:i,...a}),f=[];for(let[y,b]of c.imports)f.push(ra(b)?`import ${b} from "${y}";`:`import { ${b.join(", ")} } from "${y}";`);let u=s?nl(s).map(y=>`${c.tab()}${y}`):[],p=[];if(c.connector){let y=`${c.ns()}${c.connector}Connector()`;p.push(`${c.tab()}${c.ns()}coordinator().databaseConnector(${y});`)}let l=[];for(let y of Y2(t))l.push(`${c.ns()}loadExtension("${y}")`);for(let y of Object.values(r)){let b=y.codegen(c);b&&l.push(b)}let d=[];l.length&&(d.push(`${c.tab()}await ${c.ns()}coordinator().exec([`),c.indent(),d.push(l.map(y=>`${c.tab()}${y}`).join(`,
64
+ `)),c.undent(),d.push(`${c.tab()}]);`));let h=[];for(let[y,b]of Object.entries(o))h.push(`const ${Em(y)} = ${b.codegen(c)};`);let m=[],g=i;g.length&&(m=["const defaultAttributes = [",g.map(y=>" "+y.codegen(c)).join(`,
65
+ `),"];"]);let x=[`export default ${n.codegen(c)};`];return[...f,...sl(f),...u,...sl(u),...p,...sl(p),...d,...sl(d),...h,...sl(h),...m,...sl(m),...x].join(`
66
+ `)}var j2=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(Fr(e)){let n=e.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(rl(e)){let n=Object.entries(e).map(([r,o])=>`${WK(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
67
  ${this.tab()}${i}`).join(",");return this.undent(),o+`
68
- `+this.tab()}else return e.join(", ")}error(e,n){nl(e,n)}};function UK(t){return/^[A-Za-z_$]\w*/.test(t)?t:JSON.stringify(t)}function ol(t){return t?.length?[""]:[]}var sa=class extends gt{constructor(e){super(N2),this.value=e}instantiate(){return this.value}codegen(e){return e.stringify(this.value)}toJSON(){return this.value}};function GF(t,e){let{select:n,include:r,...o}=t,i=Ze(o,e);return r&&(i.options.include=new m7(tl(r).map(s=>e.selectionRef(Mm(s))))),new Rc(n,i)}var Rc=class extends gt{constructor(e=k2,n=new ia({})){super(NF),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()}}},m7=class extends gt{constructor(e){super(RF),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 jK=new Set([C2,DF,OF,k2,$F]);function HF(t,e){let n=el(t)?t:{value:t},{select:r=C2,value:o,date:i}=n;return jK.has(r)||e.error(`Unrecognized param type: ${r}`,n),r!==C2?GF(t,e):Fr(o)?new Oc(o.map(s=>e.maybeParam(s))):new Oc(o,i)}var Oc=class extends gt{constructor(e,n){super(LF),this.value=e,this.date=n}instantiate(e){let{date:n,value:r}=this,{Param:o}=e.api;return Fr(r)?o.array(r.map(i=>i.instantiate(e))):o.value(zF(n,r))}codegen(e){let{value:n,date:r}=this,o=`${e.ns()}Param.`;return Fr(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 Fr(n)?n.map(r=>r.toJSON()):e?{date:e}:n}};var Tm=class extends gt{constructor(e){super(CF),this.name=e}instantiate(e){return e.activeParams?.get(this.name)}codegen(e){return Am(this.name)}toJSON(){return Am(this.name)}};function W2(t,e,n){return n.plot?.attributes?.has(t)||n.error(`Unrecognized attribute: ${t}`),new j2(t,e===_m?new X2:n.maybeParam(e))}var j2=class extends gt{constructor(e,n){super(qF),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()}}},X2=class extends gt{constructor(){super(N2),this.value=_m}instantiate(e){return e.api[_m]}codegen(e){return`${e.ns()}${_m}`}toJSON(){return this.value}};function QF(t,e){let n=t[Hu].map(r=>e.parseComponent(r));return new V2(n)}var V2=class extends gt{constructor(e){super(Hu,e)}instantiate(e){return e.api[Hu](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}(
68
+ `+this.tab()}else return e.join(", ")}error(e,n){ol(e,n)}};function WK(t){return/^[A-Za-z_$]\w*/.test(t)?t:JSON.stringify(t)}function sl(t){return t?.length?[""]:[]}var ia=class extends xt{constructor(e){super(N2),this.value=e}instantiate(){return this.value}codegen(e){return e.stringify(this.value)}toJSON(){return this.value}};function HF(t,e){let{select:n,include:r,...o}=t,i=Ke(o,e);return r&&(i.options.include=new y7(nl(r).map(s=>e.selectionRef(Am(s))))),new Rc(n,i)}var Rc=class extends xt{constructor(e=L2,n=new oa({})){super(NF),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()}}},y7=class extends xt{constructor(e){super(OF),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 VK=new Set([k2,PF,$F,L2,DF]);function QF(t,e){let n=rl(t)?t:{value:t},{select:r=k2,value:o,date:i}=n;return VK.has(r)||e.error(`Unrecognized param type: ${r}`,n),r!==k2?HF(t,e):Fr(o)?new Oc(o.map(s=>e.maybeParam(s))):new Oc(o,i)}var Oc=class extends xt{constructor(e,n){super(RF),this.value=e,this.date=n}instantiate(e){let{date:n,value:r}=this,{Param:o}=e.api;return Fr(r)?o.array(r.map(i=>i.instantiate(e))):o.value(YF(n,r))}codegen(e){let{value:n,date:r}=this,o=`${e.ns()}Param.`;return Fr(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 Fr(n)?n.map(r=>r.toJSON()):e?{date:e}:n}};var Tm=class extends xt{constructor(e){super(kF),this.name=e}instantiate(e){return e.activeParams?.get(this.name)}codegen(e){return Em(this.name)}toJSON(){return Em(this.name)}};function V2(t,e,n){return n.plot?.attributes?.has(t)||n.error(`Unrecognized attribute: ${t}`),new X2(t,e===Sm?new W2:n.maybeParam(e))}var X2=class extends xt{constructor(e,n){super(BF),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()}}},W2=class extends xt{constructor(){super(N2),this.value=Sm}instantiate(e){return e.api[Sm]}codegen(e){return`${e.ns()}${Sm}`}toJSON(){return this.value}};function ZF(t,e){let n=t[Zu].map(r=>e.parseComponent(r));return new G2(n)}var G2=class extends xt{constructor(e){super(Zu,e)}instantiate(e){return e.api[Zu](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}(
69
69
  ${n.join(`,
70
70
  `)}
71
- ${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function ZF(t){return new G2(t[Zu])}var G2=class extends gt{constructor(e){super(Zu),this.value=e}instantiate(e){return e.api[Zu](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function JF(t,e){let{[wm]:n,...r}=t;return e.inputs?.has(n)||e.error(`Unrecognized input type: ${n}`,t),new H2(n,Ze(r,e))}var H2=class extends gt{constructor(e,n){super(wm),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 Z2(t,e){let{[vm]:n,...r}=t,o=`${n}Legend`;return e.plot?.legends?.has(o)||e.error(`Unrecognized legend type: ${n}`,t),new Q2(o,n,Ze(r,e))}var Q2=class extends gt{constructor(e,n,r){super(vm),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 KF(t,e){let{[l7]:n,...r}=t;return e.plot?.interactors?.has(n)||e.error(`Unrecognized interactor type: ${n}`,t),new J2(n,Ze(r,e))}var J2=class extends gt{constructor(e,n){super(BF),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{[l7]:e,...n.toJSON()}}};var K2=class extends gt{constructor(e){super(kF),this.param=e}instantiate(e){return e.api.column(this.param.instantiate(e))}codegen(e){return`${e.ns()}column(${this.param.codegen(e)})`}toJSON(){return`$${this.param.toJSON}`}};var XK=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\${1,2}\w+)/g;function tq(t,e){let n=t[kc],r=n.split(XK),o=[""],i=[];for(let s=0,a=0;s<r.length;++s){let c=r[s];c.startsWith("$")?(i[a]=c.startsWith("$$")?new K2(e.paramRef(c.slice(2))):e.maybeParam(c),o[++a]=""):o[a]+=c}return new tw(n,o,i)}var tw=class extends gt{constructor(e,n,r){super(FF),this.value=e,this.spans=n,this.params=r}instantiate(e){let{spans:n,params:r}=this,o=e.api[kc],i=r.map(s=>s.instantiate(e));return o(n,...i)}codegen(e){let{spans:n,params:r}=this,o="",i=r.length;for(let s=0;s<i;++s)o+=n[s]+"${"+r[s].codegen(e)+"}";return o+=n[i],`${e.ns()}${kc}\`${o}\``}toJSON(){return{[kc]:this.value}}};function eq(t,e){if(!t)return null;if(Fr(t))return new sa(t);let{from:n,...r}=t;return new ew(e.maybeParam(n),Ze(r,e))}var ew=class extends gt{constructor(e,n){super(p7),this.table=e,this.options=n}instantiate(e){let{table:n,options:r}=this;return e.api[p7](n.instantiate(e),r.instantiate(e))}codegen(e){let n=this.table.codegen(e),r=this.options.codegen(e);return`${e.ns()}${this.type}(${n}${r?", "+r:""})`}toJSON(){let{type:e,table:n,options:r}=this;return{[e]:n.toJSON(),...r.toJSON()}}};function nw(t,e){return t==null?[]:[t].flat().map(n=>e.maybeParam(n))}function nq(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]=nw(r,e);return new g7(n,i,Ze(o,e))}else{let r=n==="count"&&!t[n]?[]:nw(t[n],e),o={distinct:t.distinct,orderby:nw(t.orderby,e),partitionby:nw(t.partitionby,e),rows:t.rows?e.maybeParam(t.rows):null,range:t.range?e.maybeParam(t.range):null};return new rw(n,r,o)}}var rw=class extends gt{constructor(e,n,r){super(d7),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,u=e.api[n](...r.map(p=>p.instantiate(e)));return i&&(u=u.distinct()),s.length&&(u=u.orderby(s.map(p=>p.instantiate(e)))),a.length&&(u=u.partitionby(a.map(p=>p.instantiate(e)))),c!=null?u=u.rows(c.instantiate(e)):f!=null&&(u=u.range(f.instantiate(e))),u}codegen(e){let{name:n,args:r,options:o}=this,{distinct:i,orderby:s,partitionby:a,rows:c,range:f}=o,u=`${e.ns()}${n}(`+r.map(p=>p.codegen(e)).join(", ")+")";if(i&&(u+=".distinct()"),s.length){let p=s.map(l=>l.codegen(e));u+=`.orderby(${p.join(", ")})`}if(a.length){let p=a.map(l=>l.codegen(e));u+=`.partitionby(${p.join(", ")})`}return c?u+=`.rows(${c.codegen(e)})`:f&&(u+=`.range(${f.codegen(e)})`),u}toJSON(){let{name:e,args:n,options:r}=this,{distinct:o,orderby:i,partitionby:s,rows:a,range:c}=r,f={[e]:x7(n.map(u=>u.toJSON()))};return o&&(f.distinct=!0),i.length&&(f.orderby=x7(i.map(u=>u.toJSON()))),s.length&&(f.partitionby=x7(s.map(u=>u.toJSON()))),a?f.rows=a.toJSON():c&&(f.range=c.toJSON()),f}},g7=class extends gt{constructor(e,n,r){super(d7),this.name=e,this.arg=n,this.options=r}instantiate(e){let{name:n,arg:r,options:o}=this;return e.api[n](r.instantiate(e),o.instantiate(e))}codegen(e){let{name:n,arg:r,options:o}=this,i=o.codegen(e);return`${e.ns()}${n}(`+r.codegen(e)+(i?`, ${i}`:"")+")"}toJSON(){let{name:e,arg:n,options:r}=this;return{[e]:n.toJSON(),...r.toJSON()}}};function x7(t){return t.length===0?"":t.length===1?t[0]:t}function WK(t,e){if(el(t))return t[kc]?tq(t,e):nq(t,e)}function rq(t,e){let{mark:n,data:r,...o}=t;e.plot?.marks?.has(n)||e.error(`Unrecognized mark type: ${n}`,t);let i=eq(r,e),s={};for(let a in o){let c=o[a];s[a]=WK(c,e)||e.maybeParam(c)}return new ow(n,i,new ia(s))}var ow=class extends gt{constructor(e,n,r){super(L2),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=`
71
+ ${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function JF(t){return new H2(t[Ku])}var H2=class extends xt{constructor(e){super(Ku),this.value=e}instantiate(e){return e.api[Ku](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function KF(t,e){let{[vm]:n,...r}=t;return e.inputs?.has(n)||e.error(`Unrecognized input type: ${n}`,t),new Q2(n,Ke(r,e))}var Q2=class extends xt{constructor(e,n){super(vm),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 J2(t,e){let{[_m]:n,...r}=t,o=`${n}Legend`;return e.plot?.legends?.has(o)||e.error(`Unrecognized legend type: ${n}`,t),new Z2(o,n,Ke(r,e))}var Z2=class extends xt{constructor(e,n,r){super(_m),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 tq(t,e){let{[h7]:n,...r}=t;return e.plot?.interactors?.has(n)||e.error(`Unrecognized interactor type: ${n}`,t),new K2(n,Ke(r,e))}var K2=class extends xt{constructor(e,n){super(zF),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{[h7]:e,...n.toJSON()}}};var tw=class extends xt{constructor(e){super(LF),this.param=e}instantiate(e){return e.api.column(this.param.instantiate(e))}codegen(e){return`${e.ns()}column(${this.param.codegen(e)})`}toJSON(){return`$${this.param.toJSON}`}};var GK=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\${1,2}\w+)/g;function eq(t,e){let n=t[kc],r=n.split(GK),o=[""],i=[];for(let s=0,a=0;s<r.length;++s){let c=r[s];c.startsWith("$")?(i[a]=c.startsWith("$$")?new tw(e.paramRef(c.slice(2))):e.maybeParam(c),o[++a]=""):o[a]+=c}return new ew(n,o,i)}var ew=class extends xt{constructor(e,n,r){super(qF),this.value=e,this.spans=n,this.params=r}instantiate(e){let{spans:n,params:r}=this,o=e.api[kc],i=r.map(s=>s.instantiate(e));return o(n,...i)}codegen(e){let{spans:n,params:r}=this,o="",i=r.length;for(let s=0;s<i;++s)o+=n[s]+"${"+r[s].codegen(e)+"}";return o+=n[i],`${e.ns()}${kc}\`${o}\``}toJSON(){return{[kc]:this.value}}};function nq(t,e){if(!t)return null;if(Fr(t))return new ia(t);let{from:n,...r}=t;return new nw(e.maybeParam(n),Ke(r,e))}var nw=class extends xt{constructor(e,n){super(m7),this.table=e,this.options=n}instantiate(e){let{table:n,options:r}=this;return e.api[m7](n.instantiate(e),r.instantiate(e))}codegen(e){let n=this.table.codegen(e),r=this.options.codegen(e);return`${e.ns()}${this.type}(${n}${r?", "+r:""})`}toJSON(){let{type:e,table:n,options:r}=this;return{[e]:n.toJSON(),...r.toJSON()}}};function rw(t,e){return t==null?[]:[t].flat().map(n=>e.maybeParam(n))}function rq(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]=rw(r,e);return new w7(n,i,Ke(o,e))}else{let r=n==="count"&&!t[n]?[]:rw(t[n],e),o={distinct:t.distinct,orderby:rw(t.orderby,e),partitionby:rw(t.partitionby,e),rows:t.rows?e.maybeParam(t.rows):null,range:t.range?e.maybeParam(t.range):null};return new ow(n,r,o)}}var ow=class extends xt{constructor(e,n,r){super(g7),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,u=e.api[n](...r.map(p=>p.instantiate(e)));return i&&(u=u.distinct()),s.length&&(u=u.orderby(s.map(p=>p.instantiate(e)))),a.length&&(u=u.partitionby(a.map(p=>p.instantiate(e)))),c!=null?u=u.rows(c.instantiate(e)):f!=null&&(u=u.range(f.instantiate(e))),u}codegen(e){let{name:n,args:r,options:o}=this,{distinct:i,orderby:s,partitionby:a,rows:c,range:f}=o,u=`${e.ns()}${n}(`+r.map(p=>p.codegen(e)).join(", ")+")";if(i&&(u+=".distinct()"),s.length){let p=s.map(l=>l.codegen(e));u+=`.orderby(${p.join(", ")})`}if(a.length){let p=a.map(l=>l.codegen(e));u+=`.partitionby(${p.join(", ")})`}return c?u+=`.rows(${c.codegen(e)})`:f&&(u+=`.range(${f.codegen(e)})`),u}toJSON(){let{name:e,args:n,options:r}=this,{distinct:o,orderby:i,partitionby:s,rows:a,range:c}=r,f={[e]:b7(n.map(u=>u.toJSON()))};return o&&(f.distinct=!0),i.length&&(f.orderby=b7(i.map(u=>u.toJSON()))),s.length&&(f.partitionby=b7(s.map(u=>u.toJSON()))),a?f.rows=a.toJSON():c&&(f.range=c.toJSON()),f}},w7=class extends xt{constructor(e,n,r){super(g7),this.name=e,this.arg=n,this.options=r}instantiate(e){let{name:n,arg:r,options:o}=this;return e.api[n](r.instantiate(e),o.instantiate(e))}codegen(e){let{name:n,arg:r,options:o}=this,i=o.codegen(e);return`${e.ns()}${n}(`+r.codegen(e)+(i?`, ${i}`:"")+")"}toJSON(){let{name:e,arg:n,options:r}=this;return{[e]:n.toJSON(),...r.toJSON()}}};function b7(t){return t.length===0?"":t.length===1?t[0]:t}function HK(t,e){if(rl(t))return t[kc]?eq(t,e):rq(t,e)}function oq(t,e){let{mark:n,data:r,...o}=t;e.plot?.marks?.has(n)||e.error(`Unrecognized mark type: ${n}`,t);let i=nq(r,e),s={};for(let a in o){let c=o[a];s[a]=HK(c,e)||e.maybeParam(c)}return new iw(n,i,new oa(s))}var iw=class extends xt{constructor(e,n,r){super(R2),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
72
  ${e.tab()}${i},
73
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 oq(t,e){return y7({plot:[t]},e)}function y7(t,e){let{[Ku]:n,...r}=t,o=Object.entries(r).map(([s,a])=>W2(s,a,e)),i=n.map(s=>oa(s.mark)?rq(s,e):oa(s.legend)?Z2(s,e):oa(s.select)?KF(s,e):e.error("Invalid plot entry.",s));return new iw(i,o)}var iw=class extends gt{constructor(e,n){super(Ku,e),this.attributes=n}instantiate(e){let n=[...e.plotDefaults||[],...this.attributes||[]];return e.api[Ku](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(`,
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 iq(t,e){return v7({plot:[t]},e)}function v7(t,e){let{[el]:n,...r}=t,o=Object.entries(r).map(([s,a])=>V2(s,a,e)),i=n.map(s=>ra(s.mark)?oq(s,e):ra(s.legend)?J2(s,e):ra(s.select)?tq(s,e):e.error("Invalid plot entry.",s));return new sw(i,o)}var sw=class extends xt{constructor(e,n){super(el,e),this.attributes=n}instantiate(e){let n=[...e.plotDefaults||[],...this.attributes||[]];return e.api[el](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
75
  `);return e.undent(),`${e.tab()}${e.ns()}${n}(
76
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 iq(t,e){let n=t[Qu].map(r=>e.parseComponent(r));return new sw(n)}var sw=class extends gt{constructor(e){super(Qu,e)}instantiate(e){return e.api[Qu](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}(
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 sq(t,e){let n=t[Ju].map(r=>e.parseComponent(r));return new aw(n)}var aw=class extends xt{constructor(e){super(Ju,e)}instantiate(e){return e.api[Ju](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
78
  ${n.join(`,
79
79
  `)}
80
- ${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function sq(t){return new aw(t[Ju])}var aw=class extends gt{constructor(e){super(Ju),this.value=e}instantiate(e){return e.api[Ju](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function aq(t=[]){return new Map([[Ku,y7],[L2,oq],[vm,Z2],[wm,JF],[Hu,QF],[Qu,iq],[Zu,ZF],[Ju,sq],...t])}function cq(t=[]){return new Set(["menu","search","slider","table",...t])}function fq({attributes:t=VK(),interactors:e=GK(),legends:n=HK(),marks:r=QK()}={}){return{attributes:t,interactors:e,legends:n,marks:r}}function VK(t=[]){return new Set([...Object.keys(M2),...t])}function GK(t=[]){return new Set([...Object.keys(E2),...t])}function HK(t=[]){return new Set([...Object.keys(I2),...t])}function QK(t=[]){return new Set([...Object.keys(T2),...t])}function uq(t=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","column","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 ZK(t,e){return new b7(e).parse(t)}var b7=class{constructor({components:e=aq(),transforms:n=uq(),inputs:r=cq(),plot:o=fq(),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,VF(c,o[c],this));this.plotDefaults=Object.entries(s).map(([c,f])=>W2(c,f,this));for(let c in i)this.params.set(c,HF(i[c],this));return new Sm(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=Mm(e);return n?this.paramRef(n):new sa(e)}maybeSelection(e){let n=Mm(e);return n?this.selectionRef(n):new sa(e)}paramRef(e,n=()=>new Oc){let{params:r}=this;if(!e)return null;let o=r.get(e);return o||(o=n(),r.set(e,o)),new Tm(e)}selectionRef(e,n=!1){let r=this.params.get(e);return n&&r&&!(r instanceof Rc)?null:this.paramRef(e,()=>new Rc)}error(e,n){nl(e,n)}};export{gt as ASTNode,qF as ATTRIBUTE,kF as COLUMPARAMREF,OF as CROSSFILTER,P2 as CSVDataNode,U2 as CodegenContext,PF as DATA,vjt as DATAREF,R2 as DataNode,FF as EXPRESSION,tw as ExpressionNode,_m as FIXED,p7 as FROM,Lc as FileDataNode,Hu as HCONCAT,V2 as HConcatNode,Zu as HSPACE,G2 as HSpaceNode,RF as INCLUDE,wm as INPUT,BF as INTERACTOR,k2 as INTERSECT,H2 as InputNode,Y2 as InstantiateContext,F2 as JSONDataNode,vm as LEGEND,N2 as LITERAL,q2 as LiteralJSONDataNode,sa as LiteralNode,L2 as MARK,IF as OPTIONS,ia as OptionsNode,LF as PARAM,CF as PARAMREF,Ku as PLOT,Oc as ParamNode,Tm as ParamRefNode,D2 as ParquetDataNode,j2 as PlotAttributeNode,X2 as PlotFixedNode,ew as PlotFromNode,J2 as PlotInteractorNode,Q2 as PlotLegendNode,ow as PlotMarkNode,iw as PlotNode,rl as QueryDataNode,l7 as SELECT,NF as SELECTION,DF as SINGLE,EF as SPEC,kc as SQL,Rc as SelectionNode,$2 as SpatialDataNode,Sm as SpecNode,d7 as TRANSFORM,O2 as TableDataNode,rw as TransformNode,$F as UNION,C2 as VALUE,Qu as VCONCAT,sw as VConcatNode,Ju as VSPACE,aw as VSpaceNode,zK as astToDOM,YK as astToESM,ZK as parseSpec};
80
+ ${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function aq(t){return new cw(t[tl])}var cw=class extends xt{constructor(e){super(tl),this.value=e}instantiate(e){return e.api[tl](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function cq(t=[]){return new Map([[el,v7],[R2,iq],[_m,J2],[vm,KF],[Zu,ZF],[Ju,sq],[Ku,JF],[tl,aq],...t])}function fq(t=[]){return new Set(["menu","search","slider","table",...t])}function uq({attributes:t=QK(),interactors:e=ZK(),legends:n=JK(),marks:r=KK()}={}){return{attributes:t,interactors:e,legends:n,marks:r}}function QK(t=[]){return new Set([...Object.keys(A2),...t])}function ZK(t=[]){return new Set([...Object.keys(I2),...t])}function JK(t=[]){return new Set([...Object.keys(C2),...t])}function KK(t=[]){return new Set([...Object.keys(T2),...t])}function lq(t=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","column","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 ttt(t,e){return new _7(e).parse(t)}var _7=class{constructor({components:e=cq(),transforms:n=lq(),inputs:r=fq(),plot:o=uq(),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,GF(c,o[c],this));this.plotDefaults=Object.entries(s).map(([c,f])=>V2(c,f,this));for(let c in i)this.params.set(c,QF(i[c],this));return new Mm(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=Am(e);return n?this.paramRef(n):new ia(e)}maybeSelection(e){let n=Am(e);return n?this.selectionRef(n):new ia(e)}paramRef(e,n=()=>new Oc){let{params:r}=this;if(!e)return null;let o=r.get(e);return o||(o=n(),r.set(e,o)),new Tm(e)}selectionRef(e,n=!1){let r=this.params.get(e);return n&&r&&!(r instanceof Rc)?null:this.paramRef(e,()=>new Rc)}error(e,n){ol(e,n)}};export{xt as ASTNode,BF as ATTRIBUTE,LF as COLUMPARAMREF,$F as CROSSFILTER,F2 as CSVDataNode,j2 as CodegenContext,FF as DATA,Tjt as DATAREF,O2 as DataNode,qF as EXPRESSION,ew as ExpressionNode,Sm as FIXED,m7 as FROM,Lc as FileDataNode,Zu as HCONCAT,G2 as HConcatNode,Ku as HSPACE,H2 as HSpaceNode,OF as INCLUDE,vm as INPUT,zF as INTERACTOR,L2 as INTERSECT,Q2 as InputNode,U2 as InstantiateContext,q2 as JSONDataNode,_m as LEGEND,N2 as LITERAL,B2 as LiteralJSONDataNode,ia as LiteralNode,R2 as MARK,CF as OPTIONS,oa as OptionsNode,RF as PARAM,kF as PARAMREF,el as PLOT,Oc as ParamNode,Tm as ParamRefNode,P2 as ParquetDataNode,X2 as PlotAttributeNode,W2 as PlotFixedNode,nw as PlotFromNode,K2 as PlotInteractorNode,Z2 as PlotLegendNode,iw as PlotMarkNode,sw as PlotNode,il as QueryDataNode,h7 as SELECT,NF as SELECTION,PF as SINGLE,IF as SPEC,kc as SQL,Rc as SelectionNode,D2 as SpatialDataNode,Mm as SpecNode,g7 as TRANSFORM,$2 as TableDataNode,ow as TransformNode,DF as UNION,k2 as VALUE,Ju as VCONCAT,aw as VConcatNode,tl as VSPACE,cw as VSpaceNode,jK as astToDOM,XK as astToESM,ttt as parseSpec};