@uwdata/mosaic-spec 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mosaic-schema.json +431 -0
- package/dist/types/ast/PlotAttributeNode.d.ts +1 -1
- package/dist/types/ast/TransformNode.d.ts +1 -1
- package/dist/types/ast-to-dom.d.ts +16 -14
- package/dist/types/spec/Param.d.ts +1 -1
- package/dist/types/spec/Transform.d.ts +6 -0
- package/dist/types/spec/marks/Density.d.ts +22 -7
- package/package.json +12 -12
- package/src/ast-to-dom.js +9 -4
- package/src/config/transforms.js +1 -0
- package/src/spec/Param.ts +1 -0
- package/src/spec/Transform.ts +8 -0
- package/src/spec/marks/Density.ts +25 -7
- package/vitest.config.ts +3 -0
- package/dist/mosaic-spec.js +0 -38285
- package/dist/mosaic-spec.min.js +0 -80
package/dist/mosaic-spec.min.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
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)=>`
|
|
3
|
-
${e}
|
|
4
|
-
${n}`:t==="top"?(e,n)=>`${n}
|
|
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) {
|
|
8
|
-
display: block;
|
|
9
|
-
height: auto;
|
|
10
|
-
height: intrinsic;
|
|
11
|
-
max-width: 100%;
|
|
12
|
-
overflow: visible;
|
|
13
|
-
}
|
|
14
|
-
:where(.${x}-ramp text) {
|
|
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]===`
|
|
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) {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
break-inside: avoid;
|
|
22
|
-
padding-bottom: 1px;
|
|
23
|
-
}
|
|
24
|
-
:where(.${u}-swatches-columns .${u}-swatch::before) {
|
|
25
|
-
flex-shrink: 0;
|
|
26
|
-
}
|
|
27
|
-
:where(.${u}-swatches-columns .${u}-swatch-label) {
|
|
28
|
-
white-space: nowrap;
|
|
29
|
-
overflow: hidden;
|
|
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) {
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
min-height: 33px;
|
|
35
|
-
flex-wrap: wrap;
|
|
36
|
-
}
|
|
37
|
-
:where(.${u}-swatches-wrap .${u}-swatch) {
|
|
38
|
-
display: inline-flex;
|
|
39
|
-
align-items: center;
|
|
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) {
|
|
42
|
-
font-family: system-ui, sans-serif;
|
|
43
|
-
font-size: 10px;
|
|
44
|
-
margin-bottom: 0.5em;
|
|
45
|
-
}
|
|
46
|
-
:where(.${u}-swatch > svg) {
|
|
47
|
-
margin-right: 0.5em;
|
|
48
|
-
overflow: visible;
|
|
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}) {
|
|
51
|
-
--plot-background: white;
|
|
52
|
-
display: block;
|
|
53
|
-
height: auto;
|
|
54
|
-
height: intrinsic;
|
|
55
|
-
max-width: 100%;
|
|
56
|
-
}
|
|
57
|
-
:where(.${c} text),
|
|
58
|
-
:where(.${c} tspan) {
|
|
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=`[
|
|
61
|
-
`+r.map(a=>JSON.stringify(a)).join(`,
|
|
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=>`
|
|
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}(
|
|
69
|
-
${n.join(`,
|
|
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=`
|
|
72
|
-
${e.tab()}${i},
|
|
73
|
-
${e.tab()}${c}
|
|
74
|
-
`,e.undent(),a+=e.tab()}else a=`${i}${s}`;return`${e.tab()}${e.ns()}${n}(${a})`}toJSON(){let{type:e,name:n,data:r,options:o}=this;return{[e]:n,...r?{data:r.toJSON()}:{},...o.toJSON()}}};function 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(`,
|
|
75
|
-
`);return e.undent(),`${e.tab()}${e.ns()}${n}(
|
|
76
|
-
${i}
|
|
77
|
-
${e.tab()})`}toJSON(){let{type:e,children:n,attributes:r}=this,o={[e]:n.map(i=>i.toJSON())};for(let i of r)Object.assign(o,i.toJSON());return o}};function 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}(
|
|
78
|
-
${n.join(`,
|
|
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};
|