@decidables/accumulable-elements 0.3.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,23 +3,23 @@
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),r=new WeakMap;let a=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)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(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&r.set(e,t))}return t}toString(){return this.cssText}};const n=t=>new a("string"==typeof t?t:t+"",void 0,s),o=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,s)=>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[s+1],t[0]);return new a(i,t,s)},l=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return n(e)})(t):t,{is:c,defineProperty:d,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:p}=Object,m=globalThis,b=m.trustedTypes,y=b?b.emptyScript:"",Q=m.reactiveElementPolyfillSupport,B=(t,e)=>t,U={toAttribute(t,e){switch(e){case Boolean:t=t?y: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}},F=(t,e)=>!c(t,e),I={attribute:!0,type:String,converter:U,reflect:!1,useDefault:!1,hasChanged:F};
6
+ */const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),r=new WeakMap;let a=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)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(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&r.set(e,t))}return t}toString(){return this.cssText}};const n=t=>new a("string"==typeof t?t:t+"",void 0,s),o=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,s)=>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[s+1],t[0]);return new a(i,t,s)},l=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return n(e)})(t):t,{is:c,defineProperty:d,getOwnPropertyDescriptor:u,getOwnPropertyNames:h,getOwnPropertySymbols:g,getPrototypeOf:p}=Object,m=globalThis,b=m.trustedTypes,Q=b?b.emptyScript:"",B=m.reactiveElementPolyfillSupport,y=(t,e)=>t,U={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}},F=(t,e)=>!c(t,e),I={attribute:!0,type:String,converter:U,reflect:!1,useDefault:!1,hasChanged:F};
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let f=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=I){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&d(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);r?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??I}static _$Ei(){if(this.hasOwnProperty(B("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(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const t=this.properties,e=[...u(t),...g(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(l(t))}else void 0!==t&&e.push(l(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,s)=>{if(i)t.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of s){const s=document.createElement("style"),r=e.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=i.cssText,t.appendChild(s)}})(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)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:U).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:U;this._$Em=s;const a=r.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,r=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??F)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==r||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&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,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}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){}};f.elementStyles=[],f.shadowRootOptions={mode:"open"},f[B("elementProperties")]=new Map,f[B("finalized")]=new Map,Q?.({ReactiveElement:f}),(m.reactiveElementVersions??=[]).push("2.1.1");
11
+ */Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let f=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=I){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&d(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);r?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??I}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=[...h(t),...g(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(l(t))}else void 0!==t&&e.push(l(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,s)=>{if(i)t.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of s){const s=document.createElement("style"),r=e.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=i.cssText,t.appendChild(s)}})(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)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:U).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:U;this._$Em=s;const a=r.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,r=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??F)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==r||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&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,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}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){}};f.elementStyles=[],f.shadowRootOptions={mode:"open"},f[y("elementProperties")]=new Map,f[y("finalized")]=new Map,B?.({ReactiveElement:f}),(m.reactiveElementVersions??=[]).push("2.1.1");
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+E,S=`<${R}>`,N=document,L=()=>N.createComment(""),w=t=>null===t||"object"!=typeof t&&"function"!=typeof t,D=Array.isArray,M="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,V=/>/g,H=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,z=/"/g,G=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),X=Y(1),J=Y(2),W=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),K=new WeakMap,Z=N.createTreeWalker(N,129);function P(t,e){if(!D(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const O=(t,e)=>{const i=t.length-1,s=[];let r,a=2===e?"<svg>":3===e?"<math>":"",n=k;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,d=0;for(;d<i.length&&(n.lastIndex=d,l=n.exec(i),null!==l);)d=n.lastIndex,n===k?"!--"===l[1]?n=T:void 0!==l[1]?n=V:void 0!==l[2]?(G.test(l[2])&&(r=RegExp("</"+l[2],"g")),n=H):void 0!==l[3]&&(n=H):n===H?">"===l[0]?(n=r??k,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?H:'"'===l[3]?z:$):n===z||n===$?n=H:n===T||n===V?n=k:(n=H,r=void 0);const h=n===H&&t[e+1].startsWith("/>")?" ":"";a+=n===k?i+S:c>=0?(s.push(o),i.slice(0,c)+x+i.slice(c)+E+h):i+E+(-2===c?e:h)}return[P(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class j{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,a=0;const n=t.length-1,o=this.parts,[l,c]=O(t,e);if(this.el=j.createElement(l,i),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=Z.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(x)){const e=c[a++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:r,name:n[2],strings:i,ctor:"."===n[1]?st:"?"===n[1]?rt:"@"===n[1]?at:it}),s.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:r}),s.removeAttribute(t));if(G.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=v?v.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],L()),Z.nextNode(),o.push({type:2,index:++r});s.append(t[e],L())}}}else if(8===s.nodeType)if(s.data===R)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)o.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=N.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,s){if(e===W)return e;let r=void 0!==s?i._$Co?.[s]:i._$Cl;const a=w(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,s)),void 0!==s?(i._$Co??=[])[s]=r:i._$Cl=r),void 0!==r&&(e=q(t,r._$AS(t,e.values),r,s)),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:i}=this._$AD,s=(t?.creationScope??N).importNode(e,!0);Z.currentNode=s;let r=Z.nextNode(),a=0,n=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 nt(r,this,t)),this._$AV.push(e),o=i[++n]}a!==o?.index&&(r=Z.nextNode(),a++)}return Z.currentNode=N,s}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++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.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),w(t)?t===_||null==t||""===t?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>D(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!==_&&w(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=j.createElement(P(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new tt(s,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 j(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new et(this.O(L()),this.O(L()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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 it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_}_$AI(t,e=this,i,s){const r=this.strings;let a=!1;if(void 0===r)t=q(this,t,e,0),a=!w(t)||t!==this._$AH&&t!==W,a&&(this._$AH=t);else{const s=t;let n,o;for(t=r[0],n=0;n<r.length-1;n++)o=q(this,s[i+n],e,n),o===W&&(o=this._$AH[n]),a||=!w(o)||o!==this._$AH[n],o===_?t=_:t!==_&&(t+=(o??"")+r[n+1]),this._$AH[n]=o}a&&!s&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}}class rt extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}}class at extends it{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=q(this,t,e,0)??_)===W)return;const i=this._$AH,s=t===_&&i!==_||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==_&&(i===_||s);s&&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 nt{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){q(this,t)}}const ot=C.litHtmlPolyfillSupport;ot?.(j,et),(C.litHtmlVersions??=[]).push("3.3.1");const lt=(t,e,i)=>{const s=i?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=i?.renderBefore??null;s._$litPart$=r=new et(e.insertBefore(L(),t),t,void 0,i??{})}return r._$AI(t),r},ct=globalThis;
17
+ const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+E,S=`<${R}>`,N=document,L=()=>N.createComment(""),w=t=>null===t||"object"!=typeof t&&"function"!=typeof t,D=Array.isArray,M="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,V=/>/g,H=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,z=/"/g,G=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),X=Y(1),J=Y(2),W=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),K=new WeakMap,Z=N.createTreeWalker(N,129);function P(t,e){if(!D(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const O=(t,e)=>{const i=t.length-1,s=[];let r,a=2===e?"<svg>":3===e?"<math>":"",n=k;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,d=0;for(;d<i.length&&(n.lastIndex=d,l=n.exec(i),null!==l);)d=n.lastIndex,n===k?"!--"===l[1]?n=T:void 0!==l[1]?n=V:void 0!==l[2]?(G.test(l[2])&&(r=RegExp("</"+l[2],"g")),n=H):void 0!==l[3]&&(n=H):n===H?">"===l[0]?(n=r??k,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?H:'"'===l[3]?z:$):n===z||n===$?n=H:n===T||n===V?n=k:(n=H,r=void 0);const u=n===H&&t[e+1].startsWith("/>")?" ":"";a+=n===k?i+S:c>=0?(s.push(o),i.slice(0,c)+x+i.slice(c)+E+u):i+E+(-2===c?e:u)}return[P(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class j{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,a=0;const n=t.length-1,o=this.parts,[l,c]=O(t,e);if(this.el=j.createElement(l,i),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=Z.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(x)){const e=c[a++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:r,name:n[2],strings:i,ctor:"."===n[1]?st:"?"===n[1]?rt:"@"===n[1]?at:it}),s.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:r}),s.removeAttribute(t));if(G.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=v?v.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],L()),Z.nextNode(),o.push({type:2,index:++r});s.append(t[e],L())}}}else if(8===s.nodeType)if(s.data===R)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)o.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=N.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,s){if(e===W)return e;let r=void 0!==s?i._$Co?.[s]:i._$Cl;const a=w(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,s)),void 0!==s?(i._$Co??=[])[s]=r:i._$Cl=r),void 0!==r&&(e=q(t,r._$AS(t,e.values),r,s)),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:i}=this._$AD,s=(t?.creationScope??N).importNode(e,!0);Z.currentNode=s;let r=Z.nextNode(),a=0,n=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 nt(r,this,t)),this._$AV.push(e),o=i[++n]}a!==o?.index&&(r=Z.nextNode(),a++)}return Z.currentNode=N,s}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++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.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),w(t)?t===_||null==t||""===t?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>D(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!==_&&w(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=j.createElement(P(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new tt(s,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 j(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new et(this.O(L()),this.O(L()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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 it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_}_$AI(t,e=this,i,s){const r=this.strings;let a=!1;if(void 0===r)t=q(this,t,e,0),a=!w(t)||t!==this._$AH&&t!==W,a&&(this._$AH=t);else{const s=t;let n,o;for(t=r[0],n=0;n<r.length-1;n++)o=q(this,s[i+n],e,n),o===W&&(o=this._$AH[n]),a||=!w(o)||o!==this._$AH[n],o===_?t=_:t!==_&&(t+=(o??"")+r[n+1]),this._$AH[n]=o}a&&!s&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}}class rt extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}}class at extends it{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=q(this,t,e,0)??_)===W)return;const i=this._$AH,s=t===_&&i!==_||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==_&&(i===_||s);s&&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 nt{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){q(this,t)}}const ot=C.litHtmlPolyfillSupport;ot?.(j,et),(C.litHtmlVersions??=[]).push("3.3.1");const lt=(t,e,i)=>{const s=i?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=i?.renderBefore??null;s._$litPart$=r=new et(e.insertBefore(L(),t),t,void 0,i??{})}return r._$AI(t),r},ct=globalThis;
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */class dt extends f{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=lt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}dt._$litElement$=!0,dt.finalized=!0,ct.litElementHydrateSupport?.({LitElement:dt});const ht=ct.litElementPolyfillSupport;function ut(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function gt(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function pt(t){let e,i,s;function r(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<0?r=e+1:a=e}while(r<a)}return r}return 2!==t.length?(e=ut,i=(e,i)=>ut(t(e),i),s=(e,i)=>t(e)-i):(e=t===ut||t===gt?t:mt,i=t,s=t),{left:r,center:function(t,e,i=0,a=t.length){const n=r(t,e,i,a-1);return n>i&&s(t[n-1],e)>-s(t[n],e)?n-1:n},right:function(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<=0?r=e+1:a=e}while(r<a)}return r}}}function mt(){return 0}ht?.({LitElement:dt}),(ct.litElementVersions??=[]).push("4.2.1");const bt=pt(ut).right;pt(function(t){return null===t?NaN:+t}).center;const yt=Math.sqrt(50),Qt=Math.sqrt(10),Bt=Math.sqrt(2);function Ut(t,e,i){const s=(e-t)/Math.max(0,i),r=Math.floor(Math.log10(s)),a=s/Math.pow(10,r),n=a>=yt?10:a>=Qt?5:a>=Bt?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/n,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)*n,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=i&&i<2?Ut(t,e,2*i):[o,l,c]}function Ft(t,e,i){return Ut(t=+t,e=+e,i=+i)[2]}function It(t){return t}var ft=1e-6;function Ct(t){return"translate("+t+",0)"}function vt(t){return"translate(0,"+t+")"}function At(t){return e=>+t(e)}function xt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),i=>+t(i)+e}function Et(){return!this.__axis}function Rt(t,e){var i=[],s=null,r=null,a=6,n=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,d=4===t||2===t?"x":"y",h=1===t||3===t?Ct:vt;function u(u){var g=null==s?e.ticks?e.ticks.apply(e,i):e.domain():s,p=null==r?e.tickFormat?e.tickFormat.apply(e,i):It:r,m=Math.max(a,0)+o,b=e.range(),y=+b[0]+l,Q=+b[b.length-1]+l,B=(e.bandwidth?xt:At)(e.copy(),l),U=u.selection?u.selection():u,F=U.selectAll(".domain").data([null]),I=U.selectAll(".tick").data(g,e).order(),f=I.exit(),C=I.enter().append("g").attr("class","tick"),v=I.select("line"),A=I.select("text");F=F.merge(F.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(C),v=v.merge(C.append("line").attr("stroke","currentColor").attr(d+"2",c*a)),A=A.merge(C.append("text").attr("fill","currentColor").attr(d,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),u!==U&&(F=F.transition(u),I=I.transition(u),v=v.transition(u),A=A.transition(u),f=f.transition(u).attr("opacity",ft).attr("transform",function(t){return isFinite(t=B(t))?h(t+l):this.getAttribute("transform")}),C.attr("opacity",ft).attr("transform",function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:B(t))+l)})),f.remove(),F.attr("d",4===t||2===t?n?"M"+c*n+","+y+"H"+l+"V"+Q+"H"+c*n:"M"+l+","+y+"V"+Q:n?"M"+y+","+c*n+"V"+l+"H"+Q+"V"+c*n:"M"+y+","+l+"H"+Q),I.attr("opacity",1).attr("transform",function(t){return h(B(t)+l)}),v.attr(d+"2",c*a),A.attr(d,c*m).text(p),U.filter(Et).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),U.each(function(){this.__axis=B})}return u.scale=function(t){return arguments.length?(e=t,u):e},u.ticks=function(){return i=Array.from(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(s=null==t?null:Array.from(t),u):s&&s.slice()},u.tickFormat=function(t){return arguments.length?(r=t,u):r},u.tickSize=function(t){return arguments.length?(a=n=+t,u):a},u.tickSizeInner=function(t){return arguments.length?(a=+t,u):a},u.tickSizeOuter=function(t){return arguments.length?(n=+t,u):n},u.tickPadding=function(t){return arguments.length?(o=+t,u):o},u.offset=function(t){return arguments.length?(l=+t,u):l},u}function St(t){return Rt(4,t)}var Nt={value:()=>{}};function Lt(){for(var t,e=0,i=arguments.length,s={};e<i;++e){if(!(t=arguments[e]+"")||t in s||/[\s.]/.test(t))throw new Error("illegal type: "+t);s[t]=[]}return new wt(s)}function wt(t){this._=t}function Dt(t,e){for(var i,s=0,r=t.length;s<r;++s)if((i=t[s]).name===e)return i.value}function Mt(t,e,i){for(var s=0,r=t.length;s<r;++s)if(t[s].name===e){t[s]=Nt,t=t.slice(0,s).concat(t.slice(s+1));break}return null!=i&&t.push({name:e,value:i}),t}wt.prototype=Lt.prototype={constructor:wt,on:function(t,e){var i,s,r=this._,a=(s=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&&!s.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),n=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++n<o;)if(i=(t=a[n]).type)r[i]=Mt(r[i],t.name,e);else if(null==e)for(i in r)r[i]=Mt(r[i],t.name,null);return this}for(;++n<o;)if((i=(t=a[n]).type)&&(i=Dt(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new wt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,s,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=(s=this._[t]).length;a<i;++a)s[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var s=this._[t],r=0,a=s.length;r<a;++r)s[r].value.apply(e,i)}};var kt="http://www.w3.org/1999/xhtml",Tt={svg:"http://www.w3.org/2000/svg",xhtml:kt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(t){var e=t+="",i=e.indexOf(":");return i>=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),Tt.hasOwnProperty(e)?{space:Tt[e],local:t}:t}function Ht(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===kt&&e.documentElement.namespaceURI===kt?e.createElement(t):e.createElementNS(i,t)}}function $t(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function zt(t){var e=Vt(t);return(e.local?$t:Ht)(e)}function Gt(){}function Yt(t){return null==t?Gt:function(){return this.querySelector(t)}}function Xt(){return[]}function Jt(t){return null==t?Xt:function(){return this.querySelectorAll(t)}}function Wt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function _t(t){return function(){return this.matches(t)}}function Kt(t){return function(e){return e.matches(t)}}var Zt=Array.prototype.find;function Pt(){return this.firstElementChild}var Ot=Array.prototype.filter;function jt(){return Array.from(this.children)}function qt(t){return new Array(t.length)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ee(t,e,i,s,r,a){for(var n,o=0,l=e.length,c=a.length;o<c;++o)(n=e[o])?(n.__data__=a[o],s[o]=n):i[o]=new te(t,a[o]);for(;o<l;++o)(n=e[o])&&(r[o]=n)}function ie(t,e,i,s,r,a,n){var o,l,c,d=new Map,h=e.length,u=a.length,g=new Array(h);for(o=0;o<h;++o)(l=e[o])&&(g[o]=c=n.call(l,l.__data__,o,e)+"",d.has(c)?r[o]=l:d.set(c,l));for(o=0;o<u;++o)c=n.call(t,a[o],o,a)+"",(l=d.get(c))?(s[o]=l,l.__data__=a[o],d.delete(c)):i[o]=new te(t,a[o]);for(o=0;o<h;++o)(l=e[o])&&d.get(g[o])===l&&(r[o]=l)}function se(t){return t.__data__}function re(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ae(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ne(t){return function(){this.removeAttribute(t)}}function oe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function le(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function de(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}function he(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 ue(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ge(t){return function(){this.style.removeProperty(t)}}function pe(t,e,i){return function(){this.style.setProperty(t,e,i)}}function me(t,e,i){return function(){var s=e.apply(this,arguments);null==s?this.style.removeProperty(t):this.style.setProperty(t,s,i)}}function be(t,e){return t.style.getPropertyValue(e)||ue(t).getComputedStyle(t,null).getPropertyValue(e)}function ye(t){return function(){delete this[t]}}function Qe(t,e){return function(){this[t]=e}}function Be(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function Ue(t){return t.trim().split(/^|\s+/)}function Fe(t){return t.classList||new Ie(t)}function Ie(t){this._node=t,this._names=Ue(t.getAttribute("class")||"")}function fe(t,e){for(var i=Fe(t),s=-1,r=e.length;++s<r;)i.add(e[s])}function Ce(t,e){for(var i=Fe(t),s=-1,r=e.length;++s<r;)i.remove(e[s])}function ve(t){return function(){fe(this,t)}}function Ae(t){return function(){Ce(this,t)}}function xe(t,e){return function(){(e.apply(this,arguments)?fe:Ce)(this,t)}}function Ee(){this.textContent=""}function Re(t){return function(){this.textContent=t}}function Se(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Ne(){this.innerHTML=""}function Le(t){return function(){this.innerHTML=t}}function we(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function De(){this.nextSibling&&this.parentNode.appendChild(this)}function Me(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ke(){return null}function Te(){var t=this.parentNode;t&&t.removeChild(this)}function Ve(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function He(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function $e(t){return function(){var e=this.__on;if(e){for(var i,s=0,r=-1,a=e.length;s<a;++s)i=e[s],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 ze(t,e,i){return function(){var s,r=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var n=0,o=r.length;n<o;++n)if((s=r[n]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=i),void(s.value=e);this.addEventListener(t.type,a,i),s={type:t.type,name:t.name,value:e,listener:a,options:i},r?r.push(s):this.__on=[s]}}function Ge(t,e,i){var s=ue(t),r=s.CustomEvent;"function"==typeof r?r=new r(e,i):(r=s.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Ye(t,e){return function(){return Ge(this,t,e)}}function Xe(t,e){return function(){return Ge(this,t,e.apply(this,arguments))}}te.prototype={constructor:te,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)}},Ie.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 Je=[null];function We(t,e){this._groups=t,this._parents=e}function _e(){return new We([[document.documentElement]],Je)}function Ke(t){return"string"==typeof t?new We([[document.querySelector(t)]],[document.documentElement]):new We([[t]],Je)}We.prototype=_e.prototype={constructor:We,select:function(t){"function"!=typeof t&&(t=Yt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n,o=e[r],l=o.length,c=s[r]=new Array(l),d=0;d<l;++d)(a=o[d])&&(n=t.call(a,a.__data__,d,o))&&("__data__"in a&&(n.__data__=a.__data__),c[d]=n);return new We(s,this._parents)},selectAll:function(t){t="function"==typeof t?Wt(t):Jt(t);for(var e=this._groups,i=e.length,s=[],r=[],a=0;a<i;++a)for(var n,o=e[a],l=o.length,c=0;c<l;++c)(n=o[c])&&(s.push(t.call(n,n.__data__,c,o)),r.push(n));return new We(s,r)},selectChild:function(t){return this.select(null==t?Pt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:Kt(t)))},selectChildren:function(t){return this.selectAll(null==t?jt:function(t){return function(){return Ot.call(this.children,t)}}("function"==typeof t?t:Kt(t)))},filter:function(t){"function"!=typeof t&&(t=_t(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new We(s,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,se);var i=e?ie:ee,s=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,n=new Array(a),o=new Array(a),l=new Array(a),c=0;c<a;++c){var d=s[c],h=r[c],u=h.length,g=re(t.call(d,d&&d.__data__,c,s)),p=g.length,m=o[c]=new Array(p),b=n[c]=new Array(p);i(d,h,m,b,l[c]=new Array(u),g,e);for(var y,Q,B=0,U=0;B<p;++B)if(y=m[B]){for(B>=U&&(U=B+1);!(Q=b[U])&&++U<p;);y._next=Q||null}}return(n=new We(n,s))._enter=o,n._exit=l,n},enter:function(){return new We(this._enter||this._groups.map(qt),this._parents)},exit:function(){return new We(this._exit||this._groups.map(qt),this._parents)},join:function(t,e,i){var s=this.enter(),r=this,a=this.exit();return"function"==typeof t?(s=t(s))&&(s=s.selection()):s=s.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==i?a.remove():i(a),s&&r?s.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,i=this._groups,s=e._groups,r=i.length,a=s.length,n=Math.min(r,a),o=new Array(r),l=0;l<n;++l)for(var c,d=i[l],h=s[l],u=d.length,g=o[l]=new Array(u),p=0;p<u;++p)(c=d[p]||h[p])&&(g[p]=c);for(;l<r;++l)o[l]=i[l];return new We(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var s,r=t[e],a=r.length-1,n=r[a];--a>=0;)(s=r[a])&&(n&&4^s.compareDocumentPosition(n)&&n.parentNode.insertBefore(s,n),n=s);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}t||(t=ae);for(var i=this._groups,s=i.length,r=new Array(s),a=0;a<s;++a){for(var n,o=i[a],l=o.length,c=r[a]=new Array(l),d=0;d<l;++d)(n=o[d])&&(c[d]=n);c.sort(e)}return new We(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 s=t[e],r=0,a=s.length;r<a;++r){var n=s[r];if(n)return n}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,s=e.length;i<s;++i)for(var r,a=e[i],n=0,o=a.length;n<o;++n)(r=a[n])&&t.call(r,r.__data__,n,a);return this},attr:function(t,e){var i=Vt(t);if(arguments.length<2){var s=this.node();return i.local?s.getAttributeNS(i.space,i.local):s.getAttribute(i)}return this.each((null==e?i.local?oe:ne:"function"==typeof e?i.local?he:de:i.local?ce:le)(i,e))},style:function(t,e,i){return arguments.length>1?this.each((null==e?ge:"function"==typeof e?me:pe)(t,e,null==i?"":i)):be(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ye:"function"==typeof e?Be:Qe)(t,e)):this.node()[t]},classed:function(t,e){var i=Ue(t+"");if(arguments.length<2){for(var s=Fe(this.node()),r=-1,a=i.length;++r<a;)if(!s.contains(i[r]))return!1;return!0}return this.each(("function"==typeof e?xe:e?ve:Ae)(i,e))},text:function(t){return arguments.length?this.each(null==t?Ee:("function"==typeof t?Se:Re)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ne:("function"==typeof t?we:Le)(t)):this.node().innerHTML},raise:function(){return this.each(De)},lower:function(){return this.each(Me)},append:function(t){var e="function"==typeof t?t:zt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var i="function"==typeof t?t:zt(t),s=null==e?ke:"function"==typeof e?e:Yt(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),s.apply(this,arguments)||null)})},remove:function(){return this.each(Te)},clone:function(t){return this.select(t?He:Ve)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,i){var s,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+""),n=a.length;if(!(arguments.length<2)){for(o=e?ze:$e,s=0;s<n;++s)this.each(o(a[s],e,i));return this}var o=this.node().__on;if(o)for(var l,c=0,d=o.length;c<d;++c)for(s=0,l=o[c];s<n;++s)if((r=a[s]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Xe:Ye)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var s,r=t[e],a=0,n=r.length;a<n;++a)(s=r[a])&&(yield s)}};var Ze=0;function Pe(){return new Oe}function Oe(){this._="@"+(++Ze).toString(36)}function je(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 s=i.createSVGPoint();return s.x=t.clientX,s.y=t.clientY,[(s=s.matrixTransform(e.getScreenCTM().inverse())).x,s.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]}Oe.prototype=Pe.prototype={constructor:Oe,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const qe={passive:!1},ti={capture:!0,passive:!1};function ei(t){t.stopImmediatePropagation()}function ii(t){t.preventDefault(),t.stopImmediatePropagation()}var si=t=>()=>t;function ri(t,{sourceEvent:e,subject:i,target:s,identifier:r,active:a,x:n,y:o,dx:l,dy:c,dispatch:d}){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:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:n,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:d}})}function ai(t){return!t.ctrlKey&&!t.button}function ni(){return this.parentNode}function oi(t,e){return null==e?{x:t.x,y:t.y}:e}function li(){return navigator.maxTouchPoints||"ontouchstart"in this}function ci(){var t,e,i,s,r=ai,a=ni,n=oi,o=li,l={},c=Lt("start","drag","end"),d=0,h=0;function u(t){t.on("mousedown.drag",g).filter(o).on("touchstart.drag",b).on("touchmove.drag",y,qe).on("touchend.drag touchcancel.drag",Q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(n,o){if(!s&&r.call(this,n,o)){var l=B(this,a.call(this,n,o),n,o,"mouse");l&&(Ke(n.view).on("mousemove.drag",p,ti).on("mouseup.drag",m,ti),function(t){var e=t.document.documentElement,i=Ke(t).on("dragstart.drag",ii,ti);"onselectstart"in e?i.on("selectstart.drag",ii,ti):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(n.view),ei(n),i=!1,t=n.clientX,e=n.clientY,l("start",n))}}function p(s){if(ii(s),!i){var r=s.clientX-t,a=s.clientY-e;i=r*r+a*a>h}l.mouse("drag",s)}function m(t){Ke(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var i=t.document.documentElement,s=Ke(t).on("dragstart.drag",null);e&&(s.on("click.drag",ii,ti),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in i?s.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}(t.view,i),ii(t),l.mouse("end",t)}function b(t,e){if(r.call(this,t,e)){var i,s,n=t.changedTouches,o=a.call(this,t,e),l=n.length;for(i=0;i<l;++i)(s=B(this,o,t,e,n[i].identifier,n[i]))&&(ei(t),s("start",t,n[i]))}}function y(t){var e,i,s=t.changedTouches,r=s.length;for(e=0;e<r;++e)(i=l[s[e].identifier])&&(ii(t),i("drag",t,s[e]))}function Q(t){var e,i,r=t.changedTouches,a=r.length;for(s&&clearTimeout(s),s=setTimeout(function(){s=null},500),e=0;e<a;++e)(i=l[r[e].identifier])&&(ei(t),i("end",t,r[e]))}function B(t,e,i,s,r,a){var o,h,g,p=c.copy(),m=je(a||i,e);if(null!=(g=n.call(t,new ri("beforestart",{sourceEvent:i,target:u,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),s)))return o=g.x-m[0]||0,h=g.y-m[1]||0,function i(a,n,c){var b,y=m;switch(a){case"start":l[r]=i,b=d++;break;case"end":delete l[r],--d;case"drag":m=je(c||n,e),b=d}p.call(a,t,new ri(a,{sourceEvent:n,subject:g,target:u,identifier:r,active:b,x:m[0]+o,y:m[1]+h,dx:m[0]-y[0],dy:m[1]-y[1],dispatch:p}),s)}}return u.filter=function(t){return arguments.length?(r="function"==typeof t?t:si(!!t),u):r},u.container=function(t){return arguments.length?(a="function"==typeof t?t:si(t),u):a},u.subject=function(t){return arguments.length?(n="function"==typeof t?t:si(t),u):n},u.touchable=function(t){return arguments.length?(o="function"==typeof t?t:si(!!t),u):o},u.on=function(){var t=c.on.apply(c,arguments);return t===c?u:t},u.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,u):Math.sqrt(h)},u}function di(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function hi(t,e){var i=Object.create(t.prototype);for(var s in e)i[s]=e[s];return i}function ui(){}ri.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var gi=.7,pi=1/gi,mi="\\s*([+-]?\\d+)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qi=/^#([0-9a-f]{3,8})$/,Bi=new RegExp(`^rgb\\(${mi},${mi},${mi}\\)$`),Ui=new RegExp(`^rgb\\(${yi},${yi},${yi}\\)$`),Fi=new RegExp(`^rgba\\(${mi},${mi},${mi},${bi}\\)$`),Ii=new RegExp(`^rgba\\(${yi},${yi},${yi},${bi}\\)$`),fi=new RegExp(`^hsl\\(${bi},${yi},${yi}\\)$`),Ci=new RegExp(`^hsla\\(${bi},${yi},${yi},${bi}\\)$`),vi={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 xi(){return this.rgb().formatRgb()}function Ei(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=Qi.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?Ri(e):3===i?new Li(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=Bi.exec(t))?new Li(e[1],e[2],e[3],1):(e=Ui.exec(t))?new Li(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Fi.exec(t))?Si(e[1],e[2],e[3],e[4]):(e=Ii.exec(t))?Si(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=fi.exec(t))?Vi(e[1],e[2]/100,e[3]/100,1):(e=Ci.exec(t))?Vi(e[1],e[2]/100,e[3]/100,e[4]):vi.hasOwnProperty(t)?Ri(vi[t]):"transparent"===t?new Li(NaN,NaN,NaN,0):null}function Ri(t){return new Li(t>>16&255,t>>8&255,255&t,1)}function Si(t,e,i,s){return s<=0&&(t=e=i=NaN),new Li(t,e,i,s)}function Ni(t,e,i,s){return 1===arguments.length?function(t){return t instanceof ui||(t=Ei(t)),t?new Li((t=t.rgb()).r,t.g,t.b,t.opacity):new Li}(t):new Li(t,e,i,null==s?1:s)}function Li(t,e,i,s){this.r=+t,this.g=+e,this.b=+i,this.opacity=+s}function wi(){return`#${Ti(this.r)}${Ti(this.g)}${Ti(this.b)}`}function Di(){const t=Mi(this.opacity);return`${1===t?"rgb(":"rgba("}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${1===t?")":`, ${t})`}`}function Mi(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ki(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ti(t){return((t=ki(t))<16?"0":"")+t.toString(16)}function Vi(t,e,i,s){return s<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new $i(t,e,i,s)}function Hi(t){if(t instanceof $i)return new $i(t.h,t.s,t.l,t.opacity);if(t instanceof ui||(t=Ei(t)),!t)return new $i;if(t instanceof $i)return t;var e=(t=t.rgb()).r/255,i=t.g/255,s=t.b/255,r=Math.min(e,i,s),a=Math.max(e,i,s),n=NaN,o=a-r,l=(a+r)/2;return o?(n=e===a?(i-s)/o+6*(i<s):i===a?(s-e)/o+2:(e-i)/o+4,o/=l<.5?a+r:2-a-r,n*=60):o=l>0&&l<1?0:n,new $i(n,o,l,t.opacity)}function $i(t,e,i,s){this.h=+t,this.s=+e,this.l=+i,this.opacity=+s}function zi(t){return(t=(t||0)%360)<0?t+360:t}function Gi(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)}di(ui,Ei,{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 Hi(this).formatHsl()},formatRgb:xi,toString:xi}),di(Li,Ni,hi(ui,{brighter(t){return t=null==t?pi:Math.pow(pi,t),new Li(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?gi:Math.pow(gi,t),new Li(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Li(ki(this.r),ki(this.g),ki(this.b),Mi(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:wi,formatHex:wi,formatHex8:function(){return`#${Ti(this.r)}${Ti(this.g)}${Ti(this.b)}${Ti(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Di,toString:Di})),di($i,function(t,e,i,s){return 1===arguments.length?Hi(t):new $i(t,e,i,null==s?1:s)},hi(ui,{brighter(t){return t=null==t?pi:Math.pow(pi,t),new $i(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?gi:Math.pow(gi,t),new $i(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,s=i+(i<.5?i:1-i)*e,r=2*i-s;return new Li(Yi(t>=240?t-240:t+120,r,s),Yi(t,r,s),Yi(t<120?t+240:t-120,r,s),this.opacity)},clamp(){return new $i(zi(this.h),Gi(this.s),Gi(this.l),Mi(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=Mi(this.opacity);return`${1===t?"hsl(":"hsla("}${zi(this.h)}, ${100*Gi(this.s)}%, ${100*Gi(this.l)}%${1===t?")":`, ${t})`}`}}));var Xi=t=>()=>t;function Ji(t){return 1===(t=+t)?Wi: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(s){return Math.pow(t+s*e,i)}}(e,i,t):Xi(isNaN(e)?i:e)}}function Wi(t,e){var i=e-t;return i?function(t,e){return function(i){return t+i*e}}(t,i):Xi(isNaN(t)?e:t)}var _i=function t(e){var i=Ji(e);function s(t,e){var s=i((t=Ni(t)).r,(e=Ni(e)).r),r=i(t.g,e.g),a=i(t.b,e.b),n=Wi(t.opacity,e.opacity);return function(e){return t.r=s(e),t.g=r(e),t.b=a(e),t.opacity=n(e),t+""}}return s.gamma=t,s}(1);function Ki(t,e){e||(e=[]);var i,s=t?Math.min(e.length,t.length):0,r=e.slice();return function(a){for(i=0;i<s;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Zi(t,e){var i,s=e?e.length:0,r=t?Math.min(s,t.length):0,a=new Array(r),n=new Array(s);for(i=0;i<r;++i)a[i]=is(t[i],e[i]);for(;i<s;++i)n[i]=e[i];return function(t){for(i=0;i<r;++i)n[i]=a[i](t);return n}}function Pi(t,e){var i=new Date;return t=+t,e=+e,function(s){return i.setTime(t*(1-s)+e*s),i}}function Oi(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function ji(t,e){var i,s={},r={};for(i in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)i in t?s[i]=is(t[i],e[i]):r[i]=e[i];return function(t){for(i in s)r[i]=s[i](t);return r}}var qi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ts=new RegExp(qi.source,"g");function es(t,e){var i,s,r,a=qi.lastIndex=ts.lastIndex=0,n=-1,o=[],l=[];for(t+="",e+="";(i=qi.exec(t))&&(s=ts.exec(e));)(r=s.index)>a&&(r=e.slice(a,r),o[n]?o[n]+=r:o[++n]=r),(i=i[0])===(s=s[0])?o[n]?o[n]+=s:o[++n]=s:(o[++n]=null,l.push({i:n,x:Oi(i,s)})),a=ts.lastIndex;return a<e.length&&(r=e.slice(a),o[n]?o[n]+=r:o[++n]=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,s=0;s<e;++s)o[(i=l[s]).i]=i.x(t);return o.join("")})}function is(t,e){var i,s=typeof e;return null==e||"boolean"===s?Xi(e):("number"===s?Oi:"string"===s?(i=Ei(e))?(e=i,_i):es:e instanceof Ei?_i:e instanceof Date?Pi:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Ki:Array.isArray(e)?Zi:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?ji:Oi)(t,e)}function ss(t,e){return t=+t,e=+e,function(i){return Math.round(t*(1-i)+e*i)}}var rs,as=180/Math.PI,ns={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function os(t,e,i,s,r,a){var n,o,l;return(n=Math.sqrt(t*t+e*e))&&(t/=n,e/=n),(l=t*i+e*s)&&(i-=t*l,s-=e*l),(o=Math.sqrt(i*i+s*s))&&(i/=o,s/=o,l/=o),t*s<e*i&&(t=-t,e=-e,l=-l,n=-n),{translateX:r,translateY:a,rotate:Math.atan2(e,t)*as,skewX:Math.atan(l)*as,scaleX:n,scaleY:o}}function ls(t,e,i,s){function r(t){return t.length?t.pop()+" ":""}return function(a,n){var o=[],l=[];return a=t(a),n=t(n),function(t,s,r,a,n,o){if(t!==r||s!==a){var l=n.push("translate(",null,e,null,i);o.push({i:l-4,x:Oi(t,r)},{i:l-2,x:Oi(s,a)})}else(r||a)&&n.push("translate("+r+e+a+i)}(a.translateX,a.translateY,n.translateX,n.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,s)-2,x:Oi(t,e)})):e&&i.push(r(i)+"rotate("+e+s)}(a.rotate,n.rotate,o,l),function(t,e,i,a){t!==e?a.push({i:i.push(r(i)+"skewX(",null,s)-2,x:Oi(t,e)}):e&&i.push(r(i)+"skewX("+e+s)}(a.skewX,n.skewX,o,l),function(t,e,i,s,a,n){if(t!==i||e!==s){var o=a.push(r(a)+"scale(",null,",",null,")");n.push({i:o-4,x:Oi(t,i)},{i:o-2,x:Oi(e,s)})}else 1===i&&1===s||a.push(r(a)+"scale("+i+","+s+")")}(a.scaleX,a.scaleY,n.scaleX,n.scaleY,o,l),a=n=null,function(t){for(var e,i=-1,s=l.length;++i<s;)o[(e=l[i]).i]=e.x(t);return o.join("")}}}var cs,ds,hs=ls(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ns:os(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),us=ls(function(t){return null==t?ns:(rs||(rs=document.createElementNS("http://www.w3.org/2000/svg","g")),rs.setAttribute("transform",t),(t=rs.transform.baseVal.consolidate())?os((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ns)},", ",")",")"),gs=0,ps=0,ms=0,bs=0,ys=0,Qs=0,Bs="object"==typeof performance&&performance.now?performance:Date,Us="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Fs(){return ys||(Us(Is),ys=Bs.now()+Qs)}function Is(){ys=0}function fs(){this._call=this._time=this._next=null}function Cs(t,e,i){var s=new fs;return s.restart(t,e,i),s}function vs(){ys=(bs=Bs.now())+Qs,gs=ps=0;try{!function(){Fs(),++gs;for(var t,e=cs;e;)(t=ys-e._time)>=0&&e._call.call(void 0,t),e=e._next;--gs}()}finally{gs=0,function(){var t,e,i=cs,s=1/0;for(;i;)i._call?(s>i._time&&(s=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:cs=e);ds=t,xs(s)}(),ys=0}}function As(){var t=Bs.now(),e=t-bs;e>1e3&&(Qs-=e,bs=t)}function xs(t){gs||(ps&&(ps=clearTimeout(ps)),t-ys>24?(t<1/0&&(ps=setTimeout(vs,t-Bs.now()-Qs)),ms&&(ms=clearInterval(ms))):(ms||(bs=Bs.now(),ms=setInterval(As,1e3)),gs=1,Us(vs)))}function Es(t,e,i){var s=new fs;return e=null==e?0:+e,s.restart(i=>{s.stop(),t(i+e)},e,i),s}fs.prototype=Cs.prototype={constructor:fs,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Fs():+i)+(null==e?0:+e),this._next||ds===this||(ds?ds._next=this:cs=this,ds=this),this._call=t,this._time=i,xs()},stop:function(){this._call&&(this._call=null,this._time=1/0,xs())}};var Rs=Lt("start","end","cancel","interrupt"),Ss=[];function Ns(t,e,i,s,r,a){var n=t.__transition;if(n){if(i in n)return}else t.__transition={};!function(t,e,i){var s,r=t.__transition;function a(t){i.state=1,i.timer.restart(n,i.delay,i.time),i.delay<=t&&n(t-i.delay)}function n(a){var c,d,h,u;if(1!==i.state)return l();for(c in r)if((u=r[c]).name===i.name){if(3===u.state)return Es(n);4===u.state?(u.state=6,u.timer.stop(),u.on.call("interrupt",t,t.__data__,u.index,u.group),delete r[c]):+c<e&&(u.state=6,u.timer.stop(),u.on.call("cancel",t,t.__data__,u.index,u.group),delete r[c])}if(Es(function(){3===i.state&&(i.state=4,i.timer.restart(o,i.delay,i.time),o(a))}),i.state=2,i.on.call("start",t,t.__data__,i.index,i.group),2===i.state){for(i.state=3,s=new Array(h=i.tween.length),c=0,d=-1;c<h;++c)(u=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(s[++d]=u);s.length=d+1}}function o(e){for(var r=e<i.duration?i.ease.call(null,e/i.duration):(i.timer.restart(l),i.state=5,1),a=-1,n=s.length;++a<n;)s[a].call(t,r);5===i.state&&(i.on.call("end",t,t.__data__,i.index,i.group),l())}function l(){for(var s in i.state=6,i.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=i,i.timer=Cs(a,0,i.time)}(t,i,{name:e,index:s,group:r,on:Rs,tween:Ss,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ls(t,e){var i=Ds(t,e);if(i.state>0)throw new Error("too late; already scheduled");return i}function ws(t,e){var i=Ds(t,e);if(i.state>3)throw new Error("too late; already running");return i}function Ds(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function Ms(t,e){var i,s;return function(){var r=ws(this,t),a=r.tween;if(a!==i)for(var n=0,o=(s=i=a).length;n<o;++n)if(s[n].name===e){(s=s.slice()).splice(n,1);break}r.tween=s}}function ks(t,e,i){var s,r;if("function"!=typeof i)throw new Error;return function(){var a=ws(this,t),n=a.tween;if(n!==s){r=(s=n).slice();for(var o={name:e,value:i},l=0,c=r.length;l<c;++l)if(r[l].name===e){r[l]=o;break}l===c&&r.push(o)}a.tween=r}}function Ts(t,e,i){var s=t._id;return t.each(function(){var t=ws(this,s);(t.value||(t.value={}))[e]=i.apply(this,arguments)}),function(t){return Ds(t,s).value[e]}}function Vs(t,e){var i;return("number"==typeof e?Oi:e instanceof Ei?_i:(i=Ei(e))?(e=i,_i):es)(t,e)}function Hs(t){return function(){this.removeAttribute(t)}}function $s(t){return function(){this.removeAttributeNS(t.space,t.local)}}function zs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttribute(t);return n===a?null:n===s?r:r=e(s=n,i)}}function Gs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttributeNS(t.space,t.local);return n===a?null:n===s?r:r=e(s=n,i)}}function Ys(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttribute(t))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttribute(t)}}function Xs(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttributeNS(t.space,t.local)}}function Js(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}(t,r)),i}return r._value=e,r}function Ws(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}(t,r)),i}return r._value=e,r}function _s(t,e){return function(){Ls(this,t).delay=+e.apply(this,arguments)}}function Ks(t,e){return e=+e,function(){Ls(this,t).delay=e}}function Zs(t,e){return function(){ws(this,t).duration=+e.apply(this,arguments)}}function Ps(t,e){return e=+e,function(){ws(this,t).duration=e}}var Os=_e.prototype.constructor;function js(t){return function(){this.style.removeProperty(t)}}var qs=0;function tr(t,e,i,s){this._groups=t,this._parents=e,this._name=i,this._id=s}function er(){return++qs}var ir=_e.prototype;tr.prototype={constructor:tr,select:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Yt(t));for(var s=this._groups,r=s.length,a=new Array(r),n=0;n<r;++n)for(var o,l,c=s[n],d=c.length,h=a[n]=new Array(d),u=0;u<d;++u)(o=c[u])&&(l=t.call(o,o.__data__,u,c))&&("__data__"in o&&(l.__data__=o.__data__),h[u]=l,Ns(h[u],e,i,u,h,Ds(o,i)));return new tr(a,this._parents,e,i)},selectAll:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Jt(t));for(var s=this._groups,r=s.length,a=[],n=[],o=0;o<r;++o)for(var l,c=s[o],d=c.length,h=0;h<d;++h)if(l=c[h]){for(var u,g=t.call(l,l.__data__,h,c),p=Ds(l,i),m=0,b=g.length;m<b;++m)(u=g[m])&&Ns(u,e,i,m,g,p);a.push(g),n.push(l)}return new tr(a,n,e,i)},selectChild:ir.selectChild,selectChildren:ir.selectChildren,filter:function(t){"function"!=typeof t&&(t=_t(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new tr(s,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,s=e.length,r=i.length,a=Math.min(s,r),n=new Array(s),o=0;o<a;++o)for(var l,c=e[o],d=i[o],h=c.length,u=n[o]=new Array(h),g=0;g<h;++g)(l=c[g]||d[g])&&(u[g]=l);for(;o<s;++o)n[o]=e[o];return new tr(n,this._parents,this._name,this._id)},selection:function(){return new Os(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,i=er(),s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)if(n=o[c]){var d=Ds(n,e);Ns(n,t,i,c,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new tr(s,this._parents,t,i)},call:ir.call,nodes:ir.nodes,node:ir.node,size:ir.size,empty:ir.empty,each:ir.each,on:function(t,e){var i=this._id;return arguments.length<2?Ds(this.node(),i).on.on(t):this.each(function(t,e,i){var s,r,a=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Ls:ws;return function(){var n=a(this,t),o=n.on;o!==s&&(r=(s=o).copy()).on(e,i),n.on=r}}(i,t,e))},attr:function(t,e){var i=Vt(t),s="transform"===i?us:Vs;return this.attrTween(t,"function"==typeof e?(i.local?Xs:Ys)(i,s,Ts(this,"attr."+t,e)):null==e?(i.local?$s:Hs)(i):(i.local?Gs:zs)(i,s,e))},attrTween:function(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;var s=Vt(t);return this.tween(i,(s.local?Js:Ws)(s,e))},style:function(t,e,i){var s="transform"==(t+="")?hs:Vs;return null==e?this.styleTween(t,function(t,e){var i,s,r;return function(){var a=be(this,t),n=(this.style.removeProperty(t),be(this,t));return a===n?null:a===i&&n===s?r:r=e(i=a,s=n)}}(t,s)).on("end.style."+t,js(t)):"function"==typeof e?this.styleTween(t,function(t,e,i){var s,r,a;return function(){var n=be(this,t),o=i(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=be(this,t)),n===l?null:n===s&&l===r?a:(r=l,a=e(s=n,o))}}(t,s,Ts(this,"style."+t,e))).each(function(t,e){var i,s,r,a,n="style."+e,o="end."+n;return function(){var l=ws(this,t),c=l.on,d=null==l.value[n]?a||(a=js(e)):void 0;c===i&&r===d||(s=(i=c).copy()).on(o,r=d),l.on=s}}(this._id,t)):this.styleTween(t,function(t,e,i){var s,r,a=i+"";return function(){var n=be(this,t);return n===a?null:n===s?r:r=e(s=n,i)}}(t,s,e),i).on("end.style."+t,null)},styleTween:function(t,e,i){var s="style."+(t+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(null==e)return this.tween(s,null);if("function"!=typeof e)throw new Error;return this.tween(s,function(t,e,i){var s,r;function a(){var a=e.apply(this,arguments);return a!==r&&(s=(r=a)&&function(t,e,i){return function(s){this.style.setProperty(t,e.call(this,s),i)}}(t,a,i)),s}return a._value=e,a}(t,e,null==i?"":i))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ts(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,i;function s(){var s=t.apply(this,arguments);return s!==i&&(e=(i=s)&&function(t){return function(e){this.textContent=t.call(this,e)}}(s)),e}return s._value=t,s}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var i=this._id;if(t+="",arguments.length<2){for(var s,r=Ds(this.node(),i).tween,a=0,n=r.length;a<n;++a)if((s=r[a]).name===t)return s.value;return null}return this.each((null==e?Ms:ks)(i,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?_s:Ks)(e,t)):Ds(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Zs:Ps)(e,t)):Ds(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){ws(this,t).ease=e}}(e,t)):Ds(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var i=e.apply(this,arguments);if("function"!=typeof i)throw new Error;ws(this,t).ease=i}}(this._id,t))},end:function(){var t,e,i=this,s=i._id,r=i.size();return new Promise(function(a,n){var o={value:n},l={value:function(){0===--r&&a()}};i.each(function(){var i=ws(this,s),r=i.on;r!==t&&((e=(t=r).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),i.on=e}),0===r&&a()})},[Symbol.iterator]:ir[Symbol.iterator]};const sr=t=>+t;function rr(t){return--t*t*t+1}var ar={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function nr(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}_e.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var i,s,r,a=t.__transition,n=!0;if(a){for(r in e=null==e?null:e+"",a)(i=a[r]).name===e?(s=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete a[r]):n=!1;n&&delete t.__transition}}(this,t)})},_e.prototype.transition=function(t){var e,i;t instanceof tr?(e=t._id,t=t._name):(e=er(),(i=ar).time=Fs(),t=null==t?null:t+"");for(var s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)(n=o[c])&&Ns(n,t,e,c,o,i||nr(n,e));return new tr(s,this._parents,t,e)};const or=Math.PI,lr=2*or,cr=1e-6,dr=lr-cr;function hr(t){this._+=t[0];for(let e=1,i=t.length;e<i;++e)this._+=arguments[e]+t[e]}class ur{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?hr:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return hr;const i=10**e;return function(t){this._+=t[0];for(let e=1,s=t.length;e<s;++e)this._+=Math.round(arguments[e]*i)/i+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,i,s){this._append`Q${+t},${+e},${this._x1=+i},${this._y1=+s}`}bezierCurveTo(t,e,i,s,r,a){this._append`C${+t},${+e},${+i},${+s},${this._x1=+r},${this._y1=+a}`}arcTo(t,e,i,s,r){if(t=+t,e=+e,i=+i,s=+s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=this._x1,n=this._y1,o=i-t,l=s-e,c=a-t,d=n-e,h=c*c+d*d;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>cr)if(Math.abs(d*o-l*c)>cr&&r){let u=i-a,g=s-n,p=o*o+l*l,m=u*u+g*g,b=Math.sqrt(p),y=Math.sqrt(h),Q=r*Math.tan((or-Math.acos((p+h-m)/(2*b*y)))/2),B=Q/y,U=Q/b;Math.abs(B-1)>cr&&this._append`L${t+B*c},${e+B*d}`,this._append`A${r},${r},0,0,${+(d*u>c*g)},${this._x1=t+U*o},${this._y1=e+U*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,i,s,r,a){if(t=+t,e=+e,a=!!a,(i=+i)<0)throw new Error(`negative radius: ${i}`);let n=i*Math.cos(s),o=i*Math.sin(s),l=t+n,c=e+o,d=1^a,h=a?s-r:r-s;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>cr||Math.abs(this._y1-c)>cr)&&this._append`L${l},${c}`,i&&(h<0&&(h=h%lr+lr),h>dr?this._append`A${i},${i},0,1,${d},${t-n},${e-o}A${i},${i},0,1,${d},${this._x1=l},${this._y1=c}`:h>cr&&this._append`A${i},${i},0,${+(h>=or)},${d},${this._x1=t+i*Math.cos(r)},${this._y1=e+i*Math.sin(r)}`)}rect(t,e,i,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function gr(t,e){if((i=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var i,s=t.slice(0,i);return[s.length>1?s[0]+s.slice(2):s,+t.slice(i+1)]}function pr(t){return(t=gr(Math.abs(t)))?t[1]:NaN}var mr,br=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yr(t){if(!(e=br.exec(t)))throw new Error("invalid format: "+t);var e;return new Qr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Qr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Br(t,e){var i=gr(t,e);if(!i)return t+"";var s=i[0],r=i[1];return r<0?"0."+new Array(-r).join("0")+s:s.length>r+1?s.slice(0,r+1)+"."+s.slice(r+1):s+new Array(r-s.length+2).join("0")}yr.prototype=Qr.prototype,Qr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ur={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Br(100*t,e),r:Br,s:function(t,e){var i=gr(t,e);if(!i)return t+"";var s=i[0],r=i[1],a=r-(mr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,n=s.length;return a===n?s:a>n?s+new Array(a-n+1).join("0"):a>0?s.slice(0,a)+"."+s.slice(a):"0."+new Array(1-a).join("0")+gr(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Fr(t){return t}var Ir,fr,Cr,vr=Array.prototype.map,Ar=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xr(t){var e,i,s=void 0===t.grouping||void 0===t.thousands?Fr:(e=vr.call(t.grouping,Number),i=t.thousands+"",function(t,s){for(var r=t.length,a=[],n=0,o=e[0],l=0;r>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),a.push(t.substring(r-=o,r+o)),!((l+=o+1)>s));)o=e[n=(n+1)%e.length];return a.reverse().join(i)}),r=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",n=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Fr:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(vr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",d=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=yr(t)).fill,i=t.align,h=t.sign,u=t.symbol,g=t.zero,p=t.width,m=t.comma,b=t.precision,y=t.trim,Q=t.type;"n"===Q?(m=!0,Q="g"):Ur[Q]||(void 0===b&&(b=12),y=!0,Q="g"),(g||"0"===e&&"="===i)&&(g=!0,e="0",i="=");var B="$"===u?r:"#"===u&&/[boxX]/.test(Q)?"0"+Q.toLowerCase():"",U="$"===u?a:/[%p]/.test(Q)?l:"",F=Ur[Q],I=/[defgprs%]/.test(Q);function f(t){var r,a,l,u=B,f=U;if("c"===Q)f=F(t)+f,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?d:F(Math.abs(t),b),y&&(t=function(t){t:for(var e,i=t.length,s=1,r=-1;s<i;++s)switch(t[s]){case".":r=e=s;break;case"0":0===r&&(r=s),e=s;break;default:if(!+t[s])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0===+t&&"+"!==h&&(C=!1),u=(C?"("===h?h:c:"-"===h||"("===h?"":h)+u,f=("s"===Q?Ar[8+mr/3]:"")+f+(C&&"("===h?")":""),I)for(r=-1,a=t.length;++r<a;)if(48>(l=t.charCodeAt(r))||l>57){f=(46===l?n+t.slice(r+1):t.slice(r))+f,t=t.slice(0,r);break}}m&&!g&&(t=s(t,1/0));var v=u.length+t.length+f.length,A=v<p?new Array(p-v+1).join(e):"";switch(m&&g&&(t=s(A+t,A.length?p-f.length:1/0),A=""),i){case"<":t=u+t+f+A;break;case"=":t=u+A+t+f;break;case"^":t=A.slice(0,v=A.length>>1)+u+t+f+A.slice(v);break;default:t=A+u+t+f}return o(t)}return b=void 0===b?6:/[gprs]/.test(Q)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),f.toString=function(){return t+""},f}return{format:h,formatPrefix:function(t,e){var i=h(((t=yr(t)).type="f",t)),s=3*Math.max(-8,Math.min(8,Math.floor(pr(e)/3))),r=Math.pow(10,-s),a=Ar[8+s/3];return function(t){return i(r*t)+a}}}}Ir=xr({thousands:",",grouping:[3],currency:["$",""]}),fr=Ir.format,Cr=Ir.formatPrefix;var Er=Math.random,Rr=function t(e){function i(t,i){return t=null==t?0:+t,i=null==i?1:+i,1===arguments.length?(i=t,t=0):i-=t,function(){return e()*i+t}}return i.source=t,i}(Er),Sr=function t(e){function i(t,i){var s,r;return t=null==t?0:+t,i=null==i?1:+i,function(){var a;if(null!=s)a=s,s=null;else do{s=2*e()-1,a=2*e()-1,r=s*s+a*a}while(!r||r>1);return t+i*a*Math.sqrt(-2*Math.log(r)/r)}}return i.source=t,i}(Er);const Nr=1/4294967296;function Lr(t=Math.random()){let e=0|(0<=t&&t<1?t/Nr:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Nr*(e>>>0))}function wr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Dr(t){return+t}var Mr=[0,1];function kr(t){return t}function Tr(t,e){return(e-=t=+t)?function(i){return(i-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Vr(t,e,i){var s=t[0],r=t[1],a=e[0],n=e[1];return r<s?(s=Tr(r,s),a=i(n,a)):(s=Tr(s,r),a=i(a,n)),function(t){return a(s(t))}}function Hr(t,e,i){var s=Math.min(t.length,e.length)-1,r=new Array(s),a=new Array(s),n=-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++n<s;)r[n]=Tr(t[n],t[n+1]),a[n]=i(e[n],e[n+1]);return function(e){var i=bt(t,e,1,s)-1;return a[i](r[i](e))}}function $r(){var t,e,i,s,r,a,n=Mr,o=Mr,l=is,c=kr;function d(){var t=Math.min(n.length,o.length);return c!==kr&&(c=function(t,e){var i;return t>e&&(i=t,t=e,e=i),function(i){return Math.max(t,Math.min(e,i))}}(n[0],n[t-1])),s=t>2?Hr:Vr,r=a=null,h}function h(e){return null==e||isNaN(e=+e)?i:(r||(r=s(n.map(t),o,l)))(t(c(e)))}return h.invert=function(i){return c(e((a||(a=s(o,n.map(t),Oi)))(i)))},h.domain=function(t){return arguments.length?(n=Array.from(t,Dr),d()):n.slice()},h.range=function(t){return arguments.length?(o=Array.from(t),d()):o.slice()},h.rangeRound=function(t){return o=Array.from(t),l=ss,d()},h.clamp=function(t){return arguments.length?(c=!!t||kr,d()):c!==kr},h.interpolate=function(t){return arguments.length?(l=t,d()):l},h.unknown=function(t){return arguments.length?(i=t,h):i},function(i,s){return t=i,e=s,d()}}function zr(t,e,i,s){var r,a=function(t,e,i){i=+i;const s=(e=+e)<(t=+t),r=s?Ft(e,t,i):Ft(t,e,i);return(s?-1:1)*(r<0?1/-r:r)}(t,e,i);switch((s=yr(null==s?",f":s)).type){case"s":var n=Math.max(Math.abs(t),Math.abs(e));return null!=s.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(pr(e)/3)))-pr(Math.abs(t)))}(a,n))||(s.precision=r),Cr(s,n);case"":case"e":case"g":case"p":case"r":null!=s.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,pr(e)-pr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(s.precision=r-("e"===s.type));break;case"f":case"%":null!=s.precision||isNaN(r=function(t){return Math.max(0,-pr(Math.abs(t)))}(a))||(s.precision=r-2*("%"===s.type))}return fr(s)}function Gr(t){var e=t.domain;return t.ticks=function(t){var i=e();return function(t,e,i){if(!((i=+i)>0))return[];if((t=+t)===(e=+e))return[t];const s=e<t,[r,a,n]=s?Ut(e,t,i):Ut(t,e,i);if(!(a>=r))return[];const o=a-r+1,l=new Array(o);if(s)if(n<0)for(let t=0;t<o;++t)l[t]=(a-t)/-n;else for(let t=0;t<o;++t)l[t]=(a-t)*n;else if(n<0)for(let t=0;t<o;++t)l[t]=(r+t)/-n;else for(let t=0;t<o;++t)l[t]=(r+t)*n;return l}(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,i){var s=e();return zr(s[0],s[s.length-1],null==t?10:t,i)},t.nice=function(i){null==i&&(i=10);var s,r,a=e(),n=0,o=a.length-1,l=a[n],c=a[o],d=10;for(c<l&&(r=l,l=c,c=r,r=n,n=o,o=r);d-- >0;){if((r=Ft(l,c,i))===s)return a[n]=l,a[o]=c,e(a);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}s=r}return t},t}function Yr(){var t=$r()(kr,kr);return t.copy=function(){return e=t,Yr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},wr.apply(t,arguments),Gr(t)}function Xr(t){return function(){return t}}function Jr(t){this._context=t}function Wr(t){return new Jr(t)}function _r(t){return t[0]}function Kr(t){return t[1]}function Zr(t,e){var i=Xr(!0),s=null,r=Wr,a=null,n=function(t){let e=3;return t.digits=function(i){if(!arguments.length)return e;if(null==i)e=null;else{const t=Math.floor(i);if(!(t>=0))throw new RangeError(`invalid digits: ${i}`);e=t}return t},()=>new ur(e)}(o);function o(o){var l,c,d,h=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,u=!1;for(null==s&&(a=r(d=n())),l=0;l<=h;++l)!(l<h&&i(c=o[l],l,o))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(c,l,o),+e(c,l,o));if(d)return a=null,d+""||null}return t="function"==typeof t?t:void 0===t?_r:Xr(t),e="function"==typeof e?e:void 0===e?Kr:Xr(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Xr(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Xr(+t),o):e},o.defined=function(t){return arguments.length?(i="function"==typeof t?t:Xr(!!t),o):i},o.curve=function(t){return arguments.length?(r=t,null!=s&&(a=r(s)),o):r},o.context=function(t){return arguments.length?(null==t?s=a=null:a=r(s=t),o):s},o}function Pr(t,e,i){this.k=t,this.x=e,this.y=i}Jr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},Pr.prototype={constructor:Pr,scale:function(t){return 1===t?this:new Pr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Pr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Pr.prototype;class Or extends dt{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),Ke(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",t=>{Ke(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)}).on("keydown.keyboard",t=>{Ke(t.currentTarget.renderRoot.host).classed("keyboard",!0).on("keydown.keyboard mousemove.keyboard touchstart.keyboard",null)})}static get greys(){const t="#999999",e={white:"#ffffff"};return e.light75=_i(t,"#ffffff")(.75),e.light50=_i(t,"#ffffff")(.5),e.light25=_i(t,"#ffffff")(.25),e.grey=t,e.dark25=_i(t,"#000000")(.25),e.dark50=_i(t,"#000000")(.5),e.dark75=_i(t,"#000000")(.75),e.black="#000000",e}static get shadows(){return{elevations:[0,2,4,8,16],baselineColor:"#000000",baselineColorString:"0, 0, 0",inverseBaselineColor:"#FFFFFF",inverseBaselineColorString:"255, 255, 255",opacityUmbra:.2,opacityPenumbra:.14,opacityAmbient:.12,opacityBoost:.2,mapUmbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:3,b:1,s:-2},4:{x:0,y:2,b:4,s:-1},8:{x:0,y:5,b:5,s:-3},16:{x:0,y:8,b:10,s:-5}},mapPenumbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:2,b:2,s:0},4:{x:0,y:4,b:5,s:0},8:{x:0,y:8,b:10,s:1},16:{x:0,y:16,b:24,s:2}},mapAmbient:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:1,b:5,s:0},4:{x:0,y:1,b:10,s:0},8:{x:0,y:3,b:14,s:2},16:{x:0,y:6,b:30,s:5}}}}static cssBoxShadow(t,e=!1,i=!1){const s=this.shadows.opacityUmbra+this.shadows.opacityBoost,r=this.shadows.opacityPenumbra+this.shadows.opacityBoost,a=this.shadows.opacityAmbient+this.shadows.opacityBoost,n=i?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,o=i?`rgba(${this.shadows.inverseBaselineColorString}, ${r})`:`rgba(${this.shadows.baselineColorString}, ${r})`,l=i?`rgba(${this.shadows.inverseBaselineColorString}, ${a})`:`rgba(${this.shadows.baselineColorString}, ${a})`,c=this.shadows.mapUmbra[t],d=this.shadows.mapPenumbra[t],h=this.shadows.mapAmbient[t];return`${e?`${-c.y}px ${c.y/2}px ${c.b}px ${c.s}px`:`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${n}, ${e?`${-d.y}px ${d.y/2}px ${d.b}px ${d.s}px`:`${d.y/2}px ${d.y}px ${d.b}px ${d.s}px`} ${o}, ${e?`${-h.y}px ${h.y/2}px ${h.b}px ${h.s}px`:`${h.y/2}px ${h.y}px ${h.b}px ${h.s}px`} ${l}`}static get svgFilters(){const t=Or.shadows,e=t.elevations.map(e=>J`
22
+ */class dt extends f{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=lt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}dt._$litElement$=!0,dt.finalized=!0,ct.litElementHydrateSupport?.({LitElement:dt});const ut=ct.litElementPolyfillSupport;function ht(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function gt(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function pt(t){let e,i,s;function r(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<0?r=e+1:a=e}while(r<a)}return r}return 2!==t.length?(e=ht,i=(e,i)=>ht(t(e),i),s=(e,i)=>t(e)-i):(e=t===ht||t===gt?t:mt,i=t,s=t),{left:r,center:function(t,e,i=0,a=t.length){const n=r(t,e,i,a-1);return n>i&&s(t[n-1],e)>-s(t[n],e)?n-1:n},right:function(t,s,r=0,a=t.length){if(r<a){if(0!==e(s,s))return a;do{const e=r+a>>>1;i(t[e],s)<=0?r=e+1:a=e}while(r<a)}return r}}}function mt(){return 0}ut?.({LitElement:dt}),(ct.litElementVersions??=[]).push("4.2.1");const bt=pt(ht).right;pt(function(t){return null===t?NaN:+t}).center;const Qt=Math.sqrt(50),Bt=Math.sqrt(10),yt=Math.sqrt(2);function Ut(t,e,i){const s=(e-t)/Math.max(0,i),r=Math.floor(Math.log10(s)),a=s/Math.pow(10,r),n=a>=Qt?10:a>=Bt?5:a>=yt?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/n,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)*n,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=i&&i<2?Ut(t,e,2*i):[o,l,c]}function Ft(t,e,i){return Ut(t=+t,e=+e,i=+i)[2]}function It(t){return t}var ft=1e-6;function Ct(t){return"translate("+t+",0)"}function vt(t){return"translate(0,"+t+")"}function At(t){return e=>+t(e)}function xt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),i=>+t(i)+e}function Et(){return!this.__axis}function Rt(t,e){var i=[],s=null,r=null,a=6,n=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,d=4===t||2===t?"x":"y",u=1===t||3===t?Ct:vt;function h(h){var g=null==s?e.ticks?e.ticks.apply(e,i):e.domain():s,p=null==r?e.tickFormat?e.tickFormat.apply(e,i):It:r,m=Math.max(a,0)+o,b=e.range(),Q=+b[0]+l,B=+b[b.length-1]+l,y=(e.bandwidth?xt:At)(e.copy(),l),U=h.selection?h.selection():h,F=U.selectAll(".domain").data([null]),I=U.selectAll(".tick").data(g,e).order(),f=I.exit(),C=I.enter().append("g").attr("class","tick"),v=I.select("line"),A=I.select("text");F=F.merge(F.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(C),v=v.merge(C.append("line").attr("stroke","currentColor").attr(d+"2",c*a)),A=A.merge(C.append("text").attr("fill","currentColor").attr(d,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),h!==U&&(F=F.transition(h),I=I.transition(h),v=v.transition(h),A=A.transition(h),f=f.transition(h).attr("opacity",ft).attr("transform",function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")}),C.attr("opacity",ft).attr("transform",function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)})),f.remove(),F.attr("d",4===t||2===t?n?"M"+c*n+","+Q+"H"+l+"V"+B+"H"+c*n:"M"+l+","+Q+"V"+B:n?"M"+Q+","+c*n+"V"+l+"H"+B+"V"+c*n:"M"+Q+","+l+"H"+B),I.attr("opacity",1).attr("transform",function(t){return u(y(t)+l)}),v.attr(d+"2",c*a),A.attr(d,c*m).text(p),U.filter(Et).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),U.each(function(){this.__axis=y})}return h.scale=function(t){return arguments.length?(e=t,h):e},h.ticks=function(){return i=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.from(t),h):i.slice()},h.tickValues=function(t){return arguments.length?(s=null==t?null:Array.from(t),h):s&&s.slice()},h.tickFormat=function(t){return arguments.length?(r=t,h):r},h.tickSize=function(t){return arguments.length?(a=n=+t,h):a},h.tickSizeInner=function(t){return arguments.length?(a=+t,h):a},h.tickSizeOuter=function(t){return arguments.length?(n=+t,h):n},h.tickPadding=function(t){return arguments.length?(o=+t,h):o},h.offset=function(t){return arguments.length?(l=+t,h):l},h}function St(t){return Rt(4,t)}var Nt={value:()=>{}};function Lt(){for(var t,e=0,i=arguments.length,s={};e<i;++e){if(!(t=arguments[e]+"")||t in s||/[\s.]/.test(t))throw new Error("illegal type: "+t);s[t]=[]}return new wt(s)}function wt(t){this._=t}function Dt(t,e){for(var i,s=0,r=t.length;s<r;++s)if((i=t[s]).name===e)return i.value}function Mt(t,e,i){for(var s=0,r=t.length;s<r;++s)if(t[s].name===e){t[s]=Nt,t=t.slice(0,s).concat(t.slice(s+1));break}return null!=i&&t.push({name:e,value:i}),t}wt.prototype=Lt.prototype={constructor:wt,on:function(t,e){var i,s,r=this._,a=(s=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&&!s.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),n=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++n<o;)if(i=(t=a[n]).type)r[i]=Mt(r[i],t.name,e);else if(null==e)for(i in r)r[i]=Mt(r[i],t.name,null);return this}for(;++n<o;)if((i=(t=a[n]).type)&&(i=Dt(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new wt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,s,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=(s=this._[t]).length;a<i;++a)s[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var s=this._[t],r=0,a=s.length;r<a;++r)s[r].value.apply(e,i)}};var kt="http://www.w3.org/1999/xhtml",Tt={svg:"http://www.w3.org/2000/svg",xhtml:kt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(t){var e=t+="",i=e.indexOf(":");return i>=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),Tt.hasOwnProperty(e)?{space:Tt[e],local:t}:t}function Ht(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===kt&&e.documentElement.namespaceURI===kt?e.createElement(t):e.createElementNS(i,t)}}function $t(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function zt(t){var e=Vt(t);return(e.local?$t:Ht)(e)}function Gt(){}function Yt(t){return null==t?Gt:function(){return this.querySelector(t)}}function Xt(){return[]}function Jt(t){return null==t?Xt:function(){return this.querySelectorAll(t)}}function Wt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function _t(t){return function(){return this.matches(t)}}function Kt(t){return function(e){return e.matches(t)}}var Zt=Array.prototype.find;function Pt(){return this.firstElementChild}var Ot=Array.prototype.filter;function jt(){return Array.from(this.children)}function qt(t){return new Array(t.length)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ee(t,e,i,s,r,a){for(var n,o=0,l=e.length,c=a.length;o<c;++o)(n=e[o])?(n.__data__=a[o],s[o]=n):i[o]=new te(t,a[o]);for(;o<l;++o)(n=e[o])&&(r[o]=n)}function ie(t,e,i,s,r,a,n){var o,l,c,d=new Map,u=e.length,h=a.length,g=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(g[o]=c=n.call(l,l.__data__,o,e)+"",d.has(c)?r[o]=l:d.set(c,l));for(o=0;o<h;++o)c=n.call(t,a[o],o,a)+"",(l=d.get(c))?(s[o]=l,l.__data__=a[o],d.delete(c)):i[o]=new te(t,a[o]);for(o=0;o<u;++o)(l=e[o])&&d.get(g[o])===l&&(r[o]=l)}function se(t){return t.__data__}function re(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ae(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ne(t){return function(){this.removeAttribute(t)}}function oe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function le(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function de(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}function ue(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 he(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ge(t){return function(){this.style.removeProperty(t)}}function pe(t,e,i){return function(){this.style.setProperty(t,e,i)}}function me(t,e,i){return function(){var s=e.apply(this,arguments);null==s?this.style.removeProperty(t):this.style.setProperty(t,s,i)}}function be(t,e){return t.style.getPropertyValue(e)||he(t).getComputedStyle(t,null).getPropertyValue(e)}function Qe(t){return function(){delete this[t]}}function Be(t,e){return function(){this[t]=e}}function ye(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function Ue(t){return t.trim().split(/^|\s+/)}function Fe(t){return t.classList||new Ie(t)}function Ie(t){this._node=t,this._names=Ue(t.getAttribute("class")||"")}function fe(t,e){for(var i=Fe(t),s=-1,r=e.length;++s<r;)i.add(e[s])}function Ce(t,e){for(var i=Fe(t),s=-1,r=e.length;++s<r;)i.remove(e[s])}function ve(t){return function(){fe(this,t)}}function Ae(t){return function(){Ce(this,t)}}function xe(t,e){return function(){(e.apply(this,arguments)?fe:Ce)(this,t)}}function Ee(){this.textContent=""}function Re(t){return function(){this.textContent=t}}function Se(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Ne(){this.innerHTML=""}function Le(t){return function(){this.innerHTML=t}}function we(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function De(){this.nextSibling&&this.parentNode.appendChild(this)}function Me(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ke(){return null}function Te(){var t=this.parentNode;t&&t.removeChild(this)}function Ve(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function He(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function $e(t){return function(){var e=this.__on;if(e){for(var i,s=0,r=-1,a=e.length;s<a;++s)i=e[s],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 ze(t,e,i){return function(){var s,r=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var n=0,o=r.length;n<o;++n)if((s=r[n]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=i),void(s.value=e);this.addEventListener(t.type,a,i),s={type:t.type,name:t.name,value:e,listener:a,options:i},r?r.push(s):this.__on=[s]}}function Ge(t,e,i){var s=he(t),r=s.CustomEvent;"function"==typeof r?r=new r(e,i):(r=s.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Ye(t,e){return function(){return Ge(this,t,e)}}function Xe(t,e){return function(){return Ge(this,t,e.apply(this,arguments))}}te.prototype={constructor:te,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)}},Ie.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 Je=[null];function We(t,e){this._groups=t,this._parents=e}function _e(){return new We([[document.documentElement]],Je)}function Ke(t){return"string"==typeof t?new We([[document.querySelector(t)]],[document.documentElement]):new We([[t]],Je)}We.prototype=_e.prototype={constructor:We,select:function(t){"function"!=typeof t&&(t=Yt(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n,o=e[r],l=o.length,c=s[r]=new Array(l),d=0;d<l;++d)(a=o[d])&&(n=t.call(a,a.__data__,d,o))&&("__data__"in a&&(n.__data__=a.__data__),c[d]=n);return new We(s,this._parents)},selectAll:function(t){t="function"==typeof t?Wt(t):Jt(t);for(var e=this._groups,i=e.length,s=[],r=[],a=0;a<i;++a)for(var n,o=e[a],l=o.length,c=0;c<l;++c)(n=o[c])&&(s.push(t.call(n,n.__data__,c,o)),r.push(n));return new We(s,r)},selectChild:function(t){return this.select(null==t?Pt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:Kt(t)))},selectChildren:function(t){return this.selectAll(null==t?jt:function(t){return function(){return Ot.call(this.children,t)}}("function"==typeof t?t:Kt(t)))},filter:function(t){"function"!=typeof t&&(t=_t(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new We(s,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,se);var i=e?ie:ee,s=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,n=new Array(a),o=new Array(a),l=new Array(a),c=0;c<a;++c){var d=s[c],u=r[c],h=u.length,g=re(t.call(d,d&&d.__data__,c,s)),p=g.length,m=o[c]=new Array(p),b=n[c]=new Array(p);i(d,u,m,b,l[c]=new Array(h),g,e);for(var Q,B,y=0,U=0;y<p;++y)if(Q=m[y]){for(y>=U&&(U=y+1);!(B=b[U])&&++U<p;);Q._next=B||null}}return(n=new We(n,s))._enter=o,n._exit=l,n},enter:function(){return new We(this._enter||this._groups.map(qt),this._parents)},exit:function(){return new We(this._exit||this._groups.map(qt),this._parents)},join:function(t,e,i){var s=this.enter(),r=this,a=this.exit();return"function"==typeof t?(s=t(s))&&(s=s.selection()):s=s.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==i?a.remove():i(a),s&&r?s.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,i=this._groups,s=e._groups,r=i.length,a=s.length,n=Math.min(r,a),o=new Array(r),l=0;l<n;++l)for(var c,d=i[l],u=s[l],h=d.length,g=o[l]=new Array(h),p=0;p<h;++p)(c=d[p]||u[p])&&(g[p]=c);for(;l<r;++l)o[l]=i[l];return new We(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var s,r=t[e],a=r.length-1,n=r[a];--a>=0;)(s=r[a])&&(n&&4^s.compareDocumentPosition(n)&&n.parentNode.insertBefore(s,n),n=s);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}t||(t=ae);for(var i=this._groups,s=i.length,r=new Array(s),a=0;a<s;++a){for(var n,o=i[a],l=o.length,c=r[a]=new Array(l),d=0;d<l;++d)(n=o[d])&&(c[d]=n);c.sort(e)}return new We(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 s=t[e],r=0,a=s.length;r<a;++r){var n=s[r];if(n)return n}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,s=e.length;i<s;++i)for(var r,a=e[i],n=0,o=a.length;n<o;++n)(r=a[n])&&t.call(r,r.__data__,n,a);return this},attr:function(t,e){var i=Vt(t);if(arguments.length<2){var s=this.node();return i.local?s.getAttributeNS(i.space,i.local):s.getAttribute(i)}return this.each((null==e?i.local?oe:ne:"function"==typeof e?i.local?ue:de:i.local?ce:le)(i,e))},style:function(t,e,i){return arguments.length>1?this.each((null==e?ge:"function"==typeof e?me:pe)(t,e,null==i?"":i)):be(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Qe:"function"==typeof e?ye:Be)(t,e)):this.node()[t]},classed:function(t,e){var i=Ue(t+"");if(arguments.length<2){for(var s=Fe(this.node()),r=-1,a=i.length;++r<a;)if(!s.contains(i[r]))return!1;return!0}return this.each(("function"==typeof e?xe:e?ve:Ae)(i,e))},text:function(t){return arguments.length?this.each(null==t?Ee:("function"==typeof t?Se:Re)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ne:("function"==typeof t?we:Le)(t)):this.node().innerHTML},raise:function(){return this.each(De)},lower:function(){return this.each(Me)},append:function(t){var e="function"==typeof t?t:zt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var i="function"==typeof t?t:zt(t),s=null==e?ke:"function"==typeof e?e:Yt(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),s.apply(this,arguments)||null)})},remove:function(){return this.each(Te)},clone:function(t){return this.select(t?He:Ve)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,i){var s,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+""),n=a.length;if(!(arguments.length<2)){for(o=e?ze:$e,s=0;s<n;++s)this.each(o(a[s],e,i));return this}var o=this.node().__on;if(o)for(var l,c=0,d=o.length;c<d;++c)for(s=0,l=o[c];s<n;++s)if((r=a[s]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Xe:Ye)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var s,r=t[e],a=0,n=r.length;a<n;++a)(s=r[a])&&(yield s)}};var Ze=0;function Pe(){return new Oe}function Oe(){this._="@"+(++Ze).toString(36)}function je(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 s=i.createSVGPoint();return s.x=t.clientX,s.y=t.clientY,[(s=s.matrixTransform(e.getScreenCTM().inverse())).x,s.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]}Oe.prototype=Pe.prototype={constructor:Oe,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const qe={passive:!1},ti={capture:!0,passive:!1};function ei(t){t.stopImmediatePropagation()}function ii(t){t.preventDefault(),t.stopImmediatePropagation()}var si=t=>()=>t;function ri(t,{sourceEvent:e,subject:i,target:s,identifier:r,active:a,x:n,y:o,dx:l,dy:c,dispatch:d}){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:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:n,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:d}})}function ai(t){return!t.ctrlKey&&!t.button}function ni(){return this.parentNode}function oi(t,e){return null==e?{x:t.x,y:t.y}:e}function li(){return navigator.maxTouchPoints||"ontouchstart"in this}function ci(){var t,e,i,s,r=ai,a=ni,n=oi,o=li,l={},c=Lt("start","drag","end"),d=0,u=0;function h(t){t.on("mousedown.drag",g).filter(o).on("touchstart.drag",b).on("touchmove.drag",Q,qe).on("touchend.drag touchcancel.drag",B).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(n,o){if(!s&&r.call(this,n,o)){var l=y(this,a.call(this,n,o),n,o,"mouse");l&&(Ke(n.view).on("mousemove.drag",p,ti).on("mouseup.drag",m,ti),function(t){var e=t.document.documentElement,i=Ke(t).on("dragstart.drag",ii,ti);"onselectstart"in e?i.on("selectstart.drag",ii,ti):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(n.view),ei(n),i=!1,t=n.clientX,e=n.clientY,l("start",n))}}function p(s){if(ii(s),!i){var r=s.clientX-t,a=s.clientY-e;i=r*r+a*a>u}l.mouse("drag",s)}function m(t){Ke(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var i=t.document.documentElement,s=Ke(t).on("dragstart.drag",null);e&&(s.on("click.drag",ii,ti),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in i?s.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}(t.view,i),ii(t),l.mouse("end",t)}function b(t,e){if(r.call(this,t,e)){var i,s,n=t.changedTouches,o=a.call(this,t,e),l=n.length;for(i=0;i<l;++i)(s=y(this,o,t,e,n[i].identifier,n[i]))&&(ei(t),s("start",t,n[i]))}}function Q(t){var e,i,s=t.changedTouches,r=s.length;for(e=0;e<r;++e)(i=l[s[e].identifier])&&(ii(t),i("drag",t,s[e]))}function B(t){var e,i,r=t.changedTouches,a=r.length;for(s&&clearTimeout(s),s=setTimeout(function(){s=null},500),e=0;e<a;++e)(i=l[r[e].identifier])&&(ei(t),i("end",t,r[e]))}function y(t,e,i,s,r,a){var o,u,g,p=c.copy(),m=je(a||i,e);if(null!=(g=n.call(t,new ri("beforestart",{sourceEvent:i,target:h,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),s)))return o=g.x-m[0]||0,u=g.y-m[1]||0,function i(a,n,c){var b,Q=m;switch(a){case"start":l[r]=i,b=d++;break;case"end":delete l[r],--d;case"drag":m=je(c||n,e),b=d}p.call(a,t,new ri(a,{sourceEvent:n,subject:g,target:h,identifier:r,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-Q[0],dy:m[1]-Q[1],dispatch:p}),s)}}return h.filter=function(t){return arguments.length?(r="function"==typeof t?t:si(!!t),h):r},h.container=function(t){return arguments.length?(a="function"==typeof t?t:si(t),h):a},h.subject=function(t){return arguments.length?(n="function"==typeof t?t:si(t),h):n},h.touchable=function(t){return arguments.length?(o="function"==typeof t?t:si(!!t),h):o},h.on=function(){var t=c.on.apply(c,arguments);return t===c?h:t},h.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,h):Math.sqrt(u)},h}function di(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function ui(t,e){var i=Object.create(t.prototype);for(var s in e)i[s]=e[s];return i}function hi(){}ri.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var gi=.7,pi=1/gi,mi="\\s*([+-]?\\d+)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Bi=/^#([0-9a-f]{3,8})$/,yi=new RegExp(`^rgb\\(${mi},${mi},${mi}\\)$`),Ui=new RegExp(`^rgb\\(${Qi},${Qi},${Qi}\\)$`),Fi=new RegExp(`^rgba\\(${mi},${mi},${mi},${bi}\\)$`),Ii=new RegExp(`^rgba\\(${Qi},${Qi},${Qi},${bi}\\)$`),fi=new RegExp(`^hsl\\(${bi},${Qi},${Qi}\\)$`),Ci=new RegExp(`^hsla\\(${bi},${Qi},${Qi},${bi}\\)$`),vi={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 xi(){return this.rgb().formatRgb()}function Ei(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=Bi.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?Ri(e):3===i?new Li(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=yi.exec(t))?new Li(e[1],e[2],e[3],1):(e=Ui.exec(t))?new Li(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Fi.exec(t))?Si(e[1],e[2],e[3],e[4]):(e=Ii.exec(t))?Si(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=fi.exec(t))?Vi(e[1],e[2]/100,e[3]/100,1):(e=Ci.exec(t))?Vi(e[1],e[2]/100,e[3]/100,e[4]):vi.hasOwnProperty(t)?Ri(vi[t]):"transparent"===t?new Li(NaN,NaN,NaN,0):null}function Ri(t){return new Li(t>>16&255,t>>8&255,255&t,1)}function Si(t,e,i,s){return s<=0&&(t=e=i=NaN),new Li(t,e,i,s)}function Ni(t,e,i,s){return 1===arguments.length?function(t){return t instanceof hi||(t=Ei(t)),t?new Li((t=t.rgb()).r,t.g,t.b,t.opacity):new Li}(t):new Li(t,e,i,null==s?1:s)}function Li(t,e,i,s){this.r=+t,this.g=+e,this.b=+i,this.opacity=+s}function wi(){return`#${Ti(this.r)}${Ti(this.g)}${Ti(this.b)}`}function Di(){const t=Mi(this.opacity);return`${1===t?"rgb(":"rgba("}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${1===t?")":`, ${t})`}`}function Mi(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ki(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ti(t){return((t=ki(t))<16?"0":"")+t.toString(16)}function Vi(t,e,i,s){return s<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new $i(t,e,i,s)}function Hi(t){if(t instanceof $i)return new $i(t.h,t.s,t.l,t.opacity);if(t instanceof hi||(t=Ei(t)),!t)return new $i;if(t instanceof $i)return t;var e=(t=t.rgb()).r/255,i=t.g/255,s=t.b/255,r=Math.min(e,i,s),a=Math.max(e,i,s),n=NaN,o=a-r,l=(a+r)/2;return o?(n=e===a?(i-s)/o+6*(i<s):i===a?(s-e)/o+2:(e-i)/o+4,o/=l<.5?a+r:2-a-r,n*=60):o=l>0&&l<1?0:n,new $i(n,o,l,t.opacity)}function $i(t,e,i,s){this.h=+t,this.s=+e,this.l=+i,this.opacity=+s}function zi(t){return(t=(t||0)%360)<0?t+360:t}function Gi(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)}di(hi,Ei,{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 Hi(this).formatHsl()},formatRgb:xi,toString:xi}),di(Li,Ni,ui(hi,{brighter(t){return t=null==t?pi:Math.pow(pi,t),new Li(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?gi:Math.pow(gi,t),new Li(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Li(ki(this.r),ki(this.g),ki(this.b),Mi(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:wi,formatHex:wi,formatHex8:function(){return`#${Ti(this.r)}${Ti(this.g)}${Ti(this.b)}${Ti(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Di,toString:Di})),di($i,function(t,e,i,s){return 1===arguments.length?Hi(t):new $i(t,e,i,null==s?1:s)},ui(hi,{brighter(t){return t=null==t?pi:Math.pow(pi,t),new $i(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?gi:Math.pow(gi,t),new $i(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,s=i+(i<.5?i:1-i)*e,r=2*i-s;return new Li(Yi(t>=240?t-240:t+120,r,s),Yi(t,r,s),Yi(t<120?t+240:t-120,r,s),this.opacity)},clamp(){return new $i(zi(this.h),Gi(this.s),Gi(this.l),Mi(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=Mi(this.opacity);return`${1===t?"hsl(":"hsla("}${zi(this.h)}, ${100*Gi(this.s)}%, ${100*Gi(this.l)}%${1===t?")":`, ${t})`}`}}));var Xi=t=>()=>t;function Ji(t){return 1===(t=+t)?Wi: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(s){return Math.pow(t+s*e,i)}}(e,i,t):Xi(isNaN(e)?i:e)}}function Wi(t,e){var i=e-t;return i?function(t,e){return function(i){return t+i*e}}(t,i):Xi(isNaN(t)?e:t)}var _i=function t(e){var i=Ji(e);function s(t,e){var s=i((t=Ni(t)).r,(e=Ni(e)).r),r=i(t.g,e.g),a=i(t.b,e.b),n=Wi(t.opacity,e.opacity);return function(e){return t.r=s(e),t.g=r(e),t.b=a(e),t.opacity=n(e),t+""}}return s.gamma=t,s}(1);function Ki(t,e){e||(e=[]);var i,s=t?Math.min(e.length,t.length):0,r=e.slice();return function(a){for(i=0;i<s;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Zi(t,e){var i,s=e?e.length:0,r=t?Math.min(s,t.length):0,a=new Array(r),n=new Array(s);for(i=0;i<r;++i)a[i]=is(t[i],e[i]);for(;i<s;++i)n[i]=e[i];return function(t){for(i=0;i<r;++i)n[i]=a[i](t);return n}}function Pi(t,e){var i=new Date;return t=+t,e=+e,function(s){return i.setTime(t*(1-s)+e*s),i}}function Oi(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function ji(t,e){var i,s={},r={};for(i in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)i in t?s[i]=is(t[i],e[i]):r[i]=e[i];return function(t){for(i in s)r[i]=s[i](t);return r}}var qi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ts=new RegExp(qi.source,"g");function es(t,e){var i,s,r,a=qi.lastIndex=ts.lastIndex=0,n=-1,o=[],l=[];for(t+="",e+="";(i=qi.exec(t))&&(s=ts.exec(e));)(r=s.index)>a&&(r=e.slice(a,r),o[n]?o[n]+=r:o[++n]=r),(i=i[0])===(s=s[0])?o[n]?o[n]+=s:o[++n]=s:(o[++n]=null,l.push({i:n,x:Oi(i,s)})),a=ts.lastIndex;return a<e.length&&(r=e.slice(a),o[n]?o[n]+=r:o[++n]=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,s=0;s<e;++s)o[(i=l[s]).i]=i.x(t);return o.join("")})}function is(t,e){var i,s=typeof e;return null==e||"boolean"===s?Xi(e):("number"===s?Oi:"string"===s?(i=Ei(e))?(e=i,_i):es:e instanceof Ei?_i:e instanceof Date?Pi:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Ki:Array.isArray(e)?Zi:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?ji:Oi)(t,e)}function ss(t,e){return t=+t,e=+e,function(i){return Math.round(t*(1-i)+e*i)}}var rs,as=180/Math.PI,ns={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function os(t,e,i,s,r,a){var n,o,l;return(n=Math.sqrt(t*t+e*e))&&(t/=n,e/=n),(l=t*i+e*s)&&(i-=t*l,s-=e*l),(o=Math.sqrt(i*i+s*s))&&(i/=o,s/=o,l/=o),t*s<e*i&&(t=-t,e=-e,l=-l,n=-n),{translateX:r,translateY:a,rotate:Math.atan2(e,t)*as,skewX:Math.atan(l)*as,scaleX:n,scaleY:o}}function ls(t,e,i,s){function r(t){return t.length?t.pop()+" ":""}return function(a,n){var o=[],l=[];return a=t(a),n=t(n),function(t,s,r,a,n,o){if(t!==r||s!==a){var l=n.push("translate(",null,e,null,i);o.push({i:l-4,x:Oi(t,r)},{i:l-2,x:Oi(s,a)})}else(r||a)&&n.push("translate("+r+e+a+i)}(a.translateX,a.translateY,n.translateX,n.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,s)-2,x:Oi(t,e)})):e&&i.push(r(i)+"rotate("+e+s)}(a.rotate,n.rotate,o,l),function(t,e,i,a){t!==e?a.push({i:i.push(r(i)+"skewX(",null,s)-2,x:Oi(t,e)}):e&&i.push(r(i)+"skewX("+e+s)}(a.skewX,n.skewX,o,l),function(t,e,i,s,a,n){if(t!==i||e!==s){var o=a.push(r(a)+"scale(",null,",",null,")");n.push({i:o-4,x:Oi(t,i)},{i:o-2,x:Oi(e,s)})}else 1===i&&1===s||a.push(r(a)+"scale("+i+","+s+")")}(a.scaleX,a.scaleY,n.scaleX,n.scaleY,o,l),a=n=null,function(t){for(var e,i=-1,s=l.length;++i<s;)o[(e=l[i]).i]=e.x(t);return o.join("")}}}var cs,ds,us=ls(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ns:os(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),hs=ls(function(t){return null==t?ns:(rs||(rs=document.createElementNS("http://www.w3.org/2000/svg","g")),rs.setAttribute("transform",t),(t=rs.transform.baseVal.consolidate())?os((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ns)},", ",")",")"),gs=0,ps=0,ms=0,bs=0,Qs=0,Bs=0,ys="object"==typeof performance&&performance.now?performance:Date,Us="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Fs(){return Qs||(Us(Is),Qs=ys.now()+Bs)}function Is(){Qs=0}function fs(){this._call=this._time=this._next=null}function Cs(t,e,i){var s=new fs;return s.restart(t,e,i),s}function vs(){Qs=(bs=ys.now())+Bs,gs=ps=0;try{!function(){Fs(),++gs;for(var t,e=cs;e;)(t=Qs-e._time)>=0&&e._call.call(void 0,t),e=e._next;--gs}()}finally{gs=0,function(){var t,e,i=cs,s=1/0;for(;i;)i._call?(s>i._time&&(s=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:cs=e);ds=t,xs(s)}(),Qs=0}}function As(){var t=ys.now(),e=t-bs;e>1e3&&(Bs-=e,bs=t)}function xs(t){gs||(ps&&(ps=clearTimeout(ps)),t-Qs>24?(t<1/0&&(ps=setTimeout(vs,t-ys.now()-Bs)),ms&&(ms=clearInterval(ms))):(ms||(bs=ys.now(),ms=setInterval(As,1e3)),gs=1,Us(vs)))}function Es(t,e,i){var s=new fs;return e=null==e?0:+e,s.restart(i=>{s.stop(),t(i+e)},e,i),s}fs.prototype=Cs.prototype={constructor:fs,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Fs():+i)+(null==e?0:+e),this._next||ds===this||(ds?ds._next=this:cs=this,ds=this),this._call=t,this._time=i,xs()},stop:function(){this._call&&(this._call=null,this._time=1/0,xs())}};var Rs=Lt("start","end","cancel","interrupt"),Ss=[];function Ns(t,e,i,s,r,a){var n=t.__transition;if(n){if(i in n)return}else t.__transition={};!function(t,e,i){var s,r=t.__transition;function a(t){i.state=1,i.timer.restart(n,i.delay,i.time),i.delay<=t&&n(t-i.delay)}function n(a){var c,d,u,h;if(1!==i.state)return l();for(c in r)if((h=r[c]).name===i.name){if(3===h.state)return Es(n);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[c]):+c<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[c])}if(Es(function(){3===i.state&&(i.state=4,i.timer.restart(o,i.delay,i.time),o(a))}),i.state=2,i.on.call("start",t,t.__data__,i.index,i.group),2===i.state){for(i.state=3,s=new Array(u=i.tween.length),c=0,d=-1;c<u;++c)(h=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(s[++d]=h);s.length=d+1}}function o(e){for(var r=e<i.duration?i.ease.call(null,e/i.duration):(i.timer.restart(l),i.state=5,1),a=-1,n=s.length;++a<n;)s[a].call(t,r);5===i.state&&(i.on.call("end",t,t.__data__,i.index,i.group),l())}function l(){for(var s in i.state=6,i.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=i,i.timer=Cs(a,0,i.time)}(t,i,{name:e,index:s,group:r,on:Rs,tween:Ss,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ls(t,e){var i=Ds(t,e);if(i.state>0)throw new Error("too late; already scheduled");return i}function ws(t,e){var i=Ds(t,e);if(i.state>3)throw new Error("too late; already running");return i}function Ds(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function Ms(t,e){var i,s;return function(){var r=ws(this,t),a=r.tween;if(a!==i)for(var n=0,o=(s=i=a).length;n<o;++n)if(s[n].name===e){(s=s.slice()).splice(n,1);break}r.tween=s}}function ks(t,e,i){var s,r;if("function"!=typeof i)throw new Error;return function(){var a=ws(this,t),n=a.tween;if(n!==s){r=(s=n).slice();for(var o={name:e,value:i},l=0,c=r.length;l<c;++l)if(r[l].name===e){r[l]=o;break}l===c&&r.push(o)}a.tween=r}}function Ts(t,e,i){var s=t._id;return t.each(function(){var t=ws(this,s);(t.value||(t.value={}))[e]=i.apply(this,arguments)}),function(t){return Ds(t,s).value[e]}}function Vs(t,e){var i;return("number"==typeof e?Oi:e instanceof Ei?_i:(i=Ei(e))?(e=i,_i):es)(t,e)}function Hs(t){return function(){this.removeAttribute(t)}}function $s(t){return function(){this.removeAttributeNS(t.space,t.local)}}function zs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttribute(t);return n===a?null:n===s?r:r=e(s=n,i)}}function Gs(t,e,i){var s,r,a=i+"";return function(){var n=this.getAttributeNS(t.space,t.local);return n===a?null:n===s?r:r=e(s=n,i)}}function Ys(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttribute(t))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttribute(t)}}function Xs(t,e,i){var s,r,a;return function(){var n,o,l=i(this);if(null!=l)return(n=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:n===s&&o===r?a:(r=o,a=e(s=n,l));this.removeAttributeNS(t.space,t.local)}}function Js(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}(t,r)),i}return r._value=e,r}function Ws(t,e){var i,s;function r(){var r=e.apply(this,arguments);return r!==s&&(i=(s=r)&&function(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}(t,r)),i}return r._value=e,r}function _s(t,e){return function(){Ls(this,t).delay=+e.apply(this,arguments)}}function Ks(t,e){return e=+e,function(){Ls(this,t).delay=e}}function Zs(t,e){return function(){ws(this,t).duration=+e.apply(this,arguments)}}function Ps(t,e){return e=+e,function(){ws(this,t).duration=e}}var Os=_e.prototype.constructor;function js(t){return function(){this.style.removeProperty(t)}}var qs=0;function tr(t,e,i,s){this._groups=t,this._parents=e,this._name=i,this._id=s}function er(){return++qs}var ir=_e.prototype;tr.prototype={constructor:tr,select:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Yt(t));for(var s=this._groups,r=s.length,a=new Array(r),n=0;n<r;++n)for(var o,l,c=s[n],d=c.length,u=a[n]=new Array(d),h=0;h<d;++h)(o=c[h])&&(l=t.call(o,o.__data__,h,c))&&("__data__"in o&&(l.__data__=o.__data__),u[h]=l,Ns(u[h],e,i,h,u,Ds(o,i)));return new tr(a,this._parents,e,i)},selectAll:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Jt(t));for(var s=this._groups,r=s.length,a=[],n=[],o=0;o<r;++o)for(var l,c=s[o],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var h,g=t.call(l,l.__data__,u,c),p=Ds(l,i),m=0,b=g.length;m<b;++m)(h=g[m])&&Ns(h,e,i,m,g,p);a.push(g),n.push(l)}return new tr(a,n,e,i)},selectChild:ir.selectChild,selectChildren:ir.selectChildren,filter:function(t){"function"!=typeof t&&(t=_t(t));for(var e=this._groups,i=e.length,s=new Array(i),r=0;r<i;++r)for(var a,n=e[r],o=n.length,l=s[r]=[],c=0;c<o;++c)(a=n[c])&&t.call(a,a.__data__,c,n)&&l.push(a);return new tr(s,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,s=e.length,r=i.length,a=Math.min(s,r),n=new Array(s),o=0;o<a;++o)for(var l,c=e[o],d=i[o],u=c.length,h=n[o]=new Array(u),g=0;g<u;++g)(l=c[g]||d[g])&&(h[g]=l);for(;o<s;++o)n[o]=e[o];return new tr(n,this._parents,this._name,this._id)},selection:function(){return new Os(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,i=er(),s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)if(n=o[c]){var d=Ds(n,e);Ns(n,t,i,c,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new tr(s,this._parents,t,i)},call:ir.call,nodes:ir.nodes,node:ir.node,size:ir.size,empty:ir.empty,each:ir.each,on:function(t,e){var i=this._id;return arguments.length<2?Ds(this.node(),i).on.on(t):this.each(function(t,e,i){var s,r,a=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Ls:ws;return function(){var n=a(this,t),o=n.on;o!==s&&(r=(s=o).copy()).on(e,i),n.on=r}}(i,t,e))},attr:function(t,e){var i=Vt(t),s="transform"===i?hs:Vs;return this.attrTween(t,"function"==typeof e?(i.local?Xs:Ys)(i,s,Ts(this,"attr."+t,e)):null==e?(i.local?$s:Hs)(i):(i.local?Gs:zs)(i,s,e))},attrTween:function(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;var s=Vt(t);return this.tween(i,(s.local?Js:Ws)(s,e))},style:function(t,e,i){var s="transform"==(t+="")?us:Vs;return null==e?this.styleTween(t,function(t,e){var i,s,r;return function(){var a=be(this,t),n=(this.style.removeProperty(t),be(this,t));return a===n?null:a===i&&n===s?r:r=e(i=a,s=n)}}(t,s)).on("end.style."+t,js(t)):"function"==typeof e?this.styleTween(t,function(t,e,i){var s,r,a;return function(){var n=be(this,t),o=i(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=be(this,t)),n===l?null:n===s&&l===r?a:(r=l,a=e(s=n,o))}}(t,s,Ts(this,"style."+t,e))).each(function(t,e){var i,s,r,a,n="style."+e,o="end."+n;return function(){var l=ws(this,t),c=l.on,d=null==l.value[n]?a||(a=js(e)):void 0;c===i&&r===d||(s=(i=c).copy()).on(o,r=d),l.on=s}}(this._id,t)):this.styleTween(t,function(t,e,i){var s,r,a=i+"";return function(){var n=be(this,t);return n===a?null:n===s?r:r=e(s=n,i)}}(t,s,e),i).on("end.style."+t,null)},styleTween:function(t,e,i){var s="style."+(t+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(null==e)return this.tween(s,null);if("function"!=typeof e)throw new Error;return this.tween(s,function(t,e,i){var s,r;function a(){var a=e.apply(this,arguments);return a!==r&&(s=(r=a)&&function(t,e,i){return function(s){this.style.setProperty(t,e.call(this,s),i)}}(t,a,i)),s}return a._value=e,a}(t,e,null==i?"":i))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ts(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,i;function s(){var s=t.apply(this,arguments);return s!==i&&(e=(i=s)&&function(t){return function(e){this.textContent=t.call(this,e)}}(s)),e}return s._value=t,s}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var i=this._id;if(t+="",arguments.length<2){for(var s,r=Ds(this.node(),i).tween,a=0,n=r.length;a<n;++a)if((s=r[a]).name===t)return s.value;return null}return this.each((null==e?Ms:ks)(i,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?_s:Ks)(e,t)):Ds(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Zs:Ps)(e,t)):Ds(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){ws(this,t).ease=e}}(e,t)):Ds(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var i=e.apply(this,arguments);if("function"!=typeof i)throw new Error;ws(this,t).ease=i}}(this._id,t))},end:function(){var t,e,i=this,s=i._id,r=i.size();return new Promise(function(a,n){var o={value:n},l={value:function(){0===--r&&a()}};i.each(function(){var i=ws(this,s),r=i.on;r!==t&&((e=(t=r).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),i.on=e}),0===r&&a()})},[Symbol.iterator]:ir[Symbol.iterator]};const sr=t=>+t;function rr(t){return--t*t*t+1}var ar={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function nr(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}_e.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var i,s,r,a=t.__transition,n=!0;if(a){for(r in e=null==e?null:e+"",a)(i=a[r]).name===e?(s=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete a[r]):n=!1;n&&delete t.__transition}}(this,t)})},_e.prototype.transition=function(t){var e,i;t instanceof tr?(e=t._id,t=t._name):(e=er(),(i=ar).time=Fs(),t=null==t?null:t+"");for(var s=this._groups,r=s.length,a=0;a<r;++a)for(var n,o=s[a],l=o.length,c=0;c<l;++c)(n=o[c])&&Ns(n,t,e,c,o,i||nr(n,e));return new tr(s,this._parents,t,e)};const or=Math.PI,lr=2*or,cr=1e-6,dr=lr-cr;function ur(t){this._+=t[0];for(let e=1,i=t.length;e<i;++e)this._+=arguments[e]+t[e]}class hr{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?ur:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ur;const i=10**e;return function(t){this._+=t[0];for(let e=1,s=t.length;e<s;++e)this._+=Math.round(arguments[e]*i)/i+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,i,s){this._append`Q${+t},${+e},${this._x1=+i},${this._y1=+s}`}bezierCurveTo(t,e,i,s,r,a){this._append`C${+t},${+e},${+i},${+s},${this._x1=+r},${this._y1=+a}`}arcTo(t,e,i,s,r){if(t=+t,e=+e,i=+i,s=+s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=this._x1,n=this._y1,o=i-t,l=s-e,c=a-t,d=n-e,u=c*c+d*d;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>cr)if(Math.abs(d*o-l*c)>cr&&r){let h=i-a,g=s-n,p=o*o+l*l,m=h*h+g*g,b=Math.sqrt(p),Q=Math.sqrt(u),B=r*Math.tan((or-Math.acos((p+u-m)/(2*b*Q)))/2),y=B/Q,U=B/b;Math.abs(y-1)>cr&&this._append`L${t+y*c},${e+y*d}`,this._append`A${r},${r},0,0,${+(d*h>c*g)},${this._x1=t+U*o},${this._y1=e+U*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,i,s,r,a){if(t=+t,e=+e,a=!!a,(i=+i)<0)throw new Error(`negative radius: ${i}`);let n=i*Math.cos(s),o=i*Math.sin(s),l=t+n,c=e+o,d=1^a,u=a?s-r:r-s;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>cr||Math.abs(this._y1-c)>cr)&&this._append`L${l},${c}`,i&&(u<0&&(u=u%lr+lr),u>dr?this._append`A${i},${i},0,1,${d},${t-n},${e-o}A${i},${i},0,1,${d},${this._x1=l},${this._y1=c}`:u>cr&&this._append`A${i},${i},0,${+(u>=or)},${d},${this._x1=t+i*Math.cos(r)},${this._y1=e+i*Math.sin(r)}`)}rect(t,e,i,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function gr(t,e){if((i=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var i,s=t.slice(0,i);return[s.length>1?s[0]+s.slice(2):s,+t.slice(i+1)]}function pr(t){return(t=gr(Math.abs(t)))?t[1]:NaN}var mr,br=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Qr(t){if(!(e=br.exec(t)))throw new Error("invalid format: "+t);var e;return new Br({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Br(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function yr(t,e){var i=gr(t,e);if(!i)return t+"";var s=i[0],r=i[1];return r<0?"0."+new Array(-r).join("0")+s:s.length>r+1?s.slice(0,r+1)+"."+s.slice(r+1):s+new Array(r-s.length+2).join("0")}Qr.prototype=Br.prototype,Br.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ur={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>yr(100*t,e),r:yr,s:function(t,e){var i=gr(t,e);if(!i)return t+"";var s=i[0],r=i[1],a=r-(mr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,n=s.length;return a===n?s:a>n?s+new Array(a-n+1).join("0"):a>0?s.slice(0,a)+"."+s.slice(a):"0."+new Array(1-a).join("0")+gr(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Fr(t){return t}var Ir,fr,Cr,vr=Array.prototype.map,Ar=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xr(t){var e,i,s=void 0===t.grouping||void 0===t.thousands?Fr:(e=vr.call(t.grouping,Number),i=t.thousands+"",function(t,s){for(var r=t.length,a=[],n=0,o=e[0],l=0;r>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),a.push(t.substring(r-=o,r+o)),!((l+=o+1)>s));)o=e[n=(n+1)%e.length];return a.reverse().join(i)}),r=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",n=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Fr:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(vr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",d=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=Qr(t)).fill,i=t.align,u=t.sign,h=t.symbol,g=t.zero,p=t.width,m=t.comma,b=t.precision,Q=t.trim,B=t.type;"n"===B?(m=!0,B="g"):Ur[B]||(void 0===b&&(b=12),Q=!0,B="g"),(g||"0"===e&&"="===i)&&(g=!0,e="0",i="=");var y="$"===h?r:"#"===h&&/[boxX]/.test(B)?"0"+B.toLowerCase():"",U="$"===h?a:/[%p]/.test(B)?l:"",F=Ur[B],I=/[defgprs%]/.test(B);function f(t){var r,a,l,h=y,f=U;if("c"===B)f=F(t)+f,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?d:F(Math.abs(t),b),Q&&(t=function(t){t:for(var e,i=t.length,s=1,r=-1;s<i;++s)switch(t[s]){case".":r=e=s;break;case"0":0===r&&(r=s),e=s;break;default:if(!+t[s])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0===+t&&"+"!==u&&(C=!1),h=(C?"("===u?u:c:"-"===u||"("===u?"":u)+h,f=("s"===B?Ar[8+mr/3]:"")+f+(C&&"("===u?")":""),I)for(r=-1,a=t.length;++r<a;)if(48>(l=t.charCodeAt(r))||l>57){f=(46===l?n+t.slice(r+1):t.slice(r))+f,t=t.slice(0,r);break}}m&&!g&&(t=s(t,1/0));var v=h.length+t.length+f.length,A=v<p?new Array(p-v+1).join(e):"";switch(m&&g&&(t=s(A+t,A.length?p-f.length:1/0),A=""),i){case"<":t=h+t+f+A;break;case"=":t=h+A+t+f;break;case"^":t=A.slice(0,v=A.length>>1)+h+t+f+A.slice(v);break;default:t=A+h+t+f}return o(t)}return b=void 0===b?6:/[gprs]/.test(B)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),f.toString=function(){return t+""},f}return{format:u,formatPrefix:function(t,e){var i=u(((t=Qr(t)).type="f",t)),s=3*Math.max(-8,Math.min(8,Math.floor(pr(e)/3))),r=Math.pow(10,-s),a=Ar[8+s/3];return function(t){return i(r*t)+a}}}}Ir=xr({thousands:",",grouping:[3],currency:["$",""]}),fr=Ir.format,Cr=Ir.formatPrefix;var Er=Math.random,Rr=function t(e){function i(t,i){return t=null==t?0:+t,i=null==i?1:+i,1===arguments.length?(i=t,t=0):i-=t,function(){return e()*i+t}}return i.source=t,i}(Er),Sr=function t(e){function i(t,i){var s,r;return t=null==t?0:+t,i=null==i?1:+i,function(){var a;if(null!=s)a=s,s=null;else do{s=2*e()-1,a=2*e()-1,r=s*s+a*a}while(!r||r>1);return t+i*a*Math.sqrt(-2*Math.log(r)/r)}}return i.source=t,i}(Er);const Nr=1/4294967296;function Lr(t=Math.random()){let e=0|(0<=t&&t<1?t/Nr:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Nr*(e>>>0))}function wr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Dr(t){return+t}var Mr=[0,1];function kr(t){return t}function Tr(t,e){return(e-=t=+t)?function(i){return(i-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Vr(t,e,i){var s=t[0],r=t[1],a=e[0],n=e[1];return r<s?(s=Tr(r,s),a=i(n,a)):(s=Tr(s,r),a=i(a,n)),function(t){return a(s(t))}}function Hr(t,e,i){var s=Math.min(t.length,e.length)-1,r=new Array(s),a=new Array(s),n=-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++n<s;)r[n]=Tr(t[n],t[n+1]),a[n]=i(e[n],e[n+1]);return function(e){var i=bt(t,e,1,s)-1;return a[i](r[i](e))}}function $r(){var t,e,i,s,r,a,n=Mr,o=Mr,l=is,c=kr;function d(){var t=Math.min(n.length,o.length);return c!==kr&&(c=function(t,e){var i;return t>e&&(i=t,t=e,e=i),function(i){return Math.max(t,Math.min(e,i))}}(n[0],n[t-1])),s=t>2?Hr:Vr,r=a=null,u}function u(e){return null==e||isNaN(e=+e)?i:(r||(r=s(n.map(t),o,l)))(t(c(e)))}return u.invert=function(i){return c(e((a||(a=s(o,n.map(t),Oi)))(i)))},u.domain=function(t){return arguments.length?(n=Array.from(t,Dr),d()):n.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),d()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=ss,d()},u.clamp=function(t){return arguments.length?(c=!!t||kr,d()):c!==kr},u.interpolate=function(t){return arguments.length?(l=t,d()):l},u.unknown=function(t){return arguments.length?(i=t,u):i},function(i,s){return t=i,e=s,d()}}function zr(t,e,i,s){var r,a=function(t,e,i){i=+i;const s=(e=+e)<(t=+t),r=s?Ft(e,t,i):Ft(t,e,i);return(s?-1:1)*(r<0?1/-r:r)}(t,e,i);switch((s=Qr(null==s?",f":s)).type){case"s":var n=Math.max(Math.abs(t),Math.abs(e));return null!=s.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(pr(e)/3)))-pr(Math.abs(t)))}(a,n))||(s.precision=r),Cr(s,n);case"":case"e":case"g":case"p":case"r":null!=s.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,pr(e)-pr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(s.precision=r-("e"===s.type));break;case"f":case"%":null!=s.precision||isNaN(r=function(t){return Math.max(0,-pr(Math.abs(t)))}(a))||(s.precision=r-2*("%"===s.type))}return fr(s)}function Gr(t){var e=t.domain;return t.ticks=function(t){var i=e();return function(t,e,i){if(!((i=+i)>0))return[];if((t=+t)===(e=+e))return[t];const s=e<t,[r,a,n]=s?Ut(e,t,i):Ut(t,e,i);if(!(a>=r))return[];const o=a-r+1,l=new Array(o);if(s)if(n<0)for(let t=0;t<o;++t)l[t]=(a-t)/-n;else for(let t=0;t<o;++t)l[t]=(a-t)*n;else if(n<0)for(let t=0;t<o;++t)l[t]=(r+t)/-n;else for(let t=0;t<o;++t)l[t]=(r+t)*n;return l}(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,i){var s=e();return zr(s[0],s[s.length-1],null==t?10:t,i)},t.nice=function(i){null==i&&(i=10);var s,r,a=e(),n=0,o=a.length-1,l=a[n],c=a[o],d=10;for(c<l&&(r=l,l=c,c=r,r=n,n=o,o=r);d-- >0;){if((r=Ft(l,c,i))===s)return a[n]=l,a[o]=c,e(a);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}s=r}return t},t}function Yr(){var t=$r()(kr,kr);return t.copy=function(){return e=t,Yr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},wr.apply(t,arguments),Gr(t)}function Xr(t){return function(){return t}}function Jr(t){this._context=t}function Wr(t){return new Jr(t)}function _r(t){return t[0]}function Kr(t){return t[1]}function Zr(t,e){var i=Xr(!0),s=null,r=Wr,a=null,n=function(t){let e=3;return t.digits=function(i){if(!arguments.length)return e;if(null==i)e=null;else{const t=Math.floor(i);if(!(t>=0))throw new RangeError(`invalid digits: ${i}`);e=t}return t},()=>new hr(e)}(o);function o(o){var l,c,d,u=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,h=!1;for(null==s&&(a=r(d=n())),l=0;l<=u;++l)!(l<u&&i(c=o[l],l,o))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+t(c,l,o),+e(c,l,o));if(d)return a=null,d+""||null}return t="function"==typeof t?t:void 0===t?_r:Xr(t),e="function"==typeof e?e:void 0===e?Kr:Xr(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Xr(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Xr(+t),o):e},o.defined=function(t){return arguments.length?(i="function"==typeof t?t:Xr(!!t),o):i},o.curve=function(t){return arguments.length?(r=t,null!=s&&(a=r(s)),o):r},o.context=function(t){return arguments.length?(null==t?s=a=null:a=r(s=t),o):s},o}function Pr(t,e,i){this.k=t,this.x=e,this.y=i}Jr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},Pr.prototype={constructor:Pr,scale:function(t){return 1===t?this:new Pr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Pr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Pr.prototype;class Or extends dt{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}static get greys(){const t="#999999",e={white:"#ffffff"};return e.light75=_i(t,"#ffffff")(.75),e.light50=_i(t,"#ffffff")(.5),e.light25=_i(t,"#ffffff")(.25),e.grey=t,e.dark25=_i(t,"#000000")(.25),e.dark50=_i(t,"#000000")(.5),e.dark75=_i(t,"#000000")(.75),e.black="#000000",e}static get shadows(){return{elevations:[0,2,4,8,16],baselineColor:"#000000",baselineColorString:"0, 0, 0",inverseBaselineColor:"#FFFFFF",inverseBaselineColorString:"255, 255, 255",opacityUmbra:.2,opacityPenumbra:.14,opacityAmbient:.12,opacityBoost:.2,mapUmbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:3,b:1,s:-2},4:{x:0,y:2,b:4,s:-1},8:{x:0,y:5,b:5,s:-3},16:{x:0,y:8,b:10,s:-5}},mapPenumbra:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:2,b:2,s:0},4:{x:0,y:4,b:5,s:0},8:{x:0,y:8,b:10,s:1},16:{x:0,y:16,b:24,s:2}},mapAmbient:{0:{x:0,y:0,b:0,s:0},2:{x:0,y:1,b:5,s:0},4:{x:0,y:1,b:10,s:0},8:{x:0,y:3,b:14,s:2},16:{x:0,y:6,b:30,s:5}}}}static cssBoxShadow(t,e=!1){const i=this.shadows.opacityUmbra+this.shadows.opacityBoost,s=this.shadows.opacityPenumbra+this.shadows.opacityBoost,r=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=e?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,n=e?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,o=e?`rgba(${this.shadows.inverseBaselineColorString}, ${r})`:`rgba(${this.shadows.baselineColorString}, ${r})`,l=this.shadows.mapUmbra[t],c=this.shadows.mapPenumbra[t],d=this.shadows.mapAmbient[t];return`${`${l.y/2}px ${l.y}px ${l.b}px ${l.s}px`} ${a}, ${`${c.y/2}px ${c.y}px ${c.b}px ${c.s}px`} ${n}, ${`${d.y/2}px ${d.y}px ${d.b}px ${d.s}px`} ${o}`}static get svgFilters(){const t=Or.shadows,e=t.elevations.map(e=>J`
23
23
  <filter id=${`shadow-${e}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
24
24
  <feComponentTransfer in="SourceAlpha" result="solid">
25
25
  <feFuncA type="table" tableValues="0 1 1"/>
@@ -122,49 +122,58 @@ const C=globalThis,v=C.trustedTypes,A=v?v.createPolicy("lit-html",{createHTML:t=
122
122
  button {
123
123
  width: 100%;
124
124
  height: 100%;
125
+
125
126
  padding: 0.375rem 0.75rem;
126
127
 
127
128
  font-family: var(---font-family-base);
128
129
  font-size: 1.125rem;
130
+
129
131
  line-height: 1.5;
132
+
130
133
  color: var(---color-text-inverse);
131
134
 
135
+ outline: none;
136
+
132
137
  border: 0;
133
138
  border-radius: var(---border-radius);
134
- outline: none;
135
139
  }
136
140
 
137
141
  button:disabled {
138
- background-color: var(---decidables-button-background-color-disabled);
139
142
  outline: none;
143
+
144
+ background-color: var(---decidables-button-background-color-disabled);
140
145
  box-shadow: none;
141
146
  }
142
147
 
143
148
  button:enabled {
144
149
  cursor: pointer;
150
+ outline: none;
145
151
 
146
152
  background-color: var(---decidables-button-background-color-enabled);
147
- outline: none;
148
153
  box-shadow: var(---shadow-2);
149
154
  }
150
155
 
151
156
  button:enabled:hover {
152
157
  outline: none;
158
+
153
159
  box-shadow: var(---shadow-4);
154
160
  }
155
161
 
156
162
  button:enabled:active {
157
163
  outline: none;
164
+
158
165
  box-shadow: var(---shadow-8);
159
166
  }
160
167
 
161
- :host(.keyboard) button:enabled:focus {
168
+ button:enabled:focus-visible {
162
169
  outline: none;
170
+
163
171
  box-shadow: var(---shadow-4);
164
172
  }
165
173
 
166
- :host(.keyboard) button:enabled:focus:active {
174
+ button:enabled:focus-visible:active {
167
175
  outline: none;
176
+
168
177
  box-shadow: var(---shadow-8);
169
178
  }
170
179
  `]}render(){return X`
@@ -183,10 +192,6 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
183
192
  ---decidables-slider-color: var(--decidables-slider-color, var(---color-element-enabled));
184
193
  ---decidables-spinner-background-color: var(--decidables-slider-background-color, none);
185
194
 
186
- ---shadow-2-rotate: var(--shadow-2-rotate, ${n(this.cssBoxShadow(2,!0,!1))});
187
- ---shadow-4-rotate: var(--shadow-4-rotate, ${n(this.cssBoxShadow(4,!0,!1))});
188
- ---shadow-8-rotate: var(--shadow-8-rotate, ${n(this.cssBoxShadow(8,!0,!1))});
189
-
190
195
  display: flex;
191
196
 
192
197
  flex-direction: column;
@@ -201,12 +206,14 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
201
206
 
202
207
  .range {
203
208
  position: relative;
209
+
204
210
  display: flex;
205
211
 
206
212
  flex-direction: row;
207
213
 
208
214
  width: 3.5rem;
209
215
  height: 4.75rem;
216
+
210
217
  margin: 0 0.25rem 0.25rem;
211
218
  }
212
219
 
@@ -218,21 +225,20 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
218
225
  background: var(---decidables-spinner-background-color);
219
226
  }
220
227
 
221
- /* Adapted from http://danielstern.ca/range.css/#/ */
222
228
  /* Overall */
223
229
  input[type=range] {
224
- width: 4.75rem;
225
- height: 3.5rem;
230
+ width: 3.5rem;
231
+ height: 4.75rem;
232
+
226
233
  padding: 0;
227
234
  margin: 0;
235
+
236
+ appearance: none;
228
237
 
229
238
  background-color: unset;
230
239
 
231
- transform: rotate(-90deg);
232
- transform-origin: 2.375rem 2.375rem;
233
-
234
- /* stylelint-disable-next-line property-no-vendor-prefix */
235
- -webkit-appearance: none;
240
+ direction: rtl;
241
+ writing-mode: vertical-lr;
236
242
  }
237
243
 
238
244
  input[type=range]:enabled {
@@ -243,16 +249,10 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
243
249
  outline: none;
244
250
  }
245
251
 
246
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
247
- input[type=range]::-ms-tooltip {
248
- display: none;
249
- }
250
-
251
252
  /* Track */
252
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
253
253
  input[type=range]::-webkit-slider-runnable-track {
254
- width: 100%;
255
- height: 4px;
254
+ width: 4px;
255
+ height: 100%;
256
256
 
257
257
  background: var(---decidables-slider-background-color);
258
258
  border: 0;
@@ -264,10 +264,9 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
264
264
  background: var(---decidables-slider-background-color);
265
265
  }
266
266
 
267
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
268
267
  input[type=range]::-moz-range-track {
269
- width: 100%;
270
- height: 4px;
268
+ width: 4px;
269
+ height: 100%;
271
270
 
272
271
  background: var(---decidables-slider-background-color);
273
272
  border: 0;
@@ -275,57 +274,17 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
275
274
  box-shadow: none;
276
275
  }
277
276
 
278
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
279
- input[type=range]::-ms-track {
280
- width: 100%;
281
- height: 4px;
282
-
283
- color: transparent;
284
-
285
- background: transparent;
286
- border-color: transparent;
287
- }
288
-
289
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
290
- input[type=range]::-ms-fill-lower {
291
- background: #cccccc;
292
- /* background: var(---decidables-slider-background-color); */
293
- border: 0;
294
- border-radius: 2px;
295
- box-shadow: none;
296
- }
297
-
298
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
299
- input[type=range]::-ms-fill-upper {
300
- background: #cccccc;
301
- /* background: var(---decidables-slider-background-color); */
302
- border: 0;
303
- border-radius: 2px;
304
- box-shadow: none;
305
- }
306
-
307
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
308
- input[type=range]:focus::-ms-fill-lower {
309
- background: var(---decidables-slider-background-color);
310
- }
311
-
312
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
313
- input[type=range]:focus::-ms-fill-upper {
314
- background: var(---decidables-slider-background-color);
315
- }
316
-
317
277
  /* Thumb */
318
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
319
278
  input[type=range]::-webkit-slider-thumb {
320
- width: 10px;
321
- height: 20px;
322
- margin-top: -8px;
279
+ width: 20px;
280
+ height: 10px;
281
+
282
+ margin-left: -8px;
283
+
284
+ appearance: none;
323
285
 
324
286
  border: 0;
325
287
  border-radius: 4px;
326
-
327
- /* stylelint-disable-next-line property-no-vendor-prefix */
328
- -webkit-appearance: none;
329
288
  }
330
289
 
331
290
  input[type=range]:disabled::-webkit-slider-thumb {
@@ -335,112 +294,65 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
335
294
 
336
295
  input[type=range]:enabled::-webkit-slider-thumb {
337
296
  background: var(---decidables-slider-color);
338
- box-shadow: var(---shadow-2-rotate);
297
+ box-shadow: var(---shadow-2);
339
298
  }
340
299
 
341
300
  input[type=range]:enabled:hover::-webkit-slider-thumb {
342
- box-shadow: var(---shadow-4-rotate);
301
+ box-shadow: var(---shadow-4);
343
302
  }
344
303
 
345
304
  input[type=range]:enabled:active::-webkit-slider-thumb {
346
- box-shadow: var(---shadow-8-rotate);
305
+ box-shadow: var(---shadow-8);
347
306
  }
348
307
 
349
- :host(.keyboard) input[type=range]:enabled:focus::-webkit-slider-thumb {
350
- box-shadow: var(---shadow-4-rotate);
308
+ input[type=range]:enabled:focus-visible::-webkit-slider-thumb {
309
+ box-shadow: var(---shadow-4);
351
310
  }
352
311
 
353
- :host(.keyboard) input[type=range]:focus:active::-webkit-slider-thumb {
354
- box-shadow: var(---shadow-8-rotate);
312
+ input[type=range]:enabled:focus-visible:active::-webkit-slider-thumb {
313
+ box-shadow: var(---shadow-8);
355
314
  }
356
315
 
357
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
358
316
  input[type=range]::-moz-range-thumb {
359
- width: 10px;
360
- height: 20px;
317
+ width: 20px;
318
+ height: 10px;
361
319
 
362
320
  border: 0;
363
321
  border-radius: 4px;
364
322
  }
365
323
 
366
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
367
324
  input[type=range]:disabled::-moz-range-thumb {
368
325
  background: var(---decidables-slider-background-color);
369
326
  box-shadow: none;
370
327
  }
371
328
 
372
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
373
329
  input[type=range]:enabled::-moz-range-thumb {
374
330
  background: var(---decidables-slider-color);
375
- box-shadow: var(---shadow-2-rotate);
331
+ box-shadow: var(---shadow-2);
376
332
  }
377
333
 
378
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
379
334
  input[type=range]:enabled:hover::-moz-range-thumb {
380
- box-shadow: var(---shadow-4-rotate);
335
+ box-shadow: var(---shadow-4);
381
336
  }
382
337
 
383
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
384
338
  input[type=range]:enabled:active::-moz-range-thumb {
385
- box-shadow: var(---shadow-8-rotate);
386
- }
387
-
388
- :host(.keyboard) input[type=range]:enabled:focus::-moz-range-thumb {
389
- box-shadow: var(---shadow-4-rotate);
390
- }
391
-
392
- :host(.keyboard) input[type=range]:enabled:focus:active::-moz-range-thumb {
393
- box-shadow: var(---shadow-8-rotate);
394
- }
395
-
396
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
397
- input[type=range]::-ms-thumb {
398
- width: 10px;
399
- height: 20px;
400
- margin-top: 0;
401
-
402
- background: #999999;
403
- /* background: var(---color-element-enabled); */
404
- border: 0;
405
- border-radius: 4px;
406
- box-shadow: var(---shadow-2-rotate);
407
- }
408
-
409
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
410
- input[type=range]:disabled::-ms-thumb {
411
- background: var(---decidables-slider-background-color);
412
- box-shadow: none;
413
- }
414
-
415
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
416
- input[type=range]:enabled::-ms-thumb {
417
- background: var(---decidables-slider-color);
418
- box-shadow: var(---shadow-2-rotate);
419
- }
420
-
421
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
422
- input[type=range]:enabled:hover::-ms-thumb {
423
- box-shadow: var(---shadow-4-rotate);
424
- }
425
-
426
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
427
- input[type=range]:enabled:active::-ms-thumb {
428
- box-shadow: var(---shadow-8-rotate);
339
+ box-shadow: var(---shadow-8);
429
340
  }
430
341
 
431
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
432
- :host(.keyboard) input[type=range]:enabled:focus::-ms-thumb {
433
- box-shadow: var(---shadow-4-rotate);
342
+ input[type=range]:enabled:focus-visible::-moz-range-thumb {
343
+ box-shadow: var(---shadow-4);
434
344
  }
435
345
 
436
- :host(.keyboard) input[type=range]:enabled:focus:active::-ms-thumb {
437
- box-shadow: var(---shadow-8-rotate);
346
+ input[type=range]:enabled:focus-visible:active::-moz-range-thumb {
347
+ box-shadow: var(---shadow-8);
438
348
  }
439
349
 
440
- datalist {
350
+ /* Tick marks */
351
+ .datalist {
441
352
  position: absolute;
442
353
  left: 2rem;
443
354
  z-index: -1;
355
+
444
356
  display: flex;
445
357
 
446
358
  flex-direction: column;
@@ -453,14 +365,13 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
453
365
  font-size: 0.75rem;
454
366
  }
455
367
 
456
- option {
457
- padding: 0;
458
-
368
+ .option {
459
369
  line-height: 0.8;
460
- min-block-size: 0;
370
+
371
+ white-space: nowrap;
461
372
  }
462
373
 
463
- option::before {
374
+ .option::before {
464
375
  content: "– ";
465
376
  }
466
377
  `]}render(){return X`
@@ -470,10 +381,10 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
470
381
  <div class="range">
471
382
  <input ?disabled=${this.disabled} type="range" id="slider" min=${jr(this.rangeMin)} max=${jr(this.rangeMax)} step=${jr(this.rangeStep)} .value=${this.rangeValue} @change=${this.rangeChanged.bind(this)} @input=${this.rangeInputted.bind(this)}>
472
383
  ${this.scale?X`
473
- <datalist id="ticks">
474
- <option value=${jr(this.rangeMax)} label=${jr(this.max)}></option>
475
- <option value=${jr(this.rangeMin)} label=${jr(this.min)}></option>
476
- </datalist>
384
+ <div class="datalist">
385
+ <div class="option">${jr(this.max)}</div>
386
+ <div class="option">${jr(this.min)}</div>
387
+ </div>
477
388
  `:X``}
478
389
  </div>
479
390
  <decidables-spinner ?disabled=${this.disabled} min=${jr(this.min)} max=${jr(this.max)} step=${jr(this.step)} .value=${this.value} @input=${this.spinnerInputted.bind(this)}></decidables-spinner>
@@ -484,13 +395,14 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
484
395
  ---decidables-spinner-prefix: var(--decidables-spinner-prefix, "");
485
396
 
486
397
  ---decidables-spinner-postfix: var(--decidables-spinner-postfix, "");
487
- ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0);
398
+ ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0rem);
488
399
 
489
400
  display: block;
490
401
  }
491
402
 
492
403
  label {
493
404
  position: relative;
405
+
494
406
  display: flex;
495
407
 
496
408
  flex-direction: column;
@@ -508,6 +420,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
508
420
  left: calc(50% - var(---decidables-spinner-input-width) / 2 + 0.25rem);
509
421
 
510
422
  font-size: var(---decidables-spinner-font-size);
423
+
511
424
  line-height: normal;
512
425
 
513
426
  content: var(---decidables-spinner-prefix);
@@ -519,6 +432,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
519
432
  bottom: 1px;
520
433
 
521
434
  font-size: var(---decidables-spinner-font-size);
435
+
522
436
  line-height: normal;
523
437
 
524
438
  content: var(---decidables-spinner-postfix);
@@ -526,20 +440,24 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
526
440
 
527
441
  input[type=number] {
528
442
  width: var(---decidables-spinner-input-width);
529
- padding-right: var(---decidables-spinner-postfix-padding);
443
+
444
+ padding: 1px var(---decidables-spinner-postfix-padding) 1px 2px;
445
+ margin: 0;
530
446
 
531
447
  font-family: var(---font-family-base);
532
448
  font-size: var(---decidables-spinner-font-size);
449
+
533
450
  color: inherit;
451
+
534
452
  text-align: right;
535
453
 
454
+ appearance: none;
455
+ outline: none;
456
+
536
457
  background: none;
537
458
  border: 0;
538
459
  border-radius: 0;
539
- outline: none;
540
460
  box-shadow: var(---shadow-2);
541
-
542
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
543
461
  }
544
462
 
545
463
  input[type=number]:hover {
@@ -556,20 +474,54 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
556
474
 
557
475
  border: 0;
558
476
  box-shadow: none;
477
+ }
478
+
479
+ /* HACK: Manage spinners in Firefox */
480
+ @supports (-moz-appearance: textfield) {
481
+ input[type=number] {
482
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
483
+
484
+ appearance: textfield;
485
+ }
486
+
487
+ input[type=number]:hover,
488
+ input[type=number]:focus,
489
+ input[type=number]:active {
490
+ padding-right: var(---decidables-spinner-postfix-padding);
491
+
492
+ appearance: none;
493
+ }
494
+
495
+ input[type=number]:disabled {
496
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
497
+
498
+ appearance: textfield;
499
+ }
500
+ }
501
+
502
+ /* HACK: Manage spinners in Chrome/Edge/Safari */
503
+ input[type=number]::-webkit-inner-spin-button {
504
+ /* Avoid oversized spinners in Safari */
505
+ font-size: 1.125rem;
559
506
 
560
- /* HACK: Use correct text color in Safari */
561
- -webkit-opacity: 1;
562
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
563
- -moz-appearance: textfield; /* stylelint-disable-line property-no-vendor-prefix */
564
- /* HACK: Use correct text color in Safari */
565
- -webkit-text-fill-color: var(---color-text);
507
+ opacity: 0;
508
+ }
509
+
510
+ input[type=number]:hover::-webkit-inner-spin-button,
511
+ input[type=number]:focus::-webkit-inner-spin-button,
512
+ input[type=number]:active::-webkit-inner-spin-button {
513
+ opacity: 1;
566
514
  }
567
515
 
568
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
569
- input[type=number]:disabled::-webkit-outer-spin-button,
570
516
  input[type=number]:disabled::-webkit-inner-spin-button {
571
- margin: 0;
572
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
517
+ opacity: 0;
518
+ }
519
+
520
+ /* HACK: Adjust padding on mobile w/o spinners */
521
+ @media only screen and (hover: none) and (pointer: coarse) {
522
+ input[type=number] {
523
+ padding-right: calc(1.125rem + var(---decidables-spinner-postfix-padding));
524
+ }
573
525
  }
574
526
  `]}render(){return X`
575
527
  <label>
@@ -593,13 +545,16 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
593
545
 
594
546
  width: 1px;
595
547
  height: 1px;
548
+
596
549
  padding: 0;
597
550
  margin: -1px;
551
+
598
552
  overflow: hidden;
599
553
 
600
554
  white-space: nowrap;
601
555
 
602
556
  border: 0;
557
+
603
558
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
604
559
  }
605
560
 
@@ -615,6 +570,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
615
570
  position: relative;
616
571
 
617
572
  min-width: 24px;
573
+
618
574
  padding: 0 0 36px;
619
575
  margin: 0.25rem 0.25rem 0;
620
576
 
@@ -626,17 +582,17 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
626
582
  input[type=checkbox] + label + label::before,
627
583
  input[type=checkbox] + label + label::after {
628
584
  position: absolute;
629
-
630
585
  left: 50%;
631
586
 
632
587
  margin: 0;
633
588
 
634
- content: "";
635
-
636
589
  outline: 0;
637
590
 
638
- transition: all var(---transition-duration) ease;
591
+ content: "";
592
+
639
593
  transform: translate(-50%, 0);
594
+
595
+ transition: all var(---transition-duration) ease;
640
596
  }
641
597
 
642
598
  input[type=checkbox] + label + label::before {
@@ -684,17 +640,14 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
684
640
  box-shadow: var(---shadow-8);
685
641
  }
686
642
 
687
- /* stylelint-disable-next-line selector-max-compound-selectors */
688
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label::after {
643
+ input[type=checkbox]:enabled:focus-visible + label + label::after {
689
644
  box-shadow: var(---shadow-4);
690
645
  }
691
646
 
692
- /* stylelint-disable selector-max-compound-selectors */
693
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label:active::after,
694
- :host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
647
+ input[type=checkbox]:enabled:focus-visible + label + label:active::after,
648
+ input[type=checkbox]:enabled:focus-visible:active + label + label::after {
695
649
  box-shadow: var(---shadow-8);
696
650
  }
697
- /* stylelint-enable selector-max-compound-selectors */
698
651
  `]}render(){return X`
699
652
  <input type="checkbox" id="switch" ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
700
653
  <label for="switch">
@@ -736,39 +689,46 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
736
689
 
737
690
  width: 1px;
738
691
  height: 1px;
692
+
739
693
  padding: 0;
740
694
  margin: -1px;
695
+
741
696
  overflow: hidden;
742
697
 
743
698
  white-space: nowrap;
744
699
 
745
700
  border: 0;
701
+
746
702
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
747
703
  }
748
704
 
749
705
  input[type=radio] + label {
750
706
  width: 100%;
707
+
751
708
  padding: 0.375rem 0.75rem;
752
709
 
753
710
  font-family: var(---font-family-base);
754
711
  font-size: 1.125rem;
712
+
755
713
  line-height: 1.5;
714
+
756
715
  color: var(---color-text-inverse);
716
+
757
717
  text-align: center;
758
718
 
759
719
  cursor: pointer;
720
+ outline: none;
760
721
 
761
722
  background-color: var(---color-element-enabled);
762
723
  border: 0;
763
724
  border-radius: 0;
764
- outline: none;
765
-
766
725
  box-shadow: var(---shadow-2);
767
726
  }
768
727
 
769
728
  input[type=radio]:checked + label {
770
- background-color: var(---color-element-selected);
771
729
  outline: none;
730
+
731
+ background-color: var(---color-element-selected);
772
732
  box-shadow: var(---shadow-2);
773
733
  }
774
734
 
@@ -776,6 +736,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
776
736
  z-index: 1;
777
737
 
778
738
  outline: none;
739
+
779
740
  box-shadow: var(---shadow-4);
780
741
  }
781
742
 
@@ -783,6 +744,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
783
744
  z-index: 2;
784
745
 
785
746
  outline: none;
747
+
786
748
  box-shadow: var(---shadow-8);
787
749
  }
788
750
 
@@ -796,25 +758,28 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
796
758
  border-bottom-left-radius: 0.25rem;
797
759
  }
798
760
 
799
- :host(.keyboard) input[type=radio]:focus + label {
761
+ input[type=radio]:focus-visible + label {
800
762
  z-index: 1;
801
763
 
802
764
  outline: none;
765
+
803
766
  box-shadow: var(---shadow-4);
804
767
  }
805
768
 
806
- :host(.keyboard) input[type=radio]:focus:checked + label {
769
+ input[type=radio]:focus-visible:checked + label {
807
770
  z-index: 1;
808
771
 
809
- background-color: var(---color-element-selected);
810
772
  outline: none;
773
+
774
+ background-color: var(---color-element-selected);
811
775
  box-shadow: var(---shadow-4);
812
776
  }
813
777
 
814
- :host(.keyboard) input[type=radio]:focus + label:active {
778
+ input[type=radio]:focus-visible + label:active {
815
779
  z-index: 2;
816
780
 
817
781
  outline: none;
782
+
818
783
  box-shadow: var(---shadow-8);
819
784
  }
820
785
  `]}render(){return X`
@@ -881,7 +846,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
881
846
  ${this.reset?X`<decidables-button name="reset" ?disabled=${"resetted"===this.state} @click=${this.doReset.bind(this)}>Reset</decidables-button>`:X``}
882
847
  </div>
883
848
  `:X``}
884
- </div>`}}customElements.define("accumulable-control",ia);class sa{static s={DEFAULT:1};static a={DEFAULT:1.2,MIN:.01,MAX:2,STEP:.01,JUMP:.1};static z={DEFAULT:.55,MIN:.01,MAX:.99,STEP:.01,JUMP:.1};static v={DEFAULT:1.5,MIN:.01,MAX:5,STEP:.01,JUMP:.1};static t0={DEFAULT:150,MIN:0,MAX:500,STEP:1,JUMP:10};static trials2stats(t){const e={},i=t.reduce((t,e)=>{switch(e.outcome){case"correct":t.correctCount+=1,t.correctRTSum+=e.rt;break;case"error":t.errorCount+=1,t.errorRTSum+=e.rt;break;case"nr":t.nrCount+=1}return t},{correctCount:0,errorCount:0,nrCount:0,correctRTSum:0,errorRTSum:0});e.correctCount=i.correctCount,e.errorCount=i.errorCount,e.nrCount=i.nrCount,e.accuracy=i.correctCount/(i.correctCount+i.errorCount+i.nrCount),e.correctMeanRT=i.correctRTSum/i.correctCount,e.errorMeanRT=i.errorRTSum/i.errorCount,e.meanRT=(i.correctRTSum+i.errorRTSum)/(i.correctCount+i.errorCount);const s=t.reduce((t,i)=>{switch(i.outcome){case"correct":t.ss+=(i.rt-e.meanRT)**2,t.correctSS+=(i.rt-e.correctMeanRT)**2;break;case"error":t.ss+=(i.rt-e.meanRT)**2,t.errorSS+=(i.rt-e.errorMeanRT)**2}return t},{ss:0,correctSS:0,errorSS:0});return e.correctSDRT=e.correctCount>1?Math.sqrt(s.correctSS/(e.correctCount-1)):NaN,e.errorSDRT=e.errorCount>1?Math.sqrt(s.errorSS/(e.errorCount-1)):NaN,e.sdRT=e.correctCount+e.errorCount>1?Math.sqrt(s.ss/(e.correctCount+e.errorCount-1)):NaN,e}static azv2pE(t,e,i,s=sa.s.DEFAULT){const r=t*e,a=Math.exp(-2*i*t/s**2);return(a-Math.exp(-2*i*r/s**2))/(a-1)}static azv2pC(t,e,i,s=sa.s.DEFAULT){return sa.azv2pE(t,1-e,-i,s)}static azvt02m(t,e,i,s,r=sa.s.DEFAULT){const a=t*e,n=Math.exp(-2*i*t/r**2)-1;return s+1e3*(-a/i+t/i*((Math.exp(-2*i*a/r**2)-1)/n))}static azv2sd(t,e,i,s=sa.s.DEFAULT){const r=t*e,a=Math.exp(-2*i*t/s**2)-1,n=Math.exp(-2*i*r/s**2)-1,o=(-i*t**2*(n+4)*n/a**2+((-3*i*t**2+4*i*r*t+s**2*t)*n+4*i*r*t)/a-s**2*r)/i**3;return 1e3*Math.sqrt(o)}static azvt02mE(t,e,i,s,r=sa.s.DEFAULT){function a(t,e){return Math.exp(2*i*e/r**2)-Math.exp(2*i*t/r**2)}const n=t*e;return s+1e3*((n*(a(n-t,t)+a(0,n))+2*t*a(n,0))/(i*a(n,t)*a(-t,0)))}static azv2sdE(t,e,i,s=sa.s.DEFAULT){function r(t,e){return Math.exp(2*i*e/s**2)-Math.exp(2*i*t/s**2)}const a=t*e,n=-2*t*r(0,a)*(2*i*t*r(a,2*t)+s**2*r(0,t)*r(a,t))*Math.exp(2*i*t/s**2)/(i**3*r(0,t)**2*r(a,t)**2)+(4*i*a*(2*t-a)*Math.exp(2*i*(a+t)/s**2)+a*s**2*r(2*a,2*t))/(i**3*r(a,t)**2);return 1e3*Math.sqrt(n)}static azvt02mC(t,e,i,s,r=sa.s.DEFAULT){return sa.azvt02mE(t,1-e,-i,s,r)}static azv2sdC(t,e,i,s=sa.s.DEFAULT){return sa.azv2sdE(t,1-e,-i,s)}static tazv2gE(t,e,i,s,r=sa.s.DEFAULT){if(!t)return 0;const a=e*i,n=Math.PI*r**2/e**2*Math.exp(-a*s/r**2);let o=0,l=0,c=0;do{o+=1,l=o*Math.sin(Math.PI*a*o/e)*Math.exp(-.5*(s**2/r**2+Math.PI**2*o**2*r**2/e**2)*t),c+=l}while(o<200);return n*c}static tazv2gC(t,e,i,s,r=sa.s.DEFAULT){return sa.tazv2gE(t,e,1-i,-s,r)}static data2ez({accuracy:t,sdRT:e,meanRT:i,s:s}){function r(t){return Math.log(t/(1-t))}const a=(e/1e3)**2,n=i/1e3,o=s**2,l=r(t),c=l*(l*t**2-l*t+t-.5)/a,d=function(t){return t>0?1:0===t?0:-1}(t-.5)*s*c**(1/4),h=o*r(t)/d,u=-d*h/o,g=h/(2*d)*(1-Math.exp(u))/(1+Math.exp(u));return{v:d,a:h,t0:1e3*(n?n-g:null),s:s}}static data2ez2(){throw new Error("data2ez2 is not implemented!")}}class ra extends ea{static get properties(){return{feedback:{attribute:"feedback",type:Boolean,reflect:!0},trial:{attribute:"trial",type:Boolean,reflect:!0},payoff:{attribute:"payoff",type:String,reflect:!0},correctPayoff:{attribute:"correct-payoff",type:Number,reflect:!0},errorPayoff:{attribute:"error-payoff",type:Number,reflect:!0},nrPayoff:{attribute:"no-response-payoff",type:Number,reflect:!0},state:{attribute:!1,type:String,reflect:!1},trialCount:{attribute:!1,type:Number,reflect:!1},trialTotal:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.feedback=!1,this.trial=!1,this.payoffs=["none","trial","total"],this.payoff="none",this.correctPayoff=0,this.errorPayoff=0,this.nrPayoff=0,this.states=["off","waiting","feedback"],this.state="off",this.trialCount=0,this.trialTotal=0,this.signals=["left","right"],this.signal=void 0,this.responses=["left","right"],this.response=void 0,this.outcomes=["correct","error","nr"],this.outcome=void 0,this.startTime=void 0,this.rt=void 0,this.data={},this.trials=[],this.alignState()}get trialPayoff(){switch(this.outcome){case"correct":return this.correctPayoff;case"error":return this.errorPayoff;case"nr":return this.nrPayoff;default:return}}get totalPayoff(){return this.data.correctCount*this.correctPayoff+this.data.errorCount*this.errorPayoff+this.data.nrCount*this.nrPayoff}alignState(){this.data=sa.trials2stats(this.trials)}start(t,e){this.startTime=Date.now(),this.trialCount=e,this.state="waiting",this.signal=t,this.response=void 0,this.outcome=void 0,this.rt=void 0}stop(){this.state="feedback",void 0===this.response&&(this.outcome="nr",this.rt=void 0,this.trials.push({trial:this.trialCount,rt:this.rt,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff}),this.alignState())}left(){this.responded("left")}right(){this.responded("right")}responded(t){this.rt=Date.now()-this.startTime,this.state="feedback",this.response=t,this.signal===this.response?this.outcome="correct":this.signal!==this.response&&(this.outcome="error"),this.trials.push({trial:this.trialCount,rt:this.rt,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff}),this.alignState(),this.dispatchEvent(new CustomEvent("accumulable-response",{detail:{trial:this.trialCount,rt:this.rt,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff,data:this.data,totalPayoff:this.totalPayoff},bubbles:!0}))}reset(){this.state="off",this.trialCount=0,this.rt=void 0,this.signal=void 0,this.response=void 0,this.outcome=void 0,this.trials=[],this.alignState()}keydown(t){"waiting"===this.state&&("ArrowLeft"===t.key?(this.responded("left"),t.preventDefault()):"ArrowRight"===t.key&&(this.responded("right"),t.preventDefault()))}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.keydown.bind(this))}disconnectedCallback(){window.removeEventListener("keydown",this.keydown.bind(this)),super.disconnectedCallback()}static get styles(){return[super.styles,o`
849
+ </div>`}}customElements.define("accumulable-control",ia);class sa{static s={DEFAULT:1};static a={DEFAULT:1.2,MIN:.01,MAX:2,STEP:.01,JUMP:.1};static z={DEFAULT:.55,MIN:.01,MAX:.99,STEP:.01,JUMP:.1};static v={DEFAULT:1.5,MIN:.01,MAX:5,STEP:.01,JUMP:.1};static t0={DEFAULT:150,MIN:0,MAX:500,STEP:1,JUMP:10};static trials2stats(t){const e={},i=t.reduce((t,e)=>{switch(e.outcome){case"correct":t.correctCount+=1,t.correctRTSum+=e.rt;break;case"error":t.errorCount+=1,t.errorRTSum+=e.rt;break;case"nr":t.nrCount+=1}return t},{correctCount:0,errorCount:0,nrCount:0,correctRTSum:0,errorRTSum:0});e.correctCount=i.correctCount,e.errorCount=i.errorCount,e.nrCount=i.nrCount,e.accuracy=i.correctCount/(i.correctCount+i.errorCount+i.nrCount),e.correctMeanRT=i.correctRTSum/i.correctCount,e.errorMeanRT=i.errorRTSum/i.errorCount,e.meanRT=(i.correctRTSum+i.errorRTSum)/(i.correctCount+i.errorCount);const s=t.reduce((t,i)=>{switch(i.outcome){case"correct":t.ss+=(i.rt-e.meanRT)**2,t.correctSS+=(i.rt-e.correctMeanRT)**2;break;case"error":t.ss+=(i.rt-e.meanRT)**2,t.errorSS+=(i.rt-e.errorMeanRT)**2}return t},{ss:0,correctSS:0,errorSS:0});return e.correctSDRT=e.correctCount>1?Math.sqrt(s.correctSS/(e.correctCount-1)):NaN,e.errorSDRT=e.errorCount>1?Math.sqrt(s.errorSS/(e.errorCount-1)):NaN,e.sdRT=e.correctCount+e.errorCount>1?Math.sqrt(s.ss/(e.correctCount+e.errorCount-1)):NaN,e}static azv2pE(t,e,i,s=sa.s.DEFAULT){const r=t*e,a=Math.exp(-2*i*t/s**2);return(a-Math.exp(-2*i*r/s**2))/(a-1)}static azv2pC(t,e,i,s=sa.s.DEFAULT){return sa.azv2pE(t,1-e,-i,s)}static azvt02m(t,e,i,s,r=sa.s.DEFAULT){const a=t*e,n=Math.exp(-2*i*t/r**2)-1;return s+1e3*(-a/i+t/i*((Math.exp(-2*i*a/r**2)-1)/n))}static azv2sd(t,e,i,s=sa.s.DEFAULT){const r=t*e,a=Math.exp(-2*i*t/s**2)-1,n=Math.exp(-2*i*r/s**2)-1,o=(-i*t**2*(n+4)*n/a**2+((-3*i*t**2+4*i*r*t+s**2*t)*n+4*i*r*t)/a-s**2*r)/i**3;return 1e3*Math.sqrt(o)}static azvt02mE(t,e,i,s,r=sa.s.DEFAULT){function a(t,e){return Math.exp(2*i*e/r**2)-Math.exp(2*i*t/r**2)}const n=t*e;return s+1e3*((n*(a(n-t,t)+a(0,n))+2*t*a(n,0))/(i*a(n,t)*a(-t,0)))}static azv2sdE(t,e,i,s=sa.s.DEFAULT){function r(t,e){return Math.exp(2*i*e/s**2)-Math.exp(2*i*t/s**2)}const a=t*e,n=-2*t*r(0,a)*(2*i*t*r(a,2*t)+s**2*r(0,t)*r(a,t))*Math.exp(2*i*t/s**2)/(i**3*r(0,t)**2*r(a,t)**2)+(4*i*a*(2*t-a)*Math.exp(2*i*(a+t)/s**2)+a*s**2*r(2*a,2*t))/(i**3*r(a,t)**2);return 1e3*Math.sqrt(n)}static azvt02mC(t,e,i,s,r=sa.s.DEFAULT){return sa.azvt02mE(t,1-e,-i,s,r)}static azv2sdC(t,e,i,s=sa.s.DEFAULT){return sa.azv2sdE(t,1-e,-i,s)}static tazv2gE(t,e,i,s,r=sa.s.DEFAULT){if(!t)return 0;const a=e*i,n=Math.PI*r**2/e**2*Math.exp(-a*s/r**2);let o=0,l=0,c=0;do{o+=1,l=o*Math.sin(Math.PI*a*o/e)*Math.exp(-.5*(s**2/r**2+Math.PI**2*o**2*r**2/e**2)*t),c+=l}while(o<200);return n*c}static tazv2gC(t,e,i,s,r=sa.s.DEFAULT){return sa.tazv2gE(t,e,1-i,-s,r)}static data2ez({accuracy:t,sdRT:e,meanRT:i,s:s}){function r(t){return Math.log(t/(1-t))}const a=(e/1e3)**2,n=i/1e3,o=s**2,l=r(t),c=l*(l*t**2-l*t+t-.5)/a,d=function(t){return t>0?1:0===t?0:-1}(t-.5)*s*c**(1/4),u=o*r(t)/d,h=-d*u/o,g=u/(2*d)*(1-Math.exp(h))/(1+Math.exp(h));return{v:d,a:u,t0:1e3*(n?n-g:null),s:s}}static data2ez2(){throw new Error("data2ez2 is not implemented!")}}class ra extends ea{static get properties(){return{feedback:{attribute:"feedback",type:Boolean,reflect:!0},trial:{attribute:"trial",type:Boolean,reflect:!0},payoff:{attribute:"payoff",type:String,reflect:!0},correctPayoff:{attribute:"correct-payoff",type:Number,reflect:!0},errorPayoff:{attribute:"error-payoff",type:Number,reflect:!0},nrPayoff:{attribute:"no-response-payoff",type:Number,reflect:!0},state:{attribute:!1,type:String,reflect:!1},trialCount:{attribute:!1,type:Number,reflect:!1},trialTotal:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.feedback=!1,this.trial=!1,this.payoffs=["none","trial","total"],this.payoff="none",this.correctPayoff=0,this.errorPayoff=0,this.nrPayoff=0,this.states=["off","waiting","feedback"],this.state="off",this.trialCount=0,this.trialTotal=0,this.signals=["left","right"],this.signal=void 0,this.responses=["left","right"],this.response=void 0,this.outcomes=["correct","error","nr"],this.outcome=void 0,this.startTime=void 0,this.rt=void 0,this.data={},this.trials=[],this.alignState()}get trialPayoff(){switch(this.outcome){case"correct":return this.correctPayoff;case"error":return this.errorPayoff;case"nr":return this.nrPayoff;default:return}}get totalPayoff(){return this.data.correctCount*this.correctPayoff+this.data.errorCount*this.errorPayoff+this.data.nrCount*this.nrPayoff}alignState(){this.data=sa.trials2stats(this.trials)}start(t,e){this.startTime=Date.now(),this.trialCount=e,this.state="waiting",this.signal=t,this.response=void 0,this.outcome=void 0,this.rt=void 0}stop(){this.state="feedback",void 0===this.response&&(this.outcome="nr",this.rt=void 0,this.trials.push({trial:this.trialCount,rt:this.rt,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff}),this.alignState())}left(){this.responded("left")}right(){this.responded("right")}responded(t){this.rt=Date.now()-this.startTime,this.state="feedback",this.response=t,this.signal===this.response?this.outcome="correct":this.signal!==this.response&&(this.outcome="error"),this.trials.push({trial:this.trialCount,rt:this.rt,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff}),this.alignState(),this.dispatchEvent(new CustomEvent("accumulable-response",{detail:{trial:this.trialCount,rt:this.rt,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff,data:this.data,totalPayoff:this.totalPayoff},bubbles:!0}))}reset(){this.state="off",this.trialCount=0,this.rt=void 0,this.signal=void 0,this.response=void 0,this.outcome=void 0,this.trials=[],this.alignState()}keydown(t){"waiting"===this.state&&("ArrowLeft"===t.key?(this.responded("left"),t.preventDefault()):"ArrowRight"===t.key&&(this.responded("right"),t.preventDefault()))}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.keydown.bind(this))}disconnectedCallback(){window.removeEventListener("keydown",this.keydown.bind(this)),super.disconnectedCallback()}static get styles(){return[super.styles,o`
885
850
  :host {
886
851
  display: inline-block;
887
852
  }
@@ -950,6 +915,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
950
915
 
951
916
  width: 6rem;
952
917
  height: 3.5rem;
918
+
953
919
  padding: 0.375rem 0.75rem;
954
920
  margin: 0.25rem;
955
921
 
@@ -978,6 +944,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
978
944
 
979
945
  .feedback .outcome {
980
946
  font-weight: 600;
947
+
981
948
  line-height: 1.15;
982
949
  }
983
950
 
@@ -1060,6 +1027,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1060
1027
  /* Labels */
1061
1028
  .payoff {
1062
1029
  font-weight: 600;
1030
+
1063
1031
  line-height: 0.75rem;
1064
1032
  }
1065
1033
 
@@ -1316,6 +1284,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1316
1284
 
1317
1285
  decidables-slider {
1318
1286
  line-height: 1;
1287
+
1319
1288
  text-align: center;
1320
1289
  }
1321
1290
 
@@ -1384,7 +1353,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1384
1353
  @change=${this.setNondecisionTime.bind(this)}
1385
1354
  @input=${this.setNondecisionTime.bind(this)}
1386
1355
  ><div>Nondecision Time<br><span class="math-var">t₀</span></div></decidables-slider>`:X``}
1387
- </div>`}}customElements.define("ddm-parameters",da);class ha extends(qr(ea)){static get properties(){return{measures:{attribute:"measures",type:Boolean,reflect:!0},means:{attribute:"means",type:Boolean,reflect:!0},sds:{attribute:"sds",type:Boolean,reflect:!0},human:{attribute:"human",type:Boolean,reflect:!0},trials:{attribute:"trials",type:Number,reflect:!0},seed:{attribute:"seed",type:Number,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.firstUpdate=!0,this.drag=!1,this.scale={time:{min:0,max:1e3,step:1,round:Math.round},evidence:{min:-1,max:1,step:.01,round:Math.round},density:{min:0,max:10,step:.01,round:Math.round}},this.measures=!1,this.means=!1,this.sds=!1,this.resample(),this.human=!1,this.trials=10,this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.precision=.005,this.random=null,this.bounds=null,this.startingPoint=null,this.data={},this.model={},this.animate=!1,this.paused=!1,this.alignState()}clear(){this.trials=0,this.data.trials=[]}trial(t={}){this.trials+=1,this.human?this.data.trials.push(t):this.animate=!0}pauseTrial(){Ke(this.renderRoot).select(".path[data-new-trial-ease-time]").interrupt("new").select(".curve").interrupt("new"),this.paused=!0}resumeTrial(){this.paused=!1,this.requestUpdate()}resample(){this.seed=Rr(0,1)()}alignPath(t,e,i,s,r){const a=Sr.source(Lr(t))(0,this.precision**.5),n=-e/2,o=e/2,l=e*i-e/2,c=s*this.precision,d=[];for(d.push({t:r,e:l});d.at(-1).e>n&&d.at(-1).e<o;)d.push({t:d.at(-1).t+1e3*this.precision,e:d.at(-1).e+c+sa.s.DEFAULT*a()});return d}alignCorrectDistribution(t,e,i,s){const r=sa.azv2pC(t,e,i),a=[{t:0,d:0},{t:this.t0,d:0}];for(let n=this.scale.time.min;n<=this.scale.time.max-s;n+=this.scale.time.step)n>0&&a.push({t:s+n,d:sa.tazv2gC(n/1e3,t,e,i)/r});return a}alignErrorDistribution(t,e,i,s){const r=sa.azv2pE(t,e,i),a=[{t:0,d:0},{t:this.t0,d:0}];for(let n=this.scale.time.min;n<=this.scale.time.max-s;n+=this.scale.time.step)n>0&&a.push({t:s+n,d:sa.tazv2gE(n/1e3,t,e,i)/r});return a}alignState(){this.random=Rr.source(Lr(this.seed))(0,1),this.bounds={lower:-this.a/2,upper:this.a/2},this.startingPoint=this.a*this.z-this.a/2,this.human?this.trials=this.data.trials.length:this.data.trials=Array.from({length:this.trials},(t,e)=>{const i=this.random()/1e3*997,s=this.animate&&e===this.trials-1,r=this.alignPath(i,this.a,this.z,this.v,this.t0),a=r.at(-1).e<=this.bounds.lower?"error":r.at(-1).e>=this.bounds.upper?"correct":"nr",n="error"===a?r.at(-2).t+(this.bounds.lower-r.at(-2).e)/(r.at(-1).e-r.at(-2).e)*(1e3*this.precision):"correct"===a?r.at(-2).t+(this.bounds.upper-r.at(-2).e)/(r.at(-1).e-r.at(-2).e)*(1e3*this.precision):null;return{index:e,seed:i,path:r,rt:n,outcome:a,animate:s}});const t=sa.trials2stats(this.data.trials.filter(t=>!t.animate));this.data={...this.data,...t},this.model.accuracy=sa.azv2pC(this.a,this.z,this.v),this.model.correctMeanRT=sa.azvt02mC(this.a,this.z,this.v,this.t0),this.model.errorMeanRT=sa.azvt02mE(this.a,this.z,this.v,this.t0),this.model.correctSDRT=sa.azv2sdC(this.a,this.z,this.v),this.model.errorSDRT=sa.azv2sdE(this.a,this.z,this.v),this.model.correctDist=this.alignCorrectDistribution(this.a,this.z,this.v,this.t0),this.model.errorDist=this.alignErrorDistribution(this.a,this.z,this.v,this.t0),this.dispatchEvent(new CustomEvent("ddm-model-output",{detail:{data:this.data,model:this.model},bubbles:!0}))}static get styles(){return[super.styles,o`
1356
+ </div>`}}customElements.define("ddm-parameters",da);class ua extends(qr(ea)){static get properties(){return{measures:{attribute:"measures",type:Boolean,reflect:!0},means:{attribute:"means",type:Boolean,reflect:!0},sds:{attribute:"sds",type:Boolean,reflect:!0},human:{attribute:"human",type:Boolean,reflect:!0},trials:{attribute:"trials",type:Number,reflect:!0},seed:{attribute:"seed",type:Number,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.firstUpdate=!0,this.drag=!1,this.scale={time:{min:0,max:1e3,step:1,round:Math.round},evidence:{min:-1,max:1,step:.01,round:Math.round},density:{min:0,max:10,step:.01,round:Math.round}},this.measures=!1,this.means=!1,this.sds=!1,this.resample(),this.human=!1,this.trials=10,this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.precision=.005,this.random=null,this.bounds=null,this.startingPoint=null,this.data={},this.model={},this.animate=!1,this.paused=!1,this.alignState()}clear(){this.trials=0,this.data.trials=[]}trial(t={}){this.trials+=1,this.human?this.data.trials.push(t):this.animate=!0}pauseTrial(){Ke(this.renderRoot).select(".path[data-new-trial-ease-time]").interrupt("new").select(".curve").interrupt("new"),this.paused=!0}resumeTrial(){this.paused=!1,this.requestUpdate()}resample(){this.seed=Rr(0,1)()}alignPath(t,e,i,s,r){const a=Sr.source(Lr(t))(0,this.precision**.5),n=-e/2,o=e/2,l=e*i-e/2,c=s*this.precision,d=[];for(d.push({t:r,e:l});d.at(-1).e>n&&d.at(-1).e<o;)d.push({t:d.at(-1).t+1e3*this.precision,e:d.at(-1).e+c+sa.s.DEFAULT*a()});return d}alignCorrectDistribution(t,e,i,s){const r=sa.azv2pC(t,e,i),a=[{t:0,d:0},{t:this.t0,d:0}];for(let n=this.scale.time.min;n<=this.scale.time.max-s;n+=this.scale.time.step)n>0&&a.push({t:s+n,d:sa.tazv2gC(n/1e3,t,e,i)/r});return a}alignErrorDistribution(t,e,i,s){const r=sa.azv2pE(t,e,i),a=[{t:0,d:0},{t:this.t0,d:0}];for(let n=this.scale.time.min;n<=this.scale.time.max-s;n+=this.scale.time.step)n>0&&a.push({t:s+n,d:sa.tazv2gE(n/1e3,t,e,i)/r});return a}alignState(){this.random=Rr.source(Lr(this.seed))(0,1),this.bounds={lower:-this.a/2,upper:this.a/2},this.startingPoint=this.a*this.z-this.a/2,this.human?this.trials=this.data.trials.length:this.data.trials=Array.from({length:this.trials},(t,e)=>{const i=this.random()/1e3*997,s=this.animate&&e===this.trials-1,r=this.alignPath(i,this.a,this.z,this.v,this.t0),a=r.at(-1).e<=this.bounds.lower?"error":r.at(-1).e>=this.bounds.upper?"correct":"nr",n="error"===a?r.at(-2).t+(this.bounds.lower-r.at(-2).e)/(r.at(-1).e-r.at(-2).e)*(1e3*this.precision):"correct"===a?r.at(-2).t+(this.bounds.upper-r.at(-2).e)/(r.at(-1).e-r.at(-2).e)*(1e3*this.precision):null;return{index:e,seed:i,path:r,rt:n,outcome:a,animate:s}});const t=sa.trials2stats(this.data.trials.filter(t=>!t.animate));this.data={...this.data,...t},this.model.accuracy=sa.azv2pC(this.a,this.z,this.v),this.model.correctMeanRT=sa.azvt02mC(this.a,this.z,this.v,this.t0),this.model.errorMeanRT=sa.azvt02mE(this.a,this.z,this.v,this.t0),this.model.correctSDRT=sa.azv2sdC(this.a,this.z,this.v),this.model.errorSDRT=sa.azv2sdE(this.a,this.z,this.v),this.model.correctDist=this.alignCorrectDistribution(this.a,this.z,this.v,this.t0),this.model.errorDist=this.alignErrorDistribution(this.a,this.z,this.v,this.t0),this.dispatchEvent(new CustomEvent("ddm-model-output",{detail:{data:this.data,model:this.model},bubbles:!0}))}static get styles(){return[super.styles,o`
1388
1357
  :host {
1389
1358
  display: inline-block;
1390
1359
 
@@ -1453,8 +1422,9 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1453
1422
  }
1454
1423
 
1455
1424
  .path.highlight .curve {
1456
- filter: url("#shadow-2");
1457
1425
  opacity: 1;
1426
+
1427
+ filter: url("#shadow-2");
1458
1428
  }
1459
1429
 
1460
1430
  .path.correct .curve {
@@ -1530,8 +1500,9 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1530
1500
 
1531
1501
  .boundary.interactive,
1532
1502
  .t0z.interactive {
1533
- filter: url("#shadow-2");
1534
1503
  outline: none;
1504
+
1505
+ filter: url("#shadow-2");
1535
1506
  }
1536
1507
 
1537
1508
  .boundary.interactive:hover,
@@ -1551,8 +1522,8 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1551
1522
  transform: translateY(0);
1552
1523
  }
1553
1524
 
1554
- :host(.keyboard) .boundary.interactive:focus,
1555
- :host(.keyboard) .t0z.interactive:focus {
1525
+ .boundary.interactive:focus-visible,
1526
+ .t0z.interactive:focus-visible {
1556
1527
  filter: url("#shadow-8");
1557
1528
 
1558
1529
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -1571,15 +1542,15 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1571
1542
 
1572
1543
  fill: none;
1573
1544
  stroke: var(---color-element-emphasis);
1574
- stroke-dasharray: 8 4;
1575
1545
  stroke-width: 2;
1546
+ stroke-dasharray: 8 4;
1576
1547
  }
1577
1548
 
1578
1549
  .drift.interactive {
1579
1550
  cursor: ns-resize;
1551
+ outline: none;
1580
1552
 
1581
1553
  filter: url("#shadow-2");
1582
- outline: none;
1583
1554
 
1584
1555
  /* HACK: This gets Safari to correctly apply the filter! */
1585
1556
  fill: #000000;
@@ -1600,7 +1571,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1600
1571
  fill: #00ff00;
1601
1572
  }
1602
1573
 
1603
- :host(.keyboard) .drift.interactive:focus {
1574
+ .drift.interactive:focus-visible {
1604
1575
  filter: url("#shadow-8");
1605
1576
 
1606
1577
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -1614,14 +1585,14 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1614
1585
  /* Make larger targets for touch users */
1615
1586
  .interactive .touch {
1616
1587
  stroke: #000000;
1617
- stroke-dasharray: none;
1618
1588
  stroke-opacity: 0;
1589
+ stroke-dasharray: none;
1619
1590
  }
1620
1591
 
1621
1592
  @media (pointer: coarse) {
1622
1593
  .interactive .touch {
1623
- stroke-linecap: round;
1624
1594
  stroke-width: 12;
1595
+ stroke-linecap: round;
1625
1596
  }
1626
1597
  }
1627
1598
 
@@ -1646,6 +1617,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1646
1617
 
1647
1618
  .measure.a .label {
1648
1619
  dominant-baseline: auto;
1620
+
1649
1621
  text-anchor: end;
1650
1622
  }
1651
1623
 
@@ -1657,6 +1629,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1657
1629
  /* Hack to avoid Safari weirdness */
1658
1630
  .measure.z .label tspan {
1659
1631
  dominant-baseline: hanging;
1632
+
1660
1633
  text-anchor: start;
1661
1634
  }
1662
1635
 
@@ -1666,6 +1639,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1666
1639
 
1667
1640
  .measure.v .label {
1668
1641
  dominant-baseline: auto;
1642
+
1669
1643
  text-anchor: start;
1670
1644
  }
1671
1645
 
@@ -1675,6 +1649,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1675
1649
 
1676
1650
  .measure.t0 .label {
1677
1651
  dominant-baseline: auto;
1652
+
1678
1653
  text-anchor: middle;
1679
1654
  }
1680
1655
 
@@ -1774,7 +1749,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1774
1749
  .rt-label.error text {
1775
1750
  dominant-baseline: hanging;
1776
1751
  }
1777
- `]}render(){return X``}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,i=this.height;let s,r;e/i>1.5?(r=i,s=1.5*r):(s=e,r=s/1.5);const a=1*this.rem,n=3*this.rem,o=3.75*this.rem,l=3.25*this.rem,c=r-(a+n),d=s-(o+l),h=.75*this.rem,u=.5*c,g=.25*c-h,p=.75*this.rem,m=.9*d,b=.1*d-p,y=parseInt(this.getComputedStyleValue("---transition-duration"),10),Q=Yr().domain([this.scale.time.min,this.scale.time.max]).range([0,m]),B=Yr().domain([this.scale.evidence.min,this.scale.evidence.max]).range([u,0]),U=Yr().domain([this.scale.density.min,this.scale.density.max]).range([g,0]),F=Yr().domain([this.scale.density.min,this.scale.density.max]).range([0,g]),I=Yr().domain([0,1]).range([0,c]),f=ci().subject((t,e)=>({x:Q(e.t0),y:B(e.startingPoint)})).on("start",t=>{Ke(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=!!t.sourceEvent.shiftKey&&(Math.abs(t.x-t.subject.x)>Math.abs(t.y-t.subject.y)?"t0":"z");let i=Q.invert(t.x),s=(B.invert(t.y)+this.a/2)/this.a;i="z"===e?Q.invert(t.subject.x):i<sa.t0.MIN?sa.t0.MIN:i>sa.t0.MAX?sa.t0.MAX:i,s="t0"===e?(B.invert(t.subject.y)+this.a/2)/this.a:s<sa.z.MIN?sa.z.MIN:s>sa.z.MAX?sa.z.MAX:s,this.t0=i,this.z=s,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0}))}).on("end",t=>{Ke(t.currentTarget).classed("dragging",!1),this.drag=!1}),C=ci().on("start",t=>{Ke(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;let e=(B.invert(t.y)-this.startingPoint)/(Q.invert(t.x)-this.t0)*1e3;e=e<sa.v.MIN?sa.v.MIN:e>sa.v.MAX?sa.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0}))}).on("end",t=>{Ke(t.currentTarget).classed("dragging",!1),this.drag=!1}),v=ci().subject((t,e)=>({x:0,y:B(e.value)})).on("start",t=>{Ke(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=B.invert(t.y);let i=Math.abs(2*e);i=i<sa.a.MIN?sa.a.MIN:i>sa.a.MAX?sa.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0}))}).on("end",t=>{Ke(t.currentTarget).classed("dragging",!1),this.drag=!1}),A=Zr().x(t=>Q(t.t)).y(t=>B(t.e)),x=Zr().x(t=>Q(t.t)).y(t=>U(t.d)),E=Zr().x(t=>Q(t.t)).y(t=>F(t.d)),R=Ke(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),S=R.enter().append("svg").classed("main",!0).each((t,e,i)=>{lt(ea.svgFilters,i[e])}),N=S.append("defs").classed("markers",!0),L=t=>{N.append("marker").attr("id",`measure-arrow-${t}`).attr("class",`measure-arrow ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-10 -6 12 12").attr("refX","0").attr("refY","0").attr("markerWidth","12").attr("markerHeight","12").append("path").attr("class","arrow").attr("d","M -7 -3 l 6 3 l -6 3 z")},w=t=>{const e=N.append("marker").attr("id",`measure-capped-arrow-${t}`).attr("class",`measure-arrow capped ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-10 -6 12 12").attr("refX","0").attr("refY","0").attr("markerWidth","12").attr("markerHeight","12");e.append("path").attr("class","arrow").attr("d","M -7 -3 l 6 3 l -6 3 z"),e.append("path").attr("class","cap").attr("d","M 0 -4 l 0 8")};L("a"),L("z"),w("v"),L("t0"),w("t0");const D=t=>{N.append("marker").attr("id",`model-sd-cap-${t}`).attr("class",`model-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -4 l 0 8"),N.append("marker").attr("id",`data-sd-cap-${t}`).attr("class",`data-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -3 l 0 6")};D("error"),D("correct");const M=N.append("linearGradient").attr("id","path-animate").attr("gradientUnits","userSpaceOnUse").attr("color-interpolation","linearRGB").attr("x1","0").attr("x2","0").attr("y1",B(this.bounds.upper)).attr("y2",B(this.bounds.lower));M.append("stop").classed("stop-0",!0).attr("offset","0%"),M.append("stop").classed("stop-100",!0).attr("offset","100%");const k=S.merge(R).attr("viewBox",`0 0 ${s} ${r}`),T=k.selectAll(".plot.density").data([{outcome:"correct",data:{meanRT:this.data.correctMeanRT,sdRT:this.data.correctSDRT},model:{meanRT:this.model.correctMeanRT,sdRT:this.model.correctSDRT,dist:this.model.correctDist},densityScale:U,densityLine:x,alignDistribution:this.alignCorrectDistribution.bind(this)},{outcome:"error",data:{meanRT:this.data.errorMeanRT,sdRT:this.data.errorSDRT},model:{meanRT:this.model.errorMeanRT,sdRT:this.model.errorSDRT,dist:this.model.errorDist},densityScale:F,densityLine:E,alignDistribution:this.alignErrorDistribution.bind(this)}]),V=S.append("g").classed("plot evidence",!0),H=T.enter().append("g").attr("class",t=>`plot density ${t.outcome}`),$=S.append("g").classed("plot accuracy",!0),z=k.select(".plot.evidence").attr("transform",`translate(${o}, ${a+g+h})`),G=H.merge(T).attr("transform",t=>`translate(${o}, ${"correct"===t.outcome?a:a+g+u+2*h})`),Y=k.select(".plot.accuracy").attr("transform",`translate(${o+m+p}, ${a})`);V.append("clipPath").attr("id","clip-evidence").append("rect"),z.select("clipPath rect").attr("y",B(this.bounds.upper)).attr("height",B(this.bounds.lower)-B(this.bounds.upper)+1).attr("width",m+1);const X=V.append("g").classed("underlayer",!0),J=H.append("g").classed("underlayer",!0),W=$.append("g").classed("underlayer",!0),_=z.select(".underlayer"),K=G.select(".underlayer"),Z=Y.select(".underlayer");V.append("g").classed("content",!0).append("g").classed("paths",!0);const P=H.append("g").classed("content",!0);$.append("g").classed("content",!0);const O=z.select(".content"),j=G.select(".content"),q=Y.select(".content");V.append("g").classed("overlayer",!0),H.append("g").classed("overlayer",!0),$.append("g").classed("overlayer",!0);const tt=z.select(".overlayer"),et=G.select(".overlayer");X.append("rect").classed("background",!0),J.append("rect").classed("background",!0),_.select(".background").transition().duration(this.drag?0:y).ease(rr).attr("y",B(this.bounds.upper)).attr("height",B(this.bounds.lower)-B(this.bounds.upper)).attr("width",m),K.select(".background").transition().duration(y).ease(rr).attr("height",g).attr("width",m),J.filter(t=>"error"===t.outcome).append("g").classed("axis time",!0);const it=K.filter(t=>"error"===t.outcome).select(".axis.time").attr("transform",`translate(0, ${g+.25*this.rem})`);var st;it.transition().duration(y).ease(rr).call((st=Q,Rt(3,st))).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const rt=J.filter(t=>"error"===t.outcome).append("text").classed("title time",!0).attr("text-anchor","middle");rt.append("tspan").classed("name",!0).text("Time (ms)"),K.filter(t=>"error"===t.outcome).select(".title.time").transition().duration(y).ease(rr).attr("transform",`translate(${m/2}, ${g+2.5*this.rem})`),X.append("g").classed("axis evidence",!0),J.append("g").attr("class",t=>`axis density ${t.outcome}`),W.append("g").classed("axis accuracy",!0);const at=_.select(".axis.evidence").attr("transform",`translate(${-.25*this.rem}, 0)`),nt=K.select(".axis.density").attr("transform",`translate(${-.25*this.rem}, 0)`),ot=Z.select(".axis.accuracy").attr("transform",`translate(${b+.25*this.rem}, 0)`),ct=at.transition().duration(y).ease(rr).call(St(B)).attr("font-size",null).attr("font-family",null),dt=nt.transition().duration(y).ease(rr).each((t,e,i)=>{St(t.densityScale).ticks(2)(Ke(i[e]))}).attr("font-size",null).attr("font-family",null),ht=ot.transition().duration(y).ease(rr).call(function(t){return Rt(2,t)}(I)).attr("font-size",null).attr("font-family",null);ct.selectAll("line, path").attr("stroke",null),dt.selectAll("line, path").attr("stroke",null),ht.selectAll("line, path").attr("stroke",null);const ut=X.append("text").classed("title evidence",!0).attr("text-anchor","middle"),gt=J.append("text").attr("class",t=>`title density ${t.outcome}`).attr("text-anchor","middle"),pt=W.append("text").classed("title accuracy",!0).attr("text-anchor","middle");ut.append("tspan").classed("name",!0).text("Evidence"),gt.append("tspan").classed("name",!0).text("Density"),pt.append("tspan").classed("name",!0).text("Accuracy"),_.select(".title.evidence").transition().duration(y).ease(rr).attr("transform",`translate(${-2.5*this.rem}, ${u/2})rotate(-90)`),K.select(".title.density").transition().duration(y).ease(rr).attr("transform",`translate(${-2.5*this.rem}, ${g/2})rotate(-90)`),Z.select(".title.accuracy").transition().duration(y).ease(rr).attr("transform",`translate(${b+2.25*this.rem}, ${c/2})rotate(90)`);const mt=O.select(".paths").selectAll(".path").data(this.data.trials.filter(t=>void 0!==t.path)),bt=Pe(),yt=mt.enter().append("g").classed("path",!0).attr("data-new-trial-ease-time",0).on("pointerenter",(t,e)=>{if(!this.drag){Ke(t.currentTarget).classed("highlight",!0).raise();const i=tt.append("g").classed(`rt-label ${e.outcome}`,!0),s=i.append("rect"),r=i.append("text").text(`RT = ${e.rt.toFixed()}`).attr("x",Q(e.rt)).attr("y","correct"===e.outcome?B(this.bounds.upper)-.25*this.rem:B(this.bounds.lower)+.125*this.rem).node().getBBox();s.attr("x",r.x-.125*this.rem).attr("y",r.y+.125*this.rem).attr("width",r.width+.25*this.rem).attr("height",r.height-.25*this.rem),bt.set(t.currentTarget,i)}}).on("pointerout",(t,e)=>{this.drag||(Ke(t.currentTarget).classed("highlight",!1).lower(),t.currentTarget.parentNode.insertBefore(t.currentTarget,t.currentTarget.parentNode.children[e.index]),bt.get(t.currentTarget).remove())});yt.append("path").classed("curve",!0).attr("clip-path","url(#clip-evidence)").attr("pathLength",1).attr("stroke-dashoffset",1);const Qt=yt.merge(mt).attr("class",t=>`path ${t.outcome}`);Qt.select(".curve").transition().duration(this.drag?0:y).ease(rr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attrTween("d",(t,e,i)=>{const s=i[e],r=is(void 0!==s.a?s.a:this.a,this.a),a=is(void 0!==s.z?s.z:this.z,this.z),n=is(void 0!==s.v?s.v:this.v,this.v),o=is(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=this.alignPath(t.seed,s.a,s.z,s.v,s.t0);return A(i)}});const Bt=Qt.filter(t=>t.animate&&!this.paused);if(!Bt.empty()){const t=Bt.attr("data-new-trial-ease-time"),e=e=>Yr().domain([0,1]).range([t,1])(e),i=e=>i=>Yr().domain([e(t),1]).range([0,1])(e(i));Bt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1),Bt.transition("new").duration(e=>Math.floor(1.5*e.rt*(1-t))).ease(e).attr("data-new-trial-ease-time",1).select(".curve").attrTween("stroke-dashoffset",(t,e,s)=>{const r=is(s[e].getAttribute("stroke-dashoffset"),0);return t=>r(i(sr)(t))}).on("end",(t,e,i)=>{Ke(i[e].parentElement).classed("animate",!1).attr("data-new-trial-ease-time",null),t.animate=!1,this.animate=!1,this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("accumulable-response",{detail:{outcome:t.outcome,data:this.data,model:this.model},bubbles:!0}))})}const Ut=Qt.filter(t=>t.animate&&this.paused);if(!Ut.empty()){const t=Ut.attr("data-new-trial-ease-time");Ut.classed("animate",!0).select(".curve").attr("stroke-dasharray",1).attr("stroke-dashoffset",()=>is(1,0)(sr(t)))}Qt.filter(t=>!t.animate).attr("data-new-trial-ease-time",null),mt.exit().remove();const Ft=P.append("g").attr("class",t=>`dist ${t.outcome}`);Ft.append("path").classed("curve",!0),j.select(".dist").select(".curve").transition().duration(this.drag?0:y).ease(rr).attrTween("d",(t,e,i)=>{const s=i[e],r=is(void 0!==s.a?s.a:this.a,this.a),a=is(void 0!==s.z?s.z:this.z,this.z),n=is(void 0!==s.v?s.v:this.v,this.v),o=is(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=t.alignDistribution(s.a,s.z,s.v,s.t0);return t.densityLine(i)}});const It=O.selectAll(".rt").data(this.data.trials),ft=It.enter().append("g");ft.append("line").classed("mark",!0).attr("x1",t=>Q(t.rt)).attr("x2",t=>Q(t.rt)).attr("y1",t=>"correct"===t.outcome?B(1)-.125*this.rem:B(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?B(1)-.675*this.rem:B(-1)+.675*this.rem);const Ct=ft.merge(It).attr("class",t=>`rt ${t.outcome}`);Ct.filter(t=>!t.animate).select(".mark").transition().duration(this.drag?0:y).ease(rr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attr("x1",t=>Q(t.rt)).attr("x2",t=>Q(t.rt)).attr("y1",t=>"correct"===t.outcome?B(1)-.125*this.rem:B(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?B(1)-.675*this.rem:B(-1)+.675*this.rem),It.exit().remove();const vt=q.selectAll(".accuracy.model").data([this.model.accuracy,1-this.model.accuracy]),At=vt.enter().append("g").attr("class",(t,e)=>"accuracy model "+(0===e?"correct":"error"));At.append("rect").classed("bar",!0).attr("x",0),At.merge(vt).select("rect").transition().duration(this.drag?0:y).ease(rr).attr("y",(t,e)=>I(0===e?0:1-t)).attr("width",b).attr("height",t=>I(t)),vt.exit().remove();const xt=q.selectAll(".accuracy.data").data(Number.isNaN(this.data.accuracy)?[]:[this.data.accuracy]),Et=xt.enter().append("g").classed("accuracy data",!0);Et.append("line").classed("mark",!0);const Nt=Et.merge(xt).attr("class",t=>"accuracy data "+(t<this.model.accuracy.correct?"correct":"error"));Nt.select(".mark").transition().duration(this.drag?0:y).ease(rr).attr("x1",0+.25*this.rem).attr("x2",b-.25*this.rem).attr("y1",t=>I(t)-1).attr("y2",t=>I(t)-1),xt.exit().remove();const Lt=tt.selectAll(".boundary").data([{bound:"upper",value:this.bounds.upper},{bound:"lower",value:this.bounds.lower}]),wt=Lt.enter().append("g").attr("class",(t,e)=>"boundary "+(0===e?"correct":"error"));wt.append("line").classed("line",!0),wt.append("line").classed("line touch",!0);const Dt=wt.merge(Lt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?(t,e)=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{a:i}=this;switch(t.key){case"ArrowUp":i+="upper"===e.bound?t.shiftKey?sa.a.STEP:sa.a.JUMP:t.shiftKey?-.01:-.1;break;case"ArrowDown":i+="upper"===e.bound?t.shiftKey?-.01:-.1:t.shiftKey?sa.a.STEP:sa.a.JUMP}i=i<sa.a.MIN?sa.a.MIN:i>sa.a.MAX?sa.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Dt.call(v):Dt.on(".drag",null)),Dt.select(".line").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(this.scale.time.min)).attr("x2",Q(this.scale.time.max)).attr("y1",t=>B(t.value)).attr("y2",t=>B(t.value)),Dt.select(".line.touch").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(this.scale.time.min)).attr("x2",Q(this.scale.time.max)).attr("y1",t=>B(t.value)).attr("y2",t=>B(t.value)),Lt.exit().remove();const Mt=tt.selectAll(".drift").data([{v:this.v,t0:this.t0,startingPoint:this.startingPoint}]),kt=Mt.enter().append("g").classed("drift",!0);kt.append("line").classed("line",!0),kt.append("line").classed("line touch",!0),kt.append("path").classed("arrow",!0),kt.append("path").classed("arrow touch",!0);const Tt=kt.merge(Mt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{v:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?sa.v.STEP:sa.v.JUMP;break;case"ArrowDown":e-=t.shiftKey?sa.v.STEP:sa.v.JUMP}e=e<sa.v.MIN?sa.v.MIN:e>sa.v.MAX?sa.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Tt.call(C):Tt.on(".drag",null));const Vt=(B(0)-B(1))/(Q(1)-Q(0));Tt.transition().duration(this.drag?0:y).ease(rr).attr("transform",t=>`translate(${Q(t.t0)}, ${B(t.startingPoint)})\n rotate(${-Math.atan(t.v/1e3*Vt)*(180/Math.PI)})`),Tt.select(".line").attr("x2",Q(200)),Tt.select(".line.touch").attr("x2",Q(200)),Tt.select(".arrow").attr("d",`\n M ${Q(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Tt.select(".arrow.touch").attr("d",`\n M ${Q(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Mt.exit().remove();const Ht=tt.selectAll(".t0z").data([{t0:this.t0,startingPoint:this.startingPoint}]),$t=Ht.enter().append("g").classed("t0z",!0);$t.append("line").classed("line",!0),$t.append("line").classed("line touch",!0),$t.append("circle").classed("point touch",!0);const zt=$t.merge(Ht).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{z:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?sa.z.STEP:sa.z.JUMP;break;case"ArrowDown":e-=t.shiftKey?sa.z.STEP:sa.z.JUMP}e=e<sa.z.MIN?sa.z.MIN:e>sa.z.MAX?sa.z.MAX:e,this.z=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0})),t.preventDefault()}if(["ArrowLeft","ArrowRight"].includes(t.key)){let e=this.t0;switch(t.key){case"ArrowRight":e+=t.shiftKey?sa.t0.STEP:sa.t0.JUMP;break;case"ArrowLeft":e-=t.shiftKey?sa.t0.STEP:sa.t0.JUMP}e=e<sa.t0.MIN?sa.t0.MIN:e>sa.t0.MAX?sa.t0.MAX:e,this.t0=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?zt.call(f):zt.on(".drag",null)),zt.select(".line").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(0)).attr("x2",t=>Q(t.t0)).attr("y1",t=>B(t.startingPoint)).attr("y2",t=>B(t.startingPoint)),zt.select(".line.touch").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(0)).attr("x2",t=>Q(t.t0)).attr("y1",t=>B(t.startingPoint)).attr("y2",t=>B(t.startingPoint)),zt.select(".point").transition().duration(this.drag?0:y).ease(rr).attr("cx",t=>Q(t.t0)).attr("cy",t=>B(t.startingPoint)),Ht.exit().remove();const Gt=tt.selectAll(".measure.a").data(this.measures?[this.a]:[]),Yt=Gt.enter().append("g").classed("measure a",!0);Yt.append("line").classed("line",!0),Yt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-a)").attr("marker-end","url(#measure-arrow-a)");const Xt=Yt.append("text").classed("label",!0);Xt.append("tspan").classed("a math-var",!0).text("a"),Xt.append("tspan").classed("equals",!0).text(" = "),Xt.append("tspan").classed("value",!0);const Jt=Math.abs(B(this.bounds.upper)-B(this.bounds.lower))<=4,Wt=Yt.merge(Gt);Wt.select(".line").classed("short",Jt).transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(this.scale.time.max)-.75*this.rem).attr("y1",B(this.bounds.upper)+2).attr("x2",Q(this.scale.time.max)-.75*this.rem).attr("y2",B(this.bounds.lower)-2),Wt.select(".markers").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(this.scale.time.max)-.75*this.rem).attr("y1",B(this.bounds.upper)).attr("x2",Q(this.scale.time.max)-.75*this.rem).attr("y2",B(this.bounds.lower));Wt.select(".label").transition().duration(this.drag?0:y).ease(rr).attr("x",Q(this.scale.time.max)).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(fr(".2f")(this.a)),Gt.exit().remove();const _t=tt.selectAll(".measure.z").data(this.measures?[this.z]:[]),Kt=_t.enter().append("g").classed("measure z",!0);Kt.append("line").classed("line",!0),Kt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-z)").attr("marker-end","url(#measure-arrow-z)");const Zt=Kt.append("text").classed("label",!0);Zt.append("tspan").classed("z math-var",!0).text("z"),Zt.append("tspan").classed("equals",!0).text(" = "),Zt.append("tspan").classed("value",!0);const Pt=Math.abs(B(this.startingPoint)-B(this.bounds.lower))<=4,Ot=Kt.merge(_t);Ot.select(".line").classed("short",Pt).transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(this.scale.time.min)+.75*this.rem).attr("y1",B(this.startingPoint)+2).attr("x2",Q(this.scale.time.min)+.75*this.rem).attr("y2",B(this.bounds.lower)-2),Ot.select(".markers").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(this.scale.time.min)+.75*this.rem).attr("y1",B(this.startingPoint)).attr("x2",Q(this.scale.time.min)+.75*this.rem).attr("y2",B(this.bounds.lower));Ot.select(".label").transition().duration(this.drag?0:y).ease(rr).attr("x",Q(this.scale.time.min)).attr("y",B(this.bounds.lower)+.125*this.rem).select(".value").text(fr(".0%")(this.z)),_t.exit().remove();const jt=tt.selectAll(".measure.v").data(this.measures?[this.v]:[]),qt=jt.enter().append("g").classed("measure v",!0);qt.append("path").classed("line",!0),qt.append("path").classed("markers",!0).attr("marker-start","url(#measure-capped-arrow-v)").attr("marker-end","url(#measure-capped-arrow-v)");const te=qt.append("text").classed("label",!0);te.append("tspan").classed("v math-var",!0).text("v"),te.append("tspan").classed("equals",!0).text(" = "),te.append("tspan").classed("value",!0);const ee=Q(200)-Q(0)+.75*this.rem,ie=Math.atan(this.v/1e3*Vt),se=Math.cos(ie)*ee,re=Math.sin(ie)*ee,ae=2/ee,ne=Math.atan(this.v/1e3*Vt)-ae,oe=Math.cos(ae)*ee,le=Math.sin(ae)*ee,ce=Math.cos(ne)*ee,de=Math.sin(ne)*ee,he=ne*ee<=4,ue=qt.merge(jt);ue.select(".line").classed("short",he).transition().duration(this.drag?0:y).ease(rr).attr("d",`\n M ${Q(this.t0)+oe}, ${B(this.startingPoint)-le}\n A ${Q(200)-Q(0)+.75*this.rem} ${Q(200)-Q(0)+.75*this.rem} 0 0 0 ${Q(this.t0)+ce} ${B(this.startingPoint)-de}\n `),ue.select(".markers").transition().duration(this.drag?0:y).ease(rr).attr("d",`\n M ${Q(this.t0+200)+.75*this.rem}, ${B(this.startingPoint)}\n A ${Q(200)-Q(0)+.75*this.rem} ${Q(200)-Q(0)+.75*this.rem} 0 0 0 ${Q(this.t0)+se} ${B(this.startingPoint)-re}\n `);ue.select(".label").transition().duration(this.drag?0:y).ease(rr).attr("x",Q(this.t0+200)+.5*this.rem).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(fr(".2f")(this.v)),jt.exit().remove();const ge=tt.selectAll(".measure.t0").data(this.measures?[this.t0]:[]),pe=ge.enter().append("g").classed("measure t0",!0);pe.append("line").classed("line",!0),pe.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-t0)").attr("marker-end","url(#measure-capped-arrow-t0)");const me=pe.append("text").classed("label",!0);me.append("tspan").classed("t0 math-var",!0).text("t₀"),me.append("tspan").classed("equals",!0).text(" = "),me.append("tspan").classed("value",!0);const be=Math.abs(Q(0)-Q(this.t0))<=4,ye=pe.merge(ge);ye.select(".line").classed("short",be).transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(0)+2).attr("y1",B(this.startingPoint)-.75*this.rem).attr("x2",Q(this.t0)-2).attr("y2",B(this.startingPoint)-.75*this.rem),ye.select(".markers").transition().duration(this.drag?0:y).ease(rr).attr("x1",Q(0)).attr("y1",B(this.startingPoint)-.75*this.rem).attr("x2",Q(this.t0)).attr("y2",B(this.startingPoint)-.75*this.rem);ye.select(".label").transition().duration(this.drag?0:y).ease(rr).attr("x",Q(this.t0)+.25*this.rem).attr("y",B(this.bounds.upper)-.25*this.rem).select(".value").text(fr("d")(this.t0)),ge.exit().remove();const Qe=et.selectAll(".model.mean").data(t=>this.means?[t]:[]),Be=Qe.enter().append("g").attr("class",t=>`model mean ${t.outcome}`);Be.append("line").classed("indicator",!0);Be.merge(Qe).select(".indicator").transition().duration(this.drag?0:y).ease(rr).attr("x1",t=>Q(t.model.meanRT)).attr("x2",t=>Q(t.model.meanRT)).attr("y1",t=>t.densityScale(this.scale.density.min)).attr("y2",t=>t.densityScale(this.scale.density.max)),Qe.exit().remove();const Ue=et.selectAll(".data.mean").data(t=>this.means&&!Number.isNaN(t.data.meanRT)?[t]:[]),Fe=Ue.enter().append("g").attr("class",t=>`data mean ${t.outcome}`);Fe.append("line").classed("indicator",!0).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem);Fe.merge(Ue).select(".indicator").transition().duration(this.drag?0:y).ease(rr).attr("x1",t=>Q(t.data.meanRT)).attr("x2",t=>Q(t.data.meanRT)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem),Ue.exit().select(".indicator").transition().duration(this.drag?0:y).ease(rr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{Ke(i[e].parentElement).remove()});const Ie=et.selectAll(".model.sd").data(t=>this.sds?[t]:[]),fe=Ie.enter().append("g").attr("class",t=>`model sd ${t.outcome}`);fe.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#model-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#model-sd-cap-${t.outcome})`);fe.merge(Ie).select(".indicator").transition().duration(this.drag?0:y).ease(rr).attr("x1",t=>Q(t.model.meanRT-t.model.sdRT/2)).attr("x2",t=>Q(t.model.meanRT+t.model.sdRT/2)).attr("y1",t=>t.densityScale(5)).attr("y2",t=>t.densityScale(5)),Ie.exit().remove();const Ce=et.selectAll(".data.sd").data(t=>!this.sds||Number.isNaN(t.data.meanRT)||Number.isNaN(t.data.sdRT)?[]:[t]),ve=Ce.enter().append("g").attr("class",t=>`data sd ${t.outcome}`);ve.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#data-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#data-sd-cap-${t.outcome})`).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem);ve.merge(Ce).select(".indicator").transition().duration(this.drag?0:y).ease(rr).attr("x1",t=>Q(t.data.meanRT-t.data.sdRT/2)).attr("x2",t=>Q(t.data.meanRT+t.data.sdRT/2)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem),Ce.exit().select(".indicator").transition().duration(this.drag?0:y).ease(rr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{Ke(i[e].parentElement).remove()}),this.firstUpdate=!1}}customElements.define("ddm-model",ha);class ua extends(qr(ea)){static get properties(){return{coherence:{attribute:"coherence",type:Number,reflect:!0},count:{attribute:"count",type:Number,reflect:!0},probability:{attribute:"probability",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},wait:{attribute:"wait",type:Number,reflect:!0},iti:{attribute:"iti",type:Number,reflect:!0},trials:{attribute:"trials",type:Number,reflect:!0},running:{attribute:"running",type:Boolean,reflect:!0},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.coherence=.5,this.count=100,this.probability=.5,this.duration=2e3,this.wait=2e3,this.iti=2e3,this.trials=5,this.running=!1,this.lifetime=400,this.speed=50,this.firstUpdate=!0,this.COHERENT=0,this.RANDOM=1,this.dots=[[],[]],this.trial=0,this.states=["resetted","iti","stimulus","wait","ended"],this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.LEFT=180,this.RIGHT=0,this.currentDirection=void 0,this.signals=["left","right"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,o`
1752
+ `]}render(){return X``}willUpdate(){this.alignState()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,i=this.height;let s,r;e/i>1.5?(r=i,s=1.5*r):(s=e,r=s/1.5);const a=1*this.rem,n=3*this.rem,o=3.75*this.rem,l=3.25*this.rem,c=r-(a+n),d=s-(o+l),u=.75*this.rem,h=.5*c,g=.25*c-u,p=.75*this.rem,m=.9*d,b=.1*d-p,Q=parseInt(this.getComputedStyleValue("---transition-duration"),10),B=Yr().domain([this.scale.time.min,this.scale.time.max]).range([0,m]),y=Yr().domain([this.scale.evidence.min,this.scale.evidence.max]).range([h,0]),U=Yr().domain([this.scale.density.min,this.scale.density.max]).range([g,0]),F=Yr().domain([this.scale.density.min,this.scale.density.max]).range([0,g]),I=Yr().domain([0,1]).range([0,c]),f=ci().subject((t,e)=>({x:B(e.t0),y:y(e.startingPoint)})).on("start",t=>{Ke(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=!!t.sourceEvent.shiftKey&&(Math.abs(t.x-t.subject.x)>Math.abs(t.y-t.subject.y)?"t0":"z");let i=B.invert(t.x),s=(y.invert(t.y)+this.a/2)/this.a;i="z"===e?B.invert(t.subject.x):i<sa.t0.MIN?sa.t0.MIN:i>sa.t0.MAX?sa.t0.MAX:i,s="t0"===e?(y.invert(t.subject.y)+this.a/2)/this.a:s<sa.z.MIN?sa.z.MIN:s>sa.z.MAX?sa.z.MAX:s,this.t0=i,this.z=s,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0}))}).on("end",t=>{Ke(t.currentTarget).classed("dragging",!1),this.drag=!1}),C=ci().on("start",t=>{Ke(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;let e=(y.invert(t.y)-this.startingPoint)/(B.invert(t.x)-this.t0)*1e3;e=e<sa.v.MIN?sa.v.MIN:e>sa.v.MAX?sa.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0}))}).on("end",t=>{Ke(t.currentTarget).classed("dragging",!1),this.drag=!1}),v=ci().subject((t,e)=>({x:0,y:y(e.value)})).on("start",t=>{Ke(t.currentTarget).classed("dragging",!0)}).on("drag",t=>{this.drag=!0;const e=y.invert(t.y);let i=Math.abs(2*e);i=i<sa.a.MIN?sa.a.MIN:i>sa.a.MAX?sa.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0}))}).on("end",t=>{Ke(t.currentTarget).classed("dragging",!1),this.drag=!1}),A=Zr().x(t=>B(t.t)).y(t=>y(t.e)),x=Zr().x(t=>B(t.t)).y(t=>U(t.d)),E=Zr().x(t=>B(t.t)).y(t=>F(t.d)),R=Ke(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),S=R.enter().append("svg").classed("main",!0).each((t,e,i)=>{lt(ea.svgFilters,i[e])}),N=S.append("defs").classed("markers",!0),L=t=>{N.append("marker").attr("id",`measure-arrow-${t}`).attr("class",`measure-arrow ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-10 -6 12 12").attr("refX","0").attr("refY","0").attr("markerWidth","12").attr("markerHeight","12").append("path").attr("class","arrow").attr("d","M -7 -3 l 6 3 l -6 3 z")},w=t=>{const e=N.append("marker").attr("id",`measure-capped-arrow-${t}`).attr("class",`measure-arrow capped ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-10 -6 12 12").attr("refX","0").attr("refY","0").attr("markerWidth","12").attr("markerHeight","12");e.append("path").attr("class","arrow").attr("d","M -7 -3 l 6 3 l -6 3 z"),e.append("path").attr("class","cap").attr("d","M 0 -4 l 0 8")};L("a"),L("z"),w("v"),L("t0"),w("t0");const D=t=>{N.append("marker").attr("id",`model-sd-cap-${t}`).attr("class",`model-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -4 l 0 8"),N.append("marker").attr("id",`data-sd-cap-${t}`).attr("class",`data-sd cap ${t}`).attr("orient","auto-start-reverse").attr("markerUnits","userSpaceOnUse").attr("viewBox","-5 -5 10 10").attr("refX","0").attr("refY","0").attr("markerWidth","10").attr("markerHeight","10").append("path").attr("stroke","context-stroke").attr("fill","context-stroke").attr("stroke-width","2").attr("d","M 0 -3 l 0 6")};D("error"),D("correct");const M=N.append("linearGradient").attr("id","path-animate").attr("gradientUnits","userSpaceOnUse").attr("color-interpolation","linearRGB").attr("x1","0").attr("x2","0").attr("y1",y(this.bounds.upper)).attr("y2",y(this.bounds.lower));M.append("stop").classed("stop-0",!0).attr("offset","0%"),M.append("stop").classed("stop-100",!0).attr("offset","100%");const k=S.merge(R).attr("viewBox",`0 0 ${s} ${r}`),T=k.selectAll(".plot.density").data([{outcome:"correct",data:{meanRT:this.data.correctMeanRT,sdRT:this.data.correctSDRT},model:{meanRT:this.model.correctMeanRT,sdRT:this.model.correctSDRT,dist:this.model.correctDist},densityScale:U,densityLine:x,alignDistribution:this.alignCorrectDistribution.bind(this)},{outcome:"error",data:{meanRT:this.data.errorMeanRT,sdRT:this.data.errorSDRT},model:{meanRT:this.model.errorMeanRT,sdRT:this.model.errorSDRT,dist:this.model.errorDist},densityScale:F,densityLine:E,alignDistribution:this.alignErrorDistribution.bind(this)}]),V=S.append("g").classed("plot evidence",!0),H=T.enter().append("g").attr("class",t=>`plot density ${t.outcome}`),$=S.append("g").classed("plot accuracy",!0),z=k.select(".plot.evidence").attr("transform",`translate(${o}, ${a+g+u})`),G=H.merge(T).attr("transform",t=>`translate(${o}, ${"correct"===t.outcome?a:a+g+h+2*u})`),Y=k.select(".plot.accuracy").attr("transform",`translate(${o+m+p}, ${a})`);V.append("clipPath").attr("id","clip-evidence").append("rect"),z.select("clipPath rect").attr("y",y(this.bounds.upper)).attr("height",y(this.bounds.lower)-y(this.bounds.upper)+1).attr("width",m+1);const X=V.append("g").classed("underlayer",!0),J=H.append("g").classed("underlayer",!0),W=$.append("g").classed("underlayer",!0),_=z.select(".underlayer"),K=G.select(".underlayer"),Z=Y.select(".underlayer");V.append("g").classed("content",!0).append("g").classed("paths",!0);const P=H.append("g").classed("content",!0);$.append("g").classed("content",!0);const O=z.select(".content"),j=G.select(".content"),q=Y.select(".content");V.append("g").classed("overlayer",!0),H.append("g").classed("overlayer",!0),$.append("g").classed("overlayer",!0);const tt=z.select(".overlayer"),et=G.select(".overlayer");X.append("rect").classed("background",!0),J.append("rect").classed("background",!0),_.select(".background").transition().duration(this.drag?0:Q).ease(rr).attr("y",y(this.bounds.upper)).attr("height",y(this.bounds.lower)-y(this.bounds.upper)).attr("width",m),K.select(".background").transition().duration(Q).ease(rr).attr("height",g).attr("width",m),J.filter(t=>"error"===t.outcome).append("g").classed("axis time",!0);const it=K.filter(t=>"error"===t.outcome).select(".axis.time").attr("transform",`translate(0, ${g+.25*this.rem})`);var st;it.transition().duration(Q).ease(rr).call((st=B,Rt(3,st))).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const rt=J.filter(t=>"error"===t.outcome).append("text").classed("title time",!0).attr("text-anchor","middle");rt.append("tspan").classed("name",!0).text("Time (ms)"),K.filter(t=>"error"===t.outcome).select(".title.time").transition().duration(Q).ease(rr).attr("transform",`translate(${m/2}, ${g+2.5*this.rem})`),X.append("g").classed("axis evidence",!0),J.append("g").attr("class",t=>`axis density ${t.outcome}`),W.append("g").classed("axis accuracy",!0);const at=_.select(".axis.evidence").attr("transform",`translate(${-.25*this.rem}, 0)`),nt=K.select(".axis.density").attr("transform",`translate(${-.25*this.rem}, 0)`),ot=Z.select(".axis.accuracy").attr("transform",`translate(${b+.25*this.rem}, 0)`),ct=at.transition().duration(Q).ease(rr).call(St(y)).attr("font-size",null).attr("font-family",null),dt=nt.transition().duration(Q).ease(rr).each((t,e,i)=>{St(t.densityScale).ticks(2)(Ke(i[e]))}).attr("font-size",null).attr("font-family",null),ut=ot.transition().duration(Q).ease(rr).call(function(t){return Rt(2,t)}(I)).attr("font-size",null).attr("font-family",null);ct.selectAll("line, path").attr("stroke",null),dt.selectAll("line, path").attr("stroke",null),ut.selectAll("line, path").attr("stroke",null);const ht=X.append("text").classed("title evidence",!0).attr("text-anchor","middle"),gt=J.append("text").attr("class",t=>`title density ${t.outcome}`).attr("text-anchor","middle"),pt=W.append("text").classed("title accuracy",!0).attr("text-anchor","middle");ht.append("tspan").classed("name",!0).text("Evidence"),gt.append("tspan").classed("name",!0).text("Density"),pt.append("tspan").classed("name",!0).text("Accuracy"),_.select(".title.evidence").transition().duration(Q).ease(rr).attr("transform",`translate(${-2.5*this.rem}, ${h/2})rotate(-90)`),K.select(".title.density").transition().duration(Q).ease(rr).attr("transform",`translate(${-2.5*this.rem}, ${g/2})rotate(-90)`),Z.select(".title.accuracy").transition().duration(Q).ease(rr).attr("transform",`translate(${b+2.25*this.rem}, ${c/2})rotate(90)`);const mt=O.select(".paths").selectAll(".path").data(this.data.trials.filter(t=>void 0!==t.path)),bt=Pe(),Qt=mt.enter().append("g").classed("path",!0).attr("data-new-trial-ease-time",0).on("pointerenter",(t,e)=>{if(!this.drag){Ke(t.currentTarget).classed("highlight",!0).raise();const i=tt.append("g").classed(`rt-label ${e.outcome}`,!0),s=i.append("rect"),r=i.append("text").text(`RT = ${e.rt.toFixed()}`).attr("x",B(e.rt)).attr("y","correct"===e.outcome?y(this.bounds.upper)-.25*this.rem:y(this.bounds.lower)+.125*this.rem).node().getBBox();s.attr("x",r.x-.125*this.rem).attr("y",r.y+.125*this.rem).attr("width",r.width+.25*this.rem).attr("height",r.height-.25*this.rem),bt.set(t.currentTarget,i)}}).on("pointerout",(t,e)=>{this.drag||(Ke(t.currentTarget).classed("highlight",!1).lower(),t.currentTarget.parentNode.insertBefore(t.currentTarget,t.currentTarget.parentNode.children[e.index]),bt.get(t.currentTarget).remove())});Qt.append("path").classed("curve",!0).attr("clip-path","url(#clip-evidence)").attr("pathLength",1).attr("stroke-dashoffset",1);const Bt=Qt.merge(mt).attr("class",t=>`path ${t.outcome}`);Bt.select(".curve").transition().duration(this.drag?0:Q).ease(rr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attrTween("d",(t,e,i)=>{const s=i[e],r=is(void 0!==s.a?s.a:this.a,this.a),a=is(void 0!==s.z?s.z:this.z,this.z),n=is(void 0!==s.v?s.v:this.v,this.v),o=is(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=this.alignPath(t.seed,s.a,s.z,s.v,s.t0);return A(i)}});const yt=Bt.filter(t=>t.animate&&!this.paused);if(!yt.empty()){const t=yt.attr("data-new-trial-ease-time"),e=e=>Yr().domain([0,1]).range([t,1])(e),i=e=>i=>Yr().domain([e(t),1]).range([0,1])(e(i));yt.classed("animate",!0).select(".curve").attr("stroke-dasharray",1),yt.transition("new").duration(e=>Math.floor(1.5*e.rt*(1-t))).ease(e).attr("data-new-trial-ease-time",1).select(".curve").attrTween("stroke-dashoffset",(t,e,s)=>{const r=is(s[e].getAttribute("stroke-dashoffset"),0);return t=>r(i(sr)(t))}).on("end",(t,e,i)=>{Ke(i[e].parentElement).classed("animate",!1).attr("data-new-trial-ease-time",null),t.animate=!1,this.animate=!1,this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("accumulable-response",{detail:{outcome:t.outcome,data:this.data,model:this.model},bubbles:!0}))})}const Ut=Bt.filter(t=>t.animate&&this.paused);if(!Ut.empty()){const t=Ut.attr("data-new-trial-ease-time");Ut.classed("animate",!0).select(".curve").attr("stroke-dasharray",1).attr("stroke-dashoffset",()=>is(1,0)(sr(t)))}Bt.filter(t=>!t.animate).attr("data-new-trial-ease-time",null),mt.exit().remove();const Ft=P.append("g").attr("class",t=>`dist ${t.outcome}`);Ft.append("path").classed("curve",!0),j.select(".dist").select(".curve").transition().duration(this.drag?0:Q).ease(rr).attrTween("d",(t,e,i)=>{const s=i[e],r=is(void 0!==s.a?s.a:this.a,this.a),a=is(void 0!==s.z?s.z:this.z,this.z),n=is(void 0!==s.v?s.v:this.v,this.v),o=is(void 0!==s.t0?s.t0:this.t0,this.t0);return e=>{s.a=r(e),s.z=a(e),s.v=n(e),s.t0=o(e);const i=t.alignDistribution(s.a,s.z,s.v,s.t0);return t.densityLine(i)}});const It=O.selectAll(".rt").data(this.data.trials),ft=It.enter().append("g");ft.append("line").classed("mark",!0).attr("x1",t=>B(t.rt)).attr("x2",t=>B(t.rt)).attr("y1",t=>"correct"===t.outcome?y(1)-.125*this.rem:y(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?y(1)-.675*this.rem:y(-1)+.675*this.rem);const Ct=ft.merge(It).attr("class",t=>`rt ${t.outcome}`);Ct.filter(t=>!t.animate).select(".mark").transition().duration(this.drag?0:Q).ease(rr).attr("stroke",t=>this.getComputedStyleValue(`---color-${t.outcome}`)).attr("x1",t=>B(t.rt)).attr("x2",t=>B(t.rt)).attr("y1",t=>"correct"===t.outcome?y(1)-.125*this.rem:y(-1)+.125*this.rem).attr("y2",t=>"correct"===t.outcome?y(1)-.675*this.rem:y(-1)+.675*this.rem),It.exit().remove();const vt=q.selectAll(".accuracy.model").data([this.model.accuracy,1-this.model.accuracy]),At=vt.enter().append("g").attr("class",(t,e)=>"accuracy model "+(0===e?"correct":"error"));At.append("rect").classed("bar",!0).attr("x",0),At.merge(vt).select("rect").transition().duration(this.drag?0:Q).ease(rr).attr("y",(t,e)=>I(0===e?0:1-t)).attr("width",b).attr("height",t=>I(t)),vt.exit().remove();const xt=q.selectAll(".accuracy.data").data(Number.isNaN(this.data.accuracy)?[]:[this.data.accuracy]),Et=xt.enter().append("g").classed("accuracy data",!0);Et.append("line").classed("mark",!0);const Nt=Et.merge(xt).attr("class",t=>"accuracy data "+(t<this.model.accuracy.correct?"correct":"error"));Nt.select(".mark").transition().duration(this.drag?0:Q).ease(rr).attr("x1",0+.25*this.rem).attr("x2",b-.25*this.rem).attr("y1",t=>I(t)-1).attr("y2",t=>I(t)-1),xt.exit().remove();const Lt=tt.selectAll(".boundary").data([{bound:"upper",value:this.bounds.upper},{bound:"lower",value:this.bounds.lower}]),wt=Lt.enter().append("g").attr("class",(t,e)=>"boundary "+(0===e?"correct":"error"));wt.append("line").classed("line",!0),wt.append("line").classed("line touch",!0);const Dt=wt.merge(Lt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?(t,e)=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{a:i}=this;switch(t.key){case"ArrowUp":i+="upper"===e.bound?t.shiftKey?sa.a.STEP:sa.a.JUMP:t.shiftKey?-.01:-.1;break;case"ArrowDown":i+="upper"===e.bound?t.shiftKey?-.01:-.1:t.shiftKey?sa.a.STEP:sa.a.JUMP}i=i<sa.a.MIN?sa.a.MIN:i>sa.a.MAX?sa.a.MAX:i,this.a=i,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-a",{detail:{a:this.a},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Dt.call(v):Dt.on(".drag",null)),Dt.select(".line").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(this.scale.time.min)).attr("x2",B(this.scale.time.max)).attr("y1",t=>y(t.value)).attr("y2",t=>y(t.value)),Dt.select(".line.touch").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(this.scale.time.min)).attr("x2",B(this.scale.time.max)).attr("y1",t=>y(t.value)).attr("y2",t=>y(t.value)),Lt.exit().remove();const Mt=tt.selectAll(".drift").data([{v:this.v,t0:this.t0,startingPoint:this.startingPoint}]),kt=Mt.enter().append("g").classed("drift",!0);kt.append("line").classed("line",!0),kt.append("line").classed("line touch",!0),kt.append("path").classed("arrow",!0),kt.append("path").classed("arrow touch",!0);const Tt=kt.merge(Mt).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{v:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?sa.v.STEP:sa.v.JUMP;break;case"ArrowDown":e-=t.shiftKey?sa.v.STEP:sa.v.JUMP}e=e<sa.v.MIN?sa.v.MIN:e>sa.v.MAX?sa.v.MAX:e,this.v=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-v",{detail:{v:this.v},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Tt.call(C):Tt.on(".drag",null));const Vt=(y(0)-y(1))/(B(1)-B(0));Tt.transition().duration(this.drag?0:Q).ease(rr).attr("transform",t=>`translate(${B(t.t0)}, ${y(t.startingPoint)})\n rotate(${-Math.atan(t.v/1e3*Vt)*(180/Math.PI)})`),Tt.select(".line").attr("x2",B(200)),Tt.select(".line.touch").attr("x2",B(200)),Tt.select(".arrow").attr("d",`\n M ${B(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Tt.select(".arrow.touch").attr("d",`\n M ${B(200)-.5*this.rem},${.5*-this.rem}\n l ${.5*this.rem},${.5*this.rem}\n l ${.5*-this.rem},${.5*this.rem}\n `),Mt.exit().remove();const Ht=tt.selectAll(".t0z").data([{t0:this.t0,startingPoint:this.startingPoint}]),$t=Ht.enter().append("g").classed("t0z",!0);$t.append("line").classed("line",!0),$t.append("line").classed("line touch",!0),$t.append("circle").classed("point touch",!0);const zt=$t.merge(Ht).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let{z:e}=this;switch(t.key){case"ArrowUp":e+=t.shiftKey?sa.z.STEP:sa.z.JUMP;break;case"ArrowDown":e-=t.shiftKey?sa.z.STEP:sa.z.JUMP}e=e<sa.z.MIN?sa.z.MIN:e>sa.z.MAX?sa.z.MAX:e,this.z=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-z",{detail:{z:this.z},bubbles:!0})),t.preventDefault()}if(["ArrowLeft","ArrowRight"].includes(t.key)){let e=this.t0;switch(t.key){case"ArrowRight":e+=t.shiftKey?sa.t0.STEP:sa.t0.JUMP;break;case"ArrowLeft":e-=t.shiftKey?sa.t0.STEP:sa.t0.JUMP}e=e<sa.t0.MIN?sa.t0.MIN:e>sa.t0.MAX?sa.t0.MAX:e,this.t0=e,this.alignState(),this.dispatchEvent(new CustomEvent("ddm-model-t0",{detail:{t0:this.t0},bubbles:!0})),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?zt.call(f):zt.on(".drag",null)),zt.select(".line").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(0)).attr("x2",t=>B(t.t0)).attr("y1",t=>y(t.startingPoint)).attr("y2",t=>y(t.startingPoint)),zt.select(".line.touch").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(0)).attr("x2",t=>B(t.t0)).attr("y1",t=>y(t.startingPoint)).attr("y2",t=>y(t.startingPoint)),zt.select(".point").transition().duration(this.drag?0:Q).ease(rr).attr("cx",t=>B(t.t0)).attr("cy",t=>y(t.startingPoint)),Ht.exit().remove();const Gt=tt.selectAll(".measure.a").data(this.measures?[this.a]:[]),Yt=Gt.enter().append("g").classed("measure a",!0);Yt.append("line").classed("line",!0),Yt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-a)").attr("marker-end","url(#measure-arrow-a)");const Xt=Yt.append("text").classed("label",!0);Xt.append("tspan").classed("a math-var",!0).text("a"),Xt.append("tspan").classed("equals",!0).text(" = "),Xt.append("tspan").classed("value",!0);const Jt=Math.abs(y(this.bounds.upper)-y(this.bounds.lower))<=4,Wt=Yt.merge(Gt);Wt.select(".line").classed("short",Jt).transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(this.scale.time.max)-.75*this.rem).attr("y1",y(this.bounds.upper)+2).attr("x2",B(this.scale.time.max)-.75*this.rem).attr("y2",y(this.bounds.lower)-2),Wt.select(".markers").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(this.scale.time.max)-.75*this.rem).attr("y1",y(this.bounds.upper)).attr("x2",B(this.scale.time.max)-.75*this.rem).attr("y2",y(this.bounds.lower));Wt.select(".label").transition().duration(this.drag?0:Q).ease(rr).attr("x",B(this.scale.time.max)).attr("y",y(this.bounds.upper)-.25*this.rem).select(".value").text(fr(".2f")(this.a)),Gt.exit().remove();const _t=tt.selectAll(".measure.z").data(this.measures?[this.z]:[]),Kt=_t.enter().append("g").classed("measure z",!0);Kt.append("line").classed("line",!0),Kt.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-z)").attr("marker-end","url(#measure-arrow-z)");const Zt=Kt.append("text").classed("label",!0);Zt.append("tspan").classed("z math-var",!0).text("z"),Zt.append("tspan").classed("equals",!0).text(" = "),Zt.append("tspan").classed("value",!0);const Pt=Math.abs(y(this.startingPoint)-y(this.bounds.lower))<=4,Ot=Kt.merge(_t);Ot.select(".line").classed("short",Pt).transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(this.scale.time.min)+.75*this.rem).attr("y1",y(this.startingPoint)+2).attr("x2",B(this.scale.time.min)+.75*this.rem).attr("y2",y(this.bounds.lower)-2),Ot.select(".markers").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(this.scale.time.min)+.75*this.rem).attr("y1",y(this.startingPoint)).attr("x2",B(this.scale.time.min)+.75*this.rem).attr("y2",y(this.bounds.lower));Ot.select(".label").transition().duration(this.drag?0:Q).ease(rr).attr("x",B(this.scale.time.min)).attr("y",y(this.bounds.lower)+.125*this.rem).select(".value").text(fr(".0%")(this.z)),_t.exit().remove();const jt=tt.selectAll(".measure.v").data(this.measures?[this.v]:[]),qt=jt.enter().append("g").classed("measure v",!0);qt.append("path").classed("line",!0),qt.append("path").classed("markers",!0).attr("marker-start","url(#measure-capped-arrow-v)").attr("marker-end","url(#measure-capped-arrow-v)");const te=qt.append("text").classed("label",!0);te.append("tspan").classed("v math-var",!0).text("v"),te.append("tspan").classed("equals",!0).text(" = "),te.append("tspan").classed("value",!0);const ee=B(200)-B(0)+.75*this.rem,ie=Math.atan(this.v/1e3*Vt),se=Math.cos(ie)*ee,re=Math.sin(ie)*ee,ae=2/ee,ne=Math.atan(this.v/1e3*Vt)-ae,oe=Math.cos(ae)*ee,le=Math.sin(ae)*ee,ce=Math.cos(ne)*ee,de=Math.sin(ne)*ee,ue=ne*ee<=4,he=qt.merge(jt);he.select(".line").classed("short",ue).transition().duration(this.drag?0:Q).ease(rr).attr("d",`\n M ${B(this.t0)+oe}, ${y(this.startingPoint)-le}\n A ${B(200)-B(0)+.75*this.rem} ${B(200)-B(0)+.75*this.rem} 0 0 0 ${B(this.t0)+ce} ${y(this.startingPoint)-de}\n `),he.select(".markers").transition().duration(this.drag?0:Q).ease(rr).attr("d",`\n M ${B(this.t0+200)+.75*this.rem}, ${y(this.startingPoint)}\n A ${B(200)-B(0)+.75*this.rem} ${B(200)-B(0)+.75*this.rem} 0 0 0 ${B(this.t0)+se} ${y(this.startingPoint)-re}\n `);he.select(".label").transition().duration(this.drag?0:Q).ease(rr).attr("x",B(this.t0+200)+.5*this.rem).attr("y",y(this.bounds.upper)-.25*this.rem).select(".value").text(fr(".2f")(this.v)),jt.exit().remove();const ge=tt.selectAll(".measure.t0").data(this.measures?[this.t0]:[]),pe=ge.enter().append("g").classed("measure t0",!0);pe.append("line").classed("line",!0),pe.append("line").classed("markers",!0).attr("marker-start","url(#measure-arrow-t0)").attr("marker-end","url(#measure-capped-arrow-t0)");const me=pe.append("text").classed("label",!0);me.append("tspan").classed("t0 math-var",!0).text("t₀"),me.append("tspan").classed("equals",!0).text(" = "),me.append("tspan").classed("value",!0);const be=Math.abs(B(0)-B(this.t0))<=4,Qe=pe.merge(ge);Qe.select(".line").classed("short",be).transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(0)+2).attr("y1",y(this.startingPoint)-.75*this.rem).attr("x2",B(this.t0)-2).attr("y2",y(this.startingPoint)-.75*this.rem),Qe.select(".markers").transition().duration(this.drag?0:Q).ease(rr).attr("x1",B(0)).attr("y1",y(this.startingPoint)-.75*this.rem).attr("x2",B(this.t0)).attr("y2",y(this.startingPoint)-.75*this.rem);Qe.select(".label").transition().duration(this.drag?0:Q).ease(rr).attr("x",B(this.t0)+.25*this.rem).attr("y",y(this.bounds.upper)-.25*this.rem).select(".value").text(fr("d")(this.t0)),ge.exit().remove();const Be=et.selectAll(".model.mean").data(t=>this.means?[t]:[]),ye=Be.enter().append("g").attr("class",t=>`model mean ${t.outcome}`);ye.append("line").classed("indicator",!0);ye.merge(Be).select(".indicator").transition().duration(this.drag?0:Q).ease(rr).attr("x1",t=>B(t.model.meanRT)).attr("x2",t=>B(t.model.meanRT)).attr("y1",t=>t.densityScale(this.scale.density.min)).attr("y2",t=>t.densityScale(this.scale.density.max)),Be.exit().remove();const Ue=et.selectAll(".data.mean").data(t=>this.means&&!Number.isNaN(t.data.meanRT)?[t]:[]),Fe=Ue.enter().append("g").attr("class",t=>`data mean ${t.outcome}`);Fe.append("line").classed("indicator",!0).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem);Fe.merge(Ue).select(".indicator").transition().duration(this.drag?0:Q).ease(rr).attr("x1",t=>B(t.data.meanRT)).attr("x2",t=>B(t.data.meanRT)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.125:-.125)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.675:-.675)*this.rem),Ue.exit().select(".indicator").transition().duration(this.drag?0:Q).ease(rr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{Ke(i[e].parentElement).remove()});const Ie=et.selectAll(".model.sd").data(t=>this.sds?[t]:[]),fe=Ie.enter().append("g").attr("class",t=>`model sd ${t.outcome}`);fe.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#model-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#model-sd-cap-${t.outcome})`);fe.merge(Ie).select(".indicator").transition().duration(this.drag?0:Q).ease(rr).attr("x1",t=>B(t.model.meanRT-t.model.sdRT/2)).attr("x2",t=>B(t.model.meanRT+t.model.sdRT/2)).attr("y1",t=>t.densityScale(5)).attr("y2",t=>t.densityScale(5)),Ie.exit().remove();const Ce=et.selectAll(".data.sd").data(t=>!this.sds||Number.isNaN(t.data.meanRT)||Number.isNaN(t.data.sdRT)?[]:[t]),ve=Ce.enter().append("g").attr("class",t=>`data sd ${t.outcome}`);ve.append("line").classed("indicator",!0).attr("marker-start",t=>`url(#data-sd-cap-${t.outcome})`).attr("marker-end",t=>`url(#data-sd-cap-${t.outcome})`).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem);ve.merge(Ce).select(".indicator").transition().duration(this.drag?0:Q).ease(rr).attr("x1",t=>B(t.data.meanRT-t.data.sdRT/2)).attr("x2",t=>B(t.data.meanRT+t.data.sdRT/2)).attr("y1",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem).attr("y2",t=>t.densityScale(0)+("correct"===t.outcome?.375:-.375)*this.rem),Ce.exit().select(".indicator").transition().duration(this.drag?0:Q).ease(rr).attr("x1",0).attr("x2",0).on("end",(t,e,i)=>{Ke(i[e].parentElement).remove()}),this.firstUpdate=!1}}customElements.define("ddm-model",ua);class ha extends(qr(ea)){static get properties(){return{coherence:{attribute:"coherence",type:Number,reflect:!0},count:{attribute:"count",type:Number,reflect:!0},probability:{attribute:"probability",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},wait:{attribute:"wait",type:Number,reflect:!0},iti:{attribute:"iti",type:Number,reflect:!0},trials:{attribute:"trials",type:Number,reflect:!0},running:{attribute:"running",type:Boolean,reflect:!0},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.coherence=.5,this.count=100,this.probability=.5,this.duration=2e3,this.wait=2e3,this.iti=2e3,this.trials=5,this.running=!1,this.lifetime=400,this.speed=50,this.firstUpdate=!0,this.COHERENT=0,this.RANDOM=1,this.dots=[[],[]],this.trial=0,this.states=["resetted","iti","stimulus","wait","ended"],this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.LEFT=180,this.RIGHT=0,this.currentDirection=void 0,this.signals=["left","right"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,o`
1778
1753
  :host {
1779
1754
  display: inline-block;
1780
1755
 
@@ -1819,7 +1794,7 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1819
1794
  font-size: 1.75rem;
1820
1795
  font-weight: 600;
1821
1796
  }
1822
- `]}render(){return X``}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,i=this.height,s=Math.min(e,i),r=.25*this.rem,a=.25*this.rem,n=.25*this.rem,o=s-(r+a),l=s-(n+.25*this.rem);this.xScale=Yr().domain([-1,1]).range([0,l]),this.yScale=Yr().domain([1,-1]).range([0,o]);const c=Ke(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),d=c.enter().append("svg").classed("main",!0),h=d.merge(c).attr("viewBox",`0 0 ${s} ${s}`);d.append("clipPath").attr("id","clip-rdk-task").append("circle"),h.select("clipPath circle").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0));const u=d.append("g").classed("plot",!0),g=h.select(".plot").attr("transform",`translate(${n}, ${r})`),p=u.append("g").classed("underlayer",!0),m=g.select(".underlayer");p.append("circle").classed("background",!0),m.select(".background").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0)),u.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");g.select(".content").selectAll(".dots").data([[],[]]).enter().append("g").classed("dots",!0).classed("coherent",(t,e)=>e===this.COHERENT).classed("random",(t,e)=>e===this.RANDOM);const b=u.append("g").classed("overlayer",!0),y=g.select(".overlayer");b.append("circle").classed("outline",!0),y.select(".outline").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.yScale(0)),(this.firstUpdate||t.has("running"))&&(this.running?(this.pauseTime&&(this.baseTime+=Fs()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,i){var s=new fs,r=e;return s._restart=s.restart,s.restart=function(t,e,i){e=+e,i=null==i?Fs():+i,s._restart(function a(n){n+=r,s._restart(a,r+=e,i),t(n)},e,i)},s.restart(t,e,i),s}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=Fs())),this.firstUpdate=!1}reset(){void 0!==this.runner&&this.runner.stop(),this.running=!1,this.trial=0,this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0;const t=Ke(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data(t=>t);t.exit().remove();Ke(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();Ke(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=Fs(),e=this.baseTime?t-this.baseTime:0,i=this.baseTime?e-this.startTime:0,s=this.baseTime?e-this.lastTime:0;this.lastTime=e;let r=!1;if("resetted"===this.state?(this.state="iti",this.baseTime=t,this.startTime=0,this.dispatchEvent(new CustomEvent("rdk-block-start",{detail:{trials:this.trials},bubbles:!0}))):"iti"===this.state&&i>=this.iti?(r=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"left":"right",this.currentDirection="left"===this.signal?this.LEFT:this.RIGHT,this.dispatchEvent(new CustomEvent("rdk-trial-start",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"stimulus"===this.state&&i>=this.duration?(this.state="wait",this.startTime=e,this.dispatchEvent(new CustomEvent("rdk-trial-middle",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"wait"===this.state&&i>=this.wait&&(this.dispatchEvent(new CustomEvent("rdk-trial-end",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0})),this.trial>=this.trials?(this.runner.stop(),this.running=!1,this.state="ended",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0,this.dispatchEvent(new CustomEvent("rdk-block-end",{detail:{trials:this.trial},bubbles:!0}))):(this.state="iti",this.startTime=e)),"stimulus"===this.state){this.dots[this.COHERENT].length=Math.round(this.count*this.coherence),this.dots[this.RANDOM].length=this.count-this.dots[this.COHERENT].length;for(let t=0;t<this.dots.length;t+=1)for(let i=0;i<this.dots[t].length;i+=1){const a=void 0===this.dots[t][i];a&&(this.dots[t][i]={});const n=this.dots[t][i];if(r||a){n.direction=t===this.RANDOM?360*Math.random():this.currentDirection,n.birth=e-Math.floor(Math.random()*this.lifetime);const i=2*Math.random()*Math.PI,s=Math.sqrt(Math.random());n.x=this.xScale(s*Math.cos(i)),n.y=this.yScale(s*Math.sin(i))}else if(e>n.birth+this.lifetime){n.birth+=this.lifetime,n.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,i=Math.sqrt(Math.random());n.x=this.xScale(i*Math.cos(e)),n.y=this.yScale(i*Math.sin(e))}else{t===this.COHERENT&&(n.direction=this.currentDirection);const e=n.direction*(Math.PI/180);n.dx=this.speed*(s/1e3)*Math.cos(e),n.dy=this.speed*(s/1e3)*Math.sin(e),n.x+=n.dx,n.y+=n.dy;(n.x-this.xScale(0))**2+(n.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(n.x=-(n.x-this.xScale(0))+this.xScale(0),n.y=-(n.y-this.yScale(0))+this.yScale(0))}}}const a=Ke(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),n=a.enter().append("g").classed("fixation",!0);n.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),n.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),a.exit().remove();const o=Ke(this.renderRoot).select(".content").selectAll(".dots").data("stimulus"===this.state?this.dots:[[],[]]).selectAll(".dot").data(t=>t);o.enter().append("circle").classed("dot",!0).merge(o).attr("cx",t=>t.x).attr("cy",t=>t.y),o.exit().remove();const l=Ke(this.renderRoot).select(".content").selectAll(".query").data("wait"===this.state?[!0]:[]);l.enter().append("g").classed("query",!0).append("text").attr("x",this.xScale(0)).attr("y",this.xScale(0)).attr("text-anchor","middle").attr("alignment-baseline","middle").text("?"),l.exit().remove()}}customElements.define("rdk-2afc-task",ua);class ga extends ea{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,o`
1797
+ `]}render(){return X``}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,i=this.height,s=Math.min(e,i),r=.25*this.rem,a=.25*this.rem,n=.25*this.rem,o=s-(r+a),l=s-(n+.25*this.rem);this.xScale=Yr().domain([-1,1]).range([0,l]),this.yScale=Yr().domain([1,-1]).range([0,o]);const c=Ke(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),d=c.enter().append("svg").classed("main",!0),u=d.merge(c).attr("viewBox",`0 0 ${s} ${s}`);d.append("clipPath").attr("id","clip-rdk-task").append("circle"),u.select("clipPath circle").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0));const h=d.append("g").classed("plot",!0),g=u.select(".plot").attr("transform",`translate(${n}, ${r})`),p=h.append("g").classed("underlayer",!0),m=g.select(".underlayer");p.append("circle").classed("background",!0),m.select(".background").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.xScale(0)),h.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");g.select(".content").selectAll(".dots").data([[],[]]).enter().append("g").classed("dots",!0).classed("coherent",(t,e)=>e===this.COHERENT).classed("random",(t,e)=>e===this.RANDOM);const b=h.append("g").classed("overlayer",!0),Q=g.select(".overlayer");b.append("circle").classed("outline",!0),Q.select(".outline").attr("cx",this.xScale(0)).attr("cy",this.yScale(0)).attr("r",this.xScale(1)-this.yScale(0)),(this.firstUpdate||t.has("running"))&&(this.running?(this.pauseTime&&(this.baseTime+=Fs()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,i){var s=new fs,r=e;return s._restart=s.restart,s.restart=function(t,e,i){e=+e,i=null==i?Fs():+i,s._restart(function a(n){n+=r,s._restart(a,r+=e,i),t(n)},e,i)},s.restart(t,e,i),s}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=Fs())),this.firstUpdate=!1}reset(){void 0!==this.runner&&this.runner.stop(),this.running=!1,this.trial=0,this.state="resetted",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0;const t=Ke(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data(t=>t);t.exit().remove();Ke(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();Ke(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=Fs(),e=this.baseTime?t-this.baseTime:0,i=this.baseTime?e-this.startTime:0,s=this.baseTime?e-this.lastTime:0;this.lastTime=e;let r=!1;if("resetted"===this.state?(this.state="iti",this.baseTime=t,this.startTime=0,this.dispatchEvent(new CustomEvent("rdk-block-start",{detail:{trials:this.trials},bubbles:!0}))):"iti"===this.state&&i>=this.iti?(r=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"left":"right",this.currentDirection="left"===this.signal?this.LEFT:this.RIGHT,this.dispatchEvent(new CustomEvent("rdk-trial-start",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"stimulus"===this.state&&i>=this.duration?(this.state="wait",this.startTime=e,this.dispatchEvent(new CustomEvent("rdk-trial-middle",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0}))):"wait"===this.state&&i>=this.wait&&(this.dispatchEvent(new CustomEvent("rdk-trial-end",{detail:{trials:this.trials,duration:this.duration,wait:this.wait,iti:this.iti,trial:this.trial,signal:this.signal},bubbles:!0})),this.trial>=this.trials?(this.runner.stop(),this.running=!1,this.state="ended",this.baseTime=0,this.pauseTime=0,this.startTime=0,this.lastTime=0,this.signal=void 0,this.currentDirection=void 0,this.dispatchEvent(new CustomEvent("rdk-block-end",{detail:{trials:this.trial},bubbles:!0}))):(this.state="iti",this.startTime=e)),"stimulus"===this.state){this.dots[this.COHERENT].length=Math.round(this.count*this.coherence),this.dots[this.RANDOM].length=this.count-this.dots[this.COHERENT].length;for(let t=0;t<this.dots.length;t+=1)for(let i=0;i<this.dots[t].length;i+=1){const a=void 0===this.dots[t][i];a&&(this.dots[t][i]={});const n=this.dots[t][i];if(r||a){n.direction=t===this.RANDOM?360*Math.random():this.currentDirection,n.birth=e-Math.floor(Math.random()*this.lifetime);const i=2*Math.random()*Math.PI,s=Math.sqrt(Math.random());n.x=this.xScale(s*Math.cos(i)),n.y=this.yScale(s*Math.sin(i))}else if(e>n.birth+this.lifetime){n.birth+=this.lifetime,n.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,i=Math.sqrt(Math.random());n.x=this.xScale(i*Math.cos(e)),n.y=this.yScale(i*Math.sin(e))}else{t===this.COHERENT&&(n.direction=this.currentDirection);const e=n.direction*(Math.PI/180);n.dx=this.speed*(s/1e3)*Math.cos(e),n.dy=this.speed*(s/1e3)*Math.sin(e),n.x+=n.dx,n.y+=n.dy;(n.x-this.xScale(0))**2+(n.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(n.x=-(n.x-this.xScale(0))+this.xScale(0),n.y=-(n.y-this.yScale(0))+this.yScale(0))}}}const a=Ke(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),n=a.enter().append("g").classed("fixation",!0);n.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),n.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),a.exit().remove();const o=Ke(this.renderRoot).select(".content").selectAll(".dots").data("stimulus"===this.state?this.dots:[[],[]]).selectAll(".dot").data(t=>t);o.enter().append("circle").classed("dot",!0).merge(o).attr("cx",t=>t.x).attr("cy",t=>t.y),o.exit().remove();const l=Ke(this.renderRoot).select(".content").selectAll(".query").data("wait"===this.state?[!0]:[]);l.enter().append("g").classed("query",!0).append("text").attr("x",this.xScale(0)).attr("y",this.xScale(0)).attr("text-anchor","middle").attr("alignment-baseline","middle").text("?"),l.exit().remove()}}customElements.define("rdk-2afc-task",ha);class ga extends ea{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,o`
1823
1798
  :host {
1824
1799
  display: block;
1825
1800
 
@@ -1880,11 +1855,13 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
1880
1855
 
1881
1856
  .addend {
1882
1857
  position: relative;
1858
+
1883
1859
  display: inline-block;
1884
1860
  }
1885
1861
 
1886
1862
  .comparison {
1887
1863
  position: relative;
1864
+
1888
1865
  display: inline-block;
1889
1866
 
1890
1867
  font-size: 125%;
@@ -2180,5 +2157,5 @@ const jr=t=>t??_;customElements.define("decidables-slider",class extends Or{stat
2180
2157
  <div class="body">
2181
2158
  <slot>Empty!</slot>
2182
2159
  </div>
2183
- </div>`}}customElements.define("ddm-example",ba);class ya extends ba{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:!1,type:Number,reflect:!1},z:{attribute:!1,type:Number,reflect:!1},v:{attribute:!1,type:Number,reflect:!1},t0:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.accumulableResponse=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.ddmFit=null,this.data=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.ddmFit=this.querySelector("ddm-fit"),this.ddmModel.clear(),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0)}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1)}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable&&(this.accumulableTable.correctCount=NaN,this.accumulableTable.errorCount=NaN,this.accumulableTable.nrCount=NaN,this.accumulableTable.accuracy=NaN,this.accumulableTable.correctMeanRT=NaN,this.accumulableTable.errorMeanRT=NaN,this.accumulableTable.meanRT=NaN,this.accumulableTable.correctSDRT=NaN,this.accumulableTable.errorSDRT=NaN,this.accumulableTable.sdRT=NaN),this.ddmModel&&this.ddmModel.clear(),this.ddmFit&&this.ddmFit.clear()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",t=>{this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial)}),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",()=>{this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()}),this.accumulableResponse&&this.accumulableResponse.addEventListener("accumulable-response",t=>{this.data=t.detail.data,this.ddmModel&&this.ddmModel.trial({index:t.detail.trial,rt:t.detail.rt,outcome:t.detail.outcome}),this.ddmFit&&this.ddmFit.set({accuracy:t.detail.data.accuracy,correctMeanRT:t.detail.data.correctMeanRT,errorMeanRT:t.detail.data.errorMeanRT,meanRT:t.detail.data.meanRT,correctSDRT:t.detail.data.correctSDRT,errorSDRT:t.detail.data.errorSDRT,sdRT:t.detail.data.sdRT}),this.requestUpdate()}),this.ddmFit&&this.ddmFit.addEventListener("ddm-fit-update",t=>{this.a=t.detail.a,this.z=.5,this.v=t.detail.v,this.t0=t.detail.t0})}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration,this.rdkTask.iti=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-human",ya);class Qa extends ba{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.accumulableControl=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-resample",()=>{this.ddmModel?.resample(),this.requestUpdate()}),this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trials,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0)}}customElements.define("ddm-example-interactive",Qa);class Ba extends ba{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.ddmParameters=null,this.ddmModel=null,this.accumulableResponse=null,this.accumulableTable=null,this.trialCount=0,this.signals=["left","right"],this.signal=void 0,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0),this.ddmModel&&this.ddmModel.resumeTrial()}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1),this.ddmModel&&this.ddmModel.pauseTrial()}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.trialCount=0,this.signal=void 0,this.rdkTask&&this.rdkTask.reset(),this.ddmModel&&(this.ddmModel.trials=this.trialCount),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable})),this.rdkTask&&(this.rdkTask.addEventListener("rdk-trial-start",t=>{this.signal=t.detail.signal,this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial),this.ddmModel&&(this.trialCount+=1,this.ddmModel.trial())}),this.rdkTask.addEventListener("rdk-trial-end",()=>{this.signal=void 0,this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()}),this.ddmModel.addEventListener("accumulable-response",t=>{if(this.accumulableResponse){const e="correct"===t.detail.outcome?this.signal:"left"===this.signal?"right":"left";this.accumulableResponse.responded(e)}this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.trialCount>this.trials&&(this.trialCount=this.trials),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trialCount,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-model",Ba),t.AccumulableControl=ia,t.AccumulableElement=ea,t.AccumulableResponse=ra,t.AccumulableTable=aa,t.DDMEquationAZV2PC=pa,t.DDMEquationAZVT02M=ma,t.DDMExampleHuman=ya,t.DDMExampleInteractive=Qa,t.DDMExampleModel=Ba,t.DDMFit=ca,t.DDMModel=ha,t.DDMParameters=da,t.RDK2AFCTask=ua});
2160
+ </div>`}}customElements.define("ddm-example",ba);class Qa extends ba{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:!1,type:Number,reflect:!1},z:{attribute:!1,type:Number,reflect:!1},v:{attribute:!1,type:Number,reflect:!1},t0:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.accumulableResponse=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.ddmFit=null,this.data=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.ddmFit=this.querySelector("ddm-fit"),this.ddmModel.clear(),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-coherence",t=>{this.coherence=t.detail.coherence}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0)}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1)}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.rdkTask&&this.rdkTask.reset(),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable&&(this.accumulableTable.correctCount=NaN,this.accumulableTable.errorCount=NaN,this.accumulableTable.nrCount=NaN,this.accumulableTable.accuracy=NaN,this.accumulableTable.correctMeanRT=NaN,this.accumulableTable.errorMeanRT=NaN,this.accumulableTable.meanRT=NaN,this.accumulableTable.correctSDRT=NaN,this.accumulableTable.errorSDRT=NaN,this.accumulableTable.sdRT=NaN),this.ddmModel&&this.ddmModel.clear(),this.ddmFit&&this.ddmFit.clear()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",t=>{this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial)}),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",()=>{this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()}),this.accumulableResponse&&this.accumulableResponse.addEventListener("accumulable-response",t=>{this.data=t.detail.data,this.ddmModel&&this.ddmModel.trial({index:t.detail.trial,rt:t.detail.rt,outcome:t.detail.outcome}),this.ddmFit&&this.ddmFit.set({accuracy:t.detail.data.accuracy,correctMeanRT:t.detail.data.correctMeanRT,errorMeanRT:t.detail.data.errorMeanRT,meanRT:t.detail.data.meanRT,correctSDRT:t.detail.data.correctSDRT,errorSDRT:t.detail.data.errorSDRT,sdRT:t.detail.data.sdRT}),this.requestUpdate()}),this.ddmFit&&this.ddmFit.addEventListener("ddm-fit-update",t=>{this.a=t.detail.a,this.z=.5,this.v=t.detail.v,this.t0=t.detail.t0})}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.wait=this.duration,this.rdkTask.iti=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-human",Qa);class Ba extends ba{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.accumulableControl=null,this.accumulableTable=null,this.ddmParameters=null,this.ddmModel=null,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.accumulableTable=this.querySelector("accumulable-table"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-resample",()=>{this.ddmModel?.resample(),this.requestUpdate()}),this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trials,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0)}}customElements.define("ddm-example-interactive",Ba);class ya extends ba{static get properties(){return{trials:{attribute:"trials",type:Number,reflect:!0},duration:{attribute:"duration",type:Number,reflect:!0},coherence:{attribute:"coherence",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},a:{attribute:"boundary-separation",type:Number,reflect:!0},z:{attribute:"starting-point",type:Number,reflect:!0},v:{attribute:"drift-rate",type:Number,reflect:!0},t0:{attribute:"nondecision-time",type:Number,reflect:!0}}}constructor(){super(),this.trials=10,this.duration=2e3,this.coherence=.5,this.colors=["none","measure","outcome","all"],this.color="outcome",this.a=sa.a.DEFAULT,this.z=sa.z.DEFAULT,this.v=sa.v.DEFAULT,this.t0=sa.t0.DEFAULT,this.accumulableControl=null,this.rdkTask=null,this.ddmParameters=null,this.ddmModel=null,this.accumulableResponse=null,this.accumulableTable=null,this.trialCount=0,this.signals=["left","right"],this.signal=void 0,this.data=void 0,this.model=void 0}connectedCallback(){super.connectedCallback(),this.accumulableControl=this.querySelector("accumulable-control"),this.rdkTask=this.querySelector("rdk-2afc-task"),this.ddmParameters=this.querySelector("ddm-parameters"),this.ddmModel=this.querySelector("ddm-model"),this.accumulableResponse=this.querySelector("accumulable-response"),this.accumulableTable=this.querySelector("accumulable-table"),this.accumulableControl&&(this.accumulableControl.addEventListener("accumulable-control-trials",t=>{this.trials=t.detail.trials}),this.accumulableControl.addEventListener("accumulable-control-duration",t=>{this.duration=t.detail.duration}),this.accumulableControl.addEventListener("accumulable-control-color",t=>{this.color=t.detail.color}),this.accumulableControl.addEventListener("accumulable-control-run",()=>{this.rdkTask&&(this.rdkTask.running=!0),this.ddmModel&&this.ddmModel.resumeTrial()}),this.accumulableControl.addEventListener("accumulable-control-pause",()=>{this.rdkTask&&(this.rdkTask.running=!1),this.ddmModel&&this.ddmModel.pauseTrial()}),this.accumulableControl.addEventListener("accumulable-control-reset",()=>{this.trialCount=0,this.signal=void 0,this.rdkTask&&this.rdkTask.reset(),this.ddmModel&&(this.ddmModel.trials=this.trialCount),this.accumulableResponse&&this.accumulableResponse.reset(),this.accumulableTable})),this.rdkTask&&(this.rdkTask.addEventListener("rdk-trial-start",t=>{this.signal=t.detail.signal,this.accumulableResponse&&this.accumulableResponse.start(t.detail.signal,t.detail.trial),this.ddmModel&&(this.trialCount+=1,this.ddmModel.trial())}),this.rdkTask.addEventListener("rdk-trial-end",()=>{this.signal=void 0,this.accumulableResponse&&this.accumulableResponse.stop()}),this.rdkTask.addEventListener("rdk-block-end",()=>{this.accumulableControl&&this.accumulableControl.complete()})),this.ddmParameters&&(this.ddmParameters.addEventListener("ddm-parameters-a",t=>{this.a=t.detail.a}),this.ddmParameters.addEventListener("ddm-parameters-z",t=>{this.z=t.detail.z}),this.ddmParameters.addEventListener("ddm-parameters-v",t=>{this.v=t.detail.v}),this.ddmParameters.addEventListener("ddm-parameters-t0",t=>{this.t0=t.detail.t0})),this.ddmModel&&(this.ddmModel.addEventListener("ddm-model-a",t=>{this.a=t.detail.a}),this.ddmModel.addEventListener("ddm-model-z",t=>{this.z=t.detail.z}),this.ddmModel.addEventListener("ddm-model-v",t=>{this.v=t.detail.v}),this.ddmModel.addEventListener("ddm-model-t0",t=>{this.t0=t.detail.t0}),this.ddmModel.addEventListener("ddm-model-output",t=>{this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()}),this.ddmModel.addEventListener("accumulable-response",t=>{if(this.accumulableResponse){const e="correct"===t.detail.outcome?this.signal:"left"===this.signal?"right":"left";this.accumulableResponse.responded(e)}this.data=t.detail.data,this.model=t.detail.model,this.requestUpdate()})),this.requestUpdate()}update(t){super.update(t),this.trialCount>this.trials&&(this.trialCount=this.trials),this.accumulableControl&&(this.accumulableControl.trials=null!=this.accumulableControl.trials?this.trials:void 0,this.accumulableControl.duration=null!=this.accumulableControl.duration?this.duration:void 0,this.accumulableControl.coherence=null!=this.accumulableControl.coherence?this.coherence:void 0,this.accumulableControl.color=null!=this.accumulableControl.color?this.color:void 0),this.rdkTask&&(this.rdkTask.trials=this.trials,this.rdkTask.duration=this.duration,this.rdkTask.coherence=this.coherence),this.ddmParameters&&(this.ddmParameters.a=null!=this.ddmParameters.a?this.a:void 0,this.ddmParameters.z=null!=this.ddmParameters.z?this.z:void 0,this.ddmParameters.v=null!=this.ddmParameters.a?this.v:void 0,this.ddmParameters.t0=null!=this.ddmParameters.t0?this.t0:void 0),this.ddmModel&&(this.ddmModel.trials=this.trialCount,this.ddmModel.a=+this.a,this.ddmModel.z=+this.z,this.ddmModel.v=+this.v,this.ddmModel.t0=+this.t0),this.accumulableResponse&&(this.accumulableResponse.trialTotal=this.trials),this.accumulableTable&&(this.accumulableTable.color=this.color),this.accumulableTable&&this.data&&(this.accumulableTable.correctCount=this.data.correctCount,this.accumulableTable.errorCount=this.data.errorCount,this.accumulableTable.nrCount=this.data.nrCount,this.accumulableTable.accuracy=this.data.accuracy,this.accumulableTable.correctMeanRT=this.data.correctMeanRT,this.accumulableTable.errorMeanRT=this.data.errorMeanRT,this.accumulableTable.meanRT=this.data.meanRT,this.accumulableTable.correctSDRT=this.data.correctSDRT,this.accumulableTable.errorSDRT=this.data.errorSDRT,this.accumulableTable.sdRT=this.data.sdRT)}}customElements.define("ddm-example-model",ya),t.AccumulableControl=ia,t.AccumulableElement=ea,t.AccumulableResponse=ra,t.AccumulableTable=aa,t.DDMEquationAZV2PC=pa,t.DDMEquationAZVT02M=ma,t.DDMExampleHuman=Qa,t.DDMExampleInteractive=Ba,t.DDMExampleModel=ya,t.DDMFit=ca,t.DDMModel=ua,t.DDMParameters=da,t.RDK2AFCTask=ha});
2184
2161
  //# sourceMappingURL=accumulableElements.umd.min.js.map