@decidables/detectable-elements 0.2.4 → 0.2.5

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,7 +3,7 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;const i=t=>new class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const r=this.t;if(e&&void 0===t){const e=void 0!==r&&1===r.length;e&&(t=n.get(r)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(r,t))}return t}toString(){return this.cssText}}("string"==typeof t?t:t+"",void 0,r),s=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return i(e)})(t):t
6
+ const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let i=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const r=this.t;if(e&&void 0===t){const e=void 0!==r&&1===r.length;e&&(t=n.get(r)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(r,t))}return t}toString(){return this.cssText}};const s=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new i("string"==typeof t?t:t+"",void 0,r))(e)})(t):t
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
@@ -14,23 +14,30 @@ const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- var m;f.finalized=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:f}),(null!==(a=o.reactiveElementVersions)&&void 0!==a?a:o.reactiveElementVersions=[]).push("1.6.1");const b=window,v=b.trustedTypes,g=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,y="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,x="?"+w,k=`<${x}>`,$=document,_=()=>$.createComment(""),S=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,A="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,C=/>/g,N=RegExp(`>|${A}(?:([^\\s"'>=/]+)(${A}*=${A}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),R=/'/g,P=/"/g,q=/^(?:script|style|textarea|title)$/i,z=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),F=z(1),O=z(2),U=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),H=new WeakMap,D=$.createTreeWalker($,129,null,!1),L=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":"",a=M;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===M?"!--"===l[1]?a=T:void 0!==l[1]?a=C:void 0!==l[2]?(q.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=N):void 0!==l[3]&&(a=N):a===N?">"===l[0]?(a=null!=i?i:M,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?N:'"'===l[3]?P:R):a===P||a===R?a=N:a===T||a===C?a=M:(a=N,i=void 0);const u=a===N&&t[e+1].startsWith("/>")?" ":"";s+=a===M?r+k:c>=0?(n.push(o),r.slice(0,c)+y+r.slice(c)+w+u):r+w+(-2===c?(n.push(void 0),e):u)}const o=s+(t[r]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==g?g.createHTML(o):o,n]};class j{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0;const a=t.length-1,o=this.parts,[l,c]=L(t,e);if(this.el=j.createElement(l,r),D.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=D.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(y)||e.startsWith(w)){const r=c[s++];if(t.push(e),void 0!==r){const t=n.getAttribute(r.toLowerCase()+y).split(w),e=/([.?@])?(.*)/.exec(r);o.push({type:1,index:i,name:e[2],strings:t,ctor:"."===e[1]?X:"?"===e[1]?Y:"@"===e[1]?Z:K})}else o.push({type:6,index:i})}for(const e of t)n.removeAttribute(e)}if(q.test(n.tagName)){const t=n.textContent.split(w),e=t.length-1;if(e>0){n.textContent=v?v.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],_()),D.nextNode(),o.push({type:2,index:++i});n.append(t[e],_())}}}else if(8===n.nodeType)if(n.data===x)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(w,t+1));)o.push({type:7,index:i}),t+=w.length-1}i++}}static createElement(t,e){const r=$.createElement("template");return r.innerHTML=t,r}}function V(t,e,r=t,n){var i,s,a,o;if(e===U)return e;let l=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const c=S(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,r,n)),void 0!==n?(null!==(a=(o=r)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(e=V(t,l._$AS(t,e.values),l,n)),e}class B{constructor(t,e,r,n){var i;this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cm=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=V(this,t,e),S(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==U&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>E(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}g(t){this._$AH!==I&&S(this._$AH)?this._$AA.nextSibling.data=t:this.T($.createTextNode(t)),this._$AH=t}$(t){var e;const{values:r,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=j.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(r);else{const t=new class{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:r},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:$).importNode(r,!0);D.currentNode=i;let s=D.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new B(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new G(s,this,t)),this.u.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=D.nextNode(),a++)}return i}p(t){let e=0;for(const r of this.u)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}(i,this),e=t.v(this.options);t.p(r),this.T(e),this._$AH=t}}_$AC(t){let e=H.get(t.strings);return void 0===e&&H.set(t.strings,e=new j(t)),e}k(t){E(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new B(this.S(_()),this.S(_()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,r,n,i){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=I}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=V(this,t,e,0),s=!S(t)||t!==this._$AH&&t!==U,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=V(this,n[r+a],e,a),o===U&&(o=this._$AH[a]),s||(s=!S(o)||o!==this._$AH[a]),o===I?t=I:t!==I&&(t+=(null!=o?o:"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class X extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===I?void 0:t}}const W=v?v.emptyScript:"";class Y extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==I?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}}class Z extends K{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){var r;if((t=null!==(r=V(this,t,e,0))&&void 0!==r?r:I)===U)return;const n=this._$AH,i=t===I&&n!==I||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==I&&(n===I||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==r?r:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t)}}const J=b.litHtmlPolyfillSupport;null==J||J(j,B),(null!==(m=b.litHtmlVersions)&&void 0!==m?m:b.litHtmlVersions=[]).push("2.7.0");const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,tt=Symbol(),et=new Map;
17
+ var m;f.finalized=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:f}),(null!==(a=o.reactiveElementVersions)&&void 0!==a?a:o.reactiveElementVersions=[]).push("1.6.1");const b=window,v=b.trustedTypes,g=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,y="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,x="?"+w,$=`<${x}>`,_=document,k=()=>_.createComment(""),S=t=>null===t||"object"!=typeof t&&"function"!=typeof t,A=Array.isArray,E="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,C=/>/g,N=RegExp(`>|${E}(?:([^\\s"'>=/]+)(${E}*=${E}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),R=/'/g,P=/"/g,q=/^(?:script|style|textarea|title)$/i,z=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),O=new WeakMap,H=_.createTreeWalker(_,129,null,!1);function U(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==g?g.createHTML(e):e}let I=class t{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[c,h]=((t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":"",a=M;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===M?"!--"===l[1]?a=T:void 0!==l[1]?a=C:void 0!==l[2]?(q.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=N):void 0!==l[3]&&(a=N):a===N?">"===l[0]?(a=null!=i?i:M,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?N:'"'===l[3]?P:R):a===P||a===R?a=N:a===T||a===C?a=M:(a=N,i=void 0);const u=a===N&&t[e+1].startsWith("/>")?" ":"";s+=a===M?r+$:c>=0?(n.push(o),r.slice(0,c)+y+r.slice(c)+w+u):r+w+(-2===c?(n.push(void 0),e):u)}return[U(t,s+(t[r]||"<?>")+(2===e?"</svg>":"")),n]})(e,r);if(this.el=t.createElement(c,n),H.currentNode=this.el.content,2===r){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=H.nextNode())&&l.length<o;){if(1===i.nodeType){if(i.hasAttributes()){const t=[];for(const e of i.getAttributeNames())if(e.endsWith(y)||e.startsWith(w)){const r=h[a++];if(t.push(e),void 0!==r){const t=i.getAttribute(r.toLowerCase()+y).split(w),e=/([.?@])?(.*)/.exec(r);l.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?B:"?"===e[1]?W:"@"===e[1]?X:V})}else l.push({type:6,index:s})}for(const e of t)i.removeAttribute(e)}if(q.test(i.tagName)){const t=i.textContent.split(w),e=t.length-1;if(e>0){i.textContent=v?v.emptyScript:"";for(let r=0;r<e;r++)i.append(t[r],k()),H.nextNode(),l.push({type:2,index:++s});i.append(t[e],k())}}}else if(8===i.nodeType)if(i.data===x)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=i.data.indexOf(w,t+1));)l.push({type:7,index:s}),t+=w.length-1}s++}}static createElement(t,e){const r=_.createElement("template");return r.innerHTML=t,r}};function D(t,e,r=t,n){var i,s,a,o;if(e===z)return e;let l=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const c=S(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,r,n)),void 0!==n?(null!==(a=(o=r)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(e=D(t,l._$AS(t,e.values),l,n)),e}let L=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:r},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:_).importNode(r,!0);H.currentNode=i;let s=H.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new j(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new Y(s,this,t)),this._$AV.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=H.nextNode(),a++)}return H.currentNode=_,i}v(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},j=class t{constructor(t,e,r,n){var i;this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cp=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=D(this,t,e),S(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==z&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>A(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==F&&S(this._$AH)?this._$AA.nextSibling.data=t:this.$(_.createTextNode(t)),this._$AH=t}g(t){var e;const{values:r,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=I.createElement(U(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.v(r);else{const t=new L(i,this),e=t.u(this.options);t.v(r),this.$(e),this._$AH=t}}_$AC(t){let e=O.get(t.strings);return void 0===e&&O.set(t.strings,e=new I(t)),e}T(e){A(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,i=0;for(const s of e)i===r.length?r.push(n=new t(this.k(k()),this.k(k()),this,this.options)):n=r[i],n._$AI(s),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}},V=class{constructor(t,e,r,n,i){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=F}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=D(this,t,e,0),s=!S(t)||t!==this._$AH&&t!==z,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=D(this,n[r+a],e,a),o===z&&(o=this._$AH[a]),s||(s=!S(o)||o!==this._$AH[a]),o===F?t=F:t!==F&&(t+=(null!=o?o:"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}},B=class extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}};const K=v?v.emptyScript:"";let W=class extends V{constructor(){super(...arguments),this.type=4}j(t){t&&t!==F?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}},X=class extends V{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){var r;if((t=null!==(r=D(this,t,e,0))&&void 0!==r?r:F)===z)return;const n=this._$AH,i=t===F&&n!==F||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==F&&(n===F||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==r?r:this.element,t):this._$AH.handleEvent(t)}};class Y{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){D(this,t)}}const Z=b.litHtmlPolyfillSupport;null==Z||Z(I,j),(null!==(m=b.litHtmlVersions)&&void 0!==m?m:b.litHtmlVersions=[]).push("2.8.0");
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2019 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */let rt=class{constructor(t,e){if(this._$cssResult$=!0,e!==tt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=et.get(this.cssText);return Q&&void 0===t&&(et.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}};const nt=t=>new rt("string"==typeof t?t:t+"",tt),it=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1]),t[0]);return new rt(r,tt)},st=(t,e)=>{Q?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const r=document.createElement("style"),n=window.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,t.appendChild(r)}))},at=Q?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return nt(e)})(t):t
22
+ */
23
+ const G=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,J=Symbol(),Q=new Map;let tt=class{constructor(t,e){if(this._$cssResult$=!0,e!==J)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=Q.get(this.cssText);return G&&void 0===t&&(Q.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}};const et=t=>new tt("string"==typeof t?t:t+"",J),rt=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1]),t[0]);return new tt(r,J)},nt=G?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return et(e)})(t):t
24
+ /**
25
+ * @license
26
+ * Copyright 2017 Google LLC
27
+ * SPDX-License-Identifier: BSD-3-Clause
28
+ */;var it;const st=window.trustedTypes,at=st?st.emptyScript:"",ot=window.reactiveElementPolyfillSupport,lt={toAttribute(t,e){switch(e){case Boolean:t=t?at:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},ct=(t,e)=>e!==t&&(e==e||t==t),ht={attribute:!0,type:String,converter:lt,reflect:!1,hasChanged:ct};let ut=class extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,r)=>{const n=this._$Eh(r,e);void 0!==n&&(this._$Eu.set(n,r),t.push(n))})),t}static createProperty(t,e=ht){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const r="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(n){const i=this[t];this[e]=n,this.requestUpdate(t,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||ht}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const r of e)this.createProperty(r,t[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(nt(t))}else void 0!==t&&e.push(nt(t));return e}static _$Eh(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,r;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(r=t.hostConnected)||void 0===r||r.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{G?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const r=document.createElement("style"),n=window.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,t.appendChild(r)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ES(t,e,r=ht){var n,i;const s=this.constructor._$Eh(t,r);if(void 0!==s&&!0===r.reflect){const a=(null!==(i=null===(n=r.converter)||void 0===n?void 0:n.toAttribute)&&void 0!==i?i:lt.toAttribute)(e,r.type);this._$Ei=t,null==a?this.removeAttribute(s):this.setAttribute(s,a),this._$Ei=null}}_$AK(t,e){var r,n,i;const s=this.constructor,a=s._$Eu.get(t);if(void 0!==a&&this._$Ei!==a){const t=s.getPropertyOptions(a),o=t.converter,l=null!==(i=null!==(n=null===(r=o)||void 0===r?void 0:r.fromAttribute)&&void 0!==n?n:"function"==typeof o?o:null)&&void 0!==i?i:lt.fromAttribute;this._$Ei=a,this[a]=l(e,t.type),this._$Ei=null}}requestUpdate(t,e,r){let n=!0;void 0!==t&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||ct)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(r)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}};
23
29
  /**
24
30
  * @license
25
31
  * Copyright 2017 Google LLC
26
32
  * SPDX-License-Identifier: BSD-3-Clause
27
- */;var ot;const lt=window.trustedTypes,ct=lt?lt.emptyScript:"",ht=window.reactiveElementPolyfillSupport,ut={toAttribute(t,e){switch(e){case Boolean:t=t?ct:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},dt=(t,e)=>e!==t&&(e==e||t==t),pt={attribute:!0,type:String,converter:ut,reflect:!1,hasChanged:dt};class ft extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,r)=>{const n=this._$Eh(r,e);void 0!==n&&(this._$Eu.set(n,r),t.push(n))})),t}static createProperty(t,e=pt){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const r="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(n){const i=this[t];this[e]=n,this.requestUpdate(t,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||pt}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const r of e)this.createProperty(r,t[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(at(t))}else void 0!==t&&e.push(at(t));return e}static _$Eh(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,r;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(r=t.hostConnected)||void 0===r||r.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return st(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ES(t,e,r=pt){var n,i;const s=this.constructor._$Eh(t,r);if(void 0!==s&&!0===r.reflect){const a=(null!==(i=null===(n=r.converter)||void 0===n?void 0:n.toAttribute)&&void 0!==i?i:ut.toAttribute)(e,r.type);this._$Ei=t,null==a?this.removeAttribute(s):this.setAttribute(s,a),this._$Ei=null}}_$AK(t,e){var r,n,i;const s=this.constructor,a=s._$Eu.get(t);if(void 0!==a&&this._$Ei!==a){const t=s.getPropertyOptions(a),o=t.converter,l=null!==(i=null!==(n=null===(r=o)||void 0===r?void 0:r.fromAttribute)&&void 0!==n?n:"function"==typeof o?o:null)&&void 0!==i?i:ut.fromAttribute;this._$Ei=a,this[a]=l(e,t.type),this._$Ei=null}}requestUpdate(t,e,r){let n=!0;void 0!==t&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||dt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(r)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
33
+ */
34
+ var dt;ut.finalized=!0,ut.elementProperties=new Map,ut.elementStyles=[],ut.shadowRootOptions={mode:"open"},null==ot||ot({ReactiveElement:ut}),(null!==(it=globalThis.reactiveElementVersions)&&void 0!==it?it:globalThis.reactiveElementVersions=[]).push("1.3.1");const pt=window,ft=pt.trustedTypes,mt=ft?ft.createPolicy("lit-html",{createHTML:t=>t}):void 0,bt="$lit$",vt=`lit$${(Math.random()+"").slice(9)}$`,gt="?"+vt,yt=`<${gt}>`,wt=document,xt=()=>wt.createComment(""),$t=t=>null===t||"object"!=typeof t&&"function"!=typeof t,_t=Array.isArray,kt="[ \t\n\f\r]",St=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,At=/-->/g,Et=/>/g,Mt=RegExp(`>|${kt}(?:([^\\s"'>=/]+)(${kt}*=${kt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Tt=/'/g,Ct=/"/g,Nt=/^(?:script|style|textarea|title)$/i,Rt=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),Pt=Rt(1),qt=Rt(2),zt=Symbol.for("lit-noChange"),Ft=Symbol.for("lit-nothing"),Ot=new WeakMap,Ht=wt.createTreeWalker(wt,129,null,!1),Ut=(t,e)=>{const r=t.length-1,n=[];let i,s=2===e?"<svg>":"",a=St;for(let e=0;e<r;e++){const r=t[e];let o,l,c=-1,h=0;for(;h<r.length&&(a.lastIndex=h,l=a.exec(r),null!==l);)h=a.lastIndex,a===St?"!--"===l[1]?a=At:void 0!==l[1]?a=Et:void 0!==l[2]?(Nt.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=Mt):void 0!==l[3]&&(a=Mt):a===Mt?">"===l[0]?(a=null!=i?i:St,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?Mt:'"'===l[3]?Ct:Tt):a===Ct||a===Tt?a=Mt:a===At||a===Et?a=St:(a=Mt,i=void 0);const u=a===Mt&&t[e+1].startsWith("/>")?" ":"";s+=a===St?r+yt:c>=0?(n.push(o),r.slice(0,c)+bt+r.slice(c)+vt+u):r+vt+(-2===c?(n.push(void 0),e):u)}const o=s+(t[r]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==mt?mt.createHTML(o):o,n]};class It{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0;const a=t.length-1,o=this.parts,[l,c]=Ut(t,e);if(this.el=It.createElement(l,r),Ht.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=Ht.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(bt)||e.startsWith(vt)){const r=c[s++];if(t.push(e),void 0!==r){const t=n.getAttribute(r.toLowerCase()+bt).split(vt),e=/([.?@])?(.*)/.exec(r);o.push({type:1,index:i,name:e[2],strings:t,ctor:"."===e[1]?Bt:"?"===e[1]?Wt:"@"===e[1]?Xt:Vt})}else o.push({type:6,index:i})}for(const e of t)n.removeAttribute(e)}if(Nt.test(n.tagName)){const t=n.textContent.split(vt),e=t.length-1;if(e>0){n.textContent=ft?ft.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],xt()),Ht.nextNode(),o.push({type:2,index:++i});n.append(t[e],xt())}}}else if(8===n.nodeType)if(n.data===gt)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(vt,t+1));)o.push({type:7,index:i}),t+=vt.length-1}i++}}static createElement(t,e){const r=wt.createElement("template");return r.innerHTML=t,r}}function Dt(t,e,r=t,n){var i,s,a,o;if(e===zt)return e;let l=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const c=$t(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,r,n)),void 0!==n?(null!==(a=(o=r)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(e=Dt(t,l._$AS(t,e.values),l,n)),e}class Lt{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:r},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:wt).importNode(r,!0);Ht.currentNode=i;let s=Ht.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new jt(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new Yt(s,this,t)),this.u.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=Ht.nextNode(),a++)}return i}p(t){let e=0;for(const r of this.u)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class jt{constructor(t,e,r,n){var i;this.type=2,this._$AH=Ft,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cm=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Dt(this,t,e),$t(t)?t===Ft||null==t||""===t?(this._$AH!==Ft&&this._$AR(),this._$AH=Ft):t!==this._$AH&&t!==zt&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>_t(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}g(t){this._$AH!==Ft&&$t(this._$AH)?this._$AA.nextSibling.data=t:this.T(wt.createTextNode(t)),this._$AH=t}$(t){var e;const{values:r,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=It.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(r);else{const t=new Lt(i,this),e=t.v(this.options);t.p(r),this.T(e),this._$AH=t}}_$AC(t){let e=Ot.get(t.strings);return void 0===e&&Ot.set(t.strings,e=new It(t)),e}k(t){_t(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new jt(this.S(xt()),this.S(xt()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class Vt{constructor(t,e,r,n,i){this.type=1,this._$AH=Ft,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Ft}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,n){const i=this.strings;let s=!1;if(void 0===i)t=Dt(this,t,e,0),s=!$t(t)||t!==this._$AH&&t!==zt,s&&(this._$AH=t);else{const n=t;let a,o;for(t=i[0],a=0;a<i.length-1;a++)o=Dt(this,n[r+a],e,a),o===zt&&(o=this._$AH[a]),s||(s=!$t(o)||o!==this._$AH[a]),o===Ft?t=Ft:t!==Ft&&(t+=(null!=o?o:"")+i[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===Ft?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Bt extends Vt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Ft?void 0:t}}const Kt=ft?ft.emptyScript:"";class Wt extends Vt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==Ft?this.element.setAttribute(this.name,Kt):this.element.removeAttribute(this.name)}}class Xt extends Vt{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){var r;if((t=null!==(r=Dt(this,t,e,0))&&void 0!==r?r:Ft)===zt)return;const n=this._$AH,i=t===Ft&&n!==Ft||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==Ft&&(n===Ft||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==r?r:this.element,t):this._$AH.handleEvent(t)}}class Yt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Dt(this,t)}}const Zt=pt.litHtmlPolyfillSupport;null==Zt||Zt(It,jt),(null!==(dt=pt.litHtmlVersions)&&void 0!==dt?dt:pt.litHtmlVersions=[]).push("2.7.0");
28
35
  /**
29
36
  * @license
30
37
  * Copyright 2017 Google LLC
31
38
  * SPDX-License-Identifier: BSD-3-Clause
32
39
  */
33
- var mt,bt;ft.finalized=!0,ft.elementProperties=new Map,ft.elementStyles=[],ft.shadowRootOptions={mode:"open"},null==ht||ht({ReactiveElement:ft}),(null!==(ot=globalThis.reactiveElementVersions)&&void 0!==ot?ot:globalThis.reactiveElementVersions=[]).push("1.3.1");class vt extends ft{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{var n,i;const s=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:null;s._$litPart$=a=new B(e.insertBefore(_(),t),t,void 0,null!=r?r:{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return U}}vt.finalized=!0,vt._$litElement$=!0,null===(mt=globalThis.litElementHydrateSupport)||void 0===mt||mt.call(globalThis,{LitElement:vt});const gt=globalThis.litElementPolyfillSupport;function yt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function wt(t){let e=t,r=t,n=t;function i(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<0?i=r+1:s=r}while(i<s)}return i}return 2!==t.length&&(e=(e,r)=>t(e)-r,r=yt,n=(e,r)=>yt(t(e),r)),{left:i,center:function(t,r,n=0,s=t.length){const a=i(t,r,n,s-1);return a>n&&e(t[a-1],r)>-e(t[a],r)?a-1:a},right:function(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<=0?i=r+1:s=r}while(i<s)}return i}}}null==gt||gt({LitElement:vt}),(null!==(bt=globalThis.litElementVersions)&&void 0!==bt?bt:globalThis.litElementVersions=[]).push("3.3.0");const xt=wt(yt).right;wt((function(t){return null===t?NaN:+t})).center;var kt=xt;function $t(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}class _t{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n<this._n&&n<32;n++){const i=e[n],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(e[r++]=a),t=s}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,r=t[--i],s=e+r,n=r-(s-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=s+r,r==e-s&&(s=e))}return s}}function St(t){return t}var Et=Array.prototype.slice;function At(t){return()=>t}var Mt=Math.sqrt(50),Tt=Math.sqrt(10),Ct=Math.sqrt(2);function Nt(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=Rt(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function Rt(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=Mt?10:s>=Tt?5:s>=Ct?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=Mt?10:s>=Tt?5:s>=Ct?2:1)}function Pt(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}function qt(){var t=St,e=$t,r=Pt;function n(n){Array.isArray(n)||(n=Array.from(n));var i,s,a=n.length,o=new Array(a);for(i=0;i<a;++i)o[i]=t(n[i],i,n);var l=e(o),c=l[0],h=l[1],u=r(o,c,h);if(!Array.isArray(u)){const t=h,r=+u;if(e===$t&&([c,h]=function(t,e,r){let n;for(;;){const i=Rt(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}(c,h,r)),(u=Nt(c,h,r))[u.length-1]>=h)if(t>=h&&e===$t){const t=Rt(c,h,r);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else u.pop()}for(var d=u.length;u[0]<=c;)u.shift(),--d;for(;u[d-1]>h;)u.pop(),--d;var p,f=new Array(d+1);for(i=0;i<=d;++i)(p=f[i]=[]).x0=i>0?u[i-1]:c,p.x1=i<d?u[i]:h;for(i=0;i<a;++i)null!=(s=o[i])&&c<=s&&s<=h&&f[kt(u,s,0,d)].push(n[i]);return f}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:At(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:At([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?At(Et.call(t)):At(t),n):r},n}function zt(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function Ft(t){return t}var Ot=1e-6;function Ut(t){return"translate("+t+",0)"}function It(t){return"translate(0,"+t+")"}function Ht(t){return e=>+t(e)}function Dt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Lt(){return!this.__axis}function jt(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",u=1===t||3===t?Ut:It;function d(d){var p=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,f=null==i?e.tickFormat?e.tickFormat.apply(e,r):Ft:i,m=Math.max(s,0)+o,b=e.range(),v=+b[0]+l,g=+b[b.length-1]+l,y=(e.bandwidth?Dt:Ht)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),k=w.selectAll(".tick").data(p,e).order(),$=k.exit(),_=k.enter().append("g").attr("class","tick"),S=k.select("line"),E=k.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(_),S=S.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),E=E.merge(_.append("text").attr("fill","currentColor").attr(h,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),k=k.transition(d),S=S.transition(d),E=E.transition(d),$=$.transition(d).attr("opacity",Ot).attr("transform",(function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")})),_.attr("opacity",Ot).attr("transform",(function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)}))),$.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+v+"H"+l+"V"+g+"H"+c*a:"M"+l+","+v+"V"+g:a?"M"+v+","+c*a+"V"+l+"H"+g+"V"+c*a:"M"+v+","+l+"H"+g),k.attr("opacity",1).attr("transform",(function(t){return u(y(t)+l)})),S.attr(h+"2",c*s),E.attr(h,c*m).text(f),w.filter(Lt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=y}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),d):r.slice()},d.tickValues=function(t){return arguments.length?(n=null==t?null:Array.from(t),d):n&&n.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(s=a=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Vt(t){return jt(3,t)}function Bt(t){return jt(4,t)}var Kt={value:()=>{}};function Xt(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Wt(n)}function Wt(t){this._=t}function Yt(t,e){return t.trim().split(/^|\s+/).map((function(t){var r="",n=t.indexOf(".");if(n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function Zt(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Gt(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=Kt,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Wt.prototype=Xt.prototype={constructor:Wt,on:function(t,e){var r,n=this._,i=Yt(t+"",n),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)n[r]=Gt(n[r],t.name,e);else if(null==e)for(r in n)n[r]=Gt(n[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=Zt(n[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Wt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var Jt="http://www.w3.org/1999/xhtml",Qt={svg:"http://www.w3.org/2000/svg",xhtml:Jt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function te(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),Qt.hasOwnProperty(e)?{space:Qt[e],local:t}:t}function ee(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Jt&&e.documentElement.namespaceURI===Jt?e.createElement(t):e.createElementNS(r,t)}}function re(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ne(t){var e=te(t);return(e.local?re:ee)(e)}function ie(){}function se(t){return null==t?ie:function(){return this.querySelector(t)}}function ae(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function oe(){return[]}function le(t){return null==t?oe:function(){return this.querySelectorAll(t)}}function ce(t){return function(){return this.matches(t)}}function he(t){return function(e){return e.matches(t)}}var ue=Array.prototype.find;function de(){return this.firstElementChild}var pe=Array.prototype.filter;function fe(){return Array.from(this.children)}function me(t){return new Array(t.length)}function be(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ve(t){return function(){return t}}function ge(t,e,r,n,i,s){for(var a,o=0,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new be(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function ye(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,p=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(p[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new be(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(p[o])===l&&(i[o]=l)}function we(t){return t.__data__}function xe(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ke(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function $e(t){return function(){this.removeAttribute(t)}}function _e(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Se(t,e){return function(){this.setAttribute(t,e)}}function Ee(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ae(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function Me(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function Te(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ce(t){return function(){this.style.removeProperty(t)}}function Ne(t,e,r){return function(){this.style.setProperty(t,e,r)}}function Re(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function Pe(t,e){return t.style.getPropertyValue(e)||Te(t).getComputedStyle(t,null).getPropertyValue(e)}function qe(t){return function(){delete this[t]}}function ze(t,e){return function(){this[t]=e}}function Fe(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function Oe(t){return t.trim().split(/^|\s+/)}function Ue(t){return t.classList||new Ie(t)}function Ie(t){this._node=t,this._names=Oe(t.getAttribute("class")||"")}function He(t,e){for(var r=Ue(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function De(t,e){for(var r=Ue(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function Le(t){return function(){He(this,t)}}function je(t){return function(){De(this,t)}}function Ve(t,e){return function(){(e.apply(this,arguments)?He:De)(this,t)}}function Be(){this.textContent=""}function Ke(t){return function(){this.textContent=t}}function Xe(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function We(){this.innerHTML=""}function Ye(t){return function(){this.innerHTML=t}}function Ze(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ge(){this.nextSibling&&this.parentNode.appendChild(this)}function Je(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Qe(){return null}function tr(){var t=this.parentNode;t&&t.removeChild(this)}function er(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function rr(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function nr(t){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}}))}function ir(t){return function(){var e=this.__on;if(e){for(var r,n=0,i=-1,s=e.length;n<s;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?e.length=i:delete this.__on}}}function sr(t,e,r){return function(){var n,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),void(n.value=e);this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function ar(t,e,r){var n=Te(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function or(t,e){return function(){return ar(this,t,e)}}function lr(t,e){return function(){return ar(this,t,e.apply(this,arguments))}}be.prototype={constructor:be,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 cr=[null];function hr(t,e){this._groups=t,this._parents=e}function ur(){return new hr([[document.documentElement]],cr)}function dr(t){return"string"==typeof t?new hr([[document.querySelector(t)]],[document.documentElement]):new hr([[t]],cr)}function pr(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}hr.prototype=ur.prototype={constructor:hr,select:function(t){"function"!=typeof t&&(t=se(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a,o=e[i],l=o.length,c=n[i]=new Array(l),h=0;h<l;++h)(s=o[h])&&(a=t.call(s,s.__data__,h,o))&&("__data__"in s&&(a.__data__=s.__data__),c[h]=a);return new hr(n,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return ae(t.apply(this,arguments))}}(t):le(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var a,o=e[s],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),i.push(a));return new hr(n,i)},selectChild:function(t){return this.select(null==t?de:function(t){return function(){return ue.call(this.children,t)}}("function"==typeof t?t:he(t)))},selectChildren:function(t){return this.selectAll(null==t?fe:function(t){return function(){return pe.call(this.children,t)}}("function"==typeof t?t:he(t)))},filter:function(t){"function"!=typeof t&&(t=ce(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new hr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,we);var r=e?ye:ge,n=this._parents,i=this._groups;"function"!=typeof t&&(t=ve(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,p=xe(t.call(h,h&&h.__data__,c,n)),f=p.length,m=o[c]=new Array(f),b=a[c]=new Array(f),v=l[c]=new Array(d);r(h,u,m,b,v,p,e);for(var g,y,w=0,x=0;w<f;++w)if(g=m[w]){for(w>=x&&(x=w+1);!(y=b[x])&&++x<f;);g._next=y||null}}return(a=new hr(a,n))._enter=o,a._exit=l,a},enter:function(){return new hr(this._enter||this._groups.map(me),this._parents)},exit:function(){return new hr(this._exit||this._groups.map(me),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,p=o[l]=new Array(d),f=0;f<d;++f)(c=h[f]||u[f])&&(p[f]=c);for(;l<i;++l)o[l]=r[l];return new hr(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,i=t[e],s=i.length-1,a=i[s];--s>=0;)(n=i[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}t||(t=ke);for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var a,o=r[s],l=o.length,c=i[s]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new hr(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var a=n[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i,s=e[r],a=0,o=s.length;a<o;++a)(i=s[a])&&t.call(i,i.__data__,a,s);return this},attr:function(t,e){var r=te(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==e?r.local?_e:$e:"function"==typeof e?r.local?Me:Ae:r.local?Ee:Se)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?Ce:"function"==typeof e?Re:Ne)(t,e,null==r?"":r)):Pe(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?qe:"function"==typeof e?Fe:ze)(t,e)):this.node()[t]},classed:function(t,e){var r=Oe(t+"");if(arguments.length<2){for(var n=Ue(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?Ve:e?Le:je)(r,e))},text:function(t){return arguments.length?this.each(null==t?Be:("function"==typeof t?Xe:Ke)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?We:("function"==typeof t?Ze:Ye)(t)):this.node().innerHTML},raise:function(){return this.each(Ge)},lower:function(){return this.each(Je)},append:function(t){var e="function"==typeof t?t:ne(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:ne(t),n=null==e?Qe:"function"==typeof e?e:se(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(tr)},clone:function(t){return this.select(t?rr:er)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,i,s=nr(t+""),a=s.length;if(!(arguments.length<2)){for(o=e?sr:ir,n=0;n<a;++n)this.each(o(s[n],e,r));return this}var o=this.node().__on;if(o)for(var l,c=0,h=o.length;c<h;++c)for(n=0,l=o[c];n<a;++n)if((i=s[n]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?lr:or)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,i=t[e],s=0,a=i.length;s<a;++s)(n=i[s])&&(yield n)}};const fr={passive:!1},mr={capture:!0,passive:!1};function br(t){t.stopImmediatePropagation()}function vr(t){t.preventDefault(),t.stopImmediatePropagation()}var gr=t=>()=>t;function yr(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:s,x:a,y:o,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function wr(t){return!t.ctrlKey&&!t.button}function xr(){return this.parentNode}function kr(t,e){return null==e?{x:t.x,y:t.y}:e}function $r(){return navigator.maxTouchPoints||"ontouchstart"in this}function _r(){var t,e,r,n,i=wr,s=xr,a=kr,o=$r,l={},c=Xt("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",v,fr).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(dr(a.view).on("mousemove.drag",f,mr).on("mouseup.drag",m,mr),function(t){var e=t.document.documentElement,r=dr(t).on("dragstart.drag",vr,mr);"onselectstart"in e?r.on("selectstart.drag",vr,mr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),br(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function f(n){if(vr(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){dr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=dr(t).on("dragstart.drag",null);e&&(n.on("click.drag",vr,mr),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(t.view,r),vr(t),l.mouse("end",t)}function b(t,e){if(i.call(this,t,e)){var r,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(br(t),n("start",t,a[r]))}}function v(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(vr(t),r("drag",t,n[e]))}function g(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),e=0;e<s;++e)(r=l[i[e].identifier])&&(br(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,p,f=c.copy(),m=pr(s||r,e);if(null!=(p=a.call(t,new yr("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:f}),n)))return o=p.x-m[0]||0,u=p.y-m[1]||0,function r(s,a,c){var b,v=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=pr(c||a,e),b=h}f.call(s,t,new yr(s,{sourceEvent:a,subject:p,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-v[0],dy:m[1]-v[1],dispatch:f}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:gr(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:gr(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:gr(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:gr(!!t),d):o},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,d):Math.sqrt(u)},d}function Sr(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Er(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Ar(){}yr.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Mr=.7,Tr=1/Mr,Cr="\\s*([+-]?\\d+)\\s*",Nr="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Rr="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Pr=/^#([0-9a-f]{3,8})$/,qr=new RegExp("^rgb\\("+[Cr,Cr,Cr]+"\\)$"),zr=new RegExp("^rgb\\("+[Rr,Rr,Rr]+"\\)$"),Fr=new RegExp("^rgba\\("+[Cr,Cr,Cr,Nr]+"\\)$"),Or=new RegExp("^rgba\\("+[Rr,Rr,Rr,Nr]+"\\)$"),Ur=new RegExp("^hsl\\("+[Nr,Rr,Rr]+"\\)$"),Ir=new RegExp("^hsla\\("+[Nr,Rr,Rr,Nr]+"\\)$"),Hr={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 Dr(){return this.rgb().formatHex()}function Lr(){return this.rgb().formatRgb()}function jr(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Pr.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?Vr(e):3===r?new Wr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Br(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Br(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=qr.exec(t))?new Wr(e[1],e[2],e[3],1):(e=zr.exec(t))?new Wr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Fr.exec(t))?Br(e[1],e[2],e[3],e[4]):(e=Or.exec(t))?Br(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ur.exec(t))?Jr(e[1],e[2]/100,e[3]/100,1):(e=Ir.exec(t))?Jr(e[1],e[2]/100,e[3]/100,e[4]):Hr.hasOwnProperty(t)?Vr(Hr[t]):"transparent"===t?new Wr(NaN,NaN,NaN,0):null}function Vr(t){return new Wr(t>>16&255,t>>8&255,255&t,1)}function Br(t,e,r,n){return n<=0&&(t=e=r=NaN),new Wr(t,e,r,n)}function Kr(t){return t instanceof Ar||(t=jr(t)),t?new Wr((t=t.rgb()).r,t.g,t.b,t.opacity):new Wr}function Xr(t,e,r,n){return 1===arguments.length?Kr(t):new Wr(t,e,r,null==n?1:n)}function Wr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Yr(){return"#"+Gr(this.r)+Gr(this.g)+Gr(this.b)}function Zr(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Gr(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Jr(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new tn(t,e,r,n)}function Qr(t){if(t instanceof tn)return new tn(t.h,t.s,t.l,t.opacity);if(t instanceof Ar||(t=jr(t)),!t)return new tn;if(t instanceof tn)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(a=e===s?(r-n)/o+6*(r<n):r===s?(n-e)/o+2:(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new tn(a,o,l,t.opacity)}function tn(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function en(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}Sr(Ar,jr,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Dr,formatHex:Dr,formatHsl:function(){return Qr(this).formatHsl()},formatRgb:Lr,toString:Lr}),Sr(Wr,Xr,Er(Ar,{brighter:function(t){return t=null==t?Tr:Math.pow(Tr,t),new Wr(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Mr:Math.pow(Mr,t),new Wr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:Yr,formatHex:Yr,formatRgb:Zr,toString:Zr})),Sr(tn,(function(t,e,r,n){return 1===arguments.length?Qr(t):new tn(t,e,r,null==n?1:n)}),Er(Ar,{brighter:function(t){return t=null==t?Tr:Math.pow(Tr,t),new tn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Mr:Math.pow(Mr,t),new tn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Wr(en(t>=240?t-240:t+120,i,n),en(t,i,n),en(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var rn=t=>()=>t;function nn(t){return 1==(t=+t)?sn:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):rn(isNaN(e)?r:e)}}function sn(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):rn(isNaN(t)?e:t)}var an=function t(e){var r=nn(e);function n(t,e){var n=r((t=Xr(t)).r,(e=Xr(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=sn(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function on(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function ln(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n);for(r=0;r<i;++r)s[r]=mn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=s[r](t);return a}}function cn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function hn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function un(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=mn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var dn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(dn.source,"g");function fn(t,e){var r,n,i,s=dn.lastIndex=pn.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=dn.exec(t))&&(n=pn.exec(e));)(i=n.index)>s&&(i=e.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:hn(r,n)})),s=pn.lastIndex;return s<e.length&&(i=e.slice(s),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)o[(r=l[n]).i]=r.x(t);return o.join("")})}function mn(t,e){var r,n=typeof e;return null==e||"boolean"===n?rn(e):("number"===n?hn:"string"===n?(r=jr(e))?(e=r,an):fn:e instanceof jr?an:e instanceof Date?cn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?on:Array.isArray(e)?ln:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?un:hn)(t,e)}function bn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var vn,gn=180/Math.PI,yn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wn(t,e,r,n,i,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*gn,skewX:Math.atan(l)*gn,scaleX:a,scaleY:o}}function xn(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(s,a){var o=[],l=[];return s=t(s),a=t(a),function(t,n,i,s,a,o){if(t!==i||n!==s){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:hn(t,i)},{i:l-2,x:hn(n,s)})}else(i||s)&&a.push("translate("+i+e+s+r)}(s.translateX,s.translateY,a.translateX,a.translateY,o,l),function(t,e,r,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:r.push(i(r)+"rotate(",null,n)-2,x:hn(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,r,s){t!==e?s.push({i:r.push(i(r)+"skewX(",null,n)-2,x:hn(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,r,n,s,a){if(t!==r||e!==n){var o=s.push(i(s)+"scale(",null,",",null,")");a.push({i:o-4,x:hn(t,r)},{i:o-2,x:hn(e,n)})}else 1===r&&1===n||s.push(i(s)+"scale("+r+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,r=-1,n=l.length;++r<n;)o[(e=l[r]).i]=e.x(t);return o.join("")}}}var kn,$n,_n=xn((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?yn:wn(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Sn=xn((function(t){return null==t?yn:(vn||(vn=document.createElementNS("http://www.w3.org/2000/svg","g")),vn.setAttribute("transform",t),(t=vn.transform.baseVal.consolidate())?wn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):yn)}),", ",")",")"),En=0,An=0,Mn=0,Tn=0,Cn=0,Nn=0,Rn="object"==typeof performance&&performance.now?performance:Date,Pn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function qn(){return Cn||(Pn(zn),Cn=Rn.now()+Nn)}function zn(){Cn=0}function Fn(){this._call=this._time=this._next=null}function On(t,e,r){var n=new Fn;return n.restart(t,e,r),n}function Un(){Cn=(Tn=Rn.now())+Nn,En=An=0;try{!function(){qn(),++En;for(var t,e=kn;e;)(t=Cn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--En}()}finally{En=0,function(){var t,e,r=kn,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:kn=e);$n=t,Hn(n)}(),Cn=0}}function In(){var t=Rn.now(),e=t-Tn;e>1e3&&(Nn-=e,Tn=t)}function Hn(t){En||(An&&(An=clearTimeout(An)),t-Cn>24?(t<1/0&&(An=setTimeout(Un,t-Rn.now()-Nn)),Mn&&(Mn=clearInterval(Mn))):(Mn||(Tn=Rn.now(),Mn=setInterval(In,1e3)),En=1,Pn(Un)))}function Dn(t,e,r){var n=new Fn;return e=null==e?0:+e,n.restart((r=>{n.stop(),t(r+e)}),e,r),n}Fn.prototype=On.prototype={constructor:Fn,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?qn():+r)+(null==e?0:+e),this._next||$n===this||($n?$n._next=this:kn=this,$n=this),this._call=t,this._time=r,Hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hn())}};var Ln=Xt("start","end","cancel","interrupt"),jn=[];function Vn(t,e,r,n,i,s){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,e,r){var n,i=t.__transition;function s(t){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=t&&a(t-r.delay)}function a(s){var c,h,u,d;if(1!==r.state)return l();for(c in i)if((d=i[c]).name===r.name){if(3===d.state)return Dn(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(Dn((function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(s))})),r.state=2,r.on.call("start",t,t.__data__,r.index,r.group),2===r.state){for(r.state=3,n=new Array(u=r.tween.length),c=0,h=-1;c<u;++c)(d=r.tween[c].value.call(t,t.__data__,r.index,r.group))&&(n[++h]=d);n.length=h+1}}function o(e){for(var i=e<r.duration?r.ease.call(null,e/r.duration):(r.timer.restart(l),r.state=5,1),s=-1,a=n.length;++s<a;)n[s].call(t,i);5===r.state&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){for(var n in r.state=6,r.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=r,r.timer=On(s,0,r.time)}(t,r,{name:e,index:n,group:i,on:Ln,tween:jn,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function Bn(t,e){var r=Xn(t,e);if(r.state>0)throw new Error("too late; already scheduled");return r}function Kn(t,e){var r=Xn(t,e);if(r.state>3)throw new Error("too late; already running");return r}function Xn(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function Wn(t,e){var r,n;return function(){var i=Kn(this,t),s=i.tween;if(s!==r)for(var a=0,o=(n=r=s).length;a<o;++a)if(n[a].name===e){(n=n.slice()).splice(a,1);break}i.tween=n}}function Yn(t,e,r){var n,i;if("function"!=typeof r)throw new Error;return function(){var s=Kn(this,t),a=s.tween;if(a!==n){i=(n=a).slice();for(var o={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=o;break}l===c&&i.push(o)}s.tween=i}}function Zn(t,e,r){var n=t._id;return t.each((function(){var t=Kn(this,n);(t.value||(t.value={}))[e]=r.apply(this,arguments)})),function(t){return Xn(t,n).value[e]}}function Gn(t,e){var r;return("number"==typeof e?hn:e instanceof jr?an:(r=jr(e))?(e=r,an):fn)(t,e)}function Jn(t){return function(){this.removeAttribute(t)}}function Qn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ti(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttribute(t);return a===s?null:a===n?i:i=e(n=a,r)}}function ei(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===n?i:i=e(n=a,r)}}function ri(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttribute(t))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttribute(t)}}function ni(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttributeNS(t.space,t.local)}}function ii(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function si(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function ai(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&si(t,i)),r}return i._value=e,i}function oi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&ii(t,i)),r}return i._value=e,i}function li(t,e){return function(){Bn(this,t).delay=+e.apply(this,arguments)}}function ci(t,e){return e=+e,function(){Bn(this,t).delay=e}}function hi(t,e){return function(){Kn(this,t).duration=+e.apply(this,arguments)}}function ui(t,e){return e=+e,function(){Kn(this,t).duration=e}}function di(t,e){if("function"!=typeof e)throw new Error;return function(){Kn(this,t).ease=e}}function pi(t,e,r){var n,i,s=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)?Bn:Kn;return function(){var a=s(this,t),o=a.on;o!==n&&(i=(n=o).copy()).on(e,r),a.on=i}}var fi=ur.prototype.constructor;function mi(t){return function(){this.style.removeProperty(t)}}function bi(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function vi(t,e,r){var n,i;function s(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&bi(t,s,r)),n}return s._value=e,s}function gi(t){return function(e){this.textContent=t.call(this,e)}}function yi(t){var e,r;function n(){var n=t.apply(this,arguments);return n!==r&&(e=(r=n)&&gi(n)),e}return n._value=t,n}var wi=0;function xi(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function ki(){return++wi}var $i=ur.prototype;xi.prototype={constructor:xi,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=se(t));for(var n=this._groups,i=n.length,s=new Array(i),a=0;a<i;++a)for(var o,l,c=n[a],h=c.length,u=s[a]=new Array(h),d=0;d<h;++d)(o=c[d])&&(l=t.call(o,o.__data__,d,c))&&("__data__"in o&&(l.__data__=o.__data__),u[d]=l,Vn(u[d],e,r,d,u,Xn(o,r)));return new xi(s,this._parents,e,r)},selectAll:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=le(t));for(var n=this._groups,i=n.length,s=[],a=[],o=0;o<i;++o)for(var l,c=n[o],h=c.length,u=0;u<h;++u)if(l=c[u]){for(var d,p=t.call(l,l.__data__,u,c),f=Xn(l,r),m=0,b=p.length;m<b;++m)(d=p[m])&&Vn(d,e,r,m,p,f);s.push(p),a.push(l)}return new xi(s,a,e,r)},selectChild:$i.selectChild,selectChildren:$i.selectChildren,filter:function(t){"function"!=typeof t&&(t=ce(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new xi(n,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),a=new Array(n),o=0;o<s;++o)for(var l,c=e[o],h=r[o],u=c.length,d=a[o]=new Array(u),p=0;p<u;++p)(l=c[p]||h[p])&&(d[p]=l);for(;o<n;++o)a[o]=e[o];return new xi(a,this._parents,this._name,this._id)},selection:function(){return new fi(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,r=ki(),n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)if(a=o[c]){var h=Xn(a,e);Vn(a,t,r,c,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new xi(n,this._parents,t,r)},call:$i.call,nodes:$i.nodes,node:$i.node,size:$i.size,empty:$i.empty,each:$i.each,on:function(t,e){var r=this._id;return arguments.length<2?Xn(this.node(),r).on.on(t):this.each(pi(r,t,e))},attr:function(t,e){var r=te(t),n="transform"===r?Sn:Gn;return this.attrTween(t,"function"==typeof e?(r.local?ni:ri)(r,n,Zn(this,"attr."+t,e)):null==e?(r.local?Qn:Jn)(r):(r.local?ei:ti)(r,n,e))},attrTween:function(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var n=te(t);return this.tween(r,(n.local?ai:oi)(n,e))},style:function(t,e,r){var n="transform"==(t+="")?_n:Gn;return null==e?this.styleTween(t,function(t,e){var r,n,i;return function(){var s=Pe(this,t),a=(this.style.removeProperty(t),Pe(this,t));return s===a?null:s===r&&a===n?i:i=e(r=s,n=a)}}(t,n)).on("end.style."+t,mi(t)):"function"==typeof e?this.styleTween(t,function(t,e,r){var n,i,s;return function(){var a=Pe(this,t),o=r(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=Pe(this,t)),a===l?null:a===n&&l===i?s:(i=l,s=e(n=a,o))}}(t,n,Zn(this,"style."+t,e))).each(function(t,e){var r,n,i,s,a="style."+e,o="end."+a;return function(){var l=Kn(this,t),c=l.on,h=null==l.value[a]?s||(s=mi(e)):void 0;c===r&&i===h||(n=(r=c).copy()).on(o,i=h),l.on=n}}(this._id,t)):this.styleTween(t,function(t,e,r){var n,i,s=r+"";return function(){var a=Pe(this,t);return a===s?null:a===n?i:i=e(n=a,r)}}(t,n,e),r).on("end.style."+t,null)},styleTween:function(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,vi(t,e,null==r?"":r))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Zn(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,yi(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n,i=Xn(this.node(),r).tween,s=0,a=i.length;s<a;++s)if((n=i[s]).name===t)return n.value;return null}return this.each((null==e?Wn:Yn)(r,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?li:ci)(e,t)):Xn(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?hi:ui)(e,t)):Xn(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(di(e,t)):Xn(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var r=e.apply(this,arguments);if("function"!=typeof r)throw new Error;Kn(this,t).ease=r}}(this._id,t))},end:function(){var t,e,r=this,n=r._id,i=r.size();return new Promise((function(s,a){var o={value:a},l={value:function(){0==--i&&s()}};r.each((function(){var r=Kn(this,n),i=r.on;i!==t&&((e=(t=i).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),r.on=e})),0===i&&s()}))},[Symbol.iterator]:$i[Symbol.iterator]};const _i=t=>+t;function Si(t){return t*t*t}function Ei(t){return--t*t*t+1}var Ai={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Mi(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}ur.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var r,n,i,s=t.__transition,a=!0;if(s){for(i in e=null==e?null:e+"",s)(r=s[i]).name===e?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete s[i]):a=!1;a&&delete t.__transition}}(this,t)}))},ur.prototype.transition=function(t){var e,r;t instanceof xi?(e=t._id,t=t._name):(e=ki(),(r=Ai).time=qn(),t=null==t?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)(a=o[c])&&Vn(a,t,e,c,o,r||Mi(a,e));return new xi(n,this._parents,t,e)};const Ti=Math.PI,Ci=2*Ti,Ni=1e-6,Ri=Ci-Ni;function Pi(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qi(){return new Pi}Pi.prototype=qi.prototype={constructor:Pi,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,s){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+s)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var s=this._x1,a=this._y1,o=r-t,l=n-e,c=s-t,h=a-e,u=c*c+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(u>Ni)if(Math.abs(h*o-l*c)>Ni&&i){var d=r-s,p=n-a,f=o*o+l*l,m=d*d+p*p,b=Math.sqrt(f),v=Math.sqrt(u),g=i*Math.tan((Ti-Math.acos((f+u-m)/(2*b*v)))/2),y=g/v,w=g/b;Math.abs(y-1)>Ni&&(this._+="L"+(t+y*c)+","+(e+y*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>c*p)+","+(this._x1=t+w*o)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,r,n,i,s){t=+t,e=+e,s=!!s;var a=(r=+r)*Math.cos(n),o=r*Math.sin(n),l=t+a,c=e+o,h=1^s,u=s?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>Ni||Math.abs(this._y1-c)>Ni)&&(this._+="L"+l+","+c),r&&(u<0&&(u=u%Ci+Ci),u>Ri?this._+="A"+r+","+r+",0,1,"+h+","+(t-a)+","+(e-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=c):u>Ni&&(this._+="A"+r+","+r+",0,"+ +(u>=Ti)+","+h+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};var zi=Math.sqrt(50),Fi=Math.sqrt(10),Oi=Math.sqrt(2);function Ui(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=function(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=zi?10:s>=Fi?5:s>=Oi?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=zi?10:s>=Fi?5:s>=Oi?2:1)}(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function Ii(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}var Hi=Array.prototype.slice;function Di(t,e){return t-e}var Li=t=>()=>t;function ji(t,e){for(var r,n=-1,i=e.length;++n<i;)if(r=Vi(t,e[n]))return r;return 0}function Vi(t,e){for(var r=e[0],n=e[1],i=-1,s=0,a=t.length,o=a-1;s<a;o=s++){var l=t[s],c=l[0],h=l[1],u=t[o],d=u[0],p=u[1];if(Bi(l,u,e))return 0;h>n!=p>n&&r<(d-c)*(n-h)/(p-h)+c&&(i=-i)}return i}function Bi(t,e,r){var n;return function(t,e,r){return(e[0]-t[0])*(r[1]-t[1])==(r[0]-t[0])*(e[1]-t[1])}(t,e,r)&&function(t,e,r){return t<=e&&e<=r||r<=e&&e<=t}(t[n=+(t[0]===e[0])],r[n],e[n])}function Ki(){}var Xi=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Wi(){var t=1,e=1,r=Ii,n=o;function i(t){var e=r(t);if(Array.isArray(e))e=e.slice().sort(Di);else{const r=function(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}(t),n=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=zi?i*=10:s>=Fi?i*=5:s>=Oi&&(i*=2),e<t?-i:i}(r[0],r[1],e);e=Ui(Math.floor(r[0]/n)*n,Math.floor(r[1]/n-1)*n,e)}return e.map((e=>s(t,e)))}function s(r,i){var s=[],o=[];return function(r,n,i){var s,o,l,c,h,u,d=new Array,p=new Array;s=o=-1,c=r[0]>=n,Xi[c<<1].forEach(f);for(;++s<t-1;)l=c,c=r[s+1]>=n,Xi[l|c<<1].forEach(f);Xi[c<<0].forEach(f);for(;++o<e-1;){for(s=-1,c=r[o*t+t]>=n,h=r[o*t]>=n,Xi[c<<1|h<<2].forEach(f);++s<t-1;)l=c,c=r[o*t+t+s+1]>=n,u=h,h=r[o*t+s+1]>=n,Xi[l|c<<1|h<<2|u<<3].forEach(f);Xi[c|h<<3].forEach(f)}s=-1,h=r[o*t]>=n,Xi[h<<2].forEach(f);for(;++s<t-1;)u=h,h=r[o*t+s+1]>=n,Xi[h<<2|u<<3].forEach(f);function f(t){var e,r,n=[t[0][0]+s,t[0][1]+o],l=[t[1][0]+s,t[1][1]+o],c=a(n),h=a(l);(e=p[c])?(r=d[h])?(delete p[e.end],delete d[r.start],e===r?(e.ring.push(l),i(e.ring)):d[e.start]=p[r.end]={start:e.start,end:r.end,ring:e.ring.concat(r.ring)}):(delete p[e.end],e.ring.push(l),p[e.end=h]=e):(e=d[h])?(r=p[c])?(delete d[e.start],delete p[r.end],e===r?(e.ring.push(l),i(e.ring)):d[r.start]=p[e.end]={start:r.start,end:e.end,ring:r.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(n),d[e.start=c]=e):d[c]=p[h]={start:c,end:h,ring:[n,l]}}Xi[h<<3].forEach(f)}(r,i,(function(t){n(t,r,i),function(t){for(var e=0,r=t.length,n=t[r-1][1]*t[0][0]-t[r-1][0]*t[0][1];++e<r;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}(t)>0?s.push([t]):o.push(t)})),o.forEach((function(t){for(var e,r=0,n=s.length;r<n;++r)if(-1!==ji((e=s[r])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function o(r,n,i){r.forEach((function(r){var s,a=r[0],o=r[1],l=0|a,c=0|o,h=n[c*t+l];a>0&&a<t&&l===a&&(s=n[c*t+l-1],r[0]=a+(i-s)/(h-s)-.5),o>0&&o<e&&c===o&&(s=n[(c-1)*t+l],r[1]=o+(i-s)/(h-s)-.5)}))}return i.contour=s,i.size=function(r){if(!arguments.length)return[t,e];var n=Math.floor(r[0]),s=Math.floor(r[1]);if(!(n>=0&&s>=0))throw new Error("invalid size");return t=n,e=s,i},i.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?Li(Hi.call(t)):Li(t),i):r},i.smooth=function(t){return arguments.length?(n=t?o:Ki,i):n===o},i}function Yi(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Zi(t){return(t=Yi(Math.abs(t)))?t[1]:NaN}var Gi,Ji=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Qi(t){if(!(e=Ji.exec(t)))throw new Error("invalid format: "+t);var e;return new ts({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 ts(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 es(t,e){var r=Yi(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}Qi.prototype=ts.prototype,ts.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 rs={"%":(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)=>es(100*t,e),r:es,s:function(t,e){var r=Yi(t,e);if(!r)return t+"";var n=r[0],i=r[1],s=i-(Gi=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+Yi(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ns(t){return t}var is,ss,as,os=Array.prototype.map,ls=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function cs(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?ns:(e=os.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var i=t.length,s=[],a=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(i-=o,i+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return s.reverse().join(r)}),i=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?ns:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(os.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=Qi(t)).fill,r=t.align,u=t.sign,d=t.symbol,p=t.zero,f=t.width,m=t.comma,b=t.precision,v=t.trim,g=t.type;"n"===g?(m=!0,g="g"):rs[g]||(void 0===b&&(b=12),v=!0,g="g"),(p||"0"===e&&"="===r)&&(p=!0,e="0",r="=");var y="$"===d?i:"#"===d&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===d?s:/[%p]/.test(g)?l:"",x=rs[g],k=/[defgprs%]/.test(g);function $(t){var i,s,l,d=y,$=w;if("c"===g)$=x(t)+$,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),b),v&&(t=function(t){t:for(var e,r=t.length,n=1,i=-1;n<r;++n)switch(t[n]){case".":i=e=n;break;case"0":0===i&&(i=n),e=n;break;default:if(!+t[n])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),_&&0==+t&&"+"!==u&&(_=!1),d=(_?"("===u?u:c:"-"===u||"("===u?"":u)+d,$=("s"===g?ls[8+Gi/3]:"")+$+(_&&"("===u?")":""),k)for(i=-1,s=t.length;++i<s;)if(48>(l=t.charCodeAt(i))||l>57){$=(46===l?a+t.slice(i+1):t.slice(i))+$,t=t.slice(0,i);break}}m&&!p&&(t=n(t,1/0));var S=d.length+t.length+$.length,E=S<f?new Array(f-S+1).join(e):"";switch(m&&p&&(t=n(E+t,E.length?f-$.length:1/0),E=""),r){case"<":t=d+t+$+E;break;case"=":t=d+E+t+$;break;case"^":t=E.slice(0,S=E.length>>1)+d+t+$+E.slice(S);break;default:t=E+d+t+$}return o(t)}return b=void 0===b?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),$.toString=function(){return t+""},$}return{format:u,formatPrefix:function(t,e){var r=u(((t=Qi(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(Zi(e)/3))),i=Math.pow(10,-n),s=ls[8+n/3];return function(t){return r(i*t)+s}}}}is=cs({thousands:",",grouping:[3],currency:["$",""]}),ss=is.format,as=is.formatPrefix;var hs=1e-6,us=Math.PI,ds=2*us,ps=180/us,fs=us/180,ms=Math.abs,bs=Math.cos,vs=Math.sin,gs=Math.sqrt;function ys(){}function ws(t,e){t&&ks.hasOwnProperty(t.type)&&ks[t.type](t,e)}var xs={Feature:function(t,e){ws(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)ws(r[n].geometry,e)}},ks={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){$s(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)$s(r[n],e,0)},Polygon:function(t,e){_s(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)_s(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)ws(r[n],e)}};function $s(t,e,r){var n,i=-1,s=t.length-r;for(e.lineStart();++i<s;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function _s(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)$s(t[r],e,1);e.polygonEnd()}function Ss(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):ws(t,e)}function Es(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function As(t,e,r,n,i){var s,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],a=t[e];if(function(t,e){return ms(t[0]-e[0])<hs&&ms(t[1]-e[1])<hs}(n,a)){if(!n[2]&&!a[2]){for(i.lineStart(),s=0;s<e;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}a[0]+=2e-6}o.push(r=new Es(n,t,null,!0)),l.push(r.o=new Es(n,null,r,!1)),o.push(r=new Es(a,t,null,!1)),l.push(r.o=new Es(a,null,r,!0))}})),o.length){for(l.sort(e),Ms(o),Ms(l),s=0,a=l.length;s<a;++s)l[s].e=r=!r;for(var c,h,u=o[0];;){for(var d=u,p=!0;d.v;)if((d=d.n)===u)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(s=0,a=c.length;s<a;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(c=d.p.z,s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1]);else n(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function Ms(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}var Ts=1e9,Cs=-Ts;function Ns(t,e,r,n){function i(i,s){return t<=i&&i<=r&&e<=s&&s<=n}function s(i,s,o,c){var h=0,u=0;if(null==i||(h=a(i,o))!==(u=a(s,o))||l(i,s)<0^o>0)do{c.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+o+4)%4)!==u);else c.point(s[0],s[1])}function a(n,i){return ms(n[0]-t)<hs?i>0?0:3:ms(n[0]-r)<hs?i>0?2:1:ms(n[1]-e)<hs?i>0?1:0:i>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,h,u,d,p,f,m,b,v,g,y=a,w=function(){var t,e=[];return{point:function(e,r,n){t.push([e,r,n])},lineStart:function(){e.push(t=[])},lineEnd:ys,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}(),x={point:k,lineStart:function(){x.point=$,c&&c.push(h=[]);v=!0,b=!1,f=m=NaN},lineEnd:function(){l&&($(u,d),p&&b&&w.rejoin(),l.push(w.result()));x.point=k,b&&y.lineEnd()},polygonStart:function(){y=w,l=[],c=[],g=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=c.length;r<i;++r)for(var s,a,o=c[r],l=1,h=o.length,u=o[0],d=u[0],p=u[1];l<h;++l)s=d,a=p,d=(u=o[l])[0],p=u[1],a<=n?p>n&&(d-s)*(n-a)>(p-a)*(t-s)&&++e:p<=n&&(d-s)*(n-a)<(p-a)*(t-s)&&--e;return e}(),r=g&&e,i=(u=l,l=Array.from(function*(t){for(const e of t)yield*e}(u))).length;var u;(r||i)&&(a.polygonStart(),r&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),i&&As(l,o,e,s,a),a.polygonEnd());y=a,l=c=h=null}};function k(t,e){i(t,e)&&y.point(t,e)}function $(s,a){var o=i(s,a);if(c&&h.push([s,a]),v)u=s,d=a,p=o,v=!1,o&&(y.lineStart(),y.point(s,a));else if(o&&b)y.point(s,a);else{var l=[f=Math.max(Cs,Math.min(Ts,f)),m=Math.max(Cs,Math.min(Ts,m))],w=[s=Math.max(Cs,Math.min(Ts,s)),a=Math.max(Cs,Math.min(Ts,a))];!function(t,e,r,n,i,s){var a,o=t[0],l=t[1],c=0,h=1,u=e[0]-o,d=e[1]-l;if(a=r-o,u||!(a>0)){if(a/=u,u<0){if(a<c)return;a<h&&(h=a)}else if(u>0){if(a>h)return;a>c&&(c=a)}if(a=i-o,u||!(a<0)){if(a/=u,u<0){if(a>h)return;a>c&&(c=a)}else if(u>0){if(a<c)return;a<h&&(h=a)}if(a=n-l,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>c&&(c=a)}if(a=s-l,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<h&&(h=a)}return c>0&&(t[0]=o+c*u,t[1]=l+c*d),h<1&&(e[0]=o+h*u,e[1]=l+h*d),!0}}}}}(l,w,t,e,r,n)?o&&(y.lineStart(),y.point(s,a),g=!1):(b||(y.lineStart(),y.point(l[0],l[1])),y.point(w[0],w[1]),o||y.lineEnd(),g=!1)}f=s,m=a,b=o}return x}}var Rs,Ps,qs,zs,Fs=t=>t,Os=new _t,Us=new _t,Is={point:ys,lineStart:ys,lineEnd:ys,polygonStart:function(){Is.lineStart=Hs,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=ys,Os.add(ms(Us)),Us=new _t},result:function(){var t=Os/2;return Os=new _t,t}};function Hs(){Is.point=Ds}function Ds(t,e){Is.point=Ls,Rs=qs=t,Ps=zs=e}function Ls(t,e){Us.add(zs*t-qs*e),qs=t,zs=e}function js(){Ls(Rs,Ps)}var Vs=Is,Bs=1/0,Ks=Bs,Xs=-Bs,Ws=Xs,Ys={point:function(t,e){t<Bs&&(Bs=t);t>Xs&&(Xs=t);e<Ks&&(Ks=e);e>Ws&&(Ws=e)},lineStart:ys,lineEnd:ys,polygonStart:ys,polygonEnd:ys,result:function(){var t=[[Bs,Ks],[Xs,Ws]];return Xs=Ws=-(Ks=Bs=1/0),t}};var Zs,Gs,Js,Qs,ta=Ys,ea=0,ra=0,na=0,ia=0,sa=0,aa=0,oa=0,la=0,ca=0,ha={point:ua,lineStart:da,lineEnd:ma,polygonStart:function(){ha.lineStart=ba,ha.lineEnd=va},polygonEnd:function(){ha.point=ua,ha.lineStart=da,ha.lineEnd=ma},result:function(){var t=ca?[oa/ca,la/ca]:aa?[ia/aa,sa/aa]:na?[ea/na,ra/na]:[NaN,NaN];return ea=ra=na=ia=sa=aa=oa=la=ca=0,t}};function ua(t,e){ea+=t,ra+=e,++na}function da(){ha.point=pa}function pa(t,e){ha.point=fa,ua(Js=t,Qs=e)}function fa(t,e){var r=t-Js,n=e-Qs,i=gs(r*r+n*n);ia+=i*(Js+t)/2,sa+=i*(Qs+e)/2,aa+=i,ua(Js=t,Qs=e)}function ma(){ha.point=ua}function ba(){ha.point=ga}function va(){ya(Zs,Gs)}function ga(t,e){ha.point=ya,ua(Zs=Js=t,Gs=Qs=e)}function ya(t,e){var r=t-Js,n=e-Qs,i=gs(r*r+n*n);ia+=i*(Js+t)/2,sa+=i*(Qs+e)/2,aa+=i,oa+=(i=Qs*t-Js*e)*(Js+t),la+=i*(Qs+e),ca+=3*i,ua(Js=t,Qs=e)}var wa=ha;function xa(t){this._context=t}xa.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,ds)}},result:ys};var ka,$a,_a,Sa,Ea,Aa=new _t,Ma={point:ys,lineStart:function(){Ma.point=Ta},lineEnd:function(){ka&&Ca($a,_a),Ma.point=ys},polygonStart:function(){ka=!0},polygonEnd:function(){ka=null},result:function(){var t=+Aa;return Aa=new _t,t}};function Ta(t,e){Ma.point=Ca,$a=Sa=t,_a=Ea=e}function Ca(t,e){Sa-=t,Ea-=e,Aa.add(gs(Sa*Sa+Ea*Ea)),Sa=t,Ea=e}var Na=Ma;function Ra(){this._string=[]}function Pa(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function qa(t,e){var r,n,i=4.5;function s(t){return t&&("function"==typeof i&&n.pointRadius(+i.apply(this,arguments)),Ss(t,r(n))),n.result()}return s.area=function(t){return Ss(t,r(Vs)),Vs.result()},s.measure=function(t){return Ss(t,r(Na)),Na.result()},s.bounds=function(t){return Ss(t,r(ta)),ta.result()},s.centroid=function(t){return Ss(t,r(wa)),wa.result()},s.projection=function(e){return arguments.length?(r=null==e?(t=null,Fs):(t=e).stream,s):t},s.context=function(t){return arguments.length?(n=null==t?(e=null,new Ra):new xa(e=t),"function"!=typeof i&&n.pointRadius(i),s):e},s.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(n.pointRadius(+t),+t),s):i},s.projection(t).context(e)}function za(){}function Fa(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Ss(r,t.stream(ta)),e(ta.result()),null!=n&&t.clipExtent(n),t}function Oa(t,e,r){return Fa(t,(function(r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(n/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(n-s*(r[1][0]+r[0][0]))/2,o=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,o])}),r)}function Ua(){var t,e,r,n,i,s,a,o,l=1,c=0,h=0,u=1,d=1,p=0,f=null,m=1,b=1,v=(o={point:function(t,e){var r=w([t,e]);this.stream.point(r[0],r[1])}},function(t){var e=new za;for(var r in o)e[r]=o[r];return e.stream=t,e}),g=Fs;function y(){return m=l*u,b=l*d,s=a=null,w}function w(r){var n=r[0]*m,i=r[1]*b;if(p){var s=i*t-n*e;n=n*t+i*e,i=s}return[n+c,i+h]}return w.invert=function(r){var n=r[0]-c,i=r[1]-h;if(p){var s=i*t+n*e;n=n*t-i*e,i=s}return[n/m,i/b]},w.stream=function(t){return s&&a===t?s:s=v(g(a=t))},w.postclip=function(t){return arguments.length?(g=t,f=r=n=i=null,y()):g},w.clipExtent=function(t){return arguments.length?(g=null==t?(f=r=n=i=null,Fs):Ns(f=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),y()):null==f?null:[[f,r],[n,i]]},w.scale=function(t){return arguments.length?(l=+t,y()):l},w.translate=function(t){return arguments.length?(c=+t[0],h=+t[1],y()):[c,h]},w.angle=function(r){return arguments.length?(e=vs(p=r%360*fs),t=bs(p),y()):p*ps},w.reflectX=function(t){return arguments.length?(u=t?-1:1,y()):u<0},w.reflectY=function(t){return arguments.length?(d=t?-1:1,y()):d<0},w.fitExtent=function(t,e){return Oa(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return Oa(t,[[0,0],e],r)}(w,t,e)},w.fitWidth=function(t,e){return function(t,e,r){return Fa(t,(function(r){var n=+e,i=n/(r[1][0]-r[0][0]),s=(n-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w.fitHeight=function(t,e){return function(t,e,r){return Fa(t,(function(r){var n=+e,i=n/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(n-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w}function Ia(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ha(t){return+t}Ra.prototype={_radius:4.5,_circle:Pa(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Pa(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},za.prototype={constructor:za,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Da=[0,1];function La(t){return t}function ja(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Va(t,e,r){var n=t[0],i=t[1],s=e[0],a=e[1];return i<n?(n=ja(i,n),s=r(a,s)):(n=ja(n,i),s=r(s,a)),function(t){return s(n(t))}}function Ba(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),s=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)i[a]=ja(t[a],t[a+1]),s[a]=r(e[a],e[a+1]);return function(e){var r=kt(t,e,1,n)-1;return s[r](i[r](e))}}function Ka(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Xa(){var t,e,r,n,i,s,a=Da,o=Da,l=mn,c=La;function h(){var t=Math.min(a.length,o.length);return c!==La&&(c=function(t,e){var r;return t>e&&(r=t,t=e,e=r),function(r){return Math.max(t,Math.min(e,r))}}(a[0],a[t-1])),n=t>2?Ba:Va,i=s=null,u}function u(e){return null==e||isNaN(e=+e)?r:(i||(i=n(a.map(t),o,l)))(t(c(e)))}return u.invert=function(r){return c(e((s||(s=n(o,a.map(t),hn)))(r)))},u.domain=function(t){return arguments.length?(a=Array.from(t,Ha),h()):a.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),h()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=bn,h()},u.clamp=function(t){return arguments.length?(c=!!t||La,h()):c!==La},u.interpolate=function(t){return arguments.length?(l=t,h()):l},u.unknown=function(t){return arguments.length?(r=t,u):r},function(r,n){return t=r,e=n,h()}}function Wa(){return Xa()(La,La)}function Ya(t,e,r,n){var i,s=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=Mt?i*=10:s>=Tt?i*=5:s>=Ct&&(i*=2),e<t?-i:i}(t,e,r);switch((n=Qi(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Zi(e)/3)))-Zi(Math.abs(t)))}(s,a))||(n.precision=i),as(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Zi(e)-Zi(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(t){return Math.max(0,-Zi(Math.abs(t)))}(s))||(n.precision=i-2*("%"===n.type))}return ss(n)}function Za(t){var e=t.domain;return t.ticks=function(t){var r=e();return Nt(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return Ya(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,i,s=e(),a=0,o=s.length-1,l=s[a],c=s[o],h=10;for(c<l&&(i=l,l=c,c=i,i=a,a=o,o=i);h-- >0;){if((i=Rt(l,c,r))===n)return s[a]=l,s[o]=c,e(s);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}n=i}return t},t}function Ga(){var t=Wa();return t.copy=function(){return Ka(t,Ga())},Ia.apply(t,arguments),Za(t)}var Ja=function(t){for(var e=t.length/6|0,r=new Array(e),n=0;n<e;)r[n]="#"+t.slice(6*n,6*++n);return r}("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");function Qa(t){return function(){return t}}function to(t){this._context=t}function eo(t){return new to(t)}function ro(t){return t[0]}function no(t){return t[1]}function io(t,e){var r=Qa(!0),n=null,i=eo,s=null;function a(a){var o,l,c,h=(a=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(a)).length,u=!1;for(null==n&&(s=i(c=qi())),o=0;o<=h;++o)!(o<h&&r(l=a[o],o,a))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&s.point(+t(l,o,a),+e(l,o,a));if(c)return s=null,c+""||null}return t="function"==typeof t?t:void 0===t?ro:Qa(t),e="function"==typeof e?e:void 0===e?no:Qa(e),a.x=function(e){return arguments.length?(t="function"==typeof e?e:Qa(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:Qa(+t),a):e},a.defined=function(t){return arguments.length?(r="function"==typeof t?t:Qa(!!t),a):r},a.curve=function(t){return arguments.length?(i=t,null!=n&&(s=i(n)),a):i},a.context=function(t){return arguments.length?(null==t?n=s=null:s=i(n=t),a):n},a}function so(t,e,r){this.k=t,this.x=e,this.y=r}to.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)}}},so.prototype={constructor:so,scale:function(t){return 1===t?this:new so(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new so(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+")"}},so.prototype;class ao extends vt{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),dr(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",(t=>{dr(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)})).on("keydown.keyboard",(t=>{dr(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=an(t,"#ffffff")(.75),e.light50=an(t,"#ffffff")(.5),e.light25=an(t,"#ffffff")(.25),e.grey=t,e.dark25=an(t,"#000000")(.25),e.dark50=an(t,"#000000")(.5),e.dark75=an(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,r=!1){const n=this.shadows.opacityUmbra+this.shadows.opacityBoost,i=this.shadows.opacityPenumbra+this.shadows.opacityBoost,s=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=r?`rgba(${this.shadows.inverseBaselineColorString}, ${n})`:`rgba(${this.shadows.baselineColorString}, ${n})`,o=r?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,l=r?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,c=this.shadows.mapUmbra[t],h=this.shadows.mapPenumbra[t],u=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`} ${a}, ${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`} ${o}, ${e?`${-u.y}px ${u.y/2}px ${u.b}px ${u.s}px`:`${u.y/2}px ${u.y}px ${u.b}px ${u.s}px`} ${l}`}static get svgFilters(){const t=ao.shadows,e=t.elevations.map((e=>O`
40
+ var Gt,Jt;class Qt extends ut{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{var n,i;const s=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:null;s._$litPart$=a=new jt(e.insertBefore(xt(),t),t,void 0,null!=r?r:{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return zt}}Qt.finalized=!0,Qt._$litElement$=!0,null===(Gt=globalThis.litElementHydrateSupport)||void 0===Gt||Gt.call(globalThis,{LitElement:Qt});const te=globalThis.litElementPolyfillSupport;function ee(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function re(t){let e=t,r=t,n=t;function i(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<0?i=r+1:s=r}while(i<s)}return i}return 2!==t.length&&(e=(e,r)=>t(e)-r,r=ee,n=(e,r)=>ee(t(e),r)),{left:i,center:function(t,r,n=0,s=t.length){const a=i(t,r,n,s-1);return a>n&&e(t[a-1],r)>-e(t[a],r)?a-1:a},right:function(t,e,i=0,s=t.length){if(i<s){if(0!==r(e,e))return s;do{const r=i+s>>>1;n(t[r],e)<=0?i=r+1:s=r}while(i<s)}return i}}}null==te||te({LitElement:Qt}),(null!==(Jt=globalThis.litElementVersions)&&void 0!==Jt?Jt:globalThis.litElementVersions=[]).push("3.3.0");const ne=re(ee).right;re((function(t){return null===t?NaN:+t})).center;var ie=ne;function se(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}class ae{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n<this._n&&n<32;n++){const i=e[n],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(e[r++]=a),t=s}return e[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let e,r,n,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,r=t[--i],s=e+r,n=r-(s-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=s+r,r==e-s&&(s=e))}return s}}function oe(t){return t}var le=Array.prototype.slice;function ce(t){return()=>t}var he=Math.sqrt(50),ue=Math.sqrt(10),de=Math.sqrt(2);function pe(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=fe(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function fe(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=he?10:s>=ue?5:s>=de?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=he?10:s>=ue?5:s>=de?2:1)}function me(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}function be(){var t=oe,e=se,r=me;function n(n){Array.isArray(n)||(n=Array.from(n));var i,s,a=n.length,o=new Array(a);for(i=0;i<a;++i)o[i]=t(n[i],i,n);var l=e(o),c=l[0],h=l[1],u=r(o,c,h);if(!Array.isArray(u)){const t=h,r=+u;if(e===se&&([c,h]=function(t,e,r){let n;for(;;){const i=fe(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}(c,h,r)),(u=pe(c,h,r))[u.length-1]>=h)if(t>=h&&e===se){const t=fe(c,h,r);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else u.pop()}for(var d=u.length;u[0]<=c;)u.shift(),--d;for(;u[d-1]>h;)u.pop(),--d;var p,f=new Array(d+1);for(i=0;i<=d;++i)(p=f[i]=[]).x0=i>0?u[i-1]:c,p.x1=i<d?u[i]:h;for(i=0;i<a;++i)null!=(s=o[i])&&c<=s&&s<=h&&f[ie(u,s,0,d)].push(n[i]);return f}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:ce(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:ce([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?ce(le.call(t)):ce(t),n):r},n}function ve(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),s=new Array(i);++n<i;)s[n]=t+n*r;return s}function ge(t){return t}var ye=1,we=2,xe=3,$e=4,_e=1e-6;function ke(t){return"translate("+t+",0)"}function Se(t){return"translate(0,"+t+")"}function Ae(t){return e=>+t(e)}function Ee(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function Me(){return!this.__axis}function Te(t,e){var r=[],n=null,i=null,s=6,a=6,o=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=t===ye||t===$e?-1:1,h=t===$e||t===we?"x":"y",u=t===ye||t===xe?ke:Se;function d(d){var p=null==n?e.ticks?e.ticks.apply(e,r):e.domain():n,f=null==i?e.tickFormat?e.tickFormat.apply(e,r):ge:i,m=Math.max(s,0)+o,b=e.range(),v=+b[0]+l,g=+b[b.length-1]+l,y=(e.bandwidth?Ee:Ae)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),$=w.selectAll(".tick").data(p,e).order(),_=$.exit(),k=$.enter().append("g").attr("class","tick"),S=$.select("line"),A=$.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(k),S=S.merge(k.append("line").attr("stroke","currentColor").attr(h+"2",c*s)),A=A.merge(k.append("text").attr("fill","currentColor").attr(h,c*m).attr("dy",t===ye?"0em":t===xe?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),$=$.transition(d),S=S.transition(d),A=A.transition(d),_=_.transition(d).attr("opacity",_e).attr("transform",(function(t){return isFinite(t=y(t))?u(t+l):this.getAttribute("transform")})),k.attr("opacity",_e).attr("transform",(function(t){var e=this.parentNode.__axis;return u((e&&isFinite(e=e(t))?e:y(t))+l)}))),_.remove(),x.attr("d",t===$e||t===we?a?"M"+c*a+","+v+"H"+l+"V"+g+"H"+c*a:"M"+l+","+v+"V"+g:a?"M"+v+","+c*a+"V"+l+"H"+g+"V"+c*a:"M"+v+","+l+"H"+g),$.attr("opacity",1).attr("transform",(function(t){return u(y(t)+l)})),S.attr(h+"2",c*s),A.attr(h,c*m).text(f),w.filter(Me).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===we?"start":t===$e?"end":"middle"),w.each((function(){this.__axis=y}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),d):r.slice()},d.tickValues=function(t){return arguments.length?(n=null==t?null:Array.from(t),d):n&&n.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(s=a=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(o=+t,d):o},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Ce(t){return Te(xe,t)}function Ne(t){return Te($e,t)}var Re={value:()=>{}};function Pe(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new qe(n)}function qe(t){this._=t}function ze(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function Fe(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=Re,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}qe.prototype=Pe.prototype={constructor:qe,on:function(t,e){var r,n,i=this._,s=(n=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,o=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(r=(t=s[a]).type)i[r]=Fe(i[r],t.name,e);else if(null==e)for(r in i)i[r]=Fe(i[r],t.name,null);return this}for(;++a<o;)if((r=(t=s[a]).type)&&(r=ze(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new qe(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),s=0;s<r;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,r=(n=this._[t]).length;s<r;++s)n[s].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};var Oe="http://www.w3.org/1999/xhtml",He={svg:"http://www.w3.org/2000/svg",xhtml:Oe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ue(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),He.hasOwnProperty(e)?{space:He[e],local:t}:t}function Ie(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Oe&&e.documentElement.namespaceURI===Oe?e.createElement(t):e.createElementNS(r,t)}}function De(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Le(t){var e=Ue(t);return(e.local?De:Ie)(e)}function je(){}function Ve(t){return null==t?je:function(){return this.querySelector(t)}}function Be(){return[]}function Ke(t){return null==t?Be:function(){return this.querySelectorAll(t)}}function We(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function Xe(t){return function(){return this.matches(t)}}function Ye(t){return function(e){return e.matches(t)}}var Ze=Array.prototype.find;function Ge(){return this.firstElementChild}var Je=Array.prototype.filter;function Qe(){return Array.from(this.children)}function tr(t){return new Array(t.length)}function er(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function rr(t,e,r,n,i,s){for(var a,o=0,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new er(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function nr(t,e,r,n,i,s,a){var o,l,c,h=new Map,u=e.length,d=s.length,p=new Array(u);for(o=0;o<u;++o)(l=e[o])&&(p[o]=c=a.call(l,l.__data__,o,e)+"",h.has(c)?i[o]=l:h.set(c,l));for(o=0;o<d;++o)c=a.call(t,s[o],o,s)+"",(l=h.get(c))?(n[o]=l,l.__data__=s[o],h.delete(c)):r[o]=new er(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(p[o])===l&&(i[o]=l)}function ir(t){return t.__data__}function sr(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ar(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function or(t){return function(){this.removeAttribute(t)}}function lr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function cr(t,e){return function(){this.setAttribute(t,e)}}function hr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ur(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}}function dr(t,e){return function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function pr(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function fr(t){return function(){this.style.removeProperty(t)}}function mr(t,e,r){return function(){this.style.setProperty(t,e,r)}}function br(t,e,r){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function vr(t,e){return t.style.getPropertyValue(e)||pr(t).getComputedStyle(t,null).getPropertyValue(e)}function gr(t){return function(){delete this[t]}}function yr(t,e){return function(){this[t]=e}}function wr(t,e){return function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}}function xr(t){return t.trim().split(/^|\s+/)}function $r(t){return t.classList||new _r(t)}function _r(t){this._node=t,this._names=xr(t.getAttribute("class")||"")}function kr(t,e){for(var r=$r(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Sr(t,e){for(var r=$r(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function Ar(t){return function(){kr(this,t)}}function Er(t){return function(){Sr(this,t)}}function Mr(t,e){return function(){(e.apply(this,arguments)?kr:Sr)(this,t)}}function Tr(){this.textContent=""}function Cr(t){return function(){this.textContent=t}}function Nr(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Rr(){this.innerHTML=""}function Pr(t){return function(){this.innerHTML=t}}function qr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function zr(){this.nextSibling&&this.parentNode.appendChild(this)}function Fr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Or(){return null}function Hr(){var t=this.parentNode;t&&t.removeChild(this)}function Ur(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ir(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Dr(t){return function(){var e=this.__on;if(e){for(var r,n=0,i=-1,s=e.length;n<s;++n)r=e[n],t.type&&r.type!==t.type||r.name!==t.name?e[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?e.length=i:delete this.__on}}}function Lr(t,e,r){return function(){var n,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),void(n.value=e);this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function jr(t,e,r){var n=pr(t),i=n.CustomEvent;"function"==typeof i?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Vr(t,e){return function(){return jr(this,t,e)}}function Br(t,e){return function(){return jr(this,t,e.apply(this,arguments))}}er.prototype={constructor:er,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)}},_r.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 Kr=[null];function Wr(t,e){this._groups=t,this._parents=e}function Xr(){return new Wr([[document.documentElement]],Kr)}function Yr(t){return"string"==typeof t?new Wr([[document.querySelector(t)]],[document.documentElement]):new Wr([[t]],Kr)}function Zr(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(e.getScreenCTM().inverse())).x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Wr.prototype=Xr.prototype={constructor:Wr,select:function(t){"function"!=typeof t&&(t=Ve(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a,o=e[i],l=o.length,c=n[i]=new Array(l),h=0;h<l;++h)(s=o[h])&&(a=t.call(s,s.__data__,h,o))&&("__data__"in s&&(a.__data__=s.__data__),c[h]=a);return new Wr(n,this._parents)},selectAll:function(t){t="function"==typeof t?We(t):Ke(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var a,o=e[s],l=o.length,c=0;c<l;++c)(a=o[c])&&(n.push(t.call(a,a.__data__,c,o)),i.push(a));return new Wr(n,i)},selectChild:function(t){return this.select(null==t?Ge:function(t){return function(){return Ze.call(this.children,t)}}("function"==typeof t?t:Ye(t)))},selectChildren:function(t){return this.selectAll(null==t?Qe:function(t){return function(){return Je.call(this.children,t)}}("function"==typeof t?t:Ye(t)))},filter:function(t){"function"!=typeof t&&(t=Xe(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new Wr(n,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,ir);var r=e?nr:rr,n=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var s=i.length,a=new Array(s),o=new Array(s),l=new Array(s),c=0;c<s;++c){var h=n[c],u=i[c],d=u.length,p=sr(t.call(h,h&&h.__data__,c,n)),f=p.length,m=o[c]=new Array(f),b=a[c]=new Array(f);r(h,u,m,b,l[c]=new Array(d),p,e);for(var v,g,y=0,w=0;y<f;++y)if(v=m[y]){for(y>=w&&(w=y+1);!(g=b[w])&&++w<f;);v._next=g||null}}return(a=new Wr(a,n))._enter=o,a._exit=l,a},enter:function(){return new Wr(this._enter||this._groups.map(tr),this._parents)},exit:function(){return new Wr(this._exit||this._groups.map(tr),this._parents)},join:function(t,e,r){var n=this.enter(),i=this,s=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==r?s.remove():r(s),n&&i?n.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var c,h=r[l],u=n[l],d=h.length,p=o[l]=new Array(d),f=0;f<d;++f)(c=h[f]||u[f])&&(p[f]=c);for(;l<i;++l)o[l]=r[l];return new Wr(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n,i=t[e],s=i.length-1,a=i[s];--s>=0;)(n=i[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}t||(t=ar);for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var a,o=r[s],l=o.length,c=i[s]=new Array(l),h=0;h<l;++h)(a=o[h])&&(c[h]=a);c.sort(e)}return new Wr(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var a=n[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i,s=e[r],a=0,o=s.length;a<o;++a)(i=s[a])&&t.call(i,i.__data__,a,s);return this},attr:function(t,e){var r=Ue(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==e?r.local?lr:or:"function"==typeof e?r.local?dr:ur:r.local?hr:cr)(r,e))},style:function(t,e,r){return arguments.length>1?this.each((null==e?fr:"function"==typeof e?br:mr)(t,e,null==r?"":r)):vr(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?gr:"function"==typeof e?wr:yr)(t,e)):this.node()[t]},classed:function(t,e){var r=xr(t+"");if(arguments.length<2){for(var n=$r(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof e?Mr:e?Ar:Er)(r,e))},text:function(t){return arguments.length?this.each(null==t?Tr:("function"==typeof t?Nr:Cr)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Rr:("function"==typeof t?qr:Pr)(t)):this.node().innerHTML},raise:function(){return this.each(zr)},lower:function(){return this.each(Fr)},append:function(t){var e="function"==typeof t?t:Le(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:Le(t),n=null==e?Or:"function"==typeof e?e:Ve(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)}))},remove:function(){return this.each(Hr)},clone:function(t){return this.select(t?Ir:Ur)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,r){var n,i,s=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}}))}(t+""),a=s.length;if(!(arguments.length<2)){for(o=e?Lr:Dr,n=0;n<a;++n)this.each(o(s[n],e,r));return this}var o=this.node().__on;if(o)for(var l,c=0,h=o.length;c<h;++c)for(n=0,l=o[c];n<a;++n)if((i=s[n]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Br:Vr)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n,i=t[e],s=0,a=i.length;s<a;++s)(n=i[s])&&(yield n)}};const Gr={passive:!1},Jr={capture:!0,passive:!1};function Qr(t){t.stopImmediatePropagation()}function tn(t){t.preventDefault(),t.stopImmediatePropagation()}var en=t=>()=>t;function rn(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:s,x:a,y:o,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function nn(t){return!t.ctrlKey&&!t.button}function sn(){return this.parentNode}function an(t,e){return null==e?{x:t.x,y:t.y}:e}function on(){return navigator.maxTouchPoints||"ontouchstart"in this}function ln(){var t,e,r,n,i=nn,s=sn,a=an,o=on,l={},c=Pe("start","drag","end"),h=0,u=0;function d(t){t.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",v,Gr).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(a,o){if(!n&&i.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(Yr(a.view).on("mousemove.drag",f,Jr).on("mouseup.drag",m,Jr),function(t){var e=t.document.documentElement,r=Yr(t).on("dragstart.drag",tn,Jr);"onselectstart"in e?r.on("selectstart.drag",tn,Jr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),Qr(a),r=!1,t=a.clientX,e=a.clientY,l("start",a))}}function f(n){if(tn(n),!r){var i=n.clientX-t,s=n.clientY-e;r=i*i+s*s>u}l.mouse("drag",n)}function m(t){Yr(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var r=t.document.documentElement,n=Yr(t).on("dragstart.drag",null);e&&(n.on("click.drag",tn,Jr),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(t.view,r),tn(t),l.mouse("end",t)}function b(t,e){if(i.call(this,t,e)){var r,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(r=0;r<l;++r)(n=y(this,o,t,e,a[r].identifier,a[r]))&&(Qr(t),n("start",t,a[r]))}}function v(t){var e,r,n=t.changedTouches,i=n.length;for(e=0;e<i;++e)(r=l[n[e].identifier])&&(tn(t),r("drag",t,n[e]))}function g(t){var e,r,i=t.changedTouches,s=i.length;for(n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),e=0;e<s;++e)(r=l[i[e].identifier])&&(Qr(t),r("end",t,i[e]))}function y(t,e,r,n,i,s){var o,u,p,f=c.copy(),m=Zr(s||r,e);if(null!=(p=a.call(t,new rn("beforestart",{sourceEvent:r,target:d,identifier:i,active:h,x:m[0],y:m[1],dx:0,dy:0,dispatch:f}),n)))return o=p.x-m[0]||0,u=p.y-m[1]||0,function r(s,a,c){var b,v=m;switch(s){case"start":l[i]=r,b=h++;break;case"end":delete l[i],--h;case"drag":m=Zr(c||a,e),b=h}f.call(s,t,new rn(s,{sourceEvent:a,subject:p,target:d,identifier:i,active:b,x:m[0]+o,y:m[1]+u,dx:m[0]-v[0],dy:m[1]-v[1],dispatch:f}),n)}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:en(!!t),d):i},d.container=function(t){return arguments.length?(s="function"==typeof t?t:en(t),d):s},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:en(t),d):a},d.touchable=function(t){return arguments.length?(o="function"==typeof t?t:en(!!t),d):o},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,d):Math.sqrt(u)},d}function cn(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function hn(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function un(){}rn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var dn=.7,pn=1/dn,fn="\\s*([+-]?\\d+)\\s*",mn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",bn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vn=/^#([0-9a-f]{3,8})$/,gn=new RegExp("^rgb\\("+[fn,fn,fn]+"\\)$"),yn=new RegExp("^rgb\\("+[bn,bn,bn]+"\\)$"),wn=new RegExp("^rgba\\("+[fn,fn,fn,mn]+"\\)$"),xn=new RegExp("^rgba\\("+[bn,bn,bn,mn]+"\\)$"),$n=new RegExp("^hsl\\("+[mn,bn,bn]+"\\)$"),_n=new RegExp("^hsla\\("+[mn,bn,bn,mn]+"\\)$"),kn={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 Sn(){return this.rgb().formatHex()}function An(){return this.rgb().formatRgb()}function En(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=vn.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?Mn(e):3===r?new Nn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Tn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Tn(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=gn.exec(t))?new Nn(e[1],e[2],e[3],1):(e=yn.exec(t))?new Nn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=wn.exec(t))?Tn(e[1],e[2],e[3],e[4]):(e=xn.exec(t))?Tn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=$n.exec(t))?zn(e[1],e[2]/100,e[3]/100,1):(e=_n.exec(t))?zn(e[1],e[2]/100,e[3]/100,e[4]):kn.hasOwnProperty(t)?Mn(kn[t]):"transparent"===t?new Nn(NaN,NaN,NaN,0):null}function Mn(t){return new Nn(t>>16&255,t>>8&255,255&t,1)}function Tn(t,e,r,n){return n<=0&&(t=e=r=NaN),new Nn(t,e,r,n)}function Cn(t,e,r,n){return 1===arguments.length?function(t){return t instanceof un||(t=En(t)),t?new Nn((t=t.rgb()).r,t.g,t.b,t.opacity):new Nn}(t):new Nn(t,e,r,null==n?1:n)}function Nn(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Rn(){return"#"+qn(this.r)+qn(this.g)+qn(this.b)}function Pn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function qn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function zn(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new On(t,e,r,n)}function Fn(t){if(t instanceof On)return new On(t.h,t.s,t.l,t.opacity);if(t instanceof un||(t=En(t)),!t)return new On;if(t instanceof On)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(a=e===s?(r-n)/o+6*(r<n):r===s?(n-e)/o+2:(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new On(a,o,l,t.opacity)}function On(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Hn(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}cn(un,En,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Sn,formatHex:Sn,formatHsl:function(){return Fn(this).formatHsl()},formatRgb:An,toString:An}),cn(Nn,Cn,hn(un,{brighter:function(t){return t=null==t?pn:Math.pow(pn,t),new Nn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?dn:Math.pow(dn,t),new Nn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:Rn,formatHex:Rn,formatRgb:Pn,toString:Pn})),cn(On,(function(t,e,r,n){return 1===arguments.length?Fn(t):new On(t,e,r,null==n?1:n)}),hn(un,{brighter:function(t){return t=null==t?pn:Math.pow(pn,t),new On(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?dn:Math.pow(dn,t),new On(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Nn(Hn(t>=240?t-240:t+120,i,n),Hn(t,i,n),Hn(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Un=t=>()=>t;function In(t){return 1==(t=+t)?Dn:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):Un(isNaN(e)?r:e)}}function Dn(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Un(isNaN(t)?e:t)}var Ln=function t(e){var r=In(e);function n(t,e){var n=r((t=Cn(t)).r,(e=Cn(e)).r),i=r(t.g,e.g),s=r(t.b,e.b),a=Dn(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function jn(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function Vn(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n);for(r=0;r<i;++r)s[r]=Gn(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=s[r](t);return a}}function Bn(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function Kn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Wn(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=Gn(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var Xn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yn=new RegExp(Xn.source,"g");function Zn(t,e){var r,n,i,s=Xn.lastIndex=Yn.lastIndex=0,a=-1,o=[],l=[];for(t+="",e+="";(r=Xn.exec(t))&&(n=Yn.exec(e));)(i=n.index)>s&&(i=e.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Kn(r,n)})),s=Yn.lastIndex;return s<e.length&&(i=e.slice(s),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)o[(r=l[n]).i]=r.x(t);return o.join("")})}function Gn(t,e){var r,n=typeof e;return null==e||"boolean"===n?Un(e):("number"===n?Kn:"string"===n?(r=En(e))?(e=r,Ln):Zn:e instanceof En?Ln:e instanceof Date?Bn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?jn:Array.isArray(e)?Vn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Wn:Kn)(t,e)}function Jn(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var Qn,ti=180/Math.PI,ei={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ri(t,e,r,n,i,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*ti,skewX:Math.atan(l)*ti,scaleX:a,scaleY:o}}function ni(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(s,a){var o=[],l=[];return s=t(s),a=t(a),function(t,n,i,s,a,o){if(t!==i||n!==s){var l=a.push("translate(",null,e,null,r);o.push({i:l-4,x:Kn(t,i)},{i:l-2,x:Kn(n,s)})}else(i||s)&&a.push("translate("+i+e+s+r)}(s.translateX,s.translateY,a.translateX,a.translateY,o,l),function(t,e,r,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:r.push(i(r)+"rotate(",null,n)-2,x:Kn(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,r,s){t!==e?s.push({i:r.push(i(r)+"skewX(",null,n)-2,x:Kn(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,r,n,s,a){if(t!==r||e!==n){var o=s.push(i(s)+"scale(",null,",",null,")");a.push({i:o-4,x:Kn(t,r)},{i:o-2,x:Kn(e,n)})}else 1===r&&1===n||s.push(i(s)+"scale("+r+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,r=-1,n=l.length;++r<n;)o[(e=l[r]).i]=e.x(t);return o.join("")}}}var ii,si,ai=ni((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ei:ri(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),oi=ni((function(t){return null==t?ei:(Qn||(Qn=document.createElementNS("http://www.w3.org/2000/svg","g")),Qn.setAttribute("transform",t),(t=Qn.transform.baseVal.consolidate())?ri((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ei)}),", ",")",")"),li=0,ci=0,hi=0,ui=1e3,di=0,pi=0,fi=0,mi="object"==typeof performance&&performance.now?performance:Date,bi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function vi(){return pi||(bi(gi),pi=mi.now()+fi)}function gi(){pi=0}function yi(){this._call=this._time=this._next=null}function wi(t,e,r){var n=new yi;return n.restart(t,e,r),n}function xi(){pi=(di=mi.now())+fi,li=ci=0;try{!function(){vi(),++li;for(var t,e=ii;e;)(t=pi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--li}()}finally{li=0,function(){var t,e,r=ii,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:ii=e);si=t,_i(n)}(),pi=0}}function $i(){var t=mi.now(),e=t-di;e>ui&&(fi-=e,di=t)}function _i(t){li||(ci&&(ci=clearTimeout(ci)),t-pi>24?(t<1/0&&(ci=setTimeout(xi,t-mi.now()-fi)),hi&&(hi=clearInterval(hi))):(hi||(di=mi.now(),hi=setInterval($i,ui)),li=1,bi(xi)))}function ki(t,e,r){var n=new yi;return e=null==e?0:+e,n.restart((r=>{n.stop(),t(r+e)}),e,r),n}yi.prototype=wi.prototype={constructor:yi,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?vi():+r)+(null==e?0:+e),this._next||si===this||(si?si._next=this:ii=this,si=this),this._call=t,this._time=r,_i()},stop:function(){this._call&&(this._call=null,this._time=1/0,_i())}};var Si=Pe("start","end","cancel","interrupt"),Ai=[],Ei=0,Mi=1,Ti=2,Ci=3,Ni=4,Ri=5,Pi=6;function qi(t,e,r,n,i,s){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,e,r){var n,i=t.__transition;function s(t){r.state=Mi,r.timer.restart(a,r.delay,r.time),r.delay<=t&&a(t-r.delay)}function a(s){var c,h,u,d;if(r.state!==Mi)return l();for(c in i)if((d=i[c]).name===r.name){if(d.state===Ci)return ki(a);d.state===Ni?(d.state=Pi,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=Pi,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(ki((function(){r.state===Ci&&(r.state=Ni,r.timer.restart(o,r.delay,r.time),o(s))})),r.state=Ti,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Ti){for(r.state=Ci,n=new Array(u=r.tween.length),c=0,h=-1;c<u;++c)(d=r.tween[c].value.call(t,t.__data__,r.index,r.group))&&(n[++h]=d);n.length=h+1}}function o(e){for(var i=e<r.duration?r.ease.call(null,e/r.duration):(r.timer.restart(l),r.state=Ri,1),s=-1,a=n.length;++s<a;)n[s].call(t,i);r.state===Ri&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){for(var n in r.state=Pi,r.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=r,r.timer=wi(s,0,r.time)}(t,r,{name:e,index:n,group:i,on:Si,tween:Ai,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ei})}function zi(t,e){var r=Oi(t,e);if(r.state>Ei)throw new Error("too late; already scheduled");return r}function Fi(t,e){var r=Oi(t,e);if(r.state>Ci)throw new Error("too late; already running");return r}function Oi(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function Hi(t,e){var r,n;return function(){var i=Fi(this,t),s=i.tween;if(s!==r)for(var a=0,o=(n=r=s).length;a<o;++a)if(n[a].name===e){(n=n.slice()).splice(a,1);break}i.tween=n}}function Ui(t,e,r){var n,i;if("function"!=typeof r)throw new Error;return function(){var s=Fi(this,t),a=s.tween;if(a!==n){i=(n=a).slice();for(var o={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=o;break}l===c&&i.push(o)}s.tween=i}}function Ii(t,e,r){var n=t._id;return t.each((function(){var t=Fi(this,n);(t.value||(t.value={}))[e]=r.apply(this,arguments)})),function(t){return Oi(t,n).value[e]}}function Di(t,e){var r;return("number"==typeof e?Kn:e instanceof En?Ln:(r=En(e))?(e=r,Ln):Zn)(t,e)}function Li(t){return function(){this.removeAttribute(t)}}function ji(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Vi(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttribute(t);return a===s?null:a===n?i:i=e(n=a,r)}}function Bi(t,e,r){var n,i,s=r+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===n?i:i=e(n=a,r)}}function Ki(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttribute(t))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttribute(t)}}function Wi(t,e,r){var n,i,s;return function(){var a,o,l=r(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:a===n&&o===i?s:(i=o,s=e(n=a,l));this.removeAttributeNS(t.space,t.local)}}function Xi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&function(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}(t,i)),r}return i._value=e,i}function Yi(t,e){var r,n;function i(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&function(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}(t,i)),r}return i._value=e,i}function Zi(t,e){return function(){zi(this,t).delay=+e.apply(this,arguments)}}function Gi(t,e){return e=+e,function(){zi(this,t).delay=e}}function Ji(t,e){return function(){Fi(this,t).duration=+e.apply(this,arguments)}}function Qi(t,e){return e=+e,function(){Fi(this,t).duration=e}}var ts=Xr.prototype.constructor;function es(t){return function(){this.style.removeProperty(t)}}var rs=0;function ns(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function is(){return++rs}var ss=Xr.prototype;ns.prototype={constructor:ns,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=Ve(t));for(var n=this._groups,i=n.length,s=new Array(i),a=0;a<i;++a)for(var o,l,c=n[a],h=c.length,u=s[a]=new Array(h),d=0;d<h;++d)(o=c[d])&&(l=t.call(o,o.__data__,d,c))&&("__data__"in o&&(l.__data__=o.__data__),u[d]=l,qi(u[d],e,r,d,u,Oi(o,r)));return new ns(s,this._parents,e,r)},selectAll:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=Ke(t));for(var n=this._groups,i=n.length,s=[],a=[],o=0;o<i;++o)for(var l,c=n[o],h=c.length,u=0;u<h;++u)if(l=c[u]){for(var d,p=t.call(l,l.__data__,u,c),f=Oi(l,r),m=0,b=p.length;m<b;++m)(d=p[m])&&qi(d,e,r,m,p,f);s.push(p),a.push(l)}return new ns(s,a,e,r)},selectChild:ss.selectChild,selectChildren:ss.selectChildren,filter:function(t){"function"!=typeof t&&(t=Xe(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s,a=e[i],o=a.length,l=n[i]=[],c=0;c<o;++c)(s=a[c])&&t.call(s,s.__data__,c,a)&&l.push(s);return new ns(n,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),a=new Array(n),o=0;o<s;++o)for(var l,c=e[o],h=r[o],u=c.length,d=a[o]=new Array(u),p=0;p<u;++p)(l=c[p]||h[p])&&(d[p]=l);for(;o<n;++o)a[o]=e[o];return new ns(a,this._parents,this._name,this._id)},selection:function(){return new ts(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,r=is(),n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)if(a=o[c]){var h=Oi(a,e);qi(a,t,r,c,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new ns(n,this._parents,t,r)},call:ss.call,nodes:ss.nodes,node:ss.node,size:ss.size,empty:ss.empty,each:ss.each,on:function(t,e){var r=this._id;return arguments.length<2?Oi(this.node(),r).on.on(t):this.each(function(t,e,r){var n,i,s=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)?zi:Fi;return function(){var a=s(this,t),o=a.on;o!==n&&(i=(n=o).copy()).on(e,r),a.on=i}}(r,t,e))},attr:function(t,e){var r=Ue(t),n="transform"===r?oi:Di;return this.attrTween(t,"function"==typeof e?(r.local?Wi:Ki)(r,n,Ii(this,"attr."+t,e)):null==e?(r.local?ji:Li)(r):(r.local?Bi:Vi)(r,n,e))},attrTween:function(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var n=Ue(t);return this.tween(r,(n.local?Xi:Yi)(n,e))},style:function(t,e,r){var n="transform"==(t+="")?ai:Di;return null==e?this.styleTween(t,function(t,e){var r,n,i;return function(){var s=vr(this,t),a=(this.style.removeProperty(t),vr(this,t));return s===a?null:s===r&&a===n?i:i=e(r=s,n=a)}}(t,n)).on("end.style."+t,es(t)):"function"==typeof e?this.styleTween(t,function(t,e,r){var n,i,s;return function(){var a=vr(this,t),o=r(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=vr(this,t)),a===l?null:a===n&&l===i?s:(i=l,s=e(n=a,o))}}(t,n,Ii(this,"style."+t,e))).each(function(t,e){var r,n,i,s,a="style."+e,o="end."+a;return function(){var l=Fi(this,t),c=l.on,h=null==l.value[a]?s||(s=es(e)):void 0;c===r&&i===h||(n=(r=c).copy()).on(o,i=h),l.on=n}}(this._id,t)):this.styleTween(t,function(t,e,r){var n,i,s=r+"";return function(){var a=vr(this,t);return a===s?null:a===n?i:i=e(n=a,r)}}(t,n,e),r).on("end.style."+t,null)},styleTween:function(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(t,e,r){var n,i;function s(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&function(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}(t,s,r)),n}return s._value=e,s}(t,e,null==r?"":r))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ii(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,r;function n(){var n=t.apply(this,arguments);return n!==r&&(e=(r=n)&&function(t){return function(e){this.textContent=t.call(this,e)}}(n)),e}return n._value=t,n}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n,i=Oi(this.node(),r).tween,s=0,a=i.length;s<a;++s)if((n=i[s]).name===t)return n.value;return null}return this.each((null==e?Hi:Ui)(r,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Zi:Gi)(e,t)):Oi(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ji:Qi)(e,t)):Oi(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(){Fi(this,t).ease=e}}(e,t)):Oi(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var r=e.apply(this,arguments);if("function"!=typeof r)throw new Error;Fi(this,t).ease=r}}(this._id,t))},end:function(){var t,e,r=this,n=r._id,i=r.size();return new Promise((function(s,a){var o={value:a},l={value:function(){0==--i&&s()}};r.each((function(){var r=Fi(this,n),i=r.on;i!==t&&((e=(t=i).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),r.on=e})),0===i&&s()}))},[Symbol.iterator]:ss[Symbol.iterator]};const as=t=>+t;function os(t){return t*t*t}function ls(t){return--t*t*t+1}var cs={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function hs(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}Xr.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var r,n,i,s=t.__transition,a=!0;if(s){for(i in e=null==e?null:e+"",s)(r=s[i]).name===e?(n=r.state>Ti&&r.state<Ri,r.state=Pi,r.timer.stop(),r.on.call(n?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete s[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Xr.prototype.transition=function(t){var e,r;t instanceof ns?(e=t._id,t=t._name):(e=is(),(r=cs).time=vi(),t=null==t?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var a,o=n[s],l=o.length,c=0;c<l;++c)(a=o[c])&&qi(a,t,e,c,o,r||hs(a,e));return new ns(n,this._parents,t,e)};const us=Math.PI,ds=2*us,ps=1e-6,fs=ds-ps;function ms(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function bs(){return new ms}ms.prototype=bs.prototype={constructor:ms,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,s){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+s)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var s=this._x1,a=this._y1,o=r-t,l=n-e,c=s-t,h=a-e,u=c*c+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(u>ps)if(Math.abs(h*o-l*c)>ps&&i){var d=r-s,p=n-a,f=o*o+l*l,m=d*d+p*p,b=Math.sqrt(f),v=Math.sqrt(u),g=i*Math.tan((us-Math.acos((f+u-m)/(2*b*v)))/2),y=g/v,w=g/b;Math.abs(y-1)>ps&&(this._+="L"+(t+y*c)+","+(e+y*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>c*p)+","+(this._x1=t+w*o)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,r,n,i,s){t=+t,e=+e,s=!!s;var a=(r=+r)*Math.cos(n),o=r*Math.sin(n),l=t+a,c=e+o,h=1^s,u=s?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>ps||Math.abs(this._y1-c)>ps)&&(this._+="L"+l+","+c),r&&(u<0&&(u=u%ds+ds),u>fs?this._+="A"+r+","+r+",0,1,"+h+","+(t-a)+","+(e-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=c):u>ps&&(this._+="A"+r+","+r+",0,"+ +(u>=us)+","+h+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};var vs=Math.sqrt(50),gs=Math.sqrt(10),ys=Math.sqrt(2);function ws(t,e,r){var n,i,s,a,o=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=function(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),s=n/Math.pow(10,i);return i>=0?(s>=vs?10:s>=gs?5:s>=ys?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=vs?10:s>=gs?5:s>=ys?2:1)}(t,e,r))||!isFinite(a))return[];if(a>0){let r=Math.round(t/a),n=Math.round(e/a);for(r*a<t&&++r,n*a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)*a}else{a=-a;let r=Math.round(t*a),n=Math.round(e*a);for(r/a<t&&++r,n/a>e&&--n,s=new Array(i=n-r+1);++o<i;)s[o]=(r+o)/a}return n&&s.reverse(),s}function xs(t){return Math.ceil(Math.log(function(t,e){let r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}(t))/Math.LN2)+1}var $s=Array.prototype.slice;function _s(t,e){return t-e}var ks=t=>()=>t;function Ss(t,e){for(var r,n=-1,i=e.length;++n<i;)if(r=As(t,e[n]))return r;return 0}function As(t,e){for(var r=e[0],n=e[1],i=-1,s=0,a=t.length,o=a-1;s<a;o=s++){var l=t[s],c=l[0],h=l[1],u=t[o],d=u[0],p=u[1];if(Es(l,u,e))return 0;h>n!=p>n&&r<(d-c)*(n-h)/(p-h)+c&&(i=-i)}return i}function Es(t,e,r){var n;return function(t,e,r){return(e[0]-t[0])*(r[1]-t[1])==(r[0]-t[0])*(e[1]-t[1])}(t,e,r)&&function(t,e,r){return t<=e&&e<=r||r<=e&&e<=t}(t[n=+(t[0]===e[0])],r[n],e[n])}function Ms(){}var Ts=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Cs(){var t=1,e=1,r=xs,n=o;function i(t){var e=r(t);if(Array.isArray(e))e=e.slice().sort(_s);else{const r=function(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n<e&&(n=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===r?s>=s&&(r=n=s):(r>s&&(r=s),n<s&&(n=s)))}return[r,n]}(t),n=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=vs?i*=10:s>=gs?i*=5:s>=ys&&(i*=2),e<t?-i:i}(r[0],r[1],e);e=ws(Math.floor(r[0]/n)*n,Math.floor(r[1]/n-1)*n,e)}return e.map((e=>s(t,e)))}function s(r,i){var s=[],o=[];return function(r,n,i){var s,o,l,c,h,u,d=new Array,p=new Array;s=o=-1,c=r[0]>=n,Ts[c<<1].forEach(f);for(;++s<t-1;)l=c,c=r[s+1]>=n,Ts[l|c<<1].forEach(f);Ts[c<<0].forEach(f);for(;++o<e-1;){for(s=-1,c=r[o*t+t]>=n,h=r[o*t]>=n,Ts[c<<1|h<<2].forEach(f);++s<t-1;)l=c,c=r[o*t+t+s+1]>=n,u=h,h=r[o*t+s+1]>=n,Ts[l|c<<1|h<<2|u<<3].forEach(f);Ts[c|h<<3].forEach(f)}s=-1,h=r[o*t]>=n,Ts[h<<2].forEach(f);for(;++s<t-1;)u=h,h=r[o*t+s+1]>=n,Ts[h<<2|u<<3].forEach(f);function f(t){var e,r,n=[t[0][0]+s,t[0][1]+o],l=[t[1][0]+s,t[1][1]+o],c=a(n),h=a(l);(e=p[c])?(r=d[h])?(delete p[e.end],delete d[r.start],e===r?(e.ring.push(l),i(e.ring)):d[e.start]=p[r.end]={start:e.start,end:r.end,ring:e.ring.concat(r.ring)}):(delete p[e.end],e.ring.push(l),p[e.end=h]=e):(e=d[h])?(r=p[c])?(delete d[e.start],delete p[r.end],e===r?(e.ring.push(l),i(e.ring)):d[r.start]=p[e.end]={start:r.start,end:e.end,ring:r.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(n),d[e.start=c]=e):d[c]=p[h]={start:c,end:h,ring:[n,l]}}Ts[h<<3].forEach(f)}(r,i,(function(t){n(t,r,i),function(t){for(var e=0,r=t.length,n=t[r-1][1]*t[0][0]-t[r-1][0]*t[0][1];++e<r;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}(t)>0?s.push([t]):o.push(t)})),o.forEach((function(t){for(var e,r=0,n=s.length;r<n;++r)if(-1!==Ss((e=s[r])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function o(r,n,i){r.forEach((function(r){var s,a=r[0],o=r[1],l=0|a,c=0|o,h=n[c*t+l];a>0&&a<t&&l===a&&(s=n[c*t+l-1],r[0]=a+(i-s)/(h-s)-.5),o>0&&o<e&&c===o&&(s=n[(c-1)*t+l],r[1]=o+(i-s)/(h-s)-.5)}))}return i.contour=s,i.size=function(r){if(!arguments.length)return[t,e];var n=Math.floor(r[0]),s=Math.floor(r[1]);if(!(n>=0&&s>=0))throw new Error("invalid size");return t=n,e=s,i},i.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?ks($s.call(t)):ks(t),i):r},i.smooth=function(t){return arguments.length?(n=t?o:Ms,i):n===o},i}function Ns(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Rs(t){return(t=Ns(Math.abs(t)))?t[1]:NaN}var Ps,qs=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zs(t){if(!(e=qs.exec(t)))throw new Error("invalid format: "+t);var e;return new Fs({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 Fs(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 Os(t,e){var r=Ns(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}zs.prototype=Fs.prototype,Fs.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 Hs={"%":(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)=>Os(100*t,e),r:Os,s:function(t,e){var r=Ns(t,e);if(!r)return t+"";var n=r[0],i=r[1],s=i-(Ps=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+Ns(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Us(t){return t}var Is,Ds,Ls,js=Array.prototype.map,Vs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Bs(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?Us:(e=js.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var i=t.length,s=[],a=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(i-=o,i+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return s.reverse().join(r)}),i=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Us:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(js.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=zs(t)).fill,r=t.align,u=t.sign,d=t.symbol,p=t.zero,f=t.width,m=t.comma,b=t.precision,v=t.trim,g=t.type;"n"===g?(m=!0,g="g"):Hs[g]||(void 0===b&&(b=12),v=!0,g="g"),(p||"0"===e&&"="===r)&&(p=!0,e="0",r="=");var y="$"===d?i:"#"===d&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===d?s:/[%p]/.test(g)?l:"",x=Hs[g],$=/[defgprs%]/.test(g);function _(t){var i,s,l,d=y,_=w;if("c"===g)_=x(t)+_,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),b),v&&(t=function(t){t:for(var e,r=t.length,n=1,i=-1;n<r;++n)switch(t[n]){case".":i=e=n;break;case"0":0===i&&(i=n),e=n;break;default:if(!+t[n])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==u&&(k=!1),d=(k?"("===u?u:c:"-"===u||"("===u?"":u)+d,_=("s"===g?Vs[8+Ps/3]:"")+_+(k&&"("===u?")":""),$)for(i=-1,s=t.length;++i<s;)if(48>(l=t.charCodeAt(i))||l>57){_=(46===l?a+t.slice(i+1):t.slice(i))+_,t=t.slice(0,i);break}}m&&!p&&(t=n(t,1/0));var S=d.length+t.length+_.length,A=S<f?new Array(f-S+1).join(e):"";switch(m&&p&&(t=n(A+t,A.length?f-_.length:1/0),A=""),r){case"<":t=d+t+_+A;break;case"=":t=d+A+t+_;break;case"^":t=A.slice(0,S=A.length>>1)+d+t+_+A.slice(S);break;default:t=A+d+t+_}return o(t)}return b=void 0===b?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),_.toString=function(){return t+""},_}return{format:u,formatPrefix:function(t,e){var r=u(((t=zs(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(Rs(e)/3))),i=Math.pow(10,-n),s=Vs[8+n/3];return function(t){return r(i*t)+s}}}}Is=Bs({thousands:",",grouping:[3],currency:["$",""]}),Ds=Is.format,Ls=Is.formatPrefix;var Ks=1e-6,Ws=Math.PI,Xs=2*Ws,Ys=180/Ws,Zs=Ws/180,Gs=Math.abs,Js=Math.cos,Qs=Math.sin,ta=Math.sqrt;function ea(){}function ra(t,e){t&&ia.hasOwnProperty(t.type)&&ia[t.type](t,e)}var na={Feature:function(t,e){ra(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)ra(r[n].geometry,e)}},ia={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){sa(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)sa(r[n],e,0)},Polygon:function(t,e){aa(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)aa(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)ra(r[n],e)}};function sa(t,e,r){var n,i=-1,s=t.length-r;for(e.lineStart();++i<s;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function aa(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)sa(t[r],e,1);e.polygonEnd()}function oa(t,e){t&&na.hasOwnProperty(t.type)?na[t.type](t,e):ra(t,e)}function la(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function ca(t,e,r,n,i){var s,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],a=t[e];if(function(t,e){return Gs(t[0]-e[0])<Ks&&Gs(t[1]-e[1])<Ks}(n,a)){if(!n[2]&&!a[2]){for(i.lineStart(),s=0;s<e;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}a[0]+=2*Ks}o.push(r=new la(n,t,null,!0)),l.push(r.o=new la(n,null,r,!1)),o.push(r=new la(a,t,null,!1)),l.push(r.o=new la(a,null,r,!0))}})),o.length){for(l.sort(e),ha(o),ha(l),s=0,a=l.length;s<a;++s)l[s].e=r=!r;for(var c,h,u=o[0];;){for(var d=u,p=!0;d.v;)if((d=d.n)===u)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(s=0,a=c.length;s<a;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(c=d.p.z,s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1]);else n(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function ha(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}var ua=1e9,da=-ua;function pa(t,e,r,n){function i(i,s){return t<=i&&i<=r&&e<=s&&s<=n}function s(i,s,o,c){var h=0,u=0;if(null==i||(h=a(i,o))!==(u=a(s,o))||l(i,s)<0^o>0)do{c.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+o+4)%4)!==u);else c.point(s[0],s[1])}function a(n,i){return Gs(n[0]-t)<Ks?i>0?0:3:Gs(n[0]-r)<Ks?i>0?2:1:Gs(n[1]-e)<Ks?i>0?1:0:i>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,h,u,d,p,f,m,b,v,g,y=a,w=function(){var t,e=[];return{point:function(e,r,n){t.push([e,r,n])},lineStart:function(){e.push(t=[])},lineEnd:ea,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}(),x={point:$,lineStart:function(){x.point=_,c&&c.push(h=[]);v=!0,b=!1,f=m=NaN},lineEnd:function(){l&&(_(u,d),p&&b&&w.rejoin(),l.push(w.result()));x.point=$,b&&y.lineEnd()},polygonStart:function(){y=w,l=[],c=[],g=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=c.length;r<i;++r)for(var s,a,o=c[r],l=1,h=o.length,u=o[0],d=u[0],p=u[1];l<h;++l)s=d,a=p,d=(u=o[l])[0],p=u[1],a<=n?p>n&&(d-s)*(n-a)>(p-a)*(t-s)&&++e:p<=n&&(d-s)*(n-a)<(p-a)*(t-s)&&--e;return e}(),r=g&&e,i=(u=l,l=Array.from(function*(t){for(const e of t)yield*e}(u))).length;var u;(r||i)&&(a.polygonStart(),r&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),i&&ca(l,o,e,s,a),a.polygonEnd());y=a,l=c=h=null}};function $(t,e){i(t,e)&&y.point(t,e)}function _(s,a){var o=i(s,a);if(c&&h.push([s,a]),v)u=s,d=a,p=o,v=!1,o&&(y.lineStart(),y.point(s,a));else if(o&&b)y.point(s,a);else{var l=[f=Math.max(da,Math.min(ua,f)),m=Math.max(da,Math.min(ua,m))],w=[s=Math.max(da,Math.min(ua,s)),a=Math.max(da,Math.min(ua,a))];!function(t,e,r,n,i,s){var a,o=t[0],l=t[1],c=0,h=1,u=e[0]-o,d=e[1]-l;if(a=r-o,u||!(a>0)){if(a/=u,u<0){if(a<c)return;a<h&&(h=a)}else if(u>0){if(a>h)return;a>c&&(c=a)}if(a=i-o,u||!(a<0)){if(a/=u,u<0){if(a>h)return;a>c&&(c=a)}else if(u>0){if(a<c)return;a<h&&(h=a)}if(a=n-l,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>c&&(c=a)}if(a=s-l,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<h&&(h=a)}return c>0&&(t[0]=o+c*u,t[1]=l+c*d),h<1&&(e[0]=o+h*u,e[1]=l+h*d),!0}}}}}(l,w,t,e,r,n)?o&&(y.lineStart(),y.point(s,a),g=!1):(b||(y.lineStart(),y.point(l[0],l[1])),y.point(w[0],w[1]),o||y.lineEnd(),g=!1)}f=s,m=a,b=o}return x}}var fa,ma,ba,va,ga=t=>t,ya=new ae,wa=new ae,xa={point:ea,lineStart:ea,lineEnd:ea,polygonStart:function(){xa.lineStart=$a,xa.lineEnd=Sa},polygonEnd:function(){xa.lineStart=xa.lineEnd=xa.point=ea,ya.add(Gs(wa)),wa=new ae},result:function(){var t=ya/2;return ya=new ae,t}};function $a(){xa.point=_a}function _a(t,e){xa.point=ka,fa=ba=t,ma=va=e}function ka(t,e){wa.add(va*t-ba*e),ba=t,va=e}function Sa(){ka(fa,ma)}var Aa=xa,Ea=1/0,Ma=Ea,Ta=-Ea,Ca=Ta,Na={point:function(t,e){t<Ea&&(Ea=t);t>Ta&&(Ta=t);e<Ma&&(Ma=e);e>Ca&&(Ca=e)},lineStart:ea,lineEnd:ea,polygonStart:ea,polygonEnd:ea,result:function(){var t=[[Ea,Ma],[Ta,Ca]];return Ta=Ca=-(Ma=Ea=1/0),t}};var Ra,Pa,qa,za,Fa=Na,Oa=0,Ha=0,Ua=0,Ia=0,Da=0,La=0,ja=0,Va=0,Ba=0,Ka={point:Wa,lineStart:Xa,lineEnd:Ga,polygonStart:function(){Ka.lineStart=Ja,Ka.lineEnd=Qa},polygonEnd:function(){Ka.point=Wa,Ka.lineStart=Xa,Ka.lineEnd=Ga},result:function(){var t=Ba?[ja/Ba,Va/Ba]:La?[Ia/La,Da/La]:Ua?[Oa/Ua,Ha/Ua]:[NaN,NaN];return Oa=Ha=Ua=Ia=Da=La=ja=Va=Ba=0,t}};function Wa(t,e){Oa+=t,Ha+=e,++Ua}function Xa(){Ka.point=Ya}function Ya(t,e){Ka.point=Za,Wa(qa=t,za=e)}function Za(t,e){var r=t-qa,n=e-za,i=ta(r*r+n*n);Ia+=i*(qa+t)/2,Da+=i*(za+e)/2,La+=i,Wa(qa=t,za=e)}function Ga(){Ka.point=Wa}function Ja(){Ka.point=to}function Qa(){eo(Ra,Pa)}function to(t,e){Ka.point=eo,Wa(Ra=qa=t,Pa=za=e)}function eo(t,e){var r=t-qa,n=e-za,i=ta(r*r+n*n);Ia+=i*(qa+t)/2,Da+=i*(za+e)/2,La+=i,ja+=(i=za*t-qa*e)*(qa+t),Va+=i*(za+e),Ba+=3*i,Wa(qa=t,za=e)}var ro=Ka;function no(t){this._context=t}no.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Xs)}},result:ea};var io,so,ao,oo,lo,co=new ae,ho={point:ea,lineStart:function(){ho.point=uo},lineEnd:function(){io&&po(so,ao),ho.point=ea},polygonStart:function(){io=!0},polygonEnd:function(){io=null},result:function(){var t=+co;return co=new ae,t}};function uo(t,e){ho.point=po,so=oo=t,ao=lo=e}function po(t,e){oo-=t,lo-=e,co.add(ta(oo*oo+lo*lo)),oo=t,lo=e}var fo=ho;function mo(){this._string=[]}function bo(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function vo(t,e){var r,n,i=4.5;function s(t){return t&&("function"==typeof i&&n.pointRadius(+i.apply(this,arguments)),oa(t,r(n))),n.result()}return s.area=function(t){return oa(t,r(Aa)),Aa.result()},s.measure=function(t){return oa(t,r(fo)),fo.result()},s.bounds=function(t){return oa(t,r(Fa)),Fa.result()},s.centroid=function(t){return oa(t,r(ro)),ro.result()},s.projection=function(e){return arguments.length?(r=null==e?(t=null,ga):(t=e).stream,s):t},s.context=function(t){return arguments.length?(n=null==t?(e=null,new mo):new no(e=t),"function"!=typeof i&&n.pointRadius(i),s):e},s.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(n.pointRadius(+t),+t),s):i},s.projection(t).context(e)}function go(){}function yo(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),oa(r,t.stream(Fa)),e(Fa.result()),null!=n&&t.clipExtent(n),t}function wo(t,e,r){return yo(t,(function(r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(n/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(n-s*(r[1][0]+r[0][0]))/2,o=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,o])}),r)}function xo(){var t,e,r,n,i,s,a,o,l=1,c=0,h=0,u=1,d=1,p=0,f=null,m=1,b=1,v=(o={point:function(t,e){var r=w([t,e]);this.stream.point(r[0],r[1])}},function(t){var e=new go;for(var r in o)e[r]=o[r];return e.stream=t,e}),g=ga;function y(){return m=l*u,b=l*d,s=a=null,w}function w(r){var n=r[0]*m,i=r[1]*b;if(p){var s=i*t-n*e;n=n*t+i*e,i=s}return[n+c,i+h]}return w.invert=function(r){var n=r[0]-c,i=r[1]-h;if(p){var s=i*t+n*e;n=n*t-i*e,i=s}return[n/m,i/b]},w.stream=function(t){return s&&a===t?s:s=v(g(a=t))},w.postclip=function(t){return arguments.length?(g=t,f=r=n=i=null,y()):g},w.clipExtent=function(t){return arguments.length?(g=null==t?(f=r=n=i=null,ga):pa(f=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),y()):null==f?null:[[f,r],[n,i]]},w.scale=function(t){return arguments.length?(l=+t,y()):l},w.translate=function(t){return arguments.length?(c=+t[0],h=+t[1],y()):[c,h]},w.angle=function(r){return arguments.length?(e=Qs(p=r%360*Zs),t=Js(p),y()):p*Ys},w.reflectX=function(t){return arguments.length?(u=t?-1:1,y()):u<0},w.reflectY=function(t){return arguments.length?(d=t?-1:1,y()):d<0},w.fitExtent=function(t,e){return wo(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return wo(t,[[0,0],e],r)}(w,t,e)},w.fitWidth=function(t,e){return function(t,e,r){return yo(t,(function(r){var n=+e,i=n/(r[1][0]-r[0][0]),s=(n-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w.fitHeight=function(t,e){return function(t,e,r){return yo(t,(function(r){var n=+e,i=n/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(n-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])}),r)}(w,t,e)},w}function $o(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function _o(t){return+t}mo.prototype={_radius:4.5,_circle:bo(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=bo(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},go.prototype={constructor:go,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var ko=[0,1];function So(t){return t}function Ao(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Eo(t,e,r){var n=t[0],i=t[1],s=e[0],a=e[1];return i<n?(n=Ao(i,n),s=r(a,s)):(n=Ao(n,i),s=r(s,a)),function(t){return s(n(t))}}function Mo(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),s=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)i[a]=Ao(t[a],t[a+1]),s[a]=r(e[a],e[a+1]);return function(e){var r=ie(t,e,1,n)-1;return s[r](i[r](e))}}function To(){var t,e,r,n,i,s,a=ko,o=ko,l=Gn,c=So;function h(){var t=Math.min(a.length,o.length);return c!==So&&(c=function(t,e){var r;return t>e&&(r=t,t=e,e=r),function(r){return Math.max(t,Math.min(e,r))}}(a[0],a[t-1])),n=t>2?Mo:Eo,i=s=null,u}function u(e){return null==e||isNaN(e=+e)?r:(i||(i=n(a.map(t),o,l)))(t(c(e)))}return u.invert=function(r){return c(e((s||(s=n(o,a.map(t),Kn)))(r)))},u.domain=function(t){return arguments.length?(a=Array.from(t,_o),h()):a.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),h()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),l=Jn,h()},u.clamp=function(t){return arguments.length?(c=!!t||So,h()):c!==So},u.interpolate=function(t){return arguments.length?(l=t,h()):l},u.unknown=function(t){return arguments.length?(r=t,u):r},function(r,n){return t=r,e=n,h()}}function Co(t,e,r,n){var i,s=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/i;return s>=he?i*=10:s>=ue?i*=5:s>=de&&(i*=2),e<t?-i:i}(t,e,r);switch((n=zs(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Rs(e)/3)))-Rs(Math.abs(t)))}(s,a))||(n.precision=i),Ls(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Rs(e)-Rs(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(t){return Math.max(0,-Rs(Math.abs(t)))}(s))||(n.precision=i-2*("%"===n.type))}return Ds(n)}function No(){var t=To()(So,So);return t.copy=function(){return e=t,No().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},$o.apply(t,arguments),function(t){var e=t.domain;return t.ticks=function(t){var r=e();return pe(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return Co(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,i,s=e(),a=0,o=s.length-1,l=s[a],c=s[o],h=10;for(c<l&&(i=l,l=c,c=i,i=a,a=o,o=i);h-- >0;){if((i=fe(l,c,r))===n)return s[a]=l,s[o]=c,e(s);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}n=i}return t},t}(t)}var Ro=function(t){for(var e=t.length/6|0,r=new Array(e),n=0;n<e;)r[n]="#"+t.slice(6*n,6*++n);return r}("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");function Po(t){return function(){return t}}function qo(t){this._context=t}function zo(t){return new qo(t)}function Fo(t){return t[0]}function Oo(t){return t[1]}function Ho(t,e){var r=Po(!0),n=null,i=zo,s=null;function a(a){var o,l,c,h=(a=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(a)).length,u=!1;for(null==n&&(s=i(c=bs())),o=0;o<=h;++o)!(o<h&&r(l=a[o],o,a))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&s.point(+t(l,o,a),+e(l,o,a));if(c)return s=null,c+""||null}return t="function"==typeof t?t:void 0===t?Fo:Po(t),e="function"==typeof e?e:void 0===e?Oo:Po(e),a.x=function(e){return arguments.length?(t="function"==typeof e?e:Po(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:Po(+t),a):e},a.defined=function(t){return arguments.length?(r="function"==typeof t?t:Po(!!t),a):r},a.curve=function(t){return arguments.length?(i=t,null!=n&&(s=i(n)),a):i},a.context=function(t){return arguments.length?(null==t?n=s=null:s=i(n=t),a):n},a}function Uo(t,e,r){this.k=t,this.x=e,this.y=r}qo.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)}}},Uo.prototype={constructor:Uo,scale:function(t){return 1===t?this:new Uo(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Uo(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+")"}},Uo.prototype;class Io extends Qt{getComputedStyleValue(t){return getComputedStyle(this).getPropertyValue(t).trim()}firstUpdated(t){super.firstUpdated(t),Yr(this.renderRoot.host).classed("keyboard",!0).on("mousemove.keyboard touchstart.keyboard",(t=>{Yr(t.currentTarget.renderRoot.host).classed("keyboard",!1).on("mousemove.keyboard touchstart.keyboard",null)})).on("keydown.keyboard",(t=>{Yr(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=Ln(t,"#ffffff")(.75),e.light50=Ln(t,"#ffffff")(.5),e.light25=Ln(t,"#ffffff")(.25),e.grey=t,e.dark25=Ln(t,"#000000")(.25),e.dark50=Ln(t,"#000000")(.5),e.dark75=Ln(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,r=!1){const n=this.shadows.opacityUmbra+this.shadows.opacityBoost,i=this.shadows.opacityPenumbra+this.shadows.opacityBoost,s=this.shadows.opacityAmbient+this.shadows.opacityBoost,a=r?`rgba(${this.shadows.inverseBaselineColorString}, ${n})`:`rgba(${this.shadows.baselineColorString}, ${n})`,o=r?`rgba(${this.shadows.inverseBaselineColorString}, ${i})`:`rgba(${this.shadows.baselineColorString}, ${i})`,l=r?`rgba(${this.shadows.inverseBaselineColorString}, ${s})`:`rgba(${this.shadows.baselineColorString}, ${s})`,c=this.shadows.mapUmbra[t],h=this.shadows.mapPenumbra[t],u=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`} ${a}, ${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`} ${o}, ${e?`${-u.y}px ${u.y/2}px ${u.b}px ${u.s}px`:`${u.y/2}px ${u.y}px ${u.b}px ${u.s}px`} ${l}`}static get svgFilters(){const t=Io.shadows,e=t.elevations.map((e=>qt`
34
41
  <filter id=${`shadow-${e}`} x="-250%" y="-250%" width="600%" height="600%">
35
42
  <feComponentTransfer in="SourceAlpha" result="solid">
36
43
  <feFuncA type="table" tableValues="0 1 1"/>
@@ -38,9 +45,9 @@ var mt,bt;ft.finalized=!0,ft.elementProperties=new Map,ft.elementStyles=[],ft.sh
38
45
  <feOffset in="solid" result="offU" dx=${t.mapUmbra[e].y/2} dy=${t.mapUmbra[e].y} />
39
46
  <feOffset in="solid" result="offP" dx=${t.mapPenumbra[e].y/2} dy=${t.mapPenumbra[e].y} />
40
47
  <feOffset in="solid" result="offA" dx=${t.mapAmbient[e].y/2} dy=${t.mapAmbient[e].y} />
41
- ${0===t.mapUmbra[e].s?O``:O`<feMorphology in="offU" result="spreadU" operator=${t.mapUmbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapUmbra[e].s)} />`}
42
- ${0===t.mapPenumbra[e].s?O``:O`<feMorphology in="offP" result="spreadP" operator=${t.mapPenumbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapPenumbra[e].s)} />`}
43
- ${0===t.mapAmbient[e].s?O``:O`<feMorphology in="offA" result="spreadA" operator=${t.mapAmbient[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapAmbient[e].s)} />`}
48
+ ${0===t.mapUmbra[e].s?qt``:qt`<feMorphology in="offU" result="spreadU" operator=${t.mapUmbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapUmbra[e].s)} />`}
49
+ ${0===t.mapPenumbra[e].s?qt``:qt`<feMorphology in="offP" result="spreadP" operator=${t.mapPenumbra[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapPenumbra[e].s)} />`}
50
+ ${0===t.mapAmbient[e].s?qt``:qt`<feMorphology in="offA" result="spreadA" operator=${t.mapAmbient[e].s>0?"dilate":"erode"} radius=${Math.abs(t.mapAmbient[e].s)} />`}
44
51
  <feGaussianBlur in=${0===t.mapUmbra[e].s?"offU":"spreadU"} result="blurU" stdDeviation=${t.mapUmbra[e].b/2} />
45
52
  <feGaussianBlur in=${0===t.mapPenumbra[e].s?"offP":"spreadP"} result="blurP" stdDeviation=${t.mapPenumbra[e].b/2} />
46
53
  <feGaussianBlur in=${0===t.mapAmbient[e].s?"offA":"spreadA"} result="blurA" stdDeviation=${t.mapAmbient[e].b/2} />
@@ -60,30 +67,30 @@ var mt,bt;ft.finalized=!0,ft.elementProperties=new Map,ft.elementStyles=[],ft.sh
60
67
  <feMergeNode in="finalA" />
61
68
  <feMergeNode in="SourceGraphic" />
62
69
  </feMerge>
63
- </filter>`));return O`
70
+ </filter>`));return qt`
64
71
  <svg class="defs">
65
72
  <defs>
66
73
  ${e}
67
74
  </defs>
68
75
  </svg>
69
- `}static get styles(){return it`
76
+ `}static get styles(){return rt`
70
77
  :host {
71
- ---shadow-0: var(--shadow-0, ${nt(this.cssBoxShadow(0))});
72
- ---shadow-2: var(--shadow-2, ${nt(this.cssBoxShadow(2))});
73
- ---shadow-4: var(--shadow-4, ${nt(this.cssBoxShadow(4))});
74
- ---shadow-8: var(--shadow-8, ${nt(this.cssBoxShadow(8))});
75
-
76
- ---color-background: var(--color-background, ${nt(this.greys.white)});
77
- ---color-border: var(--color-border, ${nt(this.greys.light75)});
78
- ---color-text: var(--color-text, ${nt(this.greys.dark75)});
79
- ---color-text-inverse: var(--color-text-inverse, ${nt(this.greys.white)});
80
- ---color-link: var(--color-link, ${nt(this.greys.dark25)});
81
- ---color-element-background: var(--color-element-background, ${nt(this.greys.light75)});
82
- ---color-element-disabled: var(--color-element-disabled, ${nt(this.greys.light50)});
83
- ---color-element-enabled: var(--color-element-enabled, ${nt(this.greys.dark25)});
84
- ---color-element-selected: var(--color-element-selected, ${nt(this.greys.grey)});
85
- ---color-element-border: var(--color-element-border, ${nt(this.greys.dark50)});
86
- ---color-element-emphasis: var(--color-element-emphasis, ${nt(this.greys.dark75)});
78
+ ---shadow-0: var(--shadow-0, ${et(this.cssBoxShadow(0))});
79
+ ---shadow-2: var(--shadow-2, ${et(this.cssBoxShadow(2))});
80
+ ---shadow-4: var(--shadow-4, ${et(this.cssBoxShadow(4))});
81
+ ---shadow-8: var(--shadow-8, ${et(this.cssBoxShadow(8))});
82
+
83
+ ---color-background: var(--color-background, ${et(this.greys.white)});
84
+ ---color-border: var(--color-border, ${et(this.greys.light75)});
85
+ ---color-text: var(--color-text, ${et(this.greys.dark75)});
86
+ ---color-text-inverse: var(--color-text-inverse, ${et(this.greys.white)});
87
+ ---color-link: var(--color-link, ${et(this.greys.dark25)});
88
+ ---color-element-background: var(--color-element-background, ${et(this.greys.light75)});
89
+ ---color-element-disabled: var(--color-element-disabled, ${et(this.greys.light50)});
90
+ ---color-element-enabled: var(--color-element-enabled, ${et(this.greys.dark25)});
91
+ ---color-element-selected: var(--color-element-selected, ${et(this.greys.grey)});
92
+ ---color-element-border: var(--color-element-border, ${et(this.greys.dark50)});
93
+ ---color-element-emphasis: var(--color-element-emphasis, ${et(this.greys.dark75)});
87
94
 
88
95
  ---font-family-base: var(--font-family-base, "Source Sans", sans-serif);
89
96
  ---font-family-math: var(--font-family-math, "Source Serif", serif);
@@ -123,7 +130,7 @@ var mt,bt;ft.finalized=!0,ft.elementProperties=new Map,ft.elementStyles=[],ft.sh
123
130
  width: 0;
124
131
  height: 0;
125
132
  }
126
- `}}customElements.define("decidables-button",class extends ao{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,it`
133
+ `}}customElements.define("decidables-button",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,rt`
127
134
  :host {
128
135
  margin: 0.25rem;
129
136
  }
@@ -176,7 +183,7 @@ var mt,bt;ft.finalized=!0,ft.elementProperties=new Map,ft.elementStyles=[],ft.sh
176
183
  outline: none;
177
184
  box-shadow: var(---shadow-8);
178
185
  }
179
- `]}render(){return F`
186
+ `]}render(){return Pt`
180
187
  <button ?disabled=${this.disabled}>
181
188
  <slot></slot>
182
189
  </button>
@@ -186,11 +193,11 @@ var mt,bt;ft.finalized=!0,ft.elementProperties=new Map,ft.elementStyles=[],ft.sh
186
193
  * Copyright 2018 Google LLC
187
194
  * SPDX-License-Identifier: BSD-3-Clause
188
195
  */
189
- const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends ao{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}changed(t){this.value=t.target.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,it`
196
+ const Do=t=>null!=t?t:F;customElements.define("decidables-slider",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}changed(t){this.value=t.target.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,rt`
190
197
  :host {
191
- ---shadow-2-rotate: var(--shadow-2-rotate, ${nt(this.cssBoxShadow(2,!0,!1))});
192
- ---shadow-4-rotate: var(--shadow-4-rotate, ${nt(this.cssBoxShadow(4,!0,!1))});
193
- ---shadow-8-rotate: var(--shadow-8-rotate, ${nt(this.cssBoxShadow(8,!0,!1))});
198
+ ---shadow-2-rotate: var(--shadow-2-rotate, ${et(this.cssBoxShadow(2,!0,!1))});
199
+ ---shadow-4-rotate: var(--shadow-4-rotate, ${et(this.cssBoxShadow(4,!0,!1))});
200
+ ---shadow-8-rotate: var(--shadow-8-rotate, ${et(this.cssBoxShadow(8,!0,!1))});
194
201
 
195
202
  display: flex;
196
203
 
@@ -436,15 +443,15 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
436
443
  :host(.keyboard) input[type=range]:enabled:focus:active::-ms-thumb {
437
444
  box-shadow: var(---shadow-8-rotate);
438
445
  }
439
- `]}render(){return F`
446
+ `]}render(){return Pt`
440
447
  <label for="slider">
441
448
  <slot></slot>
442
449
  </label>
443
450
  <div class="range">
444
- <input type="range" id="slider" min=${oo(this.min)} max=${oo(this.max)} step=${oo(this.step)} .value=${this.value} @change=${this.changed.bind(this)} @input=${this.inputted.bind(this)}>
451
+ <input type="range" id="slider" min=${Do(this.min)} max=${Do(this.max)} step=${Do(this.step)} .value=${this.value} @change=${this.changed.bind(this)} @input=${this.inputted.bind(this)}>
445
452
  </div>
446
- <decidables-spinner min=${oo(this.min)} max=${oo(this.max)} step=${oo(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}></decidables-spinner>
447
- `}});customElements.define("decidables-spinner",class extends ao{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,it`
453
+ <decidables-spinner min=${Do(this.min)} max=${Do(this.max)} step=${Do(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}></decidables-spinner>
454
+ `}});customElements.define("decidables-spinner",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0},max:{attribute:"max",type:Number,reflect:!0},min:{attribute:"min",type:Number,reflect:!0},step:{attribute:"step",type:Number,reflect:!0},value:{attribute:"value",type:Number,reflect:!0}}}constructor(){super(),this.disabled=!1,this.max=void 0,this.min=void 0,this.step=void 0,this.value=void 0}inputted(t){this.value=t.target.value}static get styles(){return[super.styles,rt`
448
455
  :host {
449
456
  ---decidables-spinner-font-size: var(--decidables-spinner-font-size, 1.125rem);
450
457
  ---decidables-spinner-input-width: var(--decidables-spinner-input-width, 4rem);
@@ -523,12 +530,12 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
523
530
  margin: 0;
524
531
  -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
525
532
  }
526
- `]}render(){return F`
533
+ `]}render(){return Pt`
527
534
  <label>
528
535
  <slot></slot>
529
- <input ?disabled=${this.disabled} type="number" min=${oo(this.min)} max=${oo(this.max)} step=${oo(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}>
536
+ <input ?disabled=${this.disabled} type="number" min=${Do(this.min)} max=${Do(this.max)} step=${Do(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}>
530
537
  </label>
531
- `}});customElements.define("decidables-switch",class extends ao{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0}))}static get styles(){return[super.styles,it`
538
+ `}});customElements.define("decidables-switch",class extends Io{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0}))}static get styles(){return[super.styles,rt`
532
539
  :host {
533
540
  display: flex;
534
541
 
@@ -647,7 +654,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
647
654
  :host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
648
655
  box-shadow: var(---shadow-8);
649
656
  }
650
- `]}render(){return F`
657
+ `]}render(){return Pt`
651
658
  <input type="checkbox" id="switch" ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
652
659
  <label for="switch">
653
660
  <slot name="off-label"></slot>
@@ -655,7 +662,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
655
662
  <label for="switch">
656
663
  <slot></slot>
657
664
  </label>
658
- `}});customElements.define("decidables-toggle",class extends ao{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,it`
665
+ `}});customElements.define("decidables-toggle",class extends Io{static get properties(){return{disabled:{attribute:"disabled",type:Boolean,reflect:!0}}}constructor(){super(),this.disabled=!1}static get styles(){return[super.styles,rt`
659
666
  fieldset {
660
667
  display: flex;
661
668
 
@@ -672,12 +679,12 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
672
679
  legend {
673
680
  text-align: center;
674
681
  }
675
- `]}render(){return F`
682
+ `]}render(){return Pt`
676
683
  <fieldset ?disabled=${this.disabled}>
677
684
  <legend><slot name="label"></slot></legend>
678
685
  <slot></slot>
679
686
  </fieldset>
680
- `}});customElements.define("decidables-toggle-option",class extends ao{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0},name:{attribute:"name",type:String,reflect:!0},value:{attribute:"value",type:String,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1,this.name=void 0,this.value=void 0}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0}))}static get styles(){return[super.styles,it`
687
+ `}});customElements.define("decidables-toggle-option",class extends Io{static get properties(){return{checked:{attribute:"checked",type:Boolean,reflect:!0},disabled:{attribute:"disabled",type:Boolean,reflect:!0},name:{attribute:"name",type:String,reflect:!0},value:{attribute:"value",type:String,reflect:!0}}}constructor(){super(),this.checked=!1,this.disabled=!1,this.name=void 0,this.value=void 0}changed(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0}))}static get styles(){return[super.styles,rt`
681
688
  :host {
682
689
  display: flex;
683
690
  }
@@ -770,62 +777,62 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
770
777
  outline: none;
771
778
  box-shadow: var(---shadow-8);
772
779
  }
773
- `]}render(){return F`
780
+ `]}render(){return Pt`
774
781
  <input type="radio" id="toggle-option" name=${this.name} value=${this.value} .checked=${this.checked} @change=${this.changed.bind(this)}>
775
782
  <label for="toggle-option">
776
783
  <slot></slot>
777
784
  </label>
778
- `}});const lo={fromAttribute:t=>t.split(/\s+/).map((t=>Number.parseFloat(t))),toAttribute:t=>t.length?t.map((t=>t.toFixed(3))).join(" "):null},co={fromAttribute:t=>new Set(t.split(/\s+/)),toAttribute:t=>t.size?[...t].join(" "):null};class ho extends ao{static get properties(){return{interactive:{attribute:"interactive",type:Boolean,reflect:!0}}}constructor(){super(),this.interactive=!1}static get colors(){return{h:Ja[2],m:Ja[4],fa:Ja[1],cr:Ja[0],hr:Ja[5],far:Ja[3],acc:Ja[8],d:Ja[7],c:Ja[6],s:"#4545d0",present:"#f032e6",absent:"#10dbc9",correct:"#ffffff",error:"#000000",nr:"#cccccc"}}static get lights(){return Object.keys(ho.colors).reduce(((t,e)=>(t[e]=an(ho.colors[e],"#ffffff")(.5),t)),{})}static get darks(){return Object.keys(ho.colors).reduce(((t,e)=>(t[e]=an(ho.colors[e],"#000000")(.5),t)),{})}static get styles(){return[super.styles,it`
785
+ `}});const Lo={fromAttribute:t=>t.split(/\s+/).map((t=>Number.parseFloat(t))),toAttribute:t=>t.length?t.map((t=>t.toFixed(3))).join(" "):null},jo={fromAttribute:t=>new Set(t.split(/\s+/)),toAttribute:t=>t.size?[...t].join(" "):null};class Vo extends Io{static get properties(){return{interactive:{attribute:"interactive",type:Boolean,reflect:!0}}}constructor(){super(),this.interactive=!1}static get colors(){return{h:Ro[2],m:Ro[4],fa:Ro[1],cr:Ro[0],hr:Ro[5],far:Ro[3],acc:Ro[8],d:Ro[7],c:Ro[6],s:"#4545d0",present:"#f032e6",absent:"#10dbc9",correct:"#ffffff",error:"#000000",nr:"#cccccc"}}static get lights(){return Object.keys(Vo.colors).reduce(((t,e)=>(t[e]=Ln(Vo.colors[e],"#ffffff")(.5),t)),{})}static get darks(){return Object.keys(Vo.colors).reduce(((t,e)=>(t[e]=Ln(Vo.colors[e],"#000000")(.5),t)),{})}static get styles(){return[super.styles,rt`
779
786
  :host {
780
- ---color-h: var(--color-h, ${nt(this.colors.h)});
781
- ---color-m: var(--color-m, ${nt(this.colors.m)});
782
- ---color-fa: var(--color-fa, ${nt(this.colors.fa)});
783
- ---color-cr: var(--color-cr, ${nt(this.colors.cr)});
784
- ---color-hr: var(--color-hr, ${nt(this.colors.hr)});
785
- ---color-far: var(--color-far, ${nt(this.colors.far)});
786
- ---color-acc: var(--color-acc, ${nt(this.colors.acc)});
787
- ---color-d: var(--color-d, ${nt(this.colors.d)});
788
- ---color-c: var(--color-c, ${nt(this.colors.c)});
789
- ---color-s: var(--color-s, ${nt(this.colors.s)});
790
- ---color-present: var(--color-present, ${nt(this.colors.present)});
791
- ---color-absent: var(--color-absent, ${nt(this.colors.absent)});
792
- ---color-correct: var(--color-correct, ${nt(this.colors.correct)});
793
- ---color-error: var(--color-error, ${nt(this.colors.error)});
794
- ---color-nr: var(--color-nr, ${nt(this.colors.nr)});
795
-
796
- ---color-h-light: var(--color-h-light, ${nt(this.lights.h)});
797
- ---color-m-light: var(--color-m-light, ${nt(this.lights.m)});
798
- ---color-fa-light: var(--color-fa-light, ${nt(this.lights.fa)});
799
- ---color-cr-light: var(--color-cr-light, ${nt(this.lights.cr)});
800
- ---color-hr-light: var(--color-hr-light, ${nt(this.lights.hr)});
801
- ---color-far-light: var(--color-far-light, ${nt(this.lights.far)});
802
- ---color-acc-light: var(--color-acc-light, ${nt(this.lights.acc)});
803
- ---color-d-light: var(--color-d-light, ${nt(this.lights.d)});
804
- ---color-c-light: var(--color-c-light, ${nt(this.lights.c)});
805
- ---color-s-light: var(--color-s-light, ${nt(this.lights.s)});
806
- ---color-present-light: var(--color-present-light, ${nt(this.lights.present)});
807
- ---color-absent-light: var(--color-absent-light, ${nt(this.lights.absent)});
808
- ---color-correct-light: var(--color-correct-light, ${nt(this.lights.correct)});
809
- ---color-error-light: var(--color-error-light, ${nt(this.lights.error)});
810
- ---color-nr-light: var(--color-nr-light, ${nt(this.lights.nr)});
811
-
812
- ---color-h-dark: var(--color-h-dark, ${nt(this.darks.h)});
813
- ---color-m-dark: var(--color-m-dark, ${nt(this.darks.m)});
814
- ---color-fa-dark: var(--color-fa-dark, ${nt(this.darks.fa)});
815
- ---color-cr-dark: var(--color-cr-dark, ${nt(this.darks.cr)});
816
- ---color-hr-dark: var(--color-hr-dark, ${nt(this.darks.hr)});
817
- ---color-far-dark: var(--color-far-dark, ${nt(this.darks.far)});
818
- ---color-acc-dark: var(--color-acc-dark, ${nt(this.darks.acc)});
819
- ---color-d-dark: var(--color-d-dark, ${nt(this.darks.d)});
820
- ---color-c-dark: var(--color-c-dark, ${nt(this.darks.c)});
821
- ---color-s-dark: var(--color-s-dark, ${nt(this.darks.s)});
822
- ---color-present-dark: var(--color-present-dark, ${nt(this.darks.present)});
823
- ---color-absent-dark: var(--color-absent-dark, ${nt(this.darks.absent)});
824
- ---color-correct-dark: var(--color-correct-dark, ${nt(this.darks.correct)});
825
- ---color-error-dark: var(--color-error-dark, ${nt(this.darks.error)});
826
- ---color-nr-dark: var(--color-nr-dark, ${nt(this.darks.nr)});
827
- }
828
- `]}}class uo extends ho{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},direction:{attribute:!1,type:Number,reflect:!1},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{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.direction=-1,this.lifetime=400,this.speed=50,this.width=NaN,this.height=NaN,this.rem=NaN,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.currentDirection=void 0,this.signals=["present","absent"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,it`
787
+ ---color-h: var(--color-h, ${et(this.colors.h)});
788
+ ---color-m: var(--color-m, ${et(this.colors.m)});
789
+ ---color-fa: var(--color-fa, ${et(this.colors.fa)});
790
+ ---color-cr: var(--color-cr, ${et(this.colors.cr)});
791
+ ---color-hr: var(--color-hr, ${et(this.colors.hr)});
792
+ ---color-far: var(--color-far, ${et(this.colors.far)});
793
+ ---color-acc: var(--color-acc, ${et(this.colors.acc)});
794
+ ---color-d: var(--color-d, ${et(this.colors.d)});
795
+ ---color-c: var(--color-c, ${et(this.colors.c)});
796
+ ---color-s: var(--color-s, ${et(this.colors.s)});
797
+ ---color-present: var(--color-present, ${et(this.colors.present)});
798
+ ---color-absent: var(--color-absent, ${et(this.colors.absent)});
799
+ ---color-correct: var(--color-correct, ${et(this.colors.correct)});
800
+ ---color-error: var(--color-error, ${et(this.colors.error)});
801
+ ---color-nr: var(--color-nr, ${et(this.colors.nr)});
802
+
803
+ ---color-h-light: var(--color-h-light, ${et(this.lights.h)});
804
+ ---color-m-light: var(--color-m-light, ${et(this.lights.m)});
805
+ ---color-fa-light: var(--color-fa-light, ${et(this.lights.fa)});
806
+ ---color-cr-light: var(--color-cr-light, ${et(this.lights.cr)});
807
+ ---color-hr-light: var(--color-hr-light, ${et(this.lights.hr)});
808
+ ---color-far-light: var(--color-far-light, ${et(this.lights.far)});
809
+ ---color-acc-light: var(--color-acc-light, ${et(this.lights.acc)});
810
+ ---color-d-light: var(--color-d-light, ${et(this.lights.d)});
811
+ ---color-c-light: var(--color-c-light, ${et(this.lights.c)});
812
+ ---color-s-light: var(--color-s-light, ${et(this.lights.s)});
813
+ ---color-present-light: var(--color-present-light, ${et(this.lights.present)});
814
+ ---color-absent-light: var(--color-absent-light, ${et(this.lights.absent)});
815
+ ---color-correct-light: var(--color-correct-light, ${et(this.lights.correct)});
816
+ ---color-error-light: var(--color-error-light, ${et(this.lights.error)});
817
+ ---color-nr-light: var(--color-nr-light, ${et(this.lights.nr)});
818
+
819
+ ---color-h-dark: var(--color-h-dark, ${et(this.darks.h)});
820
+ ---color-m-dark: var(--color-m-dark, ${et(this.darks.m)});
821
+ ---color-fa-dark: var(--color-fa-dark, ${et(this.darks.fa)});
822
+ ---color-cr-dark: var(--color-cr-dark, ${et(this.darks.cr)});
823
+ ---color-hr-dark: var(--color-hr-dark, ${et(this.darks.hr)});
824
+ ---color-far-dark: var(--color-far-dark, ${et(this.darks.far)});
825
+ ---color-acc-dark: var(--color-acc-dark, ${et(this.darks.acc)});
826
+ ---color-d-dark: var(--color-d-dark, ${et(this.darks.d)});
827
+ ---color-c-dark: var(--color-c-dark, ${et(this.darks.c)});
828
+ ---color-s-dark: var(--color-s-dark, ${et(this.darks.s)});
829
+ ---color-present-dark: var(--color-present-dark, ${et(this.darks.present)});
830
+ ---color-absent-dark: var(--color-absent-dark, ${et(this.darks.absent)});
831
+ ---color-correct-dark: var(--color-correct-dark, ${et(this.darks.correct)});
832
+ ---color-error-dark: var(--color-error-dark, ${et(this.darks.error)});
833
+ ---color-nr-dark: var(--color-nr-dark, ${et(this.darks.nr)});
834
+ }
835
+ `]}}class Bo extends Vo{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},direction:{attribute:!1,type:Number,reflect:!1},lifetime:{attribute:!1,type:Number,reflect:!1},speed:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{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.direction=-1,this.lifetime=400,this.speed=50,this.width=NaN,this.height=NaN,this.rem=NaN,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.currentDirection=void 0,this.signals=["present","absent"],this.signal=void 0,this.runner=void 0,this.xScale=void 0,this.yScale=void 0}static get styles(){return[super.styles,rt`
829
836
  :host {
830
837
  display: inline-block;
831
838
 
@@ -870,7 +877,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
870
877
  font-size: 1.75rem;
871
878
  font-weight: 600;
872
879
  }
873
- `]}render(){return F``}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=.25*this.rem,s=.25*this.rem,a=.25*this.rem,o=n-(i+s),l=n-(a+.25*this.rem);this.xScale=Ga().domain([-1,1]).range([0,l]),this.yScale=Ga().domain([1,-1]).range([0,o]);const c=dr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),h=c.enter().append("svg").classed("main",!0),u=h.merge(c).attr("viewBox",`0 0 ${n} ${n}`);h.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 d=h.append("g").classed("plot",!0),p=u.select(".plot").attr("transform",`translate(${a}, ${i})`),f=d.append("g").classed("underlayer",!0),m=p.select(".underlayer");f.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)),d.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");p.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=d.append("g").classed("overlayer",!0),v=p.select(".overlayer");b.append("circle").classed("outline",!0),v.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+=qn()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,r){var n=new Fn,i=e;return null==e?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?qn():+r,n._restart((function s(a){a+=i,n._restart(s,i+=e,r),t(a)}),e,r)},n.restart(t,e,r),n)}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=qn())),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=dr(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data((t=>t));t.exit().remove();dr(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();dr(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=qn(),e=this.baseTime?t-this.baseTime:0,r=this.baseTime?e-this.startTime:0,n=this.baseTime?e-this.lastTime:0;this.lastTime=e;let i=!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&&r>=this.iti?(i=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"present":"absent",this.currentDirection="absent"===this.signal?void 0:this.direction>=0?this.direction:360*Math.random(),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&&r>=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&&r>=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="present"===this.signal?Math.round(this.count*this.coherence):0,this.dots[this.RANDOM].length="present"===this.signal?this.count-this.dots[this.COHERENT].length:this.count;for(let t=0;t<this.dots.length;t+=1)for(let r=0;r<this.dots[t].length;r+=1){const s=void 0===this.dots[t][r];s&&(this.dots[t][r]={});const a=this.dots[t][r];if(i||s){a.direction=t===this.RANDOM?360*Math.random():this.currentDirection,a.birth=e-Math.floor(Math.random()*this.lifetime);const r=2*Math.random()*Math.PI,n=Math.sqrt(Math.random());a.x=this.xScale(n*Math.cos(r)),a.y=this.yScale(n*Math.sin(r))}else if(e>a.birth+this.lifetime){a.birth+=this.lifetime,a.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,r=Math.sqrt(Math.random());a.x=this.xScale(r*Math.cos(e)),a.y=this.yScale(r*Math.sin(e))}else{t===this.COHERENT&&(a.direction=this.currentDirection);const e=a.direction*(Math.PI/180);a.dx=this.speed*(n/1e3)*Math.cos(e),a.dy=this.speed*(n/1e3)*Math.sin(e),a.x+=a.dx,a.y+=a.dy;(a.x-this.xScale(0))**2+(a.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(a.x=-(a.x-this.xScale(0))+this.xScale(0),a.y=-(a.y-this.yScale(0))+this.yScale(0))}}}const s=dr(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),a=s.enter().append("g").classed("fixation",!0);a.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),a.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),s.exit().remove();const o=dr(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=dr(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-task",uo);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var po,fo={},mo={get exports(){return fo},set exports(t){fo=t}};mo.exports=(po=function(t,e){var r=Array.prototype.concat,n=Array.prototype.slice,i=Object.prototype.toString;function s(e,r){var n=e>r?e:r;return t.pow(10,17-~~(t.log(n>0?n:-n)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function o(t){return"[object Function]"===i.call(t)}function l(t){return"number"==typeof t&&t-t==0}function c(t){return r.apply([],t)}function h(){return new h._init(arguments)}function u(){return 0}function d(){return 1}function p(t,e){return t===e?1:0}h.fn=h.prototype,h._init=function(t){if(a(t[0]))if(a(t[0][0])){o(t[1])&&(t[0]=h.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=o(t[1])?h.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=h.seq.apply(null,t),this.length=1;else{if(t[0]instanceof h)return h(t[0].toArray());this[0]=[],this.length=1}return this},h._init.prototype=h.prototype,h._init.constructor=h,h.utils={calcRdx:s,isArray:a,isFunction:o,isNumber:l,toVector:c},h._random_fn=t.random,h.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");h._random_fn=t},h.extend=function(t){var e,r;if(1===arguments.length){for(r in t)h[r]=t[r];return this}for(e=1;e<arguments.length;e++)for(r in arguments[e])t[r]=arguments[e][r];return t},h.rows=function(t){return t.length||1},h.cols=function(t){return t[0].length||1},h.dimensions=function(t){return{rows:h.rows(t),cols:h.cols(t)}},h.row=function(t,e){return a(e)?e.map((function(e){return h.row(t,e)})):t[e]},h.rowa=function(t,e){return h.row(t,e)},h.col=function(t,e){if(a(e)){var r=h.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,n){h.arange(t.length).forEach((function(i){r[i][n]=t[i][e]}))})),r}for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=[t[i][e]];return n},h.cola=function(t,e){return h.col(t,e).map((function(t){return t[0]}))},h.diag=function(t){for(var e=h.rows(t),r=new Array(e),n=0;n<e;n++)r[n]=[t[n][n]];return r},h.antidiag=function(t){for(var e=h.rows(t)-1,r=new Array(e),n=0;e>=0;e--,n++)r[n]=[t[n][e]];return r},h.transpose=function(t){var e,r,n,i,s,o=[];for(a(t[0])||(t=[t]),r=t.length,n=t[0].length,s=0;s<n;s++){for(e=new Array(r),i=0;i<r;i++)e[i]=t[i][s];o.push(e)}return 1===o.length?o[0]:o},h.map=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),l=0;l<s;l++)o[n][l]=e(t[n][l],n,l);return 1===o.length?o[0]:o},h.cumreduce=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),s>0&&(o[n][0]=t[n][0]),l=1;l<s;l++)o[n][l]=e(o[n][l-1],t[n][l]);return 1===o.length?o[0]:o},h.alter=function(t,e){return h.map(t,e,!0)},h.create=function(t,e,r){var n,i,s=new Array(t);for(o(e)&&(r=e,e=t),n=0;n<t;n++)for(s[n]=new Array(e),i=0;i<e;i++)s[n][i]=r(n,i);return s},h.zeros=function(t,e){return l(e)||(e=t),h.create(t,e,u)},h.ones=function(t,e){return l(e)||(e=t),h.create(t,e,d)},h.rand=function(t,e){return l(e)||(e=t),h.create(t,e,h._random_fn)},h.identity=function(t,e){return l(e)||(e=t),h.create(t,e,p)},h.symmetric=function(t){var e,r,n=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<n;e++)for(r=0;r<n;r++)if(t[r][e]!==t[e][r])return!1;return!0},h.clear=function(t){return h.alter(t,u)},h.seq=function(t,e,r,n){o(n)||(n=!1);var i,a=[],l=s(t,e),c=(e*l-t*l)/((r-1)*l),h=t;for(i=0;h<=e&&i<r;h=(t*l+c*l*++i)/l)a.push(n?n(h,i):h);return a},h.arange=function(t,r,n){var i,s=[];if(n=n||1,r===e&&(r=t,t=0),t===r||0===n)return[];if(t<r&&n<0)return[];if(t>r&&n>0)return[];if(n>0)for(i=t;i<r;i+=n)s.push(i);else for(i=t;i>r;i+=n)s.push(i);return s},h.slice=function(){function t(t,r,n,i){var s,a=[],o=t.length;if(r===e&&n===e&&i===e)return h.copy(t);if(i=i||1,(r=(r=r||0)>=0?r:o+r)===(n=(n=n||t.length)>=0?n:o+n)||0===i)return[];if(r<n&&i<0)return[];if(r>n&&i>0)return[];if(i>0)for(s=r;s<n;s+=i)a.push(t[s]);else for(s=r;s>n;s+=i)a.push(t[s]);return a}function r(e,r){var n,i;return l((r=r||{}).row)?l(r.col)?e[r.row][r.col]:t(h.rowa(e,r.row),(n=r.col||{}).start,n.end,n.step):l(r.col)?t(h.cola(e,r.col),(i=r.row||{}).start,i.end,i.step):(i=r.row||{},n=r.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,n.start,n.end,n.step)})))}return r}(),h.sliceAssign=function(r,n,i){var s,a;if(l(n.row)){if(l(n.col))return r[n.row][n.col]=i;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,s=h.arange(n.col.start,t.min(r.length,n.col.end),n.col.step);var o=n.row;return s.forEach((function(t,e){r[o][t]=i[e]})),r}if(l(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,a=h.arange(n.row.start,t.min(r[0].length,n.row.end),n.row.step);var c=n.col;return a.forEach((function(t,e){r[t][c]=i[e]})),r}return i[0].length===e&&(i=[i]),n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,a=h.arange(n.row.start,t.min(r.length,n.row.end),n.row.step),s=h.arange(n.col.start,t.min(r[0].length,n.col.end),n.col.step),a.forEach((function(t,e){s.forEach((function(n,s){r[t][n]=i[e][s]}))})),r},h.diagonal=function(t){var e=h.zeros(t.length,t.length);return t.forEach((function(t,r){e[r][r]=t})),e},h.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=h.prototype;return f.length=0,f.push=Array.prototype.push,f.sort=Array.prototype.sort,f.splice=Array.prototype.splice,f.slice=Array.prototype.slice,f.toArray=function(){return this.length>1?n.call(this):n.call(this)[0]},f.map=function(t,e){return h(h.map(this,t,e))},f.cumreduce=function(t,e){return h(h.cumreduce(this,t,e))},f.alter=function(t){return h.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e){var r,n=this;return e?(setTimeout((function(){e.call(n,f[t].call(n))})),this):(r=h[t](this),a(r)?h(r):r)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e,r){var n=this;return r?(setTimeout((function(){r.call(n,f[t].call(n,e))})),this):h(h[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return h(h[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),h}(Math),function(t,e){var r=t.utils.isFunction;function n(t,e){return t-e}function i(t,r,n){return e.max(r,e.min(t,n))}t.sum=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.sumsqrd=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r]*t[r];return e},t.sumsqerr=function(e){for(var r,n=t.mean(e),i=0,s=e.length;--s>=0;)i+=(r=e[s]-n)*r;return i},t.sumrow=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.product=function(t){for(var e=1,r=t.length;--r>=0;)e*=t[r];return e},t.min=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]<e&&(e=t[r]);return e},t.max=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]>e&&(e=t[r]);return e},t.unique=function(t){for(var e={},r=[],n=0;n<t.length;n++)e[t[n]]||(e[t[n]]=!0,r.push(t[n]));return r},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(r){var n=r.map(e.log),i=t.mean(n);return e.exp(i)},t.median=function(t){var e=t.length,r=t.slice().sort(n);return 1&e?r[e/2|0]:(r[e/2-1]+r[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,r=[],n=t.length;for(e=1;e<n;e++)r.push(t[e]-t[e-1]);return r},t.rank=function(t){var e,r=[],i={};for(e=0;e<t.length;e++)i[l=t[e]]?i[l]++:(i[l]=1,r.push(l));var s=r.sort(n),a={},o=1;for(e=0;e<s.length;e++){var l,c=i[l=s[e]],h=(o+(o+c-1))/2;a[l]=h,o+=c}return t.map((function(t){return a[t]}))},t.mode=function(t){var e,r=t.length,i=t.slice().sort(n),s=1,a=0,o=0,l=[];for(e=0;e<r;e++)i[e]===i[e+1]?s++:(s>a?(l=[i[e]],a=s,o=0):s===a&&(l.push(i[e]),o++),s=1);return 0===o?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,r){return t.sumsqerr(e)/(e.length-(r?1:0))},t.pooledvariance=function(e){var r=e.reduce((function(e,r){return e+t.sumsqerr(r)}),0),n=e.reduce((function(t,e){return t+e.length}),0);return r/(n-e.length)},t.deviation=function(e){for(var r=t.mean(e),n=e.length,i=new Array(n),s=0;s<n;s++)i[s]=e[s]-r;return i},t.stdev=function(r,n){return e.sqrt(t.variance(r,n))},t.pooledstdev=function(r){return e.sqrt(t.pooledvariance(r))},t.meandev=function(r){for(var n=t.mean(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.mean(i)},t.meddev=function(r){for(var n=t.median(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var r=t.length,i=t.slice().sort(n);return[i[e.round(r/4)-1],i[e.round(r/2)-1],i[e.round(3*r/4)-1]]},t.quantiles=function(t,r,s,a){var o,l,c,h,u,d=t.slice().sort(n),p=[r.length],f=t.length;for(void 0===s&&(s=3/8),void 0===a&&(a=3/8),o=0;o<r.length;o++)c=f*(l=r[o])+(s+l*(1-s-a)),h=e.floor(i(c,1,f-1)),u=i(c-h,0,1),p[o]=(1-u)*d[h-1]+u*d[h];return p},t.percentile=function(t,e,r){var i=t.slice().sort(n),s=e*(i.length+(r?1:-1))+(r?0:1),a=parseInt(s),o=s-a;return a+1<i.length?i[a-1]+o*(i[a]-i[a-1]):i[a-1]},t.percentileOfScore=function(t,e,r){var n,i,s=0,a=t.length,o=!1;for("strict"===r&&(o=!0),i=0;i<a;i++)n=t[i],(o&&n<e||!o&&n<=e)&&s++;return s/a},t.histogram=function(r,n){n=n||4;var i,s=t.min(r),a=(t.max(r)-s)/n,o=r.length,l=[];for(i=0;i<n;i++)l[i]=0;for(i=0;i<o;i++)l[e.min(e.floor((r[i]-s)/a),n-1)]+=1;return l},t.covariance=function(e,r){var n,i=t.mean(e),s=t.mean(r),a=e.length,o=new Array(a);for(n=0;n<a;n++)o[n]=(e[n]-i)*(r[n]-s);return t.sum(o)/(a-1)},t.corrcoeff=function(e,r){return t.covariance(e,r)/t.stdev(e,1)/t.stdev(r,1)},t.spearmancoeff=function(e,r){return e=t.rank(e),r=t.rank(r),t.corrcoeff(e,r)},t.stanMoment=function(r,n){for(var i=t.mean(r),s=t.stdev(r),a=r.length,o=0,l=0;l<a;l++)o+=e.pow((r[l]-i)/s,n);return o/r.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var s=t.prototype;!function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for(l=!0===n?this:this.transpose();o<l.length;o++)a[o]=t[e](l[o]);return a}return t[e](this[0],n)}}(e[n])}("cumsum cumprod".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===n?this:this.transpose());o<l.length;o++)a[o]=t[e](l[o]);return!0===n?t[e](t.utils.toVector(a)):a}return t[e](this[0],n)}}(e[n])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(){var n,i=[],a=0,o=this,l=Array.prototype.slice.call(arguments);if(r(l[l.length-1])){n=l[l.length-1];var c=l.slice(0,l.length-1);return setTimeout((function(){n.call(o,s[e].apply(o,c))})),this}n=void 0;var h=function(r){return t[e].apply(o,[r].concat(l))};if(this.length>1){for(o=o.transpose();a<o.length;a++)i[a]=h(o[a]);return i}return h(this[0])}}(e[n])}("quantiles percentileOfScore".split(" "))}(po,Math),function(t,e){t.gammaln=function(t){var r,n,i,s=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(i=(n=r=t)+5.5,i-=(r+.5)*e.log(i);s<6;s++)o+=a[s]/++n;return e.log(2.5066282746310007*o/r)-i},t.loggam=function(t){var r,n,i,s,a,o,l,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(r=t,l=0,1==t||2==t)return 0;for(t<=7&&(r=t+(l=e.floor(7-t))),n=1/(r*r),i=2*e.PI,a=c[9],o=8;o>=0;o--)a*=n,a+=c[o];if(s=a/r+.5*e.log(i)+(r-.5)*e.log(r)-r,t<=7)for(o=1;o<=l;o++)s-=e.log(r-1),r-=1;return s},t.gammafn=function(t){var r,n,i,s,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,c=0,h=0,u=0,d=t;if(t>171.6243769536076)return 1/0;if(d<=0){if(!(s=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*s),d=1-d}for(i=d,n=d<1?d++:(d-=c=(0|d)-1)-1,r=0;r<8;++r)u=(u+a[r])*n,h=h*n+o[r];if(s=u/h+1,i<d)s/=i;else if(i>d)for(r=0;r<c;++r)s*=d,d++;return l&&(s=l/s),s},t.gammap=function(e,r){return t.lowRegGamma(e,r)*t.gammafn(e)},t.lowRegGamma=function(r,n){var i,s=t.gammaln(r),a=r,o=1/r,l=o,c=n+1-r,h=1/1e-30,u=1/c,d=u,p=1,f=-~(8.5*e.log(r>=1?r:1/r)+.4*r+17);if(n<0||r<=0)return NaN;if(n<r+1){for(;p<=f;p++)o+=l*=n/++a;return o*e.exp(-n+r*e.log(n)-s)}for(;p<=f;p++)d*=(u=1/(u=(i=-p*(p-r))*u+(c+=2)))*(h=c+i/h);return 1-d*e.exp(-n+r*e.log(n)-s)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(r,n){return r>170||n>170?e.exp(t.combinationln(r,n)):t.factorial(r)/t.factorial(n)/t.factorial(r-n)},t.combinationln=function(e,r){return t.factorialln(e)-t.factorialln(r)-t.factorialln(e-r)},t.permutation=function(e,r){return t.factorial(e)/t.factorial(e-r)},t.betafn=function(r,n){if(!(r<=0||n<=0))return r+n>170?e.exp(t.betaln(r,n)):t.gammafn(r)*t.gammafn(n)/t.gammafn(r+n)},t.betaln=function(e,r){return t.gammaln(e)+t.gammaln(r)-t.gammaln(e+r)},t.betacf=function(t,r,n){var i,s,a,o,l=1e-30,c=1,h=r+n,u=r+1,d=r-1,p=1,f=1-h*t/u;for(e.abs(f)<l&&(f=l),o=f=1/f;c<=100&&(f=1+(s=c*(n-c)*t/((d+(i=2*c))*(r+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=(f=1/f)*p,f=1+(s=-(r+c)*(h+c)*t/((r+i)*(u+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=a=(f=1/f)*p,!(e.abs(a-1)<3e-7));c++);return o},t.gammapinv=function(r,n){var i,s,a,o,l,c,h=0,u=n-1,d=1e-8,p=t.gammaln(n);if(r>=1)return e.max(100,n+100*e.sqrt(n));if(r<=0)return 0;for(n>1?(l=e.log(u),c=e.exp(u*(l-1)-p),o=r<.5?r:1-r,i=(2.30753+.27061*(s=e.sqrt(-2*e.log(o))))/(1+s*(.99229+.04481*s))-s,r<.5&&(i=-i),i=e.max(.001,n*e.pow(1-1/(9*n)-i/(3*e.sqrt(n)),3))):i=r<(s=1-n*(.253+.12*n))?e.pow(r/s,1/n):1-e.log(1-(r-s)/(1-s));h<12;h++){if(i<=0)return 0;if((i-=s=(a=(t.lowRegGamma(n,i)-r)/(s=n>1?c*e.exp(-(i-u)+u*(e.log(i)-l)):e.exp(-i+u*e.log(i)-p)))/(1-.5*e.min(1,a*((n-1)/i-1))))<=0&&(i=.5*(i+s)),e.abs(s)<d*i)break}return i},t.erf=function(t){var r,n,i,s,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],o=a.length-1,l=!1,c=0,h=0;for(t<0&&(t=-t,l=!0),n=4*(r=2/(2+t))-2;o>0;o--)i=c,c=n*c-h+a[o],h=i;return s=r*e.exp(-t*t+.5*(a[0]+n*c)-h),l?s-1:1-s},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(r){var n,i,s,a,o=0;if(r>=2)return-100;if(r<=0)return 100;for(a=r<1?r:2-r,n=-.70711*((2.30753+.27061*(s=e.sqrt(-2*e.log(a/2))))/(1+s*(.99229+.04481*s))-s);o<2;o++)n+=(i=t.erfc(n)-a)/(1.1283791670955126*e.exp(-n*n)-n*i);return r<1?n:-n},t.ibetainv=function(r,n,i){var s,a,o,l,c,h,u,d,p,f,m=1e-8,b=n-1,v=i-1,g=0;if(r<=0)return 0;if(r>=1)return 1;for(n>=1&&i>=1?(o=r<.5?r:1-r,h=(2.30753+.27061*(l=e.sqrt(-2*e.log(o))))/(1+l*(.99229+.04481*l))-l,r<.5&&(h=-h),u=(h*h-3)/6,d=2/(1/(2*n-1)+1/(2*i-1)),p=h*e.sqrt(u+d)/d-(1/(2*i-1)-1/(2*n-1))*(u+5/6-2/(3*d)),h=n/(n+i*e.exp(2*p))):(s=e.log(n/(n+i)),a=e.log(i/(n+i)),h=r<(l=e.exp(n*s)/n)/(p=l+(c=e.exp(i*a)/i))?e.pow(n*p*r,1/n):1-e.pow(i*p*(1-r),1/i)),f=-t.gammaln(n)-t.gammaln(i)+t.gammaln(n+i);g<10;g++){if(0===h||1===h)return h;if((h-=l=(c=(t.ibeta(h,n,i)-r)/(l=e.exp(b*e.log(h)+v*e.log(1-h)+f)))/(1-.5*e.min(1,c*(b/h-v/(1-h)))))<=0&&(h=.5*(h+l)),h>=1&&(h=.5*(h+l+1)),e.abs(l)<m*h&&g>0)break}return h},t.ibeta=function(r,n,i){var s=0===r||1===r?0:e.exp(t.gammaln(n+i)-t.gammaln(n)-t.gammaln(i)+n*e.log(r)+i*e.log(1-r));return!(r<0||r>1)&&(r<(n+1)/(n+i+2)?s*t.betacf(r,n,i)/n:1-s*t.betacf(1-r,i,n)/i)},t.randn=function(r,n){var i,s,a,o,l;if(n||(n=r),r)return t.create(r,n,(function(){return t.randn()}));do{i=t._random_fn(),s=1.7156*(t._random_fn()-.5),l=(a=i-.449871)*a+(o=e.abs(s)+.386595)*(.196*o-.25472*a)}while(l>.27597&&(l>.27846||s*s>-4*e.log(i)*i*i));return s/i},t.randg=function(r,n,i){var s,a,o,l,c,h,u=r;if(i||(i=n),r||(r=1),n)return(h=t.zeros(n,i)).alter((function(){return t.randg(r)})),h;r<1&&(r+=1),s=r-1/3,a=1/e.sqrt(9*s);do{do{l=1+a*(c=t.randn())}while(l<=0);l*=l*l,o=t._random_fn()}while(o>1-.331*e.pow(c,4)&&e.log(o)>.5*c*c+s*(1-l+e.log(l)));if(r==u)return s*l;do{o=t._random_fn()}while(0===o);return e.pow(o,1/u)*s*l},function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(r){return t[e](r)})))}}(e[r])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[r])}("randn".split(" "))}(po,Math),function(t,e){function r(t,r,n,i){for(var s,a=0,o=1,l=1,c=1,h=0,u=0;e.abs((l-u)/l)>i;)u=l,o=c+(s=-(r+h)*(r+n+h)*t/(r+2*h)/(r+2*h+1))*o,l=(a=l+s*a)+(s=(h+=1)*(n-h)*t/(r+2*h-1)/(r+2*h))*l,a/=c=o+s*c,o/=c,l/=c,c=1;return l/r}function n(t){return t/e.abs(t)}function i(r,n,i){var s=12,a=6,o=-30,l=-50,c=60,h=8,u=3,d=2,p=3,f=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],m=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],b=.5*r;if(b>=h)return 1;var v,g=2*t.normal.cdf(b,0,1,1,0)-1;g=g>=e.exp(l/i)?e.pow(g,i):0;for(var y=b,w=(h-b)/(v=r>u?d:p),x=y+w,k=0,$=i-1,_=1;_<=v;_++){for(var S=0,E=.5*(x+y),A=.5*(x-y),M=1;M<=s;M++){var T,C=E+A*(a<M?f[(T=s-M+1)-1]:-f[(T=M)-1]),N=C*C;if(N>c)break;var R=2*t.normal.cdf(C,0,1,1,0)*.5-2*t.normal.cdf(C,r,1,1,0)*.5;R>=e.exp(o/$)&&(S+=R=m[T-1]*e.exp(-.5*N)*e.pow(R,$))}k+=S*=2*A*i/e.sqrt(2*e.PI),y=x,x+=w}return(g+=k)<=e.exp(o/n)?0:(g=e.pow(g,n))>=1?1:g}function s(t,r,n){var i=.322232421088,s=.099348462606,a=-1,o=.588581570495,l=-.342242088547,c=.531103462366,h=-.204231210125,u=.10353775285,d=-453642210148e-16,p=.0038560700634,f=.8832,m=.2368,b=1.214,v=1.208,g=1.4142,y=120,w=.5-.5*t,x=e.sqrt(e.log(1/(w*w))),k=x+((((x*d+h)*x+l)*x+a)*x+i)/((((x*p+u)*x+c)*x+o)*x+s);n<y&&(k+=(k*k*k+k)/n/4);var $=f-m*k;return n<y&&($+=-b/n+v*k/n),k*($*e.log(r-1)+g)}!function(e){for(var r=0;r<e.length;r++)!function(e){t[e]=function t(e,r,n){return this instanceof t?(this._a=e,this._b=r,this._c=n,this):new t(e,r,n)},t.fn[e]=function(r,n,i){var s=t[e](r,n,i);return s.data=this,s},t[e].prototype.sample=function(r){var n=this._a,i=this._b,s=this._c;return r?t.alter(r,(function(){return t[e].sample(n,i,s)})):t[e].sample(n,i,s)},function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(n){var i=this._a,s=this._b,a=this._c;return n||0===n||(n=this.data),"number"!=typeof n?t.fn.map.call(n,(function(n){return t[e][r](n,i,s,a)})):t[e][r](n,i,s,a)}}(r[n])}("pdf cdf inv".split(" ")),function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(){return t[e][r](this._a,this._b,this._c)}}(r[n])}("mean median mode variance".split(" "))}(e[r])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(r,n,i){return r>1||r<0?0:1==n&&1==i?1:n<512&&i<512?e.pow(r,n-1)*e.pow(1-r,i-1)/t.betafn(n,i):e.exp((n-1)*e.log(r)+(i-1)*e.log(1-r)-t.betaln(n,i))},cdf:function(e,r,n){return e>1||e<0?1*(e>1):t.ibeta(e,r,n)},inv:function(e,r,n){return t.ibetainv(e,r,n)},mean:function(t,e){return t/(t+e)},median:function(e,r){return t.ibetainv(.5,e,r)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,r){var n=t.randg(e);return n/(n+t.randg(r))},variance:function(t,r){return t*r/(e.pow(t+r,2)*(t+r+1))}}),t.extend(t.centralF,{pdf:function(r,n,i){var s;return r<0?0:n<=2?0===r&&n<2?1/0:0===r&&2===n?1:1/t.betafn(n/2,i/2)*e.pow(n/i,n/2)*e.pow(r,n/2-1)*e.pow(1+n/i*r,-(n+i)/2):(s=n*r/(i+r*n),n*(i/(i+r*n))/2*t.binomial.pdf((n-2)/2,(n+i-2)/2,s))},cdf:function(e,r,n){return e<0?0:t.ibeta(r*e/(r*e+n),r/2,n/2)},inv:function(e,r,n){return n/(r*(1/t.ibetainv(e,r/2,n/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,r){return 2*t.randg(e/2)/e/(2*t.randg(r/2)/r)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,r,n){return n<0?0:n/(e.pow(t-r,2)+e.pow(n,2))/e.PI},cdf:function(t,r,n){return e.atan((t-r)/n)/e.PI+.5},inv:function(t,r,n){return r+n*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(r,n){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*n+r}}),t.extend(t.chisquare,{pdf:function(r,n){return r<0?0:0===r&&2===n?.5:e.exp((n/2-1)*e.log(r)-r/2-n/2*e.log(2)-t.gammaln(n/2))},cdf:function(e,r){return e<0?0:t.lowRegGamma(r/2,e/2)},inv:function(e,r){return 2*t.gammapinv(e,.5*r)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,r){return t<0?0:r*e.exp(-r*t)},cdf:function(t,r){return t<0?0:1-e.exp(-r*t)},inv:function(t,r){return-e.log(1-t)/r},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(r){return-1/r*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(r,n,i){return r<0?0:0===r&&1===n?1/i:e.exp((n-1)*e.log(r)-r/i-t.gammaln(n)-n*e.log(i))},cdf:function(e,r,n){return e<0?0:t.lowRegGamma(r,e/n)},inv:function(e,r,n){return t.gammapinv(e,r)*n},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,r){return t.randg(e)*r},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(r,n,i){return r<=0?0:e.exp(-(n+1)*e.log(r)-i/r-t.gammaln(n)+n*e.log(i))},cdf:function(e,r,n){return e<=0?0:1-t.lowRegGamma(r,n/e)},inv:function(e,r,n){return n/t.gammapinv(1-e,r)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,r){return r/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,r,n){return 0===t&&1===r?n:1===t&&1===n?r:e.exp(e.log(r)+e.log(n)+(r-1)*e.log(t)+(n-1)*e.log(1-e.pow(t,r)))},cdf:function(t,r,n){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,r),n)},inv:function(t,r,n){return e.pow(1-e.pow(1-t,1/n),1/r)},mean:function(e,r){return r*t.gammafn(1+1/e)*t.gammafn(r)/t.gammafn(1+1/e+r)},median:function(t,r){return e.pow(1-e.pow(2,-1/r),1/t)},mode:function(t,r){if(t>=1&&r>=1&&1!==t&&1!==r)return e.pow((t-1)/(t*r-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,r,n){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(t)-r,2)/(2*n*n))},cdf:function(r,n,i){return r<0?0:.5+.5*t.erf((e.log(r)-n)/e.sqrt(2*i*i))},inv:function(r,n,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*r)+n)},mean:function(t,r){return e.exp(t+r*r/2)},median:function(t){return e.exp(t)},mode:function(t,r){return e.exp(t-r*r)},sample:function(r,n){return e.exp(t.randn()*n+r)},variance:function(t,r){return(e.exp(r*r)-1)*e.exp(2*t+r*r)}}),t.extend(t.noncentralt,{pdf:function(r,n,i){var s=1e-14;return e.abs(i)<s?t.studentt.pdf(r,n):e.abs(r)<s?e.exp(t.gammaln((n+1)/2)-i*i/2-.5*e.log(e.PI*n)-t.gammaln(n/2)):n/r*(t.noncentralt.cdf(r*e.sqrt(1+2/n),n+2,i)-t.noncentralt.cdf(r,n,i))},cdf:function(r,n,i){var s=1e-14,a=200;if(e.abs(i)<s)return t.studentt.cdf(r,n);var o=!1;r<0&&(o=!0,i=-i);for(var l=t.normal.cdf(-i,0,1),c=s+1,h=c,u=r*r/(r*r+n),d=0,p=e.exp(-i*i/2),f=e.exp(-i*i/2-.5*e.log(2)-t.gammaln(1.5))*i;d<a||h>s||c>s;)h=c,d>0&&(p*=i*i/(2*d),f*=i*i/(2*(d+.5))),l+=.5*(c=p*t.beta.cdf(u,d+.5,n/2)+f*t.beta.cdf(u,d+1,n/2)),d++;return o?1-l:l}}),t.extend(t.normal,{pdf:function(t,r,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(t-r,2)/(2*n*n))},cdf:function(r,n,i){return.5*(1+t.erf((r-n)/e.sqrt(2*i*i)))},inv:function(e,r,n){return-1.4142135623730951*n*t.erfcinv(2*e)+r},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,r){return t.randn()*r+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,r,n){return t<r?0:n*e.pow(r,n)/e.pow(t,n+1)},cdf:function(t,r,n){return t<r?0:1-e.pow(r/t,n)},inv:function(t,r,n){return r/e.pow(1-t,1/n)},mean:function(t,r){if(!(r<=1))return r*e.pow(t,r)/(r-1)},median:function(t,r){return t*(r*e.SQRT2)},mode:function(t){return t},variance:function(t,r){if(!(r<=2))return t*t*r/(e.pow(r-1,2)*(r-2))}}),t.extend(t.studentt,{pdf:function(r,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*t.betafn(.5,n/2))*e.pow(1+r*r/n,-(n+1)/2)},cdf:function(r,n){var i=n/2;return t.ibeta((r+e.sqrt(r*r+n))/(2*e.sqrt(r*r+n)),i,i)},inv:function(r,n){var i=t.ibetainv(2*e.min(r,1-r),.5*n,.5);return i=e.sqrt(n*(1-i)/i),r>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(r){return t.randn()*e.sqrt(r/(2*t.randg(r/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,r,n){return t<0||r<0||n<0?0:n/r*e.pow(t/r,n-1)*e.exp(-e.pow(t/r,n))},cdf:function(t,r,n){return t<0?0:1-e.exp(-e.pow(t/r,n))},inv:function(t,r,n){return r*e.pow(-e.log(1-t),1/n)},mean:function(e,r){return e*t.gammafn(1+1/r)},median:function(t,r){return t*e.pow(e.log(2),1/r)},mode:function(t,r){return r<=1?0:t*e.pow((r-1)/r,1/r)},sample:function(r,n){return r*e.pow(-e.log(t._random_fn()),1/n)},variance:function(r,n){return r*r*t.gammafn(1+2/n)-e.pow(t.weibull.mean(r,n),2)}}),t.extend(t.uniform,{pdf:function(t,e,r){return t<e||t>r?0:1/(r-e)},cdf:function(t,e,r){return t<e?0:t<r?(t-e)/(r-e):1},inv:function(t,e,r){return e+t*(r-e)},mean:function(t,e){return.5*(t+e)},median:function(e,r){return t.mean(e,r)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,r){return e/2+r/2+(r/2-e/2)*(2*t._random_fn()-1)},variance:function(t,r){return e.pow(r-t,2)/12}}),t.extend(t.binomial,{pdf:function(r,n,i){return 0===i||1===i?n*i===r?1:0:t.combination(n,r)*e.pow(i,r)*e.pow(1-i,n-r)},cdf:function(n,i,s){var a,o=1e-10;if(n<0)return 0;if(n>=i)return 1;if(s<0||s>1||i<=0)return NaN;var l=s,c=(n=e.floor(n))+1,h=i-n,u=c+h,d=e.exp(t.gammaln(u)-t.gammaln(h)-t.gammaln(c)+c*e.log(l)+h*e.log(1-l));return a=l<(c+1)/(u+2)?d*r(l,c,h,o):1-d*r(1-l,h,c,o),e.round(1/o*(1-a))/(1/o)}}),t.extend(t.negbin,{pdf:function(r,n,i){return r===r>>>0&&(r<0?0:t.combination(r+n-1,n-1)*e.pow(1-i,r)*e.pow(i,n))},cdf:function(e,r,n){var i=0,s=0;if(e<0)return 0;for(;s<=e;s++)i+=t.negbin.pdf(s,r,n);return i}}),t.extend(t.hypgeom,{pdf:function(r,n,i,s){if(r!=r|0)return!1;if(r<0||r<i-(n-s))return 0;if(r>s||r>i)return 0;if(2*i>n)return 2*s>n?t.hypgeom.pdf(n-i-s+r,n,n-i,n-s):t.hypgeom.pdf(s-r,n,n-i,s);if(2*s>n)return t.hypgeom.pdf(i-r,n,i,n-s);if(i<s)return t.hypgeom.pdf(r,n,s,i);for(var a=1,o=0,l=0;l<r;l++){for(;a>1&&o<s;)a*=1-i/(n-o),o++;a*=(s-l)*(i-l)/((l+1)*(n-i-s+l+1))}for(;o<s;o++)a*=1-i/(n-o);return e.min(1,e.max(0,a))},cdf:function(r,n,i,s){if(r<0||r<i-(n-s))return 0;if(r>=s||r>=i)return 1;if(2*i>n)return 2*s>n?t.hypgeom.cdf(n-i-s+r,n,n-i,n-s):1-t.hypgeom.cdf(s-r-1,n,n-i,s);if(2*s>n)return 1-t.hypgeom.cdf(i-r-1,n,i,n-s);if(i<s)return t.hypgeom.cdf(r,n,s,i);for(var a=1,o=1,l=0,c=0;c<r;c++){for(;a>1&&l<s;){var h=1-i/(n-l);o*=h,a*=h,l++}a+=o*=(s-c)*(i-c)/((c+1)*(n-i-s+c+1))}for(;l<s;l++)a*=1-i/(n-l);return e.min(1,e.max(0,a))}}),t.extend(t.poisson,{pdf:function(r,n){return n<0||r%1!=0||r<0?0:e.pow(n,r)*e.exp(-n)/t.factorial(r)},cdf:function(e,r){var n=[],i=0;if(e<0)return 0;for(;i<=e;i++)n.push(t.poisson.pdf(i,r));return t.sum(n)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(r){var n=1,i=0,s=e.exp(-r);do{i++,n*=t._random_fn()}while(n>s);return i-1},sampleLarge:function(r){var n,i,s,a,o,l,c,h,u,d,p=r;for(a=e.sqrt(p),o=e.log(p),l=.02483*(c=.931+2.53*a)-.059,h=1.1239+1.1328/(c-3.4),u=.9277-3.6224/(c-2);;){if(i=e.random()-.5,s=e.random(),d=.5-e.abs(i),n=e.floor((2*l/d+c)*i+p+.43),d>=.07&&s<=u)return n;if(!(n<0||d<.013&&s>d)&&e.log(s)+e.log(h)-e.log(l/(d*d)+c)<=n*o-p-t.loggam(n+1))return n}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,r,n){return r<=e||n<e||n>r?NaN:t<e||t>r?0:t<n?2*(t-e)/((r-e)*(n-e)):t===n?2/(r-e):2*(r-t)/((r-e)*(r-n))},cdf:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=r?0:t>=n?1:t<=i?e.pow(t-r,2)/((n-r)*(i-r)):1-e.pow(n-t,2)/((n-r)*(n-i))},inv:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=(i-r)/(n-r)?r+(n-r)*e.sqrt(t*((i-r)/(n-r))):r+(n-r)*(1-e.sqrt((1-t)*(1-(i-r)/(n-r))))},mean:function(t,e,r){return(t+e+r)/3},median:function(t,r,n){return n<=(t+r)/2?r-e.sqrt((r-t)*(r-n))/e.sqrt(2):n>(t+r)/2?t+e.sqrt((r-t)*(n-t))/e.sqrt(2):void 0},mode:function(t,e,r){return r},sample:function(r,n,i){var s=t._random_fn();return s<(i-r)/(n-r)?r+e.sqrt(s*(n-r)*(i-r)):n-e.sqrt((1-s)*(n-r)*(n-i))},variance:function(t,e,r){return(t*t+e*e+r*r-t*e-t*r-e*r)/18}}),t.extend(t.arcsine,{pdf:function(t,r,n){return n<=r?NaN:t<=r||t>=n?0:2/e.PI*e.pow(e.pow(n-r,2)-e.pow(2*t-r-n,2),-.5)},cdf:function(t,r,n){return t<r?0:t<n?2/e.PI*e.asin(e.sqrt((t-r)/(n-r))):1},inv:function(t,r,n){return r+(.5-.5*e.cos(e.PI*t))*(n-r)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,n){return(r+n)/2+(n-r)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,r){return r<=t?NaN:e.pow(r-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,r,n){return n<=0?0:e.exp(-e.abs(t-r)/n)/(2*n)},cdf:function(t,r,n){return n<=0?0:t<r?.5*e.exp((t-r)/n):1-.5*e.exp(-(t-r)/n)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(r,i){var s=t._random_fn()-.5;return r-i*n(s)*e.log(1-2*e.abs(s))}}),t.extend(t.tukey,{cdf:function(r,n,s){var a=1,o=n,l=16,c=8,h=-30,u=1e-14,d=100,p=800,f=5e3,m=25e3,b=1,v=.5,g=.25,y=.125,w=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],x=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(r<=0)return 0;if(s<2||a<1||o<2)return NaN;if(!Number.isFinite(r))return 1;if(s>m)return i(r,a,o);var k,$=.5*s,_=$*e.log(s)-s*e.log(2)-t.gammaln($),S=$-1,E=.25*s;k=s<=d?b:s<=p?v:s<=f?g:y,_+=e.log(k);for(var A=0,M=1;M<=50;M++){for(var T=0,C=(2*M-1)*k,N=1;N<=l;N++){var R,P;c<N?(R=N-c-1,P=_+S*e.log(C+w[R]*k)-(w[R]*k+C)*E):(R=N-1,P=_+S*e.log(C-w[R]*k)+(w[R]*k-C)*E),P>=h&&(T+=i(c<N?r*e.sqrt(.5*(w[R]*k+C)):r*e.sqrt(.5*(-w[R]*k+C)),a,o)*x[R]*e.exp(P))}if(M*k>=1&&T<=u)break;A+=T}if(T>u)throw new Error("tukey.cdf failed to converge");return A>1&&(A=1),A},inv:function(r,n,i){var a=1e-4,o=50;if(i<2||n<2)return NaN;if(r<0||r>1)return NaN;if(0===r)return 0;if(1===r)return 1/0;var l,c=s(r,n,i),h=t.tukey.cdf(c,n,i)-r;l=h>0?e.max(0,c-1):c+1;for(var u,d=t.tukey.cdf(l,n,i)-r,p=1;p<o;p++)if(u=l-d*(l-c)/(d-h),h=d,c=l,u<0&&(u=0,d=-r),d=t.tukey.cdf(u,n,i)-r,l=u,e.abs(l-c)<a)return u;throw new Error("tukey.inv failed to converge")}})}(po,Math),function(t,e){var r=Array.prototype.push,n=t.utils.isArray;function i(e){return n(e)||e instanceof t}t.extend({add:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t+r[e][n]}))):t.map(e,(function(t){return t+r}))},subtract:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t-r[e][n]||0}))):t.map(e,(function(t){return t-r}))},divide:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.multiply(e,t.inv(r))):t.map(e,(function(t){return t/r}))},multiply:function(e,r){var n,s,a,o,l,c,h,u;if(void 0===e.length&&void 0===r.length)return e*r;if(l=e.length,c=e[0].length,h=t.zeros(l,a=i(r)?r[0].length:c),u=0,i(r)){for(;u<a;u++)for(n=0;n<l;n++){for(o=0,s=0;s<c;s++)o+=e[n][s]*r[s][u];h[n][u]=o}return 1===l&&1===u?h[0][0]:h}return t.map(e,(function(t){return t*r}))},outer:function(e,r){return t.multiply(e.map((function(t){return[t]})),[r])},dot:function(e,r){i(e[0])||(e=[e]),i(r[0])||(r=[r]);for(var n,s,a=1===e[0].length&&1!==e.length?t.transpose(e):e,o=1===r[0].length&&1!==r.length?t.transpose(r):r,l=[],c=0,h=a.length,u=a[0].length;c<h;c++){for(l[c]=[],n=0,s=0;s<u;s++)n+=a[c][s]*o[c][s];l[c]=n}return 1===l.length?l[0]:l},pow:function(r,n){return t.map(r,(function(t){return e.pow(t,n)}))},exp:function(r){return t.map(r,(function(t){return e.exp(t)}))},log:function(r){return t.map(r,(function(t){return e.log(t)}))},abs:function(r){return t.map(r,(function(t){return e.abs(t)}))},norm:function(t,r){var n=0,s=0;for(isNaN(r)&&(r=2),i(t[0])&&(t=t[0]);s<t.length;s++)n+=e.pow(e.abs(t[s]),r);return e.pow(n,1/r)},angle:function(r,n){return e.acos(t.dot(r,n)/(t.norm(r)*t.norm(n)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)r.apply(i[n],e[n]);return i},inv:function(e){for(var r,n=e.length,i=e[0].length,s=t.identity(n,i),a=t.gauss_jordan(e,s),o=[],l=0;l<n;l++)for(o[l]=[],r=i;r<a[0].length;r++)o[l][r-i]=a[l][r];return o},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var r=0,n=0;n<e.length;n++){for(var i=[],s=1;s<e.length;s++){i[s-1]=[];for(var a=0;a<e.length;a++)a<n?i[s-1][a]=e[s][a]:a>n&&(i[s-1][a-1]=e[s][a])}var o=n%2?-1:1;r+=t(i)*e[0][n]*o}return r},gauss_elimination:function(r,n){var i,s,a,o,l=0,c=0,h=r.length,u=r[0].length,d=1,p=0,f=[];for(i=(r=t.aug(r,n))[0].length,l=0;l<h;l++){for(s=r[l][l],c=l,o=l+1;o<u;o++)s<e.abs(r[o][l])&&(s=r[o][l],c=o);if(c!=l)for(o=0;o<i;o++)a=r[l][o],r[l][o]=r[c][o],r[c][o]=a;for(c=l+1;c<h;c++)for(d=r[c][l]/r[l][l],o=l;o<i;o++)r[c][o]=r[c][o]-d*r[l][o]}for(l=h-1;l>=0;l--){for(p=0,c=l+1;c<=h-1;c++)p+=f[c]*r[l][c];f[l]=(r[l][i-1]-p)/r[l][l]}return f},gauss_jordan:function(r,n){var i,s,a,o=t.aug(r,n),l=o.length,c=o[0].length,h=0;for(s=0;s<l;s++){var u=s;for(a=s+1;a<l;a++)e.abs(o[a][s])>e.abs(o[u][s])&&(u=a);var d=o[s];for(o[s]=o[u],o[u]=d,a=s+1;a<l;a++)for(h=o[a][s]/o[s][s],i=s;i<c;i++)o[a][i]-=o[s][i]*h}for(s=l-1;s>=0;s--){for(h=o[s][s],a=0;a<s;a++)for(i=c-1;i>s-1;i--)o[a][i]-=o[s][i]*o[a][s]/h;for(o[s][s]/=h,i=l;i<c;i++)o[s][i]/=h}return o},triaUpSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i-1,-1,-1).forEach((function(a){n=t.arange(a+1,i).map((function(t){return s[t]*e[a][t]})),s[a]=(r[a]-t.sum(n))/e[a][a]})),a?s.map((function(t){return[t]})):s},triaLowSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i).forEach((function(i){n=t.arange(i).map((function(t){return e[i][t]*s[t]})),s[i]=(r[i]-t.sum(n))/e[i][i]})),a?s.map((function(t){return[t]})):s},lu:function(e){var r,n=e.length,i=t.identity(n),s=t.zeros(e.length,e[0].length);return t.arange(n).forEach((function(t){s[0][t]=e[0][t]})),t.arange(1,n).forEach((function(a){t.arange(a).forEach((function(n){r=t.arange(n).map((function(t){return i[a][t]*s[t][n]})),i[a][n]=(e[a][n]-t.sum(r))/s[n][n]})),t.arange(a,n).forEach((function(n){r=t.arange(a).map((function(t){return i[a][t]*s[t][n]})),s[a][n]=e[r.length][n]-t.sum(r)}))})),[i,s]},cholesky:function(r){var n,i=r.length,s=t.zeros(r.length,r[0].length);return t.arange(i).forEach((function(a){n=t.arange(a).map((function(t){return e.pow(s[a][t],2)})),s[a][a]=e.sqrt(r[a][a]-t.sum(n)),t.arange(a+1,i).forEach((function(e){n=t.arange(a).map((function(t){return s[a][t]*s[e][t]})),s[e][a]=(r[a][e]-t.sum(n))/s[a][a]}))})),s},gauss_jacobi:function(r,n,i,s){for(var a,o,l,c,h=0,u=0,d=r.length,p=[],f=[],m=[];h<d;h++)for(p[h]=[],f[h]=[],m[h]=[],u=0;u<d;u++)h>u?(p[h][u]=r[h][u],f[h][u]=m[h][u]=0):h<u?(f[h][u]=r[h][u],p[h][u]=m[h][u]=0):(m[h][u]=r[h][u],p[h][u]=f[h][u]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(p,f)),-1),o=t.multiply(t.inv(m),n),a=i,c=t.add(t.multiply(l,i),o),h=2;e.abs(t.norm(t.subtract(c,a)))>s;)a=c,c=t.add(t.multiply(l,a),o),h++;return c},gauss_seidel:function(r,n,i,s){for(var a,o,l,c,h,u=0,d=r.length,p=[],f=[],m=[];u<d;u++)for(p[u]=[],f[u]=[],m[u]=[],a=0;a<d;a++)u>a?(p[u][a]=r[u][a],f[u][a]=m[u][a]=0):u<a?(f[u][a]=r[u][a],p[u][a]=m[u][a]=0):(m[u][a]=r[u][a],p[u][a]=f[u][a]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,p)),f),-1),l=t.multiply(t.inv(t.add(m,p)),n),o=i,h=t.add(t.multiply(c,i),l),u=2;e.abs(t.norm(t.subtract(h,o)))>s;)o=h,h=t.add(t.multiply(c,o),l),u+=1;return h},SOR:function(r,n,i,s,a){for(var o,l,c,h,u,d=0,p=r.length,f=[],m=[],b=[];d<p;d++)for(f[d]=[],m[d]=[],b[d]=[],o=0;o<p;o++)d>o?(f[d][o]=r[d][o],m[d][o]=b[d][o]=0):d<o?(m[d][o]=r[d][o],f[d][o]=b[d][o]=0):(b[d][o]=r[d][o],f[d][o]=m[d][o]=0);for(h=t.multiply(t.inv(t.add(b,t.multiply(f,a))),t.subtract(t.multiply(b,1-a),t.multiply(m,a))),c=t.multiply(t.multiply(t.inv(t.add(b,t.multiply(f,a))),n),a),l=i,u=t.add(t.multiply(h,i),c),d=2;e.abs(t.norm(t.subtract(u,l)))>s;)l=u,u=t.add(t.multiply(h,l),c),d++;return u},householder:function(r){for(var n,i,s,a,o=r.length,l=r[0].length,c=0,h=[],u=[];c<o-1;c++){for(n=0,a=c+1;a<l;a++)n+=r[a][c]*r[a][c];for(n=(r[c+1][c]>0?-1:1)*e.sqrt(n),i=e.sqrt((n*n-r[c+1][c]*n)/2),(h=t.zeros(o,1))[c+1][0]=(r[c+1][c]-n)/(2*i),s=c+2;s<o;s++)h[s][0]=r[s][c]/(2*i);u=t.subtract(t.identity(o,l),t.multiply(t.multiply(h,t.transpose(h)),2)),r=t.multiply(u,t.multiply(r,u))}return r},QR:function(){var r=t.sum,n=t.arange;function i(i){var s,a,o,l=i.length,c=i[0].length,h=t.zeros(c,c);for(i=t.copy(i),a=0;a<c;a++){for(h[a][a]=e.sqrt(r(n(l).map((function(t){return i[t][a]*i[t][a]})))),s=0;s<l;s++)i[s][a]=i[s][a]/h[a][a];for(o=a+1;o<c;o++)for(h[a][o]=r(n(l).map((function(t){return i[t][a]*i[t][o]}))),s=0;s<l;s++)i[s][o]=i[s][o]-i[s][a]*h[a][o]}return[i,h]}return i}(),lstsq:function(){function e(e){var r=(e=t.copy(e)).length,n=t.identity(r);return t.arange(r-1,-1,-1).forEach((function(r){t.sliceAssign(n,{row:r},t.divide(t.slice(n,{row:r}),e[r][r])),t.sliceAssign(e,{row:r},t.divide(t.slice(e,{row:r}),e[r][r])),t.arange(r).forEach((function(i){var s=t.multiply(e[i][r],-1),a=t.slice(e,{row:i}),o=t.multiply(t.slice(e,{row:r}),s);t.sliceAssign(e,{row:i},t.add(a,o));var l=t.slice(n,{row:i}),c=t.multiply(t.slice(n,{row:r}),s);t.sliceAssign(n,{row:i},t.add(l,c))}))})),n}function r(r,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var s=t.QR(r),a=s[0],o=s[1],l=r[0].length,c=t.slice(a,{col:{end:l}}),h=e(t.slice(o,{row:{end:l}})),u=t.transpose(c);void 0===u[0].length&&(u=[u]);var d=t.multiply(t.multiply(h,u),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d}return r}(),jacobi:function(r){for(var n,i,s,a,o,l,c,h=1,u=r.length,d=t.identity(u,u),p=[];1===h;){for(o=r[0][1],s=0,a=1,n=0;n<u;n++)for(i=0;i<u;i++)n!=i&&o<e.abs(r[n][i])&&(o=e.abs(r[n][i]),s=n,a=i);for(l=r[s][s]===r[a][a]?r[s][a]>0?e.PI/4:-e.PI/4:e.atan(2*r[s][a]/(r[s][s]-r[a][a]))/2,(c=t.identity(u,u))[s][s]=e.cos(l),c[s][a]=-e.sin(l),c[a][s]=e.sin(l),c[a][a]=e.cos(l),d=t.multiply(d,c),r=t.multiply(t.multiply(t.inv(c),r),c),h=0,n=1;n<u;n++)for(i=1;i<u;i++)n!=i&&e.abs(r[n][i])>.001&&(h=1)}for(n=0;n<u;n++)p.push(r[n][n]);return[d,p]},rungekutta:function(t,e,r,n,i,s){var a,o,l;if(2===s)for(;n<=r;)i+=((a=e*t(n,i))+(o=e*t(n+e,i+a)))/2,n+=e;if(4===s)for(;n<=r;)i+=((a=e*t(n,i))+2*(o=e*t(n+e/2,i+a/2))+2*(l=e*t(n+e/2,i+o/2))+e*t(n+e,i+l))/6,n+=e;return i},romberg:function(t,r,n,i){for(var s,a,o,l,c,h=0,u=(n-r)/2,d=[],p=[],f=[];h<i/2;){for(c=t(r),o=r,l=0;o<=n;o+=u,l++)d[l]=o;for(s=d.length,o=1;o<s-1;o++)c+=(o%2!=0?4:2)*t(d[o]);c=u/3*(c+t(n)),f[h]=c,u/=2,h++}for(a=f.length,s=1;1!==a;){for(o=0;o<a-1;o++)p[o]=(e.pow(4,s)*f[o+1]-f[o])/(e.pow(4,s)-1);a=p.length,f=p,p=[],s++}return f},richardson:function(t,r,n,i){function s(t,e){for(var r,n=0,i=t.length;n<i;n++)t[n]===e&&(r=n);return r}for(var a,o,l,c,h,u=e.abs(n-t[s(t,n)+1]),d=0,p=[],f=[];i>=u;)a=s(t,n+i),o=s(t,n),p[d]=(r[a]-2*r[o]+r[2*o-a])/(i*i),i/=2,d++;for(c=p.length,l=1;1!=c;){for(h=0;h<c-1;h++)f[h]=(e.pow(4,l)*p[h+1]-p[h])/(e.pow(4,l)-1);c=f.length,p=f,f=[],l++}return p},simpson:function(t,e,r,n){for(var i,s=(r-e)/n,a=t(e),o=[],l=e,c=0,h=1;l<=r;l+=s,c++)o[c]=l;for(i=o.length;h<i-1;h++)a+=(h%2!=0?4:2)*t(o[h]);return s/3*(a+t(r))},hermite:function(t,e,r,n){for(var i,s=t.length,a=0,o=0,l=[],c=[],h=[],u=[];o<s;o++){for(l[o]=1,i=0;i<s;i++)o!=i&&(l[o]*=(n-t[i])/(t[o]-t[i]));for(c[o]=0,i=0;i<s;i++)o!=i&&(c[o]+=1/(t[o]-t[i]));h[o]=(1-2*(n-t[o])*c[o])*(l[o]*l[o]),u[o]=(n-t[o])*(l[o]*l[o]),a+=h[o]*e[o]+u[o]*r[o]}return a},lagrange:function(t,e,r){for(var n,i,s=0,a=0,o=t.length;a<o;a++){for(i=e[a],n=0;n<o;n++)a!=n&&(i*=(r-t[n])/(t[a]-t[n]));s+=i}return s},cubic_spline:function(e,r,n){for(var i,s=e.length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[];a<s-1;a++)u[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/u[a]*(r[a+1]-r[a])-3/u[a-1]*(r[a]-r[a-1]);for(a=1;a<s-1;a++)o[a]=[],l[a]=[],o[a][a-1]=u[a-1],o[a][a]=2*(u[a-1]+u[a]),o[a][a+1]=u[a],l[a][0]=c[a];for(h=t.multiply(t.inv(o),l),i=0;i<s-1;i++)d[i]=(r[i+1]-r[i])/u[i]-u[i]*(h[i+1][0]+2*h[i][0])/3,p[i]=(h[i+1][0]-h[i][0])/(3*u[i]);for(i=0;i<s&&!(e[i]>n);i++);return r[i-=1]+(n-e[i])*d[i]+t.sq(n-e[i])*h[i]+(n-e[i])*t.sq(n-e[i])*p[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var r,n,i=e.length,s=e[0].length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[],f=[],m=[],b=[];for(a=0;a<i;a++)o[a]=t.sum(e[a])/s;for(a=0;a<s;a++)for(p[a]=[],r=0;r<i;r++)p[a][r]=e[r][a]-o[r];for(p=t.transpose(p),a=0;a<i;a++)for(f[a]=[],r=0;r<i;r++)f[a][r]=t.dot([p[a]],[p[r]])/(s-1);for(m=(c=t.jacobi(f))[0],l=c[1],b=t.transpose(m),a=0;a<l.length;a++)for(r=a;r<l.length;r++)l[a]<l[r]&&(n=l[a],l[a]=l[r],l[r]=n,h=b[a],b[a]=b[r],b[r]=h);for(d=t.transpose(p),a=0;a<i;a++)for(u[a]=[],r=0;r<d.length;r++)u[a][r]=t.dot([b[a]],[d[r]]);return[e,l,b,u]}}),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(r,n){var i=this;return n?(setTimeout((function(){n.call(i,t.fn[e].call(i,r))}),15),this):"number"==typeof t[e](this,r)?t[e](this,r):t(t[e](this,r))}}(e[r])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(po,Math),function(t,e){var r=[].slice,n=t.utils.isNumber,i=t.utils.isArray;function s(t,r,n,i){if(t>1||n>1||t<=0||n<=0)throw new Error("Proportions should be greater than 0 and less than 1");var s=(t*r+n*i)/(r+i);return(t-n)/e.sqrt(s*(1-s)*(1/r+1/i))}t.extend({zscore:function(){var e=r.call(arguments);return n(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var n,s=r.call(arguments);return i(s[1])?(n=t.zscore(s[0],s[1],s[3]),1===s[2]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):s.length>2?(n=t.zscore(s[0],s[1],s[2]),1===s[3]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):(n=s[0],1===s[1]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(r,n,i){var s=e.abs(this.zscore(r,i));return 1===n?t.normal.cdf(-s,0,1):2*t.normal.cdf(-s,0,1)}}),t.extend({tscore:function(){var n=r.call(arguments);return 4===n.length?(n[0]-n[1])/(n[2]/e.sqrt(n[3])):(n[0]-t.mean(n[1]))/(t.stdev(n[1],!0)/e.sqrt(n[1].length))},ttest:function(){var i,s=r.call(arguments);return 5===s.length?(i=e.abs(t.tscore(s[0],s[1],s[2],s[3])),1===s[4]?t.studentt.cdf(-i,s[3]-1):2*t.studentt.cdf(-i,s[3]-1)):n(s[1])?(i=e.abs(s[0]),1==s[2]?t.studentt.cdf(-i,s[1]-1):2*t.studentt.cdf(-i,s[1]-1)):(i=e.abs(t.tscore(s[0],s[1])),1==s[2]?t.studentt.cdf(-i,s[1].length-1):2*t.studentt.cdf(-i,s[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(r,n){return 1===n?1-t.studentt.cdf(e.abs(this.tscore(r)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(r)),this.cols()-1)}}),t.extend({anovafscore:function(){var n,i,s,a,o,l,c,h,u=r.call(arguments);if(1===u.length){for(o=new Array(u[0].length),c=0;c<u[0].length;c++)o[c]=u[0][c];u=o}for(i=new Array,c=0;c<u.length;c++)i=i.concat(u[c]);for(s=t.mean(i),n=0,c=0;c<u.length;c++)n+=u[c].length*e.pow(t.mean(u[c])-s,2);for(n/=u.length-1,l=0,c=0;c<u.length;c++)for(a=t.mean(u[c]),h=0;h<u[c].length;h++)l+=e.pow(u[c][h]-a,2);return n/(l/=i.length-u.length)},anovaftest:function(){var e,i,s,a,o=r.call(arguments);if(n(o[0]))return 1-t.centralF.cdf(o[0],o[1],o[2]);var l=t.anovafscore(o);for(e=o.length-1,s=0,a=0;a<o.length;a++)s+=o[a].length;return i=s-e-1,1-t.centralF.cdf(l,e,i)},ftest:function(e,r,n){return 1-t.centralF.cdf(e,r,n)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,r=0;for(e=0;e<this.length;e++)r+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,r-this.length)}}),t.extend({qscore:function(){var i,s,a,o,l,c=r.call(arguments);return n(c[0])?(i=c[0],s=c[1],a=c[2],o=c[3],l=c[4]):(i=t.mean(c[0]),s=t.mean(c[1]),a=c[0].length,o=c[1].length,l=c[2]),e.abs(i-s)/(l*e.sqrt((1/a+1/o)/2))},qtest:function(){var e,n=r.call(arguments);3===n.length?(e=n[0],n=n.slice(1)):7===n.length?(e=t.qscore(n[0],n[1],n[2],n[3],n[4]),n=n.slice(5)):(e=t.qscore(n[0],n[1],n[2]),n=n.slice(3));var i=n[0],s=n[1];return 1-t.tukey.cdf(e,s,i-s)},tukeyhsd:function(e){for(var r=t.pooledstdev(e),n=e.map((function(e){return t.mean(e)})),i=e.reduce((function(t,e){return t+e.length}),0),s=[],a=0;a<e.length;++a)for(var o=a+1;o<e.length;++o){var l=t.qtest(n[a],n[o],e[a].length,e[o].length,r,i,e.length);s.push([[a,o],l])}return s}}),t.extend({normalci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.normal.inv(i[1]/2,0,1)*i[2]/e.sqrt(i[3])):e.abs(t.normal.inv(i[1]/2,0,1)*t.stdev(i[2])/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},tci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.studentt.inv(i[1]/2,i[3]-1)*i[2]/e.sqrt(i[3])):e.abs(t.studentt.inv(i[1]/2,i[2].length-1)*t.stdev(i[2],!0)/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,r){return t.normalci(e,r,this.toArray())},tci:function(e,r){return t.tci(e,r,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,1)},twoSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,2)}})}(po,Math),po.models=function(){function t(t){var r=t[0].length,n=po.arange(r).map((function(n){var i=po.arange(r).filter((function(t){return t!==n}));return e(po.col(t,n).map((function(t){return t[0]})),po.col(t,i))}));return n}function e(t,e){var r=t.length,n=e[0].length-1,i=r-n-1,s=po.lstsq(e,t),a=po.multiply(e,s.map((function(t){return[t]}))).map((function(t){return t[0]})),o=po.subtract(t,a),l=po.mean(t),c=po.sum(a.map((function(t){return Math.pow(t-l,2)}))),h=po.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),u=c+h;return{exog:e,endog:t,nobs:r,df_model:n,df_resid:i,coef:s,predict:a,resid:o,ybar:l,SST:u,SSE:c,SSR:h,R2:c/u}}function r(e){var r=t(e.exog),n=Math.sqrt(e.SSR/e.df_resid),i=r.map((function(t){var e=t.SST,r=t.R2;return n/Math.sqrt(e*(1-r))})),s=e.coef.map((function(t,e){return(t-0)/i[e]})),a=s.map((function(t){var r=po.studentt.cdf(t,e.df_resid);return 2*(r>.5?1-r:r)})),o=po.studentt.inv(.975,e.df_resid),l=e.coef.map((function(t,e){var r=o*i[e];return[t-r,t+r]}));return{se:i,t:s,p:a,sigmaHat:n,interval95:l}}function n(t){var e=t.R2/t.df_model/((1-t.R2)/t.df_resid),r=function(t,e,r){return po.beta.cdf(t/(r/e+t),e/2,r/2)};return{F_statistic:e,pvalue:1-r(e,t.df_model,t.df_resid)}}function i(t,i){var s=e(t,i),a=r(s),o=n(s),l=1-(1-s.R2)*((s.nobs-1)/s.df_resid);return s.t=a,s.f=o,s.adjust_R2=l,s}return{ols:i}}(),po.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),e=0;e<arguments.length;e++){var r=[1];t[e]=r.concat(arguments[e])}return po(t)},builddxmatrix:function(){for(var t=new Array(arguments[0].length),e=0;e<arguments[0].length;e++){var r=[1];t[e]=r.concat(arguments[0][e])}return po(t)},buildjxmatrix:function(t){for(var e=new Array(t.length),r=0;r<t.length;r++)e[r]=t[r];return po.builddxmatrix(e)},buildymatrix:function(t){return po(t).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(t,e){var r,n,i,s,a;if(t.cols()==e.rows()){if(e.rows()>1){for(s=[],r=0;r<t.rows();r++)for(s[r]=[],n=0;n<e.cols();n++){for(a=0,i=0;i<t.cols();i++)a+=t.toArray()[r][i]*e.toArray()[i][n];s[r][n]=a}return po(s)}for(s=[],r=0;r<t.rows();r++)for(s[r]=[],n=0;n<e.cols();n++){for(a=0,i=0;i<t.cols();i++)a+=t.toArray()[r][i]*e.toArray()[n];s[r][n]=a}return po(s)}},regress:function(t,e){var r=po.xtranspxinv(t),n=t.transpose(),i=po.matrixmult(po(r),n);return po.matrixmult(i,e)},regresst:function(t,e,r){var n=po.regress(t,e),i={anova:{}},s=po.jMatYBar(t,n);i.yBar=s;var a=e.mean();i.anova.residuals=po.residuals(e,s),i.anova.ssr=po.ssr(s,a),i.anova.msr=i.anova.ssr/(t[0].length-1),i.anova.sse=po.sse(e,s),i.anova.mse=i.anova.sse/(e.length-(t[0].length-1)-1),i.anova.sst=po.sst(e,a),i.anova.mst=i.anova.sst/(e.length-1),i.anova.r2=1-i.anova.sse/i.anova.sst,i.anova.r2<0&&(i.anova.r2=0),i.anova.fratio=i.anova.msr/i.anova.mse,i.anova.pvalue=po.anovaftest(i.anova.fratio,t[0].length-1,e.length-(t[0].length-1)-1),i.anova.rmse=Math.sqrt(i.anova.mse),i.anova.r2adj=1-i.anova.mse/i.anova.mst,i.anova.r2adj<0&&(i.anova.r2adj=0),i.stats=new Array(t[0].length);for(var o,l,c,h=po.xtranspxinv(t),u=0;u<n.length;u++)o=Math.sqrt(i.anova.mse*Math.abs(h[u][u])),l=Math.abs(n[u]/o),c=po.ttest(l,e.length-t[0].length-1,r),i.stats[u]=[n[u],o,l,c];return i.regress=n,i},xtranspx:function(t){return po.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var e=po.matrixmult(t.transpose(),t);return po.inv(e)},jMatYBar:function(t,e){var r=po.matrixmult(t,e);return new po(r)},residuals:function(t,e){return po.matrixsubtract(t,e)},ssr:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},sse:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r},sst:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},matrixsubtract:function(t,e){for(var r=new Array(t.length),n=0;n<t.length;n++){r[n]=new Array(t[n].length);for(var i=0;i<t[n].length;i++)r[n][i]=t[n][i]-e[n][i]}return po(r)}}),po.jStat=po,po);class bo{static hM2Hr(t,e){return 0===t&&0===e?0:t/(t+e)}static faCr2Far(t,e){return 0===t&&0===e?0:t/(t+e)}static hMFaCr2Acc(t,e,r,n){return 0===t&&0===e&&0===r&&0===n?0:(t+n)/(t+e+r+n)}static hrFar2Acc(t,e){return(t+(1-e))/2}static hFa2Ppv(t,e){return 0===t&&0===e?0:t/(t+e)}static mCr2Fomr(t,e){return 0===t&&0===e?0:t/(t+e)}static hrFar2D(t,e,r=1){return 1===r?fo.normal.inv(t,0,1)-fo.normal.inv(e,0,1):Math.sqrt(2/(r*r+1))*(r*fo.normal.inv(t,0,1)-fo.normal.inv(e,0,1))}static hrFar2C(t,e,r=1){return 1===r?-(fo.normal.inv(t,0,1)+fo.normal.inv(e,0,1))/2:Math.sqrt(2/(r*r+1))*(r/(r+1))*-(fo.normal.inv(t,0,1)+fo.normal.inv(e,0,1))}static dC2Hr(t,e,r=1){return 1===r?fo.normal.cdf(t/2-e,0,1):fo.normal.cdf(Math.sqrt((r*r+1)/2)*(t/(1+r)-e/r),0,1)}static dC2Far(t,e,r=1){return 1===r?fo.normal.cdf(-(t/2+e),0,1):fo.normal.cdf(Math.sqrt((r*r+1)/2)*-(t/(1+r)+e),0,1)}static dFar2Hr(t,e,r=1){return 1===r?fo.normal.cdf(t+fo.normal.inv(e,0,1),0,1):fo.normal.cdf((Math.sqrt((r*r+1)/2)*t+fo.normal.inv(e,0,1))/r,0,1)}static cFar2Hr(t,e,r=1){return 1===r?fo.normal.cdf(-2*t-fo.normal.inv(e,0,1),0,1):fo.normal.cdf(-Math.sqrt((r*r+1)/2)*((r+1)/r)*t-fo.normal.inv(e,0,1),0,1)}static d2MuN(t,e=1){return 1===e?-t/2:-Math.sqrt((e*e+1)/2)*(1/(e+1))*t}static muN2D(t,e=1){return 1===e?-2*t:-Math.sqrt(2/(e*e+1))*(e+1)*t}static d2MuS(t,e=1){return 1===e?t/2:Math.sqrt((e*e+1)/2)*(e/(e+1))*t}static muS2D(t,e=1){return 1===e?2*t:Math.sqrt(2/(e*e+1))*((e+1)/e)*t}static c2L(t,e=1){return 1===e?t:Math.sqrt((e*e+1)/2)*t}static l2C(t,e=1){return 1===e?t:Math.sqrt(2/(e*e+1))*t}static s2H(t=1){return 1/(t*Math.sqrt(2*Math.PI))}static h2S(t){return 1/(t*Math.sqrt(2*Math.PI))}static hr2Zhr(t){return fo.normal.inv(t,0,1)}static far2Zfar(t){return fo.normal.inv(t,0,1)}static zhr2Hr(t){return fo.normal.cdf(t,0,1)}static zfar2Far(t){return fo.normal.cdf(t,0,1)}}class vo extends ho{static get properties(){return{contour:{attribute:"contour",type:String,reflect:!0},point:{attribute:"point",type:String,reflect:!0},isoD:{attribute:"iso-d",type:String,reflect:!0},isoC:{attribute:"iso-c",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},far:{attribute:"far",type:Number,reflect:!0},hr:{attribute:"hr",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1},c:{attribute:!1,type:Number,reflect:!1},s:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.firstUpdate=!0,this.drag=!1,this.sdt=!1,this.contours=["sensitivity","bias","accuracy"],this.contour=void 0,this.points=["all","first","rest","none"],this.point="all",this.isoDs=["all","first","rest","none"],this.isoD="first",this.isoCs=["all","first","rest","none"],this.isoC="first",this.zRoc=!1,this.far=.25,this.hr=.75,this.s=1,this.label="",this.locations=[{name:"default",far:this.far,hr:this.hr,s:this.s,label:""}],this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.alignState()}alignState(){this.locations[0].hr=this.hr,this.locations[0].far=this.far,this.locations[0].s=this.s,this.locations[0].label=this.label,this.d=bo.hrFar2D(this.hr,this.far,this.s),this.c=bo.hrFar2C(this.hr,this.far,this.s),this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.locations.forEach(((t,e)=>{t.d=bo.hrFar2D(t.hr,t.far,t.s),t.c=bo.hrFar2C(t.hr,t.far,t.s),0!==e||"first"!==this.point&&"all"!==this.point?e>0&&("rest"===this.point||"all"===this.point)&&this.pointArray.push(t):this.pointArray.push(t),0!==e||"first"!==this.isoD&&"all"!==this.isoD?e>0&&("rest"===this.isoD||"all"===this.isoD)&&this.isoDArray.push(t):this.isoDArray.push(t),0!==e||"first"!==this.isoC&&"all"!==this.isoC?e>0&&("rest"===this.isoC||"all"===this.isoC)&&this.isoCArray.push(t):this.isoCArray.push(t)}))}set(t,e,r="default",n="",i=1){"default"===r&&(this.hr=t,this.far=e,this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:e,hr:t,s:i,label:n}):(s.hr=t,s.far=e,s.s=i,s.label=n),this.requestUpdate()}setWithSDT(t,e,r="default",n="",i=1){"default"===r&&(this.hr=bo.dC2Hr(t,e,i),this.far=bo.dC2Far(t,e,i),this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:bo.dC2Far(t,e,i),hr:bo.dC2Hr(t,e,i),s:i,label:n}):(s.hr=bo.dC2Hr(t,e,i),s.far=bo.dC2Far(t,e,i),s.s=i,s.label=n),this.sdt=!0,this.requestUpdate()}static get styles(){return[super.styles,it`
880
+ `]}render(){return Pt``}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=.25*this.rem,s=.25*this.rem,a=.25*this.rem,o=n-(i+s),l=n-(a+.25*this.rem);this.xScale=No().domain([-1,1]).range([0,l]),this.yScale=No().domain([1,-1]).range([0,o]);const c=Yr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),h=c.enter().append("svg").classed("main",!0),u=h.merge(c).attr("viewBox",`0 0 ${n} ${n}`);h.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 d=h.append("g").classed("plot",!0),p=u.select(".plot").attr("transform",`translate(${a}, ${i})`),f=d.append("g").classed("underlayer",!0),m=p.select(".underlayer");f.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)),d.append("g").classed("content",!0).attr("clip-path","url(#clip-rdk-task)");p.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=d.append("g").classed("overlayer",!0),v=p.select(".overlayer");b.append("circle").classed("outline",!0),v.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+=vi()-this.pauseTime,this.pauseTime=0),this.runner=function(t,e,r){var n=new yi,i=e;return null==e?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?vi():+r,n._restart((function s(a){a+=i,n._restart(s,i+=e,r),t(a)}),e,r)},n.restart(t,e,r),n)}(this.run.bind(this),20)):void 0!==this.runner&&(this.runner.stop(),this.pauseTime=vi())),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=Yr(this.renderRoot).select(".content").selectAll(".dots").data([[],[]]).selectAll(".dot").data((t=>t));t.exit().remove();Yr(this.renderRoot).select(".content").selectAll(".fixation").data([]).exit().remove();Yr(this.renderRoot).select(".content").selectAll(".query").data([]).exit().remove()}run(){const t=vi(),e=this.baseTime?t-this.baseTime:0,r=this.baseTime?e-this.startTime:0,n=this.baseTime?e-this.lastTime:0;this.lastTime=e;let i=!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&&r>=this.iti?(i=!0,this.trial+=1,this.state="stimulus",this.startTime=e,this.signal=Math.random()<this.probability?"present":"absent",this.currentDirection="absent"===this.signal?void 0:this.direction>=0?this.direction:360*Math.random(),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&&r>=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&&r>=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="present"===this.signal?Math.round(this.count*this.coherence):0,this.dots[this.RANDOM].length="present"===this.signal?this.count-this.dots[this.COHERENT].length:this.count;for(let t=0;t<this.dots.length;t+=1)for(let r=0;r<this.dots[t].length;r+=1){const s=void 0===this.dots[t][r];s&&(this.dots[t][r]={});const a=this.dots[t][r];if(i||s){a.direction=t===this.RANDOM?360*Math.random():this.currentDirection,a.birth=e-Math.floor(Math.random()*this.lifetime);const r=2*Math.random()*Math.PI,n=Math.sqrt(Math.random());a.x=this.xScale(n*Math.cos(r)),a.y=this.yScale(n*Math.sin(r))}else if(e>a.birth+this.lifetime){a.birth+=this.lifetime,a.direction=t===this.RANDOM?360*Math.random():this.currentDirection;const e=2*Math.random()*Math.PI,r=Math.sqrt(Math.random());a.x=this.xScale(r*Math.cos(e)),a.y=this.yScale(r*Math.sin(e))}else{t===this.COHERENT&&(a.direction=this.currentDirection);const e=a.direction*(Math.PI/180);a.dx=this.speed*(n/1e3)*Math.cos(e),a.dy=this.speed*(n/1e3)*Math.sin(e),a.x+=a.dx,a.y+=a.dy;(a.x-this.xScale(0))**2+(a.y-this.yScale(0))**2>(this.xScale(1)-this.xScale(0))**2&&(a.x=-(a.x-this.xScale(0))+this.xScale(0),a.y=-(a.y-this.yScale(0))+this.yScale(0))}}}const s=Yr(this.renderRoot).select(".content").selectAll(".fixation").data("iti"===this.state?[!0]:[]),a=s.enter().append("g").classed("fixation",!0);a.append("line").attr("x1",this.xScale(-.1)).attr("y1",this.xScale(0)).attr("x2",this.xScale(.1)).attr("y2",this.xScale(0)),a.append("line").attr("x1",this.xScale(0)).attr("y1",this.xScale(-.1)).attr("x2",this.xScale(0)).attr("y2",this.xScale(.1)),s.exit().remove();const o=Yr(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=Yr(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-task",Bo);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Ko(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Wo={exports:{}};Wo.exports=function(){var t=function(t,e){var r=Array.prototype.concat,n=Array.prototype.slice,i=Object.prototype.toString;function s(e,r){var n=e>r?e:r;return t.pow(10,17-~~(t.log(n>0?n:-n)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function o(t){return"[object Function]"===i.call(t)}function l(t){return"number"==typeof t&&t-t==0}function c(t){return r.apply([],t)}function h(){return new h._init(arguments)}function u(){return 0}function d(){return 1}function p(t,e){return t===e?1:0}h.fn=h.prototype,h._init=function(t){if(a(t[0]))if(a(t[0][0])){o(t[1])&&(t[0]=h.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=o(t[1])?h.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=h.seq.apply(null,t),this.length=1;else{if(t[0]instanceof h)return h(t[0].toArray());this[0]=[],this.length=1}return this},h._init.prototype=h.prototype,h._init.constructor=h,h.utils={calcRdx:s,isArray:a,isFunction:o,isNumber:l,toVector:c},h._random_fn=t.random,h.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");h._random_fn=t},h.extend=function(t){var e,r;if(1===arguments.length){for(r in t)h[r]=t[r];return this}for(e=1;e<arguments.length;e++)for(r in arguments[e])t[r]=arguments[e][r];return t},h.rows=function(t){return t.length||1},h.cols=function(t){return t[0].length||1},h.dimensions=function(t){return{rows:h.rows(t),cols:h.cols(t)}},h.row=function(t,e){return a(e)?e.map((function(e){return h.row(t,e)})):t[e]},h.rowa=function(t,e){return h.row(t,e)},h.col=function(t,e){if(a(e)){var r=h.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,n){h.arange(t.length).forEach((function(i){r[i][n]=t[i][e]}))})),r}for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=[t[i][e]];return n},h.cola=function(t,e){return h.col(t,e).map((function(t){return t[0]}))},h.diag=function(t){for(var e=h.rows(t),r=new Array(e),n=0;n<e;n++)r[n]=[t[n][n]];return r},h.antidiag=function(t){for(var e=h.rows(t)-1,r=new Array(e),n=0;e>=0;e--,n++)r[n]=[t[n][e]];return r},h.transpose=function(t){var e,r,n,i,s,o=[];for(a(t[0])||(t=[t]),r=t.length,n=t[0].length,s=0;s<n;s++){for(e=new Array(r),i=0;i<r;i++)e[i]=t[i][s];o.push(e)}return 1===o.length?o[0]:o},h.map=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),l=0;l<s;l++)o[n][l]=e(t[n][l],n,l);return 1===o.length?o[0]:o},h.cumreduce=function(t,e,r){var n,i,s,o,l;for(a(t[0])||(t=[t]),i=t.length,s=t[0].length,o=r?t:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(s)),s>0&&(o[n][0]=t[n][0]),l=1;l<s;l++)o[n][l]=e(o[n][l-1],t[n][l]);return 1===o.length?o[0]:o},h.alter=function(t,e){return h.map(t,e,!0)},h.create=function(t,e,r){var n,i,s=new Array(t);for(o(e)&&(r=e,e=t),n=0;n<t;n++)for(s[n]=new Array(e),i=0;i<e;i++)s[n][i]=r(n,i);return s},h.zeros=function(t,e){return l(e)||(e=t),h.create(t,e,u)},h.ones=function(t,e){return l(e)||(e=t),h.create(t,e,d)},h.rand=function(t,e){return l(e)||(e=t),h.create(t,e,h._random_fn)},h.identity=function(t,e){return l(e)||(e=t),h.create(t,e,p)},h.symmetric=function(t){var e,r,n=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<n;e++)for(r=0;r<n;r++)if(t[r][e]!==t[e][r])return!1;return!0},h.clear=function(t){return h.alter(t,u)},h.seq=function(t,e,r,n){o(n)||(n=!1);var i,a=[],l=s(t,e),c=(e*l-t*l)/((r-1)*l),h=t;for(i=0;h<=e&&i<r;h=(t*l+c*l*++i)/l)a.push(n?n(h,i):h);return a},h.arange=function(t,r,n){var i,s=[];if(n=n||1,r===e&&(r=t,t=0),t===r||0===n)return[];if(t<r&&n<0)return[];if(t>r&&n>0)return[];if(n>0)for(i=t;i<r;i+=n)s.push(i);else for(i=t;i>r;i+=n)s.push(i);return s},h.slice=function(){function t(t,r,n,i){var s,a=[],o=t.length;if(r===e&&n===e&&i===e)return h.copy(t);if(i=i||1,(r=(r=r||0)>=0?r:o+r)===(n=(n=n||t.length)>=0?n:o+n)||0===i)return[];if(r<n&&i<0)return[];if(r>n&&i>0)return[];if(i>0)for(s=r;s<n;s+=i)a.push(t[s]);else for(s=r;s>n;s+=i)a.push(t[s]);return a}function r(e,r){var n,i;return l((r=r||{}).row)?l(r.col)?e[r.row][r.col]:t(h.rowa(e,r.row),(n=r.col||{}).start,n.end,n.step):l(r.col)?t(h.cola(e,r.col),(i=r.row||{}).start,i.end,i.step):(i=r.row||{},n=r.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,n.start,n.end,n.step)})))}return r}(),h.sliceAssign=function(r,n,i){var s,a;if(l(n.row)){if(l(n.col))return r[n.row][n.col]=i;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,s=h.arange(n.col.start,t.min(r.length,n.col.end),n.col.step);var o=n.row;return s.forEach((function(t,e){r[o][t]=i[e]})),r}if(l(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,a=h.arange(n.row.start,t.min(r[0].length,n.row.end),n.row.step);var c=n.col;return a.forEach((function(t,e){r[t][c]=i[e]})),r}return i[0].length===e&&(i=[i]),n.row.start=n.row.start||0,n.row.end=n.row.end||r.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||r[0].length,n.col.step=n.col.step||1,a=h.arange(n.row.start,t.min(r.length,n.row.end),n.row.step),s=h.arange(n.col.start,t.min(r[0].length,n.col.end),n.col.step),a.forEach((function(t,e){s.forEach((function(n,s){r[t][n]=i[e][s]}))})),r},h.diagonal=function(t){var e=h.zeros(t.length,t.length);return t.forEach((function(t,r){e[r][r]=t})),e},h.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=h.prototype;return f.length=0,f.push=Array.prototype.push,f.sort=Array.prototype.sort,f.splice=Array.prototype.splice,f.slice=Array.prototype.slice,f.toArray=function(){return this.length>1?n.call(this):n.call(this)[0]},f.map=function(t,e){return h(h.map(this,t,e))},f.cumreduce=function(t,e){return h(h.cumreduce(this,t,e))},f.alter=function(t){return h.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e){var r,n=this;return e?(setTimeout((function(){e.call(n,f[t].call(n))})),this):(r=h[t](this),a(r)?h(r):r)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e,r){var n=this;return r?(setTimeout((function(){r.call(n,f[t].call(n,e))})),this):h(h[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return h(h[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),h}(Math);return function(t,e){var r=t.utils.isFunction;function n(t,e){return t-e}function i(t,r,n){return e.max(r,e.min(t,n))}t.sum=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.sumsqrd=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r]*t[r];return e},t.sumsqerr=function(e){for(var r,n=t.mean(e),i=0,s=e.length;--s>=0;)i+=(r=e[s]-n)*r;return i},t.sumrow=function(t){for(var e=0,r=t.length;--r>=0;)e+=t[r];return e},t.product=function(t){for(var e=1,r=t.length;--r>=0;)e*=t[r];return e},t.min=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]<e&&(e=t[r]);return e},t.max=function(t){for(var e=t[0],r=0;++r<t.length;)t[r]>e&&(e=t[r]);return e},t.unique=function(t){for(var e={},r=[],n=0;n<t.length;n++)e[t[n]]||(e[t[n]]=!0,r.push(t[n]));return r},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(r){var n=r.map(e.log),i=t.mean(n);return e.exp(i)},t.median=function(t){var e=t.length,r=t.slice().sort(n);return 1&e?r[e/2|0]:(r[e/2-1]+r[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,r=[],n=t.length;for(e=1;e<n;e++)r.push(t[e]-t[e-1]);return r},t.rank=function(t){var e,r=[],i={};for(e=0;e<t.length;e++)i[l=t[e]]?i[l]++:(i[l]=1,r.push(l));var s=r.sort(n),a={},o=1;for(e=0;e<s.length;e++){var l,c=i[l=s[e]],h=(o+(o+c-1))/2;a[l]=h,o+=c}return t.map((function(t){return a[t]}))},t.mode=function(t){var e,r=t.length,i=t.slice().sort(n),s=1,a=0,o=0,l=[];for(e=0;e<r;e++)i[e]===i[e+1]?s++:(s>a?(l=[i[e]],a=s,o=0):s===a&&(l.push(i[e]),o++),s=1);return 0===o?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,r){return t.sumsqerr(e)/(e.length-(r?1:0))},t.pooledvariance=function(e){var r=e.reduce((function(e,r){return e+t.sumsqerr(r)}),0),n=e.reduce((function(t,e){return t+e.length}),0);return r/(n-e.length)},t.deviation=function(e){for(var r=t.mean(e),n=e.length,i=new Array(n),s=0;s<n;s++)i[s]=e[s]-r;return i},t.stdev=function(r,n){return e.sqrt(t.variance(r,n))},t.pooledstdev=function(r){return e.sqrt(t.pooledvariance(r))},t.meandev=function(r){for(var n=t.mean(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.mean(i)},t.meddev=function(r){for(var n=t.median(r),i=[],s=r.length-1;s>=0;s--)i.push(e.abs(r[s]-n));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var r=t.length,i=t.slice().sort(n);return[i[e.round(r/4)-1],i[e.round(r/2)-1],i[e.round(3*r/4)-1]]},t.quantiles=function(t,r,s,a){var o,l,c,h,u,d=t.slice().sort(n),p=[r.length],f=t.length;for(void 0===s&&(s=3/8),void 0===a&&(a=3/8),o=0;o<r.length;o++)c=f*(l=r[o])+(s+l*(1-s-a)),h=e.floor(i(c,1,f-1)),u=i(c-h,0,1),p[o]=(1-u)*d[h-1]+u*d[h];return p},t.percentile=function(t,e,r){var i=t.slice().sort(n),s=e*(i.length+(r?1:-1))+(r?0:1),a=parseInt(s),o=s-a;return a+1<i.length?i[a-1]+o*(i[a]-i[a-1]):i[a-1]},t.percentileOfScore=function(t,e,r){var n,i,s=0,a=t.length,o=!1;for("strict"===r&&(o=!0),i=0;i<a;i++)n=t[i],(o&&n<e||!o&&n<=e)&&s++;return s/a},t.histogram=function(r,n){n=n||4;var i,s=t.min(r),a=(t.max(r)-s)/n,o=r.length,l=[];for(i=0;i<n;i++)l[i]=0;for(i=0;i<o;i++)l[e.min(e.floor((r[i]-s)/a),n-1)]+=1;return l},t.covariance=function(e,r){var n,i=t.mean(e),s=t.mean(r),a=e.length,o=new Array(a);for(n=0;n<a;n++)o[n]=(e[n]-i)*(r[n]-s);return t.sum(o)/(a-1)},t.corrcoeff=function(e,r){return t.covariance(e,r)/t.stdev(e,1)/t.stdev(r,1)},t.spearmancoeff=function(e,r){return e=t.rank(e),r=t.rank(r),t.corrcoeff(e,r)},t.stanMoment=function(r,n){for(var i=t.mean(r),s=t.stdev(r),a=r.length,o=0,l=0;l<a;l++)o+=e.pow((r[l]-i)/s,n);return o/r.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var s=t.prototype;!function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for(l=!0===n?this:this.transpose();o<l.length;o++)a[o]=t[e](l[o]);return a}return t[e](this[0],n)}}(e[n])}("cumsum cumprod".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(n,i){var a=[],o=0,l=this;if(r(n)&&(i=n,n=!1),i)return setTimeout((function(){i.call(l,s[e].call(l,n))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===n?this:this.transpose());o<l.length;o++)a[o]=t[e](l[o]);return!0===n?t[e](t.utils.toVector(a)):a}return t[e](this[0],n)}}(e[n])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){s[e]=function(){var n,i=[],a=0,o=this,l=Array.prototype.slice.call(arguments);if(r(l[l.length-1])){n=l[l.length-1];var c=l.slice(0,l.length-1);return setTimeout((function(){n.call(o,s[e].apply(o,c))})),this}n=void 0;var h=function(r){return t[e].apply(o,[r].concat(l))};if(this.length>1){for(o=o.transpose();a<o.length;a++)i[a]=h(o[a]);return i}return h(this[0])}}(e[n])}("quantiles percentileOfScore".split(" "))}(t,Math),function(t,e){t.gammaln=function(t){var r,n,i,s=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(i=(n=r=t)+5.5,i-=(r+.5)*e.log(i);s<6;s++)o+=a[s]/++n;return e.log(2.5066282746310007*o/r)-i},t.loggam=function(t){var r,n,i,s,a,o,l,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(r=t,l=0,1==t||2==t)return 0;for(t<=7&&(r=t+(l=e.floor(7-t))),n=1/(r*r),i=2*e.PI,a=c[9],o=8;o>=0;o--)a*=n,a+=c[o];if(s=a/r+.5*e.log(i)+(r-.5)*e.log(r)-r,t<=7)for(o=1;o<=l;o++)s-=e.log(r-1),r-=1;return s},t.gammafn=function(t){var r,n,i,s,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,c=0,h=0,u=0,d=t;if(t>171.6243769536076)return 1/0;if(d<=0){if(!(s=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*s),d=1-d}for(i=d,n=d<1?d++:(d-=c=(0|d)-1)-1,r=0;r<8;++r)u=(u+a[r])*n,h=h*n+o[r];if(s=u/h+1,i<d)s/=i;else if(i>d)for(r=0;r<c;++r)s*=d,d++;return l&&(s=l/s),s},t.gammap=function(e,r){return t.lowRegGamma(e,r)*t.gammafn(e)},t.lowRegGamma=function(r,n){var i,s=t.gammaln(r),a=r,o=1/r,l=o,c=n+1-r,h=1/1e-30,u=1/c,d=u,p=1,f=-~(8.5*e.log(r>=1?r:1/r)+.4*r+17);if(n<0||r<=0)return NaN;if(n<r+1){for(;p<=f;p++)o+=l*=n/++a;return o*e.exp(-n+r*e.log(n)-s)}for(;p<=f;p++)d*=(u=1/(u=(i=-p*(p-r))*u+(c+=2)))*(h=c+i/h);return 1-d*e.exp(-n+r*e.log(n)-s)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(r,n){return r>170||n>170?e.exp(t.combinationln(r,n)):t.factorial(r)/t.factorial(n)/t.factorial(r-n)},t.combinationln=function(e,r){return t.factorialln(e)-t.factorialln(r)-t.factorialln(e-r)},t.permutation=function(e,r){return t.factorial(e)/t.factorial(e-r)},t.betafn=function(r,n){if(!(r<=0||n<=0))return r+n>170?e.exp(t.betaln(r,n)):t.gammafn(r)*t.gammafn(n)/t.gammafn(r+n)},t.betaln=function(e,r){return t.gammaln(e)+t.gammaln(r)-t.gammaln(e+r)},t.betacf=function(t,r,n){var i,s,a,o,l=1e-30,c=1,h=r+n,u=r+1,d=r-1,p=1,f=1-h*t/u;for(e.abs(f)<l&&(f=l),o=f=1/f;c<=100&&(f=1+(s=c*(n-c)*t/((d+(i=2*c))*(r+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=(f=1/f)*p,f=1+(s=-(r+c)*(h+c)*t/((r+i)*(u+i)))*f,e.abs(f)<l&&(f=l),p=1+s/p,e.abs(p)<l&&(p=l),o*=a=(f=1/f)*p,!(e.abs(a-1)<3e-7));c++);return o},t.gammapinv=function(r,n){var i,s,a,o,l,c,h=0,u=n-1,d=1e-8,p=t.gammaln(n);if(r>=1)return e.max(100,n+100*e.sqrt(n));if(r<=0)return 0;for(n>1?(l=e.log(u),c=e.exp(u*(l-1)-p),o=r<.5?r:1-r,i=(2.30753+.27061*(s=e.sqrt(-2*e.log(o))))/(1+s*(.99229+.04481*s))-s,r<.5&&(i=-i),i=e.max(.001,n*e.pow(1-1/(9*n)-i/(3*e.sqrt(n)),3))):i=r<(s=1-n*(.253+.12*n))?e.pow(r/s,1/n):1-e.log(1-(r-s)/(1-s));h<12;h++){if(i<=0)return 0;if((i-=s=(a=(t.lowRegGamma(n,i)-r)/(s=n>1?c*e.exp(-(i-u)+u*(e.log(i)-l)):e.exp(-i+u*e.log(i)-p)))/(1-.5*e.min(1,a*((n-1)/i-1))))<=0&&(i=.5*(i+s)),e.abs(s)<d*i)break}return i},t.erf=function(t){var r,n,i,s,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],o=a.length-1,l=!1,c=0,h=0;for(t<0&&(t=-t,l=!0),n=4*(r=2/(2+t))-2;o>0;o--)i=c,c=n*c-h+a[o],h=i;return s=r*e.exp(-t*t+.5*(a[0]+n*c)-h),l?s-1:1-s},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(r){var n,i,s,a,o=0;if(r>=2)return-100;if(r<=0)return 100;for(a=r<1?r:2-r,n=-.70711*((2.30753+.27061*(s=e.sqrt(-2*e.log(a/2))))/(1+s*(.99229+.04481*s))-s);o<2;o++)n+=(i=t.erfc(n)-a)/(1.1283791670955126*e.exp(-n*n)-n*i);return r<1?n:-n},t.ibetainv=function(r,n,i){var s,a,o,l,c,h,u,d,p,f,m=1e-8,b=n-1,v=i-1,g=0;if(r<=0)return 0;if(r>=1)return 1;for(n>=1&&i>=1?(o=r<.5?r:1-r,h=(2.30753+.27061*(l=e.sqrt(-2*e.log(o))))/(1+l*(.99229+.04481*l))-l,r<.5&&(h=-h),u=(h*h-3)/6,d=2/(1/(2*n-1)+1/(2*i-1)),p=h*e.sqrt(u+d)/d-(1/(2*i-1)-1/(2*n-1))*(u+5/6-2/(3*d)),h=n/(n+i*e.exp(2*p))):(s=e.log(n/(n+i)),a=e.log(i/(n+i)),h=r<(l=e.exp(n*s)/n)/(p=l+(c=e.exp(i*a)/i))?e.pow(n*p*r,1/n):1-e.pow(i*p*(1-r),1/i)),f=-t.gammaln(n)-t.gammaln(i)+t.gammaln(n+i);g<10;g++){if(0===h||1===h)return h;if((h-=l=(c=(t.ibeta(h,n,i)-r)/(l=e.exp(b*e.log(h)+v*e.log(1-h)+f)))/(1-.5*e.min(1,c*(b/h-v/(1-h)))))<=0&&(h=.5*(h+l)),h>=1&&(h=.5*(h+l+1)),e.abs(l)<m*h&&g>0)break}return h},t.ibeta=function(r,n,i){var s=0===r||1===r?0:e.exp(t.gammaln(n+i)-t.gammaln(n)-t.gammaln(i)+n*e.log(r)+i*e.log(1-r));return!(r<0||r>1)&&(r<(n+1)/(n+i+2)?s*t.betacf(r,n,i)/n:1-s*t.betacf(1-r,i,n)/i)},t.randn=function(r,n){var i,s,a,o,l;if(n||(n=r),r)return t.create(r,n,(function(){return t.randn()}));do{i=t._random_fn(),s=1.7156*(t._random_fn()-.5),l=(a=i-.449871)*a+(o=e.abs(s)+.386595)*(.196*o-.25472*a)}while(l>.27597&&(l>.27846||s*s>-4*e.log(i)*i*i));return s/i},t.randg=function(r,n,i){var s,a,o,l,c,h,u=r;if(i||(i=n),r||(r=1),n)return(h=t.zeros(n,i)).alter((function(){return t.randg(r)})),h;r<1&&(r+=1),s=r-1/3,a=1/e.sqrt(9*s);do{do{l=1+a*(c=t.randn())}while(l<=0);l*=l*l,o=t._random_fn()}while(o>1-.331*e.pow(c,4)&&e.log(o)>.5*c*c+s*(1-l+e.log(l)));if(r==u)return s*l;do{o=t._random_fn()}while(0===o);return e.pow(o,1/u)*s*l},function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(r){return t[e](r)})))}}(e[r])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[r])}("randn".split(" "))}(t,Math),function(t,e){function r(t,r,n,i){for(var s,a=0,o=1,l=1,c=1,h=0,u=0;e.abs((l-u)/l)>i;)u=l,o=c+(s=-(r+h)*(r+n+h)*t/(r+2*h)/(r+2*h+1))*o,l=(a=l+s*a)+(s=(h+=1)*(n-h)*t/(r+2*h-1)/(r+2*h))*l,a/=c=o+s*c,o/=c,l/=c,c=1;return l/r}function n(t){return t/e.abs(t)}function i(r,n,i){var s=12,a=6,o=-30,l=-50,c=60,h=8,u=3,d=2,p=3,f=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],m=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],b=.5*r;if(b>=h)return 1;var v,g=2*t.normal.cdf(b,0,1,1,0)-1;g=g>=e.exp(l/i)?e.pow(g,i):0;for(var y=b,w=(h-b)/(v=r>u?d:p),x=y+w,$=0,_=i-1,k=1;k<=v;k++){for(var S=0,A=.5*(x+y),E=.5*(x-y),M=1;M<=s;M++){var T,C=A+E*(a<M?f[(T=s-M+1)-1]:-f[(T=M)-1]),N=C*C;if(N>c)break;var R=2*t.normal.cdf(C,0,1,1,0)*.5-2*t.normal.cdf(C,r,1,1,0)*.5;R>=e.exp(o/_)&&(S+=R=m[T-1]*e.exp(-.5*N)*e.pow(R,_))}$+=S*=2*E*i/e.sqrt(2*e.PI),y=x,x+=w}return(g+=$)<=e.exp(o/n)?0:(g=e.pow(g,n))>=1?1:g}function s(t,r,n){var i=.322232421088,s=.099348462606,a=-1,o=.588581570495,l=-.342242088547,c=.531103462366,h=-.204231210125,u=.10353775285,d=-453642210148e-16,p=.0038560700634,f=.8832,m=.2368,b=1.214,v=1.208,g=1.4142,y=120,w=.5-.5*t,x=e.sqrt(e.log(1/(w*w))),$=x+((((x*d+h)*x+l)*x+a)*x+i)/((((x*p+u)*x+c)*x+o)*x+s);n<y&&($+=($*$*$+$)/n/4);var _=f-m*$;return n<y&&(_+=-b/n+v*$/n),$*(_*e.log(r-1)+g)}!function(e){for(var r=0;r<e.length;r++)!function(e){t[e]=function t(e,r,n){return this instanceof t?(this._a=e,this._b=r,this._c=n,this):new t(e,r,n)},t.fn[e]=function(r,n,i){var s=t[e](r,n,i);return s.data=this,s},t[e].prototype.sample=function(r){var n=this._a,i=this._b,s=this._c;return r?t.alter(r,(function(){return t[e].sample(n,i,s)})):t[e].sample(n,i,s)},function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(n){var i=this._a,s=this._b,a=this._c;return n||0===n||(n=this.data),"number"!=typeof n?t.fn.map.call(n,(function(n){return t[e][r](n,i,s,a)})):t[e][r](n,i,s,a)}}(r[n])}("pdf cdf inv".split(" ")),function(r){for(var n=0;n<r.length;n++)!function(r){t[e].prototype[r]=function(){return t[e][r](this._a,this._b,this._c)}}(r[n])}("mean median mode variance".split(" "))}(e[r])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(r,n,i){return r>1||r<0?0:1==n&&1==i?1:n<512&&i<512?e.pow(r,n-1)*e.pow(1-r,i-1)/t.betafn(n,i):e.exp((n-1)*e.log(r)+(i-1)*e.log(1-r)-t.betaln(n,i))},cdf:function(e,r,n){return e>1||e<0?1*(e>1):t.ibeta(e,r,n)},inv:function(e,r,n){return t.ibetainv(e,r,n)},mean:function(t,e){return t/(t+e)},median:function(e,r){return t.ibetainv(.5,e,r)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,r){var n=t.randg(e);return n/(n+t.randg(r))},variance:function(t,r){return t*r/(e.pow(t+r,2)*(t+r+1))}}),t.extend(t.centralF,{pdf:function(r,n,i){var s;return r<0?0:n<=2?0===r&&n<2?1/0:0===r&&2===n?1:1/t.betafn(n/2,i/2)*e.pow(n/i,n/2)*e.pow(r,n/2-1)*e.pow(1+n/i*r,-(n+i)/2):(s=n*r/(i+r*n),n*(i/(i+r*n))/2*t.binomial.pdf((n-2)/2,(n+i-2)/2,s))},cdf:function(e,r,n){return e<0?0:t.ibeta(r*e/(r*e+n),r/2,n/2)},inv:function(e,r,n){return n/(r*(1/t.ibetainv(e,r/2,n/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,r){return 2*t.randg(e/2)/e/(2*t.randg(r/2)/r)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,r,n){return n<0?0:n/(e.pow(t-r,2)+e.pow(n,2))/e.PI},cdf:function(t,r,n){return e.atan((t-r)/n)/e.PI+.5},inv:function(t,r,n){return r+n*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(r,n){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*n+r}}),t.extend(t.chisquare,{pdf:function(r,n){return r<0?0:0===r&&2===n?.5:e.exp((n/2-1)*e.log(r)-r/2-n/2*e.log(2)-t.gammaln(n/2))},cdf:function(e,r){return e<0?0:t.lowRegGamma(r/2,e/2)},inv:function(e,r){return 2*t.gammapinv(e,.5*r)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,r){return t<0?0:r*e.exp(-r*t)},cdf:function(t,r){return t<0?0:1-e.exp(-r*t)},inv:function(t,r){return-e.log(1-t)/r},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(r){return-1/r*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(r,n,i){return r<0?0:0===r&&1===n?1/i:e.exp((n-1)*e.log(r)-r/i-t.gammaln(n)-n*e.log(i))},cdf:function(e,r,n){return e<0?0:t.lowRegGamma(r,e/n)},inv:function(e,r,n){return t.gammapinv(e,r)*n},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,r){return t.randg(e)*r},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(r,n,i){return r<=0?0:e.exp(-(n+1)*e.log(r)-i/r-t.gammaln(n)+n*e.log(i))},cdf:function(e,r,n){return e<=0?0:1-t.lowRegGamma(r,n/e)},inv:function(e,r,n){return n/t.gammapinv(1-e,r)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,r){return r/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,r,n){return 0===t&&1===r?n:1===t&&1===n?r:e.exp(e.log(r)+e.log(n)+(r-1)*e.log(t)+(n-1)*e.log(1-e.pow(t,r)))},cdf:function(t,r,n){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,r),n)},inv:function(t,r,n){return e.pow(1-e.pow(1-t,1/n),1/r)},mean:function(e,r){return r*t.gammafn(1+1/e)*t.gammafn(r)/t.gammafn(1+1/e+r)},median:function(t,r){return e.pow(1-e.pow(2,-1/r),1/t)},mode:function(t,r){if(t>=1&&r>=1&&1!==t&&1!==r)return e.pow((t-1)/(t*r-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,r,n){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(t)-r,2)/(2*n*n))},cdf:function(r,n,i){return r<0?0:.5+.5*t.erf((e.log(r)-n)/e.sqrt(2*i*i))},inv:function(r,n,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*r)+n)},mean:function(t,r){return e.exp(t+r*r/2)},median:function(t){return e.exp(t)},mode:function(t,r){return e.exp(t-r*r)},sample:function(r,n){return e.exp(t.randn()*n+r)},variance:function(t,r){return(e.exp(r*r)-1)*e.exp(2*t+r*r)}}),t.extend(t.noncentralt,{pdf:function(r,n,i){var s=1e-14;return e.abs(i)<s?t.studentt.pdf(r,n):e.abs(r)<s?e.exp(t.gammaln((n+1)/2)-i*i/2-.5*e.log(e.PI*n)-t.gammaln(n/2)):n/r*(t.noncentralt.cdf(r*e.sqrt(1+2/n),n+2,i)-t.noncentralt.cdf(r,n,i))},cdf:function(r,n,i){var s=1e-14,a=200;if(e.abs(i)<s)return t.studentt.cdf(r,n);var o=!1;r<0&&(o=!0,i=-i);for(var l=t.normal.cdf(-i,0,1),c=s+1,h=c,u=r*r/(r*r+n),d=0,p=e.exp(-i*i/2),f=e.exp(-i*i/2-.5*e.log(2)-t.gammaln(1.5))*i;d<a||h>s||c>s;)h=c,d>0&&(p*=i*i/(2*d),f*=i*i/(2*(d+.5))),l+=.5*(c=p*t.beta.cdf(u,d+.5,n/2)+f*t.beta.cdf(u,d+1,n/2)),d++;return o?1-l:l}}),t.extend(t.normal,{pdf:function(t,r,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(t-r,2)/(2*n*n))},cdf:function(r,n,i){return.5*(1+t.erf((r-n)/e.sqrt(2*i*i)))},inv:function(e,r,n){return-1.4142135623730951*n*t.erfcinv(2*e)+r},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,r){return t.randn()*r+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,r,n){return t<r?0:n*e.pow(r,n)/e.pow(t,n+1)},cdf:function(t,r,n){return t<r?0:1-e.pow(r/t,n)},inv:function(t,r,n){return r/e.pow(1-t,1/n)},mean:function(t,r){if(!(r<=1))return r*e.pow(t,r)/(r-1)},median:function(t,r){return t*(r*e.SQRT2)},mode:function(t){return t},variance:function(t,r){if(!(r<=2))return t*t*r/(e.pow(r-1,2)*(r-2))}}),t.extend(t.studentt,{pdf:function(r,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*t.betafn(.5,n/2))*e.pow(1+r*r/n,-(n+1)/2)},cdf:function(r,n){var i=n/2;return t.ibeta((r+e.sqrt(r*r+n))/(2*e.sqrt(r*r+n)),i,i)},inv:function(r,n){var i=t.ibetainv(2*e.min(r,1-r),.5*n,.5);return i=e.sqrt(n*(1-i)/i),r>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(r){return t.randn()*e.sqrt(r/(2*t.randg(r/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,r,n){return t<0||r<0||n<0?0:n/r*e.pow(t/r,n-1)*e.exp(-e.pow(t/r,n))},cdf:function(t,r,n){return t<0?0:1-e.exp(-e.pow(t/r,n))},inv:function(t,r,n){return r*e.pow(-e.log(1-t),1/n)},mean:function(e,r){return e*t.gammafn(1+1/r)},median:function(t,r){return t*e.pow(e.log(2),1/r)},mode:function(t,r){return r<=1?0:t*e.pow((r-1)/r,1/r)},sample:function(r,n){return r*e.pow(-e.log(t._random_fn()),1/n)},variance:function(r,n){return r*r*t.gammafn(1+2/n)-e.pow(t.weibull.mean(r,n),2)}}),t.extend(t.uniform,{pdf:function(t,e,r){return t<e||t>r?0:1/(r-e)},cdf:function(t,e,r){return t<e?0:t<r?(t-e)/(r-e):1},inv:function(t,e,r){return e+t*(r-e)},mean:function(t,e){return.5*(t+e)},median:function(e,r){return t.mean(e,r)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,r){return e/2+r/2+(r/2-e/2)*(2*t._random_fn()-1)},variance:function(t,r){return e.pow(r-t,2)/12}}),t.extend(t.binomial,{pdf:function(r,n,i){return 0===i||1===i?n*i===r?1:0:t.combination(n,r)*e.pow(i,r)*e.pow(1-i,n-r)},cdf:function(n,i,s){var a,o=1e-10;if(n<0)return 0;if(n>=i)return 1;if(s<0||s>1||i<=0)return NaN;var l=s,c=(n=e.floor(n))+1,h=i-n,u=c+h,d=e.exp(t.gammaln(u)-t.gammaln(h)-t.gammaln(c)+c*e.log(l)+h*e.log(1-l));return a=l<(c+1)/(u+2)?d*r(l,c,h,o):1-d*r(1-l,h,c,o),e.round(1/o*(1-a))/(1/o)}}),t.extend(t.negbin,{pdf:function(r,n,i){return r===r>>>0&&(r<0?0:t.combination(r+n-1,n-1)*e.pow(1-i,r)*e.pow(i,n))},cdf:function(e,r,n){var i=0,s=0;if(e<0)return 0;for(;s<=e;s++)i+=t.negbin.pdf(s,r,n);return i}}),t.extend(t.hypgeom,{pdf:function(r,n,i,s){if(r!=r|0)return!1;if(r<0||r<i-(n-s))return 0;if(r>s||r>i)return 0;if(2*i>n)return 2*s>n?t.hypgeom.pdf(n-i-s+r,n,n-i,n-s):t.hypgeom.pdf(s-r,n,n-i,s);if(2*s>n)return t.hypgeom.pdf(i-r,n,i,n-s);if(i<s)return t.hypgeom.pdf(r,n,s,i);for(var a=1,o=0,l=0;l<r;l++){for(;a>1&&o<s;)a*=1-i/(n-o),o++;a*=(s-l)*(i-l)/((l+1)*(n-i-s+l+1))}for(;o<s;o++)a*=1-i/(n-o);return e.min(1,e.max(0,a))},cdf:function(r,n,i,s){if(r<0||r<i-(n-s))return 0;if(r>=s||r>=i)return 1;if(2*i>n)return 2*s>n?t.hypgeom.cdf(n-i-s+r,n,n-i,n-s):1-t.hypgeom.cdf(s-r-1,n,n-i,s);if(2*s>n)return 1-t.hypgeom.cdf(i-r-1,n,i,n-s);if(i<s)return t.hypgeom.cdf(r,n,s,i);for(var a=1,o=1,l=0,c=0;c<r;c++){for(;a>1&&l<s;){var h=1-i/(n-l);o*=h,a*=h,l++}a+=o*=(s-c)*(i-c)/((c+1)*(n-i-s+c+1))}for(;l<s;l++)a*=1-i/(n-l);return e.min(1,e.max(0,a))}}),t.extend(t.poisson,{pdf:function(r,n){return n<0||r%1!=0||r<0?0:e.pow(n,r)*e.exp(-n)/t.factorial(r)},cdf:function(e,r){var n=[],i=0;if(e<0)return 0;for(;i<=e;i++)n.push(t.poisson.pdf(i,r));return t.sum(n)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(r){var n=1,i=0,s=e.exp(-r);do{i++,n*=t._random_fn()}while(n>s);return i-1},sampleLarge:function(r){var n,i,s,a,o,l,c,h,u,d,p=r;for(a=e.sqrt(p),o=e.log(p),l=.02483*(c=.931+2.53*a)-.059,h=1.1239+1.1328/(c-3.4),u=.9277-3.6224/(c-2);;){if(i=e.random()-.5,s=e.random(),d=.5-e.abs(i),n=e.floor((2*l/d+c)*i+p+.43),d>=.07&&s<=u)return n;if(!(n<0||d<.013&&s>d)&&e.log(s)+e.log(h)-e.log(l/(d*d)+c)<=n*o-p-t.loggam(n+1))return n}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,r,n){return r<=e||n<e||n>r?NaN:t<e||t>r?0:t<n?2*(t-e)/((r-e)*(n-e)):t===n?2/(r-e):2*(r-t)/((r-e)*(r-n))},cdf:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=r?0:t>=n?1:t<=i?e.pow(t-r,2)/((n-r)*(i-r)):1-e.pow(n-t,2)/((n-r)*(n-i))},inv:function(t,r,n,i){return n<=r||i<r||i>n?NaN:t<=(i-r)/(n-r)?r+(n-r)*e.sqrt(t*((i-r)/(n-r))):r+(n-r)*(1-e.sqrt((1-t)*(1-(i-r)/(n-r))))},mean:function(t,e,r){return(t+e+r)/3},median:function(t,r,n){return n<=(t+r)/2?r-e.sqrt((r-t)*(r-n))/e.sqrt(2):n>(t+r)/2?t+e.sqrt((r-t)*(n-t))/e.sqrt(2):void 0},mode:function(t,e,r){return r},sample:function(r,n,i){var s=t._random_fn();return s<(i-r)/(n-r)?r+e.sqrt(s*(n-r)*(i-r)):n-e.sqrt((1-s)*(n-r)*(n-i))},variance:function(t,e,r){return(t*t+e*e+r*r-t*e-t*r-e*r)/18}}),t.extend(t.arcsine,{pdf:function(t,r,n){return n<=r?NaN:t<=r||t>=n?0:2/e.PI*e.pow(e.pow(n-r,2)-e.pow(2*t-r-n,2),-.5)},cdf:function(t,r,n){return t<r?0:t<n?2/e.PI*e.asin(e.sqrt((t-r)/(n-r))):1},inv:function(t,r,n){return r+(.5-.5*e.cos(e.PI*t))*(n-r)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,n){return(r+n)/2+(n-r)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,r){return r<=t?NaN:e.pow(r-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,r,n){return n<=0?0:e.exp(-e.abs(t-r)/n)/(2*n)},cdf:function(t,r,n){return n<=0?0:t<r?.5*e.exp((t-r)/n):1-.5*e.exp(-(t-r)/n)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(r,i){var s=t._random_fn()-.5;return r-i*n(s)*e.log(1-2*e.abs(s))}}),t.extend(t.tukey,{cdf:function(r,n,s){var a=1,o=n,l=16,c=8,h=-30,u=1e-14,d=100,p=800,f=5e3,m=25e3,b=1,v=.5,g=.25,y=.125,w=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],x=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(r<=0)return 0;if(s<2||a<1||o<2)return NaN;if(!Number.isFinite(r))return 1;if(s>m)return i(r,a,o);var $,_=.5*s,k=_*e.log(s)-s*e.log(2)-t.gammaln(_),S=_-1,A=.25*s;$=s<=d?b:s<=p?v:s<=f?g:y,k+=e.log($);for(var E=0,M=1;M<=50;M++){for(var T=0,C=(2*M-1)*$,N=1;N<=l;N++){var R,P;c<N?(R=N-c-1,P=k+S*e.log(C+w[R]*$)-(w[R]*$+C)*A):(R=N-1,P=k+S*e.log(C-w[R]*$)+(w[R]*$-C)*A),P>=h&&(T+=i(c<N?r*e.sqrt(.5*(w[R]*$+C)):r*e.sqrt(.5*(-w[R]*$+C)),a,o)*x[R]*e.exp(P))}if(M*$>=1&&T<=u)break;E+=T}if(T>u)throw new Error("tukey.cdf failed to converge");return E>1&&(E=1),E},inv:function(r,n,i){var a=1e-4,o=50;if(i<2||n<2)return NaN;if(r<0||r>1)return NaN;if(0===r)return 0;if(1===r)return 1/0;var l,c=s(r,n,i),h=t.tukey.cdf(c,n,i)-r;l=h>0?e.max(0,c-1):c+1;for(var u,d=t.tukey.cdf(l,n,i)-r,p=1;p<o;p++)if(u=l-d*(l-c)/(d-h),h=d,c=l,u<0&&(u=0,d=-r),d=t.tukey.cdf(u,n,i)-r,l=u,e.abs(l-c)<a)return u;throw new Error("tukey.inv failed to converge")}})}(t,Math),function(t,e){var r=Array.prototype.push,n=t.utils.isArray;function i(e){return n(e)||e instanceof t}t.extend({add:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t+r[e][n]}))):t.map(e,(function(t){return t+r}))},subtract:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.map(e,(function(t,e,n){return t-r[e][n]||0}))):t.map(e,(function(t){return t-r}))},divide:function(e,r){return i(r)?(i(r[0])||(r=[r]),t.multiply(e,t.inv(r))):t.map(e,(function(t){return t/r}))},multiply:function(e,r){var n,s,a,o,l,c,h,u;if(void 0===e.length&&void 0===r.length)return e*r;if(l=e.length,c=e[0].length,h=t.zeros(l,a=i(r)?r[0].length:c),u=0,i(r)){for(;u<a;u++)for(n=0;n<l;n++){for(o=0,s=0;s<c;s++)o+=e[n][s]*r[s][u];h[n][u]=o}return 1===l&&1===u?h[0][0]:h}return t.map(e,(function(t){return t*r}))},outer:function(e,r){return t.multiply(e.map((function(t){return[t]})),[r])},dot:function(e,r){i(e[0])||(e=[e]),i(r[0])||(r=[r]);for(var n,s,a=1===e[0].length&&1!==e.length?t.transpose(e):e,o=1===r[0].length&&1!==r.length?t.transpose(r):r,l=[],c=0,h=a.length,u=a[0].length;c<h;c++){for(l[c]=[],n=0,s=0;s<u;s++)n+=a[c][s]*o[c][s];l[c]=n}return 1===l.length?l[0]:l},pow:function(r,n){return t.map(r,(function(t){return e.pow(t,n)}))},exp:function(r){return t.map(r,(function(t){return e.exp(t)}))},log:function(r){return t.map(r,(function(t){return e.log(t)}))},abs:function(r){return t.map(r,(function(t){return e.abs(t)}))},norm:function(t,r){var n=0,s=0;for(isNaN(r)&&(r=2),i(t[0])&&(t=t[0]);s<t.length;s++)n+=e.pow(e.abs(t[s]),r);return e.pow(n,1/r)},angle:function(r,n){return e.acos(t.dot(r,n)/(t.norm(r)*t.norm(n)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)r.apply(i[n],e[n]);return i},inv:function(e){for(var r,n=e.length,i=e[0].length,s=t.identity(n,i),a=t.gauss_jordan(e,s),o=[],l=0;l<n;l++)for(o[l]=[],r=i;r<a[0].length;r++)o[l][r-i]=a[l][r];return o},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var r=0,n=0;n<e.length;n++){for(var i=[],s=1;s<e.length;s++){i[s-1]=[];for(var a=0;a<e.length;a++)a<n?i[s-1][a]=e[s][a]:a>n&&(i[s-1][a-1]=e[s][a])}var o=n%2?-1:1;r+=t(i)*e[0][n]*o}return r},gauss_elimination:function(r,n){var i,s,a,o,l=0,c=0,h=r.length,u=r[0].length,d=1,p=0,f=[];for(i=(r=t.aug(r,n))[0].length,l=0;l<h;l++){for(s=r[l][l],c=l,o=l+1;o<u;o++)s<e.abs(r[o][l])&&(s=r[o][l],c=o);if(c!=l)for(o=0;o<i;o++)a=r[l][o],r[l][o]=r[c][o],r[c][o]=a;for(c=l+1;c<h;c++)for(d=r[c][l]/r[l][l],o=l;o<i;o++)r[c][o]=r[c][o]-d*r[l][o]}for(l=h-1;l>=0;l--){for(p=0,c=l+1;c<=h-1;c++)p+=f[c]*r[l][c];f[l]=(r[l][i-1]-p)/r[l][l]}return f},gauss_jordan:function(r,n){var i,s,a,o=t.aug(r,n),l=o.length,c=o[0].length,h=0;for(s=0;s<l;s++){var u=s;for(a=s+1;a<l;a++)e.abs(o[a][s])>e.abs(o[u][s])&&(u=a);var d=o[s];for(o[s]=o[u],o[u]=d,a=s+1;a<l;a++)for(h=o[a][s]/o[s][s],i=s;i<c;i++)o[a][i]-=o[s][i]*h}for(s=l-1;s>=0;s--){for(h=o[s][s],a=0;a<s;a++)for(i=c-1;i>s-1;i--)o[a][i]-=o[s][i]*o[a][s]/h;for(o[s][s]/=h,i=l;i<c;i++)o[s][i]/=h}return o},triaUpSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i-1,-1,-1).forEach((function(a){n=t.arange(a+1,i).map((function(t){return s[t]*e[a][t]})),s[a]=(r[a]-t.sum(n))/e[a][a]})),a?s.map((function(t){return[t]})):s},triaLowSolve:function(e,r){var n,i=e[0].length,s=t.zeros(1,i)[0],a=!1;return null!=r[0].length&&(r=r.map((function(t){return t[0]})),a=!0),t.arange(i).forEach((function(i){n=t.arange(i).map((function(t){return e[i][t]*s[t]})),s[i]=(r[i]-t.sum(n))/e[i][i]})),a?s.map((function(t){return[t]})):s},lu:function(e){var r,n=e.length,i=t.identity(n),s=t.zeros(e.length,e[0].length);return t.arange(n).forEach((function(t){s[0][t]=e[0][t]})),t.arange(1,n).forEach((function(a){t.arange(a).forEach((function(n){r=t.arange(n).map((function(t){return i[a][t]*s[t][n]})),i[a][n]=(e[a][n]-t.sum(r))/s[n][n]})),t.arange(a,n).forEach((function(n){r=t.arange(a).map((function(t){return i[a][t]*s[t][n]})),s[a][n]=e[r.length][n]-t.sum(r)}))})),[i,s]},cholesky:function(r){var n,i=r.length,s=t.zeros(r.length,r[0].length);return t.arange(i).forEach((function(a){n=t.arange(a).map((function(t){return e.pow(s[a][t],2)})),s[a][a]=e.sqrt(r[a][a]-t.sum(n)),t.arange(a+1,i).forEach((function(e){n=t.arange(a).map((function(t){return s[a][t]*s[e][t]})),s[e][a]=(r[a][e]-t.sum(n))/s[a][a]}))})),s},gauss_jacobi:function(r,n,i,s){for(var a,o,l,c,h=0,u=0,d=r.length,p=[],f=[],m=[];h<d;h++)for(p[h]=[],f[h]=[],m[h]=[],u=0;u<d;u++)h>u?(p[h][u]=r[h][u],f[h][u]=m[h][u]=0):h<u?(f[h][u]=r[h][u],p[h][u]=m[h][u]=0):(m[h][u]=r[h][u],p[h][u]=f[h][u]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(p,f)),-1),o=t.multiply(t.inv(m),n),a=i,c=t.add(t.multiply(l,i),o),h=2;e.abs(t.norm(t.subtract(c,a)))>s;)a=c,c=t.add(t.multiply(l,a),o),h++;return c},gauss_seidel:function(r,n,i,s){for(var a,o,l,c,h,u=0,d=r.length,p=[],f=[],m=[];u<d;u++)for(p[u]=[],f[u]=[],m[u]=[],a=0;a<d;a++)u>a?(p[u][a]=r[u][a],f[u][a]=m[u][a]=0):u<a?(f[u][a]=r[u][a],p[u][a]=m[u][a]=0):(m[u][a]=r[u][a],p[u][a]=f[u][a]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,p)),f),-1),l=t.multiply(t.inv(t.add(m,p)),n),o=i,h=t.add(t.multiply(c,i),l),u=2;e.abs(t.norm(t.subtract(h,o)))>s;)o=h,h=t.add(t.multiply(c,o),l),u+=1;return h},SOR:function(r,n,i,s,a){for(var o,l,c,h,u,d=0,p=r.length,f=[],m=[],b=[];d<p;d++)for(f[d]=[],m[d]=[],b[d]=[],o=0;o<p;o++)d>o?(f[d][o]=r[d][o],m[d][o]=b[d][o]=0):d<o?(m[d][o]=r[d][o],f[d][o]=b[d][o]=0):(b[d][o]=r[d][o],f[d][o]=m[d][o]=0);for(h=t.multiply(t.inv(t.add(b,t.multiply(f,a))),t.subtract(t.multiply(b,1-a),t.multiply(m,a))),c=t.multiply(t.multiply(t.inv(t.add(b,t.multiply(f,a))),n),a),l=i,u=t.add(t.multiply(h,i),c),d=2;e.abs(t.norm(t.subtract(u,l)))>s;)l=u,u=t.add(t.multiply(h,l),c),d++;return u},householder:function(r){for(var n,i,s,a,o=r.length,l=r[0].length,c=0,h=[],u=[];c<o-1;c++){for(n=0,a=c+1;a<l;a++)n+=r[a][c]*r[a][c];for(n=(r[c+1][c]>0?-1:1)*e.sqrt(n),i=e.sqrt((n*n-r[c+1][c]*n)/2),(h=t.zeros(o,1))[c+1][0]=(r[c+1][c]-n)/(2*i),s=c+2;s<o;s++)h[s][0]=r[s][c]/(2*i);u=t.subtract(t.identity(o,l),t.multiply(t.multiply(h,t.transpose(h)),2)),r=t.multiply(u,t.multiply(r,u))}return r},QR:function(){var r=t.sum,n=t.arange;function i(i){var s,a,o,l=i.length,c=i[0].length,h=t.zeros(c,c);for(i=t.copy(i),a=0;a<c;a++){for(h[a][a]=e.sqrt(r(n(l).map((function(t){return i[t][a]*i[t][a]})))),s=0;s<l;s++)i[s][a]=i[s][a]/h[a][a];for(o=a+1;o<c;o++)for(h[a][o]=r(n(l).map((function(t){return i[t][a]*i[t][o]}))),s=0;s<l;s++)i[s][o]=i[s][o]-i[s][a]*h[a][o]}return[i,h]}return i}(),lstsq:function(){function e(e){var r=(e=t.copy(e)).length,n=t.identity(r);return t.arange(r-1,-1,-1).forEach((function(r){t.sliceAssign(n,{row:r},t.divide(t.slice(n,{row:r}),e[r][r])),t.sliceAssign(e,{row:r},t.divide(t.slice(e,{row:r}),e[r][r])),t.arange(r).forEach((function(i){var s=t.multiply(e[i][r],-1),a=t.slice(e,{row:i}),o=t.multiply(t.slice(e,{row:r}),s);t.sliceAssign(e,{row:i},t.add(a,o));var l=t.slice(n,{row:i}),c=t.multiply(t.slice(n,{row:r}),s);t.sliceAssign(n,{row:i},t.add(l,c))}))})),n}function r(r,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var s=t.QR(r),a=s[0],o=s[1],l=r[0].length,c=t.slice(a,{col:{end:l}}),h=e(t.slice(o,{row:{end:l}})),u=t.transpose(c);void 0===u[0].length&&(u=[u]);var d=t.multiply(t.multiply(h,u),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d}return r}(),jacobi:function(r){for(var n,i,s,a,o,l,c,h=1,u=r.length,d=t.identity(u,u),p=[];1===h;){for(o=r[0][1],s=0,a=1,n=0;n<u;n++)for(i=0;i<u;i++)n!=i&&o<e.abs(r[n][i])&&(o=e.abs(r[n][i]),s=n,a=i);for(l=r[s][s]===r[a][a]?r[s][a]>0?e.PI/4:-e.PI/4:e.atan(2*r[s][a]/(r[s][s]-r[a][a]))/2,(c=t.identity(u,u))[s][s]=e.cos(l),c[s][a]=-e.sin(l),c[a][s]=e.sin(l),c[a][a]=e.cos(l),d=t.multiply(d,c),r=t.multiply(t.multiply(t.inv(c),r),c),h=0,n=1;n<u;n++)for(i=1;i<u;i++)n!=i&&e.abs(r[n][i])>.001&&(h=1)}for(n=0;n<u;n++)p.push(r[n][n]);return[d,p]},rungekutta:function(t,e,r,n,i,s){var a,o,l;if(2===s)for(;n<=r;)i+=((a=e*t(n,i))+(o=e*t(n+e,i+a)))/2,n+=e;if(4===s)for(;n<=r;)i+=((a=e*t(n,i))+2*(o=e*t(n+e/2,i+a/2))+2*(l=e*t(n+e/2,i+o/2))+e*t(n+e,i+l))/6,n+=e;return i},romberg:function(t,r,n,i){for(var s,a,o,l,c,h=0,u=(n-r)/2,d=[],p=[],f=[];h<i/2;){for(c=t(r),o=r,l=0;o<=n;o+=u,l++)d[l]=o;for(s=d.length,o=1;o<s-1;o++)c+=(o%2!=0?4:2)*t(d[o]);c=u/3*(c+t(n)),f[h]=c,u/=2,h++}for(a=f.length,s=1;1!==a;){for(o=0;o<a-1;o++)p[o]=(e.pow(4,s)*f[o+1]-f[o])/(e.pow(4,s)-1);a=p.length,f=p,p=[],s++}return f},richardson:function(t,r,n,i){function s(t,e){for(var r,n=0,i=t.length;n<i;n++)t[n]===e&&(r=n);return r}for(var a,o,l,c,h,u=e.abs(n-t[s(t,n)+1]),d=0,p=[],f=[];i>=u;)a=s(t,n+i),o=s(t,n),p[d]=(r[a]-2*r[o]+r[2*o-a])/(i*i),i/=2,d++;for(c=p.length,l=1;1!=c;){for(h=0;h<c-1;h++)f[h]=(e.pow(4,l)*p[h+1]-p[h])/(e.pow(4,l)-1);c=f.length,p=f,f=[],l++}return p},simpson:function(t,e,r,n){for(var i,s=(r-e)/n,a=t(e),o=[],l=e,c=0,h=1;l<=r;l+=s,c++)o[c]=l;for(i=o.length;h<i-1;h++)a+=(h%2!=0?4:2)*t(o[h]);return s/3*(a+t(r))},hermite:function(t,e,r,n){for(var i,s=t.length,a=0,o=0,l=[],c=[],h=[],u=[];o<s;o++){for(l[o]=1,i=0;i<s;i++)o!=i&&(l[o]*=(n-t[i])/(t[o]-t[i]));for(c[o]=0,i=0;i<s;i++)o!=i&&(c[o]+=1/(t[o]-t[i]));h[o]=(1-2*(n-t[o])*c[o])*(l[o]*l[o]),u[o]=(n-t[o])*(l[o]*l[o]),a+=h[o]*e[o]+u[o]*r[o]}return a},lagrange:function(t,e,r){for(var n,i,s=0,a=0,o=t.length;a<o;a++){for(i=e[a],n=0;n<o;n++)a!=n&&(i*=(r-t[n])/(t[a]-t[n]));s+=i}return s},cubic_spline:function(e,r,n){for(var i,s=e.length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[];a<s-1;a++)u[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/u[a]*(r[a+1]-r[a])-3/u[a-1]*(r[a]-r[a-1]);for(a=1;a<s-1;a++)o[a]=[],l[a]=[],o[a][a-1]=u[a-1],o[a][a]=2*(u[a-1]+u[a]),o[a][a+1]=u[a],l[a][0]=c[a];for(h=t.multiply(t.inv(o),l),i=0;i<s-1;i++)d[i]=(r[i+1]-r[i])/u[i]-u[i]*(h[i+1][0]+2*h[i][0])/3,p[i]=(h[i+1][0]-h[i][0])/(3*u[i]);for(i=0;i<s&&!(e[i]>n);i++);return r[i-=1]+(n-e[i])*d[i]+t.sq(n-e[i])*h[i]+(n-e[i])*t.sq(n-e[i])*p[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var r,n,i=e.length,s=e[0].length,a=0,o=[],l=[],c=[],h=[],u=[],d=[],p=[],f=[],m=[],b=[];for(a=0;a<i;a++)o[a]=t.sum(e[a])/s;for(a=0;a<s;a++)for(p[a]=[],r=0;r<i;r++)p[a][r]=e[r][a]-o[r];for(p=t.transpose(p),a=0;a<i;a++)for(f[a]=[],r=0;r<i;r++)f[a][r]=t.dot([p[a]],[p[r]])/(s-1);for(m=(c=t.jacobi(f))[0],l=c[1],b=t.transpose(m),a=0;a<l.length;a++)for(r=a;r<l.length;r++)l[a]<l[r]&&(n=l[a],l[a]=l[r],l[r]=n,h=b[a],b[a]=b[r],b[r]=h);for(d=t.transpose(p),a=0;a<i;a++)for(u[a]=[],r=0;r<d.length;r++)u[a][r]=t.dot([b[a]],[d[r]]);return[e,l,b,u]}}),function(e){for(var r=0;r<e.length;r++)!function(e){t.fn[e]=function(r,n){var i=this;return n?(setTimeout((function(){n.call(i,t.fn[e].call(i,r))}),15),this):"number"==typeof t[e](this,r)?t[e](this,r):t(t[e](this,r))}}(e[r])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(t,Math),function(t,e){var r=[].slice,n=t.utils.isNumber,i=t.utils.isArray;function s(t,r,n,i){if(t>1||n>1||t<=0||n<=0)throw new Error("Proportions should be greater than 0 and less than 1");var s=(t*r+n*i)/(r+i);return(t-n)/e.sqrt(s*(1-s)*(1/r+1/i))}t.extend({zscore:function(){var e=r.call(arguments);return n(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var n,s=r.call(arguments);return i(s[1])?(n=t.zscore(s[0],s[1],s[3]),1===s[2]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):s.length>2?(n=t.zscore(s[0],s[1],s[2]),1===s[3]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1)):(n=s[0],1===s[1]?t.normal.cdf(-e.abs(n),0,1):2*t.normal.cdf(-e.abs(n),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(r,n,i){var s=e.abs(this.zscore(r,i));return 1===n?t.normal.cdf(-s,0,1):2*t.normal.cdf(-s,0,1)}}),t.extend({tscore:function(){var n=r.call(arguments);return 4===n.length?(n[0]-n[1])/(n[2]/e.sqrt(n[3])):(n[0]-t.mean(n[1]))/(t.stdev(n[1],!0)/e.sqrt(n[1].length))},ttest:function(){var i,s=r.call(arguments);return 5===s.length?(i=e.abs(t.tscore(s[0],s[1],s[2],s[3])),1===s[4]?t.studentt.cdf(-i,s[3]-1):2*t.studentt.cdf(-i,s[3]-1)):n(s[1])?(i=e.abs(s[0]),1==s[2]?t.studentt.cdf(-i,s[1]-1):2*t.studentt.cdf(-i,s[1]-1)):(i=e.abs(t.tscore(s[0],s[1])),1==s[2]?t.studentt.cdf(-i,s[1].length-1):2*t.studentt.cdf(-i,s[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(r,n){return 1===n?1-t.studentt.cdf(e.abs(this.tscore(r)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(r)),this.cols()-1)}}),t.extend({anovafscore:function(){var n,i,s,a,o,l,c,h,u=r.call(arguments);if(1===u.length){for(o=new Array(u[0].length),c=0;c<u[0].length;c++)o[c]=u[0][c];u=o}for(i=new Array,c=0;c<u.length;c++)i=i.concat(u[c]);for(s=t.mean(i),n=0,c=0;c<u.length;c++)n+=u[c].length*e.pow(t.mean(u[c])-s,2);for(n/=u.length-1,l=0,c=0;c<u.length;c++)for(a=t.mean(u[c]),h=0;h<u[c].length;h++)l+=e.pow(u[c][h]-a,2);return n/(l/=i.length-u.length)},anovaftest:function(){var e,i,s,a,o=r.call(arguments);if(n(o[0]))return 1-t.centralF.cdf(o[0],o[1],o[2]);var l=t.anovafscore(o);for(e=o.length-1,s=0,a=0;a<o.length;a++)s+=o[a].length;return i=s-e-1,1-t.centralF.cdf(l,e,i)},ftest:function(e,r,n){return 1-t.centralF.cdf(e,r,n)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,r=0;for(e=0;e<this.length;e++)r+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,r-this.length)}}),t.extend({qscore:function(){var i,s,a,o,l,c=r.call(arguments);return n(c[0])?(i=c[0],s=c[1],a=c[2],o=c[3],l=c[4]):(i=t.mean(c[0]),s=t.mean(c[1]),a=c[0].length,o=c[1].length,l=c[2]),e.abs(i-s)/(l*e.sqrt((1/a+1/o)/2))},qtest:function(){var e,n=r.call(arguments);3===n.length?(e=n[0],n=n.slice(1)):7===n.length?(e=t.qscore(n[0],n[1],n[2],n[3],n[4]),n=n.slice(5)):(e=t.qscore(n[0],n[1],n[2]),n=n.slice(3));var i=n[0],s=n[1];return 1-t.tukey.cdf(e,s,i-s)},tukeyhsd:function(e){for(var r=t.pooledstdev(e),n=e.map((function(e){return t.mean(e)})),i=e.reduce((function(t,e){return t+e.length}),0),s=[],a=0;a<e.length;++a)for(var o=a+1;o<e.length;++o){var l=t.qtest(n[a],n[o],e[a].length,e[o].length,r,i,e.length);s.push([[a,o],l])}return s}}),t.extend({normalci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.normal.inv(i[1]/2,0,1)*i[2]/e.sqrt(i[3])):e.abs(t.normal.inv(i[1]/2,0,1)*t.stdev(i[2])/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},tci:function(){var n,i=r.call(arguments),s=new Array(2);return n=4===i.length?e.abs(t.studentt.inv(i[1]/2,i[3]-1)*i[2]/e.sqrt(i[3])):e.abs(t.studentt.inv(i[1]/2,i[2].length-1)*t.stdev(i[2],!0)/e.sqrt(i[2].length)),s[0]=i[0]-n,s[1]=i[0]+n,s},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,r){return t.normalci(e,r,this.toArray())},tci:function(e,r){return t.tci(e,r,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,1)},twoSidedDifferenceOfProportions:function(e,r,n,i){var a=s(e,r,n,i);return t.ztest(a,2)}})}(t,Math),t.models=function(){function e(e){var n=e[0].length,i=t.arange(n).map((function(i){var s=t.arange(n).filter((function(t){return t!==i}));return r(t.col(e,i).map((function(t){return t[0]})),t.col(e,s))}));return i}function r(e,r){var n=e.length,i=r[0].length-1,s=n-i-1,a=t.lstsq(r,e),o=t.multiply(r,a.map((function(t){return[t]}))).map((function(t){return t[0]})),l=t.subtract(e,o),c=t.mean(e),h=t.sum(o.map((function(t){return Math.pow(t-c,2)}))),u=t.sum(e.map((function(t,e){return Math.pow(t-o[e],2)}))),d=h+u;return{exog:r,endog:e,nobs:n,df_model:i,df_resid:s,coef:a,predict:o,resid:l,ybar:c,SST:d,SSE:h,SSR:u,R2:h/d}}function n(r){var n=e(r.exog),i=Math.sqrt(r.SSR/r.df_resid),s=n.map((function(t){var e=t.SST,r=t.R2;return i/Math.sqrt(e*(1-r))})),a=r.coef.map((function(t,e){return(t-0)/s[e]})),o=a.map((function(e){var n=t.studentt.cdf(e,r.df_resid);return 2*(n>.5?1-n:n)})),l=t.studentt.inv(.975,r.df_resid),c=r.coef.map((function(t,e){var r=l*s[e];return[t-r,t+r]}));return{se:s,t:a,p:o,sigmaHat:i,interval95:c}}function i(e){var r=e.R2/e.df_model/((1-e.R2)/e.df_resid),n=function(e,r,n){return t.beta.cdf(e/(n/r+e),r/2,n/2)};return{F_statistic:r,pvalue:1-n(r,e.df_model,e.df_resid)}}function s(t,e){var s=r(t,e),a=n(s),o=i(s),l=1-(1-s.R2)*((s.nobs-1)/s.df_resid);return s.t=a,s.f=o,s.adjust_R2=l,s}return{ols:s}}(),t.extend({buildxmatrix:function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;r++){var n=[1];e[r]=n.concat(arguments[r])}return t(e)},builddxmatrix:function(){for(var e=new Array(arguments[0].length),r=0;r<arguments[0].length;r++){var n=[1];e[r]=n.concat(arguments[0][r])}return t(e)},buildjxmatrix:function(e){for(var r=new Array(e.length),n=0;n<e.length;n++)r[n]=e[n];return t.builddxmatrix(r)},buildymatrix:function(e){return t(e).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(e,r){var n,i,s,a,o;if(e.cols()==r.rows()){if(r.rows()>1){for(a=[],n=0;n<e.rows();n++)for(a[n]=[],i=0;i<r.cols();i++){for(o=0,s=0;s<e.cols();s++)o+=e.toArray()[n][s]*r.toArray()[s][i];a[n][i]=o}return t(a)}for(a=[],n=0;n<e.rows();n++)for(a[n]=[],i=0;i<r.cols();i++){for(o=0,s=0;s<e.cols();s++)o+=e.toArray()[n][s]*r.toArray()[i];a[n][i]=o}return t(a)}},regress:function(e,r){var n=t.xtranspxinv(e),i=e.transpose(),s=t.matrixmult(t(n),i);return t.matrixmult(s,r)},regresst:function(e,r,n){var i=t.regress(e,r),s={anova:{}},a=t.jMatYBar(e,i);s.yBar=a;var o=r.mean();s.anova.residuals=t.residuals(r,a),s.anova.ssr=t.ssr(a,o),s.anova.msr=s.anova.ssr/(e[0].length-1),s.anova.sse=t.sse(r,a),s.anova.mse=s.anova.sse/(r.length-(e[0].length-1)-1),s.anova.sst=t.sst(r,o),s.anova.mst=s.anova.sst/(r.length-1),s.anova.r2=1-s.anova.sse/s.anova.sst,s.anova.r2<0&&(s.anova.r2=0),s.anova.fratio=s.anova.msr/s.anova.mse,s.anova.pvalue=t.anovaftest(s.anova.fratio,e[0].length-1,r.length-(e[0].length-1)-1),s.anova.rmse=Math.sqrt(s.anova.mse),s.anova.r2adj=1-s.anova.mse/s.anova.mst,s.anova.r2adj<0&&(s.anova.r2adj=0),s.stats=new Array(e[0].length);for(var l,c,h,u=t.xtranspxinv(e),d=0;d<i.length;d++)l=Math.sqrt(s.anova.mse*Math.abs(u[d][d])),c=Math.abs(i[d]/l),h=t.ttest(c,r.length-e[0].length-1,n),s.stats[d]=[i[d],l,c,h];return s.regress=i,s},xtranspx:function(e){return t.matrixmult(e.transpose(),e)},xtranspxinv:function(e){var r=t.matrixmult(e.transpose(),e);return t.inv(r)},jMatYBar:function(e,r){var n=t.matrixmult(e,r);return new t(n)},residuals:function(e,r){return t.matrixsubtract(e,r)},ssr:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},sse:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r},sst:function(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e,2);return r},matrixsubtract:function(e,r){for(var n=new Array(e.length),i=0;i<e.length;i++){n[i]=new Array(e[i].length);for(var s=0;s<e[i].length;s++)n[i][s]=e[i][s]-r[i][s]}return t(n)}}),t.jStat=t,t}();var Xo=Ko(Wo.exports);class Yo{static hM2Hr(t,e){return 0===t&&0===e?0:t/(t+e)}static faCr2Far(t,e){return 0===t&&0===e?0:t/(t+e)}static hMFaCr2Acc(t,e,r,n){return 0===t&&0===e&&0===r&&0===n?0:(t+n)/(t+e+r+n)}static hrFar2Acc(t,e){return(t+(1-e))/2}static hFa2Ppv(t,e){return 0===t&&0===e?0:t/(t+e)}static mCr2Fomr(t,e){return 0===t&&0===e?0:t/(t+e)}static hrFar2D(t,e,r=1){return 1===r?Xo.normal.inv(t,0,1)-Xo.normal.inv(e,0,1):Math.sqrt(2/(r*r+1))*(r*Xo.normal.inv(t,0,1)-Xo.normal.inv(e,0,1))}static hrFar2C(t,e,r=1){return 1===r?-(Xo.normal.inv(t,0,1)+Xo.normal.inv(e,0,1))/2:Math.sqrt(2/(r*r+1))*(r/(r+1))*-(Xo.normal.inv(t,0,1)+Xo.normal.inv(e,0,1))}static dC2Hr(t,e,r=1){return 1===r?Xo.normal.cdf(t/2-e,0,1):Xo.normal.cdf(Math.sqrt((r*r+1)/2)*(t/(1+r)-e/r),0,1)}static dC2Far(t,e,r=1){return 1===r?Xo.normal.cdf(-(t/2+e),0,1):Xo.normal.cdf(Math.sqrt((r*r+1)/2)*-(t/(1+r)+e),0,1)}static dFar2Hr(t,e,r=1){return 1===r?Xo.normal.cdf(t+Xo.normal.inv(e,0,1),0,1):Xo.normal.cdf((Math.sqrt((r*r+1)/2)*t+Xo.normal.inv(e,0,1))/r,0,1)}static cFar2Hr(t,e,r=1){return 1===r?Xo.normal.cdf(-2*t-Xo.normal.inv(e,0,1),0,1):Xo.normal.cdf(-Math.sqrt((r*r+1)/2)*((r+1)/r)*t-Xo.normal.inv(e,0,1),0,1)}static d2MuN(t,e=1){return 1===e?-t/2:-Math.sqrt((e*e+1)/2)*(1/(e+1))*t}static muN2D(t,e=1){return 1===e?-2*t:-Math.sqrt(2/(e*e+1))*(e+1)*t}static d2MuS(t,e=1){return 1===e?t/2:Math.sqrt((e*e+1)/2)*(e/(e+1))*t}static muS2D(t,e=1){return 1===e?2*t:Math.sqrt(2/(e*e+1))*((e+1)/e)*t}static c2L(t,e=1){return 1===e?t:Math.sqrt((e*e+1)/2)*t}static l2C(t,e=1){return 1===e?t:Math.sqrt(2/(e*e+1))*t}static s2H(t=1){return 1/(t*Math.sqrt(2*Math.PI))}static h2S(t){return 1/(t*Math.sqrt(2*Math.PI))}static hr2Zhr(t){return Xo.normal.inv(t,0,1)}static far2Zfar(t){return Xo.normal.inv(t,0,1)}static zhr2Hr(t){return Xo.normal.cdf(t,0,1)}static zfar2Far(t){return Xo.normal.cdf(t,0,1)}}class Zo extends Vo{static get properties(){return{contour:{attribute:"contour",type:String,reflect:!0},point:{attribute:"point",type:String,reflect:!0},isoD:{attribute:"iso-d",type:String,reflect:!0},isoC:{attribute:"iso-c",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},far:{attribute:"far",type:Number,reflect:!0},hr:{attribute:"hr",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1},c:{attribute:!1,type:Number,reflect:!1},s:{attribute:!1,type:Number,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.firstUpdate=!0,this.drag=!1,this.sdt=!1,this.contours=["sensitivity","bias","accuracy"],this.contour=void 0,this.points=["all","first","rest","none"],this.point="all",this.isoDs=["all","first","rest","none"],this.isoD="first",this.isoCs=["all","first","rest","none"],this.isoC="first",this.zRoc=!1,this.far=.25,this.hr=.75,this.s=1,this.label="",this.locations=[{name:"default",far:this.far,hr:this.hr,s:this.s,label:""}],this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.alignState()}alignState(){this.locations[0].hr=this.hr,this.locations[0].far=this.far,this.locations[0].s=this.s,this.locations[0].label=this.label,this.d=Yo.hrFar2D(this.hr,this.far,this.s),this.c=Yo.hrFar2C(this.hr,this.far,this.s),this.pointArray=[],this.isoDArray=[],this.isoCArray=[],this.locations.forEach(((t,e)=>{t.d=Yo.hrFar2D(t.hr,t.far,t.s),t.c=Yo.hrFar2C(t.hr,t.far,t.s),0!==e||"first"!==this.point&&"all"!==this.point?e>0&&("rest"===this.point||"all"===this.point)&&this.pointArray.push(t):this.pointArray.push(t),0!==e||"first"!==this.isoD&&"all"!==this.isoD?e>0&&("rest"===this.isoD||"all"===this.isoD)&&this.isoDArray.push(t):this.isoDArray.push(t),0!==e||"first"!==this.isoC&&"all"!==this.isoC?e>0&&("rest"===this.isoC||"all"===this.isoC)&&this.isoCArray.push(t):this.isoCArray.push(t)}))}set(t,e,r="default",n="",i=1){"default"===r&&(this.hr=t,this.far=e,this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:e,hr:t,s:i,label:n}):(s.hr=t,s.far=e,s.s=i,s.label=n),this.requestUpdate()}setWithSDT(t,e,r="default",n="",i=1){"default"===r&&(this.hr=Yo.dC2Hr(t,e,i),this.far=Yo.dC2Far(t,e,i),this.s=i,this.label=n);const s=this.locations.find((t=>t.name===r));void 0===s?this.locations.push({name:r,far:Yo.dC2Far(t,e,i),hr:Yo.dC2Hr(t,e,i),s:i,label:n}):(s.hr=Yo.dC2Hr(t,e,i),s.far=Yo.dC2Far(t,e,i),s.s=i,s.label=n),this.sdt=!0,this.requestUpdate()}static get styles(){return[super.styles,rt`
874
881
  :host {
875
882
  display: inline-block;
876
883
 
@@ -1002,9 +1009,9 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1002
1009
 
1003
1010
  fill: var(---color-text-inverse);
1004
1011
  }
1005
- `]}render(){return F`
1006
- ${ho.svgFilters}
1007
- `}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=2*this.rem,s=3*this.rem,a=3*this.rem,o=n-(i+s),l=n-(a+2*this.rem),c=parseInt(this.getComputedStyleValue("---transition-duration"),10),h=Ga().domain(this.zRoc?[-3,3]:[0,1]).range([0,l]);this.xScale=h;const u=Ga().domain(this.zRoc?[3,-3]:[1,0]).range([0,o]);this.yScale=u;const d=_r().subject(((t,e)=>({x:this.xScale(this.zRoc?bo.far2Zfar(e.far):e.far),y:this.yScale(this.zRoc?bo.hr2Zhr(e.hr):e.hr)}))).on("start",(t=>{dr(t.currentTarget).classed("dragging",!0)})).on("drag",((t,e)=>{this.drag=!0;const r=this.zRoc?bo.zfar2Far(this.xScale.invert(t.x)):this.xScale.invert(t.x),n=this.zRoc?bo.zhr2Hr(this.yScale.invert(t.y)):this.yScale.invert(t.y);e.far=r<.001?.001:r>.999?.999:r,e.hr=n<=.001?.001:n>=.999?.999:n,"default"===e.name&&(this.far=e.far,this.hr=e.hr),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))})).on("end",(t=>{dr(t.currentTarget).classed("dragging",!1)})),p=io().x((t=>h(this.zRoc?bo.far2Zfar(t.far):t.far))).y((t=>u(this.zRoc?bo.hr2Zhr(t.hr):t.hr))),f=dr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),m=f.enter().append("svg").classed("main",!0),b=m.merge(f).attr("viewBox",`0 0 ${n} ${n}`),v=m.append("g").classed("plot",!0),g=b.select(".plot").attr("transform",`translate(${a}, ${i})`);v.append("clipPath").attr("id","clip-roc-space").append("rect"),g.select("clipPath rect").attr("height",o+1).attr("width",l+1);const y=v.append("g").classed("underlayer",!0),w=g.select(".underlayer");if(y.append("rect").classed("background",!0),w.select(".background").attr("height",o).attr("width",l),this.firstUpdate||t.has("contour")||t.has("zRoc")||t.has("width")||t.has("height")||t.has("rem")||t.has("s"))if(void 0!==this.contour){const t=100,e=[];for(let r=.5,n=0;r<t;r+=1)for(let i=.5;i<t;i+=1,n+=1){const s=this.zRoc?bo.zhr2Hr(i/t*6-3):i/t,a=this.zRoc?bo.zfar2Far(6*(1-r/t)-3):1-r/t;e[n]="bias"===this.contour?bo.hrFar2C(s,a,this.s):"sensitivity"===this.contour?bo.hrFar2D(s,a,this.s):"accuracy"===this.contour?bo.hrFar2Acc(s,a):null}const r="bias"===this.contour?zt(-3,3,.25):"sensitivity"===this.contour?zt(-6,6,.5):"accuracy"===this.contour?zt(0,1,.05):null,n=Wi().size([t,t]).thresholds(r),i=this.getComputedStyleValue("bias"===this.contour?"---color-element-background":"sensitivity"===this.contour?"---color-d":"accuracy"===this.contour?"---color-acc-dark":null),s=this.getComputedStyleValue("bias"===this.contour?"---color-c":"sensitivity"===this.contour||"accuracy"===this.contour?"---color-element-background":null),a=Ga().domain($t(r)).interpolate((()=>an(i,s))),o=w.selectAll(".plot-contour").data([this.contour]),h=o.enter().append("g").classed("plot-contour",!0).merge(o).selectAll(".contour").data(n(e));h.enter().append("path").classed("contour",!0).merge(h).transition().duration(2*c).ease(Ei).attr("d",qa(Ua().scale(l/t))).attr("fill",(t=>a(t.value))),h.exit().remove();const u=w.selectAll(".title-contour").data([this.contour]);u.enter().append("text").classed("title-contour",!0).attr("text-anchor","middle").merge(u).classed("math-var","bias"===this.contour||"sensitivity"===this.contour).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${this.rem})`:"accuracy"===this.contour?`translate(${l+1.125*this.rem}, ${this.rem})`:null).text("bias"===this.contour?"c":"sensitivity"===this.contour?"d′":"accuracy"===this.contour?"Acc":null);const d=100,p=[];for(let e=.5,r=0;e<d;e+=1,r+=4)p[r]="bias"===this.contour?-(e/t*6-3):"sensitivity"===this.contour?e/t*12-6:"accuracy"===this.contour?e/t:null,p[r+1]=p[r],p[r+2]=p[r],p[r+3]=p[r];const f=Wi().size([4,d]).thresholds(r),m=Ga().domain("bias"===this.contour?[3,-3]:"sensitivity"===this.contour?[6,-6]:"accuracy"===this.contour?[1,0]:null).range([0,10*this.rem]),b=w.selectAll(".legend-contour").data([this.contour]),v=b.enter().append("g").classed("legend-contour",!0),g=v.merge(b).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${1.5*this.rem})`:"accuracy"===this.contour?`translate(${l+1.5*this.rem}, ${1.5*this.rem})`:null);b.exit().remove(),v.append("g").classed("axis-contour",!0),g.select(".axis-contour").call(Bt(m).ticks(7).tickSize(0)).attr("font-size",null).attr("font-family",null);const y=g.selectAll(".contour").data(f(p));y.enter().append("path").classed("contour",!0).merge(y).attr("d",qa(Ua().scale(10*this.rem/d))).attr("fill",(t=>a(t.value))),y.exit().remove()}else{w.selectAll(".plot-contour").data([]).exit().remove();w.selectAll(".title-contour").data([]).exit().remove();w.selectAll(".legend-contour").data([]).exit().remove()}y.append("g").classed("axis-x",!0);w.select(".axis-x").attr("transform",`translate(0, ${o})`).transition().duration(2*c).ease(Ei).call(Vt(h)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const x=y.append("text").classed("title-x",!0).attr("text-anchor","middle");x.append("tspan").classed("z math-var",!0),x.append("tspan").classed("name",!0);const k=w.select(".title-x").attr("transform",`translate(${l/2}, ${o+2.25*this.rem})`);k.select("tspan.z").text(this.zRoc?"z":""),k.select("tspan.name").text(this.zRoc?"(False Alarm Rate)":"False Alarm Rate"),y.append("g").classed("axis-y",!0);w.select(".axis-y").transition().duration(2*c).ease(Ei).call(Bt(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const $=y.append("text").classed("title-y",!0).attr("text-anchor","middle");$.append("tspan").classed("z math-var",!0),$.append("tspan").classed("name",!0);const _=w.select(".title-y").attr("transform",`translate(${-2*this.rem}, ${o/2})rotate(-90)`);_.select("tspan.z").text(this.zRoc?"z":""),_.select("tspan.name").text(this.zRoc?"(Hit Rate)":"Hit Rate"),y.append("line").classed("diagonal",!0),w.select(".diagonal").attr("x1",this.zRoc?h(-3):h(0)).attr("y1",this.zRoc?u(-3):u(0)).attr("x2",this.zRoc?h(3):h(1)).attr("y2",this.zRoc?u(3):u(1)),v.append("g").classed("content",!0);const S=g.select(".content"),E=S.selectAll(".curve-iso-d").data(this.isoDArray,(t=>t.name)),A=E.enter().append("path").classed("curve-iso-d",!0).attr("clip-path","url(#clip-roc-space)").merge(E);this.firstUpdate||t.has("zRoc")?A.transition().duration(this.drag?0:2*c).ease(Ei).attr("d",(t=>p(zt(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?bo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?bo.dFar2Hr(t.d,bo.zfar2Far(h.invert(e)),t.s):bo.dFar2Hr(t.d,h.invert(e),t.s)})))))):this.sdt?A.transition().duration(this.drag?0:c).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=mn(void 0!==n.d?n.d:t.d,t.d),s=mn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.d=i(t),n.s=s(t);const e=zt(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?bo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?bo.dFar2Hr(n.d,bo.zfar2Far(h.invert(t)),n.s):bo.dFar2Hr(n.d,h.invert(t),n.s)})));return p(e)}})):A.transition().duration(this.drag?0:c).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e];n.d=void 0,n.s=void 0;const i=mn(void 0!==n.hr?n.hr:t.hr,t.hr),s=mn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=zt(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?bo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?bo.dFar2Hr(bo.hrFar2D(n.hr,n.far,t.s),bo.zfar2Far(h.invert(e)),t.s):bo.dFar2Hr(bo.hrFar2D(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),E.exit().remove();const M=S.selectAll(".curve-iso-c").data(this.isoCArray,(t=>t.name)),T=M.enter().append("path").classed("curve-iso-c",!0).attr("clip-path","url(#clip-roc-space)").merge(M);this.firstUpdate||t.has("zRoc")?T.transition().duration(this.drag?0:2*c).ease(Ei).attr("d",(t=>p(zt(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?bo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?bo.cFar2Hr(t.c,bo.zfar2Far(h.invert(e)),t.s):bo.cFar2Hr(t.c,h.invert(e),t.s)})))))):this.sdt?T.transition().duration(this.drag?0:c).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=mn(void 0!==n.c?n.c:t.c,t.c),s=mn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.c=i(t),n.s=s(t);const e=zt(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?bo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?bo.cFar2Hr(n.c,bo.zfar2Far(h.invert(t)),n.s):bo.cFar2Hr(n.c,h.invert(t),n.s)})));return p(e)}})):T.transition().duration(this.drag?0:c).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e];n.c=void 0,n.s=void 0;const i=mn(void 0!==n.hr?n.hr:t.hr,t.hr),s=mn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=zt(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?bo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?bo.cFar2Hr(bo.hrFar2C(n.hr,n.far,t.s),bo.zfar2Far(h.invert(e)),t.s):bo.cFar2Hr(bo.hrFar2C(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),M.exit().remove();const C=S.selectAll(".point").data(this.pointArray,(t=>t.name)),N=C.enter().append("g").classed("point",!0);N.append("circle").classed("circle",!0),N.append("text").classed("label",!0);const R=N.merge(C);R.select("text").text((t=>t.label)),(this.firstUpdate||t.has("interactive"))&&(this.interactive?R.attr("tabindex",0).classed("interactive",!0).call(d).on("keydown",((t,e)=>{if(["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t.key)){let r=this.zRoc?bo.hr2Zhr(e.hr):e.hr,n=this.zRoc?bo.far2Zfar(e.far):e.far;switch(t.key){case"ArrowUp":r+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowDown":r-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowRight":n+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowLeft":n-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05}r=this.zRoc?bo.zhr2Hr(r):r,n=this.zRoc?bo.zfar2Far(n):n,r=r<.001?.001:r>.999?.999:r,n=n<.001?.001:n>.999?.999:n,r===e.hr&&n===e.far||(e.hr=r,e.far=n,"default"===e.name&&(this.hr=e.hr,this.far=e.far),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))),t.preventDefault()}})):R.attr("tabindex",null).classed("interactive",!1).on("drag",null).on("keydown",null)),this.firstUpdate||t.has("zRoc")?R.transition().duration(this.drag?0:2*c).ease(Ei).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?bo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?bo.hr2Zhr(t.hr):t.hr)}\n )`})):this.sdt?R.transition().duration(this.drag?0:c).ease(Ei).attrTween("transform",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:t.d,t.d),s=mn(void 0!==n.c?n.c:t.c,t.c),a=mn(void 0!==n.s?n.s:t.s,t.s);return t=>(n.d=i(t),n.c=s(t),n.s=a(t),`translate(\n ${h(this.zRoc?bo.far2Zfar(bo.dC2Far(n.d,n.c,n.s)):bo.dC2Far(n.d,n.c,n.s))},\n ${u(this.zRoc?bo.hr2Zhr(bo.dC2Hr(n.d,n.c,n.s)):bo.dC2Hr(n.d,n.c,n.s))}\n )`)})):R.transition().duration(this.drag?0:c).ease(Ei).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?bo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?bo.hr2Zhr(t.hr):t.hr)}\n )`})),C.exit().remove(),this.drag=!1,this.sdt=!1,this.firstUpdate=!1}}customElements.define("roc-space",vo);class go extends ho{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},payoff:{attribute:"payoff",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},run:{attribute:"run",type:Boolean,reflect:!0},pause:{attribute:"pause",type:Boolean,reflect:!0},reset:{attribute:"reset",type:Boolean,reflect:!0},state:{atribute:!1,type:String,reflect:!1}}}constructor(){super(),this.trials=void 0,this.duration=void 0,this.coherence=void 0,this.payoff=void 0,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color=void 0,this.zRoc=void 0,this.run=!1,this.pause=!1,this.reset=!1,this.states=["resetted","running","paused","ended"],this.state="resetted"}setTrials(t){this.trials=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-trials",{detail:{trials:this.trials},bubbles:!0}))}setDuration(t){this.duration=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-duration",{detail:{duration:this.duration},bubbles:!0}))}setCoherence(t){this.coherence=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-coherence",{detail:{coherence:this.coherence},bubbles:!0}))}setPayoff(t){this.payoff=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-payoff",{detail:{payoff:this.payoff},bubbles:!0}))}chooseColor(t){this.color=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-color",{detail:{color:this.color},bubbles:!0}))}flipZRoc(t){this.zRoc=t.target.checked,this.dispatchEvent(new CustomEvent("detectable-control-z-roc",{detail:{zRoc:this.zRoc},bubbles:!0}))}doRun(){this.state="running",this.dispatchEvent(new CustomEvent("detectable-control-run",{detail:{},bubbles:!0}))}doPause(){this.state="paused",this.dispatchEvent(new CustomEvent("detectable-control-pause",{detail:{},bubbles:!0}))}doReset(){this.state="resetted",this.dispatchEvent(new CustomEvent("detectable-control-reset",{detail:{},bubbles:!0}))}complete(){this.state="ended"}static get styles(){return[super.styles,it`
1012
+ `]}render(){return Pt`
1013
+ ${Vo.svgFilters}
1014
+ `}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height,n=Math.min(e,r),i=2*this.rem,s=3*this.rem,a=3*this.rem,o=n-(i+s),l=n-(a+2*this.rem),c=parseInt(this.getComputedStyleValue("---transition-duration"),10),h=No().domain(this.zRoc?[-3,3]:[0,1]).range([0,l]);this.xScale=h;const u=No().domain(this.zRoc?[3,-3]:[1,0]).range([0,o]);this.yScale=u;const d=ln().subject(((t,e)=>({x:this.xScale(this.zRoc?Yo.far2Zfar(e.far):e.far),y:this.yScale(this.zRoc?Yo.hr2Zhr(e.hr):e.hr)}))).on("start",(t=>{Yr(t.currentTarget).classed("dragging",!0)})).on("drag",((t,e)=>{this.drag=!0;const r=this.zRoc?Yo.zfar2Far(this.xScale.invert(t.x)):this.xScale.invert(t.x),n=this.zRoc?Yo.zhr2Hr(this.yScale.invert(t.y)):this.yScale.invert(t.y);e.far=r<.001?.001:r>.999?.999:r,e.hr=n<=.001?.001:n>=.999?.999:n,"default"===e.name&&(this.far=e.far,this.hr=e.hr),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))})).on("end",(t=>{Yr(t.currentTarget).classed("dragging",!1)})),p=Ho().x((t=>h(this.zRoc?Yo.far2Zfar(t.far):t.far))).y((t=>u(this.zRoc?Yo.hr2Zhr(t.hr):t.hr))),f=Yr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),m=f.enter().append("svg").classed("main",!0),b=m.merge(f).attr("viewBox",`0 0 ${n} ${n}`),v=m.append("g").classed("plot",!0),g=b.select(".plot").attr("transform",`translate(${a}, ${i})`);v.append("clipPath").attr("id","clip-roc-space").append("rect"),g.select("clipPath rect").attr("height",o+1).attr("width",l+1);const y=v.append("g").classed("underlayer",!0),w=g.select(".underlayer");if(y.append("rect").classed("background",!0),w.select(".background").attr("height",o).attr("width",l),this.firstUpdate||t.has("contour")||t.has("zRoc")||t.has("width")||t.has("height")||t.has("rem")||t.has("s"))if(void 0!==this.contour){const t=100,e=[];for(let r=.5,n=0;r<t;r+=1)for(let i=.5;i<t;i+=1,n+=1){const s=this.zRoc?Yo.zhr2Hr(i/t*6-3):i/t,a=this.zRoc?Yo.zfar2Far(6*(1-r/t)-3):1-r/t;e[n]="bias"===this.contour?Yo.hrFar2C(s,a,this.s):"sensitivity"===this.contour?Yo.hrFar2D(s,a,this.s):"accuracy"===this.contour?Yo.hrFar2Acc(s,a):null}const r="bias"===this.contour?ve(-3,3,.25):"sensitivity"===this.contour?ve(-6,6,.5):"accuracy"===this.contour?ve(0,1,.05):null,n=Cs().size([t,t]).thresholds(r),i=this.getComputedStyleValue("bias"===this.contour?"---color-element-background":"sensitivity"===this.contour?"---color-d":"accuracy"===this.contour?"---color-acc-dark":null),s=this.getComputedStyleValue("bias"===this.contour?"---color-c":"sensitivity"===this.contour||"accuracy"===this.contour?"---color-element-background":null),a=No().domain(se(r)).interpolate((()=>Ln(i,s))),o=w.selectAll(".plot-contour").data([this.contour]),h=o.enter().append("g").classed("plot-contour",!0).merge(o).selectAll(".contour").data(n(e));h.enter().append("path").classed("contour",!0).merge(h).transition().duration(2*c).ease(ls).attr("d",vo(xo().scale(l/t))).attr("fill",(t=>a(t.value))),h.exit().remove();const u=w.selectAll(".title-contour").data([this.contour]);u.enter().append("text").classed("title-contour",!0).attr("text-anchor","middle").merge(u).classed("math-var","bias"===this.contour||"sensitivity"===this.contour).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${this.rem})`:"accuracy"===this.contour?`translate(${l+1.125*this.rem}, ${this.rem})`:null).text("bias"===this.contour?"c":"sensitivity"===this.contour?"d′":"accuracy"===this.contour?"Acc":null);const d=100,p=[];for(let e=.5,r=0;e<d;e+=1,r+=4)p[r]="bias"===this.contour?-(e/t*6-3):"sensitivity"===this.contour?e/t*12-6:"accuracy"===this.contour?e/t:null,p[r+1]=p[r],p[r+2]=p[r],p[r+3]=p[r];const f=Cs().size([4,d]).thresholds(r),m=No().domain("bias"===this.contour?[3,-3]:"sensitivity"===this.contour?[6,-6]:"accuracy"===this.contour?[1,0]:null).range([0,10*this.rem]),b=w.selectAll(".legend-contour").data([this.contour]),v=b.enter().append("g").classed("legend-contour",!0),g=v.merge(b).attr("transform","bias"===this.contour||"sensitivity"===this.contour?`translate(${l+1.25*this.rem}, ${1.5*this.rem})`:"accuracy"===this.contour?`translate(${l+1.5*this.rem}, ${1.5*this.rem})`:null);b.exit().remove(),v.append("g").classed("axis-contour",!0),g.select(".axis-contour").call(Ne(m).ticks(7).tickSize(0)).attr("font-size",null).attr("font-family",null);const y=g.selectAll(".contour").data(f(p));y.enter().append("path").classed("contour",!0).merge(y).attr("d",vo(xo().scale(10*this.rem/d))).attr("fill",(t=>a(t.value))),y.exit().remove()}else{w.selectAll(".plot-contour").data([]).exit().remove();w.selectAll(".title-contour").data([]).exit().remove();w.selectAll(".legend-contour").data([]).exit().remove()}y.append("g").classed("axis-x",!0);w.select(".axis-x").attr("transform",`translate(0, ${o})`).transition().duration(2*c).ease(ls).call(Ce(h)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const x=y.append("text").classed("title-x",!0).attr("text-anchor","middle");x.append("tspan").classed("z math-var",!0),x.append("tspan").classed("name",!0);const $=w.select(".title-x").attr("transform",`translate(${l/2}, ${o+2.25*this.rem})`);$.select("tspan.z").text(this.zRoc?"z":""),$.select("tspan.name").text(this.zRoc?"(False Alarm Rate)":"False Alarm Rate"),y.append("g").classed("axis-y",!0);w.select(".axis-y").transition().duration(2*c).ease(ls).call(Ne(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null);const _=y.append("text").classed("title-y",!0).attr("text-anchor","middle");_.append("tspan").classed("z math-var",!0),_.append("tspan").classed("name",!0);const k=w.select(".title-y").attr("transform",`translate(${-2*this.rem}, ${o/2})rotate(-90)`);k.select("tspan.z").text(this.zRoc?"z":""),k.select("tspan.name").text(this.zRoc?"(Hit Rate)":"Hit Rate"),y.append("line").classed("diagonal",!0),w.select(".diagonal").attr("x1",this.zRoc?h(-3):h(0)).attr("y1",this.zRoc?u(-3):u(0)).attr("x2",this.zRoc?h(3):h(1)).attr("y2",this.zRoc?u(3):u(1)),v.append("g").classed("content",!0);const S=g.select(".content"),A=S.selectAll(".curve-iso-d").data(this.isoDArray,(t=>t.name)),E=A.enter().append("path").classed("curve-iso-d",!0).attr("clip-path","url(#clip-roc-space)").merge(A);this.firstUpdate||t.has("zRoc")?E.transition().duration(this.drag?0:2*c).ease(ls).attr("d",(t=>p(ve(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Yo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Yo.dFar2Hr(t.d,Yo.zfar2Far(h.invert(e)),t.s):Yo.dFar2Hr(t.d,h.invert(e),t.s)})))))):this.sdt?E.transition().duration(this.drag?0:c).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=Gn(void 0!==n.d?n.d:t.d,t.d),s=Gn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.d=i(t),n.s=s(t);const e=ve(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?Yo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?Yo.dFar2Hr(n.d,Yo.zfar2Far(h.invert(t)),n.s):Yo.dFar2Hr(n.d,h.invert(t),n.s)})));return p(e)}})):E.transition().duration(this.drag?0:c).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e];n.d=void 0,n.s=void 0;const i=Gn(void 0!==n.hr?n.hr:t.hr,t.hr),s=Gn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=ve(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Yo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Yo.dFar2Hr(Yo.hrFar2D(n.hr,n.far,t.s),Yo.zfar2Far(h.invert(e)),t.s):Yo.dFar2Hr(Yo.hrFar2D(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),A.exit().remove();const M=S.selectAll(".curve-iso-c").data(this.isoCArray,(t=>t.name)),T=M.enter().append("path").classed("curve-iso-c",!0).attr("clip-path","url(#clip-roc-space)").merge(M);this.firstUpdate||t.has("zRoc")?T.transition().duration(this.drag?0:2*c).ease(ls).attr("d",(t=>p(ve(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Yo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Yo.cFar2Hr(t.c,Yo.zfar2Far(h.invert(e)),t.s):Yo.cFar2Hr(t.c,h.invert(e),t.s)})))))):this.sdt?T.transition().duration(this.drag?0:c).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e];n.hr=void 0,n.far=void 0;const i=Gn(void 0!==n.c?n.c:t.c,t.c),s=Gn(void 0!==n.s?n.s:t.s,t.s);return t=>{n.c=i(t),n.s=s(t);const e=ve(h.range()[0],h.range()[1]+1,1).map((t=>({far:this.zRoc?Yo.zfar2Far(h.invert(t)):h.invert(t),hr:this.zRoc?Yo.cFar2Hr(n.c,Yo.zfar2Far(h.invert(t)),n.s):Yo.cFar2Hr(n.c,h.invert(t),n.s)})));return p(e)}})):T.transition().duration(this.drag?0:c).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e];n.c=void 0,n.s=void 0;const i=Gn(void 0!==n.hr?n.hr:t.hr,t.hr),s=Gn(void 0!==n.far?n.far:t.far,t.far);return e=>{n.hr=i(e),n.far=s(e);const r=ve(h.range()[0],h.range()[1]+1,1).map((e=>({far:this.zRoc?Yo.zfar2Far(h.invert(e)):h.invert(e),hr:this.zRoc?Yo.cFar2Hr(Yo.hrFar2C(n.hr,n.far,t.s),Yo.zfar2Far(h.invert(e)),t.s):Yo.cFar2Hr(Yo.hrFar2C(n.hr,n.far,t.s),h.invert(e),t.s)})));return p(r)}})),M.exit().remove();const C=S.selectAll(".point").data(this.pointArray,(t=>t.name)),N=C.enter().append("g").classed("point",!0);N.append("circle").classed("circle",!0),N.append("text").classed("label",!0);const R=N.merge(C);R.select("text").text((t=>t.label)),(this.firstUpdate||t.has("interactive"))&&(this.interactive?R.attr("tabindex",0).classed("interactive",!0).call(d).on("keydown",((t,e)=>{if(["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t.key)){let r=this.zRoc?Yo.hr2Zhr(e.hr):e.hr,n=this.zRoc?Yo.far2Zfar(e.far):e.far;switch(t.key){case"ArrowUp":r+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowDown":r-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowRight":n+=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05;break;case"ArrowLeft":n-=this.zRoc?t.shiftKey?.05:.25:t.shiftKey?.01:.05}r=this.zRoc?Yo.zhr2Hr(r):r,n=this.zRoc?Yo.zfar2Far(n):n,r=r<.001?.001:r>.999?.999:r,n=n<.001?.001:n>.999?.999:n,r===e.hr&&n===e.far||(e.hr=r,e.far=n,"default"===e.name&&(this.hr=e.hr,this.far=e.far),this.alignState(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("roc-point-change",{detail:{name:e.name,far:e.far,hr:e.hr,d:e.d,c:e.c,s:e.s,label:e.label},bubbles:!0}))),t.preventDefault()}})):R.attr("tabindex",null).classed("interactive",!1).on("drag",null).on("keydown",null)),this.firstUpdate||t.has("zRoc")?R.transition().duration(this.drag?0:2*c).ease(ls).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?Yo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?Yo.hr2Zhr(t.hr):t.hr)}\n )`})):this.sdt?R.transition().duration(this.drag?0:c).ease(ls).attrTween("transform",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:t.d,t.d),s=Gn(void 0!==n.c?n.c:t.c,t.c),a=Gn(void 0!==n.s?n.s:t.s,t.s);return t=>(n.d=i(t),n.c=s(t),n.s=a(t),`translate(\n ${h(this.zRoc?Yo.far2Zfar(Yo.dC2Far(n.d,n.c,n.s)):Yo.dC2Far(n.d,n.c,n.s))},\n ${u(this.zRoc?Yo.hr2Zhr(Yo.dC2Hr(n.d,n.c,n.s)):Yo.dC2Hr(n.d,n.c,n.s))}\n )`)})):R.transition().duration(this.drag?0:c).ease(ls).attr("transform",((t,e,r)=>{const n=r[e];return n.d=void 0,n.c=void 0,n.s=void 0,`translate(\n ${h(this.zRoc?Yo.far2Zfar(t.far):t.far)},\n ${u(this.zRoc?Yo.hr2Zhr(t.hr):t.hr)}\n )`})),C.exit().remove(),this.drag=!1,this.sdt=!1,this.firstUpdate=!1}}customElements.define("roc-space",Zo);class Go extends Vo{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},payoff:{attribute:"payoff",type:Number,reflect:!0},color:{attribute:"color",type:String,reflect:!0},zRoc:{attribute:"z-roc",type:Boolean,reflect:!0},run:{attribute:"run",type:Boolean,reflect:!0},pause:{attribute:"pause",type:Boolean,reflect:!0},reset:{attribute:"reset",type:Boolean,reflect:!0},state:{attribute:!1,type:String,reflect:!1}}}constructor(){super(),this.trials=void 0,this.duration=void 0,this.coherence=void 0,this.payoff=void 0,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color=void 0,this.zRoc=void 0,this.run=!1,this.pause=!1,this.reset=!1,this.states=["resetted","running","paused","ended"],this.state="resetted"}setTrials(t){this.trials=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-trials",{detail:{trials:this.trials},bubbles:!0}))}setDuration(t){this.duration=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-duration",{detail:{duration:this.duration},bubbles:!0}))}setCoherence(t){this.coherence=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-coherence",{detail:{coherence:this.coherence},bubbles:!0}))}setPayoff(t){this.payoff=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-payoff",{detail:{payoff:this.payoff},bubbles:!0}))}chooseColor(t){this.color=t.target.value,this.dispatchEvent(new CustomEvent("detectable-control-color",{detail:{color:this.color},bubbles:!0}))}flipZRoc(t){this.zRoc=t.target.checked,this.dispatchEvent(new CustomEvent("detectable-control-z-roc",{detail:{zRoc:this.zRoc},bubbles:!0}))}doRun(){this.state="running",this.dispatchEvent(new CustomEvent("detectable-control-run",{detail:{},bubbles:!0}))}doPause(){this.state="paused",this.dispatchEvent(new CustomEvent("detectable-control-pause",{detail:{},bubbles:!0}))}doReset(){this.state="resetted",this.dispatchEvent(new CustomEvent("detectable-control-reset",{detail:{},bubbles:!0}))}complete(){this.state="ended"}static get styles(){return[super.styles,rt`
1008
1015
  :host {
1009
1016
  display: inline-block;
1010
1017
  }
@@ -1031,13 +1038,13 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1031
1038
  .payoff {
1032
1039
  --decidables-spinner-prefix: "$";
1033
1040
  }
1034
- `]}render(){return F`
1041
+ `]}render(){return Pt`
1035
1042
  <div class="holder">
1036
- ${this.trials?F`<decidables-slider min="1" max="100" step="1" .value=${this.trials} @change=${this.setTrials.bind(this)} @input=${this.setTrials.bind(this)}>Trials</decidables-slider>`:F``}
1037
- ${this.duration?F`<decidables-slider min="10" max="2000" step="10" .value=${this.duration} @change=${this.setDuration.bind(this)} @input=${this.setDuration.bind(this)}>Duration</decidables-slider>`:F``}
1038
- ${this.coherence?F`<decidables-slider min="0" max="1" step=".01" .value=${this.coherence} @change=${this.setCoherence.bind(this)} @input=${this.setCoherence.bind(this)}>Coherence</decidables-slider>`:F``}
1039
- ${this.payoff?F`<decidables-slider class="payoff" min="0" max="100" step="1" .value=${this.payoff} @change=${this.setPayoff.bind(this)} @input=${this.setPayoff.bind(this)}>Payoff</decidables-slider>`:F``}
1040
- ${void 0!==this.color?F`
1043
+ ${this.trials?Pt`<decidables-slider min="1" max="100" step="1" .value=${this.trials} @change=${this.setTrials.bind(this)} @input=${this.setTrials.bind(this)}>Trials</decidables-slider>`:Pt``}
1044
+ ${this.duration?Pt`<decidables-slider min="10" max="2000" step="10" .value=${this.duration} @change=${this.setDuration.bind(this)} @input=${this.setDuration.bind(this)}>Duration</decidables-slider>`:Pt``}
1045
+ ${this.coherence?Pt`<decidables-slider min="0" max="1" step=".01" .value=${this.coherence} @change=${this.setCoherence.bind(this)} @input=${this.setCoherence.bind(this)}>Coherence</decidables-slider>`:Pt``}
1046
+ ${this.payoff?Pt`<decidables-slider class="payoff" min="0" max="100" step="1" .value=${this.payoff} @change=${this.setPayoff.bind(this)} @input=${this.setPayoff.bind(this)}>Payoff</decidables-slider>`:Pt``}
1047
+ ${void 0!==this.color?Pt`
1041
1048
  <decidables-toggle @change=${this.chooseColor.bind(this)}>
1042
1049
  <span slot="label">Emphasis</span>
1043
1050
  <decidables-toggle-option name="toggle" value="none" ?checked=${"none"===this.color}>None</decidables-toggle-option>
@@ -1047,21 +1054,21 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1047
1054
  <decidables-toggle-option name="toggle" value="outcome" ?checked=${"outcome"===this.color}>Outcome</decidables-toggle-option>
1048
1055
  <decidables-toggle-option name="toggle" value="all" ?checked=${"all"===this.color}>All</decidables-toggle-option>
1049
1056
  </decidables-toggle>
1050
- `:F``}
1051
- ${void 0!==this.zRoc?F`
1057
+ `:Pt``}
1058
+ ${void 0!==this.zRoc?Pt`
1052
1059
  <decidables-switch ?checked=${this.zRoc} @change=${this.flipZRoc.bind(this)}>
1053
1060
  <span class="math-var">z</span>ROC
1054
1061
  <span slot="off-label">ROC</span>
1055
1062
  </decidables-switch>
1056
- `:F``}
1057
- ${this.run||this.pause||this.reset?F`
1063
+ `:Pt``}
1064
+ ${this.run||this.pause||this.reset?Pt`
1058
1065
  <div class="buttons">
1059
- ${this.run?F`<decidables-button name="run" ?disabled=${"running"===this.state||"ended"===this.state} @click=${this.doRun.bind(this)}>Run</decidables-button>`:F``}
1060
- ${this.pause?F`<decidables-button name="pause" ?disabled=${"running"!==this.state} @click=${this.doPause.bind(this)}>Pause</decidables-button>`:F``}
1061
- ${this.reset?F`<decidables-button name="reset" ?disabled=${"resetted"===this.state} @click=${this.doReset.bind(this)}>Reset</decidables-button>`:F``}
1066
+ ${this.run?Pt`<decidables-button name="run" ?disabled=${"running"===this.state||"ended"===this.state} @click=${this.doRun.bind(this)}>Run</decidables-button>`:Pt``}
1067
+ ${this.pause?Pt`<decidables-button name="pause" ?disabled=${"running"!==this.state} @click=${this.doPause.bind(this)}>Pause</decidables-button>`:Pt``}
1068
+ ${this.reset?Pt`<decidables-button name="reset" ?disabled=${"resetted"===this.state} @click=${this.doReset.bind(this)}>Reset</decidables-button>`:Pt``}
1062
1069
  </div>
1063
- `:F``}
1064
- </div>`}}customElements.define("detectable-control",go);class yo extends ho{static get properties(){return{color:{attribute:"color",type:String,reflect:!0},distributions:{attribute:"distributions",type:Boolean,reflect:!0},threshold:{attribute:"threshold",type:Boolean,reflect:!0},unequal:{attribute:"unequal",type:Boolean,reflect:!0},sensitivity:{attribute:"sensitivity",type:Boolean,reflect:!0},bias:{attribute:"bias",type:Boolean,reflect:!0},variance:{attribute:"variance",type:Boolean,reflect:!0},histogram:{attribute:"histogram",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},binWidth:{attribute:!1,type:Number,reflect:!1},trials:{attribute:!1,type:Array,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.colors=["outcome","response","stimulus","none"],this.color="outcome",this.distributions=!1,this.threshold=!1,this.unequal=!1,this.sensitivity=!1,this.bias=!1,this.variance=!1,this.histogram=!1,this.d=1,this.c=0,this.s=1,this.binWidth=.25,this.signals=["present","absent"],this.responses=["present","absent"],this.trials=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.muN=NaN,this.muS=NaN,this.l=NaN,this.hS=NaN,this.binRange=[-3,3],this.h=0,this.m=0,this.fa=0,this.cr=0,this.firstUpdate=!0,this.drag=!1,this.alignState()}reset(){this.trials=[],this.h=0,this.m=0,this.fa=0,this.cr=0}trial(t,e,r,n,i){const s={new:!0,paused:!1};s.trial=t,s.signal=e,s.duration=r,s.wait=n,s.iti=i,s.evidence=fo.normal.sample(0,1),this.alignTrial(s),this.trials.push(s),this.requestUpdate()}alignTrial(t){return"present"===t.signal?(t.trueEvidence=t.evidence*this.s+this.muS,t.response=t.trueEvidence>this.l?"present":"absent",t.outcome="present"===t.response?"h":"m"):(t.trueEvidence=t.evidence+this.muN,t.response=t.trueEvidence>this.l?"present":"absent",t.outcome="present"===t.response?"fa":"cr"),t.new||(this[t.outcome]+=1),t}alignState(){this.far=bo.dC2Far(this.d,this.c,this.s),this.hr=bo.dC2Hr(this.d,this.c,this.s),this.muN=bo.d2MuN(this.d,this.s),this.muS=bo.d2MuS(this.d,this.s),this.l=bo.c2L(this.c,this.s),this.hS=bo.s2H(this.s),this.h=0,this.m=0,this.fa=0,this.cr=0;for(let t=0;t<this.trials.length;t+=1)this.alignTrial(this.trials[t])}static get styles(){return[super.styles,it`
1070
+ `:Pt``}
1071
+ </div>`}}customElements.define("detectable-control",Go);class Jo extends Vo{static get properties(){return{color:{attribute:"color",type:String,reflect:!0},distributions:{attribute:"distributions",type:Boolean,reflect:!0},threshold:{attribute:"threshold",type:Boolean,reflect:!0},unequal:{attribute:"unequal",type:Boolean,reflect:!0},sensitivity:{attribute:"sensitivity",type:Boolean,reflect:!0},bias:{attribute:"bias",type:Boolean,reflect:!0},variance:{attribute:"variance",type:Boolean,reflect:!0},histogram:{attribute:"histogram",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},binWidth:{attribute:!1,type:Number,reflect:!1},trials:{attribute:!1,type:Array,reflect:!1},width:{attribute:!1,type:Number,reflect:!1},height:{attribute:!1,type:Number,reflect:!1},rem:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.colors=["outcome","response","stimulus","none"],this.color="outcome",this.distributions=!1,this.threshold=!1,this.unequal=!1,this.sensitivity=!1,this.bias=!1,this.variance=!1,this.histogram=!1,this.d=1,this.c=0,this.s=1,this.binWidth=.25,this.signals=["present","absent"],this.responses=["present","absent"],this.trials=[],this.width=NaN,this.height=NaN,this.rem=NaN,this.muN=NaN,this.muS=NaN,this.l=NaN,this.hS=NaN,this.binRange=[-3,3],this.h=0,this.m=0,this.fa=0,this.cr=0,this.firstUpdate=!0,this.drag=!1,this.alignState()}reset(){this.trials=[],this.h=0,this.m=0,this.fa=0,this.cr=0}trial(t,e,r,n,i){const s={new:!0,paused:!1};s.trial=t,s.signal=e,s.duration=r,s.wait=n,s.iti=i,s.evidence=Xo.normal.sample(0,1),this.alignTrial(s),this.trials.push(s),this.requestUpdate()}alignTrial(t){return"present"===t.signal?(t.trueEvidence=t.evidence*this.s+this.muS,t.response=t.trueEvidence>this.l?"present":"absent",t.outcome="present"===t.response?"h":"m"):(t.trueEvidence=t.evidence+this.muN,t.response=t.trueEvidence>this.l?"present":"absent",t.outcome="present"===t.response?"fa":"cr"),t.new||(this[t.outcome]+=1),t}alignState(){this.far=Yo.dC2Far(this.d,this.c,this.s),this.hr=Yo.dC2Hr(this.d,this.c,this.s),this.muN=Yo.d2MuN(this.d,this.s),this.muS=Yo.d2MuS(this.d,this.s),this.l=Yo.c2L(this.c,this.s),this.hS=Yo.s2H(this.s),this.h=0,this.m=0,this.fa=0,this.cr=0;for(let t=0;t<this.trials.length;t+=1)this.alignTrial(this.trials[t])}static get styles(){return[super.styles,rt`
1065
1072
  :host {
1066
1073
  display: inline-block;
1067
1074
 
@@ -1303,9 +1310,9 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1303
1310
  text-anchor: middle;
1304
1311
  fill: currentColor;
1305
1312
  }
1306
- `]}render(){return F`
1307
- ${ho.svgFilters}
1308
- `}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-model-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far,hr:this.hr,h:this.h,m:this.m,fa:this.fa,cr:this.cr},bubbles:!0}))}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height;let n,i;e/r>1.8?(i=r,n=1.8*i):(n=e,i=n/1.8);const s=2*this.rem,a=3*this.rem,o=3*this.rem,l=i-(s+a),c=n-(o+(this.histogram&&this.distributions?3:.75)*this.rem),h=parseInt(this.getComputedStyleValue("---transition-duration"),10),u=Ga().domain([-3,3]).range([0,c]),d=Ga().domain([.5,0]).range([0,l]),p=u(this.binWidth)-u(0),f=Ga().domain([l/p,0]).range([0,l]),m=_r().subject((()=>({x:u(this.l),y:0}))).on("start",(t=>{dr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.c=bo.l2C(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{dr(t.currentTarget).classed("dragging",!1)})),b=_r().subject((()=>({x:u(this.muN),y:0}))).on("start",(t=>{dr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.d=bo.muN2D(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{dr(t.currentTarget).classed("dragging",!1)})),v=_r().subject((()=>({x:u(this.muS),y:d(this.hS)}))).on("start",((t,e)=>{dr(t.currentTarget).classed("dragging",!0),e.startX=t.x,e.startY=t.y,e.startHS=this.hS,e.startMuS=this.muS})).on("drag",((t,e)=>{this.drag=!0;let r=this.muS;this.interactive&&(r=u.invert(t.x),r=r<u.domain()[0]?u.domain()[0]:r>u.domain()[1]?u.domain()[1]:r);let n=this.hS;this.unequal&&(n=d.invert(t.y),n=n<.01?.01:n>d.domain()[0]?d.domain()[0]:n),this.interactive&&this.unequal&&t.sourceEvent.shiftKey&&(Math.abs(t.x-e.startX)>Math.abs(t.y-e.startY)?n=e.startHS:r=e.startMuS),this.unequal&&(this.s=bo.h2S(n),this.c=bo.l2C(this.l,this.s)),this.d=bo.muS2D(r,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{dr(t.currentTarget).classed("dragging",!1)})),g=io().x((t=>u(t.e))).y((t=>d(t.p))),y=dr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),w=y.enter().append("svg").classed("main",!0),x=w.merge(y).attr("viewBox",`0 0 ${n} ${i}`),k=w.append("g").classed("plot",!0),$=x.select(".plot").attr("transform",`translate(${o}, ${s})`),_=k.append("g").classed("underlayer",!0),S=$.select(".underlayer");_.append("rect").classed("background",!0),S.select(".background").attr("height",l).attr("width",c),_.append("g").classed("axis-x",!0);S.select(".axis-x").attr("transform",`translate(0, ${l})`).call(Vt(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),_.append("text").classed("title-x",!0).attr("text-anchor","middle").text("Evidence"),S.select(".title-x").attr("transform",`translate(${c/2}, ${l+2.25*this.rem})`);const E=S.selectAll(".axis-y").data(this.distributions?[{}]:[]);E.enter().append("g").classed("axis-y",!0).merge(E).call(Bt(d).ticks(5)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),E.exit().remove();const A=S.selectAll(".title-y").data(this.distributions?[{}]:[]);A.enter().append("text").classed("title-y",!0).attr("text-anchor","middle").text("Probability").merge(A).attr("transform",`translate(${-2*this.rem}, ${l/2})rotate(-90)`),A.exit().remove();const M=S.selectAll(".axis-y2").data(this.histogram?[{}]:[]);var T;M.enter().append("g").classed("axis-y2",!0).merge(M).attr("transform",this.distributions?`translate(${c}, 0)`:"").call(this.distributions?(T=f,jt(2,T)).ticks(10):Bt(f).ticks(10)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),M.exit().remove();const C=S.selectAll(".title-y2").data(this.histogram?[{}]:[]);C.enter().append("text").classed("title-y2",!0).attr("text-anchor","middle").text("Count").merge(C).attr("transform",this.distributions?`translate(${c+1.5*this.rem}, ${l/2})rotate(90)`:`translate(${-1.5*this.rem}, ${l/2})rotate(-90)`),C.exit().remove(),k.append("g").classed("content",!0);const N=$.select(".content"),R=N.selectAll(".signal-noise").data(this.distributions?[{}]:[]),P=R.enter().append("g").classed("signal-noise",!0),q=P.merge(R);R.exit().remove();const z=P.append("g").classed("noise",!0),F=q.selectAll(".noise").attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muN;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muN&&(this.d=bo.muN2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?F.call(b):F.on(".drag",null)),z.append("path").classed("curve-cr",!0),F.select(".curve-cr").transition().duration(this.drag?0:h).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d),s=mn(void 0!==n.c?n.c:this.c,this.c),a=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=zt(u.domain()[0],bo.c2L(n.c,n.s),.05).map((t=>({e:t,p:fo.normal.pdf(t,bo.d2MuN(n.d,n.s),1)})));return e.push({e:bo.c2L(n.c,n.s),p:fo.normal.pdf(bo.c2L(n.c,n.s),bo.d2MuN(n.d,n.s),1)}),e.push({e:bo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),z.append("path").classed("curve-fa",!0),F.select(".curve-fa").transition().duration(this.drag?0:h).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d),s=mn(void 0!==n.c?n.c:this.c,this.c),a=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=zt(bo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:fo.normal.pdf(t,bo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:fo.normal.pdf(u.domain()[1],bo.d2MuN(n.d,n.s),1)}),e.push({e:u.domain()[1],p:0}),e.push({e:bo.c2L(n.c,n.s),p:0}),g(e)}})),z.append("path").classed("curve-noise",!0),F.select(".curve-noise").transition().duration(this.drag?0:h).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d),s=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=zt(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:fo.normal.pdf(t,bo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:fo.normal.pdf(u.domain()[1],bo.d2MuN(n.d,n.s),1)}),g(e)}}));const O=P.append("g").classed("signal",!0),U=q.selectAll(".signal").attr("tabindex",this.interactive||this.unequal?0:null).classed("interactive",this.interactive).classed("unequal",this.unequal).on("keydown.sensitivity",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muS;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muS&&(this.d=bo.muS2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null).on("keydown.variance",this.unequal?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let e=this.hS;switch(t.key){case"ArrowUp":e+=t.shiftKey?.002:.02;break;case"ArrowDown":e-=t.shiftKey?.002:.02}e=e<.01?.01:e>d.domain()[0]?d.domain()[0]:e,e!==this.hS&&(this.s=bo.h2S(e),this.d=bo.muN2D(this.muN,this.s),this.c=bo.l2C(this.l,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive")||t.has("unequal"))&&(this.interactive||this.unequal?U.call(v):U.on(".drag",null)),O.append("path").classed("curve-m",!0),U.select(".curve-m").transition().duration(this.drag?0:h).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d),s=mn(void 0!==n.c?n.c:this.c,this.c),a=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=zt(u.domain()[0],bo.c2L(n.c,n.s),.05).map((t=>({e:t,p:fo.normal.pdf(t,bo.d2MuS(n.d,n.s),n.s)})));return e.push({e:bo.c2L(n.c,n.s),p:fo.normal.pdf(bo.c2L(n.c,n.s),bo.d2MuS(n.d,n.s),n.s)}),e.push({e:bo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),O.append("path").classed("curve-h",!0),U.select(".curve-h").transition().duration(this.drag?0:h).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d),s=mn(void 0!==n.c?n.c:this.c,this.c),a=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=zt(bo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:fo.normal.pdf(t,bo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:fo.normal.pdf(u.domain()[1],bo.d2MuS(n.d,n.s),n.s)}),e.push({e:u.domain()[1],p:0}),e.push({e:bo.c2L(n.c,n.s),p:0}),g(e)}})),O.append("path").classed("curve-signal",!0),U.select(".curve-signal").transition().duration(this.drag?0:h).ease(Ei).attrTween("d",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d),s=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=zt(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:fo.normal.pdf(t,bo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:fo.normal.pdf(u.domain()[1],bo.d2MuS(n.d,n.s),n.s)}),g(e)}}));const I=N.selectAll(".measure-d").data(this.sensitivity?[{}]:[]),H=I.enter().append("g").classed("measure-d",!0);H.append("line").classed("line",!0),H.append("line").classed("cap-left",!0),H.append("line").classed("cap-right",!0);const D=H.append("text").classed("label",!0);D.append("tspan").classed("d math-var",!0).text("d′"),D.append("tspan").classed("equals",!0).text(" = "),D.append("tspan").classed("value",!0);const L=H.merge(I);L.select(".line").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.muN)).attr("y1",d(.43)).attr("x2",u(this.muS)).attr("y2",d(.43)),L.select(".cap-left").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.muN)).attr("y1",d(.43)+5).attr("x2",u(this.muN)).attr("y2",d(.43)-5),L.select(".cap-right").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.muS)).attr("y1",d(.43)+5).attr("x2",u(this.muS)).attr("y2",d(.43)-5);L.select(".label").transition().duration(this.drag?0:h).ease(Ei).attr("x",u(this.muN>this.muS?this.muN:this.muS)+5).attr("y",d(.43)+3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.d?n.d:this.d,this.d);return t=>{n.d=i(t),dr(n).text(ss(".3")(n.d))}})),I.exit().remove();const j=N.selectAll(".measure-c").data(this.bias?[{}]:[]),V=j.enter().append("g").classed("measure-c",!0);V.append("line").classed("line",!0),V.append("line").classed("cap-zero",!0);const B=V.append("text").classed("label",!0);B.append("tspan").classed("c math-var",!0).text("c"),B.append("tspan").classed("equals",!0).text(" = "),B.append("tspan").classed("value",!0);const K=V.merge(j);K.select(".line").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.l)).attr("y1",d(.47)).attr("x2",u(0)).attr("y2",d(.47)),K.select(".cap-zero").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(0)).attr("y1",d(.47)+5).attr("x2",u(0)).attr("y2",d(.47)-5);K.select(".label").transition().duration(this.drag?0:h).ease(Ei).attr("x",u(0)+(this.l<0?5:-5)).attr("y",d(.47)+3).attr("text-anchor",this.c<0?"start":"end").select(".value").tween("text",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.c?n.c:this.c,this.c);return t=>{n.c=i(t),dr(n).text(ss(".3")(n.c))}})),j.exit().remove();const X=N.selectAll(".measure-s").data(this.variance?[{}]:[]),W=X.enter().append("g").classed("measure-s",!0);W.append("line").classed("line",!0),W.append("line").classed("cap-left",!0),W.append("line").classed("cap-right",!0);const Y=W.append("text").classed("label",!0);Y.append("tspan").classed("s math-var",!0).text("σ"),Y.append("tspan").classed("equals",!0).text(" = "),Y.append("tspan").classed("value",!0);const Z=W.merge(X);Z.select(".line").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.muS-this.s)).attr("y1",d(fo.normal.pdf(this.s,0,this.s))+10/this.s).attr("x2",u(this.muS+this.s)).attr("y2",d(fo.normal.pdf(this.s,0,this.s))+10/this.s),Z.select(".cap-left").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.muS-this.s)).attr("y1",d(fo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS-this.s)).attr("y2",d(fo.normal.pdf(this.s,0,this.s))+10/this.s-5),Z.select(".cap-right").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.muS+this.s)).attr("y1",d(fo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS+this.s)).attr("y2",d(fo.normal.pdf(this.s,0,this.s))+10/this.s-5);Z.select(".label").transition().duration(this.drag?0:h).ease(Ei).attr("x",u(this.muS)).attr("y",d(fo.normal.pdf(this.s,0,this.s))+10/this.s-3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=mn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.s=i(t),dr(n).text(ss(".3")(n.s))}})),X.exit().remove();const G=N.selectAll(".threshold").data(this.threshold?[{}]:[]),J=G.enter().append("g").classed("threshold",!0);J.append("line").classed("line",!0),J.append("circle").classed("handle",!0);const Q=J.merge(G).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Q.call(m).on("keydown",(t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.l;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.l&&(this.c=bo.l2C(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}})):Q.on("drag",null).on("keydown",null)),Q.select(".line").transition().duration(this.drag?0:h).ease(Ei).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),Q.select(".handle").transition().duration(this.drag?0:h).ease(Ei).attr("cx",u(this.l)).attr("cy",d(.54)),G.exit().remove();const tt=N.selectAll(".histogram").data(this.histogram?[{}]:[]),et=tt.enter().append("g").classed("histogram",!0).merge(tt);if(tt.exit().remove(),this.histogram){const t=qt().value((t=>t.trueEvidence)).domain(u.domain()).thresholds(zt(this.binRange[0],this.binRange[1],this.binWidth)),e=t(this.trials);let r=-1,n=-1;for(let t=0;t<e.length;t+=1)for(let i=0;i<e[t].length;i+=1)e[t][i].binValue=e[t].x0,e[t][i].binCount=i,0===t&&(r=i),t===e.length-1&&(n=i);for(let t=0;t<this.trials.length;t+=1)this.trials[t].trueEvidence<this.binRange[0]&&(r+=1,this.trials[t].binCount=r,this.trials[t].binValue=e[0].x0),this.trials[t].trueEvidence>this.binRange[1]&&(n+=1,this.trials[t].binCount=n,this.trials[t].binValue=e[e.length-1].x0);const i=et.selectAll(".trial").data(this.trials,(t=>t.trial)),s=i.enter().append("rect").attr("stroke-width",3).attr("data-new-trial-ease-time",0).attr("stroke",this.getComputedStyleValue("---color-acc")).attr("fill",this.getComputedStyleValue("---color-acc-light")).merge(i).attr("class",(t=>`trial ${t.outcome}`)).attr("width",p-3).attr("height",p-3),a=s.filter((t=>t.new&&!t.paused));if(!a.empty()){const t=a.attr("data-new-trial-ease-time"),e=e=>Ga().domain([0,1]).range([t,1])(e),r=e=>r=>Ga().domain([e(t),1]).range([0,1])(e(r));a.transition("new").duration((e=>Math.floor((.75*e.duration+.25*e.wait)*(1-t)))).ease(e).attr("data-new-trial-ease-time",1).attrTween("stroke",((t,e,n)=>{const i=n[e],s=an(i.getAttribute("stroke"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"));return t=>s(r(Si)(t))})).attrTween("fill",((t,e,n)=>{const i=n[e],s=an(i.getAttribute("fill"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"));return t=>s(r(Si)(t))})).attrTween("x",((t,e,n)=>{const i=mn(n[e].getAttribute("x"),u(t.binValue)+1.5);return t=>i(r(Ei)(t))})).attrTween("y",((t,e,n)=>{const i=mn(n[e].getAttribute("y"),d(0)+1.5-(t.binCount+1)*p);return t=>i(r(Si)(t))})).on("end",((t,e,r)=>{r[e].removeAttribute("data-new-trial-ease-time"),t.new=!1,this.alignTrial(t),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{stimulus:t.signal,response:t.response,outcome:t.outcome,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:0},bubbles:!0}))}))}const o=s.filter((t=>t.new&&t.paused));if(!o.empty()){const t=o.attr("data-new-trial-ease-time");o.transition().duration(h).ease(Ei).attr("x",(e=>mn(0,u(e.binValue)+1.5)(Ei(t)))).attr("y",(e=>mn(0,d(0)+1.5-(e.binCount+1)*p)(Si(t)))).attr("stroke",(e=>an(this.getComputedStyleValue("---color-acc"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}`):this.getComputedStyleValue("---color-acc"))(Si(t)))).attr("fill",(e=>an(this.getComputedStyleValue("---color-acc-light"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))(Si(t))))}s.filter((t=>!t.new)).transition().duration(h).ease(Ei).attr("x",(t=>u(t.binValue)+1.5)).attr("y",(t=>d(0)+1.5-(t.binCount+1)*p)).attr("stroke",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"))).attr("fill",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))),i.exit().transition().duration(h).ease(_i).attrTween("stroke",((t,e,r)=>{const n=r[e],i=an(n.getAttribute("stroke"),this.getComputedStyleValue("---color-acc"));return t=>i(Si(t))})).attrTween("fill",((t,e,r)=>{const n=r[e],i=an(n.getAttribute("fill"),this.getComputedStyleValue("---color-acc-light"));return t=>i(Si(t))})).attrTween("x",((t,e,r)=>{const n=mn(r[e].getAttribute("x"),0);return t=>n(Si(t))})).attrTween("y",((t,e,r)=>{const n=mn(r[e].getAttribute("y"),0);return t=>n(Ei(t))})).remove()}const rt=k.append("g").classed("overlayer",!0),nt=$.select(".overlayer");rt.append("rect").classed("background",!0),nt.select(".background").attr("height",l).attr("width",c),this.drag=!1,this.firstUpdate=!1}pauseTrial(){const t=dr(this.renderRoot).select(".trial[data-new-trial-ease-time]");t.interrupt("new"),t.datum((t=>(t.paused=!0,t)))}resumeTrial(){dr(this.renderRoot).select(".trial[data-new-trial-ease-time]").datum((t=>(t.paused=!1,t))),this.requestUpdate()}}customElements.define("sdt-model",yo);class wo extends ho{static get properties(){return{feedback:{attribute:"feedback",type:String,reflect:!0},trial:{attribute:"trial",type:Boolean,reflect:!0},payoff:{attribute:"payoff",type:String,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-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.feedbacks=["none","accuracy","outcome"],this.feedback="outcome",this.trial=!1,this.payoffs=["none","trial","total"],this.payoff="none",this.hPayoff=0,this.mPayoff=0,this.crPayoff=0,this.faPayoff=0,this.nrPayoff=0,this.states=["off","waiting","feedback"],this.state="off",this.trialCount=0,this.trialTotal=0,this.signals=["present","absent"],this.signal=void 0,this.responses=["present","absent"],this.response=void 0,this.outcomes=["h","m","fa","cr","nr"],this.outcome=void 0,this.accuracies=["c","e","nr"],this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.c=0,this.e=0,this.nr=0}get trialPayoff(){switch(this.outcome){case"h":return this.hPayoff;case"m":return this.mPayoff;case"fa":return this.faPayoff;case"cr":return this.crPayoff;case"nr":return this.nrPayoff;default:return}}get totalPayoff(){return this.h*this.hPayoff+this.m*this.mPayoff+this.cr*this.crPayoff+this.fa*this.faPayoff+this.nr*this.nrPayoff}start(t,e){this.trialCount=e,this.state="waiting",this.signal=t,this.response=void 0,this.outcome=void 0}stop(){this.state="feedback",void 0===this.response&&(this.outcome="nr",this.nr+=1,this.accuracy="nr")}present(){this.responded("present")}absent(){this.responded("absent")}responded(t){this.state="feedback",this.response=t,"present"===this.signal&&"present"===this.response?(this.outcome="h",this.h+=1,this.accuracy="c",this.c+=1):"present"===this.signal&&"absent"===this.response?(this.outcome="m",this.m+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"present"===this.response?(this.outcome="fa",this.fa+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"absent"===this.response&&(this.outcome="cr",this.cr+=1,this.accuracy="c",this.c+=1),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{trial:this.trialCount,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:this.nr,totalPayoff:this.totalPayoff},bubbles:!0}))}reset(){this.state="off",this.trialCount=0,this.signal=void 0,this.response=void 0,this.outcome=void 0,this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.nr=0,this.c=0,this.e=0}static get styles(){return[super.styles,it`
1313
+ `]}render(){return Pt`
1314
+ ${Vo.svgFilters}
1315
+ `}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-model-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far,hr:this.hr,h:this.h,m:this.m,fa:this.fa,cr:this.cr},bubbles:!0}))}getDimensions(){this.width=parseFloat(this.getComputedStyleValue("width"),10),this.height=parseFloat(this.getComputedStyleValue("height"),10),this.rem=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"),10)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.getDimensions.bind(this))}disconnectedCallback(){window.removeEventListener("resize",this.getDimensions.bind(this)),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.getDimensions()}update(t){if(super.update(t),this.alignState(),Number.isNaN(this.width)||Number.isNaN(this.height)||Number.isNaN(this.rem))return;const e=this.width,r=this.height;let n,i;e/r>1.8?(i=r,n=1.8*i):(n=e,i=n/1.8);const s=2*this.rem,a=3*this.rem,o=3*this.rem,l=i-(s+a),c=n-(o+(this.histogram&&this.distributions?3:.75)*this.rem),h=parseInt(this.getComputedStyleValue("---transition-duration"),10),u=No().domain([-3,3]).range([0,c]),d=No().domain([.5,0]).range([0,l]),p=u(this.binWidth)-u(0),f=No().domain([l/p,0]).range([0,l]),m=ln().subject((()=>({x:u(this.l),y:0}))).on("start",(t=>{Yr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.c=Yo.l2C(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Yr(t.currentTarget).classed("dragging",!1)})),b=ln().subject((()=>({x:u(this.muN),y:0}))).on("start",(t=>{Yr(t.currentTarget).classed("dragging",!0)})).on("drag",(t=>{this.drag=!0;let e=u.invert(t.x);e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,this.d=Yo.muN2D(e,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Yr(t.currentTarget).classed("dragging",!1)})),v=ln().subject((()=>({x:u(this.muS),y:d(this.hS)}))).on("start",((t,e)=>{Yr(t.currentTarget).classed("dragging",!0),e.startX=t.x,e.startY=t.y,e.startHS=this.hS,e.startMuS=this.muS})).on("drag",((t,e)=>{this.drag=!0;let r=this.muS;this.interactive&&(r=u.invert(t.x),r=r<u.domain()[0]?u.domain()[0]:r>u.domain()[1]?u.domain()[1]:r);let n=this.hS;this.unequal&&(n=d.invert(t.y),n=n<.01?.01:n>d.domain()[0]?d.domain()[0]:n),this.interactive&&this.unequal&&t.sourceEvent.shiftKey&&(Math.abs(t.x-e.startX)>Math.abs(t.y-e.startY)?n=e.startHS:r=e.startMuS),this.unequal&&(this.s=Yo.h2S(n),this.c=Yo.l2C(this.l,this.s)),this.d=Yo.muS2D(r,this.s),this.alignState(),this.sendEvent()})).on("end",(t=>{Yr(t.currentTarget).classed("dragging",!1)})),g=Ho().x((t=>u(t.e))).y((t=>d(t.p))),y=Yr(this.renderRoot).selectAll(".main").data([{width:this.width,height:this.height,rem:this.rem}]),w=y.enter().append("svg").classed("main",!0),x=w.merge(y).attr("viewBox",`0 0 ${n} ${i}`),$=w.append("g").classed("plot",!0),_=x.select(".plot").attr("transform",`translate(${o}, ${s})`),k=$.append("g").classed("underlayer",!0),S=_.select(".underlayer");k.append("rect").classed("background",!0),S.select(".background").attr("height",l).attr("width",c),k.append("g").classed("axis-x",!0);S.select(".axis-x").attr("transform",`translate(0, ${l})`).call(Ce(u)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),k.append("text").classed("title-x",!0).attr("text-anchor","middle").text("Evidence"),S.select(".title-x").attr("transform",`translate(${c/2}, ${l+2.25*this.rem})`);const A=S.selectAll(".axis-y").data(this.distributions?[{}]:[]);A.enter().append("g").classed("axis-y",!0).merge(A).call(Ne(d).ticks(5)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),A.exit().remove();const E=S.selectAll(".title-y").data(this.distributions?[{}]:[]);E.enter().append("text").classed("title-y",!0).attr("text-anchor","middle").text("Probability").merge(E).attr("transform",`translate(${-2*this.rem}, ${l/2})rotate(-90)`),E.exit().remove();const M=S.selectAll(".axis-y2").data(this.histogram?[{}]:[]);var T;M.enter().append("g").classed("axis-y2",!0).merge(M).attr("transform",this.distributions?`translate(${c}, 0)`:"").call(this.distributions?(T=f,Te(we,T)).ticks(10):Ne(f).ticks(10)).attr("font-size",null).attr("font-family",null).selectAll("line, path").attr("stroke",null),M.exit().remove();const C=S.selectAll(".title-y2").data(this.histogram?[{}]:[]);C.enter().append("text").classed("title-y2",!0).attr("text-anchor","middle").text("Count").merge(C).attr("transform",this.distributions?`translate(${c+1.5*this.rem}, ${l/2})rotate(90)`:`translate(${-1.5*this.rem}, ${l/2})rotate(-90)`),C.exit().remove(),$.append("g").classed("content",!0);const N=_.select(".content"),R=N.selectAll(".signal-noise").data(this.distributions?[{}]:[]),P=R.enter().append("g").classed("signal-noise",!0),q=P.merge(R);R.exit().remove();const z=P.append("g").classed("noise",!0),F=q.selectAll(".noise").attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive).on("keydown",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muN;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muN&&(this.d=Yo.muN2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive"))&&(this.interactive?F.call(b):F.on(".drag",null)),z.append("path").classed("curve-cr",!0),F.select(".curve-cr").transition().duration(this.drag?0:h).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d),s=Gn(void 0!==n.c?n.c:this.c,this.c),a=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ve(u.domain()[0],Yo.c2L(n.c,n.s),.05).map((t=>({e:t,p:Xo.normal.pdf(t,Yo.d2MuN(n.d,n.s),1)})));return e.push({e:Yo.c2L(n.c,n.s),p:Xo.normal.pdf(Yo.c2L(n.c,n.s),Yo.d2MuN(n.d,n.s),1)}),e.push({e:Yo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),z.append("path").classed("curve-fa",!0),F.select(".curve-fa").transition().duration(this.drag?0:h).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d),s=Gn(void 0!==n.c?n.c:this.c,this.c),a=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ve(Yo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:Xo.normal.pdf(t,Yo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:Xo.normal.pdf(u.domain()[1],Yo.d2MuN(n.d,n.s),1)}),e.push({e:u.domain()[1],p:0}),e.push({e:Yo.c2L(n.c,n.s),p:0}),g(e)}})),z.append("path").classed("curve-noise",!0),F.select(".curve-noise").transition().duration(this.drag?0:h).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d),s=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=ve(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:Xo.normal.pdf(t,Yo.d2MuN(n.d,n.s),1)})));return e.push({e:u.domain()[1],p:Xo.normal.pdf(u.domain()[1],Yo.d2MuN(n.d,n.s),1)}),g(e)}}));const O=P.append("g").classed("signal",!0),H=q.selectAll(".signal").attr("tabindex",this.interactive||this.unequal?0:null).classed("interactive",this.interactive).classed("unequal",this.unequal).on("keydown.sensitivity",this.interactive?t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.muS;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.muS&&(this.d=Yo.muS2D(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null).on("keydown.variance",this.unequal?t=>{if(["ArrowUp","ArrowDown"].includes(t.key)){let e=this.hS;switch(t.key){case"ArrowUp":e+=t.shiftKey?.002:.02;break;case"ArrowDown":e-=t.shiftKey?.002:.02}e=e<.01?.01:e>d.domain()[0]?d.domain()[0]:e,e!==this.hS&&(this.s=Yo.h2S(e),this.d=Yo.muN2D(this.muN,this.s),this.c=Yo.l2C(this.l,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}}:null);(this.firstUpdate||t.has("interactive")||t.has("unequal"))&&(this.interactive||this.unequal?H.call(v):H.on(".drag",null)),O.append("path").classed("curve-m",!0),H.select(".curve-m").transition().duration(this.drag?0:h).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d),s=Gn(void 0!==n.c?n.c:this.c,this.c),a=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ve(u.domain()[0],Yo.c2L(n.c,n.s),.05).map((t=>({e:t,p:Xo.normal.pdf(t,Yo.d2MuS(n.d,n.s),n.s)})));return e.push({e:Yo.c2L(n.c,n.s),p:Xo.normal.pdf(Yo.c2L(n.c,n.s),Yo.d2MuS(n.d,n.s),n.s)}),e.push({e:Yo.c2L(n.c,n.s),p:0}),e.push({e:u.domain()[0],p:0}),g(e)}})),O.append("path").classed("curve-h",!0),H.select(".curve-h").transition().duration(this.drag?0:h).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d),s=Gn(void 0!==n.c?n.c:this.c,this.c),a=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.c=s(t),n.s=a(t);const e=ve(Yo.c2L(n.c,n.s),u.domain()[1],.05).map((t=>({e:t,p:Xo.normal.pdf(t,Yo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:Xo.normal.pdf(u.domain()[1],Yo.d2MuS(n.d,n.s),n.s)}),e.push({e:u.domain()[1],p:0}),e.push({e:Yo.c2L(n.c,n.s),p:0}),g(e)}})),O.append("path").classed("curve-signal",!0),H.select(".curve-signal").transition().duration(this.drag?0:h).ease(ls).attrTween("d",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d),s=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.d=i(t),n.s=s(t);const e=ve(u.domain()[0],u.domain()[1],.05).map((t=>({e:t,p:Xo.normal.pdf(t,Yo.d2MuS(n.d,n.s),n.s)})));return e.push({e:u.domain()[1],p:Xo.normal.pdf(u.domain()[1],Yo.d2MuS(n.d,n.s),n.s)}),g(e)}}));const U=N.selectAll(".measure-d").data(this.sensitivity?[{}]:[]),I=U.enter().append("g").classed("measure-d",!0);I.append("line").classed("line",!0),I.append("line").classed("cap-left",!0),I.append("line").classed("cap-right",!0);const D=I.append("text").classed("label",!0);D.append("tspan").classed("d math-var",!0).text("d′"),D.append("tspan").classed("equals",!0).text(" = "),D.append("tspan").classed("value",!0);const L=I.merge(U);L.select(".line").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.muN)).attr("y1",d(.43)).attr("x2",u(this.muS)).attr("y2",d(.43)),L.select(".cap-left").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.muN)).attr("y1",d(.43)+5).attr("x2",u(this.muN)).attr("y2",d(.43)-5),L.select(".cap-right").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.muS)).attr("y1",d(.43)+5).attr("x2",u(this.muS)).attr("y2",d(.43)-5);L.select(".label").transition().duration(this.drag?0:h).ease(ls).attr("x",u(this.muN>this.muS?this.muN:this.muS)+5).attr("y",d(.43)+3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.d?n.d:this.d,this.d);return t=>{n.d=i(t),Yr(n).text(Ds(".3")(n.d))}})),U.exit().remove();const j=N.selectAll(".measure-c").data(this.bias?[{}]:[]),V=j.enter().append("g").classed("measure-c",!0);V.append("line").classed("line",!0),V.append("line").classed("cap-zero",!0);const B=V.append("text").classed("label",!0);B.append("tspan").classed("c math-var",!0).text("c"),B.append("tspan").classed("equals",!0).text(" = "),B.append("tspan").classed("value",!0);const K=V.merge(j);K.select(".line").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.l)).attr("y1",d(.47)).attr("x2",u(0)).attr("y2",d(.47)),K.select(".cap-zero").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(0)).attr("y1",d(.47)+5).attr("x2",u(0)).attr("y2",d(.47)-5);K.select(".label").transition().duration(this.drag?0:h).ease(ls).attr("x",u(0)+(this.l<0?5:-5)).attr("y",d(.47)+3).attr("text-anchor",this.c<0?"start":"end").select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.c?n.c:this.c,this.c);return t=>{n.c=i(t),Yr(n).text(Ds(".3")(n.c))}})),j.exit().remove();const W=N.selectAll(".measure-s").data(this.variance?[{}]:[]),X=W.enter().append("g").classed("measure-s",!0);X.append("line").classed("line",!0),X.append("line").classed("cap-left",!0),X.append("line").classed("cap-right",!0);const Y=X.append("text").classed("label",!0);Y.append("tspan").classed("s math-var",!0).text("σ"),Y.append("tspan").classed("equals",!0).text(" = "),Y.append("tspan").classed("value",!0);const Z=X.merge(W);Z.select(".line").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.muS-this.s)).attr("y1",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s).attr("x2",u(this.muS+this.s)).attr("y2",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s),Z.select(".cap-left").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.muS-this.s)).attr("y1",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS-this.s)).attr("y2",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s-5),Z.select(".cap-right").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.muS+this.s)).attr("y1",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s+5).attr("x2",u(this.muS+this.s)).attr("y2",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s-5);Z.select(".label").transition().duration(this.drag?0:h).ease(ls).attr("x",u(this.muS)).attr("y",d(Xo.normal.pdf(this.s,0,this.s))+10/this.s-3).select(".value").tween("text",((t,e,r)=>{const n=r[e],i=Gn(void 0!==n.s?n.s:this.s,this.s);return t=>{n.s=i(t),Yr(n).text(Ds(".3")(n.s))}})),W.exit().remove();const G=N.selectAll(".threshold").data(this.threshold?[{}]:[]),J=G.enter().append("g").classed("threshold",!0);J.append("line").classed("line",!0),J.append("circle").classed("handle",!0);const Q=J.merge(G).attr("tabindex",this.interactive?0:null).classed("interactive",this.interactive);(this.firstUpdate||t.has("interactive"))&&(this.interactive?Q.call(m).on("keydown",(t=>{if(["ArrowRight","ArrowLeft"].includes(t.key)){let e=this.l;switch(t.key){case"ArrowRight":e+=t.shiftKey?.01:.1;break;case"ArrowLeft":e-=t.shiftKey?.01:.1}e=e<u.domain()[0]?u.domain()[0]:e>u.domain()[1]?u.domain()[1]:e,e!==this.l&&(this.c=Yo.l2C(e,this.s),this.alignState(),this.sendEvent()),t.preventDefault()}})):Q.on("drag",null).on("keydown",null)),Q.select(".line").transition().duration(this.drag?0:h).ease(ls).attr("x1",u(this.l)).attr("y1",d(0)).attr("x2",u(this.l)).attr("y2",d(.54)),Q.select(".handle").transition().duration(this.drag?0:h).ease(ls).attr("cx",u(this.l)).attr("cy",d(.54)),G.exit().remove();const tt=N.selectAll(".histogram").data(this.histogram?[{}]:[]),et=tt.enter().append("g").classed("histogram",!0).merge(tt);if(tt.exit().remove(),this.histogram){const t=be().value((t=>t.trueEvidence)).domain(u.domain()).thresholds(ve(this.binRange[0],this.binRange[1],this.binWidth)),e=t(this.trials);let r=-1,n=-1;for(let t=0;t<e.length;t+=1)for(let i=0;i<e[t].length;i+=1)e[t][i].binValue=e[t].x0,e[t][i].binCount=i,0===t&&(r=i),t===e.length-1&&(n=i);for(let t=0;t<this.trials.length;t+=1)this.trials[t].trueEvidence<this.binRange[0]&&(r+=1,this.trials[t].binCount=r,this.trials[t].binValue=e[0].x0),this.trials[t].trueEvidence>this.binRange[1]&&(n+=1,this.trials[t].binCount=n,this.trials[t].binValue=e[e.length-1].x0);const i=et.selectAll(".trial").data(this.trials,(t=>t.trial)),s=i.enter().append("rect").attr("stroke-width",3).attr("data-new-trial-ease-time",0).attr("stroke",this.getComputedStyleValue("---color-acc")).attr("fill",this.getComputedStyleValue("---color-acc-light")).merge(i).attr("class",(t=>`trial ${t.outcome}`)).attr("width",p-3).attr("height",p-3),a=s.filter((t=>t.new&&!t.paused));if(!a.empty()){const t=a.attr("data-new-trial-ease-time"),e=e=>No().domain([0,1]).range([t,1])(e),r=e=>r=>No().domain([e(t),1]).range([0,1])(e(r));a.transition("new").duration((e=>Math.floor((.75*e.duration+.25*e.wait)*(1-t)))).ease(e).attr("data-new-trial-ease-time",1).attrTween("stroke",((t,e,n)=>{const i=n[e],s=Ln(i.getAttribute("stroke"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"));return t=>s(r(os)(t))})).attrTween("fill",((t,e,n)=>{const i=n[e],s=Ln(i.getAttribute("fill"),"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"));return t=>s(r(os)(t))})).attrTween("x",((t,e,n)=>{const i=Gn(n[e].getAttribute("x"),u(t.binValue)+1.5);return t=>i(r(ls)(t))})).attrTween("y",((t,e,n)=>{const i=Gn(n[e].getAttribute("y"),d(0)+1.5-(t.binCount+1)*p);return t=>i(r(os)(t))})).on("end",((t,e,r)=>{r[e].removeAttribute("data-new-trial-ease-time"),t.new=!1,this.alignTrial(t),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{stimulus:t.signal,response:t.response,outcome:t.outcome,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:0},bubbles:!0}))}))}const o=s.filter((t=>t.new&&t.paused));if(!o.empty()){const t=o.attr("data-new-trial-ease-time");o.transition().duration(h).ease(ls).attr("x",(e=>Gn(0,u(e.binValue)+1.5)(ls(t)))).attr("y",(e=>Gn(0,d(0)+1.5-(e.binCount+1)*p)(os(t)))).attr("stroke",(e=>Ln(this.getComputedStyleValue("---color-acc"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}`):this.getComputedStyleValue("---color-acc"))(os(t)))).attr("fill",(e=>Ln(this.getComputedStyleValue("---color-acc-light"),"stimulus"===this.color?"present"===e.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${e.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${e.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))(os(t))))}s.filter((t=>!t.new)).transition().duration(h).ease(ls).attr("x",(t=>u(t.binValue)+1.5)).attr("y",(t=>d(0)+1.5-(t.binCount+1)*p)).attr("stroke",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr"):this.getComputedStyleValue("---color-far"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}`):this.getComputedStyleValue("---color-acc"))).attr("fill",(t=>"stimulus"===this.color?"present"===t.signal?this.getComputedStyleValue("---color-hr-light"):this.getComputedStyleValue("---color-far-light"):"response"===this.color?this.getComputedStyleValue(`---color-${t.response}-light`):"outcome"===this.color?this.getComputedStyleValue(`---color-${t.outcome}-light`):this.getComputedStyleValue("---color-acc-light"))),i.exit().transition().duration(h).ease(as).attrTween("stroke",((t,e,r)=>{const n=r[e],i=Ln(n.getAttribute("stroke"),this.getComputedStyleValue("---color-acc"));return t=>i(os(t))})).attrTween("fill",((t,e,r)=>{const n=r[e],i=Ln(n.getAttribute("fill"),this.getComputedStyleValue("---color-acc-light"));return t=>i(os(t))})).attrTween("x",((t,e,r)=>{const n=Gn(r[e].getAttribute("x"),0);return t=>n(os(t))})).attrTween("y",((t,e,r)=>{const n=Gn(r[e].getAttribute("y"),0);return t=>n(ls(t))})).remove()}const rt=$.append("g").classed("overlayer",!0),nt=_.select(".overlayer");rt.append("rect").classed("background",!0),nt.select(".background").attr("height",l).attr("width",c),this.drag=!1,this.firstUpdate=!1}pauseTrial(){const t=Yr(this.renderRoot).select(".trial[data-new-trial-ease-time]");t.interrupt("new"),t.datum((t=>(t.paused=!0,t)))}resumeTrial(){Yr(this.renderRoot).select(".trial[data-new-trial-ease-time]").datum((t=>(t.paused=!1,t))),this.requestUpdate()}}customElements.define("sdt-model",Jo);class Qo extends Vo{static get properties(){return{feedback:{attribute:"feedback",type:String,reflect:!0},trial:{attribute:"trial",type:Boolean,reflect:!0},payoff:{attribute:"payoff",type:String,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-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.feedbacks=["none","accuracy","outcome"],this.feedback="outcome",this.trial=!1,this.payoffs=["none","trial","total"],this.payoff="none",this.hPayoff=0,this.mPayoff=0,this.crPayoff=0,this.faPayoff=0,this.nrPayoff=0,this.states=["off","waiting","feedback"],this.state="off",this.trialCount=0,this.trialTotal=0,this.signals=["present","absent"],this.signal=void 0,this.responses=["present","absent"],this.response=void 0,this.outcomes=["h","m","fa","cr","nr"],this.outcome=void 0,this.accuracies=["c","e","nr"],this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.c=0,this.e=0,this.nr=0}get trialPayoff(){switch(this.outcome){case"h":return this.hPayoff;case"m":return this.mPayoff;case"fa":return this.faPayoff;case"cr":return this.crPayoff;case"nr":return this.nrPayoff;default:return}}get totalPayoff(){return this.h*this.hPayoff+this.m*this.mPayoff+this.cr*this.crPayoff+this.fa*this.faPayoff+this.nr*this.nrPayoff}start(t,e){this.trialCount=e,this.state="waiting",this.signal=t,this.response=void 0,this.outcome=void 0}stop(){this.state="feedback",void 0===this.response&&(this.outcome="nr",this.nr+=1,this.accuracy="nr")}present(){this.responded("present")}absent(){this.responded("absent")}responded(t){this.state="feedback",this.response=t,"present"===this.signal&&"present"===this.response?(this.outcome="h",this.h+=1,this.accuracy="c",this.c+=1):"present"===this.signal&&"absent"===this.response?(this.outcome="m",this.m+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"present"===this.response?(this.outcome="fa",this.fa+=1,this.accuracy="e",this.e+=1):"absent"===this.signal&&"absent"===this.response&&(this.outcome="cr",this.cr+=1,this.accuracy="c",this.c+=1),this.dispatchEvent(new CustomEvent("detectable-response",{detail:{trial:this.trialCount,signal:this.signal,response:this.response,outcome:this.outcome,payoff:this.trialPayoff,h:this.h,m:this.m,fa:this.fa,cr:this.cr,nr:this.nr,totalPayoff:this.totalPayoff},bubbles:!0}))}reset(){this.state="off",this.trialCount=0,this.signal=void 0,this.response=void 0,this.outcome=void 0,this.accuracy=void 0,this.h=0,this.m=0,this.cr=0,this.fa=0,this.nr=0,this.c=0,this.e=0}static get styles(){return[super.styles,rt`
1309
1316
  :host {
1310
1317
  display: inline-block;
1311
1318
  }
@@ -1425,29 +1432,29 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1425
1432
  .total .label {
1426
1433
  font-weight: 600;
1427
1434
  }
1428
- `]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));return F`
1435
+ `]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));return Pt`
1429
1436
  <div class="holder">
1430
1437
  <div class="responses">
1431
1438
  <decidables-button name="present" class=${"feedback"===this.state&&"present"===this.response?"selected":"waiting"===this.state?"waiting":""} ?disabled=${"waiting"!==this.state||!0!==this.interactive} @click=${this.present.bind(this)}>Present</decidables-button>
1432
1439
  <decidables-button name="absent" class=${"feedback"===this.state&&"absent"===this.response?"selected":"waiting"===this.state?"waiting":""} ?disabled=${"waiting"!==this.state||!0!==this.interactive} @click=${this.absent.bind(this)}>Absent</decidables-button>
1433
1440
  </div>
1434
- ${this.trial||"none"!==this.feedback||"total"===this.payoff?F`
1441
+ ${this.trial||"none"!==this.feedback||"total"===this.payoff?Pt`
1435
1442
  <div class="feedbacks">
1436
- ${this.trial?F`
1443
+ ${this.trial?Pt`
1437
1444
  <div class="trial">
1438
1445
  <span class="label">Trial: </span><span class="count">${this.trialCount}</span><span class="of"> of </span><span class="total">${this.trialTotal}</span>
1439
- </div>`:F``}
1440
- ${"none"!==this.feedback?F`
1446
+ </div>`:Pt``}
1447
+ ${"none"!==this.feedback?Pt`
1441
1448
  <div class=${`feedback ${"feedback"===this.state?"outcome"===this.feedback?this.outcome:this.accuracy:""}`}>
1442
- ${"feedback"===this.state?"outcome"===this.feedback?"h"===this.outcome?F`<span class="outcome">Hit</span>`:"m"===this.outcome?F`<span class="outcome">Miss</span>`:"fa"===this.outcome?F`<span class="outcome">False<br>Alarm</span>`:"cr"===this.outcome?F`<span class="outcome">Correct<br>Rejection</span>`:F`<span class="outcome">No<br>Response</span>`:"c"===this.accuracy?F`<span class="outcome">Correct</span>`:"e"===this.accuracy?F`<span class="outcome">Error</span>`:F`<span class="outcome">No<br>Response</span>`:""}
1443
- ${"feedback"!==this.state||"trial"!==this.payoff&&"total"!==this.payoff?F``:F`<span class="payoff">${e(this.trialPayoff)}</span>`}
1444
- </div>`:F``}
1445
- ${"total"===this.payoff?F`
1449
+ ${"feedback"===this.state?"outcome"===this.feedback?"h"===this.outcome?Pt`<span class="outcome">Hit</span>`:"m"===this.outcome?Pt`<span class="outcome">Miss</span>`:"fa"===this.outcome?Pt`<span class="outcome">False<br>Alarm</span>`:"cr"===this.outcome?Pt`<span class="outcome">Correct<br>Rejection</span>`:Pt`<span class="outcome">No<br>Response</span>`:"c"===this.accuracy?Pt`<span class="outcome">Correct</span>`:"e"===this.accuracy?Pt`<span class="outcome">Error</span>`:Pt`<span class="outcome">No<br>Response</span>`:""}
1450
+ ${"feedback"!==this.state||"trial"!==this.payoff&&"total"!==this.payoff?Pt``:Pt`<span class="payoff">${e(this.trialPayoff)}</span>`}
1451
+ </div>`:Pt``}
1452
+ ${"total"===this.payoff?Pt`
1446
1453
  <div class="total">
1447
1454
  <span class="label">Total: </span><span class="value">${e(this.totalPayoff)}</span>
1448
- </div>`:F``}
1449
- </div>`:F``}
1450
- </div>`}}customElements.define("detectable-response",wo);class xo extends ho{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0},summary:{attribute:"summary",converter:co,reflect:!0},color:{attribute:"color",type:String,reflect:!0},h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},payoff:{attribute:"payoff",type:Boolean,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-payoff",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},acc:{attribute:!1,type:Number,reflect:!1},ppv:{attribute:!1,type:Number,reflect:!1},fomr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.numeric=!1,this.summaries=["stimulusRates","responseRates","accuracy"],this.summary=new Set,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color="all",this.h=40,this.m=60,this.fa=75,this.cr=25,this.alignState(),this.payoff=!1,this.hPayoff=void 0,this.mPayoff=void 0,this.crPayoff=void 0,this.faPayoff=void 0}alignState(){this.hr=bo.hM2Hr(this.h,this.m),this.far=bo.faCr2Far(this.fa,this.cr),this.acc=bo.hMFaCr2Acc(this.h,this.m,this.fa,this.cr),this.ppv=bo.hFa2Ppv(this.h,this.fa),this.fomr=bo.mCr2Fomr(this.m,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("detectable-table-change",{detail:{h:this.h,m:this.m,hr:this.hr,fa:this.fa,cr:this.cr,far:this.far,acc:this.acc,ppv:this.ppv,fomr:this.fomr},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}hrInput(t){const e=parseFloat(t.target.value),r=this.h+this.m;this.h=Math.round(e*r),this.m=r-this.h,this.alignState(),this.sendEvent()}farInput(t){const e=parseFloat(t.target.value),r=this.fa+this.cr;this.fa=Math.round(e*r),this.cr=r-this.fa,this.alignState(),this.sendEvent()}accInput(t){const e=parseFloat(t.target.value),r=this.h+this.m,n=this.fa+this.cr,i=(this.hr+this.far-1)/2;let s=i+e,a=1+i-e;a>1&&(a=1,s=a+2*e-1),a<0&&(a=0,s=a+2*e-1),s>1&&(s=1,a=s-2*e+1),s<0&&(s=0,a=s-2*e+1),this.h=Math.round(s*r),this.m=r-this.h,this.fa=Math.round(a*n),this.cr=n-this.fa,this.alignState(),this.sendEvent()}ppvInput(t){const e=parseFloat(t.target.value),r=this.h+this.fa;this.h=Math.round(e*r),this.fa=r-this.h,this.alignState(),this.sendEvent()}fomrInput(t){const e=parseFloat(t.target.value),r=this.m+this.cr;this.m=Math.round(e*r),this.cr=r-this.m,this.alignState(),this.sendEvent()}static get styles(){return[super.styles,it`
1455
+ </div>`:Pt``}
1456
+ </div>`:Pt``}
1457
+ </div>`}}customElements.define("detectable-response",Qo);class tl extends Vo{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0},summary:{attribute:"summary",converter:jo,reflect:!0},color:{attribute:"color",type:String,reflect:!0},h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},payoff:{attribute:"payoff",type:Boolean,reflect:!0},hPayoff:{attribute:"hit-payoff",type:Number,reflect:!0},mPayoff:{attribute:"miss-payoff",type:Number,reflect:!0},faPayoff:{attribute:"false-alarm-payoff",type:Number,reflect:!0},crPayoff:{attribute:"correct-rejection-payoff",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1},hr:{attribute:!1,type:Number,reflect:!1},acc:{attribute:!1,type:Number,reflect:!1},ppv:{attribute:!1,type:Number,reflect:!1},fomr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.numeric=!1,this.summaries=["stimulusRates","responseRates","accuracy"],this.summary=new Set,this.colors=["none","accuracy","stimulus","response","outcome","all"],this.color="all",this.h=40,this.m=60,this.fa=75,this.cr=25,this.alignState(),this.payoff=!1,this.hPayoff=void 0,this.mPayoff=void 0,this.crPayoff=void 0,this.faPayoff=void 0}alignState(){this.hr=Yo.hM2Hr(this.h,this.m),this.far=Yo.faCr2Far(this.fa,this.cr),this.acc=Yo.hMFaCr2Acc(this.h,this.m,this.fa,this.cr),this.ppv=Yo.hFa2Ppv(this.h,this.fa),this.fomr=Yo.mCr2Fomr(this.m,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("detectable-table-change",{detail:{h:this.h,m:this.m,hr:this.hr,fa:this.fa,cr:this.cr,far:this.far,acc:this.acc,ppv:this.ppv,fomr:this.fomr},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}hrInput(t){const e=parseFloat(t.target.value),r=this.h+this.m;this.h=Math.round(e*r),this.m=r-this.h,this.alignState(),this.sendEvent()}farInput(t){const e=parseFloat(t.target.value),r=this.fa+this.cr;this.fa=Math.round(e*r),this.cr=r-this.fa,this.alignState(),this.sendEvent()}accInput(t){const e=parseFloat(t.target.value),r=this.h+this.m,n=this.fa+this.cr,i=(this.hr+this.far-1)/2;let s=i+e,a=1+i-e;a>1&&(a=1,s=a+2*e-1),a<0&&(a=0,s=a+2*e-1),s>1&&(s=1,a=s-2*e+1),s<0&&(s=0,a=s-2*e+1),this.h=Math.round(s*r),this.m=r-this.h,this.fa=Math.round(a*n),this.cr=n-this.fa,this.alignState(),this.sendEvent()}ppvInput(t){const e=parseFloat(t.target.value),r=this.h+this.fa;this.h=Math.round(e*r),this.fa=r-this.h,this.alignState(),this.sendEvent()}fomrInput(t){const e=parseFloat(t.target.value),r=this.m+this.cr;this.m=Math.round(e*r),this.cr=r-this.m,this.alignState(),this.sendEvent()}static get styles(){return[super.styles,rt`
1451
1458
  :host {
1452
1459
  display: inline-block;
1453
1460
  }
@@ -1630,51 +1637,51 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1630
1637
  :host([color="none"]) .acc {
1631
1638
  background: var(---color-element-background);
1632
1639
  }
1633
- `]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));let r,n,i,s,a,o,l,c,h;return this.alignState(),this.numeric?(r=F`
1640
+ `]}render(){const t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),e=e=>t.formatToParts(e).map((({type:t,value:e})=>"minusSign"===t?"−":e)).reduce(((t,e)=>t+e));let r,n,i,s,a,o,l,c,h;return this.alignState(),this.numeric?(r=Pt`
1634
1641
  <decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
1635
1642
  <span>Hits</span>
1636
- ${this.payoff?F`<span class="payoff">${e(this.hPayoff)}</span>`:F``}
1643
+ ${this.payoff?Pt`<span class="payoff">${e(this.hPayoff)}</span>`:Pt``}
1637
1644
  </decidables-spinner>
1638
- `,n=F`
1645
+ `,n=Pt`
1639
1646
  <decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
1640
1647
  <span>Misses</span>
1641
- ${this.payoff?F`<span class="payoff">${e(this.mPayoff)}</span>`:F``}
1648
+ ${this.payoff?Pt`<span class="payoff">${e(this.mPayoff)}</span>`:Pt``}
1642
1649
  </decidables-spinner>
1643
- `,i=F`
1650
+ `,i=Pt`
1644
1651
  <decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
1645
1652
  <span>False Alarms</span>
1646
- ${this.payoff?F`<span class="payoff">${e(this.faPayoff)}</span>`:F``}
1653
+ ${this.payoff?Pt`<span class="payoff">${e(this.faPayoff)}</span>`:Pt``}
1647
1654
  </decidables-spinner>
1648
- `,s=F`
1655
+ `,s=Pt`
1649
1656
  <decidables-spinner ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
1650
1657
  <span>Correct Rejections</span>
1651
- ${this.payoff?F`<span class="payoff">${e(this.crPayoff)}</span>`:F``}
1658
+ ${this.payoff?Pt`<span class="payoff">${e(this.crPayoff)}</span>`:Pt``}
1652
1659
  </decidables-spinner>
1653
- `,a=F`
1660
+ `,a=Pt`
1654
1661
  <decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.hr.toFixed(3)}" @input=${this.hrInput.bind(this)}>
1655
1662
  <span>Hit Rate</span>
1656
1663
  </decidables-spinner>
1657
- `,o=F`
1664
+ `,o=Pt`
1658
1665
  <decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.far.toFixed(3)}" @input=${this.farInput.bind(this)}>
1659
1666
  <span>False Alarm Rate</span>
1660
1667
  </decidables-spinner>
1661
- `,l=F`
1668
+ `,l=Pt`
1662
1669
  <decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.acc.toFixed(3)}" @input=${this.accInput.bind(this)}>
1663
1670
  <span>Accuracy</span>
1664
1671
  </decidables-spinner>
1665
- `,c=F`
1672
+ `,c=Pt`
1666
1673
  <decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.ppv.toFixed(3)}" @input=${this.ppvInput.bind(this)}>
1667
1674
  <span>Positive Predictive Value</span>
1668
1675
  </decidables-spinner>
1669
- `,h=F`
1676
+ `,h=Pt`
1670
1677
  <decidables-spinner ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${+this.fomr.toFixed(3)}" @input=${this.fomrInput.bind(this)}>
1671
1678
  <span>False Omission Rate</span>
1672
1679
  </decidables-spinner>
1673
- `):(r=F`<span>Hits</span>
1674
- ${this.payoff?F`<span class="payoff">${e(this.hPayoff)}</span>`:F``}`,n=F`<span>Misses</span>
1675
- ${this.payoff?F`<span class="payoff">${e(this.mPayoff)}</span>`:F``}`,i=F`<span>False Alarms</span>
1676
- ${this.payoff?F`<span class="payoff">${e(this.faPayoff)}</span>`:F``}`,s=F`<span>Correct Rejections</span>
1677
- ${this.payoff?F`<span class="payoff">${e(this.crPayoff)}</span>`:F``}`,a=F`<span>Hit Rate</span>`,o=F`<span>False Alarm Rate</span>`,l=F`<span>Accuracy</span>`,c=F`<span>Positive Predictive Value</span>`,h=F`<span>False Omission Rate</span>`),F`
1680
+ `):(r=Pt`<span>Hits</span>
1681
+ ${this.payoff?Pt`<span class="payoff">${e(this.hPayoff)}</span>`:Pt``}`,n=Pt`<span>Misses</span>
1682
+ ${this.payoff?Pt`<span class="payoff">${e(this.mPayoff)}</span>`:Pt``}`,i=Pt`<span>False Alarms</span>
1683
+ ${this.payoff?Pt`<span class="payoff">${e(this.faPayoff)}</span>`:Pt``}`,s=Pt`<span>Correct Rejections</span>
1684
+ ${this.payoff?Pt`<span class="payoff">${e(this.crPayoff)}</span>`:Pt``}`,a=Pt`<span>Hit Rate</span>`,o=Pt`<span>False Alarm Rate</span>`,l=Pt`<span>Accuracy</span>`,c=Pt`<span>Positive Predictive Value</span>`,h=Pt`<span>False Omission Rate</span>`),Pt`
1678
1685
  <table class=${this.numeric?"numeric":""}>
1679
1686
  <thead>
1680
1687
  <tr>
@@ -1706,10 +1713,10 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1706
1713
  <td class="td td-data m">
1707
1714
  ${n}
1708
1715
  </td>
1709
- ${this.summary.has("stimulusRates")?F`
1716
+ ${this.summary.has("stimulusRates")?Pt`
1710
1717
  <td class="td td-summary hr">
1711
1718
  ${a}
1712
- </td>`:F``}
1719
+ </td>`:Pt``}
1713
1720
  </tr>
1714
1721
  <tr>
1715
1722
  <th class="th th-sub th-left" scope="row">
@@ -1721,29 +1728,29 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1721
1728
  <td class="td td-data cr">
1722
1729
  ${s}
1723
1730
  </td>
1724
- ${this.summary.has("stimulusRates")?F`
1731
+ ${this.summary.has("stimulusRates")?Pt`
1725
1732
  <td class="td td-summary far">
1726
1733
  ${o}
1727
- </td>`:F``}
1734
+ </td>`:Pt``}
1728
1735
  </tr>
1729
- ${this.summary.has("responseRates")||this.summary.has("accuracy")?F`
1736
+ ${this.summary.has("responseRates")||this.summary.has("accuracy")?Pt`
1730
1737
  <tr>
1731
1738
  <td colspan="2"></td>
1732
- ${this.summary.has("responseRates")?F`
1739
+ ${this.summary.has("responseRates")?Pt`
1733
1740
  <td class="td td-summary ppv">
1734
1741
  ${c}
1735
1742
  </td>
1736
1743
  <td class="td td-summary fomr">
1737
1744
  ${h}
1738
- </td>`:F`
1745
+ </td>`:Pt`
1739
1746
  <td colspan="2"></td>`}
1740
- ${this.summary.has("accuracy")?F`
1747
+ ${this.summary.has("accuracy")?Pt`
1741
1748
  <td class="td td-summary acc" rowspan="2">
1742
1749
  ${l}
1743
- </td>`:F``}
1744
- </tr>`:F``}
1750
+ </td>`:Pt``}
1751
+ </tr>`:Pt``}
1745
1752
  </tbody>
1746
- </table>`}}customElements.define("detectable-table",xo);class ko extends ho{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,it`
1753
+ </table>`}}customElements.define("detectable-table",tl);class el extends Vo{static get properties(){return{numeric:{attribute:"numeric",type:Boolean,reflect:!0}}}constructor(){super(),this.numeric=!1}static get styles(){return[super.styles,rt`
1747
1754
  :host {
1748
1755
  display: block;
1749
1756
 
@@ -1867,23 +1874,23 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1867
1874
  .s {
1868
1875
  background: var(---color-s-light);
1869
1876
  }
1870
- `]}}class $o extends ko{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.d=0,this.c=0,this.s=1,this.alignState()}alignState(){this.far=bo.dC2Far(this.d,this.c,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-dc2far-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far},bubbles:!0}))}dInput(t){this.d=parseFloat(t.target.value),this.alignState(),this.sendEvent()}cInput(t){this.c=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=F`
1877
+ `]}}class rl extends el{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.d=0,this.c=0,this.s=1,this.alignState()}alignState(){this.far=Yo.dC2Far(this.d,this.c,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-dc2far-change",{detail:{d:this.d,c:this.c,s:this.s,far:this.far},bubbles:!0}))}dInput(t){this.d=parseFloat(t.target.value),this.alignState(),this.sendEvent()}cInput(t){this.c=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
1871
1878
  <decidables-spinner class="d bottom" ?disabled=${!this.interactive} step=".001" .value="${this.d}" @input=${this.dInput.bind(this)}>
1872
1879
  <var class="math-var">d′</var>
1873
1880
  </decidables-spinner>
1874
- `,e=F`
1881
+ `,e=Pt`
1875
1882
  <decidables-spinner class="c bottom" ?disabled=${!this.interactive} step=".001" .value="${this.c}" @input=${this.cInput.bind(this)}>
1876
1883
  <var class="math-var">c</var>
1877
1884
  </decidables-spinner>
1878
- `,r=F`
1885
+ `,r=Pt`
1879
1886
  <decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
1880
1887
  <var class="math-var">σ</var>
1881
1888
  </decidables-spinner>
1882
- `,n=F`
1889
+ `,n=Pt`
1883
1890
  <decidables-spinner class="far bottom" disabled min="0" max="1" step=".001" .value="${+this.far.toFixed(3)}">
1884
1891
  <var>False Alarm Rate</var>
1885
1892
  </decidables-spinner>
1886
- `):(t=F`<var class="math-var d">d′</var>`,e=F`<var class="math-var c">c</var>`,r=F`<var class="math-var s">σ</var>`,n=F`<var class="far">False Alarm Rate</var>`),i=this.unequal?F`
1893
+ `):(t=Pt`<var class="math-var d">d′</var>`,e=Pt`<var class="math-var c">c</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="far">False Alarm Rate</var>`),i=this.unequal?Pt`
1887
1894
  <tr>
1888
1895
  <td rowspan="2">
1889
1896
  ${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="bracket tight">[</span>
@@ -1908,7 +1915,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1908
1915
  <td>
1909
1916
  <span><span>1</span><span class="plus">+</span>${r}</span>
1910
1917
  </td>
1911
- </tr>`:F`
1918
+ </tr>`:Pt`
1912
1919
  <tr>
1913
1920
  <td rowspan="2">
1914
1921
  ${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="minus tight">−</span>
@@ -1924,30 +1931,30 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1924
1931
  <td>
1925
1932
  <span>2</span>
1926
1933
  </td>
1927
- </tr>`,F`
1934
+ </tr>`,Pt`
1928
1935
  <div class="holder">
1929
1936
  <table class="equation">
1930
1937
  <tbody>
1931
1938
  ${i}
1932
1939
  </tbody>
1933
1940
  </table>
1934
- </div>`}}customElements.define("sdt-equation-dc2far",$o);class _o extends ko{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},hr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.d=0,this.c=0,this.s=1,this.alignState()}alignState(){this.hr=bo.dC2Hr(this.d,this.c,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-dc2hr-change",{detail:{d:this.d,c:this.c,s:this.s,hr:this.hr},bubbles:!0}))}dInput(t){this.d=parseFloat(t.target.value),this.alignState(),this.sendEvent()}cInput(t){this.c=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=F`
1941
+ </div>`}}customElements.define("sdt-equation-dc2far",rl);class nl extends el{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},d:{attribute:"d",type:Number,reflect:!0},c:{attribute:"c",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},hr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.d=0,this.c=0,this.s=1,this.alignState()}alignState(){this.hr=Yo.dC2Hr(this.d,this.c,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-dc2hr-change",{detail:{d:this.d,c:this.c,s:this.s,hr:this.hr},bubbles:!0}))}dInput(t){this.d=parseFloat(t.target.value),this.alignState(),this.sendEvent()}cInput(t){this.c=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
1935
1942
  <decidables-spinner class="d bottom" ?disabled=${!this.interactive} step=".001" .value="${this.d}" @input=${this.dInput.bind(this)}>
1936
1943
  <var class="math-var">d′</var>
1937
1944
  </decidables-spinner>
1938
- `,e=F`
1945
+ `,e=Pt`
1939
1946
  <decidables-spinner class="c bottom" ?disabled=${!this.interactive} step=".001" .value="${this.c}" @input=${this.cInput.bind(this)}>
1940
1947
  <var class="math-var">c</var>
1941
1948
  </decidables-spinner>
1942
- `,r=F`
1949
+ `,r=Pt`
1943
1950
  <decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
1944
1951
  <var class="math-var">σ</var>
1945
1952
  </decidables-spinner>
1946
- `,n=F`
1953
+ `,n=Pt`
1947
1954
  <decidables-spinner class="hr bottom" disabled min="0" max="1" step=".001" .value="${+this.hr.toFixed(3)}">
1948
1955
  <var>Hit Rate</var>
1949
1956
  </decidables-spinner>
1950
- `):(t=F`<var class="math-var d">d′</var>`,e=F`<var class="math-var c">c</var>`,r=F`<var class="math-var s">σ</var>`,n=F`<var class="hr">Hit Rate</var>`),i=this.unequal?F`
1957
+ `):(t=Pt`<var class="math-var d">d′</var>`,e=Pt`<var class="math-var c">c</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="hr">Hit Rate</var>`),i=this.unequal?Pt`
1951
1958
  <tr>
1952
1959
  <td rowspan="2">
1953
1960
  ${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span><span class="bracket tight">[</span>
@@ -1981,7 +1988,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1981
1988
  <td>
1982
1989
  ${r}
1983
1990
  </td>
1984
- </tr>`:F`
1991
+ </tr>`:Pt`
1985
1992
  <tr>
1986
1993
  <td rowspan="2">
1987
1994
  ${n}<span class="equals">=</span><var class="math-greek phi tight">Φ</var><span class="paren tight">(</span>
@@ -1997,26 +2004,26 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
1997
2004
  <td>
1998
2005
  <span>2</span>
1999
2006
  </td>
2000
- </tr>`,F`
2007
+ </tr>`,Pt`
2001
2008
  <div class="holder">
2002
2009
  <table class="equation">
2003
2010
  <tbody>
2004
2011
  ${i}
2005
2012
  </tbody>
2006
2013
  </table>
2007
- </div>`}}customElements.define("sdt-equation-dc2hr",_o);class So extends ko{static get properties(){return{fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.fa=0,this.cr=0,this.alignState()}alignState(){this.far=bo.faCr2Far(this.fa,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-facr2far-change",{detail:{fa:this.fa,cr:this.cr,far:this.far},bubbles:!0}))}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=F`
2014
+ </div>`}}customElements.define("sdt-equation-dc2hr",nl);class il extends el{static get properties(){return{fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},far:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.fa=0,this.cr=0,this.alignState()}alignState(){this.far=Yo.faCr2Far(this.fa,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-facr2far-change",{detail:{fa:this.fa,cr:this.cr,far:this.far},bubbles:!0}))}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
2008
2015
  <decidables-spinner class="fa" ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
2009
2016
  <var>False Alarms</var>
2010
2017
  </decidables-spinner>
2011
- `,e=F`
2018
+ `,e=Pt`
2012
2019
  <decidables-spinner class="cr" ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
2013
2020
  <var>Correct Rejections</var>
2014
2021
  </decidables-spinner>
2015
- `,r=F`
2022
+ `,r=Pt`
2016
2023
  <decidables-spinner class="far" disabled min="0" max="1" step=".001" .value="${+this.far.toFixed(3)}">
2017
2024
  <var>False Alarm Rate</var>
2018
2025
  </decidables-spinner>
2019
- `):(t=F`<var class="fa">False Alarms</var>`,e=F`<var class="cr">Correct Rejections</var>`,r=F`<var class="far">False Alarm Rate</var>`),F`
2026
+ `):(t=Pt`<var class="fa">False Alarms</var>`,e=Pt`<var class="cr">Correct Rejections</var>`,r=Pt`<var class="far">False Alarm Rate</var>`),Pt`
2020
2027
  <div class="holder">
2021
2028
  <table class="equation">
2022
2029
  <tbody>
@@ -2035,19 +2042,19 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2035
2042
  </tr>
2036
2043
  </tbody>
2037
2044
  </table>
2038
- </div>`}}customElements.define("sdt-equation-facr2far",So);class Eo extends ko{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},ppv:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.fa=0,this.alignState()}alignState(){this.ppv=bo.hFa2Ppv(this.h,this.fa)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hfa2ppv-change",{detail:{h:this.h,fa:this.fa,ppv:this.ppv},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=F`
2045
+ </div>`}}customElements.define("sdt-equation-facr2far",il);class sl extends el{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},ppv:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.fa=0,this.alignState()}alignState(){this.ppv=Yo.hFa2Ppv(this.h,this.fa)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hfa2ppv-change",{detail:{h:this.h,fa:this.fa,ppv:this.ppv},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
2039
2046
  <decidables-spinner class="h" ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
2040
2047
  <var>Hits</var>
2041
2048
  </decidables-spinner>
2042
- `,e=F`
2049
+ `,e=Pt`
2043
2050
  <decidables-spinner class="fa" ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
2044
2051
  <var>False Alarms</var>
2045
2052
  </decidables-spinner>
2046
- `,r=F`
2053
+ `,r=Pt`
2047
2054
  <decidables-spinner class="ppv" disabled min="0" max="1" step=".001" .value="${+this.ppv.toFixed(3)}">
2048
2055
  <var>Positive Predictive Value</var>
2049
2056
  </decidables-spinner>
2050
- `):(t=F`<var class="h">Hits</var>`,e=F`<var class="fa">False Alarms</var>`,r=F`<var class="ppv">Positive Predictive Value</var>`),F`
2057
+ `):(t=Pt`<var class="h">Hits</var>`,e=Pt`<var class="fa">False Alarms</var>`,r=Pt`<var class="ppv">Positive Predictive Value</var>`),Pt`
2051
2058
  <div class="holder">
2052
2059
  <table class="equation">
2053
2060
  <tbody>
@@ -2067,19 +2074,19 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2067
2074
  </tbody>
2068
2075
  </table>
2069
2076
  </div>
2070
- `}}customElements.define("sdt-equation-hfa2ppv",Eo);class Ao extends ko{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},hr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.m=0,this.alignState()}alignState(){this.hr=bo.hM2Hr(this.h,this.m)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hm2hr-change",{detail:{h:this.h,m:this.m,hr:this.hr},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=F`
2077
+ `}}customElements.define("sdt-equation-hfa2ppv",sl);class al extends el{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},hr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.m=0,this.alignState()}alignState(){this.hr=Yo.hM2Hr(this.h,this.m)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hm2hr-change",{detail:{h:this.h,m:this.m,hr:this.hr},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
2071
2078
  <decidables-spinner class="h" ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
2072
2079
  <var>Hits</var>
2073
2080
  </decidables-spinner>
2074
- `,e=F`
2081
+ `,e=Pt`
2075
2082
  <decidables-spinner class="m" ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
2076
2083
  <var>Misses</var>
2077
2084
  </decidables-spinner>
2078
- `,r=F`
2085
+ `,r=Pt`
2079
2086
  <decidables-spinner class="hr" disabled min="0" max="1" step=".001" .value="${+this.hr.toFixed(3)}">
2080
2087
  <var>Hit Rate</var>
2081
2088
  </decidables-spinner>
2082
- `):(t=F`<var class="h">Hits</var>`,e=F`<var class="m">Misses</var>`,r=F`<var class="hr">Hit Rate</var>`),F`
2089
+ `):(t=Pt`<var class="h">Hits</var>`,e=Pt`<var class="m">Misses</var>`,r=Pt`<var class="hr">Hit Rate</var>`),Pt`
2083
2090
  <div class="holder">
2084
2091
  <table class="equation">
2085
2092
  <tbody>
@@ -2099,27 +2106,27 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2099
2106
  </tbody>
2100
2107
  </table>
2101
2108
  </div>
2102
- `}}customElements.define("sdt-equation-hm2hr",Ao);class Mo extends ko{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},acc:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.alignState()}alignState(){this.acc=bo.hMFaCr2Acc(this.h,this.m,this.fa,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hmfacr2acc-change",{detail:{h:this.h,m:this.m,fa:this.fa,cr:this.cr,acc:this.acc},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=F`
2109
+ `}}customElements.define("sdt-equation-hm2hr",al);class ol extends el{static get properties(){return{h:{attribute:"hits",type:Number,reflect:!0},m:{attribute:"misses",type:Number,reflect:!0},fa:{attribute:"false-alarms",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},acc:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.h=0,this.m=0,this.fa=0,this.cr=0,this.alignState()}alignState(){this.acc=Yo.hMFaCr2Acc(this.h,this.m,this.fa,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hmfacr2acc-change",{detail:{h:this.h,m:this.m,fa:this.fa,cr:this.cr,acc:this.acc},bubbles:!0}))}hInput(t){this.h=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}faInput(t){this.fa=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
2103
2110
  <decidables-spinner class="h" ?disabled=${!this.interactive} min="0" .value="${this.h}" @input=${this.hInput.bind(this)}>
2104
2111
  <var>Hits</var>
2105
2112
  </decidables-spinner>
2106
- `,e=F`
2113
+ `,e=Pt`
2107
2114
  <decidables-spinner class="m" ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
2108
2115
  <var>Misses</var>
2109
2116
  </decidables-spinner>
2110
- `,r=F`
2117
+ `,r=Pt`
2111
2118
  <decidables-spinner class="fa" ?disabled=${!this.interactive} min="0" .value="${this.fa}" @input=${this.faInput.bind(this)}>
2112
2119
  <var>False Alarms</var>
2113
2120
  </decidables-spinner>
2114
- `,n=F`
2121
+ `,n=Pt`
2115
2122
  <decidables-spinner class="cr" ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
2116
2123
  <var>Correct Rejections</var>
2117
2124
  </decidables-spinner>
2118
- `,i=F`
2125
+ `,i=Pt`
2119
2126
  <decidables-spinner class="acc" disabled min="0" max="1" step=".001" .value="${+this.acc.toFixed(3)}">
2120
2127
  <var>Accuracy</var>
2121
2128
  </decidables-spinner>
2122
- `):(t=F`<var class="h">Hits</var>`,e=F`<var class="m">Misses</var>`,r=F`<var class="fa">False Alarms</var>`,n=F`<var class="cr">Correct Rejections</var>`,i=F`<var class="acc">Accuracy</var>`),F`
2129
+ `):(t=Pt`<var class="h">Hits</var>`,e=Pt`<var class="m">Misses</var>`,r=Pt`<var class="fa">False Alarms</var>`,n=Pt`<var class="cr">Correct Rejections</var>`,i=Pt`<var class="acc">Accuracy</var>`),Pt`
2123
2130
  <div class="holder">
2124
2131
  <table class="equation">
2125
2132
  <tbody>
@@ -2138,23 +2145,23 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2138
2145
  </tr>
2139
2146
  </tbody>
2140
2147
  </table>
2141
- </div>`}}customElements.define("sdt-equation-hmfacr2acc",Mo);class To extends ko{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},hr:{attribute:"hit-rate",type:Number,reflect:!0},far:{attribute:"false-alarm-rate",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},c:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.hr=0,this.far=0,this.s=1,this.alignState()}alignState(){this.c=bo.hrFar2C(this.hr,this.far,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hrfar2c-change",{detail:{hr:this.hr,far:this.far,s:this.s,c:this.c},bubbles:!0}))}hrInput(t){this.hr=parseFloat(t.target.value),this.alignState(),this.sendEvent()}farInput(t){this.far=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=F`
2148
+ </div>`}}customElements.define("sdt-equation-hmfacr2acc",ol);class ll extends el{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},hr:{attribute:"hit-rate",type:Number,reflect:!0},far:{attribute:"false-alarm-rate",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},c:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.hr=0,this.far=0,this.s=1,this.alignState()}alignState(){this.c=Yo.hrFar2C(this.hr,this.far,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hrfar2c-change",{detail:{hr:this.hr,far:this.far,s:this.s,c:this.c},bubbles:!0}))}hrInput(t){this.hr=parseFloat(t.target.value),this.alignState(),this.sendEvent()}farInput(t){this.far=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
2142
2149
  <decidables-spinner class="hr bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.hr}" @input=${this.hrInput.bind(this)}>
2143
2150
  <var>Hit Rate</var>
2144
2151
  </decidables-spinner>
2145
- `,e=F`
2152
+ `,e=Pt`
2146
2153
  <decidables-spinner class="far bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.far}" @input=${this.farInput.bind(this)}>
2147
2154
  <var>False Alarm Rate</var>
2148
2155
  </decidables-spinner>
2149
- `,r=F`
2156
+ `,r=Pt`
2150
2157
  <decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
2151
2158
  <var class="math-var">σ</var>
2152
2159
  </decidables-spinner>
2153
- `,n=F`
2160
+ `,n=Pt`
2154
2161
  <decidables-spinner class="c bottom" disabled step=".001" .value="${+this.c.toFixed(3)}">
2155
2162
  <var class="math-var">c</var>
2156
2163
  </decidables-spinner>
2157
- `):(t=F`<var class="hr">Hit Rate</var>`,e=F`<var class="far">False Alarm Rate</var>`,r=F`<var class="math-var s">σ</var>`,n=F`<var class="math-var c">c</var>`),i=this.unequal?F`
2164
+ `):(t=Pt`<var class="hr">Hit Rate</var>`,e=Pt`<var class="far">False Alarm Rate</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="math-var c">c</var>`),i=this.unequal?Pt`
2158
2165
  <tr>
2159
2166
  <td rowspan="2">
2160
2167
  ${n}<span class="equals">=</span><span class="bracket tight">(</span>
@@ -2179,7 +2186,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2179
2186
  <td>
2180
2187
  <span><span>1</span><span class="plus">+</span>${r}</span>
2181
2188
  </td>
2182
- </tr>`:F`
2189
+ </tr>`:Pt`
2183
2190
  <tr>
2184
2191
  <td rowspan="2">
2185
2192
  ${n}<span class="equals">=</span>
@@ -2192,30 +2199,30 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2192
2199
  <td>
2193
2200
  <span>2</span>
2194
2201
  </td>
2195
- </tr>`,F`
2202
+ </tr>`,Pt`
2196
2203
  <div class="holder">
2197
2204
  <table class="equation">
2198
2205
  <tbody>
2199
2206
  ${i}
2200
2207
  </tbody>
2201
2208
  </table>
2202
- </div>`}}customElements.define("sdt-equation-hrfar2c",To);class Co extends ko{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},hr:{attribute:"hit-rate",type:Number,reflect:!0},far:{attribute:"false-alarm-rate",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.hr=0,this.far=0,this.s=1,this.alignState()}alignState(){this.d=bo.hrFar2D(this.hr,this.far,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hrfar2d-change",{detail:{hr:this.hr,far:this.far,s:this.s,d:this.d},bubbles:!0}))}hrInput(t){this.hr=parseFloat(t.target.value),this.alignState(),this.sendEvent()}farInput(t){this.far=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=F`
2209
+ </div>`}}customElements.define("sdt-equation-hrfar2c",ll);class cl extends el{static get properties(){return{unequal:{attribute:"unequal",type:Boolean,reflect:!0},hr:{attribute:"hit-rate",type:Number,reflect:!0},far:{attribute:"false-alarm-rate",type:Number,reflect:!0},s:{attribute:"s",type:Number,reflect:!0},d:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.unequal=!1,this.hr=0,this.far=0,this.s=1,this.alignState()}alignState(){this.d=Yo.hrFar2D(this.hr,this.far,this.s)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-hrfar2d-change",{detail:{hr:this.hr,far:this.far,s:this.s,d:this.d},bubbles:!0}))}hrInput(t){this.hr=parseFloat(t.target.value),this.alignState(),this.sendEvent()}farInput(t){this.far=parseFloat(t.target.value),this.alignState(),this.sendEvent()}sInput(t){this.s=parseFloat(t.target.value),this.alignState(),this.sendEvent()}render(){let t,e,r,n,i;return this.alignState(),this.numeric?(t=Pt`
2203
2210
  <decidables-spinner class="hr bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.hr}" @input=${this.hrInput.bind(this)}>
2204
2211
  <var>Hit Rate</var>
2205
2212
  </decidables-spinner>
2206
- `,e=F`
2213
+ `,e=Pt`
2207
2214
  <decidables-spinner class="far bottom" ?disabled=${!this.interactive} min="0" max="1" step=".001" .value="${this.far}" @input=${this.farInput.bind(this)}>
2208
2215
  <var>False Alarm Rate</var>
2209
2216
  </decidables-spinner>
2210
- `,r=F`
2217
+ `,r=Pt`
2211
2218
  <decidables-spinner class="s bottom" ?disabled=${!this.interactive} min="0" step=".001" .value="${this.s}" @input=${this.sInput.bind(this)}>
2212
2219
  <var class="math-var">σ</var>
2213
2220
  </decidables-spinner>
2214
- `,n=F`
2221
+ `,n=Pt`
2215
2222
  <decidables-spinner class="d bottom" disabled step=".001" .value="${+this.d.toFixed(3)}">
2216
2223
  <var class="math-var">d′</var>
2217
2224
  </decidables-spinner>
2218
- `):(t=F`<var class="hr">Hit Rate</var>`,e=F`<var class="far">False Alarm Rate</var>`,r=F`<var class="math-var s">σ</var>`,n=F`<var class="math-var d">d′</var>`),i=this.unequal?F`
2225
+ `):(t=Pt`<var class="hr">Hit Rate</var>`,e=Pt`<var class="far">False Alarm Rate</var>`,r=Pt`<var class="math-var s">σ</var>`,n=Pt`<var class="math-var d">d′</var>`),i=this.unequal?Pt`
2219
2226
  <tr>
2220
2227
  <td rowspan="2">
2221
2228
  ${n}<span class="equals">=</span><span class="bracket tight">(</span>
@@ -2231,31 +2238,31 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2231
2238
  <td>
2232
2239
  <span>2</span>
2233
2240
  </td>
2234
- </tr>`:F`
2241
+ </tr>`:Pt`
2235
2242
  <tr>
2236
2243
  <td>
2237
2244
  ${n}<span class="equals">=</span><span class="tight"><var class="math-greek phi tight">Φ</var><sup class="exp">−1</sup></span><span class="paren tight">(</span>${t}<span class="paren tight">)</span><span class="minus">−</span><span class="tight"><var class="math-greek phi tight">Φ</var><sup class="exp">−1</sup></span><span class="paren tight">(</span>${e}<span class="paren tight">)</span>
2238
2245
  </td>
2239
- </tr>`,F`
2246
+ </tr>`,Pt`
2240
2247
  <div class="holder">
2241
2248
  <table class="equation">
2242
2249
  <tbody>
2243
2250
  ${i}
2244
2251
  </tbody>
2245
2252
  </table>
2246
- </div>`}}customElements.define("sdt-equation-hrfar2d",Co);class No extends ko{static get properties(){return{m:{attribute:"misses",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},fomr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.m=0,this.cr=0,this.alignState()}alignState(){this.fomr=bo.mCr2Fomr(this.m,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-mcr2fomr-change",{detail:{m:this.m,cr:this.cr,fomr:this.fomr},bubbles:!0}))}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=F`
2253
+ </div>`}}customElements.define("sdt-equation-hrfar2d",cl);class hl extends el{static get properties(){return{m:{attribute:"misses",type:Number,reflect:!0},cr:{attribute:"correct-rejections",type:Number,reflect:!0},fomr:{attribute:!1,type:Number,reflect:!1}}}constructor(){super(),this.m=0,this.cr=0,this.alignState()}alignState(){this.fomr=Yo.mCr2Fomr(this.m,this.cr)}sendEvent(){this.dispatchEvent(new CustomEvent("sdt-equation-mcr2fomr-change",{detail:{m:this.m,cr:this.cr,fomr:this.fomr},bubbles:!0}))}mInput(t){this.m=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}crInput(t){this.cr=parseInt(t.target.value,10),this.alignState(),this.sendEvent()}render(){let t,e,r;return this.alignState(),this.numeric?(t=Pt`
2247
2254
  <decidables-spinner class="m" ?disabled=${!this.interactive} min="0" .value="${this.m}" @input=${this.mInput.bind(this)}>
2248
2255
  <var>Misses</var>
2249
2256
  </decidables-spinner>
2250
- `,e=F`
2257
+ `,e=Pt`
2251
2258
  <decidables-spinner class="cr" ?disabled=${!this.interactive} min="0" .value="${this.cr}" @input=${this.crInput.bind(this)}>
2252
2259
  <var>Correct Rejections</var>
2253
2260
  </decidables-spinner>
2254
- `,r=F`
2261
+ `,r=Pt`
2255
2262
  <decidables-spinner class="fomr" disabled min="0" max="1" step=".001" .value="${+this.fomr.toFixed(3)}">
2256
2263
  <var>False Omission Rate</var>
2257
2264
  </decidables-spinner>
2258
- `):(t=F`<var class="m">Misses</var>`,e=F`<var class="cr">Correct Rejections</var>`,r=F`<var class="fomr">False Omission Rate</var>`),F`
2265
+ `):(t=Pt`<var class="m">Misses</var>`,e=Pt`<var class="cr">Correct Rejections</var>`,r=Pt`<var class="fomr">False Omission Rate</var>`),Pt`
2259
2266
  <div class="holder">
2260
2267
  <table class="equation">
2261
2268
  <tbody>
@@ -2275,7 +2282,7 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2275
2282
  </tbody>
2276
2283
  </table>
2277
2284
  </div>
2278
- `}}customElements.define("sdt-equation-mcr2fomr",No);class Ro extends ho{static get styles(){return[super.styles,it`
2285
+ `}}customElements.define("sdt-equation-mcr2fomr",hl);class ul extends Vo{static get styles(){return[super.styles,rt`
2279
2286
  :host {
2280
2287
  display: inline-block;
2281
2288
 
@@ -2319,10 +2326,10 @@ const oo=t=>null!=t?t:I;customElements.define("decidables-slider",class extends
2319
2326
  .body ::slotted(rdk-task) {
2320
2327
  margin-left: 0;
2321
2328
  }
2322
- `]}render(){return F`
2329
+ `]}render(){return Pt`
2323
2330
  <div class="holder">
2324
2331
  <div class="body">
2325
2332
  <slot>Empty!</slot>
2326
2333
  </div>
2327
- </div>`}}customElements.define("sdt-example",Ro);class Po extends Ro{firstUpdated(){this.one={},this.one.h=95,this.one.m=5,this.one.fa=35,this.one.cr=65,this.one.hr=bo.hM2Hr(this.one.h,this.one.m),this.one.far=bo.faCr2Far(this.one.fa,this.one.cr),this.one.d=bo.hrFar2D(this.one.hr,this.one.far),this.one.c=bo.hrFar2C(this.one.hr,this.one.far),this.two={},this.two.h=40,this.two.m=60,this.two.fa=20,this.two.cr=80,this.two.hr=bo.hM2Hr(this.two.h,this.two.m),this.two.far=bo.faCr2Far(this.two.fa,this.two.cr),this.two.d=bo.hrFar2D(this.two.hr,this.two.far),this.two.c=bo.hrFar2C(this.two.hr,this.two.far),this.detectableTableOne=this.querySelector("detectable-table:nth-of-type(1)"),this.detectableTableTwo=this.querySelector("detectable-table:nth-of-type(2)"),this.rocSpace=this.querySelector("roc-space"),this.sdtModelOne=this.querySelector("sdt-model:nth-of-type(1)"),this.sdtModelTwo=this.querySelector("sdt-model:nth-of-type(2)"),this.detectableTableOne&&(this.detectableTableOne.h=this.one.h,this.detectableTableOne.m=this.one.m,this.detectableTableOne.fa=this.one.fa,this.detectableTableOne.cr=this.one.cr,this.detectableTableOne.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"default","↑"),this.sdtModelOne&&(this.sdtModelOne.d=bo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelOne.c=bo.hrFar2C(t.detail.hr,t.detail.far))}))),this.detectableTableTwo&&(this.detectableTableTwo.h=this.two.h,this.detectableTableTwo.m=this.two.m,this.detectableTableTwo.fa=this.two.fa,this.detectableTableTwo.cr=this.two.cr,this.detectableTableTwo.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"two","↓"),this.sdtModelTwo&&(this.sdtModelTwo.d=bo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelTwo.c=bo.hrFar2C(t.detail.hr,t.detail.far))}))),this.rocSpace&&(this.rocSpace.set(this.one.hr,this.one.far,"default","↑"),this.rocSpace.set(this.two.hr,this.two.far,"two","↓"),this.rocSpace.addEventListener("roc-point-change",(t=>{if("default"===t.detail.name&&this.sdtModelOne?(this.sdtModelOne.d=t.detail.d,this.sdtModelOne.c=t.detail.c):"two"===t.detail.name&&this.sdtModelTwo&&(this.sdtModelTwo.d=t.detail.d,this.sdtModelTwo.c=t.detail.c),"default"===t.detail.name&&this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}else if("two"===t.detail.name&&this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}}))),this.sdtModelOne&&(this.sdtModelOne.d=this.one.d,this.sdtModelOne.c=this.one.c,this.sdtModelOne.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","↑"),this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}}))),this.sdtModelTwo&&(this.sdtModelTwo.d=this.two.d,this.sdtModelTwo.c=this.two.c,this.sdtModelTwo.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"two","↓"),this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}})))}}customElements.define("sdt-example-double-interactive",Po);class qo extends Ro{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(.5,.5,"default",this.count),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("payoff")&&this.detectableControl.addEventListener("detectable-control-payoff",(t=>{this.detectableResponse&&(this.detectableResponse.hPayoff=t.detail.payoff,this.detectableResponse.mPayoff=0-t.detail.payoff,this.detectableResponse.faPayoff=0-(100-t.detail.payoff),this.detectableResponse.crPayoff=100-t.detail.payoff),this.detectableTable&&(this.detectableTable.hPayoff=t.detail.payoff,this.detectableTable.mPayoff=0-t.detail.payoff,this.detectableTable.faPayoff=0-(100-t.detail.payoff),this.detectableTable.crPayoff=100-t.detail.payoff)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0)})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1)})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,this.count)):(this.rocSpace.hr=.5,this.rocSpace.far=.5)),this.sdtModel&&(this.sdtModel.d=0,this.sdtModel.c=0)})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.detectableResponse&&this.detectableResponse.addEventListener("detectable-response",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr);const e=bo.hM2Hr(t.detail.h+1,t.detail.m+1),r=bo.faCr2Far(t.detail.fa+1,t.detail.cr+1);this.rocSpace&&(this.rocSpace.hasAttribute("history")?this.rocSpace.set(e,r,1===this.count?"default":`point${this.count}`,this.count):(this.rocSpace.hr=e,this.rocSpace.far=r)),this.sdtModel&&(this.sdtModel.d=bo.hrFar2D(e,r),this.sdtModel.c=bo.hrFar2C(e,r))}))}}customElements.define("sdt-example-human",qo);class zo extends Ro{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpaces=this.querySelectorAll("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.zRoc=t.detail.zRoc}))})),this.detectableTable&&(this.rocSpace&&(this.rocSpace.hr=bo.hM2Hr(this.detectableTable.h,this.detectableTable.m),this.rocSpace.far=bo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr)),this.sdtModel&&(this.sdtModel.d=bo.hrFar2D(bo.hM2Hr(this.detectableTable.h,this.detectableTable.m),bo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s),this.sdtModel.c=bo.hrFar2C(bo.hM2Hr(this.detectableTable.h,this.detectableTable.m),bo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s)),this.detectableTable.addEventListener("detectable-table-change",(t=>{this.rocSpace&&(this.rocSpace.far=t.detail.far,this.rocSpace.hr=t.detail.hr),this.sdtModel&&(this.sdtModel.d=bo.hrFar2D(t.detail.hr,t.detail.far,this.sdtModel.s),this.sdtModel.c=bo.hrFar2C(t.detail.hr,t.detail.far,this.sdtModel.s))}))),this.rocSpace&&(this.sdtModel&&!this.detectableTable&&(this.sdtModel.d=bo.hrFar2D(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.c=bo.hrFar2C(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.s=this.rocSpace.s),this.rocSpace.addEventListener("roc-point-change",(t=>{if(this.sdtModel&&(this.sdtModel.d=t.detail.d,this.sdtModel.c=t.detail.c,this.sdtModel.s=t.detail.s),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{if(this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s)})),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))}}customElements.define("sdt-example-interactive",zo);class Fo extends Ro{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.sdtModel=this.querySelector("sdt-model"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0),this.sdtModel&&this.sdtModel.resumeTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1),this.sdtModel&&this.sdtModel.pauseTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.sdtModel&&this.sdtModel.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,"",1)):(this.rocSpace.hr=.5,this.rocSpace.far=.5))})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial),this.sdtModel&&this.sdtModel.trial(t.detail.trial,t.detail.signal,t.detail.duration,t.detail.wait,t.detail.iti)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-middle",(()=>{})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.sdtModel&&this.sdtModel.addEventListener("detectable-response",(t=>{this.detectableResponse&&this.detectableResponse.responded(t.detail.response),this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=bo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=bo.faCr2Far(t.detail.fa,t.detail.cr))})),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=bo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=bo.faCr2Far(t.detail.fa,t.detail.cr))}))}}customElements.define("sdt-example-model",Fo);class Oo extends Ro{static get properties(){return{variable:{attribute:"variable",type:String,reflect:!0},values:{attribute:"values",converter:lo,reflect:!0}}}constructor(){super(),this.variables=["d","c"],this.variable="d",this.values=[0,1]}firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),"d"===this.variable?this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(t,this.sdtModel.c,`point${e}`,e+1,this.sdtModel.s)})):"c"===this.variable&&this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,e+1,this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&(this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s),"d"===this.variable?this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(e,t.detail.c,`point${r}`,r+1,t.detail.s)})):"c"===this.variable&&this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,r+1,t.detail.s)})))}))}}customElements.define("sdt-example-multiple",Oo);class Uo extends Ro{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),zt(-1.5,1.6,.5).forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,"",this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&zt(-1.5,1.6,.5).forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,"",t.detail.s)}))}))}}customElements.define("sdt-example-unequal",Uo);export{go as DetectableControl,ho as DetectableElement,wo as DetectableResponse,xo as DetectableTable,uo as RDKTask,vo as ROCSpace,$o as SDTEquationDC2Far,_o as SDTEquationDC2Hr,So as SDTEquationFaCr2Far,Eo as SDTEquationHFa2Ppv,Ao as SDTEquationHM2Hr,Mo as SDTEquationHMFaCr2Acc,To as SDTEquationHrFar2C,Co as SDTEquationHrFar2D,No as SDTEquationMCr2Fomr,Po as SDTExampleDoubleInteractive,qo as SDTExampleHuman,zo as SDTExampleInteractive,Fo as SDTExampleModel,Oo as SDTExampleMultiple,Uo as SDTExampleUnequal,yo as SDTModel};
2334
+ </div>`}}customElements.define("sdt-example",ul);class dl extends ul{firstUpdated(){this.one={},this.one.h=95,this.one.m=5,this.one.fa=35,this.one.cr=65,this.one.hr=Yo.hM2Hr(this.one.h,this.one.m),this.one.far=Yo.faCr2Far(this.one.fa,this.one.cr),this.one.d=Yo.hrFar2D(this.one.hr,this.one.far),this.one.c=Yo.hrFar2C(this.one.hr,this.one.far),this.two={},this.two.h=40,this.two.m=60,this.two.fa=20,this.two.cr=80,this.two.hr=Yo.hM2Hr(this.two.h,this.two.m),this.two.far=Yo.faCr2Far(this.two.fa,this.two.cr),this.two.d=Yo.hrFar2D(this.two.hr,this.two.far),this.two.c=Yo.hrFar2C(this.two.hr,this.two.far),this.detectableTableOne=this.querySelector("detectable-table:nth-of-type(1)"),this.detectableTableTwo=this.querySelector("detectable-table:nth-of-type(2)"),this.rocSpace=this.querySelector("roc-space"),this.sdtModelOne=this.querySelector("sdt-model:nth-of-type(1)"),this.sdtModelTwo=this.querySelector("sdt-model:nth-of-type(2)"),this.detectableTableOne&&(this.detectableTableOne.h=this.one.h,this.detectableTableOne.m=this.one.m,this.detectableTableOne.fa=this.one.fa,this.detectableTableOne.cr=this.one.cr,this.detectableTableOne.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"default","↑"),this.sdtModelOne&&(this.sdtModelOne.d=Yo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelOne.c=Yo.hrFar2C(t.detail.hr,t.detail.far))}))),this.detectableTableTwo&&(this.detectableTableTwo.h=this.two.h,this.detectableTableTwo.m=this.two.m,this.detectableTableTwo.fa=this.two.fa,this.detectableTableTwo.cr=this.two.cr,this.detectableTableTwo.addEventListener("detectable-table-change",(t=>{this.rocSpace&&this.rocSpace.set(t.detail.hr,t.detail.far,"two","↓"),this.sdtModelTwo&&(this.sdtModelTwo.d=Yo.hrFar2D(t.detail.hr,t.detail.far),this.sdtModelTwo.c=Yo.hrFar2C(t.detail.hr,t.detail.far))}))),this.rocSpace&&(this.rocSpace.set(this.one.hr,this.one.far,"default","↑"),this.rocSpace.set(this.two.hr,this.two.far,"two","↓"),this.rocSpace.addEventListener("roc-point-change",(t=>{if("default"===t.detail.name&&this.sdtModelOne?(this.sdtModelOne.d=t.detail.d,this.sdtModelOne.c=t.detail.c):"two"===t.detail.name&&this.sdtModelTwo&&(this.sdtModelTwo.d=t.detail.d,this.sdtModelTwo.c=t.detail.c),"default"===t.detail.name&&this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}else if("two"===t.detail.name&&this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}}))),this.sdtModelOne&&(this.sdtModelOne.d=this.one.d,this.sdtModelOne.c=this.one.c,this.sdtModelOne.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","↑"),this.detectableTableOne){const e=Math.round((this.detectableTableOne.h+this.detectableTableOne.m)*t.detail.hr),r=this.detectableTableOne.h+this.detectableTableOne.m-e,n=Math.round((this.detectableTableOne.fa+this.detectableTableOne.cr)*t.detail.far),i=this.detectableTableOne.fa+this.detectableTableOne.cr-n;this.detectableTableOne.h=e,this.detectableTableOne.m=r,this.detectableTableOne.fa=n,this.detectableTableOne.cr=i}}))),this.sdtModelTwo&&(this.sdtModelTwo.d=this.two.d,this.sdtModelTwo.c=this.two.c,this.sdtModelTwo.addEventListener("sdt-model-change",(t=>{if(this.rocSpace&&this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"two","↓"),this.detectableTableTwo){const e=Math.round((this.detectableTableTwo.h+this.detectableTableTwo.m)*t.detail.hr),r=this.detectableTableTwo.h+this.detectableTableTwo.m-e,n=Math.round((this.detectableTableTwo.fa+this.detectableTableTwo.cr)*t.detail.far),i=this.detectableTableTwo.fa+this.detectableTableTwo.cr-n;this.detectableTableTwo.h=e,this.detectableTableTwo.m=r,this.detectableTableTwo.fa=n,this.detectableTableTwo.cr=i}})))}}customElements.define("sdt-example-double-interactive",dl);class pl extends ul{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpace&&this.rocSpace.hasAttribute("history")&&this.rocSpace.set(.5,.5,"default",this.count),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("payoff")&&this.detectableControl.addEventListener("detectable-control-payoff",(t=>{this.detectableResponse&&(this.detectableResponse.hPayoff=t.detail.payoff,this.detectableResponse.mPayoff=0-t.detail.payoff,this.detectableResponse.faPayoff=0-(100-t.detail.payoff),this.detectableResponse.crPayoff=100-t.detail.payoff),this.detectableTable&&(this.detectableTable.hPayoff=t.detail.payoff,this.detectableTable.mPayoff=0-t.detail.payoff,this.detectableTable.faPayoff=0-(100-t.detail.payoff),this.detectableTable.crPayoff=100-t.detail.payoff)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0)})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1)})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,this.count)):(this.rocSpace.hr=.5,this.rocSpace.far=.5)),this.sdtModel&&(this.sdtModel.d=0,this.sdtModel.c=0)})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.detectableResponse&&this.detectableResponse.addEventListener("detectable-response",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr);const e=Yo.hM2Hr(t.detail.h+1,t.detail.m+1),r=Yo.faCr2Far(t.detail.fa+1,t.detail.cr+1);this.rocSpace&&(this.rocSpace.hasAttribute("history")?this.rocSpace.set(e,r,1===this.count?"default":`point${this.count}`,this.count):(this.rocSpace.hr=e,this.rocSpace.far=r)),this.sdtModel&&(this.sdtModel.d=Yo.hrFar2D(e,r),this.sdtModel.c=Yo.hrFar2C(e,r))}))}}customElements.define("sdt-example-human",pl);class fl extends ul{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.rocSpaces=this.querySelectorAll("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.zRoc=t.detail.zRoc}))})),this.detectableTable&&(this.rocSpace&&(this.rocSpace.hr=Yo.hM2Hr(this.detectableTable.h,this.detectableTable.m),this.rocSpace.far=Yo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr)),this.sdtModel&&(this.sdtModel.d=Yo.hrFar2D(Yo.hM2Hr(this.detectableTable.h,this.detectableTable.m),Yo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s),this.sdtModel.c=Yo.hrFar2C(Yo.hM2Hr(this.detectableTable.h,this.detectableTable.m),Yo.faCr2Far(this.detectableTable.fa,this.detectableTable.cr),this.sdtModel.s)),this.detectableTable.addEventListener("detectable-table-change",(t=>{this.rocSpace&&(this.rocSpace.far=t.detail.far,this.rocSpace.hr=t.detail.hr),this.sdtModel&&(this.sdtModel.d=Yo.hrFar2D(t.detail.hr,t.detail.far,this.sdtModel.s),this.sdtModel.c=Yo.hrFar2C(t.detail.hr,t.detail.far,this.sdtModel.s))}))),this.rocSpace&&(this.sdtModel&&!this.detectableTable&&(this.sdtModel.d=Yo.hrFar2D(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.c=Yo.hrFar2C(this.rocSpace.hr,this.rocSpace.far,this.rocSpace.s),this.sdtModel.s=this.rocSpace.s),this.rocSpace.addEventListener("roc-point-change",(t=>{if(this.sdtModel&&(this.sdtModel.d=t.detail.d,this.sdtModel.c=t.detail.c,this.sdtModel.s=t.detail.s),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{if(this.rocSpaces.length>0&&this.rocSpaces.forEach((e=>{e.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s)})),this.detectableTable){const e=Math.round((this.detectableTable.h+this.detectableTable.m)*t.detail.hr),r=this.detectableTable.h+this.detectableTable.m-e,n=Math.round((this.detectableTable.fa+this.detectableTable.cr)*t.detail.far),i=this.detectableTable.fa+this.detectableTable.cr-n;this.detectableTable.h=e,this.detectableTable.m=r,this.detectableTable.fa=n,this.detectableTable.cr=i}}))}}customElements.define("sdt-example-interactive",fl);class ml extends ul{firstUpdated(){this.count=1,this.detectableControl=this.querySelector("detectable-control"),this.rdkTask=this.querySelector("rdk-task"),this.sdtModel=this.querySelector("sdt-model"),this.detectableResponse=this.querySelector("detectable-response"),this.detectableTable=this.querySelector("detectable-table"),this.rocSpace=this.querySelector("roc-space"),this.detectableControl&&this.detectableControl.hasAttribute("color")&&this.detectableControl.addEventListener("detectable-control-color",(t=>{this.sdtModel&&(this.sdtModel.color=t.detail.color),this.detectableTable&&(this.detectableTable.color=t.detail.color)})),this.detectableControl&&this.detectableControl.hasAttribute("duration")&&this.detectableControl.addEventListener("detectable-control-duration",(t=>{this.rdkTask&&(this.rdkTask.duration=t.detail.duration,this.rdkTask.wait=t.detail.duration,this.rdkTask.iti=t.detail.duration)})),this.detectableControl&&this.detectableControl.hasAttribute("trials")&&this.detectableControl.addEventListener("detectable-control-trials",(t=>{this.rdkTask&&(this.rdkTask.trials=t.detail.trials),this.detectableResponse&&(this.detectableResponse.trialTotal=t.detail.trials)})),this.detectableControl&&this.detectableControl.hasAttribute("coherence")&&this.detectableControl.addEventListener("detectable-control-coherence",(t=>{this.rdkTask&&(this.rdkTask.coherence=t.detail.coherence)})),this.detectableControl&&this.detectableControl.hasAttribute("run")&&this.detectableControl.addEventListener("detectable-control-run",(()=>{this.rdkTask&&(this.rdkTask.running=!0),this.sdtModel&&this.sdtModel.resumeTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("pause")&&this.detectableControl.addEventListener("detectable-control-pause",(()=>{this.rdkTask&&(this.rdkTask.running=!1),this.sdtModel&&this.sdtModel.pauseTrial()})),this.detectableControl&&this.detectableControl.hasAttribute("reset")&&this.detectableControl.addEventListener("detectable-control-reset",(()=>{this.rdkTask&&this.rdkTask.reset(),this.detectableResponse&&this.detectableResponse.reset(),this.sdtModel&&this.sdtModel.reset(),this.detectableTable&&(this.detectableTable.h=0,this.detectableTable.m=0,this.detectableTable.fa=0,this.detectableTable.cr=0),this.rocSpace&&(this.rocSpace.hasAttribute("history")?(this.count+=1,this.rocSpace.set(.5,.5,`point${this.count}`,"",1)):(this.rocSpace.hr=.5,this.rocSpace.far=.5))})),this.rdkTask&&this.detectableResponse&&(this.detectableResponse.trialTotal=this.rdkTask.trials),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-start",(t=>{this.detectableResponse&&this.detectableResponse.start(t.detail.signal,t.detail.trial),this.sdtModel&&this.sdtModel.trial(t.detail.trial,t.detail.signal,t.detail.duration,t.detail.wait,t.detail.iti)})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-middle",(()=>{})),this.rdkTask&&this.rdkTask.addEventListener("rdk-trial-end",(()=>{this.detectableResponse&&this.detectableResponse.stop()})),this.rdkTask&&this.rdkTask.addEventListener("rdk-block-end",(()=>{this.detectableControl&&this.detectableControl.complete()})),this.sdtModel&&this.sdtModel.addEventListener("detectable-response",(t=>{this.detectableResponse&&this.detectableResponse.responded(t.detail.response),this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=Yo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=Yo.faCr2Far(t.detail.fa,t.detail.cr))})),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.detectableTable&&(this.detectableTable.h=t.detail.h,this.detectableTable.m=t.detail.m,this.detectableTable.fa=t.detail.fa,this.detectableTable.cr=t.detail.cr),this.rocSpace&&(this.rocSpace.hr=Yo.hM2Hr(t.detail.h,t.detail.m),this.rocSpace.far=Yo.faCr2Far(t.detail.fa,t.detail.cr))}))}}customElements.define("sdt-example-model",ml);class bl extends ul{static get properties(){return{variable:{attribute:"variable",type:String,reflect:!0},values:{attribute:"values",converter:Lo,reflect:!0}}}constructor(){super(),this.variables=["d","c"],this.variable="d",this.values=[0,1]}firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),"d"===this.variable?this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(t,this.sdtModel.c,`point${e}`,e+1,this.sdtModel.s)})):"c"===this.variable&&this.values.forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,e+1,this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&(this.rocSpace.setWithSDT(t.detail.d,t.detail.c,"default","",t.detail.s),"d"===this.variable?this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(e,t.detail.c,`point${r}`,r+1,t.detail.s)})):"c"===this.variable&&this.values.forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,r+1,t.detail.s)})))}))}}customElements.define("sdt-example-multiple",bl);class vl extends ul{firstUpdated(){this.detectableControl=this.querySelector("detectable-control"),this.rocSpace=this.querySelector("roc-space"),this.sdtModel=this.querySelector("sdt-model"),this.detectableControl&&this.detectableControl.addEventListener("detectable-control-z-roc",(t=>{this.rocSpace.zRoc=t.detail.zRoc})),this.rocSpace&&(this.rocSpace.setWithSDT(1,0,"default","",1),ve(-1.5,1.6,.5).forEach(((t,e)=>{this.rocSpace.setWithSDT(this.sdtModel.d,t,`point${e}`,"",this.sdtModel.s)}))),this.sdtModel&&this.sdtModel.addEventListener("sdt-model-change",(t=>{this.rocSpace&&ve(-1.5,1.6,.5).forEach(((e,r)=>{this.rocSpace.setWithSDT(t.detail.d,e,`point${r}`,"",t.detail.s)}))}))}}customElements.define("sdt-example-unequal",vl);export{Go as DetectableControl,Vo as DetectableElement,Qo as DetectableResponse,tl as DetectableTable,Bo as RDKTask,Zo as ROCSpace,rl as SDTEquationDC2Far,nl as SDTEquationDC2Hr,il as SDTEquationFaCr2Far,sl as SDTEquationHFa2Ppv,al as SDTEquationHM2Hr,ol as SDTEquationHMFaCr2Acc,ll as SDTEquationHrFar2C,cl as SDTEquationHrFar2D,hl as SDTEquationMCr2Fomr,dl as SDTExampleDoubleInteractive,pl as SDTExampleHuman,fl as SDTExampleInteractive,ml as SDTExampleModel,bl as SDTExampleMultiple,vl as SDTExampleUnequal,Jo as SDTModel};
2328
2335
  //# sourceMappingURL=detectableElements.esm.min.js.map