@decidables/detectable-elements
Version:
detectable-elements: Web Components for visualizing Signal Detection Theory
22 lines • 318 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).detectableElements={})}(this,function(t){"use strict";
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const e=globalThis,r=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;let s=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(e,t))}return t}toString(){return this.cssText}};const a=t=>new s("string"==typeof t?t:t+"",void 0,n),o=(t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1],t[0]);return new s(r,t,n)},l=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return a(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:d,getOwnPropertySymbols:f,getPrototypeOf:p}=Object,m=globalThis,b=m.trustedTypes,g=b?b.emptyScript:"",v=m.reactiveElementPolyfillSupport,y=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},x=(t,e)=>!c(t,e),$={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:x};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:i}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const s=n?.call(this);i?.call(this,e),this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...d(t),...f(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,n)=>{if(r)t.adoptedStyleSheets=n.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const r of n){const n=document.createElement("style"),i=e.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:w).toAttribute(e,r.type);this._$Em=t,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){const r=this.constructor,n=r._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=r.getPropertyOptions(n),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=n;const s=i.fromAttribute(e,t.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){const n=this.constructor,i=this[t];if(r??=n.getPropertyOptions(t),!((r.hasChanged??x)(i,e)||r.useDefault&&r.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:i},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),!0!==i||void 0!==s)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,r,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[y("elementProperties")]=new Map,k[y("finalized")]=new Map,v?.({ReactiveElement:k}),(m.reactiveElementVersions??=[]).push("2.1.1");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const _=globalThis,S=_.trustedTypes,A=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",M=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+M,N=`<${T}>`,C=document,R=()=>C.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,F="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,D=/>/g,I=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),O=/'/g,H=/"/g,L=/^(?:script|style|textarea|title)$/i,j=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),B=j(1),V=j(2),X=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),W=new WeakMap,G=C.createTreeWalker(C,129);function Y(t,e){if(!q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const Z=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":3===e?"<math>":"",a=z;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===z?"!--"===l[1]?a=U:void 0!==l[1]?a=D:void 0!==l[2]?(L.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=I):void 0!==l[3]&&(a=I):a===I?">"===l[0]?(a=i??z,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?I:'"'===l[3]?H:O):a===H||a===O?a=I:a===U||a===D?a=z:(a=I,i=void 0);const u=a===I&&t[e+1].startsWith("/>")?" ":"";s+=a===z?r+N:c>=0?(n.push(o),r.slice(0,c)+E+r.slice(c)+M+u):r+M+(-2===c?e:u)}return[Y(t,s+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class J{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0;const a=t.length-1,o=this.parts,[l,c]=Z(t,e);if(this.el=J.createElement(l,r),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=G.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(E)){const e=c[s++],r=n.getAttribute(t).split(M),a=/([.?@])?(.*)/.exec(e);o.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?nt:"?"===a[1]?it:"@"===a[1]?st:rt}),n.removeAttribute(t)}else t.startsWith(M)&&(o.push({type:6,index:i}),n.removeAttribute(t));if(L.test(n.tagName)){const t=n.textContent.split(M),e=t.length-1;if(e>0){n.textContent=S?S.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],R()),G.nextNode(),o.push({type:2,index:++i});n.append(t[e],R())}}}else if(8===n.nodeType)if(n.data===T)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(M,t+1));)o.push({type:7,index:i}),t+=M.length-1}i++}}static createElement(t,e){const r=C.createElement("template");return r.innerHTML=t,r}}function Q(t,e,r=t,n){if(e===X)return e;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const s=P(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),void 0===s?i=void 0:(i=new s(t),i._$AT(t,r,n)),void 0!==n?(r._$Co??=[])[n]=i:r._$Cl=i),void 0!==i&&(e=Q(t,i._$AS(t,e.values),i,n)),e}class tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??C).importNode(e,!0);G.currentNode=n;let i=G.nextNode(),s=0,a=0,o=r[0];for(;void 0!==o;){if(s===o.index){let e;2===o.type?e=new et(i,i.nextSibling,this,t):1===o.type?e=new o.ctor(i,o.name,o.strings,this,t):6===o.type&&(e=new at(i,this,t)),this._$AV.push(e),o=r[++a]}s!==o?.index&&(i=G.nextNode(),s++)}return G.currentNode=C,n}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),P(t)?t===K||null==t||""===t?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==X&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>q(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==K&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,n="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=J.createElement(Y(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new tt(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new J(t)),e}k(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new et(this.O(R()),this.O(R()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=K,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=K}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=Q(this,t,e,0),s=!P(t)||t!==this._$AH&&t!==X,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=Q(this,n[r+a],e,a),o===X&&(o=this._$AH[a]),s||=!P(o)||o!==this._$AH[a],o===K?t=K:t!==K&&(t+=(o??"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class nt extends rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}}class it extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}}class st extends rt{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??K)===X)return;const r=this._$AH,n=t===K&&r!==K||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==K&&(r===K||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const ot=_.litHtmlPolyfillSupport;ot?.(J,et),(_.litHtmlVersions??=[]).push("3.3.1");const lt=globalThis;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class ct extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const n=r?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=r?.renderBefore??null;n._$litPart$=i=new et(e.insertBefore(R(),t),t,void 0,r??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ct._$litElement$=!0,ct.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ct});const ht=lt.litElementPolyfillSupport;function ut(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function dt(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ft(t){let e,r,n;function i(t,n,i=0,s=t.length){if(i<s){if(0!==e(n,n))return s;do{const e=i+s>>>1;r(t[e],n)<0?i=e+1:s=e}while(i<s)}return i}return 2!==t.length?(e=ut,r=(e,r)=>ut(t(e),r),n=(e,r)=>t(e)-r):(e=t===ut||t===dt?t:pt,r=t,n=t),{left:i,center:function(t,e,r=0,s=t.length){const a=i(t,e,r,s-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,i=0,s=t.length){if(i<s){if(0!==e(n,n))return s;do{const e=i+s>>>1;r(t[e],n)<=0?i=e+1:s=e}while(i<s)}return i}}}function pt(){return 0}ht?.({LitElement:ct}),(lt.litElementVersions??=[]).push("4.2.1");const mt=ft(ut).right;function bt(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}ft(function(t){return null===t?NaN:+t}).center;class gt{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n<this._n&&n<32;n++){const i=e[n],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(e[r++]=a),t=s}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,r=t[--i],s=e+r,n=r-(s-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=s+r,r==e-s&&(s=e))}return s}}function vt(t){return t}var yt=Array.prototype.slice;function wt(t){return()=>t}const xt=Math.sqrt(50),$t=Math.sqrt(10),kt=Math.sqrt(2);function _t(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),s=n/Math.pow(10,i),a=s>=xt?10:s>=$t?5:s>=kt?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=r&&r<2?_t(t,e,2*r):[o,l,c]}function St(t,e,r){if(!((r=+r)>0))return[];if((t=+t)===(e=+e))return[t];const n=e<t,[i,s,a]=n?_t(e,t,r):_t(t,e,r);if(!(s>=i))return[];const o=s-i+1,l=new Array(o);if(n)if(a<0)for(let t=0;t<o;++t)l[t]=(s-t)/-a;else for(let t=0;t<o;++t)l[t]=(s-t)*a;else if(a<0)for(let t=0;t<o;++t)l[t]=(i+t)/-a;else for(let t=0;t<o;++t)l[t]=(i+t)*a;return l}function At(t,e,r){return _t(t=+t,e=+e,r=+r)[2]}function Et(t,e,r){let n;for(;;){const i=At(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}function Mt(t){return Math.max(1,Math.ceil(Math.log(function(t){let e=0;for(let r of t)null!=r&&(r=+r)>=r&&++e;return e}(t))/Math.LN2)+1)}function Tt(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function Nt(t){return t}var Ct=1e-6;function Rt(t){return"translate("+t+",0)"}function Pt(t){return"translate(0,"+t+")"}function qt(t){return e=>+t(e)}function Ft(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function zt(){return!this.__axis}function Ut(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",u=1===t||3===t?Rt:Pt;function d(d){var f=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,p=null==i?e.tickFormat?e.tickFormat.apply(e,r):Nt:i,m=Math.max(s,0)+o,b=e.range(),g=+b[0]+l,v=+b[b.length-1]+l,y=(e.bandwidth?Ft:qt)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),$=w.selectAll(".tick").data(f,e).order(),k=$.exit(),_=$.enter().append("g").attr("class","tick"),S=$.select("line"),A=$.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(_),S=S.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),A=A.merge(_.append("text").attr("fill","currentColor").attr(h,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),$=$.transition(d),S=S.transition(d),A=A.transition(d),k=k.transition(d).attr("opacity",Ct).attr("transform",function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")}),_.attr("opacity",Ct).attr("transform",function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)})),k.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+g+"H"+l+"V"+v+"H"+c*a:"M"+l+","+g+"V"+v:a?"M"+g+","+c*a+"V"+l+"H"+v+"V"+c*a:"M"+g+","+l+"H"+v),$.attr("opacity",1).attr("transform",function(t){return u(y(t)+l)}),S.attr(h+"2",c*s),A.attr(h,c*m).text(p),w.filter(zt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each(function(){this.__axis=y})}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),d):r.slice()},d.tickValues=function(t){return arguments.length?(n=null==t?null:Array.from(t),d):n&&n.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(s=a=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Dt(t){return Ut(3,t)}function It(t){return Ut(4,t)}var Ot={value:()=>{}};function Ht(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Lt(n)}function Lt(t){this._=t}function jt(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Bt(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=Ot,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Lt.prototype=Ht.prototype={constructor:Lt,on:function(t,e){var r,n,i=this._,s=(n=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,o=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(r=(t=s[a]).type)i[r]=Bt(i[r],t.name,e);else if(null==e)for(r in i)i[r]=Bt(i[r],t.name,null);return this}for(;++a<o;)if((r=(t=s[a]).type)&&(r=jt(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Lt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var Vt="http://www.w3.org/1999/xhtml",Xt={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Kt(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Xt.hasOwnProperty(e)?{space:Xt[e],local:t}:t}function Wt(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(r,t)}}function Gt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Yt(t){var e=Kt(t);return(e.local?Gt:Wt)(e)}function Zt(){}function Jt(t){return null==t?Zt:function(){return this.querySelector(t)}}function Qt(){return[]}function te(t){return null==t?Qt:function(){return this.querySelectorAll(t)}}function ee(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function re(t){return function(){return this.matches(t)}}function ne(t){return function(e){return e.matches(t)}}var ie=Array.prototype.find;function se(){return this.firstElementChild}var ae=Array.prototype.filter;function oe(){return Array.from(this.children)}function le(t){return new Array(t.length)}function ce(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function he(t,e,r,n,i,s){for(var a,o=0,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new ce(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function ue(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,f=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(f[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new ce(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(f[o])===l&&(i[o]=l)}function de(t){return t.__data__}function fe(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function pe(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function me(t){return function(){this.removeAttribute(t)}}function be(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ge(t,e){return function(){this.setAttribute(t,e)}}function ve(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ye(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function we(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function xe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function $e(t){return function(){this.style.removeProperty(t)}}function ke(t,e,r){return function(){this.style.setProperty(t,e,r)}}function _e(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function Se(t,e){return t.style.getPropertyValue(e)||xe(t).getComputedStyle(t,null).getPropertyValue(e)}function Ae(t){return function(){delete this[t]}}function Ee(t,e){return function(){this[t]=e}}function Me(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function Te(t){return t.trim().split(/^|\s+/)}function Ne(t){return t.classList||new Ce(t)}function Ce(t){this._node=t,this._names=Te(t.getAttribute("class")||"")}function Re(t,e){for(var r=Ne(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Pe(t,e){for(var r=Ne(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function qe(t){return function(){Re(this,t)}}function Fe(t){return function(){Pe(this,t)}}function ze(t,e){return function(){(e.apply(this,arguments)?Re:Pe)(this,t)}}function Ue(){this.textContent=""}function De(t){return function(){this.textContent=t}}function Ie(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Oe(){this.innerHTML=""}function He(t){return function(){this.innerHTML=t}}function Le(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function je(){this.nextSibling&&this.parentNode.appendChild(this)}function Be(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ve(){return null}function Xe(){var t=this.parentNode;t&&t.removeChild(this)}function Ke(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function We(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ge(t){return function(){var e=this.__on;if(e){for(var r,n=0,i=-1,s=e.length;n<s;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?e.length=i:delete this.__on}}}function Ye(t,e,r){return function(){var n,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),void(n.value=e);this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function Ze(t,e,r){var n=xe(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Je(t,e){return function(){return Ze(this,t,e)}}function Qe(t,e){return function(){return Ze(this,t,e.apply(this,arguments))}}ce.prototype={constructor:ce,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)}},Ce.prototype={add:function(t){this._names.indexOf(t)<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}};var tr=[null];function er(t,e){this._groups=t,this._parents=e}function rr(){return new er([[document.documentElement]],tr)}function nr(t){return"string"==typeof t?new er([[document.querySelector(t)]],[document.documentElement]):new er([[t]],tr)}function ir(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}er.prototype=rr.prototype={constructor:er,select:function(t){"function"!=typeof t&&(t=Jt(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a,o=e[i],l=o.length,c=n[i]=new Array(l),h=0;h<l;++h)(s=o[h])&&(a=t.call(s,s.__data__,h,o))&&("__data__"in s&&(a.__data__=s.__data__),c[h]=a);return new er(n,this._parents)},selectAll:function(t){t="function"==typeof t?ee(t):te(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var a,o=e[s],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),i.push(a));return new er(n,i)},selectChild:function(t){return this.select(null==t?se:function(t){return function(){return ie.call(this.children,t)}}("function"==typeof t?t:ne(t)))},selectChildren:function(t){return this.selectAll(null==t?oe:function(t){return function(){return ae.call(this.children,t)}}("function"==typeof t?t:ne(t)))},filter:function(t){"function"!=typeof t&&(t=re(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new er(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,de);var r=e?ue:he,n=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,f=fe(t.call(h,h&&h.__data__,c,n)),p=f.length,m=o[c]=new Array(p),b=a[c]=new Array(p);r(h,u,m,b,l[c]=new Array(d),f,e);for(var g,v,y=0,w=0;y<p;++y)if(g=m[y]){for(y>=w&&(w=y+1);!(v=b[w])&&++w<p;);g._next=v||null}}return(a=new er(a,n))._enter=o,a._exit=l,a},enter:function(){return new er(this._enter||this._groups.map(le),this._parents)},exit:function(){return new er(this._exit||this._groups.map(le),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,f=o[l]=new Array(d),p=0;p<d;++p)(c=h[p]||u[p])&&(f[p]=c);for(;l<i;++l)o[l]=r[l];return new er(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,i=t[e],s=i.length-1,a=i[s];--s>=0;)(n=i[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}t||(t=pe);for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var a,o=r[s],l=o.length,c=i[s]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new er(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var a=n[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i,s=e[r],a=0,o=s.length;a<o;++a)(i=s[a])&&t.call(i,i.__data__,a,s);return this},attr:function(t,e){var r=Kt(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==e?r.local?be:me:"function"==typeof e?r.local?we:ye:r.local?ve:ge)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?$e:"function"==typeof e?_e:ke)(t,e,null==r?"":r)):Se(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ae:"function"==typeof e?Me:Ee)(t,e)):this.node()[t]},classed:function(t,e){var r=Te(t+"");if(arguments.length<2){for(var n=Ne(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?ze:e?qe:Fe)(r,e))},text:function(t){return arguments.length?this.each(null==t?Ue:("function"==typeof t?Ie:De)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Oe:("function"==typeof t?Le:He)(t)):this.node().innerHTML},raise:function(){return this.each(je)},lower:function(){return this.each(Be)},append:function(t){var e="function"==typeof t?t:Yt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var r="function"==typeof t?t:Yt(t),n=null==e?Ve:"function"==typeof e?e:Jt(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(Xe)},clone:function(t){return this.select(t?We:Ke)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,i,s=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}})}(t+""),a=s.length;if(!(arguments.length<2)){for(o=e?Ye:Ge,n=0;n<a;++n)this.each(o(s[n],e,r));return this}var o=this.node().__on;if(o)for(var l,c=0,h=o.length;c<h;++c)for(n=0,l=o[c];n<a;++n)if((i=s[n]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Qe:Je)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,i=t[e],s=0,a=i.length;s<a;++s)(n=i[s])&&(yield n)}};const sr={passive:!1},ar={capture:!0,passive:!1};function or(t){t.stopImmediatePropagation()}function lr(t){t.preventDefault(),t.stopImmediatePropagation()}var cr=t=>()=>t;function hr(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:s,x:a,y:o,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function ur(t){return!t.ctrlKey&&!t.button}function dr(){return this.parentNode}function fr(t,e){return null==e?{x:t.x,y:t.y}:e}function pr(){return navigator.maxTouchPoints||"ontouchstart"in this}function mr(){var t,e,r,n,i=ur,s=dr,a=fr,o=pr,l={},c=Ht("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",f).filter(o).on("touchstart.drag",b).on("touchmove.drag",g,sr).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(nr(a.view).on("mousemove.drag",p,ar).on("mouseup.drag",m,ar),function(t){var e=t.document.documentElement,r=nr(t).on("dragstart.drag",lr,ar);"onselectstart"in e?r.on("selectstart.drag",lr,ar):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),or(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(n){if(lr(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){nr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=nr(t).on("dragstart.drag",null);e&&(n.on("click.drag",lr,ar),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(t.view,r),lr(t),l.mouse("end",t)}function b(t,e){if(i.call(this,t,e)){var r,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(or(t),n("start",t,a[r]))}}function g(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(lr(t),r("drag",t,n[e]))}function v(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout(function(){n=null},500),e=0;e<s;++e)(r=l[i[e].identifier])&&(or(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,f,p=c.copy(),m=ir(s||r,e);if(null!=(f=a.call(t,new hr("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),n)))return o=f.x-m[0]||0,u=f.y-m[1]||0,function r(s,a,c){var b,g=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=ir(c||a,e),b=h}p.call(s,t,new hr(s,{sourceEvent:a,subject:f,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-g[0],dy:m[1]-g[1],dispatch:p}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:cr(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:cr(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:cr(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:cr(!!t),d):o},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,d):Math.sqrt(u)},d}function br(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function gr(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function vr(){}hr.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var yr=.7,wr=1/yr,xr="\\s*([+-]?\\d+)\\s*",$r="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",kr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_r=/^#([0-9a-f]{3,8})$/,Sr=new RegExp(`^rgb\\(${xr},${xr},${xr}\\)$`),Ar=new RegExp(`^rgb\\(${kr},${kr},${kr}\\)$`),Er=new RegExp(`^rgba\\(${xr},${xr},${xr},${$r}\\)$`),Mr=new RegExp(`^rgba\\(${kr},${kr},${kr},${$r}\\)$`),Tr=new RegExp(`^hsl\\(${$r},${kr},${kr}\\)$`),Nr=new RegExp(`^hsla\\(${$r},${kr},${kr},${$r}\\)$`),Cr={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 Rr(){return this.rgb().formatHex()}function Pr(){return this.rgb().formatRgb()}function qr(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=_r.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?Fr(e):3===r?new Dr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?zr(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?zr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Sr.exec(t))?new Dr(e[1],e[2],e[3],1):(e=Ar.exec(t))?new Dr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Er.exec(t))?zr(e[1],e[2],e[3],e[4]):(e=Mr.exec(t))?zr(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Tr.exec(t))?Br(e[1],e[2]/100,e[3]/100,1):(e=Nr.exec(t))?Br(e[1],e[2]/100,e[3]/100,e[4]):Cr.hasOwnProperty(t)?Fr(Cr[t]):"transparent"===t?new Dr(NaN,NaN,NaN,0):null}function Fr(t){return new Dr(t>>16&255,t>>8&255,255&t,1)}function zr(t,e,r,n){return n<=0&&(t=e=r=NaN),new Dr(t,e,r,n)}function Ur(t,e,r,n){return 1===arguments.length?function(t){return t instanceof vr||(t=qr(t)),t?new Dr((t=t.rgb()).r,t.g,t.b,t.opacity):new Dr}(t):new Dr(t,e,r,null==n?1:n)}function Dr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Ir(){return`#${jr(this.r)}${jr(this.g)}${jr(this.b)}`}function Or(){const t=Hr(this.opacity);return`${1===t?"rgb(":"rgba("}${Lr(this.r)}, ${Lr(this.g)}, ${Lr(this.b)}${1===t?")":`, ${t})`}`}function Hr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Lr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function jr(t){return((t=Lr(t))<16?"0":"")+t.toString(16)}function Br(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Xr(t,e,r,n)}function Vr(t){if(t instanceof Xr)return new Xr(t.h,t.s,t.l,t.opacity);if(t instanceof vr||(t=qr(t)),!t)return new Xr;if(t instanceof Xr)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(a=e===s?(r-n)/o+6*(r<n):r===s?(n-e)/o+2:(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new Xr(a,o,l,t.opacity)}function Xr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Kr(t){return(t=(t||0)%360)<0?t+360:t}function Wr(t){return Math.max(0,Math.min(1,t||0))}function Gr(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}br(vr,qr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rr,formatHex:Rr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Vr(this).formatHsl()},formatRgb:Pr,toString:Pr}),br(Dr,Ur,gr(vr,{brighter(t){return t=null==t?wr:Math.pow(wr,t),new Dr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?yr:Math.pow(yr,t),new Dr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Dr(Lr(this.r),Lr(this.g),Lr(this.b),Hr(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:Ir,formatHex:Ir,formatHex8:function(){return`#${jr(this.r)}${jr(this.g)}${jr(this.b)}${jr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Or,toString:Or})),br(Xr,function(t,e,r,n){return 1===arguments.length?Vr(t):new Xr(t,e,r,null==n?1:n)},gr(vr,{brighter(t){return t=null==t?wr:Math.pow(wr,t),new Xr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?yr:Math.pow(yr,t),new Xr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Dr(Gr(t>=240?t-240:t+120,i,n),Gr(t,i,n),Gr(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Xr(Kr(this.h),Wr(this.s),Wr(this.l),Hr(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(){const t=Hr(this.opacity);return`${1===t?"hsl(":"hsla("}${Kr(this.h)}, ${100*Wr(this.s)}%, ${100*Wr(this.l)}%${1===t?")":`, ${t})`}`}}));var Yr=t=>()=>t;function Zr(t){return 1===(t=+t)?Jr:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):Yr(isNaN(e)?r:e)}}function Jr(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Yr(isNaN(t)?e:t)}var Qr=function t(e){var r=Zr(e);function n(t,e){var n=r((t=Ur(t)).r,(e=Ur(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=Jr(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function tn(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function en(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n);for(r=0;r<i;++r)s[r]=cn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=s[r](t);return a}}function rn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function nn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function sn(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=cn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var an=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,on=new RegExp(an.source,"g");function ln(t,e){var r,n,i,s=an.lastIndex=on.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=an.exec(t))&&(n=on.exec(e));)(i=n.index)>s&&(i=e.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:nn(r,n)})),s=on.lastIndex;return s<e.length&&(i=e.slice(s),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)o[(r=l[n]).i]=r.x(t);return o.join("")})}function cn(t,e){var r,n=typeof e;return null==e||"boolean"===n?Yr(e):("number"===n?nn:"string"===n?(r=qr(e))?(e=r,Qr):ln:e instanceof qr?Qr:e instanceof Date?rn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?tn:Array.isArray(e)?en:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?sn:nn)(t,e)}function hn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var un,dn=180/Math.PI,fn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pn(t,e,r,n,i,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*dn,skewX:Math.atan(l)*dn,scaleX:a,scaleY:o}}function mn(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(s,a){var o=[],l=[];return s=t(s),a=t(a),function(t,n,i,s,a,o){if(t!==i||n!==s){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:nn(t,i)},{i:l-2,x:nn(n,s)})}else(i||s)&&a.push("translate("+i+e+s+r)}(s.translateX,s.translateY,a.translateX,a.translateY,o,l),function(t,e,r,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:r.push(i(r)+"rotate(",null,n)-2,x:nn(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,r,s){t!==e?s.push({i:r.push(i(r)+"skewX(",null,n)-2,x:nn(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,r,n,s,a){if(t!==r||e!==n){var o=s.push(i(s)+"scale(",null,",",null,")");a.push({i:o-4,x:nn(t,r)},{i:o-2,x:nn(e,n)})}else 1===r&&1===n||s.push(i(s)+"scale("+r+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,r=-1,n=l.length;++r<n;)o[(e=l[r]).i]=e.x(t);return o.join("")}}}var bn,gn,vn=mn(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?fn:pn(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),yn=mn(function(t){return null==t?fn:(un||(un=document.createElementNS("http://www.w3.org/2000/svg","g")),un.setAttribute("transform",t),(t=un.transform.baseVal.consolidate())?pn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):fn)},", ",")",")"),wn=0,xn=0,$n=0,kn=0,_n=0,Sn=0,A