UNPKG

@decidables/prospectable-elements

Version:

prospectable-elements: Web Components for visualizing Cumulative Prospect Theory

23 lines 2.49 MB
!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).prospectableElements={})}(this,(function(t){"use strict";function e(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(i){if("default"!==i&&!(i in t)){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}}))})),Object.freeze(t)} /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),a=new WeakMap;let s=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==r)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(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&a.set(e,t))}return t}toString(){return this.cssText}};const o=t=>new s("string"==typeof t?t:t+"",void 0,r),l=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,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.")})(i)+t[n+1]),t[0]);return new s(i,t,r)},c=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return o(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,{is:g,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:h,getOwnPropertySymbols:B,getPrototypeOf:p}=Object,F=globalThis,f=F.trustedTypes,Q=f?f.emptyScript:"",I=F.reactiveElementPolyfillSupport,U=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?Q:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>!g(t,e),m={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),F.litPropertyMetadata??=new WeakMap;let x=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=m){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&u(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:r}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return n?.call(this)},set(e){const a=n?.call(this);r.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??m}static _$Ei(){if(this.hasOwnProperty(U("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(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const t=this.properties,e=[...h(t),...B(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"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 i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),r=i.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=n.cssText,t.appendChild(e)}})(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,i){this._$AK(t,i)}_$EC(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:b).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:b;this._$Em=n,this[n]=r.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??y)(this[t],e))return;this.P(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){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,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],i)}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._$EU()}catch(e){throw t=!1,this._$EU(),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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[U("elementProperties")]=new Map,x[U("finalized")]=new Map,I?.({ReactiveElement:x}),(F.reactiveElementVersions??=[]).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const v=globalThis,C=v.trustedTypes,A=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,L="$lit$",G=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+G,S=`<${R}>`,w=document,V=()=>w.createComment(""),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Z=Array.isArray,N="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,X=/-->/g,H=/>/g,W=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),k=/'/g,M=/"/g,T=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),J=Y(1),_=Y(2),z=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),K=new WeakMap,P=w.createTreeWalker(w,129);function j(t,e){if(!Z(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}let q=class t{constructor({strings:e,_$litType$:i},n){let r;this.parts=[];let a=0,s=0;const o=e.length-1,l=this.parts,[c,g]=((t,e)=>{const i=t.length-1,n=[];let r,a=2===e?"<svg>":3===e?"<math>":"",s=D;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,g=0;for(;g<i.length&&(s.lastIndex=g,l=s.exec(i),null!==l);)g=s.lastIndex,s===D?"!--"===l[1]?s=X:void 0!==l[1]?s=H:void 0!==l[2]?(T.test(l[2])&&(r=RegExp("</"+l[2],"g")),s=W):void 0!==l[3]&&(s=W):s===W?">"===l[0]?(s=r??D,c=-1):void 0===l[1]?c=-2:(c=s.lastIndex-l[2].length,o=l[1],s=void 0===l[3]?W:'"'===l[3]?M:k):s===M||s===k?s=W:s===X||s===H?s=D:(s=W,r=void 0);const u=s===W&&t[e+1].startsWith("/>")?" ":"";a+=s===D?i+S:c>=0?(n.push(o),i.slice(0,c)+L+i.slice(c)+G+u):i+G+(-2===c?e:u)}return[j(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]})(e,i);if(this.el=t.createElement(c,n),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=P.nextNode())&&l.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(L)){const e=g[s++],i=r.getAttribute(t).split(G),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:a,name:n[2],strings:i,ctor:"."===n[1]?nt:"?"===n[1]?rt:"@"===n[1]?at:it}),r.removeAttribute(t)}else t.startsWith(G)&&(l.push({type:6,index:a}),r.removeAttribute(t));if(T.test(r.tagName)){const t=r.textContent.split(G),e=t.length-1;if(e>0){r.textContent=C?C.emptyScript:"";for(let i=0;i<e;i++)r.append(t[i],V()),P.nextNode(),l.push({type:2,index:++a});r.append(t[e],V())}}}else if(8===r.nodeType)if(r.data===R)l.push({type:2,index:a});else{let t=-1;for(;-1!==(t=r.data.indexOf(G,t+1));)l.push({type:7,index:a}),t+=G.length-1}a++}}static createElement(t,e){const i=w.createElement("template");return i.innerHTML=t,i}};function $(t,e,i=t,n){if(e===z)return e;let r=void 0!==n?i._$Co?.[n]:i._$Cl;const a=E(e)?void 0:e._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),void 0===a?r=void 0:(r=new a(t),r._$AT(t,i,n)),void 0!==n?(i._$Co??=[])[n]=r:i._$Cl=r),void 0!==r&&(e=$(t,r._$AS(t,e.values),r,n)),e}let tt=class{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:i}=this._$AD,n=(t?.creationScope??w).importNode(e,!0);P.currentNode=n;let r=P.nextNode(),a=0,s=0,o=i[0];for(;void 0!==o;){if(a===o.index){let e;2===o.type?e=new et(r,r.nextSibling,this,t):1===o.type?e=new o.ctor(r,o.name,o.strings,this,t):6===o.type&&(e=new st(r,this,t)),this._$AV.push(e),o=i[++s]}a!==o?.index&&(r=P.nextNode(),a++)}return P.currentNode=w,n}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},et=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,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=$(this,t,e),E(t)?t===O||null==t||""===t?(this._$AH!==O&&this._$AR(),this._$AH=O):t!==this._$AH&&t!==z&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>Z(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!==O&&E(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=q.createElement(j(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new tt(n,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new q(t)),e}k(e){Z(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let n,r=0;for(const a of e)r===i.length?i.push(n=new t(this.O(V()),this.O(V()),this,this.options)):n=i[r],n._$AI(a),r++;r<i.length&&(this._$AR(n&&n._$AB.nextSibling,r),i.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},it=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,r){this.type=1,this._$AH=O,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=O}_$AI(t,e=this,i,n){const r=this.strings;let a=!1;if(void 0===r)t=$(this,t,e,0),a=!E(t)||t!==this._$AH&&t!==z,a&&(this._$AH=t);else{const n=t;let s,o;for(t=r[0],s=0;s<r.length-1;s++)o=$(this,n[i+s],e,s),o===z&&(o=this._$AH[s]),a||=!E(o)||o!==this._$AH[s],o===O?t=O:t!==O&&(t+=(o??"")+r[s+1]),this._$AH[s]=o}a&&!n&&this.j(t)}j(t){t===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},nt=class extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===O?void 0:t}},rt=class extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==O)}},at=class extends it{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){if((t=$(this,t,e,0)??O)===z)return;const i=this._$AH,n=t===O&&i!==O||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==O&&(i===O||n);n&&this.element.removeEventListener(this.name,this,i),r&&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 st{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){$(this,t)}}const ot=v.litHtmlPolyfillSupport;ot?.(q,et),(v.litHtmlVersions??=[]).push("3.2.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ let lt=class extends x{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,i)=>{const n=i?.renderBefore??e;let r=n._$litPart$;if(void 0===r){const t=i?.renderBefore??null;n._$litPart$=r=new et(e.insertBefore(V(),t),t,void 0,i??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};lt._$litElement$=!0,lt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:lt});const ct=globalThis.litElementPolyfillSupport;function gt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ut(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function dt(t){let e,i,n;function r(t,n,r=0,a=t.length){if(r<a){if(0!==e(n,n))return a;do{const e=r+a>>>1;i(t[e],n)<0?r=e+1:a=e}while(r<a)}return r}return 2!==t.length?(e=gt,i=(e,i)=>gt(t(e),i),n=(e,i)=>t(e)-i):(e=t===gt||t===ut?t:ht,i=t,n=t),{left:r,center:function(t,e,i=0,a=t.length){const s=r(t,e,i,a-1);return s>i&&n(t[s-1],e)>-n(t[s],e)?s-1:s},right:function(t,n,r=0,a=t.length){if(r<a){if(0!==e(n,n))return a;do{const e=r+a>>>1;i(t[e],n)<=0?r=e+1:a=e}while(r<a)}return r}}}function ht(){return 0}ct?.({LitElement:lt}),(globalThis.litElementVersions??=[]).push("4.1.1");const Bt=dt(gt).right;dt((function(t){return null===t?NaN:+t})).center;const pt=Math.sqrt(50),Ft=Math.sqrt(10),ft=Math.sqrt(2);function Qt(t,e,i){const n=(e-t)/Math.max(0,i),r=Math.floor(Math.log10(n)),a=n/Math.pow(10,r),s=a>=pt?10:a>=Ft?5:a>=ft?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/s,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*s,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=i&&i<2?Qt(t,e,2*i):[o,l,c]}function It(t,e,i){return Qt(t=+t,e=+e,i=+i)[2]}function Ut(t,e,i){t=+t,e=+e,i=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+i;for(var n=-1,r=0|Math.max(0,Math.ceil((e-t)/i)),a=new Array(r);++n<r;)a[n]=t+n*i;return a}function bt(t){return t}var yt=1,mt=2,xt=3,vt=4,Ct=1e-6;function At(t){return"translate("+t+",0)"}function Lt(t){return"translate(0,"+t+")"}function Gt(t){return e=>+t(e)}function Rt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),i=>+t(i)+e}function St(){return!this.__axis}function wt(t,e){var i=[],n=null,r=null,a=6,s=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=t===yt||t===vt?-1:1,g=t===vt||t===mt?"x":"y",u=t===yt||t===xt?At:Lt;function d(d){var h=null==n?e.ticks?e.ticks.apply(e,i):e.domain():n,B=null==r?e.tickFormat?e.tickFormat.apply(e,i):bt:r,p=Math.max(a,0)+o,F=e.range(),f=+F[0]+l,Q=+F[F.length-1]+l,I=(e.bandwidth?Rt:Gt)(e.copy(),l),U=d.selection?d.selection():d,b=U.selectAll(".domain").data([null]),y=U.selectAll(".tick").data(h,e).order(),m=y.exit(),x=y.enter().append("g").attr("class","tick"),v=y.select("line"),C=y.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),y=y.merge(x),v=v.merge(x.append("line").attr("stroke","currentColor").attr(g+"2",c*a)),C=C.merge(x.append("text").attr("fill","currentColor").attr(g,c*p).attr("dy",t===yt?"0em":t===xt?"0.71em":"0.32em")),d!==U&&(b=b.transition(d),y=y.transition(d),v=v.transition(d),C=C.transition(d),m=m.transition(d).attr("opacity",Ct).attr("transform",(function(t){return isFinite(t=I(t))?u(t+l):this.getAttribute("transform")})),x.attr("opacity",Ct).attr("transform",(function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:I(t))+l)}))),m.remove(),b.attr("d",t===vt||t===mt?s?"M"+c*s+","+f+"H"+l+"V"+Q+"H"+c*s:"M"+l+","+f+"V"+Q:s?"M"+f+","+c*s+"V"+l+"H"+Q+"V"+c*s:"M"+f+","+l+"H"+Q),y.attr("opacity",1).attr("transform",(function(t){return u(I(t)+l)})),v.attr(g+"2",c*a),C.attr(g,c*p).text(B),U.filter(St).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===mt?"start":t===vt?"end":"middle"),U.each((function(){this.__axis=I}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return i=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),d):i.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?(r=t,d):r},d.tickSize=function(t){return arguments.length?(a=s=+t,d):a},d.tickSizeInner=function(t){return arguments.length?(a=+t,d):a},d.tickSizeOuter=function(t){return arguments.length?(s=+t,d):s},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Vt(t){return wt(xt,t)}function Et(t){return wt(vt,t)}var Zt={value:()=>{}};function Nt(){for(var t,e=0,i=arguments.length,n={};e<i;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Dt(n)}function Dt(t){this._=t}function Xt(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function Ht(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=Zt,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}Dt.prototype=Nt.prototype={constructor:Dt,on:function(t,e){var i,n,r=this._,a=(n=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",i=t.indexOf(".");if(i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=a[s]).type)r[i]=Ht(r[i],t.name,e);else if(null==e)for(i in r)r[i]=Ht(r[i],t.name,null);return this}for(;++s<o;)if((i=(t=a[s]).type)&&(i=Xt(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Dt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,n,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(n=this._[t]).length;a<i;++a)n[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,a=n.length;r<a;++r)n[r].value.apply(e,i)}};var Wt="http://www.w3.org/1999/xhtml",kt={svg:"http://www.w3.org/2000/svg",xhtml:Wt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mt(t){var e=t+="",i=e.indexOf(":");return i>=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),kt.hasOwnProperty(e)?{space:kt[e],local:t}:t}function Tt(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===Wt&&e.documentElement.namespaceURI===Wt?e.createElement(t):e.createElementNS(i,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Jt(t){var e=Mt(t);return(e.local?Yt:Tt)(e)}function _t(){}function zt(t){return null==t?_t:function(){return this.querySelector(t)}}function Ot(){return[]}function Kt(t){return null==t?Ot:function(){return this.querySelectorAll(t)}}function Pt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function jt(t){return function(){return this.matches(t)}}function qt(t){return function(e){return e.matches(t)}}var $t=Array.prototype.find;function te(){return this.firstElementChild}var ee=Array.prototype.filter;function ie(){return Array.from(this.children)}function ne(t){return new Array(t.length)}function re(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ae(t,e,i,n,r,a){for(var s,o=0,l=e.length,c=a.length;o<c;++o)(s=e[o])?(s.__data__=a[o],n[o]=s):i[o]=new re(t,a[o]);for(;o<l;++o)(s=e[o])&&(r[o]=s)}function se(t,e,i,n,r,a,s){var o,l,c,g=new Map,u=e.length,d=a.length,h=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(h[o]=c=s.call(l,l.__data__,o,e)+"",g.has(c)?r[o]=l:g.set(c,l));for(o=0;o<d;++o)c=s.call(t,a[o],o,a)+"",(l=g.get(c))?(n[o]=l,l.__data__=a[o],g.delete(c)):i[o]=new re(t,a[o]);for(o=0;o<u;++o)(l=e[o])&&g.get(h[o])===l&&(r[o]=l)}function oe(t){return t.__data__}function le(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ce(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ge(t){return function(){this.removeAttribute(t)}}function ue(t){return function(){this.removeAttributeNS(t.space,t.local)}}function de(t,e){return function(){this.setAttribute(t,e)}}function he(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Be(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}function pe(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function Fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function fe(t){return function(){this.style.removeProperty(t)}}function Qe(t,e,i){return function(){this.style.setProperty(t,e,i)}}function Ie(t,e,i){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,i)}}function Ue(t,e){return t.style.getPropertyValue(e)||Fe(t).getComputedStyle(t,null).getPropertyValue(e)}function be(t){return function(){delete this[t]}}function ye(t,e){return function(){this[t]=e}}function me(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function xe(t){return t.trim().split(/^|\s+/)}function ve(t){return t.classList||new Ce(t)}function Ce(t){this._node=t,this._names=xe(t.getAttribute("class")||"")}function Ae(t,e){for(var i=ve(t),n=-1,r=e.length;++n<r;)i.add(e[n])}function Le(t,e){for(var i=ve(t),n=-1,r=e.length;++n<r;)i.remove(e[n])}function Ge(t){return function(){Ae(this,t)}}function Re(t){return function(){Le(this,t)}}function Se(t,e){return function(){(e.apply(this,arguments)?Ae:Le)(this,t)}}function we(){this.textContent=""}function Ve(t){return function(){this.textContent=t}}function Ee(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Ze(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function De(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Xe(){this.nextSibling&&this.parentNode.appendChild(this)}function He(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function We(){return null}function ke(){var t=this.parentNode;t&&t.removeChild(this)}function Me(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Te(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(t){return function(){var e=this.__on;if(e){for(var i,n=0,r=-1,a=e.length;n<a;++n)i=e[n],t.type&&i.type!==t.type||i.name!==t.name?e[++r]=i:this.removeEventListener(i.type,i.listener,i.options);++r?e.length=r:delete this.__on}}}function Je(t,e,i){return function(){var n,r=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var s=0,o=r.length;s<o;++s)if((n=r[s]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=i),void(n.value=e);this.addEventListener(t.type,a,i),n={type:t.type,name:t.name,value:e,listener:a,options:i},r?r.push(n):this.__on=[n]}}function _e(t,e,i){var n=Fe(t),r=n.CustomEvent;"function"==typeof r?r=new r(e,i):(r=n.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function ze(t,e){return function(){return _e(this,t,e)}}function Oe(t,e){return function(){return _e(this,t,e.apply(this,arguments))}}re.prototype={constructor:re,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 Ke=[null];function Pe(t,e){this._groups=t,this._parents=e}function je(){return new Pe([[document.documentElement]],Ke)}function qe(t){return"string"==typeof t?new Pe([[document.querySelector(t)]],[document.documentElement]):new Pe([[t]],Ke)}function $e(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 i=e.ownerSVGElement||e;if(i.createSVGPoint){var n=i.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}Pe.prototype=je.prototype={constructor:Pe,select:function(t){"function"!=typeof t&&(t=zt(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var a,s,o=e[r],l=o.length,c=n[r]=new Array(l),g=0;g<l;++g)(a=o[g])&&(s=t.call(a,a.__data__,g,o))&&("__data__"in a&&(s.__data__=a.__data__),c[g]=s);return new Pe(n,this._parents)},selectAll:function(t){t="function"==typeof t?Pt(t):Kt(t);for(var e=this._groups,i=e.length,n=[],r=[],a=0;a<i;++a)for(var s,o=e[a],l=o.length,c=0;c<l;++c)(s=o[c])&&(n.push(t.call(s,s.__data__,c,o)),r.push(s));return new Pe(n,r)},selectChild:function(t){return this.select(null==t?te:function(t){return function(){return $t.call(this.children,t)}}("function"==typeof t?t:qt(t)))},selectChildren:function(t){return this.selectAll(null==t?ie:function(t){return function(){return ee.call(this.children,t)}}("function"==typeof t?t:qt(t)))},filter:function(t){"function"!=typeof t&&(t=jt(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var a,s=e[r],o=s.length,l=n[r]=[],c=0;c<o;++c)(a=s[c])&&t.call(a,a.__data__,c,s)&&l.push(a);return new Pe(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,oe);var i=e?se:ae,n=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,s=new Array(a),o=new Array(a),l=new Array(a),c=0;c<a;++c){var g=n[c],u=r[c],d=u.length,h=le(t.call(g,g&&g.__data__,c,n)),B=h.length,p=o[c]=new Array(B),F=s[c]=new Array(B);i(g,u,p,F,l[c]=new Array(d),h,e);for(var f,Q,I=0,U=0;I<B;++I)if(f=p[I]){for(I>=U&&(U=I+1);!(Q=F[U])&&++U<B;);f._next=Q||null}}return(s=new Pe(s,n))._enter=o,s._exit=l,s},enter:function(){return new Pe(this._enter||this._groups.map(ne),this._parents)},exit:function(){return new Pe(this._exit||this._groups.map(ne),this._parents)},join:function(t,e,i){var n=this.enter(),r=this,a=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==i?a.remove():i(a),n&&r?n.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,i=this._groups,n=e._groups,r=i.length,a=n.length,s=Math.min(r,a),o=new Array(r),l=0;l<s;++l)for(var c,g=i[l],u=n[l],d=g.length,h=o[l]=new Array(d),B=0;B<d;++B)(c=g[B]||u[B])&&(h[B]=c);for(;l<r;++l)o[l]=i[l];return new Pe(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var n,r=t[e],a=r.length-1,s=r[a];--a>=0;)(n=r[a])&&(s&&4^n.compareDocumentPosition(s)&&s.parentNode.insertBefore(n,s),s=n);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}t||(t=ce);for(var i=this._groups,n=i.length,r=new Array(n),a=0;a<n;++a){for(var s,o=i[a],l=o.length,c=r[a]=new Array(l),g=0;g<l;++g)(s=o[g])&&(c[g]=s);c.sort(e)}return new Pe(r,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,i=t.length;e<i;++e)for(var n=t[e],r=0,a=n.length;r<a;++r){var s=n[r];if(s)return s}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,i=0,n=e.length;i<n;++i)for(var r,a=e[i],s=0,o=a.length;s<o;++s)(r=a[s])&&t.call(r,r.__data__,s,a);return this},attr:function(t,e){var i=Mt(t);if(arguments.length<2){var n=this.node();return i.local?n.getAttributeNS(i.space,i.local):n.getAttribute(i)}return this.each((null==e?i.local?ue:ge:"function"==typeof e?i.local?pe:Be:i.local?he:de)(i,e))},style:function(t,e,i){return arguments.length>1?this.each((null==e?fe:"function"==typeof e?Ie:Qe)(t,e,null==i?"":i)):Ue(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?be:"function"==typeof e?me:ye)(t,e)):this.node()[t]},classed:function(t,e){var i=xe(t+"");if(arguments.length<2){for(var n=ve(this.node()),r=-1,a=i.length;++r<a;)if(!n.contains(i[r]))return!1;return!0}return this.each(("function"==typeof e?Se:e?Ge:Re)(i,e))},text:function(t){return arguments.length?this.each(null==t?we:("function"==typeof t?Ee:Ve)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ze:("function"==typeof t?De:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(Xe)},lower:function(){return this.each(He)},append:function(t){var e="function"==typeof t?t:Jt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var i="function"==typeof t?t:Jt(t),n=null==e?We:"function"==typeof e?e:zt(e);return this.select((function(){return this.insertBefore(i.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(ke)},clone:function(t){return this.select(t?Te:Me)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,i){var n,r,a=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",i=t.indexOf(".");return i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}}))}(t+""),s=a.length;if(!(arguments.length<2)){for(o=e?Je:Ye,n=0;n<s;++n)this.each(o(a[n],e,i));return this}var o=this.node().__on;if(o)for(var l,c=0,g=o.length;c<g;++c)for(n=0,l=o[c];n<s;++n)if((r=a[n]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Oe:ze)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var n,r=t[e],a=0,s=r.length;a<s;++a)(n=r[a])&&(yield n)}};const ti={passive:!1},ei={capture:!0,passive:!1};function ii(t){t.stopImmediatePropagation()}function ni(t){t.preventDefault(),t.stopImmediatePropagation()}var ri=t=>()=>t;function ai(t,{sourceEvent:e,subject:i,target:n,identifier:r,active:a,x:s,y:o,dx:l,dy:c,dispatch:g}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:s,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:g}})}function si(t){return!t.ctrlKey&&!t.button}function oi(){return this.parentNode}function li(t,e){return null==e?{x:t.x,y:t.y}:e}function ci(){return navigator.maxTouchPoints||"ontouchstart"in this}function gi(){var t,e,i,n,r=si,a=oi,s=li,o=ci,l={},c=Nt("start","drag","end"),g=0,u=0;function d(t){t.on("mousedown.drag",h).filter(o).on("touchstart.drag",F).on("touchmove.drag",f,ti).on("touchend.drag touchcancel.drag",Q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(s,o){if(!n&&r.call(this,s,o)){var l=I(this,a.call(this,s,o),s,o,"mouse");l&&(qe(s.view).on("mousemove.drag",B,ei).on("mouseup.drag",p,ei),function(t){var e=t.document.documentElement,i=qe(t).on("dragstart.drag",ni,ei);"onselectstart"in e?i.on("selectstart.drag",ni,ei):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(s.view),ii(s),i=!1,t=s.clientX,e=s.clientY,l("start",s))}}function B(n){if(ni(n),!i){var r=n.clientX-t,a=n.clientY-e;i=r*r+a*a>u}l.mouse("drag",n)}function p(t){qe(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var i=t.document.documentElement,n=qe(t).on("dragstart.drag",null);e&&(n.on("click.drag",ni,ei),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in i?n.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}(t.view,i),ni(t),l.mouse("end",t)}function F(t,e){if(r.call(this,t,e)){var i,n,s=t.changedTouches,o=a.call(this,t,e),l=s.length;for(i=0;i<l;++i)(n=I(this,o,t,e,s[i].identifier,s[i]))&&(ii(t),n("start",t,s[i]))}}function f(t){var e,i,n=t.changedTouches,r=n.length;for(e=0;e<r;++e)(i=l[n[e].identifier])&&(ni(t),i("drag",t,n[e]))}function Q(t){var e,i,r=t.changedTouches,a=r.length;for(n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),e=0;e<a;++e)(i=l[r[e].identifier])&&(ii(t),i("end",t,r[e]))}function I(t,e,i,n,r,a){var o,u,h,B=c.copy(),p=$e(a||i,e);if(null!=(h=s.call(t,new ai("beforestart",{sourceEvent:i,target:d,identifier:r,active:g,x:p[0],y:p[1],dx:0,dy:0,dispatch:B}),n)))return o=h.x-p[0]||0,u=h.y-p[1]||0,function i(a,s,c){var F,f=p;switch(a){case"start":l[r]=i,F=g++;break;case"end":delete l[r],--g;case"drag":p=$e(c||s,e),F=g}B.call(a,t,new ai(a,{sourceEvent:s,subject:h,target:d,identifier:r,active:F,x:p[0]+o,y:p[1]+u,dx:p[0]-f[0],dy:p[1]-f[1],dispatch:B}),n)}}return d.filter=function(t){return arguments.length?(r="function"==typeof t?t:ri(!!t),d):r},d.container=function(t){return arguments.length?(a="function"==typeof t?t:ri(t),d):a},d.subject=function(t){return arguments.length?(s="function"==typeof t?t:ri(t),d):s},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:ri(!!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 ui(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function di(t,e){var i=Object.create(t.prototype);for(var n in e)i[n]=e[n];return i}function hi(){}ai.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Bi=.7,pi=1/Bi,Fi="\\s*([+-]?\\d+)\\s*",fi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ii=/^#([0-9a-f]{3,8})$/,Ui=new RegExp(`^rgb\\(${Fi},${Fi},${Fi}\\)$`),bi=new RegExp(`^rgb\\(${Qi},${Qi},${Qi}\\)$`),yi=new RegExp(`^rgba\\(${Fi},${Fi},${Fi},${fi}\\)$`),mi=new RegExp(`^rgba\\(${Qi},${Qi},${Qi},${fi}\\)$`),xi=new RegExp(`^hsl\\(${fi},${Qi},${Qi}\\)$`),vi=new RegExp(`^hsla\\(${fi},${Qi},${Qi},${fi}\\)$`),Ci={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 Ai(){return this.rgb().formatHex()}function Li(){return this.rgb().formatRgb()}function Gi(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=Ii.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?Ri(e):3===i?new Vi(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===i?Si(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===i?Si(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=Ui.exec(t))?new Vi(e[1],e[2],e[3],1):(e=bi.exec(t))?new Vi(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=yi.exec(t))?Si(e[1],e[2],e[3],e[4]):(e=mi.exec(t))?Si(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=xi.exec(t))?Hi(e[1],e[2]/100,e[3]/100,1):(e=vi.exec(t))?Hi(e[1],e[2]/100,e[3]/100,e[4]):Ci.hasOwnProperty(t)?Ri(Ci[t]):"transparent"===t?new Vi(NaN,NaN,NaN,0):null}function Ri(t){return new Vi(t>>16&255,t>>8&255,255&t,1)}function Si(t,e,i,n){return n<=0&&(t=e=i=NaN),new Vi(t,e,i,n)}function wi(t,e,i,n){return 1===arguments.length?function(t){return t instanceof hi||(t=Gi(t)),t?new Vi((t=t.rgb()).r,t.g,t.b,t.opacity):new Vi}(t):new Vi(t,e,i,null==n?1:n)}function Vi(t,e,i,n){this.r=+t,this.g=+e,this.b=+i,this.opacity=+n}function Ei(){return`#${Xi(this.r)}${Xi(this.g)}${Xi(this.b)}`}function Zi(){const t=Ni(this.opacity);return`${1===t?"rgb(":"rgba("}${Di(this.r)}, ${Di(this.g)}, ${Di(this.b)}${1===t?")":`, ${t})`}`}function Ni(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Di(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xi(t){return((t=Di(t))<16?"0":"")+t.toString(16)}function Hi(t,e,i,n){return n<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new ki(t,e,i,n)}function Wi(t){if(t instanceof ki)return new ki(t.h,t.s,t.l,t.opacity);if(t instanceof hi||(t=Gi(t)),!t)return new ki;if(t instanceof ki)return t;var e=(t=t.rgb()).r/255,i=t.g/255,n=t.b/255,r=Math.min(e,i,n),a=Math.max(e,i,n),s=NaN,o=a-r,l=(a+r)/2;return o?(s=e===a?(i-n)/o+6*(i<n):i===a?(n-e)/o+2:(e-i)/o+4,o/=l<.5?a+r:2-a-r,s*=60):o=l>0&&l<1?0:s,new ki(s,o,l,t.opacity)}function ki(t,e,i,n){this.h=+t,this.s=+e,this.l=+i,this.opacity=+n}function Mi(t){return(t=(t||0)%360)<0?t+360:t}function Ti(t){return Math.max(0,Math.min(1,t||0))}function Yi(t,e,i){return 255*(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)}ui(hi,Gi,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ai,formatHex:Ai,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Wi(this).formatHsl()},formatRgb:Li,toString:Li}),ui(Vi,wi,di(hi,{brighter(t){return t=null==t?pi:Math.pow(pi,t),new Vi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Bi:Math.pow(Bi,t),new Vi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Vi(Di(this.r),Di(this.g),Di(this.b),Ni(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:Ei,formatHex:Ei,formatHex8:function(){return`#${Xi(this.r)}${Xi(this.g)}${Xi(this.b)}${Xi(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Zi,toString:Zi})),ui(ki,(function(t,e,i,n){return 1===arguments.length?Wi(t):new ki(t,e,i,null==n?1:n)}),di(hi,{brighter(t){return t=null==t?pi:Math.pow(pi,t),new ki(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Bi:Math.pow(Bi,t),new ki(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,i=this.l,n=i+(i<.5?i:1-i)*e,r=2*i-n;return new Vi(Yi(t>=240?t-240:t+120,r,n),Yi(t,r,n),Yi(t<120?t+240:t-120,r,n),this.opacity)},clamp(){return new ki(Mi(this.h),Ti(this.s),Ti(this.l),Ni(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=Ni(this.opacity);return`${1===t?"hsl(":"hsla("}${Mi(this.h)}, ${100*Ti(this.s)}%, ${100*Ti(this.l)}%${1===t?")":`, ${t})`}`}}));var Ji=t=>()=>t;function _i(t){return 1==(t=+t)?zi:function(e,i){return i-e?function(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(n){return Math.pow(t+n*e,i)}}(e,i,t):Ji(isNaN(e)?i:e)}}function zi(t,e){var i=e-t;return i?function(t,e){return function(i){return t+i*e}}(t,i):Ji(isNaN(t)?e:t)}var Oi=function t(e){var i=_i(e);function n(t,e){var n=i((t=wi(t)).r,(e=wi(e)).r),r=i(t.g,e.g),a=i(t.b,e.b),s=zi(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=r(e),t.b=a(e),t.opacity=s(e),t+""}}return n.gamma=t,n}(1);function Ki(t,e){e||(e=[]);var i,n=t?Math.min(e.length,t.length):0,r=e.slice();return function(a){for(i=0;i<n;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Pi(t,e){var i,n=e?e.length:0,r=t?Math.min(n,t.length):0,a=new Array(r),s=new Array(n);for(i=0;i<r;++i)a[i]=rn(t[i],e[i]);for(;i<n;++i)s[i]=e[i];return function(t){for(i=0;i<r;++i)s[i]=a[i](t);return s}}function ji(t,e){var i=new Date;return t=+t,e=+e,function(n){return i.setTime(t*(1-n)+e*n),i}}function qi(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function $i(t,e){var i,n={},r={};for(i in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)i in t?n[i]=rn(t[i],e[i]):r[i]=e[i];return function(t){for(i in n)r[i]=n[i](t);return r}}var tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,en=new RegExp(tn.source,"g");function nn(t,e){var i,n,r,a=tn.lastIndex=en.lastIndex=0,s=-1,o=[],l=[];for(t+="",e+="";(i=tn.exec(t))&&(n=en.exec(e));)(r=n.index)>a&&(r=e.slice(a,r),o[s]?o[s]+=r:o[++s]=r),(i=i[0])===(n=n[0])?o[s]?o[s]+=n:o[++s]=n:(o[++s]=null,l.push({i:s,x:qi(i,n)})),a=en.lastIndex;return a<e.length&&(r=e.slice(a),o[s]?o[s]+=r:o[++s]=r),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 i,n=0;n<e;++n)o[(i=l[n]).i]=i.x(t);return o.join("")})}function rn(t,e){var i,n=typeof e;return null==e||"boolean"===n?Ji(e):("number"===n?qi:"string"===n?(i=Gi(e))?(e=i,Oi):nn:e instanceof Gi?Oi:e instanceof Date?ji:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Ki:Array.isArray(e)?Pi:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?$i:qi)(t,e)}function an(t,e){return t=+t,e=+e,function(i){return Math.round(t*(1-i)+e*i)}}var sn,on=180/Math.PI,ln={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cn(t,e,i,n,r,a){var s,o,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*i+e*n)&&(i-=t*l,n-=e*l),(o=Math.sqrt(i*i+n*n))&&(i/=o,n/=o,l/=o),t*n<e*i&&(t=-t,e=-e,l=-l,s=-s),{translateX:r,translateY:a,rotate:Math.atan2(e,t)*on,skewX:Math.atan(l)*on,scaleX:s,scaleY:o}}function gn(t,e,i,n){function r(t){return t.length?t.pop()+" ":""}return function(a,s){var o=[],l=[];return a=t(a),s=t(s),function(t,n,r,a,s,o){if(t!==r||n!==a){var l=s.push("translate(",null,e,null,i);o.push({i:l-4,x:qi(t,r)},{i:l-2,x:qi(n,a)})}else(r||a)&&s.push("translate("+r+e+a+i)}(a.translateX,a.translateY,s.translateX,s.translateY,o,l),function(t,e,i,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:i.push(r(i)+"rotate(",null,n)-2,x:qi(t,e)})):e&&i.push(r(i)+"rotate("+e+n)}(a.rotate,s.rotate,o,l),function(t,e,i,a){t!==e?a.push({i:i.push(r(i)+"skewX(",null,n)-2,x:qi(t,e)}):e&&i.push(r(i)+"skewX("+e+n)}(a.skewX,s.skewX,o,l),function(t,e,i,n,a,s){if(t!==i||e!==n){var o=a.push(r(a)+"scale(",null,",",null,")");s.push({i:o-4,x:qi(t,i)},{i:o-2,x:qi(e,n)})}else 1===i&&1===n||a.push(r(a)+"scale("+i+","+n+")")}(a.scaleX,a.scaleY,s.scaleX,s.scaleY,o,l),a=s=null,function(t){for(var e,i=-1,n=l.length;++i<n;)o[(e=l[i]).i]=e.x(t);return o.join("")}}}var un,dn,hn=gn((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ln:cn(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Bn=gn((function(t){return null==t?ln:(sn||(sn=document.createElementNS("http://www.w3.org/2000/svg","g")),sn.setAttribute("transform",t),(t=sn.transform.baseVal.consolidate())?cn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ln)}),", ",")",")"),pn=0,Fn=0,fn=0,Qn=1e3,In=0,Un=0,bn=0,yn="object"==typeof performance&&performance.now?performance:Date,mn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function xn(){return Un||(mn(vn),Un=yn.now()+bn)}function vn(){Un=0}function Cn(){this._call=this._time=this._next=null}function An(t,e,i){var n=new Cn;return n.restart(t,e,i),n}function Ln(){Un=(In=yn.now())+bn,pn=Fn=0;try{!function(){xn(),++pn;for(var t,e=un;e;)(t=Un-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pn}()}finally{pn=0,function(){var t,e,i=un,n=1/0;for(;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:un=e);dn=t,Rn(n)}(),Un=0}}function Gn(){var t=yn.now(),e=t-In;e>Qn&&(bn-=e,In=t)}function Rn(t){pn||(Fn&&(Fn=clearTimeout(Fn)),t-Un>24?(t<1/0&&(Fn=setTimeout(Ln,t-yn.now()-bn)),fn&&(fn=clearInterval(fn))):(fn||(In=yn.now(),fn=setInterval(Gn,Qn)),pn=1,mn(Ln)))}function Sn(t,e,i){var n=new Cn;return e=null==e?0:+e,n.restart((i=>{n.stop(),t(i+e)}),e,i),n}Cn.prototype=An.prototype={constructor:Cn,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?xn():+i)+(null==e?0:+e),this._next||dn===this||(dn?dn._next=this:un=this,dn=this),this._call=t,this._time=i,Rn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rn())}};var wn=Nt("start","end","c