@decidables/discountable-elements
Version:
discountable-elements: Web Components for visualizing Hyperbolic Temporal Discounting
22 lines • 1.01 MB
JavaScript
!function(B,Q){"object"==typeof exports&&"undefined"!=typeof module?Q(exports):"function"==typeof define&&define.amd?define(["exports"],Q):Q((B="undefined"!=typeof globalThis?globalThis:B||self).discountableElements={})}(this,function(B){"use strict";
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Q=globalThis,F=Q.ShadowRoot&&(void 0===Q.ShadyCSS||Q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),t=new WeakMap;let s=class{constructor(B,Q,F){if(this._$cssResult$=!0,F!==U)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=B,this.t=Q}get styleSheet(){let B=this.o;const Q=this.t;if(F&&void 0===B){const F=void 0!==Q&&1===Q.length;F&&(B=t.get(Q)),void 0===B&&((this.o=B=new CSSStyleSheet).replaceSync(this.cssText),F&&t.set(Q,B))}return B}toString(){return this.cssText}};const I=B=>new s("string"==typeof B?B:B+"",void 0,U),g=(B,...Q)=>{const F=1===B.length?B[0]:Q.reduce((Q,F,U)=>Q+(B=>{if(!0===B._$cssResult$)return B.cssText;if("number"==typeof B)return B;throw Error("Value passed to 'css' function must be a 'css' function result: "+B+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(F)+B[U+1],B[0]);return new s(F,B,U)},i=F?B=>B:B=>B instanceof CSSStyleSheet?(B=>{let Q="";for(const F of B.cssRules)Q+=F.cssText;return I(Q)})(B):B,{is:l,defineProperty:c,getOwnPropertyDescriptor:e,getOwnPropertyNames:n,getOwnPropertySymbols:C,getPrototypeOf:d}=Object,a=globalThis,b=a.trustedTypes,o=b?b.emptyScript:"",G=a.reactiveElementPolyfillSupport,u=(B,Q)=>B,r={toAttribute(B,Q){switch(Q){case Boolean:B=B?o:null;break;case Object:case Array:B=null==B?B:JSON.stringify(B)}return B},fromAttribute(B,Q){let F=B;switch(Q){case Boolean:F=null!==B;break;case Number:F=null===B?null:Number(B);break;case Object:case Array:try{F=JSON.parse(B)}catch(B){F=null}}return F}},x=(B,Q)=>!l(B,Q),A={attribute:!0,type:String,converter:r,reflect:!1,useDefault:!1,hasChanged:x};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;let L=class extends HTMLElement{static addInitializer(B){this._$Ei(),(this.l??=[]).push(B)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(B,Q=A){if(Q.state&&(Q.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(B)&&((Q=Object.create(Q)).wrapped=!0),this.elementProperties.set(B,Q),!Q.noAccessor){const F=Symbol(),U=this.getPropertyDescriptor(B,F,Q);void 0!==U&&c(this.prototype,B,U)}}static getPropertyDescriptor(B,Q,F){const{get:U,set:t}=e(this.prototype,B)??{get(){return this[Q]},set(B){this[Q]=B}};return{get:U,set(Q){const s=U?.call(this);t?.call(this,Q),this.requestUpdate(B,s,F)},configurable:!0,enumerable:!0}}static getPropertyOptions(B){return this.elementProperties.get(B)??A}static _$Ei(){if(this.hasOwnProperty(u("elementProperties")))return;const B=d(this);B.finalize(),void 0!==B.l&&(this.l=[...B.l]),this.elementProperties=new Map(B.elementProperties)}static finalize(){if(this.hasOwnProperty(u("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(u("properties"))){const B=this.properties,Q=[...n(B),...C(B)];for(const F of Q)this.createProperty(F,B[F])}const B=this[Symbol.metadata];if(null!==B){const Q=litPropertyMetadata.get(B);if(void 0!==Q)for(const[B,F]of Q)this.elementProperties.set(B,F)}this._$Eh=new Map;for(const[B,Q]of this.elementProperties){const F=this._$Eu(B,Q);void 0!==F&&this._$Eh.set(F,B)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(B){const Q=[];if(Array.isArray(B)){const F=new Set(B.flat(1/0).reverse());for(const B of F)Q.unshift(i(B))}else void 0!==B&&Q.push(i(B));return Q}static _$Eu(B,Q){const F=Q.attribute;return!1===F?void 0:"string"==typeof F?F:"string"==typeof B?B.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(B=>this.enableUpdating=B),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(B=>B(this))}addController(B){(this._$EO??=new Set).add(B),void 0!==this.renderRoot&&this.isConnected&&B.hostConnected?.()}removeController(B){this._$EO?.delete(B)}_$E_(){const B=new Map,Q=this.constructor.elementProperties;for(const F of Q.keys())this.hasOwnProperty(F)&&(B.set(F,this[F]),delete this[F]);B.size>0&&(this._$Ep=B)}createRenderRoot(){const B=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((B,U)=>{if(F)B.adoptedStyleSheets=U.map(B=>B instanceof CSSStyleSheet?B:B.styleSheet);else for(const F of U){const U=document.createElement("style"),t=Q.litNonce;void 0!==t&&U.setAttribute("nonce",t),U.textContent=F.cssText,B.appendChild(U)}})(B,this.constructor.elementStyles),B}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(B=>B.hostConnected?.())}enableUpdating(B){}disconnectedCallback(){this._$EO?.forEach(B=>B.hostDisconnected?.())}attributeChangedCallback(B,Q,F){this._$AK(B,F)}_$ET(B,Q){const F=this.constructor.elementProperties.get(B),U=this.constructor._$Eu(B,F);if(void 0!==U&&!0===F.reflect){const t=(void 0!==F.converter?.toAttribute?F.converter:r).toAttribute(Q,F.type);this._$Em=B,null==t?this.removeAttribute(U):this.setAttribute(U,t),this._$Em=null}}_$AK(B,Q){const F=this.constructor,U=F._$Eh.get(B);if(void 0!==U&&this._$Em!==U){const B=F.getPropertyOptions(U),t="function"==typeof B.converter?{fromAttribute:B.converter}:void 0!==B.converter?.fromAttribute?B.converter:r;this._$Em=U;const s=t.fromAttribute(Q,B.type);this[U]=s??this._$Ej?.get(U)??s,this._$Em=null}}requestUpdate(B,Q,F,U=!1,t){if(void 0!==B){const s=this.constructor;if(!1===U&&(t=this[B]),F??=s.getPropertyOptions(B),!((F.hasChanged??x)(t,Q)||F.useDefault&&F.reflect&&t===this._$Ej?.get(B)&&!this.hasAttribute(s._$Eu(B,F))))return;this.C(B,Q,F)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(B,Q,{useDefault:F,reflect:U,wrapped:t},s){F&&!(this._$Ej??=new Map).has(B)&&(this._$Ej.set(B,s??Q??this[B]),!0!==t||void 0!==s)||(this._$AL.has(B)||(this.hasUpdated||F||(Q=void 0),this._$AL.set(B,Q)),!0===U&&this._$Em!==B&&(this._$Eq??=new Set).add(B))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(B){Promise.reject(B)}const B=this.scheduleUpdate();return null!=B&&await B,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[B,Q]of this._$Ep)this[B]=Q;this._$Ep=void 0}const B=this.constructor.elementProperties;if(B.size>0)for(const[Q,F]of B){const{wrapped:B}=F,U=this[Q];!0!==B||this._$AL.has(Q)||void 0===U||this.C(Q,void 0,F,U)}}let B=!1;const Q=this._$AL;try{B=this.shouldUpdate(Q),B?(this.willUpdate(Q),this._$EO?.forEach(B=>B.hostUpdate?.()),this.update(Q)):this._$EM()}catch(Q){throw B=!1,this._$EM(),Q}B&&this._$AE(Q)}willUpdate(B){}_$AE(B){this._$EO?.forEach(B=>B.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(B)),this.updated(B)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(B){return!0}update(B){this._$Eq&&=this._$Eq.forEach(B=>this._$ET(B,this[B])),this._$EM()}updated(B){}firstUpdated(B){}};L.elementStyles=[],L.shadowRootOptions={mode:"open"},L[u("elementProperties")]=new Map,L[u("finalized")]=new Map,G?.({ReactiveElement:L}),(a.reactiveElementVersions??=[]).push("2.1.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const h=globalThis,y=B=>B,R=h.trustedTypes,Z=R?R.createPolicy("lit-html",{createHTML:B=>B}):void 0,V="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,m="?"+S,E=`<${m}>`,N=document,X=()=>N.createComment(""),p=B=>null===B||"object"!=typeof B&&"function"!=typeof B,W=Array.isArray,H="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Y=/-->/g,f=/>/g,w=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),v=/'/g,J=/"/g,k=/^(?:script|style|textarea|title)$/i,M=B=>(Q,...F)=>({_$litType$:B,strings:Q,values:F}),T=M(1),z=M(2),K=M(3),O=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),P=new WeakMap,_=N.createTreeWalker(N,129);function $(B,Q){if(!W(B)||!B.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Z?Z.createHTML(Q):Q}class q{constructor({strings:B,_$litType$:Q},F){let U;this.parts=[];let t=0,s=0;const I=B.length-1,g=this.parts,[i,l]=((B,Q)=>{const F=B.length-1,U=[];let t,s=2===Q?"<svg>":3===Q?"<math>":"",I=D;for(let Q=0;Q<F;Q++){const F=B[Q];let g,i,l=-1,c=0;for(;c<F.length&&(I.lastIndex=c,i=I.exec(F),null!==i);)c=I.lastIndex,I===D?"!--"===i[1]?I=Y:void 0!==i[1]?I=f:void 0!==i[2]?(k.test(i[2])&&(t=RegExp("</"+i[2],"g")),I=w):void 0!==i[3]&&(I=w):I===w?">"===i[0]?(I=t??D,l=-1):void 0===i[1]?l=-2:(l=I.lastIndex-i[2].length,g=i[1],I=void 0===i[3]?w:'"'===i[3]?J:v):I===J||I===v?I=w:I===Y||I===f?I=D:(I=w,t=void 0);const e=I===w&&B[Q+1].startsWith("/>")?" ":"";s+=I===D?F+E:l>=0?(U.push(g),F.slice(0,l)+V+F.slice(l)+S+e):F+S+(-2===l?Q:e)}return[$(B,s+(B[F]||"<?>")+(2===Q?"</svg>":3===Q?"</math>":"")),U]})(B,Q);if(this.el=q.createElement(i,F),_.currentNode=this.el.content,2===Q||3===Q){const B=this.el.content.firstChild;B.replaceWith(...B.childNodes)}for(;null!==(U=_.nextNode())&&g.length<I;){if(1===U.nodeType){if(U.hasAttributes())for(const B of U.getAttributeNames())if(B.endsWith(V)){const Q=l[s++],F=U.getAttribute(B).split(S),I=/([.?@])?(.*)/.exec(Q);g.push({type:1,index:t,name:I[2],strings:F,ctor:"."===I[1]?tB:"?"===I[1]?sB:"@"===I[1]?IB:UB}),U.removeAttribute(B)}else B.startsWith(S)&&(g.push({type:6,index:t}),U.removeAttribute(B));if(k.test(U.tagName)){const B=U.textContent.split(S),Q=B.length-1;if(Q>0){U.textContent=R?R.emptyScript:"";for(let F=0;F<Q;F++)U.append(B[F],X()),_.nextNode(),g.push({type:2,index:++t});U.append(B[Q],X())}}}else if(8===U.nodeType)if(U.data===m)g.push({type:2,index:t});else{let B=-1;for(;-1!==(B=U.data.indexOf(S,B+1));)g.push({type:7,index:t}),B+=S.length-1}t++}}static createElement(B,Q){const F=N.createElement("template");return F.innerHTML=B,F}}function BB(B,Q,F=B,U){if(Q===O)return Q;let t=void 0!==U?F._$Co?.[U]:F._$Cl;const s=p(Q)?void 0:Q._$litDirective$;return t?.constructor!==s&&(t?._$AO?.(!1),void 0===s?t=void 0:(t=new s(B),t._$AT(B,F,U)),void 0!==U?(F._$Co??=[])[U]=t:F._$Cl=t),void 0!==t&&(Q=BB(B,t._$AS(B,Q.values),t,U)),Q}class QB{constructor(B,Q){this._$AV=[],this._$AN=void 0,this._$AD=B,this._$AM=Q}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(B){const{el:{content:Q},parts:F}=this._$AD,U=(B?.creationScope??N).importNode(Q,!0);_.currentNode=U;let t=_.nextNode(),s=0,I=0,g=F[0];for(;void 0!==g;){if(s===g.index){let Q;2===g.type?Q=new FB(t,t.nextSibling,this,B):1===g.type?Q=new g.ctor(t,g.name,g.strings,this,B):6===g.type&&(Q=new gB(t,this,B)),this._$AV.push(Q),g=F[++I]}s!==g?.index&&(t=_.nextNode(),s++)}return _.currentNode=N,U}p(B){let Q=0;for(const F of this._$AV)void 0!==F&&(void 0!==F.strings?(F._$AI(B,F,Q),Q+=F.strings.length-2):F._$AI(B[Q])),Q++}}let FB=class B{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(B,Q,F,U){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=B,this._$AB=Q,this._$AM=F,this.options=U,this._$Cv=U?.isConnected??!0}get parentNode(){let B=this._$AA.parentNode;const Q=this._$AM;return void 0!==Q&&11===B?.nodeType&&(B=Q.parentNode),B}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(B,Q=this){B=BB(this,B,Q),p(B)?B===j||null==B||""===B?(this._$AH!==j&&this._$AR(),this._$AH=j):B!==this._$AH&&B!==O&&this._(B):void 0!==B._$litType$?this.$(B):void 0!==B.nodeType?this.T(B):(B=>W(B)||"function"==typeof B?.[Symbol.iterator])(B)?this.k(B):this._(B)}O(B){return this._$AA.parentNode.insertBefore(B,this._$AB)}T(B){this._$AH!==B&&(this._$AR(),this._$AH=this.O(B))}_(B){this._$AH!==j&&p(this._$AH)?this._$AA.nextSibling.data=B:this.T(N.createTextNode(B)),this._$AH=B}$(B){const{values:Q,_$litType$:F}=B,U="number"==typeof F?this._$AC(B):(void 0===F.el&&(F.el=q.createElement($(F.h,F.h[0]),this.options)),F);if(this._$AH?._$AD===U)this._$AH.p(Q);else{const B=new QB(U,this),F=B.u(this.options);B.p(Q),this.T(F),this._$AH=B}}_$AC(B){let Q=P.get(B.strings);return void 0===Q&&P.set(B.strings,Q=new q(B)),Q}k(Q){W(this._$AH)||(this._$AH=[],this._$AR());const F=this._$AH;let U,t=0;for(const s of Q)t===F.length?F.push(U=new B(this.O(X()),this.O(X()),this,this.options)):U=F[t],U._$AI(s),t++;t<F.length&&(this._$AR(U&&U._$AB.nextSibling,t),F.length=t)}_$AR(B=this._$AA.nextSibling,Q){for(this._$AP?.(!1,!0,Q);B!==this._$AB;){const Q=y(B).nextSibling;y(B).remove(),B=Q}}setConnected(B){void 0===this._$AM&&(this._$Cv=B,this._$AP?.(B))}};class UB{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(B,Q,F,U,t){this.type=1,this._$AH=j,this._$AN=void 0,this.element=B,this.name=Q,this._$AM=U,this.options=t,F.length>2||""!==F[0]||""!==F[1]?(this._$AH=Array(F.length-1).fill(new String),this.strings=F):this._$AH=j}_$AI(B,Q=this,F,U){const t=this.strings;let s=!1;if(void 0===t)B=BB(this,B,Q,0),s=!p(B)||B!==this._$AH&&B!==O,s&&(this._$AH=B);else{const U=B;let I,g;for(B=t[0],I=0;I<t.length-1;I++)g=BB(this,U[F+I],Q,I),g===O&&(g=this._$AH[I]),s||=!p(g)||g!==this._$AH[I],g===j?B=j:B!==j&&(B+=(g??"")+t[I+1]),this._$AH[I]=g}s&&!U&&this.j(B)}j(B){B===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,B??"")}}class tB extends UB{constructor(){super(...arguments),this.type=3}j(B){this.element[this.name]=B===j?void 0:B}}class sB extends UB{constructor(){super(...arguments),this.type=4}j(B){this.element.toggleAttribute(this.name,!!B&&B!==j)}}class IB extends UB{constructor(B,Q,F,U,t){super(B,Q,F,U,t),this.type=5}_$AI(B,Q=this){if((B=BB(this,B,Q,0)??j)===O)return;const F=this._$AH,U=B===j&&F!==j||B.capture!==F.capture||B.once!==F.once||B.passive!==F.passive,t=B!==j&&(F===j||U);U&&this.element.removeEventListener(this.name,this,F),t&&this.element.addEventListener(this.name,this,B),this._$AH=B}handleEvent(B){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,B):this._$AH.handleEvent(B)}}class gB{constructor(B,Q,F){this.element=B,this.type=6,this._$AN=void 0,this._$AM=Q,this.options=F}get _$AU(){return this._$AM._$AU}_$AI(B){BB(this,B)}}const iB=h.litHtmlPolyfillSupport;iB?.(q,FB),(h.litHtmlVersions??=[]).push("3.3.2");const lB=(B,Q,F)=>{const U=F?.renderBefore??Q;let t=U._$litPart$;if(void 0===t){const B=F?.renderBefore??null;U._$litPart$=t=new FB(Q.insertBefore(X(),B),B,void 0,F??{})}return t._$AI(B),t},cB=globalThis;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/let eB=class extends L{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const B=super.createRenderRoot();return this.renderOptions.renderBefore??=B.firstChild,B}update(B){const Q=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(B),this._$Do=lB(Q,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};eB._$litElement$=!0,eB.finalized=!0,cB.litElementHydrateSupport?.({LitElement:eB});const nB=cB.litElementPolyfillSupport;function CB(B,Q){return null==B||null==Q?NaN:B<Q?-1:B>Q?1:B>=Q?0:NaN}function dB(B,Q){return null==B||null==Q?NaN:Q<B?-1:Q>B?1:Q>=B?0:NaN}function aB(B){let Q,F,U;function t(B,U,t=0,s=B.length){if(t<s){if(0!==Q(U,U))return s;do{const Q=t+s>>>1;F(B[Q],U)<0?t=Q+1:s=Q}while(t<s)}return t}return 2!==B.length?(Q=CB,F=(Q,F)=>CB(B(Q),F),U=(Q,F)=>B(Q)-F):(Q=B===CB||B===dB?B:bB,F=B,U=B),{left:t,center:function(B,Q,F=0,s=B.length){const I=t(B,Q,F,s-1);return I>F&&U(B[I-1],Q)>-U(B[I],Q)?I-1:I},right:function(B,U,t=0,s=B.length){if(t<s){if(0!==Q(U,U))return s;do{const Q=t+s>>>1;F(B[Q],U)<=0?t=Q+1:s=Q}while(t<s)}return t}}}function bB(){return 0}function oB(B){return null===B?NaN:+B}nB?.({LitElement:eB}),(cB.litElementVersions??=[]).push("4.2.2");const GB=aB(CB).right;function uB(B,Q){let F=0;for(let Q of B)null!=Q&&(Q=+Q)>=Q&&++F;return F}function rB(B){return 0|B.length}function xB(B){return!(B>0)}function AB(B){return"object"!=typeof B||"length"in B?B:Array.from(B)}function LB(B,Q){var F=0;return Float64Array.from(B,B=>F+=+B||0)}function hB(B,Q){let F,U=0,t=0,s=0;if(void 0===Q)for(let Q of B)null!=Q&&(Q=+Q)>=Q&&(F=Q-t,t+=F/++U,s+=F*(Q-t));else{let I=-1;for(let g of B)null!=(g=Q(g,++I,B))&&(g=+g)>=g&&(F=g-t,t+=F/++U,s+=F*(g-t))}if(U>1)return s/(U-1)}function yB(B,Q){const F=hB(B,Q);return F?Math.sqrt(F):F}function RB(B,Q){let F,U;if(void 0===Q)for(const Q of B)null!=Q&&(void 0===F?Q>=Q&&(F=U=Q):(F>Q&&(F=Q),U<Q&&(U=Q)));else{let t=-1;for(let s of B)null!=(s=Q(s,++t,B))&&(void 0===F?s>=s&&(F=U=s):(F>s&&(F=s),U<s&&(U=s)))}return[F,U]}aB(oB).center;class ZB{constructor(){this._partials=new Float64Array(32),this._n=0}add(B){const Q=this._partials;let F=0;for(let U=0;U<this._n&&U<32;U++){const t=Q[U],s=B+t,I=Math.abs(B)<Math.abs(t)?B-(s-t):t-(s-B);I&&(Q[F++]=I),B=s}return Q[F]=B,this._n=F+1,this}valueOf(){const B=this._partials;let Q,F,U,t=this._n,s=0;if(t>0){for(s=B[--t];t>0&&(Q=s,F=B[--t],s=Q+F,U=F-(s-Q),!U););t>0&&(U<0&&B[t-1]<0||U>0&&B[t-1]>0)&&(F=2*U,Q=s+F,F==Q-s&&(s=Q))}return s}}class VB extends Map{constructor(B,Q=XB){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:Q}}),null!=B)for(const[Q,F]of B)this.set(Q,F)}get(B){return super.get(mB(this,B))}has(B){return super.has(mB(this,B))}set(B,Q){return super.set(EB(this,B),Q)}delete(B){return super.delete(NB(this,B))}}class SB extends Set{constructor(B,Q=XB){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:Q}}),null!=B)for(const Q of B)this.add(Q)}has(B){return super.has(mB(this,B))}add(B){return super.add(EB(this,B))}delete(B){return super.delete(NB(this,B))}}function mB({_intern:B,_key:Q},F){const U=Q(F);return B.has(U)?B.get(U):F}function EB({_intern:B,_key:Q},F){const U=Q(F);return B.has(U)?B.get(U):(B.set(U,F),F)}function NB({_intern:B,_key:Q},F){const U=Q(F);return B.has(U)&&(F=B.get(U),B.delete(U)),F}function XB(B){return null!==B&&"object"==typeof B?B.valueOf():B}function pB(B){return B}function WB(B,...Q){return YB(B,pB,pB,Q)}function HB(B,Q,...F){return YB(B,pB,Q,F)}function DB(B,Q,...F){return YB(B,Array.from,Q,F)}function YB(B,Q,F,U){return function B(t,s){if(s>=U.length)return F(t);const I=new VB,g=U[s++];let i=-1;for(const B of t){const Q=g(B,++i,t),F=I.get(Q);F?F.push(B):I.set(Q,[B])}for(const[Q,F]of I)I.set(Q,B(F,s));return Q(I)}(B,0)}function fB(B,...Q){if("function"!=typeof B[Symbol.iterator])throw new TypeError("values is not iterable");B=Array.from(B);let[F]=Q;if(F&&2!==F.length||Q.length>1){const s=Uint32Array.from(B,(B,Q)=>Q);return Q.length>1?(Q=Q.map(Q=>B.map(Q)),s.sort((B,F)=>{for(const U of Q){const Q=vB(U[B],U[F]);if(Q)return Q}})):(F=B.map(F),s.sort((B,Q)=>vB(F[B],F[Q]))),U=B,t=s,Array.from(t,B=>U[B])}var U,t;return B.sort(wB(F))}function wB(B=CB){if(B===CB)return vB;if("function"!=typeof B)throw new TypeError("compare is not a function");return(Q,F)=>{const U=B(Q,F);return U||0===U?U:(0===B(F,F))-(0===B(Q,Q))}}function vB(B,Q){return(null==B||!(B>=B))-(null==Q||!(Q>=Q))||(B<Q?-1:B>Q?1:0)}function JB(B,Q,F){return(2!==Q.length?fB(HB(B,Q,F),([B,Q],[F,U])=>CB(Q,U)||CB(B,F)):fB(WB(B,F),([B,F],[U,t])=>Q(F,t)||CB(B,U))).map(([B])=>B)}const kB=Math.sqrt(50),MB=Math.sqrt(10),TB=Math.sqrt(2);function zB(B,Q,F){const U=(Q-B)/Math.max(0,F),t=Math.floor(Math.log10(U)),s=U/Math.pow(10,t),I=s>=kB?10:s>=MB?5:s>=TB?2:1;let g,i,l;return t<0?(l=Math.pow(10,-t)/I,g=Math.round(B*l),i=Math.round(Q*l),g/l<B&&++g,i/l>Q&&--i,l=-l):(l=Math.pow(10,t)*I,g=Math.round(B/l),i=Math.round(Q/l),g*l<B&&++g,i*l>Q&&--i),i<g&&.5<=F&&F<2?zB(B,Q,2*F):[g,i,l]}function KB(B,Q,F){if(!((F=+F)>0))return[];if((B=+B)===(Q=+Q))return[B];const U=Q<B,[t,s,I]=U?zB(Q,B,F):zB(B,Q,F);if(!(s>=t))return[];const g=s-t+1,i=new Array(g);if(U)if(I<0)for(let B=0;B<g;++B)i[B]=(s-B)/-I;else for(let B=0;B<g;++B)i[B]=(s-B)*I;else if(I<0)for(let B=0;B<g;++B)i[B]=(t+B)/-I;else for(let B=0;B<g;++B)i[B]=(t+B)*I;return i}function OB(B,Q,F){return zB(B=+B,Q=+Q,F=+F)[2]}function jB(B,Q,F){F=+F;const U=(Q=+Q)<(B=+B),t=U?OB(Q,B,F):OB(B,Q,F);return(U?-1:1)*(t<0?1/-t:t)}function PB(B){return Math.max(1,Math.ceil(Math.log(uB(B))/Math.LN2)+1)}function _B(B,Q){let F;if(void 0===Q)for(const Q of B)null!=Q&&(F<Q||void 0===F&&Q>=Q)&&(F=Q);else{let U=-1;for(let t of B)null!=(t=Q(t,++U,B))&&(F<t||void 0===F&&t>=t)&&(F=t)}return F}function $B(B,Q){let F,U=-1,t=-1;if(void 0===Q)for(const Q of B)++t,null!=Q&&(F<Q||void 0===F&&Q>=Q)&&(F=Q,U=t);else for(let s of B)null!=(s=Q(s,++t,B))&&(F<s||void 0===F&&s>=s)&&(F=s,U=t);return U}function qB(B,Q){let F;if(void 0===Q)for(const Q of B)null!=Q&&(F>Q||void 0===F&&Q>=Q)&&(F=Q);else{let U=-1;for(let t of B)null!=(t=Q(t,++U,B))&&(F>t||void 0===F&&t>=t)&&(F=t)}return F}function BQ(B,Q){let F,U=-1,t=-1;if(void 0===Q)for(const Q of B)++t,null!=Q&&(F>Q||void 0===F&&Q>=Q)&&(F=Q,U=t);else for(let s of B)null!=(s=Q(s,++t,B))&&(F>s||void 0===F&&s>=s)&&(F=s,U=t);return U}function QQ(B,Q,F=0,U=1/0,t){if(Q=Math.floor(Q),F=Math.floor(Math.max(0,F)),U=Math.floor(Math.min(B.length-1,U)),!(F<=Q&&Q<=U))return B;for(t=void 0===t?vB:wB(t);U>F;){if(U-F>600){const s=U-F+1,I=Q-F+1,g=Math.log(s),i=.5*Math.exp(2*g/3),l=.5*Math.sqrt(g*i*(s-i)/s)*(I-s/2<0?-1:1);QQ(B,Q,Math.max(F,Math.floor(Q-I*i/s+l)),Math.min(U,Math.floor(Q+(s-I)*i/s+l)),t)}const s=B[Q];let I=F,g=U;for(FQ(B,F,Q),t(B[U],s)>0&&FQ(B,F,U);I<g;){for(FQ(B,I,g),++I,--g;t(B[I],s)<0;)++I;for(;t(B[g],s)>0;)--g}0===t(B[F],s)?FQ(B,F,g):(++g,FQ(B,g,U)),g<=Q&&(F=g+1),Q<=g&&(U=g-1)}return B}function FQ(B,Q,F){const U=B[Q];B[Q]=B[F],B[F]=U}function UQ(B,Q=CB){let F,U=!1;if(1===Q.length){let t;for(const s of B){const B=Q(s);(U?CB(B,t)>0:0===CB(B,B))&&(F=s,t=B,U=!0)}}else for(const t of B)(U?Q(t,F)>0:0===Q(t,t))&&(F=t,U=!0);return F}function tQ(B,Q,F){if(B=Float64Array.from(function*(B,Q){if(void 0===Q)for(let Q of B)null!=Q&&(Q=+Q)>=Q&&(yield Q);else{let F=-1;for(let U of B)null!=(U=Q(U,++F,B))&&(U=+U)>=U&&(yield U)}}(B,F)),(U=B.length)&&!isNaN(Q=+Q)){if(Q<=0||U<2)return qB(B);if(Q>=1)return _B(B);var U,t=(U-1)*Q,s=Math.floor(t),I=_B(QQ(B,s).subarray(0,s+1));return I+(qB(B.subarray(s+1))-I)*(t-s)}}function sQ(B,Q,F=oB){if((U=B.length)&&!isNaN(Q=+Q)){if(Q<=0||U<2)return+F(B[0],0,B);if(Q>=1)return+F(B[U-1],U-1,B);var U,t=(U-1)*Q,s=Math.floor(t),I=+F(B[s],s,B);return I+(+F(B[s+1],s+1,B)-I)*(t-s)}}function IQ(B,Q,F){const U=uB(B),t=tQ(B,.75)-tQ(B,.25);return U&&t?Math.ceil((F-Q)/(2*t*Math.pow(U,-1/3))):1}function gQ(B,Q,F){const U=uB(B),t=yB(B);return U&&t?Math.ceil((F-Q)*Math.cbrt(U)/(3.49*t)):1}function iQ(B,Q){let F=0,U=0;if(void 0===Q)for(let Q of B)null!=Q&&(Q=+Q)>=Q&&(++F,U+=Q);else{let t=-1;for(let s of B)null!=(s=Q(s,++t,B))&&(s=+s)>=s&&(++F,U+=s)}if(F)return U/F}function lQ(B,Q){return tQ(B,.5,Q)}function cQ(B){return Array.from(function*(B){for(const Q of B)yield*Q}(B))}function eQ(B,Q){const F=new VB;if(void 0===Q)for(let Q of B)null!=Q&&Q>=Q&&F.set(Q,(F.get(Q)||0)+1);else{let U=-1;for(let t of B)null!=(t=Q(t,++U,B))&&t>=t&&F.set(t,(F.get(t)||0)+1)}let U,t=0;for(const[B,Q]of F)Q>t&&(t=Q,U=B);return U}function nQ(B,Q){return[B,Q]}function CQ(B,Q,F){B=+B,Q=+Q,F=(t=arguments.length)<2?(Q=B,B=0,1):t<3?1:+F;for(var U=-1,t=0|Math.max(0,Math.ceil((Q-B)/F)),s=new Array(t);++U<t;)s[U]=B+U*F;return s}function dQ(B,Q){let F=0;if(void 0===Q)for(let Q of B)(Q=+Q)&&(F+=Q);else{let U=-1;for(let t of B)(t=+Q(t,++U,B))&&(F+=t)}return F}function aQ(B){if("function"!=typeof B[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(B).reverse()}function bQ(B){return B}var oQ=1e-6;function GQ(B){return"translate("+B+",0)"}function uQ(B){return"translate(0,"+B+")"}function rQ(B){return Q=>+B(Q)}function xQ(B,Q){return Q=Math.max(0,B.bandwidth()-2*Q)/2,B.round()&&(Q=Math.round(Q)),F=>+B(F)+Q}function AQ(){return!this.__axis}function LQ(B,Q){var F=[],U=null,t=null,s=6,I=6,g=3,i="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,l=1===B||4===B?-1:1,c=4===B||2===B?"x":"y",e=1===B||3===B?GQ:uQ;function n(n){var C=null==U?Q.ticks?Q.ticks.apply(Q,F):Q.domain():U,d=null==t?Q.tickFormat?Q.tickFormat.apply(Q,F):bQ:t,a=Math.max(s,0)+g,b=Q.range(),o=+b[0]+i,G=+b[b.length-1]+i,u=(Q.bandwidth?xQ:rQ)(Q.copy(),i),r=n.selection?n.selection():n,x=r.selectAll(".domain").data([null]),A=r.selectAll(".tick").data(C,Q).order(),L=A.exit(),h=A.enter().append("g").attr("class","tick"),y=A.select("line"),R=A.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),A=A.merge(h),y=y.merge(h.append("line").attr("stroke","currentColor").attr(c+"2",l*s)),R=R.merge(h.append("text").attr("fill","currentColor").attr(c,l*a).attr("dy",1===B?"0em":3===B?"0.71em":"0.32em")),n!==r&&(x=x.transition(n),A=A.transition(n),y=y.transition(n),R=R.transition(n),L=L.transition(n).attr("opacity",oQ).attr("transform",function(B){return isFinite(B=u(B))?e(B+i):this.getAttribute("transform")}),h.attr("opacity",oQ).attr("transform",function(B){var Q=this.parentNode.__axis;return e((Q&&isFinite(Q=Q(B))?Q:u(B))+i)})),L.remove(),x.attr("d",4===B||2===B?I?"M"+l*I+","+o+"H"+i+"V"+G+"H"+l*I:"M"+i+","+o+"V"+G:I?"M"+o+","+l*I+"V"+i+"H"+G+"V"+l*I:"M"+o+","+i+"H"+G),A.attr("opacity",1).attr("transform",function(B){return e(u(B)+i)}),y.attr(c+"2",l*s),R.attr(c,l*a).text(d),r.filter(AQ).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===B?"start":4===B?"end":"middle"),r.each(function(){this.__axis=u})}return n.scale=function(B){return arguments.length?(Q=B,n):Q},n.ticks=function(){return F=Array.from(arguments),n},n.tickArguments=function(B){return arguments.length?(F=null==B?[]:Array.from(B),n):F.slice()},n.tickValues=function(B){return arguments.length?(U=null==B?null:Array.from(B),n):U&&U.slice()},n.tickFormat=function(B){return arguments.length?(t=B,n):t},n.tickSize=function(B){return arguments.length?(s=I=+B,n):s},n.tickSizeInner=function(B){return arguments.length?(s=+B,n):s},n.tickSizeOuter=function(B){return arguments.length?(I=+B,n):I},n.tickPadding=function(B){return arguments.length?(g=+B,n):g},n.offset=function(B){return arguments.length?(i=+B,n):i},n}function hQ(B){return LQ(3,B)}var yQ={value:()=>{}};function RQ(){for(var B,Q=0,F=arguments.length,U={};Q<F;++Q){if(!(B=arguments[Q]+"")||B in U||/[\s.]/.test(B))throw new Error("illegal type: "+B);U[B]=[]}return new ZQ(U)}function ZQ(B){this._=B}function VQ(B,Q){for(var F,U=0,t=B.length;U<t;++U)if((F=B[U]).name===Q)return F.value}function SQ(B,Q,F){for(var U=0,t=B.length;U<t;++U)if(B[U].name===Q){B[U]=yQ,B=B.slice(0,U).concat(B.slice(U+1));break}return null!=F&&B.push({name:Q,value:F}),B}ZQ.prototype=RQ.prototype={constructor:ZQ,on:function(B,Q){var F,U,t=this._,s=(U=t,(B+"").trim().split(/^|\s+/).map(function(B){var Q="",F=B.indexOf(".");if(F>=0&&(Q=B.slice(F+1),B=B.slice(0,F)),B&&!U.hasOwnProperty(B))throw new Error("unknown type: "+B);return{type:B,name:Q}})),I=-1,g=s.length;if(!(arguments.length<2)){if(null!=Q&&"function"!=typeof Q)throw new Error("invalid callback: "+Q);for(;++I<g;)if(F=(B=s[I]).type)t[F]=SQ(t[F],B.name,Q);else if(null==Q)for(F in t)t[F]=SQ(t[F],B.name,null);return this}for(;++I<g;)if((F=(B=s[I]).type)&&(F=VQ(t[F],B.name)))return F},copy:function(){var B={},Q=this._;for(var F in Q)B[F]=Q[F].slice();return new ZQ(B)},call:function(B,Q){if((F=arguments.length-2)>0)for(var F,U,t=new Array(F),s=0;s<F;++s)t[s]=arguments[s+2];if(!this._.hasOwnProperty(B))throw new Error("unknown type: "+B);for(s=0,F=(U=this._[B]).length;s<F;++s)U[s].value.apply(Q,t)},apply:function(B,Q,F){if(!this._.hasOwnProperty(B))throw new Error("unknown type: "+B);for(var U=this._[B],t=0,s=U.length;t<s;++t)U[t].value.apply(Q,F)}};var mQ="http://www.w3.org/1999/xhtml",EQ={svg:"http://www.w3.org/2000/svg",xhtml:mQ,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function NQ(B){var Q=B+="",F=Q.indexOf(":");return F>=0&&"xmlns"!==(Q=B.slice(0,F))&&(B=B.slice(F+1)),EQ.hasOwnProperty(Q)?{space:EQ[Q],local:B}:B}function XQ(B){return function(){var Q=this.ownerDocument,F=this.namespaceURI;return F===mQ&&Q.documentElement.namespaceURI===mQ?Q.createElement(B):Q.createElementNS(F,B)}}function pQ(B){return function(){return this.ownerDocument.createElementNS(B.space,B.local)}}function WQ(B){var Q=NQ(B);return(Q.local?pQ:XQ)(Q)}function HQ(){}function DQ(B){return null==B?HQ:function(){return this.querySelector(B)}}function YQ(){return[]}function fQ(B){return null==B?YQ:function(){return this.querySelectorAll(B)}}function wQ(B){return function(){return function(B){return null==B?[]:Array.isArray(B)?B:Array.from(B)}(B.apply(this,arguments))}}function vQ(B){return function(){return this.matches(B)}}function JQ(B){return function(Q){return Q.matches(B)}}var kQ=Array.prototype.find;function MQ(){return this.firstElementChild}var TQ=Array.prototype.filter;function zQ(){return Array.from(this.children)}function KQ(B){return new Array(B.length)}function OQ(B,Q){this.ownerDocument=B.ownerDocument,this.namespaceURI=B.namespaceURI,this._next=null,this._parent=B,this.__data__=Q}function jQ(B,Q,F,U,t,s){for(var I,g=0,i=Q.length,l=s.length;g<l;++g)(I=Q[g])?(I.__data__=s[g],U[g]=I):F[g]=new OQ(B,s[g]);for(;g<i;++g)(I=Q[g])&&(t[g]=I)}function PQ(B,Q,F,U,t,s,I){var g,i,l,c=new Map,e=Q.length,n=s.length,C=new Array(e);for(g=0;g<e;++g)(i=Q[g])&&(C[g]=l=I.call(i,i.__data__,g,Q)+"",c.has(l)?t[g]=i:c.set(l,i));for(g=0;g<n;++g)l=I.call(B,s[g],g,s)+"",(i=c.get(l))?(U[g]=i,i.__data__=s[g],c.delete(l)):F[g]=new OQ(B,s[g]);for(g=0;g<e;++g)(i=Q[g])&&c.get(C[g])===i&&(t[g]=i)}function _Q(B){return B.__data__}function $Q(B){return"object"==typeof B&&"length"in B?B:Array.from(B)}function qQ(B,Q){return B<Q?-1:B>Q?1:B>=Q?0:NaN}function BF(B){return function(){this.removeAttribute(B)}}function QF(B){return function(){this.removeAttributeNS(B.space,B.local)}}function FF(B,Q){return function(){this.setAttribute(B,Q)}}function UF(B,Q){return function(){this.setAttributeNS(B.space,B.local,Q)}}function tF(B,Q){return function(){var F=Q.apply(this,arguments);null==F?this.removeAttribute(B):this.setAttribute(B,F)}}function sF(B,Q){return function(){var F=Q.apply(this,arguments);null==F?this.removeAttributeNS(B.space,B.local):this.setAttributeNS(B.space,B.local,F)}}function IF(B){return B.ownerDocument&&B.ownerDocument.defaultView||B.document&&B||B.defaultView}function gF(B){return function(){this.style.removeProperty(B)}}function iF(B,Q,F){return function(){this.style.setProperty(B,Q,F)}}function lF(B,Q,F){return function(){var U=Q.apply(this,arguments);null==U?this.style.removeProperty(B):this.style.setProperty(B,U,F)}}function cF(B,Q){return B.style.getPropertyValue(Q)||IF(B).getComputedStyle(B,null).getPropertyValue(Q)}function eF(B){return function(){delete this[B]}}function nF(B,Q){return function(){this[B]=Q}}function CF(B,Q){return function(){var F=Q.apply(this,arguments);null==F?delete this[B]:this[B]=F}}function dF(B){return B.trim().split(/^|\s+/)}function aF(B){return B.classList||new bF(B)}function bF(B){this._node=B,this._names=dF(B.getAttribute("class")||"")}function oF(B,Q){for(var F=aF(B),U=-1,t=Q.length;++U<t;)F.add(Q[U])}function GF(B,Q){for(var F=aF(B),U=-1,t=Q.length;++U<t;)F.remove(Q[U])}function uF(B){return function(){oF(this,B)}}function rF(B){return function(){GF(this,B)}}function xF(B,Q){return function(){(Q.apply(this,arguments)?oF:GF)(this,B)}}function AF(){this.textContent=""}function LF(B){return function(){this.textContent=B}}function hF(B){return function(){var Q=B.apply(this,arguments);this.textContent=null==Q?"":Q}}function yF(){this.innerHTML=""}function RF(B){return function(){this.innerHTML=B}}function ZF(B){return function(){var Q=B.apply(this,arguments);this.innerHTML=null==Q?"":Q}}function VF(){this.nextSibling&&this.parentNode.appendChild(this)}function SF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mF(){return null}function EF(){var B=this.parentNode;B&&B.removeChild(this)}function NF(){var B=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(B,this.nextSibling):B}function XF(){var B=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(B,this.nextSibling):B}function pF(B){return function(){var Q=this.__on;if(Q){for(var F,U=0,t=-1,s=Q.length;U<s;++U)F=Q[U],B.type&&F.type!==B.type||F.name!==B.name?Q[++t]=F:this.removeEventListener(F.type,F.listener,F.options);++t?Q.length=t:delete this.__on}}}function WF(B,Q,F){return function(){var U,t=this.__on,s=function(B){return function(Q){B.call(this,Q,this.__data__)}}(Q);if(t)for(var I=0,g=t.length;I<g;++I)if((U=t[I]).type===B.type&&U.name===B.name)return this.removeEventListener(U.type,U.listener,U.options),this.addEventListener(U.type,U.listener=s,U.options=F),void(U.value=Q);this.addEventListener(B.type,s,F),U={type:B.type,name:B.name,value:Q,listener:s,options:F},t?t.push(U):this.__on=[U]}}function HF(B,Q,F){var U=IF(B),t=U.CustomEvent;"function"==typeof t?t=new t(Q,F):(t=U.document.createEvent("Event"),F?(t.initEvent(Q,F.bubbles,F.cancelable),t.detail=F.detail):t.initEvent(Q,!1,!1)),B.dispatchEvent(t)}function DF(B,Q){return function(){return HF(this,B,Q)}}function YF(B,Q){return function(){return HF(this,B,Q.apply(this,arguments))}}OQ.prototype={constructor:OQ,appendChild:function(B){return this._parent.insertBefore(B,this._next)},insertBefore:function(B,Q){return this._parent.insertBefore(B,Q)},querySelector:function(B){return this._parent.querySelector(B)},querySelectorAll:function(B){return this._parent.querySelectorAll(B)}},bF.prototype={add:function(B){this._names.indexOf(B)<0&&(this._names.push(B),this._node.setAttribute("class",this._names.join(" ")))},remove:function(B){var Q=this._names.indexOf(B);Q>=0&&(this._names.splice(Q,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(B){return this._names.indexOf(B)>=0}};var fF=[null];function wF(B,Q){this._groups=B,this._parents=Q}function vF(){return new wF([[document.documentElement]],fF)}function JF(B){return"string"==typeof B?new wF([[document.querySelector(B)]],[document.documentElement]):new wF([[B]],fF)}function kF(B,Q){if(B=function(B){let Q;for(;Q=B.sourceEvent;)B=Q;return B}(B),void 0===Q&&(Q=B.currentTarget),Q){var F=Q.ownerSVGElement||Q;if(F.createSVGPoint){var U=F.createSVGPoint();return U.x=B.clientX,U.y=B.clientY,[(U=U.matrixTransform(Q.getScreenCTM().inverse())).x,U.y]}if(Q.getBoundingClientRect){var t=Q.getBoundingClientRect();return[B.clientX-t.left-Q.clientLeft,B.clientY-t.top-Q.clientTop]}}return[B.pageX,B.pageY]}wF.prototype=vF.prototype={constructor:wF,select:function(B){"function"!=typeof B&&(B=DQ(B));for(var Q=this._groups,F=Q.length,U=new Array(F),t=0;t<F;++t)for(var s,I,g=Q[t],i=g.length,l=U[t]=new Array(i),c=0;c<i;++c)(s=g[c])&&(I=B.call(s,s.__data__,c,g))&&("__data__"in s&&(I.__data__=s.__data__),l[c]=I);return new wF(U,this._parents)},selectAll:function(B){B="function"==typeof B?wQ(B):fQ(B);for(var Q=this._groups,F=Q.length,U=[],t=[],s=0;s<F;++s)for(var I,g=Q[s],i=g.length,l=0;l<i;++l)(I=g[l])&&(U.push(B.call(I,I.__data__,l,g)),t.push(I));return new wF(U,t)},selectChild:function(B){return this.select(null==B?MQ:function(B){return function(){return kQ.call(this.children,B)}}("function"==typeof B?B:JQ(B)))},selectChildren:function(B){return this.selectAll(null==B?zQ:function(B){return function(){return TQ.call(this.children,B)}}("function"==typeof B?B:JQ(B)))},filter:function(B){"function"!=typeof B&&(B=vQ(B));for(var Q=this._groups,F=Q.length,U=new Array(F),t=0;t<F;++t)for(var s,I=Q[t],g=I.length,i=U[t]=[],l=0;l<g;++l)(s=I[l])&&B.call(s,s.__data__,l,I)&&i.push(s);return new wF(U,this._parents)},data:function(B,Q){if(!arguments.length)return Array.from(this,_Q);var F=Q?PQ:jQ,U=this._parents,t=this._groups;"function"!=typeof B&&(B=function(B){return function(){return B}}(B));for(var s=t.length,I=new Array(s),g=new Array(s),i=new Array(s),l=0;l<s;++l){var c=U[l],e=t[l],n=e.length,C=$Q(B.call(c,c&&c.__data__,l,U)),d=C.length,a=g[l]=new Array(d),b=I[l]=new Array(d);F(c,e,a,b,i[l]=new Array(n),C,Q);for(var o,G,u=0,r=0;u<d;++u)if(o=a[u]){for(u>=r&&(r=u+1);!(G=b[r])&&++r<d;);o._next=G||null}}return(I=new wF(I,U))._enter=g,I._exit=i,I},enter:function(){return new wF(this._enter||this._groups.map(KQ),this._parents)},exit:function(){return new wF(this._exit||this._groups.map(KQ),this._parents)},join:function(B,Q,F){var U=this.enter(),t=this,s=this.exit();return"function"==typeof B?(U=B(U))&&(U=U.selection()):U=U.append(B+""),null!=Q&&(t=Q(t))&&(t=t.selection()),null==F?s.remove():F(s),U&&t?U.merge(t).order():t},merge:function(B){for(var Q=B.selection?B.selection():B,F=this._groups,U=Q._groups,t=F.length,s=U.length,I=Math.min(t,s),g=new Array(t),i=0;i<I;++i)for(var l,c=F[i],e=U[i],n=c.length,C=g[i]=new Array(n),d=0;d<n;++d)(l=c[d]||e[d])&&(C[d]=l);for(;i<t;++i)g[i]=F[i];return new wF(g,this._parents)},selection:function(){return this},order:function(){for(var B=this._groups,Q=-1,F=B.length;++Q<F;)for(var U,t=B[Q],s=t.length-1,I=t[s];--s>=0;)(U=t[s])&&(I&&4^U.compareDocumentPosition(I)&&I.parentNode.insertBefore(U,I),I=U);return this},sort:function(B){function Q(Q,F){return Q&&F?B(Q.__data__,F.__data__):!Q-!F}B||(B=qQ);for(var F=this._groups,U=F.length,t=new Array(U),s=0;s<U;++s){for(var I,g=F[s],i=g.length,l=t[s]=new Array(i),c=0;c<i;++c)(I=g[c])&&(l[c]=I);l.sort(Q)}return new wF(t,this._parents).order()},call:function(){var B=arguments[0];return arguments[0]=this,B.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var B=this._groups,Q=0,F=B.length;Q<F;++Q)for(var U=B[Q],t=0,s=U.length;t<s;++t){var I=U[t];if(I)return I}return null},size:function(){let B=0;for(const Q of this)++B;return B},empty:function(){return!this.node()},each:function(B){for(var Q=this._groups,F=0,U=Q.length;F<U;++F)for(var t,s=Q[F],I=0,g=s.length;I<g;++I)(t=s[I])&&B.call(t,t.__data__,I,s);return this},attr:function(B,Q){var F=NQ(B);if(arguments.length<2){var U=this.node();return F.local?U.getAttributeNS(F.space,F.local):U.getAttribute(F)}return this.each((null==Q?F.local?QF:BF:"function"==typeof Q?F.local?sF:tF:F.local?UF:FF)(F,Q))},style:function(B,Q,F){return arguments.length>1?this.each((null==Q?gF:"function"==typeof Q?lF:iF)(B,Q,null==F?"":F)):cF(this.node(),B)},property:function(B,Q){return arguments.length>1?this.each((null==Q?eF:"function"==typeof Q?CF:nF)(B,Q)):this.node()[B]},classed:function(B,Q){var F=dF(B+"");if(arguments.length<2){for(var U=aF(this.node()),t=-1,s=F.length;++t<s;)if(!U.contains(F[t]))return!1;return!0}return this.each(("function"==typeof Q?xF:Q?uF:rF)(F,Q))},text:function(B){return arguments.length?this.each(null==B?AF:("function"==typeof B?hF:LF)(B)):this.node().textContent},html:function(B){return arguments.length?this.each(null==B?yF:("function"==typeof B?ZF:RF)(B)):this.node().innerHTML},raise:function(){return this.each(VF)},lower:function(){return this.each(SF)},append:function(B){var Q="function"==typeof B?B:WQ(B);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})},insert:function(B,Q){var F="function"==typeof B?B:WQ(B),U=null==Q?mF:"function"==typeof Q?Q:DQ(Q);return this.select(function(){return this.insertBefore(F.apply(this,arguments),U.apply(this,arguments)||null)})},remove:function(){return this.each(EF)},clone:function(B){return this.select(B?XF:NF)},datum:function(B){return arguments.length?this.property("__data__",B):this.node().__data__},on:function(B,Q,F){var U,t,s=function(B){return B.trim().split(/^|\s+/).map(function(B){var Q="",F=B.indexOf(".");return F>=0&&(Q=B.slice(F+1),B=B.slice(0,F)),{type:B,name:Q}})}(B+""),I=s.length;if(!(arguments.length<2)){for(g=Q?WF:pF,U=0;U<I;++U)this.each(g(s[U],Q,F));return this}var g=this.node().__on;if(g)for(var i,l=0,c=g.length;l<c;++l)for(U=0,i=g[l];U<I;++U)if((t=s[U]).type===i.type&&t.name===i.name)return i.value},dispatch:function(B,Q){return this.each(("function"==typeof Q?YF:DF)(B,Q))},[Symbol.iterator]:function*(){for(var B=this._groups,Q=0,F=B.length;Q<F;++Q)for(var U,t=B[Q],s=0,I=t.length;s<I;++s)(U=t[s])&&(yield U)}};const MF={passive:!1},TF={capture:!0,passive:!1};function zF(B){B.stopImmediatePropagation()}function KF(B){B.preventDefault(),B.stopImmediatePropagation()}var OF=B=>()=>B;function jF(B,{sourceEvent:Q,subject:F,target:U,identifier:t,active:s,x:I,y:g,dx:i,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:B,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},subject:{value:F,enumerable:!0,configurable:!0},target:{value:U,enumerable:!0,configurable:!0},identifier:{value:t,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:I,enumerable:!0,configurable:!0},y:{value:g,enumerable:!0,configurable:!0},dx:{value:i,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}function PF(B){return!B.ctrlKey&&!B.button}function _F(){return this.parentNode}function $F(B,Q){return null==Q?{x:B.x,y:B.y}:Q}function qF(){return navigator.maxTouchPoints||"ontouchstart"in this}function BU(){var B,Q,F,U,t=PF,s=_F,I=$F,g=qF,i={},l=RQ("start","drag","end"),c=0,e=0;function n(B){B.on("mousedown.drag",C).filter(g).on("touchstart.drag",b).on("touchmove.drag",o,MF).on("touchend.drag touchcancel.drag",G).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function C(I,g){if(!U&&t.call(this,I,g)){var i=u(this,s.call(this,I,g),I,g,"mouse");i&&(JF(I.view).on("mousemove.drag",d,TF).on("mouseup.drag",a,TF),function(B){var Q=B.document.documentElement,F=JF(B).on("dragstart.drag",KF,TF);"onselectstart"in Q?F.on("selectstart.drag",KF,TF):(Q.__noselect=Q.style.MozUserSelect,Q.style.MozUserSelect="none")}(I.view),zF(I),F=!1,B=I.clientX,Q=I.clientY,i("start",I))}}function d(U){if(KF(U),!F){var t=U.clientX-B,s=U.clientY-Q;F=t*t+s*s>e}i.mouse("drag",U)}function a(B){JF(B.view).on("mousemove.drag mouseup.drag",null),function(B,Q){var F=B.document.documentElement,U=JF(B).on("dragstart.drag",null);Q&&(U.on("click.drag",KF,TF),setTimeout(function(){U.on("click.drag",null)},0)),"onselectstart"in F?U.on("selectstart.drag",null):(F.style.MozUserSelect=F.__noselect,delete F.__noselect)}(B.view,F),KF(B),i.mouse("end",B)}function b(B,Q){if(t.call(this,B,Q)){var F,U,I=B.changedTouches,g=s.call(this,B,Q),i=I.length;for(F=0;F<i;++F)(U=u(this,g,B,Q,I[F].identifier,I[F]))&&(zF(B),U("start",B,I[F]))}}function o(B){var Q,F,U=B.changedTouches,t=U.length;for(Q=0;Q<t;++Q)(F=i[U[Q].identifier])&&(KF(B),F("drag",B,U[Q]))}function G(B){var Q,F,t=B.changedTouches,s=t.length;for(U&&clearTimeout(U),U=setTimeout(function(){U=null},500),Q=0;Q<s;++Q)(F=i[t[Q].identifier])&&(zF(B),F("end",B,t[Q]))}function u(B,Q,F,U,t,s){var g,e,C,d=l.copy(),a=kF(s||F,Q);if(null!=(C=I.call(B,new jF("beforestart",{sourceEvent:F,target:n,identifier:t,active:c,x:a[0],y:a[1],dx:0,dy:0,dispatch:d}),U)))return g=C.x-a[0]||0,e=C.y-a[1]||0,function F(s,I,l){var b,o=a;switch(s){case"start":i[t]=F,b=c++;break;case"end":delete i[t],--c;case"drag":a=kF(l||I,Q),b=c}d.call(s,B,new jF(s,{sourceEvent:I,subject:C,target:n,identifier:t,active:b,x:a[0]+g,y:a[1]+e,dx:a[0]-o[0],dy:a[1]-o[1],dispatch:d}),U)}}return n.filter=function(B){return arguments.length?(t="function"==typeof B?B:OF(!!B),n):t},n.container=function(B){return arguments.length?(s="function"==typeof B?B:OF(B),n):s},n.subject=function(B){return arguments.length?(I="function"==typeof B?B:OF(B),n):I},n.touchable=function(B){return arguments.length?(g="function"==typeof B?B:OF(!!B),n):g},n.on=function(){var B=l.on.apply(l,arguments);return B===l?n:B},n.clickDistance=function(B){return arguments.length?(e=(B=+B)*B,n):Math.sqrt(e)},n}function QU(B,Q,F){B.prototype=Q.prototype=F,F.constructor=B}function FU(B,Q){var F=Object.create(B.prototype);for(var U in Q)F[U]=Q[U];return F}function UU(){}jF.prototype.on=function(){var B=this._.on.apply(this._,arguments);return B===this._?this:B};var tU=.7,sU=1/tU,IU="\\s*([+-]?\\d+)\\s*",gU="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",iU="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lU=/^#([0-9a-f]{3,8})$/,cU=new RegExp(`^rgb\\(${IU},${IU},${IU}\\)$`),eU=new RegExp(`^rgb\\(${iU},${iU},${iU}\\)$`),nU=new RegExp(`^rgba\\(${IU},${IU},${IU},${gU}\\)$`),CU=new RegExp(`^rgba\\(${iU},${iU},${iU},${gU}\\)$`),dU=new RegExp(`^hsl\\(${gU},${iU},${iU}\\)$`),aU=new RegExp(`^hsla\\(${gU},${iU},${iU},${gU}\\)$`),bU={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};function oU(){return this.rgb().formatHex()}function GU(){return this.rgb().formatRgb()}function uU(B){var Q,F;return B=(B+"").trim().toLowerCase(),(Q=lU.exec(B))?(F=Q[1].length,Q=parseInt(Q[1],16),6===F?rU(Q):3===F?new hU(Q>>8&15|Q>>4&240,Q>>4&15|240&Q,(15&Q)<<4|15&Q,1):8===F?xU(Q>>24&255,Q>>16&255,Q>>8&255,(255&Q)/255):4===F?xU(Q>>12&15|Q>>8&240,Q>>8&15|Q>>4&240,Q>>4&15|240&Q,((15&Q)<<4|15&Q)/255):null):(Q=cU.exec(B))?new hU(Q[1],Q[2],Q[3],1):(Q=eU.exec(B))?new hU(255*Q[1]/100,255*Q[2]/100,255*Q[3]/100,1):(Q=nU.exec(B))?xU(Q[1],Q[2],Q[3],Q[4]):(Q=CU.exec(B))?xU(255*Q[1]/100,255*Q[2]/100,255*Q[3]/100,Q[4]):(Q=dU.exec(B))?mU(Q[1],Q[2]/100,Q[3]/100,1):(Q=aU.exec(B))?mU(Q[1],Q[2]/100,Q[3]/100,Q[4]):bU.hasOwnProperty(B)?rU(bU[B]):"transparent"===B?new hU(NaN,NaN,NaN,0):null}function rU(B){return new hU(B>>16&255,B>>8&255,255&B,1)}function xU(B,Q,F,U){return U<=0&&(B=Q=F=NaN),new hU(B,Q,F,U)}function AU(B){return B instanceof UU||(B=uU(B)),B?new hU((B=B.rgb()).r,B.g,B.b,B.opacity):new hU}function LU(B,Q,F,U){return 1===arguments.length?AU(B):new hU(B,Q,F,null==U?1:U)}function hU(B,Q,F,U){this.r=+B,this.g=+Q,this.b=+F,this.opacity=+U}function yU(){return`#${SU(this.r)}${SU(this.g)}${SU(this.b)}`}function RU(){const B=ZU(this.opacity);return`${1===B?"rgb(":"rgba("}${VU(this.r)}, ${VU(this.g)}, ${VU(this.b)}${1===B?")":`, ${B})`}`}function ZU(B){return isNaN(B)?1:Math.max(0,Math.min(1,B))}function VU(B){return Math.max(0,Math.min(255,Math.round(B)||0))}function SU(B){return((B=VU(B))<16?"0":"")+B.toString(16)}function mU(B,Q,F,U){return U<=0?B=Q=F=NaN:F<=0||F>=1?B=Q=NaN:Q<=0&&(B=NaN),new XU(B,Q,F,U)}function EU(B){if(B instanceof XU)return new XU(B.h,B.s,B.l,B.opacity);if(B instanceof UU||(B=uU(B)),!B)return new XU;if(B instanceof XU)return B;var Q=(B=B.rgb()).r/255,F=B.g/255,U=B.b/255,t=Math.min(Q,F,U),s=Math.max(Q,F,U),I=NaN,g=s-t,i=(s+t)/2;return g?(I=Q===s?(F-U)/g+6*(F<U):F===s?(U-Q)/g+2:(Q-F)/g+4,g/=i<.5?s+t:2-s-t,I*=60):g=i>0&&i<1?0:I,new XU(I,g,i,B.opacity)}function NU(B,Q,F,U){return 1===arguments.length?EU(B):new XU(B,Q,F,null==U?1:U)}function XU(B,Q,F,U){this.h=+B,this.s=+Q,this.l=+F,this.opacity=+U}function pU(B){return(B=(B||0)%360)<0?B+360:B}function WU(B){return Math.max(0,Math.min(1,B||0))}function HU(B,Q,F){return 255*(B<60?Q+(F-Q)*B/60:B<180?F:B<240?Q+(F-Q)*(240-B)/60:Q)}QU(UU,uU,{c