diff --git a/dist/js/ideogram.min.js b/dist/js/ideogram.min.js index 8e393536..04502a6f 100644 --- a/dist/js/ideogram.min.js +++ b/dist/js/ideogram.min.js @@ -1,3 +1,3 @@ /*! For license information please see ideogram.min.js.LICENSE.txt */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(self,(()=>(()=>{"use strict";var t={913:()=>{try{self["workbox:core:7.0.0"]&&_()}catch(t){}},762:()=>{try{self["workbox:range-requests:7.0.0"]&&_()}catch(t){}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{default:()=>qm});var t={};n.r(t),n.d(t,{blob:()=>xt,buffer:()=>At,csv:()=>Gt,dsv:()=>Ht,html:()=>Yt,image:()=>jt,json:()=>zt,svg:()=>Xt,text:()=>Ot,tsv:()=>Wt,xml:()=>Vt});var e={};n.r(e),n.d(e,{brush:()=>qr,brushSelection:()=>Gr,brushX:()=>Wr,brushY:()=>jr});var r={};n.r(r),n.d(r,{dispatch:()=>ee});var i={};n.r(i),n.d(i,{FormatSpecifier:()=>Qr,format:()=>ni,formatDefaultLocale:()=>si,formatLocale:()=>ai,formatPrefix:()=>oi,formatSpecifier:()=>Kr,precisionFixed:()=>ci,precisionPrefix:()=>li,precisionRound:()=>ui});const a="1.45.1-beta";function s(){}function c(t){return null==t?s:function(){return this.querySelector(t)}}function l(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function u(){return[]}function d(t){return null==t?u:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function h(t){return function(e){return e.matches(t)}}var p=Array.prototype.find;function m(){return this.firstElementChild}var g=Array.prototype.filter;function y(){return this.children}function v(t){return new Array(t.length)}function b(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function w(t,e,n,o,r,i){for(var a,s=0,c=e.length,l=i.length;se?1:t>=e?0:NaN}b.prototype={constructor:b,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)}};var C="http://www.w3.org/1999/xhtml";const S={svg:"http://www.w3.org/2000/svg",xhtml:C,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function L(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),S.hasOwnProperty(e)?{space:S[e],local:t}:t}function T(t){return function(){this.removeAttribute(t)}}function k(t){return function(){this.removeAttributeNS(t.space,t.local)}}function M(t,e){return function(){this.setAttribute(t,e)}}function E(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function D(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function N(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function F(t){return function(){this.style.removeProperty(t)}}function B(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var o=e.apply(this,arguments);null==o?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function $(t,e){return t.style.getPropertyValue(e)||N(t).getComputedStyle(t,null).getPropertyValue(e)}function O(t){return function(){delete this[t]}}function R(t,e){return function(){this[t]=e}}function H(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function G(t){return t.trim().split(/^|\s+/)}function W(t){return t.classList||new j(t)}function j(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function q(t,e){for(var n=W(t),o=-1,r=e.length;++o=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var mt=[null];function gt(t,e){this._groups=t,this._parents=e}function yt(){return new gt([[document.documentElement]],mt)}gt.prototype=yt.prototype={constructor:gt,select:function(t){"function"!=typeof t&&(t=c(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r=C&&(C=A+1);!(b=y[C])&&++C=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=A);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i1?this.each((null==e?F:"function"==typeof e?I:B)(t,e,null==n?"":n)):$(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?O:"function"==typeof e?H:R)(t,e)):this.node()[t]},classed:function(t,e){var n=G(t+"");if(arguments.length<2){for(var o=W(this.node()),r=-1,i=n.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=e?dt:ut,o=0;o=i?c=!0:(o=t.charCodeAt(a++))===Tt?l=!0:o===kt&&(l=!0,t.charCodeAt(a)===Tt&&++a),t.slice(r+1,e-1).replace(/""/g,'"')}for(;a9999?"+"+Pt(e,6):Pt(e,4))+"-"+Pt(t.getUTCMonth()+1,2)+"-"+Pt(t.getUTCDate(),2)+(i?"T"+Pt(n,2)+":"+Pt(o,2)+":"+Pt(r,2)+"."+Pt(i,3)+"Z":r?"T"+Pt(n,2)+":"+Pt(o,2)+":"+Pt(r,2)+"Z":o||n?"T"+Pt(n,2)+":"+Pt(o,2)+"Z":"")}(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,r,i=o(t,(function(t,o){if(n)return n(t,o-1);r=t,n=e?function(t,e){var n=Mt(t);return function(o,r){return e(n(o),r,t)}}(t,e):Mt(t)}));return i.columns=r||[],i},parseRows:o,format:function(e,n){return null==n&&(n=Et(e)),[n.map(a).join(t)].concat(r(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Et(t)),r(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var Nt=Dt(","),Ft=Nt.parse,Bt=(Nt.parseRows,Nt.format,Nt.formatBody,Nt.formatRows,Nt.formatRow,Nt.formatValue,Dt("\t")),It=Bt.parse;function $t(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Ot(t,e){return fetch(t,e).then($t)}function Rt(t){return function(e,n,o){return 2===arguments.length&&"function"==typeof n&&(o=n,n=void 0),Ot(e,n).then((function(e){return t(e,o)}))}}function Ht(t,e,n,o){3===arguments.length&&"function"==typeof n&&(o=n,n=void 0);var r=Dt(t);return Ot(e,n).then((function(t){return r.parse(t,o)}))}Bt.parseRows,Bt.format,Bt.formatBody,Bt.formatRows,Bt.formatRow,Bt.formatValue;var Gt=Rt(Ft),Wt=Rt(It);function jt(t,e){return new Promise((function(n,o){var r=new Image;for(var i in e)r[i]=e[i];r.onerror=o,r.onload=function(){n(r)},r.src=t}))}function qt(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function zt(t,e){return fetch(t,e).then(qt)}function Ut(t){return(e,n)=>Ot(e,n).then((e=>(new DOMParser).parseFromString(e,t)))}const Vt=Ut("application/xml");var Yt=Ut("text/html"),Xt=Ut("image/svg+xml"),Kt={value:()=>{}};function Qt(){for(var t,e=0,n=arguments.length,o={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!o.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,o,r=new Array(n),i=0;i>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ae(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ae(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=fe.exec(t))?new Se(e[1],e[2],e[3],1):(e=he.exec(t))?new Se(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=pe.exec(t))?Ae(e[1],e[2],e[3],e[4]):(e=me.exec(t))?Ae(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ge.exec(t))?Pe(e[1],e[2]/100,e[3]/100,1):(e=ye.exec(t))?Pe(e[1],e[2]/100,e[3]/100,e[4]):ve.hasOwnProperty(t)?_e(ve[t]):"transparent"===t?new Se(NaN,NaN,NaN,0):null}function _e(t){return new Se(t>>16&255,t>>8&255,255&t,1)}function Ae(t,e,n,o){return o<=0&&(t=e=n=NaN),new Se(t,e,n,o)}function Ce(t,e,n,o){return 1===arguments.length?((r=t)instanceof ie||(r=xe(r)),r?new Se((r=r.rgb()).r,r.g,r.b,r.opacity):new Se):new Se(t,e,n,null==o?1:o);var r}function Se(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}function Le(){return`#${Ee(this.r)}${Ee(this.g)}${Ee(this.b)}`}function Te(){const t=ke(this.opacity);return`${1===t?"rgb(":"rgba("}${Me(this.r)}, ${Me(this.g)}, ${Me(this.b)}${1===t?")":`, ${t})`}`}function ke(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Me(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ee(t){return((t=Me(t))<16?"0":"")+t.toString(16)}function Pe(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ne(t,e,n,o)}function De(t){if(t instanceof Ne)return new Ne(t.h,t.s,t.l,t.opacity);if(t instanceof ie||(t=xe(t)),!t)return new Ne;if(t instanceof Ne)return t;var e=(t=t.rgb()).r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,s=i-r,c=(i+r)/2;return s?(a=e===i?(n-o)/s+6*(n0&&c<1?0:a,new Ne(a,s,c,t.opacity)}function Ne(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}function Fe(t){return(t=(t||0)%360)<0?t+360:t}function Be(t){return Math.max(0,Math.min(1,t||0))}function Ie(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function $e(t,e,n,o,r){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*n+(1+3*t+3*i-3*a)*o+a*r)/6}oe(ie,xe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:be,formatHex:be,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return De(this).formatHsl()},formatRgb:we,toString:we}),oe(Se,Ce,re(ie,{brighter(t){return t=null==t?se:Math.pow(se,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ae:Math.pow(ae,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Se(Me(this.r),Me(this.g),Me(this.b),ke(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Le,formatHex:Le,formatHex8:function(){return`#${Ee(this.r)}${Ee(this.g)}${Ee(this.b)}${Ee(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Te,toString:Te})),oe(Ne,(function(t,e,n,o){return 1===arguments.length?De(t):new Ne(t,e,n,null==o?1:o)}),re(ie,{brighter(t){return t=null==t?se:Math.pow(se,t),new Ne(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ae:Math.pow(ae,t),new Ne(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new Se(Ie(t>=240?t-240:t+120,r,o),Ie(t,r,o),Ie(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new Ne(Fe(this.h),Be(this.s),Be(this.l),ke(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ke(this.opacity);return`${1===t?"hsl(":"hsla("}${Fe(this.h)}, ${100*Be(this.s)}%, ${100*Be(this.l)}%${1===t?")":`, ${t})`}`}}));const Oe=t=>()=>t;function Re(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Oe(isNaN(t)?e:t)}const He=function t(e){var n=function(t){return 1==(t=+t)?Re:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}(e,n,t):Oe(isNaN(e)?n:e)}}(e);function o(t,e){var o=n((t=Ce(t)).r,(e=Ce(e)).r),r=n(t.g,e.g),i=n(t.b,e.b),a=Re(t.opacity,e.opacity);return function(e){return t.r=o(e),t.g=r(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function Ge(t){return function(e){var n,o,r=e.length,i=new Array(r),a=new Array(r),s=new Array(r);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),r=t[o],i=t[o+1],a=o>0?t[o-1]:2*r-i,s=oi&&(r=e.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,c.push({i:a,x:qe(n,o)})),i=Ve.lastIndex;return ie?1:t>=e?0:NaN}sn.prototype={constructor:sn,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)}};var hn="http://www.w3.org/1999/xhtml";const pn={svg:"http://www.w3.org/2000/svg",xhtml:hn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function mn(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),pn.hasOwnProperty(e)?{space:pn[e],local:t}:t}function gn(t){return function(){this.removeAttribute(t)}}function yn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vn(t,e){return function(){this.setAttribute(t,e)}}function bn(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function wn(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function xn(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function _n(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function An(t){return function(){this.style.removeProperty(t)}}function Cn(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Sn(t,e,n){return function(){var o=e.apply(this,arguments);null==o?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ln(t){return function(){delete this[t]}}function Tn(t,e){return function(){this[t]=e}}function kn(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Mn(t){return t.trim().split(/^|\s+/)}function En(t){return t.classList||new Pn(t)}function Pn(t){this._node=t,this._names=Mn(t.getAttribute("class")||"")}function Dn(t,e){for(var n=En(t),o=-1,r=e.length;++o=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var oo=[null];function ro(t,e){this._groups=t,this._parents=e}function io(t){return"string"==typeof t?new ro([[document.querySelector(t)]],[document.documentElement]):new ro([[t]],oo)}function ao(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 n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}ro.prototype=function(){return new ro([[document.documentElement]],oo)}.prototype={constructor:ro,select:function(t){"function"!=typeof t&&(t=Je(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r=w&&(w=b+1);!(v=g[w])&&++w=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=fn);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i1?this.each((null==e?An:"function"==typeof e?Sn:Cn)(t,e,null==n?"":n)):function(t,e){return t.style.getPropertyValue(e)||_n(t).getComputedStyle(t,null).getPropertyValue(e)}(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ln:"function"==typeof e?kn:Tn)(t,e)):this.node()[t]},classed:function(t,e){var n=Mn(t+"");if(arguments.length<2){for(var o=En(this.node()),r=-1,i=n.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=e?Zn:Jn,o=0;o=0&&e._call.call(void 0,t),e=e._next;--lo}()}finally{lo=0,function(){for(var t,e,n=so,o=1/0;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:so=e);co=t,So(o)}(),mo=0}}function Co(){var t=yo.now(),e=t-po;e>ho&&(go-=e,po=t)}function So(t){lo||(uo&&(uo=clearTimeout(uo)),t-mo>24?(t<1/0&&(uo=setTimeout(Ao,t-yo.now()-go)),fo&&(fo=clearInterval(fo))):(fo||(po=yo.now(),fo=setInterval(Co,ho)),lo=1,vo(Ao)))}function Lo(t,e,n){var o=new xo;return e=null==e?0:+e,o.restart((n=>{o.stop(),t(n+e)}),e,n),o}xo.prototype=_o.prototype={constructor:xo,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?bo():+n)+(null==e?0:+e),this._next||co===this||(co?co._next=this:so=this,co=this),this._call=t,this._time=n,So()},stop:function(){this._call&&(this._call=null,this._time=1/0,So())}};var To=ee("start","end","cancel","interrupt"),ko=[],Mo=0,Eo=2,Po=3,Do=5,No=6;function Fo(t,e,n,o,r,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var o,r=t.__transition;function i(c){var l,u,d,f;if(1!==n.state)return s();for(l in r)if((f=r[l]).name===n.name){if(f.state===Po)return Lo(i);4===f.state?(f.state=No,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[l]):+lMo)throw new Error("too late; already scheduled");return n}function Io(t,e){var n=$o(t,e);if(n.state>Po)throw new Error("too late; already running");return n}function $o(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Oo(t,e){var n,o,r,i=t.__transition,a=!0;if(i){for(r in e=null==e?null:e+"",i)(n=i[r]).name===e?(o=n.state>Eo&&n.state180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:qe(t,e)})):e&&n.push(r(n)+"rotate("+e+o)}(i.rotate,a.rotate,s,c),function(t,e,n,i){t!==e?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:qe(t,e)}):e&&n.push(r(n)+"skewX("+e+o)}(i.skewX,a.skewX,s,c),function(t,e,n,o,i,a){if(t!==n||e!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:qe(t,n)},{i:s-2,x:qe(e,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,c),i=a=null,function(t){for(var e,n=-1,o=c.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Bo:Io;return function(){var a=i(this,t),s=a.on;s!==o&&(r=(o=s).copy()).on(e,n),a.on=r}}(n,t,e))},attr:function(t,e){var n=L(t),o="transform"===n?zo:Xo;return this.attrTween(t,"function"==typeof e?(n.local?er:tr)(n,o,Yo(this,"attr."+t,e)):null==e?(n.local?Qo:Ko)(n):(n.local?Zo:Jo)(n,o,e))},attrTween:function(t,e){var n="attr."+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;var o=L(t);return this.tween(n,(o.local?nr:or)(o,e))},style:function(t,e,n){var o="transform"==(t+="")?qo:Xo;return null==e?this.styleTween(t,function(t,e){var n,o,r;return function(){var i=$(this,t),a=(this.style.removeProperty(t),$(this,t));return i===a?null:i===n&&a===o?r:r=e(n=i,o=a)}}(t,o)).on("end.style."+t,lr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var o,r,i;return function(){var a=$(this,t),s=n(this),c=s+"";return null==s&&(this.style.removeProperty(t),c=s=$(this,t)),a===c?null:a===o&&c===r?i:(r=c,i=e(o=a,s))}}(t,o,Yo(this,"style."+t,e))).each(function(t,e){var n,o,r,i,a="style."+e,s="end."+a;return function(){var c=Io(this,t),l=c.on,u=null==c.value[a]?i||(i=lr(e)):void 0;l===n&&r===u||(o=(n=l).copy()).on(s,r=u),c.on=o}}(this._id,t)):this.styleTween(t,function(t,e,n){var o,r,i=n+"";return function(){var a=$(this,t);return a===i?null:a===o?r:r=e(o=a,n)}}(t,o,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==e)return this.tween(o,null);if("function"!=typeof e)throw new Error;return this.tween(o,function(t,e,n){var o,r;function i(){var i=e.apply(this,arguments);return i!==r&&(o=(r=i)&&function(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}(t,i,n)),o}return i._value=e,i}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Yo(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,n;function o(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&function(t){return function(e){this.textContent=t.call(this,e)}}(o)),e}return o._value=t,o}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o,r=$o(this.node(),n).tween,i=0,a=r.length;i()=>t;function yr(t,{sourceEvent:e,target:n,selection:o,mode:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:o,enumerable:!0,configurable:!0},mode:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function vr(t){t.preventDefault(),t.stopImmediatePropagation()}var br={name:"drag"},wr={name:"space"},xr={name:"handle"},_r={name:"center"};const{abs:Ar,max:Cr,min:Sr}=Math;function Lr(t){return[+t[0],+t[1]]}function Tr(t){return[Lr(t[0]),Lr(t[1])]}var kr={name:"x",handles:["w","e"].map(Ir),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Mr={name:"y",handles:["n","s"].map(Ir),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Er={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Ir),input:function(t){return null==t?null:Tr(t)},output:function(t){return t}},Pr={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Dr={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Nr={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Fr={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Br={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ir(t){return{type:t}}function $r(t){return!t.ctrlKey&&!t.button}function Or(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Rr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Hr(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Gr(t){var e=t.__brush;return e?e.dim.output(e.selection):null}function Wr(){return zr(kr)}function jr(){return zr(Mr)}function qr(){return zr(Er)}function zr(t){var e,n=Or,o=$r,r=Rr,i=!0,a=ee("start","brush","end"),s=6;function c(e){var n=e.property("__brush",m).selectAll(".overlay").data([Ir("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Pr.overlay).merge(n).each((function(){var t=Hr(this).extent;io(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),e.selectAll(".selection").data([Ir("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Pr.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var o=e.selectAll(".handle").data(t.handles,(function(t){return t.type}));o.exit().remove(),o.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return Pr[t.type]})),e.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(r).on("touchstart.brush",f).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function l(){var t=io(this),e=Hr(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2})).attr("y",(function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s})).attr("height",(function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var o=t.__brush.emitter;return!o||n&&o.clean?new d(t,e,n):o}function d(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&o.apply(this,arguments)){var r,a,s,c,d,f,h,p,m,g,y,v=this,b=n.target.__data__.type,w="selection"===(i&&n.metaKey?b="overlay":b)?br:i&&n.altKey?_r:xr,x=t===Mr?null:Fr[b],_=t===kr?null:Br[b],A=Hr(v),C=A.extent,S=A.selection,L=C[0][0],T=C[0][1],k=C[1][0],M=C[1][1],E=0,P=0,D=x&&_&&i&&n.shiftKey,N=Array.from(n.touches||[n],(t=>{const e=t.identifier;return(t=ao(t,v)).point0=t.slice(),t.identifier=e,t}));Oo(v);var F=u(v,arguments,!0).beforestart();if("overlay"===b){S&&(m=!0);const e=[N[0],N[1]||N[0]];A.selection=S=[[r=t===Mr?L:Sr(e[0][0],e[1][0]),s=t===kr?T:Sr(e[0][1],e[1][1])],[d=t===Mr?k:Cr(e[0][0],e[1][0]),h=t===kr?M:Cr(e[0][1],e[1][1])]],N.length>1&&R(n)}else r=S[0][0],s=S[0][1],d=S[1][0],h=S[1][1];a=r,c=s,f=d,p=h;var B=io(v).attr("pointer-events","none"),I=B.selectAll(".overlay").attr("cursor",Pr[b]);if(n.touches)F.moved=O,F.ended=H;else{var $=io(n.view).on("mousemove.brush",O,!0).on("mouseup.brush",H,!0);i&&$.on("keydown.brush",(function(t){switch(t.keyCode){case 16:D=x&&_;break;case 18:w===xr&&(x&&(d=f-E*x,r=a+E*x),_&&(h=p-P*_,s=c+P*_),w=_r,R(t));break;case 32:w!==xr&&w!==_r||(x<0?d=f-E:x>0&&(r=a-E),_<0?h=p-P:_>0&&(s=c-P),w=wr,I.attr("cursor",Pr.selection),R(t));break;default:return}vr(t)}),!0).on("keyup.brush",(function(t){switch(t.keyCode){case 16:D&&(g=y=D=!1,R(t));break;case 18:w===_r&&(x<0?d=f:x>0&&(r=a),_<0?h=p:_>0&&(s=c),w=xr,R(t));break;case 32:w===wr&&(t.altKey?(x&&(d=f-E*x,r=a+E*x),_&&(h=p-P*_,s=c+P*_),w=_r):(x<0?d=f:x>0&&(r=a),_<0?h=p:_>0&&(s=c),w=xr),I.attr("cursor",Pr[b]),R(t));break;default:return}vr(t)}),!0),function(t){var e=t.document.documentElement,n=bt(t).on("dragstart.drag",ne,!0);"onselectstart"in e?n.on("selectstart.drag",ne,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(n.view)}l.call(v),F.start(n,w.name)}function O(t){for(const e of t.changedTouches||[t])for(const t of N)t.identifier===e.identifier&&(t.cur=ao(e,v));if(D&&!g&&!y&&1===N.length){const t=N[0];Ar(t.cur[0]-t[0])>Ar(t.cur[1]-t[1])?y=!0:g=!0}for(const t of N)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);m=!0,vr(t),R(t)}function R(t){const e=N[0],n=e.point0;var o;switch(E=e[0]-n[0],P=e[1]-n[1],w){case wr:case br:x&&(E=Cr(L-r,Sr(k-d,E)),a=r+E,f=d+E),_&&(P=Cr(T-s,Sr(M-h,P)),c=s+P,p=h+P);break;case xr:N[1]?(x&&(a=Cr(L,Sr(k,N[0][0])),f=Cr(L,Sr(k,N[1][0])),x=1),_&&(c=Cr(T,Sr(M,N[0][1])),p=Cr(T,Sr(M,N[1][1])),_=1)):(x<0?(E=Cr(L-r,Sr(k-r,E)),a=r+E,f=d):x>0&&(E=Cr(L-d,Sr(k-d,E)),a=r,f=d+E),_<0?(P=Cr(T-s,Sr(M-s,P)),c=s+P,p=h):_>0&&(P=Cr(T-h,Sr(M-h,P)),c=s,p=h+P));break;case _r:x&&(a=Cr(L,Sr(k,r-E*x)),f=Cr(L,Sr(k,d+E*x))),_&&(c=Cr(T,Sr(M,s-P*_)),p=Cr(T,Sr(M,h+P*_)))}f1?o[0]+o.slice(2):o,+t.slice(n+1)]}function Vr(t){return(t=Ur(Math.abs(t)))?t[1]:NaN}var Yr,Xr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Kr(t){if(!(e=Xr.exec(t)))throw new Error("invalid format: "+t);var e;return new Qr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Qr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Jr(t,e){var n=Ur(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}Kr.prototype=Qr.prototype,Qr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Zr={"%":(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)=>Jr(100*t,e),r:Jr,s:function(t,e){var n=Ur(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(Yr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=o.length;return i===a?o:i>a?o+new Array(i-a+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+Ur(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ti(t){return t}var ei,ni,oi,ri=Array.prototype.map,ii=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ai(t){var e,n,o=void 0===t.grouping||void 0===t.thousands?ti:(e=ri.call(t.grouping,Number),n=t.thousands+"",function(t,o){for(var r=t.length,i=[],a=0,s=e[0],c=0;r>0&&s>0&&(c+s+1>o&&(s=Math.max(1,o-c)),i.push(t.substring(r-=s,r+s)),!((c+=s+1)>o));)s=e[a=(a+1)%e.length];return i.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?ti:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ri.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=Kr(t)).fill,n=t.align,d=t.sign,f=t.symbol,h=t.zero,p=t.width,m=t.comma,g=t.precision,y=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Zr[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===e&&"="===n)&&(h=!0,e="0",n="=");var b="$"===f?r:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",w="$"===f?i:/[%p]/.test(v)?c:"",x=Zr[v],_=/[defgprs%]/.test(v);function A(t){var r,i,c,f=b,A=w;if("c"===v)A=x(t)+A,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),g),y&&(t=function(t){t:for(var e,n=t.length,o=1,r=-1;o0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0==+t&&"+"!==d&&(C=!1),f=(C?"("===d?d:l:"-"===d||"("===d?"":d)+f,A=("s"===v?ii[8+Yr/3]:"")+A+(C&&"("===d?")":""),_)for(r=-1,i=t.length;++r(c=t.charCodeAt(r))||c>57){A=(46===c?a+t.slice(r+1):t.slice(r))+A,t=t.slice(0,r);break}}m&&!h&&(t=o(t,1/0));var S=f.length+t.length+A.length,L=S>1)+f+t+A+L.slice(S);break;default:t=L+f+t+A}return s(t)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),A.toString=function(){return t+""},A}return{format:d,formatPrefix:function(t,e){var n=d(((t=Kr(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3))),r=Math.pow(10,-o),i=ii[8+o/3];return function(t){return n(r*t)+i}}}}function si(t){return ei=ai(t),ni=ei.format,oi=ei.formatPrefix,ei}function ci(t){return Math.max(0,-Vr(Math.abs(t)))}function li(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3)))-Vr(Math.abs(t)))}function ui(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vr(e)-Vr(t))+1}si({thousands:",",grouping:[3],currency:["$",""]});var di=Math.sqrt(50),fi=Math.sqrt(10),hi=Math.sqrt(2);function pi(t,e,n){var o=(e-t)/Math.max(0,n),r=Math.floor(Math.log(o)/Math.LN10),i=o/Math.pow(10,r);return r>=0?(i>=di?10:i>=fi?5:i>=hi?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(i>=di?10:i>=fi?5:i>=hi?2:1)}function mi(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function gi(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function yi(t){let e,n,o;function r(t,o,r=0,i=t.length){if(r>>1;n(t[e],o)<0?r=e+1:i=e}while(rmi(t(e),n),o=(e,n)=>t(e)-n):(e=t===mi||t===gi?t:vi,n=t,o=t),{left:r,center:function(t,e,n=0,i=t.length){const a=r(t,e,n,i-1);return a>n&&o(t[a-1],e)>-o(t[a],e)?a-1:a},right:function(t,o,r=0,i=t.length){if(r>>1;n(t[e],o)<=0?r=e+1:i=e}while(r0)return[t];if((o=e0){let n=Math.round(t/a),o=Math.round(e/a);for(n*ae&&--o,i=new Array(r=o-n+1);++se&&--o,i=new Array(r=o-n+1);++s=di?r*=10:i>=fi?r*=5:i>=hi&&(r*=2),e0;){if((r=pi(c,l,n))===o)return i[a]=c,i[s]=l,e(i);if(r>0)c=Math.floor(c/r)*r,l=Math.ceil(l/r)*r;else{if(!(r<0))break;c=Math.ceil(c*r)/r,l=Math.floor(l*r)/r}o=r}return t},t}var Pi={9606:{commonName:"Human",scientificName:"Homo sapiens",assemblies:{default:"GCF_000001405.26",GRCh38:"GCF_000001405.26",GRCh37:"GCF_000001405.13",NCBI36:"GCF_000001405.12"},hasGeneCache:!0,hasParalogCache:!0,hasInteractionCache:!0,hasGeneStructureCache:!0,hasProteinCache:!0,hasSynonymCache:!0,hasTissueCache:!0},10090:{commonName:"Mouse",scientificName:"Mus musculus",assemblies:{default:"GCF_000001635.27",GRCm39:"GCF_000001635.27",GRCm38:"GCF_000001635.20",MGSCv37:"GCF_000001635.18"},hasGeneCache:!0,hasParalogCache:!0,hasInteractionCache:!0,hasGeneStructureCache:!0,hasProteinCache:!0,hasSynonymCache:!0},9598:{commonName:"Chimpanzee",scientificName:"Pan troglodytes",assemblies:{default:"GCF_028858775.1","NHGRI_mPanTro3-v1.1-hic.freeze_pri":"GCF_028858775.1","Pan_tro 3.0":"GCF_000001515.7"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},10116:{commonName:"Rat",scientificName:"Rattus norvegicus",assemblies:{default:"GCF_000001895.5","Rnor_6.0":"GCF_000001895.5"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},3702:{commonName:"Thale cress",scientificName:"Arabidopsis thaliana",assemblies:{default:"GCF_000001735.3",TAIR10:"GCF_000001735.3"}},4530:{commonName:"Rice",scientificName:"Oryza sativa",assemblies:{default:"GCA_001433935.1","IRGSP-1.0":"GCA_001433935.1"}},4577:{commonName:"Maize",scientificName:"Zea mays",assemblies:{default:"GCA_000005005.5","IRGSP-1.0":"GCA_001433935.1"}},4641:{commonName:"Banana",scientificName:"Musa acuminata",assemblies:{default:"mock"}},7227:{commonName:"Fly",scientificName:"Drosophila melanogaster",assemblies:{default:"GCA_000001215.4","Release 6 plus ISO1 MT":"GCA_000001215.4"},hasSynonymCache:!0},7165:{commonName:"Mosquito",scientificName:"Anopheles gambiae",assemblies:{default:"GCF_000005575.2"}},746128:{commonName:"Aspergillis fumigatus",scientificName:"Aspergillis fumigatus",assemblies:{default:"GCF_000002655.1"}},227321:{scientificName:"Aspergillus nidulans",assemblies:{default:"GCF_000149205.2"}},5061:{commonName:"black mold",scientificName:"Aspergillus niger",assemblies:{default:"GCF_003184595.1"}},5062:{commonName:"koji",scientificName:"Aspergillus oryzae",assemblies:{default:"GCF_000184455.2"}},15368:{commonName:"stiff brome",scientificName:"Brachypodium distachyon",assemblies:{default:"GCF_000005505.3"}},60711:{commonName:"green monkey",scientificName:"Chlorocebus sabaeus",assemblies:{default:"GCF_015252025.1"}},7719:{commonName:"Vase tunicate",scientificName:"Ciona intestinalis",assemblies:{default:"GCF_000224145.3"}},9685:{commonName:"Cat",scientificName:"Felis catus",assemblies:{default:"GCF_000181335.3"},hasGeneCache:!0},9031:{commonName:"Chicken",scientificName:"Gallus gallus",assemblies:{default:"GCF_000002315.6"},hasGeneCache:!0,hasParalogCache:!0},9593:{commonName:"Gorilla",scientificName:"Gorilla gorilla",assemblies:{default:"GCF_008122165.1"}},4513:{commonName:"Barley",scientificName:"Hordeum vulgare",assemblies:{default:"GCA_901482405.1"}},9541:{commonName:"Crab-eating macaque",scientificName:"Macaca fascicularis",assemblies:{default:"GCF_000364345.1"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},9544:{commonName:"Rhesus macaque",scientificName:"Macaca mulatta",assemblies:{default:"GCF_003339765.1"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},9597:{commonName:"Bonobo",scientificName:"Pan paniscus",assemblies:{default:"GCF_013052645.1"}},9615:{commonName:"Dog",scientificName:"Canis lupus familiaris",assemblies:{default:"GCF_014441545.1"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},9823:{commonName:"Pig",scientificName:"Sus scrofa",assemblies:{default:"GCF_000003025.6"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},4932:{commonName:"Yeast",scientificName:"Saccharomyces cerevisiae",assemblies:{default:"GCA_000146045.2",R64:"GCA_000146045.2"}},5833:{commonName:"malaria parasite",scientificName:"Plasmodium falciparum",assemblies:{default:"GCA_000002765.3",GCA_000002765:"GCA_000002765.3"}},6239:{commonName:"worm",scientificName:"Caenorhabditis elegans",assemblies:{default:"GCF_000002985.6"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},4081:{commonName:"tomato",scientificName:"Solanum lycopersicum",assemblies:{default:"GCF_000188115.4"}},4072:{commonName:"pepper",scientificName:"Capsicum annuum",assemblies:{default:"GCF_000710875.1"}},3694:{commonName:"black cottonwood",scientificName:"Populus trichocarpa",assemblies:{default:"GCF_000002775.5"}}},Di=Object.assign({},t,e,r,i);function Ni(){return"assembly"in this.config&&/(GCF_|GCA_)/.test(this.config.assembly)}function Fi(t){var e,n,o,r=document.scripts,i=Ideogram.version;if(!1===location.pathname.includes("/examples/vanilla/"))return`https://cdn.jsdelivr.net/npm/ideogram@${i}/dist/data/${t}`;for(var a=0;a{if(n.ok)return n;if(!1===e)return Bi(t.replace(".json",""),!0);throw Error("Fetch failed for "+t)}))}function Ii(){return Fi("bands/native/")}function $i(t){return Math.round(100*t)/100}function Oi(t){call(this.onDidRotateCallback,t)}function Ri(){return Di.select(this.selector).node()}function Hi(t,e){var n=this.config,o=new Headers;return n.accessToken&&(o=new Headers({Authorization:"Bearer "+n.accessToken})),"text"===e?Di.text(t,{headers:o}):Di.json(t,{headers:o})}function Gi(t){var e,n,o,r,i=this.organisms;for(n in t=zi(t),i)if(o=zi((e=i[n]).commonName),r=zi(e.scientificName),o===t||r===t)return n;return null}function Wi(t){return t in this.organisms?this.organisms[t].commonName:null}function ji(t){return t in this.organisms?this.organisms[t].scientificName:null}function qi(t){const e=t.split(/[ _-]/g).map(((t,e)=>e>0?t[0].toUpperCase()+t.slice(1):t)).join("");return e}function zi(t){return void 0===t?"":t.toLowerCase().replace(/ /g,"-")}function Ui(t){return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(t)}function Vi(t){var e={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};return t.toUpperCase().split("").reduce((function(t,n,o,r){return e[n]150&&n.g>150&&n.b>150&&(t=`rgb(${n.r-30}, ${n.g-30}, ${n.b-30})`),n.r>200&&n.g>200&&n.b>200&&(t=`rgb(${n.r-50}, ${n.g-50}, ${n.b-50})`);else{const s=Ki(e);o=[n.r,n.g,n.b],r=[s.r,s.g,s.b],i=oa(...o),a=oa(...r),(Math.max(i,a)+.05)/(Math.min(i,a)+.05)<3&&(t="rgb(230, 230, 230)")}var o,r,i,a;return t}Di.select=bt,Di.selectAll=function(t){return"string"==typeof t?new gt([document.querySelectorAll(t)],[document.documentElement]):new gt([null==t?[]:l(t)],mt)},Di.scaleLinear=function t(){var e=function(){var t,e,n,o,r,i,a=Ci,s=Ci,c=Ke,l=Si;function u(){var t,e,n,c=Math.min(a.length,s.length);return l!==Si&&(t=a[0],e=a[c-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),o=c>2?ki:Ti,r=i=null,d}function d(e){return null==e||isNaN(e=+e)?n:(r||(r=o(a.map(t),s,c)))(t(l(e)))}return d.invert=function(n){return l(e((i||(i=o(s,a.map(t),qe)))(n)))},d.domain=function(t){return arguments.length?(a=Array.from(t,Ai),u()):a.slice()},d.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},d.rangeRound=function(t){return s=Array.from(t),c=_i,u()},d.clamp=function(t){return arguments.length?(l=!!t||Si,u()):l!==Si},d.interpolate=function(t){return arguments.length?(c=t,u()):c},d.unknown=function(t){return arguments.length?(n=t,d):n},function(n,o){return t=n,e=o,u()}}()(Si,Si);return e.copy=function(){return n=e,t().domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());var n},Mi.apply(e,arguments),Ei(e)},Di.max=function(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n=e)&&(n=e);else{let o=-1;for(let r of t)null!=(r=e(r,++o,t))&&(n=r)&&(n=r)}return n};const Zi=.2126,ta=.7152,ea=.0722,na=2.4;function oa(t,e,n){var o=[t,e,n].map((t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,na)));return o[0]*Zi+o[1]*ta+o[2]*ea}function ra(t,e){if("#"!==t[0])return t;const n=Ki(t),o=e;return`rgb(${n.r*o}, ${n.g*o}, ${n.b*o})`}function ia(){return{theme:"light-border",allowHTML:!0,popperOptions:{modifiers:[{name:"flip"}]},onShow:function(){document.querySelectorAll("[data-tippy-root]").forEach((t=>t.remove()))}}}var aa;aa=[["gneg","#FFF","#FFF","#DDD"],["gpos25","#C8C8C8","#DDD","#BBB"],["gpos33","#BBB","#BBB","#AAA"],["gpos50","#999","#AAA","#888"],["gpos66","#888","#888","#666"],["gpos75","#777","#777","#444"],["gpos100","#444","#666","#000"],["acen","#FEE","#FEE","#FDD"],["noBands","#BBB","#BBB","#AAA"]];let sa='#_ideogram {padding-left: 5px;} #_ideogram .labeled {padding-left: 15px;} #_ideogram.labeledLeft {padding-left: 15px; padding-top: 15px;} #_ideogram text {font: 9px Tahoma; fill: #000;} #_ideogram .italic {font-style: italic;} #_ideogram .chromosome {cursor: pointer; fill: #AAA;}#_ideogram.no-rotate .chromosome {cursor: default;} #_ideogram .chrLabel, #_ideogram .annot {cursor: pointer;}#_ideogram .chrSetLabel {font-weight: bolder;}#_ideogram .ghost {opacity: 0.2;}#_ideogram .hidden {display: none;}#_ideogram .bandLabelStalk line {stroke: #AAA; stroke-width: 1;}#_ideogram .syntenyBorder {stroke:#AAA;stroke-width:1;}#_ideogram rect.cursor { fill: #F00; stroke: #F00; fill-opacity: .3; shape-rendering: crispEdges;}#_ideogram .brush .selection { fill: #F00; stroke: #F00; fill-opacity: .3; shape-rendering: crispEdges;}#_ideogram .noBands {fill: #AAA;}#_ideogram .gneg {fill: #FFF}#_ideogram .gpos25 {fill: #BBB}#_ideogram .gpos33 {fill: #AAA}#_ideogram .gpos50 {fill: #888}#_ideogram .gpos66 {fill: #666}#_ideogram .gpos75 {fill: #444}#_ideogram .gpos100 {fill: #000}#_ideogram .gpos {fill: #000}#_ideogram .acen {fill: #FDD}#_ideogram .stalk {fill: #CCE;}#_ideogram .gvar {fill: #DDF}#_ideogram.faint .gneg {fill: #FFF}#_ideogram.faint .gpos25 {fill: #EEE}#_ideogram.faint .gpos33 {fill: #EEE}#_ideogram.faint .gpos50 {fill: #EEE}#_ideogram.faint .gpos66 {fill: #EEE}#_ideogram.faint .gpos75 {fill: #EEE}#_ideogram.faint .gpos100 {fill: #DDD}#_ideogram.faint .gpos {fill: #DDD}#_ideogram.faint .acen {fill: #FEE}#_ideogram.faint .stalk {fill: #EEF;}#_ideogram.faint .gvar {fill: #EEF}#_ideogram .gneg {fill: url("#gneg")} #_ideogram .gpos25 {fill: url("#gpos25")} #_ideogram .gpos33 {fill: url("#gpos33")} #_ideogram .gpos50 {fill: url("#gpos50")} #_ideogram .gpos66 {fill: url("#gpos66")} #_ideogram .gpos75 {fill: url("#gpos75")} #_ideogram .gpos100 {fill: url("#gpos100")} #_ideogram .gpos {fill: url("#gpos100")} #_ideogram .acen {fill: url("#acen")} #_ideogram .stalk {fill: url("#stalk")} #_ideogram .gvar {fill: url("#gvar")} #_ideogram .noBands {fill: url("#noBands")} #_ideogram .chromosome {fill: url("#noBands")} ';function ca(t){var e;this.config=JSON.parse(JSON.stringify(t)),(e=this).chromosomesArray=[],e.coordinateSystem="iscn",e.maxLength={bp:0,iscn:0},e.chromosomes={},e.numChromosomes=0,e.config.debug||(e.config.debug=!1),e.config.dataDir||(e.config.dataDir=e.getDataDir()),e.config.container||(e.config.container="body"),e.selector=e.config.container+" #_ideogram",e.config.resolution||(e.config.resolution=""),e.config.orientation||(e.config.orientation="vertical"),e.config.brush||(e.config.brush=null),e.config.rows||(e.config.rows=1),"showChromosomeLabels"in e.config==0&&(e.config.showChromosomeLabels=!0),e.config.showNonNuclearChromosomes||(e.config.showNonNuclearChromosomes=!1),e.config.chromosomeScale||(e.config.chromosomeScale="absolute"),e.config.showTools||(e.config.showTools=!1),function(t){t.config.ploidy||(t.config.ploidy=1),t.config.ploidy>1&&(t.sexChromosomes={},t.config.sex||(t.config.sex="male"),2!==t.config.ploidy||t.config.ancestors||(t.config.ancestors={M:"#ffb6c1",P:"#add8e6"},t.config.ploidyDesc="MP"))}(this),function(t){t.config.showBandLabels||(t.config.showBandLabels=!1),"showFullyBanded"in t.config==0&&(t.config.showFullyBanded=!0),t.bandsToShow=[],t.bandData={}}(this),function(t){var e,n,o;t.config.chrHeight||(e=t.config.container,n=document.querySelector(e).getBoundingClientRect(),o="vertical"===t.config.orientation?n.height:n.width,"body"!==e&&0!==o||(o=400),t.config.chrHeight=o)}(this),function(t){var e,n;t.config.chrWidth||(e=10,(n=t.config.chrHeight)<900&&n>500?e=Math.round(n/40):n>=900&&(e=Math.round(n/45)),t.config.chrWidth=e)}(this),function(t){t.config.geometry&&"collinear"===t.config.geometry?"chrMargin"in t.config==0&&(t.config.chrMargin=0):(t.config.chrMargin||(1===t.config.ploidy?t.config.chrMargin=10:t.config.chrMargin=Math.round(t.config.chrWidth/4)),t.config.showBandLabels&&(t.config.chrMargin+=20))}(this),function(t,e){t.onLoad&&(e.onLoadCallback=t.onLoad),t.onLoadAnnots&&(e.onLoadAnnotsCallback=t.onLoadAnnots),t.onBeforeDrawAnnots&&(e.onBeforeDrawAnnotsCallback=t.onBeforeDrawAnnots),t.onDrawAnnots&&(e.onDrawAnnotsCallback=t.onDrawAnnots),t.onBrushMove&&(e.onBrushMoveCallback=t.onBrushMove),t.onBrushEnd&&(e.onBrushEndCallback=t.onBrushEnd),t.onCursorMove&&(e.onCursorMoveCallback=t.onCursorMove),t.onDidRotate&&(e.onDidRotateCallback=t.onDidRotate),t.onWillShowAnnotTooltip&&(e.onWillShowAnnotTooltipCallback=t.onWillShowAnnotTooltip),t.onDidShowAnnotTooltip&&(e.onDidShowAnnotTooltipCallback=t.onDidShowAnnotTooltip),t.onClickAnnot&&(e.onClickAnnotCallback=t.onClickAnnot)}(t,this),function(t,e){e.organisms=Object.assign({},Pi),t.taxid&&t.organismMetadata&&(e.organisms[t.taxid]=t.organismMetadata),e.organismsWithBands=Object.assign({},e.organisms)}(t,this),function(t){t.bump=Math.round(t.config.chrHeight/125),t.adjustedBump=!1,t.config.chrHeight<200&&(t.adjustedBump=!0,t.bump=4)}(this),function(t,e){t.chromosome&&(e.config.chromosomes=[t.chromosome],"showBandLabels"in t==0&&(e.config.showBandLabels=!0),"rotatable"in t==0&&(e.config.rotatable=!1))}(t,this),function(t){const e=t.config;e.chrLabelSize||(t.config.chrLabelSize=9),e.chrLabelColor||(t.config.chrLabelColor="#000"),e.fontFamily||(t.config.fontFamily="");const n=`font-size: ${e.chrLabelSize}px`,o=`fill: ${e.chrLabelColor}`,r=`font-family: ${e.fontFamily}`;sa+=`#_ideogram text {${r}; ${n}; ${o};}`,sa+=`#_ideogramLabel text {${r};}`}(this),this.initAnnotSettings(),this.config.geometry&&"parallel"!==this.config.geometry||(this.config.chrMargin+=this.config.chrWidth,"heatmap"===this.config.annotationsLayout?this.config.chrMargin+=this.config.annotTracksHeight:this.config.chrMargin+=2*this.config.annotTracksHeight),this.init()}const la=function(t){var e,n,o,r,i=t.config;if(t.config.annotLabelHeight=12,"demarcateCollinearChromosomes"in t.config==0&&(t.config.demarcateCollinearChromosomes=!0),n=function(t,e){var n,o,r,i,a,s,c,l={};for(n=[],o=0;o tspan");t.setAttribute("x",s),t.setAttribute("dy",f-8),i.querySelector(".chrLabel").setAttribute("text-anchor","start")}i.setAttribute("transform","rotate(90) translate("+a+","+c+")"),i.querySelector(".chromosome").setAttribute("transform","translate(-13, 10)")}!function(t){t.config.taxids.forEach(((e,n)=>{var o=t.organisms[e].scientificName;Di.select(t.selector).append("text").attr("class","genomeLabel italic").attr("x",55+200*n).attr("y",10).text(o).attr("text-anchor","middle")}))}(o)}(e,n,-40,t),r=Math.round(n.slice(-1)[0]+70),i.multiorganism){o*=8;var a=0;n.forEach((t=>{t>a&&(a=t)})),o=a+30}else o=xOffsets.slice(-1)[0]+30;Di.select(t.selector).attr("height",o).attr("width",r),Di.select("#_ideogramTrackLabelContainer").remove(),Di.select("#_ideogramInnerWrap").insert("div",":first-child").attr("id","_ideogramTrackLabelContainer").style("position","absolute")};const ua=function(t){var e,n,o,r,i,a=t.config,s=a.annotationHeight||0;if("vertical"!==a.orientation){t.config.annotLabelHeight=12;var c=t.config.annotLabelHeight;if("demarcateCollinearChromosomes"in t.config==0&&(t.config.demarcateCollinearChromosomes=!0),e=document.querySelectorAll(".chromosome-set"),o=a.numAnnotTracks*(s+c+4)-a.chrWidth+1,n=function(t,e){var n,o,r,i,a,s,c,l={};for(n=[],o=0;o{var o=t.organisms[e],r=t.config,i=o.scientificName;Di.select(t.selector).append("text").attr("class","genomeLabel italic").attr("x",5).attr("y",r.chrLabelSize+(200+3*r.chrWidth)*n).text(i)}))}(o)}(e,n,o,t),r=o+2*a.chrWidth+20,a.multiorganism){r*=8;var l=0;n.forEach((t=>{t>l&&(l=t)})),i=l+20}else i=n.slice(-1)[0]+20;Di.select(t.selector).attr("width",i).attr("height",r),Di.select("#_ideogramTrackLabelContainer").remove(),Di.select("#_ideogramInnerWrap").insert("div",":first-child").attr("id","_ideogramTrackLabelContainer").style("position","absolute")}else la(t)};var da=Uint8Array,fa=Uint16Array,ha=Uint32Array,pa=new da([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ma=new da([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ga=new da([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ya=function(t,e){for(var n=new fa(31),o=0;o<31;++o)n[o]=e+=1<>>1|(21845&Ca)<<1;Sa=(61680&(Sa=(52428&Sa)>>>2|(13107&Sa)<<2))>>>4|(3855&Sa)<<4,Aa[Ca]=((65280&Sa)>>>8|(255&Sa)<<8)>>>1}var La=function(t,e,n){for(var o=t.length,r=0,i=new fa(e);r>>c]=l}else for(a=new fa(o),r=0;r>>15-t[r]);return a},Ta=new da(288);for(Ca=0;Ca<144;++Ca)Ta[Ca]=8;for(Ca=144;Ca<256;++Ca)Ta[Ca]=9;for(Ca=256;Ca<280;++Ca)Ta[Ca]=7;for(Ca=280;Ca<288;++Ca)Ta[Ca]=8;var ka=new da(32);for(Ca=0;Ca<32;++Ca)ka[Ca]=5;var Ma=La(Ta,9,1),Ea=La(ka,5,1),Pa=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},Da=function(t,e,n){var o=e/8|0;return(t[o]|t[o+1]<<8)>>(7&e)&n},Na=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},Fa=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var o=new(2==t.BYTES_PER_ELEMENT?fa:4==t.BYTES_PER_ELEMENT?ha:da)(n-e);return o.set(t.subarray(e,n)),o},Ba=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ia=function(t,e,n){var o=new Error(e||Ba[t]);if(o.code=t,Error.captureStackTrace&&Error.captureStackTrace(o,Ia),!n)throw o;return o},$a=function(t,e,n){var o=t.length;if(!o||n&&n.f&&!n.l)return e||new da(0);var r=!e||n,i=!n||n.i;n||(n={}),e||(e=new da(3*o));var a,s=function(t){var n=e.length;if(t>n){var o=new da(Math.max(2*n,t));o.set(e),e=o}},c=n.f||0,l=n.p||0,u=n.b||0,d=n.l,f=n.d,h=n.m,p=n.n,m=8*o;do{if(!d){c=Da(t,l,1);var g=Da(t,l+1,3);if(l+=3,!g){var y=t[(a=l,(k=4+((a+7)/8|0))-4)]|t[k-3]<<8,v=k+y;if(v>o){i&&Ia(0);break}r&&s(u+y),e.set(t.subarray(k,v),u),n.b=u+=y,n.p=l=8*v,n.f=c;continue}if(1==g)d=Ma,f=Ea,h=9,p=5;else if(2==g){var b=Da(t,l,31)+257,w=Da(t,l+10,15)+4,x=b+Da(t,l+5,31)+1;l+=14;for(var _=new da(x),A=new da(19),C=0;C>>4)<16)_[C++]=k;else{var E=0,P=0;for(16==k?(P=3+Da(t,l,3),l+=2,E=_[C-1]):17==k?(P=3+Da(t,l,7),l+=3):18==k&&(P=11+Da(t,l,127),l+=7);P--;)_[C++]=E}}var D=_.subarray(0,b),N=_.subarray(b);h=Pa(D),p=Pa(N),d=La(D,h,1),f=La(N,p,1)}else Ia(1);if(l>m){i&&Ia(0);break}}r&&s(u+131072);for(var F=(1<>>4;if((l+=15&E)>m){i&&Ia(0);break}if(E||Ia(2),$<256)e[u++]=$;else{if(256==$){I=l,d=null;break}var O=$-254;if($>264){var R=pa[C=$-257];O=Da(t,l,(1<>>4;if(H||Ia(3),l+=15&H,N=_a[G],G>3&&(R=ma[G],N+=Na(t,l)&(1<m){i&&Ia(0);break}r&&s(u+131072);for(var W=u+O;u>3&1)+(e>>4&1);o>0;o-=!t[n++]);return n+(2&e)},Ha=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},Ga=function(t){(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&Ia(6,"invalid zlib data"),32&t[1]&&Ia(6,"invalid zlib data: preset dictionaries not supported")};function Wa(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){return $a(t.subarray(Ra(t),-8),e||new da(Ha(t)))}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return $a(t,e)}(t,e):function(t,e){return $a((Ga(t),t.subarray(2,-4)),e)}(t,e)}var ja="undefined"!=typeof TextDecoder&&new TextDecoder;try{ja.decode(Oa,{stream:!0})}catch(t){}var qa=function(t){for(var e="",n=0;;){var o=t[n++],r=(o>127)+(o>223)+(o>239);if(n+r>t.length)return[e,Fa(t,n-1)];r?3==r?(o=((15&o)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|o>>10,56320|1023&o)):e+=1&r?String.fromCharCode((31&o)<<6|63&t[n++]):String.fromCharCode((15&o)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(o)}};function za(t,e){if(e){for(var n="",o=0;o{let n=t;return e.length>0&&(n+=` :: ${JSON.stringify(e)}`),n})(t,e)),this.name=t,this.details=e}}async function Va(t,e){try{if(206===e.status)return e;const n=t.headers.get("range");if(!n)throw new Ua("no-range-header");const o=function(t){const e=t.trim().toLowerCase();if(!e.startsWith("bytes="))throw new Ua("unit-must-be-bytes",{normalizedRangeHeader:e});if(e.includes(","))throw new Ua("single-range-only",{normalizedRangeHeader:e});const n=/(\d*)-(\d*)/.exec(e);if(!n||!n[1]&&!n[2])throw new Ua("invalid-range-values",{normalizedRangeHeader:e});return{start:""===n[1]?void 0:Number(n[1]),end:""===n[2]?void 0:Number(n[2])}}(n),r=await e.blob(),i=function(t,e,n){const o=t.size;if(n&&n>o||e&&e<0)throw new Ua("range-not-satisfiable",{size:o,end:n,start:e});let r,i;return void 0!==e&&void 0!==n?(r=e,i=n+1):void 0!==e&&void 0===n?(r=e,i=o):void 0!==n&&void 0===e&&(r=o-n,i=o),{start:r,end:i}}(r,o.start,o.end),a=r.slice(i.start,i.end),s=a.size,c=new Response(a,{status:206,statusText:"Partial Content",headers:e.headers});return c.headers.set("Content-Length",String(s)),c.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/${r.size}`),c}catch(t){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}function Ya(t,e,n,o="tsv"){const r=zi(t);return e?e+=n+"/":e=Fi("cache/"+n+"/"),e+r+"-"+n+"."+o+".gz"}function Xa(t,e,n=11){return"WBGene"===t&&(n=8),t+e.padStart(n,"0")}async function Ka(){const t=`ideogram-${a}`;return(await caches.keys()).forEach((e=>{e.startsWith("ideogram-")&&e!==t&&caches.delete(e)})),await caches.open(t)}async function Qa(t){const e=await Ka();window.ideoCache=e,window.createPartialResponse=Va;const n=t.replace(".gz","");if(void 0===await e.match(n)){const o=await fetch(t),r=await o.blob(),i=za(Wa(new Uint8Array(await r.arrayBuffer()))),a=i.length,s=new Response(new Blob([i],{type:"text/tab-separated-values"}),{headers:new Headers({"Content-Length":a})});return await e.put(n,s),await e.match(n)}return await e.match(n)}async function Ja(t,e){t=t.replace(".gz","");const n=e[0]+1,o=e[1]-1,r=new Headers({"content-type":"multipart/byteranges",range:`bytes=${n}-${o}`}),i=new Request(t,{headers:r}),a=await Ka(),s=await a.match(i),c=await Va(i,s);return await c.text()}function Za(t,e){const n=[];for(let o=0;o{const e=t.split(" = ");o[e[0]]=e[1]})),[n,o]}function es(t,e){const n=[];for(let o=0;o{const e=t.split(" = ");o[e[0]]=e[1]})),[n,o]}function os(t){const e=[],n=[],o=[];return t.split(";").forEach((t=>{const r=t.split(",");e.push(r[0]),n.push(r[1]),o.push(r[2])})),[e,n,o]}async function rs(t,e){const n=e.tissueCache,o=n.byteRangesByName[t];if(e.cacheRangeFetch||(e.cacheRangeFetch=Ja),!o)return null;const r=e.config;let i=null;r.cacheDir&&(i=r.cacheDir);const a=Ya("homo-sapiens",i,"tissues","tsv"),s=[],c=(await Ja(a,o)).split("\t").slice(1);for(let t=0;t""===t?0:t)),o=e.length;15===o?e.splice(1,0,0):14===o?(e.splice(1,0,0),e.splice(1,0,0)):13===o&&(e.splice(1,0,0),e.splice(1,0,0),e.splice(1,0,0));const r=e[0],i=e.slice(1,6),a={min:parseFloat(i[0]),q1:parseFloat(i[1]),median:parseFloat(i[2]),q3:parseFloat(i[3]),max:parseFloat(i[4]),quantiles:e.slice(6).map((t=>parseInt(t)))},l=n.tissueNames[r],u=n.tissueColors[r],d=parseInt(n.tissueSamples[r]);s.push({tissue:l,expression:a,color:u,samples:d})}return s}n(762),window.cacheRangeFetch=Ja;const is={gene:{metadata:"Gene",dir:"genes",fn:function(t,e){const[n,o,r,i,a,s,c]=t;e.geneCache={interestingNames:n,nameCaseMap:o,namesById:r,fullNamesById:i,idsByName:a,lociByName:s,lociById:c}},parseFn:function(t,e){const n=[],o={},r={},i={},a={},s={},c={},l=[],u={};let d,f=performance.now();const h=t.split(/\r\n|\n/);e.rawTsvSplit=Math.round(performance.now()-f),f=performance.now();for(let t=0;t{if(r.fn(s,n,e),Ideogram[l][e]=n[l],i){console.timeEnd(`${t}Cache total`),c.total=Math.round(performance.now()-a);const e="perfTimes in init"+r.metadata+"Cache:";console.log(e,c)}o()}))}function ss(t){void 0!==t.timeout&&window.clearTimeout(t.timeout),t.rawAnnots=t.setOriginalTrackIndexes(t.rawAnnots),t.config.annotationsDisplayedTracks?t.annots=t.updateDisplayedTracks(t.config.annotationsDisplayedTracks):(t.annots=t.processAnnotData(t.rawAnnots),t.config.filterable&&t.initCrossFilter(),t.drawProcessedAnnots(t.annots))}function cs(t){var e=(new Date).getTime(),n=this,o=n.config,r=o.annotations;n.initDrawChromosomes(),o.annotationsPath&&function(t){t.rawAnnots?ss(t):function e(){t.timeout=setTimeout((function(){!t.rawAnnots||t.rawAnnots&&void 0!==t.rawAnnots.then?e():ss(t)}),50)}()}(n),function(t,e){var n,o,r,i;if(!0===t.showBandLabels&&(r=(new Date).getTime(),e.hideUnshownBandLabels(),i=(new Date).getTime(),t.debug&&console.log("Time in showing bands: "+(i-r)+" ms"),"vertical"===t.orientation))for(n=0;n{n.config.debug&&console.timeEnd("initCache: Ideogram"),n.onLoadCallback&&n.onLoadCallback()}))}class ls{constructor(t){this._config=t,this._description=this._normalize(this._config.ploidyDesc)}getChromosomesNumber(t){if(this._config.ploidyDesc){var e=this._config.ploidyDesc[t];return e instanceof Object?Object.keys(e)[0].length:e.length}return this._config.ploidy||1}_normalize(t){var e,n,o=[];if(!t)return t;for(e in t)"string"==typeof(n=t[e])?("vertical"===this._config.orientation&&(n=n.split("").reverse()),o.push({ancestors:n,existence:this._getexistenceArray(n.length)})):o.push({ancestors:Object.keys(n)[0],existence:n[Object.keys(n)[0]]});return o}_getexistenceArray(t){for(var e=[],n=0;n0}return!0}}class us{constructor(t){this._node=t}getLabel(){return Di.select(this._node.parentNode).select("text.chrLabel").text()}getSetLabel(){return Di.select(this._node.parentNode).select("text.chrSetLabel").text()}}const ds=class{constructor(t,e){if(this._config=t,this._ideo=e,this._ploidy=this._ideo._ploidy,this._translate=void 0,"chrSetMargin"in t)this.chrSetMargin=t.chrSetMargin;else{var n=this._config.chrMargin;this.chrSetMargin=this._config.ploidy>1?n:0}this._tickSize=8,this._isRotated=!1}_getLeftMargin(){return this.margin.left}_getYScale(){return 20/this._config.chrWidth}getChromosomeLabels(t){var e=new us(t),n=[];return this._ideo.config.ploidy>1&&n.push(e.getSetLabel()),n.push(e.getLabel()),n.filter((function(t){return t.length>0}))}getChromosomeBandLabelTranslate(t){var e,n,o,r=this._ideo,i=this._tickSize,a=r.config.orientation;return"vertical"===a?o="rotate(-90)translate("+(e=i)+","+(n=r.round(2+t.px.start+t.px.width/2))+")":"horizontal"===a&&(o="translate("+(e=r.round(-i+t.px.start+t.px.width/2))+","+(n=-10)+")"),{x:e,y:n,translate:o}}didRotate(t,e){var n,o,r,i,a,s,c,l,u;o=(n=this._ideo).config.taxid,r=e.id.split("-")[0].replace("chr",""),i=(a=n.chromosomes[o][r]).bands,l=(c=Di.select(e.parentNode)).attr("transform"),u=/scale\(.*\)/.exec(l),l=l.replace(u,""),c.attr("transform",l),s=a.width,(a=n.getChromosomeModel(i,r,o,t)).oldWidth=s,n.chromosomes[o][r]=a,n.drawChromosome(a),n.handleRotateOnClick(),n.rawAnnots&&(n.displayedTrackIndexes?n.updateDisplayedTracks(n.displayedTrackIndexes):(n.annots=n.processAnnotData(n.rawAnnots),n.drawProcessedAnnots(n.annots),n.config.filterable&&n.initCrossFilter())),!0===n.config.showBandLabels&&(n.drawBandLabels(n.chromosomes),n.hideUnshownBandLabels()),n.onDidRotateCallback&&n.onDidRotateCallback(a)}rotate(t,e,n){var o,r,i,a;o=this._ideo,a=o.selector+" .chrSetLabel, "+o.selector+" .chrLabel",i=document.querySelector(o.selector).getBoundingClientRect(),r=Di.selectAll(o.selector+" g.chromosome").filter((function(){return this!==n})),this._isRotated?(this._isRotated=!1,o.config.chrHeight=o.config.chrHeightOriginal,o.config.chrWidth=o.config.chrWidthOriginal,o.config.annotationHeight=o.config.annotationHeightOriginal,this.rotateBack(t,e,n,(function(){r.style("display",null),Di.selectAll(a).style("display",null),o._layout.didRotate(e,n)}))):(this._isRotated=!0,r.style("display","none"),Di.selectAll(a).style("display","none"),this.rotateForward(t,e,n,(function(){var t,r,a;o.config.chrHeightOriginal=o.config.chrHeight,o.config.chrWidthOriginal=o.config.chrWidth,o.config.annotationHeightOriginal=o.config.annotationHeight,"VerticalLayout"===o._layout._class?(r=i.width-20,a=window.innerWidth-20):(r=i.height-10,a=window.innerHeight-10),t=a0?e:e+4+2*t);if(!this._translate){var a;this._translate=[this._ploidy.getSetSize(0)*i*2];for(var s=1;s1&&(t*=1.8),t}rotateForward(t,e,n,o){var r;Di.select(n.parentNode).transition().attr("transform","rotate(90) translate(30, -37.5) ").on("end",o),r=this.getChromosomeLabels(n),Di.select(this._ideo.getSvg()).append("g").attr("class","tmp").selectAll("text").data(r).enter().append("text").attr("class",(function(t,e){return 0===e&&2===r.length?"chrSetLabel":null})).attr("x",26).attr("y",(function(t,e){return 12*(e+1+r.length%2)})).style("text-anchor","middle").style("opacity",0).text(String).transition().style("opacity",1),this._ideo.config.orientation="vertical"}rotateBack(t,e,n,o){var r=this.getChromosomeSetTranslate(t);Di.select(n.parentNode).transition().attr("transform",r).on("end",o),Di.selectAll(this._ideo.selector+" g.tmp").style("opacity",0).remove(),this._ideo.config.orientation="horizontal"}getHeight(t){void 0===t&&(t=this._config.taxids[0]);var e=this._config.chromosomes[t].length,n=this.getChromosomeSetYTranslate(e-1);return(n+=this._getChromosomeSetSize(e-1))+2*this._getAdditionalOffset()}getWidth(){return this._config.chrHeight+1.5*this.margin.top}getChromosomeSetLabelAnchor(){return"end"}getChromosomeBandLabelAnchor(){return null}getChromosomeBandTickY1(){return 2}getChromosomeBandTickY2(){return 10}getChromosomeSetLabelTranslate(){return null}getChromosomeSetTranslate(t){return"translate("+this._getLeftMargin()+", "+this.getChromosomeSetYTranslate(t)+")"}getChromosomeSetYTranslate(t){if(!this._config.ploidyDesc)return this._config.chrMargin*(t+1);if(!this._translate){this._translate=[1];for(var e=1;ethis.chrsPerRow-1?(e=this.margin.left+1.3*this._config.chrHeight,n=this.getChromosomeSetYTranslate(t-this.chrsPerRow)):(e=this.margin.left,n=this.getChromosomeSetYTranslate(t)),"rotate(90) translate("+e+", -"+n+")"}getChromosomeSetYTranslate(t){var e=.3*this._getAdditionalOffset();return this.margin.left*t+this._config.chrWidth+2*e+e*t}getChromosomeSetLabelXPosition(t){return(this._ploidy.getSetSize(t)*this._config.chrWidth+20)/-2+(this._config.ploidy>1?0:this._config.chrWidth)}getChromosomeLabelXPosition(){return this._config.chrWidth/-2}};function gs(t){if(27===t.keyCode){const t=document.querySelector("#_ideogramTooltip");if(!t)return;t.style.opacity=0}}function ys(t){var e=this;e.config.annotationsPath&&e.fetchAnnots(e.config.annotationsPath),function(t){if("ploidyDesc"in t.config&&"string"==typeof t.config.ploidyDesc){for(var e=[],n=0;n1?new ms(e,t):"vertical"===e.orientation?new fs(e,t):"horizontal"===e.orientation?new hs(e,t):new fs(e,t)}(e),function(t){Di.selectAll(t.config.container+" #_ideogramOuterWrap").remove(),Di.select(t.config.container).append("div").attr("id","_ideogramOuterWrap").append("div").attr("id","_ideogramTrackLabelContainer").style("position","absolute"),Di.select(t.config.container+" #_ideogramOuterWrap").append("div").attr("id","_ideogramMiddleWrap").style("position","relative").style("overflow-x","auto").style("transform","translateZ(0)").append("div").attr("id","_ideogramInnerWrap").append("svg").attr("id","_ideogram").attr("class",function(t){var e="";return t.config.showChromosomeLabels&&("horizontal"===t.config.orientation?e+="labeledLeft ":e+="labeled "),!1===t.config.rotatable&&(e+="no-rotate "),t.config.annotationsLayout&&"overlay"===t.config.annotationsLayout&&(e+="faint"),e}(t)).attr("width",t._layout.getWidth()).attr("height",t._layout.getHeight()).html(t.getBandColorGradients())}(e),e.isOnlyIdeogram=1===document.querySelectorAll("#_ideogram").length,function(t){Di.select(t.config.container+" #_ideogramOuterWrap").append("div").attr("class","_ideogramTooltip").attr("id","_ideogramTooltip").style("opacity",0).style("position","fixed").style("text-align","center").style("padding","4px").style("font","12px sans-serif").style("background","white").style("border","1px solid black").style("border-radius","5px").style("z-index","1000").style("margin-left","-2px"),document.removeEventListener("keydown",gs),document.addEventListener("keydown",gs)}(e),e.finishInit(t)}var vs="";function bs(t,e,n){return n.config.dataDir+t[e]}function ws(t,e,n){var o=n.config.ploidy;return"sex"in n.config&&(2===o&&n.sexChromosomes.index+1===e||"female"===n.config.sex&&"Y"===t.name)}function xs(t,e,n,o){var r,i,a,s,c;for(r=0;r=chrBands.length/2&&(e.coordinateSystem="bp")}function As(){var t,e,n,o,r=this,i=r.config.taxids;for(e=0;e"MT"!==t)),void 0!==o&&(o=o.filter((t=>"MT"!==t[0].chr)))),_s(n,r),r.chromosomes[t]={},r.setSexChromosomes(n),xs(o,n,t,r),r.config.showBandLabels&&r.drawBandLabels(r.chromosomes),r.handleRotateOnClick(),r._gotChrModels=!0}function Cs(){var t=this;"rotatable"in t.config&&!1===t.config.rotatable?Di.selectAll(t.selector).style("cursor","default"):Di.selectAll(t.selector+" .chromosome-set").on("click",(function(){const e=this.children[1];t.rotateAndToggleDisplay(e)}))}function Ss(){call(this.onLoadCallback)}function Ls(t,e,n){var o=n.organisms[t],r=[zi(o.scientificName)],i=o.assemblies,a=n.config.resolution;return e!==i.default&&r.push(e),"9606"===t&&(e in i==="false"&&Object.values(i).includes(config.assembly)||""!==a&&850!==a)&&r.push(a),r=r.join("-"),["9606","10090","10116"].includes(t)&&!n.config.showFullyBanded&&(r+="-no-bands"),r+".json"}function Ts(t,e,n){var o,r,i,a=n.config;o=n.organisms[t],a.assembly||(n.config.assembly="default"),r=o.assemblies,i=Ls(t,n.assemblyIsAccession()?a.assembly:r[a.assembly],n);var s="-1"===t;return(t in n.organismsWithBands||s)&&(e[t]=i),e}function ks(t,e,n,o){return function(t,e,n){var o=bs(t,e,n);return(!(void 0!==window.chrBands&&""===vs)||vs!==o)&&function(t){return"assembly"in t.config&&!1===/(GCA_)/.test(t.config.assembly)}(n)&&e in t}(e,t,o)?function(t,e,n,o){var r=bs(t,e,o);return o.numBandDataResponses||(o.numBandDataResponses=0),Bi(r).then((function(e){return e.json().then((function(n){vs=r,delete window.chrBands,window.chrBands=n.chrBands,function(t,e,n,o){var r,i,a;for(r in e)a=e[r],t.includes(a)&&""!==a&&(i=r);o.bandData[i]=n}(e.url,t,chrBands,o)}))}))}(e,t,0,o).then((function(){return o.processBandData(t)})):new Promise((function(e){o.processBandData(t),e([t,void 0])}))}var Ms={},Es={},Ps={};function Ds(t){var e=(t=t||this).config.container;Ps[e]?(Es[e]=!0,Ms[e]=t):(Ps[e]=!0,function(t){return new Promise((function(e){var n=t.config.organism;"number"==typeof n?t.getOrganismFromEutils(n,(function(){t.getTaxids(e)})):t.getTaxids(e)}))}(t).then((function(n){var o=n[0];t.config.taxid=o,t.config.taxids=n,t.organismScientificName=t.getScientificName(t.config.taxid),function(t,e,n){var o,r,i,a=[];for(i in o={},Pi)o[i]="";for(r=0;r=4&&(l=u[3],o[0]=l),u.length>=8&&(s=u[8].split(","),c=Ns.rgbToHex(s[0],s[1],s[2]),o.push(c)),[r,o])}parseRawAnnots(t,e,n,o){var r,i,a,s,c,l;for(l=!0,!1===isNaN(parseInt(n[e],10))&&(l=!1),r=e;r=8&&c.push("color"),{keys:c,annots:t}}parseBed(t,e){var n,o,r,i,a=[],s=t.split(/\r\n|\n/);for(o=Object.keys(e.chromosomes[e.config.taxid]),n=0;n1){const e=t[0].slice(3),n=t[1].split(";");a[qi(e)]=n}}else i=e.slice(1).trim().split(/\t/).map((t=>qi(t))),i.slice(4).forEach(((t,e)=>s.push(qi(t))));continue}const c=e.trim().split(/\t/),l=c[0],[u,d,f]=this.parseGenomicCoordinates(c),h=o.indexOf(u);if(-1===h)continue;const p=c.slice(4);for(let t=0;t<4;t++){const e=s[t];if(e in a){const n=a[e],o=c[4+t].split(";"),r=[];if(""!==o[0])for(let t=0;t!Bs.includes(t)));return t.displayedTrackIndexes&&(e=e.filter((function(e,n){return t.displayedTrackIndexes.includes(n+1)}))),e}function Os(t){var e,n,o=t.rawAnnots;if(!o.metadata||o.metadata.heatmapThresholds||t.config.heatmapThresholds)return e=t.config.heatmapThresholds?t.config.heatmapThresholds:t.rawAnnots.metadata.heatmapThresholds,n=Is[e.length+1],e=e.map(((t,e)=>[t,"#"+n[e]])),e.push(["+","#"+n.slice(-1)[0]]),e}function Rs(t,e,n,o,r){return t===e&&"+"===r&&n>o||n===r||0!==t&&t!==e&&n<=r&&n>o||0===t&&n<=r}function Hs(t,e){var n,o,r,i,a,s,c,l;for(n=0;n0&&(r+=n.config.chrMargin*t.chrIndex-1),a=Di.select(n.config.container+" #_ideogramInnerWrap").append("canvas").attr("id",s).attr("width",c+1).attr("height",i).style("position","absolute").style("left",r+"px").style("top",i*o+1+"px").nodes()[0].getContext("2d"),l.push([a,t]);return l}function Ws(t,e,n){var o,r,i,a,s=n.config.annotLabelHeight,c=n.config.annotationHeight,l=n.config.demarcateCollinearChromosomes,u=c+s+4;for(o=0;oa.width-1)continue;i.fillRect(r.startPx,1,.5,u)}else i.fillRect(r.startPx,s+1,.5,c);if(l)for(o=0;o"),Di.select(e.config.container+" #_ideogramTrackLabel").interrupt().style("top","").style("left","").style("transform",null).style("transform","rotate(-90deg)").html(n),[o,r]=function(t,e,n){var o,r,i,a,s;return o=e.id.split("-").slice(0,-1).join("-")+"-0",r=Di.select(n.config.container+" #"+o).nodes()[0].getBoundingClientRect(),i=Di.select(n.config.container+" #_ideogramTrackLabel").nodes()[0].getBoundingClientRect(),a=Di.select(n.config.container).nodes()[0].getBoundingClientRect(),s=Math.round(r.left+i.width)-r.width-1,[s-=a.left-7,-(t.split("
").length-2)*r.width+2]}(n,t,e),function(t,e,n){Di.select(n.config.container+" #_ideogramTrackLabel").style("opacity",1).style("left",e+"px").style("top",t+"px").style("width","max-content").style("transform-origin","bottom left").style("text-align","left").on("mouseover",(function(){clearTimeout(n.hideTrackLabelTimeout)})).on("mouseout",(function(){zs(n)}))}(r,o,e)}(this,i)})).on("mouseout",(function(){zs(i)})),i.onDrawAnnotsCallback&&i.onDrawAnnotsCallback()}function Xs(t,e,n){var o,r,i,a,s,c,l,u=[];for(o=0;o0&&(r+="-"+t.stop.toLocaleString(),e&&(r+=" ("+function(t){const e=Math.abs(t.stop-t.start);return n=e,((o=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"},{value:1e12,symbol:"T"},{value:1e15,symbol:"P"},{value:1e18,symbol:"E"}].slice().reverse().find((function(t){return n>=t.value})))?(n/o.value).toFixed(void 0).replace(/\.0+$|(\.[0-9]*[1-9])0+$/,"$1")+" "+o.symbol:"0")+"bp";var n,o}(t)+")")),n=`
${r}
`,o=24,t.name&&(n=(t.displayName?t.displayName:t.name)+n,o+=8),[n,o]}(t,!0),function(t,e,n,o,r){t.html(e).style("opacity",1).style("left",n.e+"px").style("top",n.f-o+"px").style("font-family",r.config.fontFamily).style("pointer-events",null).on("mouseover",(function(){clearTimeout(r.hideAnnotTooltipTimeout)})).on("mouseout",(function(){r.startHideAnnotTooltipTimeout()}))}(i,o,n,r,c),c.onDidShowAnnotTooltipCallback&&c.onDidShowAnnotTooltipCallback()):Zs())}function ic(t){return"ideogramLabel_"+t.domId}function ac(t,e,n){Di.selectAll("._ideoActive").classed("_ideoActive",!1),Di.select("#"+e).attr("class","_ideogramLabel "+t),Di.select("#"+n+" > path").attr("class",t)}function sc(t,e){let n,o;const r=t.target,i=t.type;if(Array.from(r.classList).includes("_ideogramLabel"))n=r.id,o=r.id.split("ideogramLabel_")[1],Di.select("#"+o+" path").dispatch(i);else{const t=r.parentElement;n="ideogramLabel_"+t.id,o=t.id}"mouseout"===i&&(e.time.prevTooltipOff=performance.now(),e.time.prevTooltipAnnotDomId=o),"mouseover"===i?(clearTimeout(window._ideoActiveTimeout),ac("_ideoActive",n,o)):window._ideoActiveTimeout=window.setTimeout((function(){ac("",n,o)}),250)}function cc(t,e){var n,o=!1;return e.annots.forEach((e=>{o||e.annots.forEach((e=>{o||e.name===t&&(n=e,o=!0)}))})),n}function lc(t,e){var n,o,r,i,a,s,c,l,u,d=e.config;return null===(n=document.querySelector("#"+t.domId))?null:(o=n.getBoundingClientRect(),r=document.querySelector("#_ideogram").getBoundingClientRect(),i=Xi(t.name,e).width,i+=d.fontFamily?9:7,a=d.annotLabelSize?d.annotLabelSize:13,c=(s=o.top-r.top+a-1)+a,u=(l=o.left-r.left-i)+i,name=t.name,{top:s,bottom:c,right:u,left:l,width:i,height:a,name})}function uc(t,e,n){var o,r=this;const i=lc(o=cc(t,r),r);null!==i&&function(t,e,n){n.didSetLabelStyle||(document.querySelector("#_ideogramInnerWrap").insertAdjacentHTML("afterbegin","\n \n "),n.didSetLabelStyle=!0);const o=ic(t),r=Yi(n);let i="pink"===t.color?"#CF406B":t.color;i=Ji(i),Di.select("#_ideogram").append("text").attr("id",o).attr("class","_ideogramLabel").attr("x",e.left).attr("y",e.top).style("font",r).style("fill",i).style("pointer-events",null).html(t.name)}(o,Object.assign(i,{backgroundColor:e,borderColor:n}),r)}function dc(t=[],e=10){const n=this;t=function(t){return JSON.parse(JSON.stringify(t))}(t),n.clearAnnotLabels();let o=[];const r=[];0===t.length&&(t=n.flattenAnnots()),t.forEach(((t,e)=>{const i=lc(t,n);null!==i?r.length>0&&r.some(((t,e)=>{const n=function(t,e,n){const o=t.left-0,r=e.left-0,i=t.right+0,a=e.right+0;return o<=r&&o<=a&&i<=a&&i>=r||o>=r&&o<=a&&i>=a&&i>=r||o<=r&&o<=a&&i>=a&&i>=r||o>=r&&o<=a&&i>=r&&i<=a}(t,i),o=function(t,e,n){const o=t.top-0,r=e.top-0,i=t.bottom+0,a=e.bottom+0;return o<=r&&o<=a&&i<=a&&i>=r||o>=r&&o<=a&&i>=a&&i>=r}(t,i);return n&&o}))||(o.push(t),r.push(i)):console.debug(t.name+" has null layout")}));const i=n.config;"relatedGenesMode"in i&&["hints"].includes(i.relatedGenesMode)&&(e=20),o=o.sort(n.annotSortFunction).slice(0,e),o.reverse(),o.forEach((t=>{n.addAnnotLabel(t.name)})),Di.selectAll("._ideogramLabel, .annot").on("mouseover",(t=>sc(t))).on("mouseout",(t=>sc(t,n))).on("click",(t=>sc(t)))}function fc(t){const e=ic(cc(t,this));document.querySelector("#"+e).remove()}function hc(){document.querySelectorAll("._ideogramLabel").forEach((t=>{t.remove()}))}function pc(t){var e,n,o=!1,r=(new Date).getTime(),i=this;return e=i.chromosomes[i.config.taxid],function(t){"histogramScaling"in t.config==0&&(t.config.histogramScaling="absolute")}(i),void 0===i.maxAnnotsPerBar&&(i.maxAnnotsPerBar={},o=!0),n=function(t,e){var n,o,r,i,a,s,c,l,u=e.config.barWidth,d=[];for(s=0;s=f&&ui&&(i=l),l>o&&(o=l);n.maxAnnotsPerBar[s]=i}n.maxAnnotsPerBarAllChrs=o}}(n,o,i),n=function(t,e){var n,o,r,i,a,s,c,l=e._layout._isRotated;for(n=0;n";else if("triangle"===r){var i="";"vertical"===e.config.orientation&&(i=' transform="rotate(90, 7, 7)"'),"down"===e.config.orientation&&(i=' transform="rotate(180, 7, 7)"'),n='"}}else n='";return n}function yc(t,e,n,o,r){var i,a,s,c=vc(r);for(i=0;i'+(s=n.rows[i]).name+"",a=c*(i-1)+o+1,"name"in n&&(a+=c),e+=''+gc(s,r)+"";return[t,e]}function vc(t){return 2*$i(Xi("A",t).height)+.5}function bc(t){var e,n,o,r,i,a,s=t.config,c=vc(t);for(Di.select(s.container+" #_ideogramLegend").remove(),n=s.legend,a="",e=0;e`+i.name+""),o='',[r,o]=yc(r,o,i,s,t),a+=(o+="")+"
    "+r+"
"}var l=`font-family: ${s.fontFamily};`,u=`line-height: ${vc(t)}px;`;mc+=`#_ideogramLegend {${l} ${u}}`;var d=Di.select(s.container+" #_ideogramOuterWrap");d.append("style").html(mc),d.append("div").attr("id","_ideogramLegend").html(a)}function wc(t,e,n=!1,o=!1){var r,i,a=[],s=this,c=s.chromosomes[s.config.taxid];if(0===t.length)return void(s.annots=[]);if("annots"in t[0]||"values"in t[0])return s.drawProcessedAnnots(t,e);for(i in c)a.push({chr:i,annots:[]});a=function(t,e){var n,o,r,i;for(n=0;n2e3&&console.warn('Rendering more than 2000 annotations in Ideogram?\nTry setting "annotationsLayout" to "heatmap" or "histogram" in your Ideogram configuration object for better layout and performance.')}}(t,e),"histogram"===t&&(e=n.getHistogramBars(e)),o=function(t,e){return Di.selectAll(e.selector+" .chromosome").data(t).selectAll("path.annot").data((function(t){return t.annots})).enter()}(n.fillAnnots(e),n),"tracks"===t?function(t,e){var n,o=e.config.annotationHeight;n=function(t){var e;return{triangle:"m0,0 l -"+t+" "+2*t+" l "+2*t+" 0 z",circle:"m -"+(e=t)+", "+e+"a "+e+","+e+" 0 1,0 "+2*e+",0a "+e+","+e+" 0 1,0 -"+2*e+",0",rectangle:"m0,0 l 0 "+2*t+"l "+t+" 0l 0 -"+2*t+"z"}}(o),t.append("g").attr("id",(function(t){return t.domId})).attr("class","annot").attr("transform",(function(t){var n=e.config.chrWidth+t.trackIndex*o*2;return"translate("+t.px+","+n+")"})).append("path").attr("d",(function(t){return function(t,e){return t.shape&&"triangle"!==t.shape?"circle"===t.shape?e.circle:"rectangle"===t.shape?e.rectangle:t.shape:e.triangle}(t,n)})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t,n){e.showAnnotTooltip(n,this)})).on("mouseout",(function(){e.startHideAnnotTooltipTimeout()})).on("click",(function(t,n){e.onClickAnnot(n)}))}(o,n):"overlay"===t?function(t,e){t.append("polygon").attr("id",(function(t){return t.id})).attr("class","annot").attr("points",(function(t){var n,o,r=e.config.chrWidth;return t.stopPx-t.startPx>1?(n=t.startPx,o=t.stopPx):(n=t.px-.5,o=t.px+.5),n+","+r+" "+o+","+r+" "+o+",0 "+n+",0"})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t,n){e.showAnnotTooltip(n,this)})).on("mouseout",(function(){e.startHideAnnotTooltipTimeout()}))}(o,n):"histogram"===t&&function(t,e){var n,o,r={},i=e.config.chrWidth;for(o in n=e.chromosomes[e.config.taxid])r[o]=n[o];t.append("polygon").attr("class","annot").attr("points",(function(t){return function(t,e,n,o){var r,i,a,s;r=t.px+o.bump,i=t.px+o.config.barWidth+o.bump,a=e,s=e+t.height;var c=n[t.chr];return i>c&&(i=c),r+","+a+" "+i+","+a+" "+i+","+s+" "+r+","+s}(t,i,r,e)})).attr("fill",(function(t){return t.color}))}(o,n)}(e,t,o),o.onDrawAnnotsCallback&&o.onDrawAnnotsCallback())}function _c(t,e,n){return t.append("g").attr("class","syntenicRegion").attr("id",e).on("click",(function(){var t=this,e=Di.selectAll(n.selector+" .syntenicRegion").filter((function(){return this!==t}));e.classed("hidden",!e.classed("hidden"))})).on("mouseover",(function(){var t=this;Di.selectAll(n.selector+" .syntenicRegion").filter((function(){return this!==t})).classed("ghost",!0)})).on("mouseout",(function(){Di.selectAll(n.selector+" .syntenicRegion").classed("ghost",!1)}))}function Ac(t,e,n,o,r,i){var a,s;a="color"in i?i.color:"#CFC",s="opacity"in i?i.opacity:1,t.append("polygon").attr("points",e+", "+o.startPx+" "+e+", "+o.stopPx+" "+n+", "+r.stopPx+" "+n+", "+r.startPx).style("fill",a).style("fill-opacity",s)}function Cc(t,e,n,o,r,i){var a,s;a="color"in i?i.color:"#CFC",s="opacity"in i?i.opacity:1,t.append("polygon").attr("points",o.startPx-15+", "+e+" "+(o.stopPx-15)+", "+e+" "+(r.stopPx-15)+", "+n+" "+(r.startPx-15)+", "+n).style("fill",a).style("fill-opacity",s)}function Sc(t,e,n=null){var o,r,i,a;if(o=t.r1,r=t.r2,"string"==typeof o.chr){const t=e.config.taxids;e.config.multiorganism?(o.chr=e.chromosomes[t[0]][o.chr],r.chr=e.chromosomes[t[1]][r.chr]):(o.chr=e.chromosomes[t[0]][o.chr],r.chr=e.chromosomes[t[0]][r.chr])}var s=document.querySelector("#"+o.chr.id+"-chromosome-set"),c=s.getCTM().e,l=s.getCTM().f,u=document.querySelector("#"+r.chr.id+"-chromosome-set"),d=u.getCTM().e,f=u.getCTM().f;return null===n?"vertical"===e.config.orientation?(i=l-12,a=f-12):(i=c,a=d):(i=n,a=n),o.startPx=e.convertBpToPx(o.chr,o.start)+i,o.stopPx=e.convertBpToPx(o.chr,o.stop)+i,r.startPx=e.convertBpToPx(r.chr,r.start)+a,r.stopPx=e.convertBpToPx(r.chr,r.stop)+a,[o,r]}function Lc(t,e,n,o,r){t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.startPx).attr("y2",r.startPx),t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.stopPx).attr("y2",r.stopPx)}function Tc(t,e,n,o,r){t.append("line").attr("class","syntenyBorder").attr("x1",o.startPx-15).attr("x2",r.startPx-15).attr("y1",e).attr("y2",n),t.append("line").attr("class","syntenyBorder").attr("x1",o.stopPx-15).attr("x2",r.stopPx-15).attr("y1",e).attr("y2",n)}function kc(t,e,n,o,r,i){var a,s;Math.abs(o.startPx-o.startPx)<2&&Math.abs(o.stopPx-o.stopPx)<2?(a=i.color,s=i.width):(a="",s=""),t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.startPx).attr("y2",r.startPx).style("stroke",a).style("stroke-width",s),t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.stopPx).attr("y2",r.stopPx).style("stroke",a).style("stroke-width",a)}function Mc(t,e,n,o,r,i){var a=i.split("__").map((t=>"label_"+t));if("name"in o){t.append("text").attr("id",a[0]).attr("y",o.startPx+3).text(o.name);var s=document.querySelector("#"+a[0]).getBoundingClientRect().width;Di.select("#"+a[0]).attr("x",e-15-s)}"name"in r&&t.append("text").attr("id",a[1]).text(r.name).attr("x",n+15).attr("y",r.startPx+3).text(r.name)}function Ec(t){var e=(new Date).getTime(),n=this,o=n.config;if(n.syntenicRegions=t,o.multiorganism&&"collinear"===o.geometry)return"vertical"===o.orientation?function(t,e){var n=(new Date).getTime();(function(t,e,n){var o,r,i,a,s,c,l,u;for(o=0;oc&&(c=s+1),i.splice(4,0,s),a.push(i);l.push({chr:r.chr,annots:a})}return e.numAvailTracks=c,l}(t.annots,o),e.splice(4,0,"trackIndexOriginal"),t={keys:e,annots:n},o.rawAnnots.metadata&&(t.metadata=o.rawAnnots.metadata)),t}var Fc=[["F00"],["F00","88F"],["F00","CCC","88F"],["F00","FA0","0AF","88F"],["F00","FA0","CCC","0AF","88F"],["F00","FA0","875","578","0AF","88F"],["F00","FA0","875","CCC","578","0AF","88F"],["F00","FA0","7A0","875","0A7","578","0AF","88F"],["F00","FA0","7A0","875","CCC","0A7","578","0AF","88F"],["F00","FA0","7A0","875","552","255","0A7","578","0AF","88F"]];function Bc(t,e,n,o,r,i,a){return a.config.annotationTracks?r=function(t,e,n,o,r){var i;return e.trackIndex=n[3],(i=r.config.annotationTracks[e.trackIndex]).color&&(e.color=i.color),i.shape&&(e.shape=i.shape),t[o].annots.push(e),t}(r,t,n,i,a):"trackIndex"===e[3]&&1!==a.numAvailTracks?[r,o]=function(t,e,n,o,r,i){var a=Fc[i.numAvailTracks-1];return t.trackIndex=e[3],t.trackIndexOriginal=e[4],t.color="#"+a[t.trackIndexOriginal],t.trackIndex>i.config.numTracks-1?(t.trackIndex in n?n[t.trackIndex].push(t):n[t.trackIndex]=[t],[o,n]):(o[r].annots.push(t),[o,n])}(t,n,o,r,i,a):r=function(t,e,n,o){return e.trackIndex=0,e.color||(e.color=o.config.annotationsColor),e.shape||(e.shape="triangle"),t[n].annots.push(e),t}(r,t,i,a),[r,o]}function Ic(t,e){return"_c"+t+"_a"+e}function $c(t,e,n,o,r,i,a){var s,c,l,u;const d=!a.config.annotationsLayout||"tracks"===a.config.annotationsLayout;for(s=0;s-a.annotSortFunction(t,e)))):t[r].annots.sort(((t,e)=>t[1]-e[1])),s=0;s10&&console.error("Ideogram only displays up to 10 tracks at a time. You specified "+r+" tracks. Perhaps consider a different way to visualize your data."),(n=Object.keys(t).length)&&console.warn("Ideogram configuration specified "+r+" tracks, but loaded annotations contain "+n+" extra tracks.")}(o,r),n}class Hc{constructor(t,e){this.matrix=t,this.ideo=e}setRawAnnots(){var t,e,n;return t=this,e=this.ideo,n=this.matrix,new Promise((function(o){t.rawAnnots=t.fetchCoordinates(e).then((function(r){t.coordinates=r,o(t.parseExpressionMatrix(n,e))}))}))}fetchCoordinates(t){var e={};if("human"===t.config.organism){var n=t.config.dataDir+"../../annotations/Homo_sapiens,_Ensembl_80.tsv";return new Promise((function(o){t.fetch(n,"text").then((function(t){var n,r,i,a,s,c,l;for(n=t.split(/\r\n|\n/).slice(1),r=0;rparseFloat(t))),[o,r,length]=this.coordinates[i],-1===(n=e.indexOf(o))?[null,null]:[n,[i,r,length].concat(a)])}parseExpressionMatrix(t,e){var n,o,r,i,a,s,c=[],l=t.split(/\r\n|\n/);for(o=Object.keys(e.chromosomes[e.config.taxid]),n=0;n{n.annots.forEach((n=>{const o=t.annotDescriptions.annots[n.name];e[n.name]=[n.name,o.ensemblId,n.chr,n.start,n.stop,n.length,o.type]}))}));const n=[["# Gene name","Ensembl ID","Chromosome","Start","Stop","Length","Type"]].concat(Object.values(e)),o=t.annotDescriptions.headers+"\n#\n"+n.map((t=>t.join("\t"))).join("\n"),r="data:text/plain;charset=utf-8,"+encodeURIComponent(o);var i=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),a=document.createElement("a");a.setAttribute("download","ideogram.tsv"),a.setAttribute("href",r),a.setAttribute("target","_blank"),a.setAttribute("id","_ideo-undisplayed-dl-annots-link"),a.setAttribute("style","display: none;"),document.body.appendChild(a),a.dispatchEvent(i)}function Wc(){var t=this,e=t.config;!function(t){var e,n=t.config;n.annotationHeight||("heatmap"===n.annotationsLayout?e=n.chrWidth-1:(e=Math.round(n.chrHeight/100))<3&&(e=3),t.config.annotationHeight=e)}(t),e.annotationsPath||e.localAnnotationsPath||t.annots||e.annotations?function(t,e){e.annotationTracks?t.config.numAnnotTracks=e.annotationTracks.length:e.annotationsNumTracks?t.config.numAnnotTracks=e.annotationsNumTracks:t.config.numAnnotTracks=1,t.config.annotTracksHeight=e.annotationHeight*e.numAnnotTracks,void 0===e.barWidth&&(t.config.barWidth=3)}(t,e):(t.config.annotTracksHeight=0,t.config.numAnnotTracks=0),void 0===e.annotationsColor&&(t.config.annotationsColor="#F00"),e.onClickAnnot&&(t.onClickAnnotCallback=e.onClickAnnot),function(t,e){!1!==e.showAnnotTooltip&&(t.config.showAnnotTooltip=!0),e.onWillShowAnnotTooltip&&(t.onWillShowAnnotTooltipCallback=e.onWillShowAnnotTooltip),e.onDidShowAnnotTooltip&&(t.onDidShowAnnotTooltipCallback=e.onDidShowAnnotTooltip)}(t,e),function(t,e){!1!==e.addAnnotLabel&&(t.config.addAnnotLabel=!0),e.onWillAddAnnotLabel&&(t.onWillAddAnnotLabelCallback=e.onWillAddAnnotLabel)}(t,e)}function jc(){var t=this,e=t.config;t.rawAnnots.annots=t.rawAnnots.annots.sort(Ideogram.sortChromosomes),t.onLoadAnnotsCallback&&t.onLoadAnnotsCallback(),("heatmapThresholds"in e||"metadata"in t.rawAnnots&&"heatmapThresholds"in t.rawAnnots.metadata)&&("heatmap"===e.annotationsLayout?function(t){var e,n,o,r,i,a,s=t.config.heatmapThresholds;for(o=[],n=(i=t.rawAnnots).keys.slice(3),r=[],a=[],!i.metadata&&isNaN(s[0])||(s=Os(t)),e=0;et.chr));if(o.forEach((t=>{t in e&&n.push(t),e[t]=1})),n.length>0)throw Error(`Duplicate chromosomes detected.\nChromosome list: ${o}. Duplicates: ${n}.\nTo fix this, edit your raw annotations JSON data to remove redundant chromosomes.`)}(t)}function qc(){return this.annots.reduce(((t,e)=>[...t,...e.annots]),[])}function zc(t){var e,n=this,o=n.config;e="heatmap-2d"===o.annotationsLayout;var r=function(t){var e,n;return n=(e=t.split("?")[0].split("."))[e.length-1],!1===["bed","json","tsv"].includes(n)?(n=n.toUpperCase(),void alert("Ideogram.js only supports BED and Ideogram JSON and TSV at the moment. Sorry, check back soon for "+n+" support!")):n}(t);"http"===t.slice(0,4)||e||"tsv"===r?(r=e?"":r,n.fetch(t,"text").then((function(t){n.rawAnnotsResponse=t,e?new Hc(t,n).setRawAnnots().then((function(t){n.rawAnnots=t,n.afterRawAnnots()})):(n.rawAnnots="tsv"===r?new Fs(t,n).rawAnnots:"bed"===r?new Ns(t,n).rawAnnots:JSON.parse(t),n.afterRawAnnots())}))):n.fetch(t).then((function(t){n.rawAnnotsResponse=t,n.rawAnnots=t,n.afterRawAnnots()}))}function Uc(t){var e,n,o,r,i,a,s;for(e=[],n=[],o=this.chromosomesArray,r=0;r(n.includes(t.name)?t.rank=n.indexOf(t.name)+1:t.rank=1e10,t)))}return t.map((t=>(t.rank=t.initRank,t)))}function Yc(t,e="red"){const n=this,o=n.config.taxid,r=t.map((t=>{const r=n.chromosomes[o][t].id,i=`${n.selector} #${r}-chromosome-set`,a=document.querySelector(i),s=a.getBoundingClientRect();return``})).join();document.querySelector(n.selector).insertAdjacentHTML("afterBegin",r)}function Xc(t){const e=this;let n=`${e.selector} .ideo-highlight`;if(void 0!==t){const o=e.config.taxid;n=t.map((t=>{const n=e.chromosomes[o][t].id;return`${e.selector} #ideo-highlight-${n}`}))}document.querySelectorAll(n).forEach((t=>{t.remove()}))}var Kc="&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",Qc="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/",Jc=Qc+"esearch.fcgi?retmode=json"+Kc,Zc=Qc+"esummary.fcgi?retmode=json"+Kc,tl=Qc+"elink.fcgi?retmode=json"+Kc;function el(t,e){var n,o;return n=e.esearch+"&db=taxonomy&term="+t,Di.json(n).then((function(e){if(0===e.esearchresult.idlist.length)throw'Organism "'+t+"\" is generally unknown; it was not found in the NCBI Taxonomy database. If you did not intend to specify a novel or custom taxon, then try using the organism's scientific name, e.g. Homo sapiens or Arabidopsis thaliana.";return o=e.esearchresult.idlist[0],[t,o]}))}function nl(t,e){var n,o,r=this;t=r.config.organism,o=r.esummary+"&db=taxonomy&id="+t,Di.json(o).then((function(o){return n=o.result[String(t)].commonname,r.config.organism=n,e(n)}))}function ol(t,e,n){var o,r,i,a,s,c=n.config;(function(t,e){var n,o,r;if(e.assemblyIsAccession())return new Promise((function(n){e.coordinateSystem="bp",e.getAssemblyAndChromosomesFromEutils(t,n)}));n=e.config.dataDir,o=zi(e.organisms[t].scientificName),r=[t],["9606","10090","10116"].includes(t)&&!e.config.showFullyBanded&&(o+="-no-bands");var i=n+o+".json",a=new Promise(((t,e)=>Bi(i).then((e=>e.json().then((function(e){t(e)})))).catch((t=>{e(t)}))));return a.then((function(n){var o,i,a,s,c=n.chrBands,l=[""],u=[],d={};e.bandData[n.taxid]=c;for(var f=0;f{t.length>i.bp&&(i.bp=t.length)})),e.maxLength[t]=i,l.push(u),l.push(r),l}),(function(){return new Promise((function(n){e.coordinateSystem="bp",e.getAssemblyAndChromosomesFromEutils(t,n)}))}))})(t,n).then((function(l){o=l[0],r=l[1],"chromosomes"in c==0||null===c.chromosomes?(n.config.chromosomes={},n.config.chromosomes[t]=r):(c.multiorganism?t in c.chromosomes?i=c.chromosomes[t]:(a=zi(n.getScientificName(t)),n.config.chromosomes[t]=c.chromosomes[a].slice(),i=n.config.chromosomes[t]):i=c.chromosomes,s=r.filter((t=>i.includes(t.name))),n.config.chromosomes[t]=s),n.chromosomes[t]=n.config.chromosomes[t].slice(),n.organisms[t].assemblies={default:o},e()}))}function rl(t,e){var n,o;for(n in e.organisms)if(o=e.organisms[n],n===zi(t)||zi(o.commonName)===zi(t)||zi(o.scientificName)===zi(t))return!0;return!1}function il(t,e){(function(t){var e,n,o,r,i,a=t.config;return e=[],n={},function(t,e){var n,o,r,i=[],a={};for(r=0;rzi(t))),i.includes(zi(s.scientificName))?o=s.scientificName:i.includes(zi(s.commonName))&&(o=s.commonName),zi(o)in a.chromosomes?n[r]=a.chromosomes[zi(o)]:n[r]=a.chromosomes[o.toLowerCase()]):n=null);return[n,e]}))})(e).then((function([n,o]){var r,i,a,s,c,l=e.config,u=[];for(r=0;r{t.length>a.bp&&(a.bp=t.length)})),a.bp>n.maxLength.bp&&(n.maxLength.bp=a.bp),n.maxLength[e]=a,n.coordinateSystem="bp",c}(r.result,t,o);return e([n,i])}),(function(t){console.warn(t)}))}function ll(){var t=this,e=t.bandsToShow.join(",");0!==t.bandsToShow.length&&(Di.selectAll(t.selector+" .bandLabel, .bandLabelStalk").style("display","none"),Di.selectAll(e).style("display",""))}function ul(t,e,n,o,r){return e!==n&&(t=o[r.id][n]+36),t}function dl(t,e,n,o,r,i,a){var s,c;return n"pter"!==t.name)),s=a.drawBandLabelText(n,i,o,s),a.drawBandLabelStalk(n,i,o,s);a.setBandsToShow(r,s)}function yl(t,e){return[e[t][0],e[t][1],e[t][2],e[t][3]]}function vl(){var t="";return t=function(t){var e,n,o,r,i,a="";for(e=0;e',a+="gneg"===n?'':'',a+="";return a}(aa),``+(t+=' ')+""}function bl(t,e,n){var o,r,i;return(o=e[0])in t==0&&(t[o]=[]),r=function(t){var e=t[7];return t[8]&&(e+=t[8]),e}(e),i=function(t,e,n,o){return{chr:t,bp:{start:parseInt(e[5],10),stop:parseInt(e[6],10)},iscn:{start:parseInt(e[3],10),stop:parseInt(e[4],10)},px:{start:-1,stop:-1,width:-1},name:e[1]+e[2],stain:n,taxid:o}}(o,e,r,n),t[o].push(i),t}function wl(t,e,n,o){var r,i,a=o.config.multiorganism;return null!=t&&(i=(r=Array.isArray(t))&&-1===t.indexOf(e),!(!r||"object"==typeof t||!i)||(n in t!=0||!a)&&(a?"string"==typeof t[n][0]?!1===t[n].includes(e):0===t[n].filter((t=>t.name===e)).length:0===t.filter((t=>t===e)).length))}function xl(t,e,n,o){var r,i,a=[];return r=e[t],a.push(r),i={iscn:r[r.length-1].iscn.stop,bp:r[r.length-1].bp.stop},n in o.maxLength==0&&(o.maxLength[n]={bp:0,iscn:0}),i.iscn>o.maxLength[n].iscn&&(o.maxLength[n].iscn=i.iscn,i.iscn>o.maxLength.iscn&&(o.maxLength.iscn=i.iscn)),i.bp>o.maxLength[n].bp&&(o.maxLength[n].bp=i.bp,i.bp>o.maxLength.bp&&(o.maxLength.bp=i.bp)),a}function _l(t,e,n,o){var r,i;if(t in o.bandData||t in Pi&&!1===o.assemblyIsAccession())n=function(t,e,n,o){var r,i,a;r=function(t,e,n){var o,r,i,a,s,c,l={};c=n.bandData[t],Array.isArray(c)&&(s="native"),e=function(t){var e,n;if(t instanceof Array&&"object"==typeof t[0]){for(e=[],n=0;n0&&(o.config.chromosomes[t]=e.slice()),o.numChromosomes+=o.config.chromosomes[t].length;for(i=0;io.maxLength.bp&&(o.maxLength.bp=r.length);return n}function Al(t){var e,n,o=this,r=o.config,i=(new Date).getTime();return e=[],"chromosomes"in r&&(n=r.multiorganism?r.chromosomes:t in r.chromosomes?r.chromosomes[t].slice():r.chromosomes.slice()),e=_l(t,n,e,o),function(t,e){var n=(new Date).getTime();e.config.debug&&console.log("Time in processBandData: "+(n-t)+" ms")}(i,o),[t,e]}function Cl(){call(this.onBrushMoveCallback)}function Sl(){call(this.onBrushEndCallback)}function Ll(t,e,n){var o,r,i,a,s=this,c=s.config.chrWidth+6.5,l=s._layout.margin.left;[t,e,n]=function(t,e,n){var o,r;return o=t.split(":"),r=t.split("-"),o.length>1&&r.length>1&&(t=o[0].replace("chr",""),r=o[1].split("-"),e=parseInt(r[0]),n=parseInt(r[1]-1)),[t,e,n]}(t,e,n),o=function(t,e){var n,o;for(n=0;n1||"MT"===t.name){if([o,n]=function(t,e){var n,o,r,i,a,s,c,l,u;for(n=0;n=a&&e<=s)return[l+u*(r+i/c*(e-a)-r)/i,o];return[null,o]}(t,e),null!==o)return o}else if(e>=1&&e<=t.length)return t.scale.bp*e;!function(t,e,n){throw new Error("Base pair out of range. bp: "+t+"; length of chr"+e.name+": "+n.bp.stop)}(e,t,n)}function Dl(t,e,n,o,r,i,a){var s,c,l,u;return a=t-e,s=o-r,c=i.bp.stop-i.bp.start,l=e+a/s*(n-r),u=i.bp.start+c*(l-e)/a,Math.round(u)}function Nl(t,e){var n,o,r,i,a,s;for(0===e&&(e=t.bands[0].px.start),n=0;n=r&&e<=i)return Dl(s,a,e,i,r,o,void 0);!function(t,e,n){throw new Error("Pixel out of range. px: "+t+"; length of chr"+e.name+": "+n)}(e,t,i)}let Fl=Rl,Bl=Rl,Il=Rl,$l=Hl,Ol=Gl;function Rl(t){for(var e=new Array(t),n=-1;++n32)throw new Error("invalid array width!");return t}function Wl(t){this.length=t,this.subarrays=1,this.width=8,this.masks={0:0},this[0]=Fl(t)}"undefined"!=typeof Uint8Array&&(Fl=function(t){return new Uint8Array(t)},Bl=function(t){return new Uint16Array(t)},Il=function(t){return new Uint32Array(t)},$l=function(t,e){if(t.length>=e)return t;var n=new t.constructor(e);return n.set(t),n},Ol=function(t,e){var n;switch(e){case 16:n=Bl(t.length);break;case 32:n=Il(t.length);break;default:throw new Error("invalid array width!")}return n.set(t),n}),Wl.prototype.lengthen=function(t){var e,n;for(e=0,n=this.subarrays;e>>0,!((e=this.width-32*o)>=32)||n)return e<32&&n&1<=t;o--)this[e][o]=0;this.length=t},Wl.prototype.zero=function(t){var e,n;for(e=0,n=this.subarrays;e[0,t.length],zl=t=>t,Ul=()=>null,Vl=()=>0;function Yl(t){function e(t,e,o){for(var r=o-e,i=1+(r>>>1);--i>0;)n(t,i,r,e);return t}function n(e,n,o,r){for(var i,a=e[--r+n],s=t(a);(i=n<<1)<=o&&(it(e[r+i+1])&&i++,!(s<=t(e[r+i])));)e[r+n]=e[r+i],n=i;e[r+n]=a}return e.sort=function(t,e,o){for(var r,i=o-e;--i>0;)r=t[e],t[e]=t[e+i],t[e+i]=r,n(t,1,i,e);return t},e}const Xl=Yl(zl);Xl.by=Yl;const Kl=Xl;function Ql(t){var e=Kl.by(t);return function(n,o,r,i){var a,s,c,l=new Array(i=Math.min(r-o,i));for(s=0;sa&&(l[0]=c,a=t(e(l,0,i)[0]))}while(++o>>1;n>>1;t(e[i]){for(var o=0,r=e.length,i=n?JSON.parse(JSON.stringify(t)):new Array(r);ot+1,iu=t=>t-1,au=t=>function(e,n){return e+ +t(n)},su=t=>function(e,n){return e-t(n)},cu=(t,e)=>{const n=t[e];return"function"==typeof n?n.call(t):n},lu=/\[([\w\d]+)\]/g;var uu=-1;fu.heap=Kl,fu.heapselect=Zl,fu.bisect=nu,fu.permute=ou;const du=fu;function fu(){var t,e={add:c,remove:function(e){for(var i=new Array(o),s=[],c="function"==typeof e,l=function(o){return c?e(n[o],o):t.zero(o)},d=0,f=0;d0&&(c=o);--a>=E&&e>0;)t.zero(r=m[a])&&(c>0?--c:(i.push(n[r]),--e));if(s)for(a=0;a0;a++)t.zero(r=S[a])&&(c>0?--c:(i.push(n[r]),--e));return i},bottom:function(e,o){var r,i,a=[],c=0;if(o&&o>0&&(c=o),s)for(r=0;r0;r++)t.zero(i=S[r])&&(c>0?--c:(a.push(n[i]),--e));for(r=E;r0;)t.zero(i=m[r])&&(c>0?--c:(a.push(n[i]),--e)),r++;return a},group:j,groupAll:function(){var t=j(Ul),e=t.all;return delete t.all,delete t.top,delete t.order,delete t.orderNatural,delete t.size,t.value=function(){return e()[0].value},t},dispose:q,remove:q,accessor:e,id:function(){return h}},S=[],L=function(t){return pu(t).sort((function(t,e){var n=g[t],o=g[e];return no?1:t-e}))},T=ql,k=[],M=[],E=0,P=0,D=0;i.unshift(F),i.push(B),a.push(I);var N=t.add();function F(n,r,i){var a,c;if(s){D=0,W=0,A=[];for(var u=0;uE)for(i=E,a=Math.min(n,P);iP)for(i=Math.max(n,P),a=o;ifunction(n){var o=n.length;return[t.left(n,e,0,o),t.right(n,e,0,o)]})(nu,t))(p))}function R(t){return x=t,_=!0,$((T=((t,e)=>{var n=e[0],o=e[1];return function(e){var r=e.length;return[t.left(e,n,0,r),t.left(e,o,0,r)]}})(nu,t))(p))}function H(){return x=void 0,_=!1,$((T=ql)(p))}function G(t){x=t,_=!0,w=t,T=ql,W(t,!1);var e=T(p);return E=e[0],P=e[1],C}function W(e,n){var o,i,a,c=[],h=[],g=[],y=[],w=p.length;if(!s)for(o=0;o1?jl.arrayLengthen(u,o):hu(o,_),G&&(k=(g=I[0]).key);j=M);)++j;for(;j=h));)M=e(i[j]);z()}for(;WW)if(s)for(W=0;W1||s?(C=D,S=F):(!A&&T&&(A=1,c=[{key:null,value:H()}]),1===A?(C=N,S=B):(C=Ul,S=Ul),u=null),r[m]=C}function P(t){if(A>1||s){var e,n,i,a=A,l=c,d=hu(a,a);if(s){for(e=0,i=0;e1||s)if(s)for(e=0;e1||s?(S=F,C=D):1===A?(S=B,C=N):S=C=Ul}else if(1===A){if(T)return;for(var f=0;f=0&&r.splice(t,1),(t=k.indexOf(E))>=0&&k.splice(t,1),(t=a.indexOf(P))>=0&&a.splice(t,1),(t=M.indexOf(i))>=0&&M.splice(t,1),i}return arguments.length<1&&(e=zl),r.push(C),k.push(E),a.push(P),E(p,m,0,o),O().orderNatural()}function q(){M.forEach((function(t){t.dispose()}));var e=i.indexOf(F);return e>=0&&i.splice(e,1),(e=i.indexOf(B))>=0&&i.splice(e,1),(e=a.indexOf(I))>=0&&a.splice(e,1),t.masks[f]&=d,H()}return f=N.offset,l=N.one,d=~l,h=f<<7|Math.log(l)/Math.log(2),F(n,0,o),B(0,0,o),C},groupAll:function(){var e,a,s,c,l={reduce:h,reduceCount:p,reduceSum:function(t){return h(au(t),su(t),Vl)},value:function(){return u&&(function(){var r;for(e=c(),r=0;r=0&&r.splice(t,1),(t=i.indexOf(d))>=0&&i.splice(t,1),l}return r.push(f),i.push(d),d(0,0),p()},size:function(){return o},all:function(){return n},allFiltered:function(e){var r=[],i=0,a=l(e||[]);for(i=0;i>7]&=~(1<<(63&i));return a}function u(t){for(var e=0;e{t.classList.remove("active")}))}function Su(){Cu(document.querySelectorAll("#tools > ul > li")),document.querySelectorAll(".ideo-modal, .ideo-tool-panel").forEach((t=>{t.remove()})),document.querySelector("#tools").style.display="none"}function Lu(t){const e=document.querySelectorAll("#tools > ul > li");e.forEach((n=>{const o=function(t){return Array.from(t.classList).includes("ideo-tool-hover")?"mouseenter":"click"}(n);n.addEventListener(o,(r=>{Cu(e),n.classList+=" active";const i=n.id.split("-")[0],s=function(t,e){var n;return"download"===t&&(n=`\n
\n
  • Image
  • \n
  • 0?"":"ideo-disabled"}">Annotations
  • \n
    \n `),"about"===t&&(n=`\n
    \n \n \n Ideogram.js, version ${a} x
    \n Chromosome visualization for the web\n
    `),n.trim()}(i);"mouseenter"===o?(n.insertAdjacentHTML("beforeend",s),function(t,e,n,o){"mouseenter"===t&&n.addEventListener("mouseleave",(t=>{const n=t.toElement,r=n.id,i=document.querySelector(".ideo-tool-panel");document.querySelector("#tools").contains(n)&&i&&!i.contains(n)&&r!==e&&(Cu(o),i.remove())}))}(o,i,n,e),"download"===i&&(document.querySelector("#download-image").addEventListener("click",(e=>{Su(),function(t){var e=document.querySelector(t.selector),n="_ideo-undisplayed-dl-canvas";(o=document.createElement("canvas")).setAttribute("style","display: none"),o.setAttribute("id",n);var o,r=e.width.baseVal.value+30,i=e.cloneNode(!0);i.style.left="",o.setAttribute("width",r),document.body.appendChild(o),(o=document.getElementById(n)).width*=2,o.height*=2;var a=o.getContext("2d");a.setTransform(2,0,0,2,0,0),a.imageSmoothingEnabled=!1;var s=(new XMLSerializer).serializeToString(i),c=window.URL||window.webkitURL||window,l=new Image,u=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),d=c.createObjectURL(u);l.onload=function(){var t,e,n;a.drawImage(l,0,0),c.revokeObjectURL(d),t=o.toDataURL("image/png").replace("image/png","image/octet-stream"),e=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),(n=document.createElement("a")).setAttribute("download","ideogram.png"),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.setAttribute("id","_ideo-undisplayed-dl-image-link"),n.setAttribute("style","display: none;"),document.body.appendChild(n),n.dispatchEvent(e),o.remove()},l.src=d}(t)})),document.querySelector("#download-annots").addEventListener("click",(e=>{const n=document.querySelector("#download-annots");!1===Array.from(n.classList).includes("ideo-disabled")&&(Su(),t.downloadAnnotations())})))):document.querySelector("#gear").insertAdjacentHTML("beforeend",s)}))})),document.querySelectorAll("#close").forEach((t=>{t.addEventListener("click",(()=>{Su()}))}))}function Tu(t){const e=`\n ${_u}\n \n `;document.querySelector(t.selector).insertAdjacentHTML("beforebegin",e),function(t){document.querySelector("#gear").addEventListener("click",(t=>{var e=document.querySelector("#tools");"none"===e.style.display?(e.style.display="",function(t){const e=document.querySelectorAll("#gear, #tools"),n=t=>{let n=0;e.forEach((e=>{e.contains(t.target)||(n+=1)})),n===e.length&&(Su(),o())},o=()=>{document.removeEventListener("click",n)};document.addEventListener("click",n)}()):(e.style.display="none",Su())})),Lu(t)}(t),function(t){const e=document.querySelector(t.selector),n=document.querySelector("#gear"),o=document.querySelector("#tools");e.addEventListener("mouseover",(()=>n.style.display="")),e.addEventListener("mouseout",(()=>{"none"===o.style.display&&(n.style.display="none")})),n.addEventListener("mouseover",(()=>n.style.display=""))}(t)}class ku{constructor(t){this._model=t,this._class="ModelAdapter"}static getInstance(t){return t.bands?new ku(t):new Mu(t)}getModel(){return this._model}getCssClass(){return""}}class Mu extends ku{constructor(t){super(t),this._class="ModelNoBandsAdapter"}getModel(){this._model.bands=[];const t="MT"===this._model.name,e=this._model.width;return(e>1||t)&&this._model.bands.push({name:"q",px:{start:0,stop:e,width:e},bp:{start:1,stop:this._model.bpLength??this._model.length},iscn:{start:1,stop:this._model.length}}),this._model}getCssClass(){return"noBands"}}class Eu{constructor(t){this._config=t,this._ploidy=new ls(this._config)}getArmColor(t,e,n){return this._config.armColors?this._config.armColors[n]:this._config.ancestors?this._getPolyploidArmColor(t,e,n):null}getBorderColor(t,e,n){const o=this._config,r=o.chrBorderColor?o.chrBorderColor:"#000";return e1&&(o=this._ploidy.getChromosomesNumber(e)),i=0;i1||""===e.orientation)&&(t-=1),t}(e,s),r=-4,!0===s.showBandLabels&&(r=s.chrMargin+s.chrWidth+26),i=s.chrMargin*e,s.numAnnotTracks>1==0&&(i+=1),a=i+r,t.selectAll("text.chrLabel").attr("transform",n.scaleSvg).selectAll("tspan").attr("x",n.x).attr("y",a)}(t,e,r,this):function(t,e,n,o){var r,i,a,s=o.config;r=-s.chrWidth-2,!0===s.showBandLabels&&(r=s.chrMargin+8),i=s.annotTracksHeight,"overlay"!==s.annotationsLayout&&(i*=2),a=3-(s.chrMargin*e+r)+i,a/=n.scale.x,t.selectAll("text.chrLabel").attr("transform","rotate(-90)"+n.scaleSvg).selectAll("tspan").attr("x",a).attr("y",n.y)}(t,e,r,this)}function Wu(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function ju(t){return t instanceof Wu(t).Element||t instanceof Element}function qu(t){return t instanceof Wu(t).HTMLElement||t instanceof HTMLElement}function zu(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Wu(t).ShadowRoot||t instanceof ShadowRoot)}var Uu=Math.max,Vu=Math.min,Yu=Math.round;function Xu(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Ku(){return!/^((?!chrome|android).)*safari/i.test(Xu())}function Qu(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&qu(t)&&(r=t.offsetWidth>0&&Yu(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&Yu(o.height)/t.offsetHeight||1);var a=(ju(t)?Wu(t):window).visualViewport,s=!Ku()&&n,c=(o.left+(s&&a?a.offsetLeft:0))/r,l=(o.top+(s&&a?a.offsetTop:0))/i,u=o.width/r,d=o.height/i;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function Ju(t){var e=Wu(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Zu(t){return t?(t.nodeName||"").toLowerCase():null}function td(t){return((ju(t)?t.ownerDocument:t.document)||window.document).documentElement}function ed(t){return Qu(td(t)).left+Ju(t).scrollLeft}function nd(t){return Wu(t).getComputedStyle(t)}function od(t){var e=nd(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function rd(t,e,n){void 0===n&&(n=!1);var o,r,i=qu(e),a=qu(e)&&function(t){var e=t.getBoundingClientRect(),n=Yu(e.width)/t.offsetWidth||1,o=Yu(e.height)/t.offsetHeight||1;return 1!==n||1!==o}(e),s=td(e),c=Qu(t,a,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(i||!i&&!n)&&(("body"!==Zu(e)||od(s))&&(l=(o=e)!==Wu(o)&&qu(o)?{scrollLeft:(r=o).scrollLeft,scrollTop:r.scrollTop}:Ju(o)),qu(e)?((u=Qu(e,!0)).x+=e.clientLeft,u.y+=e.clientTop):s&&(u.x=ed(s))),{x:c.left+l.scrollLeft-u.x,y:c.top+l.scrollTop-u.y,width:c.width,height:c.height}}function id(t){var e=Qu(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function ad(t){return"html"===Zu(t)?t:t.assignedSlot||t.parentNode||(zu(t)?t.host:null)||td(t)}function sd(t){return["html","body","#document"].indexOf(Zu(t))>=0?t.ownerDocument.body:qu(t)&&od(t)?t:sd(ad(t))}function cd(t,e){var n;void 0===e&&(e=[]);var o=sd(t),r=o===(null==(n=t.ownerDocument)?void 0:n.body),i=Wu(o),a=r?[i].concat(i.visualViewport||[],od(o)?o:[]):o,s=e.concat(a);return r?s:s.concat(cd(ad(a)))}function ld(t){return["table","td","th"].indexOf(Zu(t))>=0}function ud(t){return qu(t)&&"fixed"!==nd(t).position?t.offsetParent:null}function dd(t){for(var e=Wu(t),n=ud(t);n&&ld(n)&&"static"===nd(n).position;)n=ud(n);return n&&("html"===Zu(n)||"body"===Zu(n)&&"static"===nd(n).position)?e:n||function(t){var e=/firefox/i.test(Xu());if(/Trident/i.test(Xu())&&qu(t)&&"fixed"===nd(t).position)return null;var n=ad(t);for(zu(n)&&(n=n.host);qu(n)&&["html","body"].indexOf(Zu(n))<0;){var o=nd(n);if("none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||-1!==["transform","perspective"].indexOf(o.willChange)||e&&"filter"===o.willChange||e&&o.filter&&"none"!==o.filter)return n;n=n.parentNode}return null}(t)||e}var fd="top",hd="bottom",pd="right",md="left",gd="auto",yd=[fd,hd,pd,md],vd="start",bd="end",wd="viewport",xd="popper",_d=yd.reduce((function(t,e){return t.concat([e+"-"+vd,e+"-"+bd])}),[]),Ad=[].concat(yd,[gd]).reduce((function(t,e){return t.concat([e,e+"-"+vd,e+"-"+bd])}),[]),Cd=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Sd(t){var e=new Map,n=new Set,o=[];function r(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var o=e.get(t);o&&r(o)}})),o.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||r(t)})),o}var Ld={placement:"bottom",modifiers:[],strategy:"absolute"};function Td(){for(var t=arguments.length,e=new Array(t),n=0;n=0?"x":"y"}function Nd(t){var e,n=t.reference,o=t.element,r=t.placement,i=r?Ed(r):null,a=r?Pd(r):null,s=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2;switch(i){case fd:e={x:s,y:n.y-o.height};break;case hd:e={x:s,y:n.y+n.height};break;case pd:e={x:n.x+n.width,y:c};break;case md:e={x:n.x-o.width,y:c};break;default:e={x:n.x,y:n.y}}var l=i?Dd(i):null;if(null!=l){var u="y"===l?"height":"width";switch(a){case vd:e[l]=e[l]-(n[u]/2-o[u]/2);break;case bd:e[l]=e[l]+(n[u]/2-o[u]/2)}}return e}var Fd={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Bd(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,a=t.offsets,s=t.position,c=t.gpuAcceleration,l=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=a.x,h=void 0===f?0:f,p=a.y,m=void 0===p?0:p,g="function"==typeof u?u({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var y=a.hasOwnProperty("x"),v=a.hasOwnProperty("y"),b=md,w=fd,x=window;if(l){var _=dd(n),A="clientHeight",C="clientWidth";_===Wu(n)&&"static"!==nd(_=td(n)).position&&"absolute"===s&&(A="scrollHeight",C="scrollWidth"),(r===fd||(r===md||r===pd)&&i===bd)&&(w=hd,m-=(d&&_===x&&x.visualViewport?x.visualViewport.height:_[A])-o.height,m*=c?1:-1),r!==md&&(r!==fd&&r!==hd||i!==bd)||(b=pd,h-=(d&&_===x&&x.visualViewport?x.visualViewport.width:_[C])-o.width,h*=c?1:-1)}var S,L=Object.assign({position:s},l&&Fd),T=!0===u?function(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:Yu(n*r)/r||0,y:Yu(o*r)/r||0}}({x:h,y:m},Wu(n)):{x:h,y:m};return h=T.x,m=T.y,c?Object.assign({},L,((S={})[w]=v?"0":"",S[b]=y?"0":"",S.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",S)):Object.assign({},L,((e={})[w]=v?m+"px":"",e[b]=y?h+"px":"",e.transform="",e))}const Id={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},o=e.attributes[t]||{},r=e.elements[t];qu(r)&&Zu(r)&&(Object.assign(r.style,n),Object.keys(o).forEach((function(t){var e=o[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var o=e.elements[t],r=e.attributes[t]||{},i=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});qu(o)&&Zu(o)&&(Object.assign(o.style,i),Object.keys(r).forEach((function(t){o.removeAttribute(t)})))}))}},requires:["computeStyles"]},$d={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=void 0===r?[0,0]:r,a=Ad.reduce((function(t,n){return t[n]=function(t,e,n){var o=Ed(t),r=[md,fd].indexOf(o)>=0?-1:1,i="function"==typeof n?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*r,[md,pd].indexOf(o)>=0?{x:s,y:a}:{x:a,y:s}}(n,e.rects,i),t}),{}),s=a[e.placement],c=s.x,l=s.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=l),e.modifiersData[o]=a}};var Od={left:"right",right:"left",bottom:"top",top:"bottom"};function Rd(t){return t.replace(/left|right|bottom|top/g,(function(t){return Od[t]}))}var Hd={start:"end",end:"start"};function Gd(t){return t.replace(/start|end/g,(function(t){return Hd[t]}))}function Wd(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&zu(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function jd(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function qd(t,e,n){return e===wd?jd(function(t,e){var n=Wu(t),o=td(t),r=n.visualViewport,i=o.clientWidth,a=o.clientHeight,s=0,c=0;if(r){i=r.width,a=r.height;var l=Ku();(l||!l&&"fixed"===e)&&(s=r.offsetLeft,c=r.offsetTop)}return{width:i,height:a,x:s+ed(t),y:c}}(t,n)):ju(e)?function(t,e){var n=Qu(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(e,n):jd(function(t){var e,n=td(t),o=Ju(t),r=null==(e=t.ownerDocument)?void 0:e.body,i=Uu(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=Uu(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-o.scrollLeft+ed(t),c=-o.scrollTop;return"rtl"===nd(r||n).direction&&(s+=Uu(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:s,y:c}}(td(t)))}function zd(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Ud(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}function Vd(t,e){void 0===e&&(e={});var n=e,o=n.placement,r=void 0===o?t.placement:o,i=n.strategy,a=void 0===i?t.strategy:i,s=n.boundary,c=void 0===s?"clippingParents":s,l=n.rootBoundary,u=void 0===l?wd:l,d=n.elementContext,f=void 0===d?xd:d,h=n.altBoundary,p=void 0!==h&&h,m=n.padding,g=void 0===m?0:m,y=zd("number"!=typeof g?g:Ud(g,yd)),v=f===xd?"reference":xd,b=t.rects.popper,w=t.elements[p?v:f],x=function(t,e,n,o){var r="clippingParents"===e?function(t){var e=cd(ad(t)),n=["absolute","fixed"].indexOf(nd(t).position)>=0&&qu(t)?dd(t):t;return ju(n)?e.filter((function(t){return ju(t)&&Wd(t,n)&&"body"!==Zu(t)})):[]}(t):[].concat(e),i=[].concat(r,[n]),a=i[0],s=i.reduce((function(e,n){var r=qd(t,n,o);return e.top=Uu(r.top,e.top),e.right=Vu(r.right,e.right),e.bottom=Vu(r.bottom,e.bottom),e.left=Uu(r.left,e.left),e}),qd(t,a,o));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}(ju(w)?w:w.contextElement||td(t.elements.popper),c,u,a),_=Qu(t.elements.reference),A=Nd({reference:_,element:b,strategy:"absolute",placement:r}),C=jd(Object.assign({},b,A)),S=f===xd?C:_,L={top:x.top-S.top+y.top,bottom:S.bottom-x.bottom+y.bottom,left:x.left-S.left+y.left,right:S.right-x.right+y.right},T=t.modifiersData.offset;if(f===xd&&T){var k=T[r];Object.keys(L).forEach((function(t){var e=[pd,hd].indexOf(t)>=0?1:-1,n=[fd,hd].indexOf(t)>=0?"y":"x";L[t]+=k[n]*e}))}return L}const Yd={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=void 0===h||h,m=n.allowedAutoPlacements,g=e.options.placement,y=Ed(g),v=c||(y!==g&&p?function(t){if(Ed(t)===gd)return[];var e=Rd(t);return[Gd(t),e,Gd(e)]}(g):[Rd(g)]),b=[g].concat(v).reduce((function(t,n){return t.concat(Ed(n)===gd?function(t,e){void 0===e&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=void 0===c?Ad:c,u=Pd(o),d=u?s?_d:_d.filter((function(t){return Pd(t)===u})):yd,f=d.filter((function(t){return l.indexOf(t)>=0}));0===f.length&&(f=d);var h=f.reduce((function(e,n){return e[n]=Vd(t,{placement:n,boundary:r,rootBoundary:i,padding:a})[Ed(n)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}(e,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:p,allowedAutoPlacements:m}):n)}),[]),w=e.rects.reference,x=e.rects.popper,_=new Map,A=!0,C=b[0],S=0;S=0,E=M?"width":"height",P=Vd(e,{placement:L,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),D=M?k?pd:md:k?hd:fd;w[E]>x[E]&&(D=Rd(D));var N=Rd(D),F=[];if(i&&F.push(P[T]<=0),s&&F.push(P[D]<=0,P[N]<=0),F.every((function(t){return t}))){C=L,A=!1;break}_.set(L,F)}if(A)for(var B=function(t){var e=b.find((function(e){var n=_.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return C=e,"break"},I=p?3:1;I>0&&"break"!==B(I);I--);e.placement!==C&&(e.modifiersData[o]._skip=!0,e.placement=C,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Xd(t,e,n){return Uu(t,Vu(e,n))}const Kd={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0!==a&&a,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=void 0===f||f,p=n.tetherOffset,m=void 0===p?0:p,g=Vd(e,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),y=Ed(e.placement),v=Pd(e.placement),b=!v,w=Dd(y),x="x"===w?"y":"x",_=e.modifiersData.popperOffsets,A=e.rects.reference,C=e.rects.popper,S="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,L="number"==typeof S?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(_){if(i){var M,E="y"===w?fd:md,P="y"===w?hd:pd,D="y"===w?"height":"width",N=_[w],F=N+g[E],B=N-g[P],I=h?-C[D]/2:0,$=v===vd?A[D]:C[D],O=v===vd?-C[D]:-A[D],R=e.elements.arrow,H=h&&R?id(R):{width:0,height:0},G=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},W=G[E],j=G[P],q=Xd(0,A[D],H[D]),z=b?A[D]/2-I-q-W-L.mainAxis:$-q-W-L.mainAxis,U=b?-A[D]/2+I+q+j+L.mainAxis:O+q+j+L.mainAxis,V=e.elements.arrow&&dd(e.elements.arrow),Y=V?"y"===w?V.clientTop||0:V.clientLeft||0:0,X=null!=(M=null==T?void 0:T[w])?M:0,K=N+U-X,Q=Xd(h?Vu(F,N+z-X-Y):F,N,h?Uu(B,K):B);_[w]=Q,k[w]=Q-N}if(s){var J,Z="x"===w?fd:md,tt="x"===w?hd:pd,et=_[x],nt="y"===x?"height":"width",ot=et+g[Z],rt=et-g[tt],it=-1!==[fd,md].indexOf(y),at=null!=(J=null==T?void 0:T[x])?J:0,st=it?ot:et-A[nt]-C[nt]-at+L.altAxis,ct=it?et+A[nt]+C[nt]-at-L.altAxis:rt,lt=h&&it?function(t,e,n){var o=Xd(t,e,n);return o>n?n:o}(st,et,ct):Xd(h?st:ot,et,h?ct:rt);_[x]=lt,k[x]=lt-et}e.modifiersData[o]=k}},requiresIfExists:["offset"]},Qd={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=Ed(n.placement),c=Dd(s),l=[md,pd].indexOf(s)>=0?"height":"width";if(i&&a){var u=function(t,e){return zd("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Ud(t,yd))}(r.padding,n),d=id(i),f="y"===c?fd:md,h="y"===c?hd:pd,p=n.rects.reference[l]+n.rects.reference[c]-a[c]-n.rects.popper[l],m=a[c]-n.rects.reference[c],g=dd(i),y=g?"y"===c?g.clientHeight||0:g.clientWidth||0:0,v=p/2-m/2,b=u[f],w=y-d[l]-u[h],x=y/2-d[l]/2+v,_=Xd(b,x,w),A=c;n.modifiersData[o]=((e={})[A]=_,e.centerOffset=_-x,e)}},effect:function(t){var e=t.state,n=t.options.element,o=void 0===n?"[data-popper-arrow]":n;null!=o&&("string"!=typeof o||(o=e.elements.popper.querySelector(o)))&&Wd(e.elements.popper,o)&&(e.elements.arrow=o)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Jd(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Zd(t){return[fd,pd,hd,md].some((function(e){return t[e]>=0}))}var tf=kd({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=void 0===r||r,a=o.resize,s=void 0===a||a,c=Wu(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&l.forEach((function(t){t.addEventListener("scroll",n.update,Md)})),s&&c.addEventListener("resize",n.update,Md),function(){i&&l.forEach((function(t){t.removeEventListener("scroll",n.update,Md)})),s&&c.removeEventListener("resize",n.update,Md)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=Nd({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=void 0===o||o,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,c=void 0===s||s,l={placement:Ed(e.placement),variation:Pd(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Bd(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:c})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Bd(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Id,$d,Yd,Kd,Qd,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,a=Vd(e,{elementContext:"reference"}),s=Vd(e,{altBoundary:!0}),c=Jd(a,o),l=Jd(s,r,i),u=Zd(c),d=Zd(l);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),ef="tippy-content",nf="tippy-backdrop",of="tippy-arrow",rf="tippy-svg-arrow",af={passive:!0,capture:!0},sf=function(){return document.body};function cf(t,e,n){if(Array.isArray(t)){var o=t[e];return null==o?Array.isArray(n)?n[e]:n:o}return t}function lf(t,e){var n={}.toString.call(t);return 0===n.indexOf("[object")&&n.indexOf(e+"]")>-1}function uf(t,e){return"function"==typeof t?t.apply(void 0,e):t}function df(t,e){return 0===e?t:function(o){clearTimeout(n),n=setTimeout((function(){t(o)}),e)};var n}function ff(t){return[].concat(t)}function hf(t,e){-1===t.indexOf(e)&&t.push(e)}function pf(t){return[].slice.call(t)}function mf(t){return Object.keys(t).reduce((function(e,n){return void 0!==t[n]&&(e[n]=t[n]),e}),{})}function gf(){return document.createElement("div")}function yf(t){return["Element","Fragment"].some((function(e){return lf(t,e)}))}function vf(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function bf(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function wf(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[o](e,n)}))}function xf(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=null==n.getRootNode||null==(o=n.getRootNode())?void 0:o.host}return!1}var _f={isTouch:!1},Af=0;function Cf(){_f.isTouch||(_f.isTouch=!0,window.performance&&document.addEventListener("mousemove",Sf))}function Sf(){var t=performance.now();t-Af<20&&(_f.isTouch=!1,document.removeEventListener("mousemove",Sf)),Af=t}function Lf(){var t=document.activeElement;if(function(t){return!(!t||!t._tippy||t._tippy.reference!==t)}(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}var Tf=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),kf=Object.assign({appendTo:sf,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Mf=Object.keys(kf);function Ef(t){var e=(t.plugins||[]).reduce((function(e,n){var o,r=n.name,i=n.defaultValue;return r&&(e[r]=void 0!==t[r]?t[r]:null!=(o=kf[r])?o:i),e}),{});return Object.assign({},t,e)}function Pf(t,e){var n=Object.assign({},e,{content:uf(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(Ef(Object.assign({},kf,{plugins:e}))):Mf).reduce((function(e,n){var o=(t.getAttribute("data-tippy-"+n)||"").trim();if(!o)return e;if("content"===n)e[n]=o;else try{e[n]=JSON.parse(o)}catch(t){e[n]=o}return e}),{})}(t,e.plugins));return n.aria=Object.assign({},kf.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?e.interactive:n.aria.expanded,content:"auto"===n.aria.content?e.interactive?null:"describedby":n.aria.content},n}var Df=function(){return"innerHTML"};function Nf(t,e){t[Df()]=e}function Ff(t){var e=gf();return!0===t?e.className=of:(e.className=rf,yf(t)?e.appendChild(t):Nf(e,t)),e}function Bf(t,e){yf(e.content)?(Nf(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?Nf(t,e.content):t.textContent=e.content)}function If(t){var e=t.firstElementChild,n=pf(e.children);return{box:e,content:n.find((function(t){return t.classList.contains(ef)})),arrow:n.find((function(t){return t.classList.contains(of)||t.classList.contains(rf)})),backdrop:n.find((function(t){return t.classList.contains(nf)}))}}function $f(t){var e=gf(),n=gf();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=gf();function r(n,o){var r=If(e),i=r.box,a=r.content,s=r.arrow;o.theme?i.setAttribute("data-theme",o.theme):i.removeAttribute("data-theme"),"string"==typeof o.animation?i.setAttribute("data-animation",o.animation):i.removeAttribute("data-animation"),o.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof o.maxWidth?o.maxWidth+"px":o.maxWidth,o.role?i.setAttribute("role",o.role):i.removeAttribute("role"),n.content===o.content&&n.allowHTML===o.allowHTML||Bf(a,t.props),o.arrow?s?n.arrow!==o.arrow&&(i.removeChild(s),i.appendChild(Ff(o.arrow))):i.appendChild(Ff(o.arrow)):s&&i.removeChild(s)}return o.className=ef,o.setAttribute("data-state","hidden"),Bf(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props),{popper:e,onUpdate:r}}$f.$$tippy=!0;var Of=1,Rf=[],Hf=[];function Gf(t,e){var n,o,r,i,a,s,c,l,u=Pf(t,Object.assign({},kf,Ef(mf(e)))),d=!1,f=!1,h=!1,p=!1,m=[],g=df(V,u.interactiveDebounce),y=Of++,v=(l=u.plugins).filter((function(t,e){return l.indexOf(t)===e})),b={id:y,reference:t,popper:gf(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(n),clearTimeout(o),cancelAnimationFrame(r)},setProps:function(e){if(!b.state.isDestroyed){N("onBeforeUpdate",[b,e]),z();var n=b.props,o=Pf(t,Object.assign({},n,mf(e),{ignoreAttributes:!0}));b.props=o,q(),n.interactiveDebounce!==o.interactiveDebounce&&(I(),g=df(V,o.interactiveDebounce)),n.triggerTarget&&!o.triggerTarget?ff(n.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):o.triggerTarget&&t.removeAttribute("aria-expanded"),B(),D(),_&&_(n,o),b.popperInstance&&(Q(),Z().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)}))),N("onAfterUpdate",[b,e])}},setContent:function(t){b.setProps({content:t})},show:function(){var t=b.state.isVisible,e=b.state.isDestroyed,n=!b.state.isEnabled,o=_f.isTouch&&!b.props.touch,r=cf(b.props.duration,0,kf.duration);if(!(t||e||n||o||k().hasAttribute("disabled")||(N("onShow",[b],!1),!1===b.props.onShow(b)))){if(b.state.isVisible=!0,T()&&(x.style.visibility="visible"),D(),H(),b.state.isMounted||(x.style.transition="none"),T()){var i=E();vf([i.box,i.content],0)}var a,c,l;s=function(){var t;if(b.state.isVisible&&!p){if(p=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,T()&&b.props.animation){var e=E(),n=e.box,o=e.content;vf([n,o],r),bf([n,o],"visible")}F(),B(),hf(Hf,b),null==(t=b.popperInstance)||t.forceUpdate(),N("onMount",[b]),b.props.animation&&T()&&function(t,e){W(t,(function(){b.state.isShown=!0,N("onShown",[b])}))}(r)}},c=b.props.appendTo,l=k(),(a=b.props.interactive&&c===sf||"parent"===c?l.parentNode:uf(c,[l])).contains(x)||a.appendChild(x),b.state.isMounted=!0,Q()}},hide:function(){var t=!b.state.isVisible,e=b.state.isDestroyed,n=!b.state.isEnabled,o=cf(b.props.duration,1,kf.duration);if(!(t||e||n)&&(N("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,p=!1,d=!1,T()&&(x.style.visibility="hidden"),I(),G(),D(!0),T()){var r=E(),i=r.box,a=r.content;b.props.animation&&(vf([i,a],o),bf([i,a],"hidden"))}F(),B(),b.props.animation?T()&&function(t,e){W(t,(function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&e()}))}(o,b.unmount):b.unmount()}},hideWithInteractivity:function(t){M().addEventListener("mousemove",g),hf(Rf,g),g(t)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(J(),Z().forEach((function(t){t._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),Hf=Hf.filter((function(t){return t!==b})),b.state.isMounted=!1,N("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),z(),delete t._tippy,b.state.isDestroyed=!0,N("onDestroy",[b]))}};if(!u.render)return b;var w=u.render(b),x=w.popper,_=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,t._tippy=b,x._tippy=b;var A=v.map((function(t){return t.fn(b)})),C=t.hasAttribute("aria-expanded");return q(),B(),D(),N("onCreate",[b]),u.showOnCreate&&tt(),x.addEventListener("mouseenter",(function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&M().addEventListener("mousemove",g)})),b;function S(){var t=b.props.touch;return Array.isArray(t)?t:[t,0]}function L(){return"hold"===S()[0]}function T(){var t;return!(null==(t=b.props.render)||!t.$$tippy)}function k(){return c||t}function M(){var t,e,n=k().parentNode;return n?null!=(e=ff(n)[0])&&null!=(t=e.ownerDocument)&&t.body?e.ownerDocument:document:document}function E(){return If(x)}function P(t){return b.state.isMounted&&!b.state.isVisible||_f.isTouch||i&&"focus"===i.type?0:cf(b.props.delay,t?0:1,kf.delay)}function D(t){void 0===t&&(t=!1),x.style.pointerEvents=b.props.interactive&&!t?"":"none",x.style.zIndex=""+b.props.zIndex}function N(t,e,n){var o;void 0===n&&(n=!0),A.forEach((function(n){n[t]&&n[t].apply(n,e)})),n&&(o=b.props)[t].apply(o,e)}function F(){var e=b.props.aria;if(e.content){var n="aria-"+e.content,o=x.id;ff(b.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(n);if(b.state.isVisible)t.setAttribute(n,e?e+" "+o:o);else{var r=e&&e.replace(o,"").trim();r?t.setAttribute(n,r):t.removeAttribute(n)}}))}}function B(){!C&&b.props.aria.expanded&&ff(b.props.triggerTarget||t).forEach((function(t){b.props.interactive?t.setAttribute("aria-expanded",b.state.isVisible&&t===k()?"true":"false"):t.removeAttribute("aria-expanded")}))}function I(){M().removeEventListener("mousemove",g),Rf=Rf.filter((function(t){return t!==g}))}function $(e){if(!_f.isTouch||!h&&"mousedown"!==e.type){var n=e.composedPath&&e.composedPath()[0]||e.target;if(!b.props.interactive||!xf(x,n)){if(ff(b.props.triggerTarget||t).some((function(t){return xf(t,n)}))){if(_f.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else N("onClickOutside",[b,e]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),f=!0,setTimeout((function(){f=!1})),b.state.isMounted||G())}}}function O(){h=!0}function R(){h=!1}function H(){var t=M();t.addEventListener("mousedown",$,!0),t.addEventListener("touchend",$,af),t.addEventListener("touchstart",R,af),t.addEventListener("touchmove",O,af)}function G(){var t=M();t.removeEventListener("mousedown",$,!0),t.removeEventListener("touchend",$,af),t.removeEventListener("touchstart",R,af),t.removeEventListener("touchmove",O,af)}function W(t,e){var n=E().box;function o(t){t.target===n&&(wf(n,"remove",o),e())}if(0===t)return e();wf(n,"remove",a),wf(n,"add",o),a=o}function j(e,n,o){void 0===o&&(o=!1),ff(b.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,n,o),m.push({node:t,eventType:e,handler:n,options:o})}))}function q(){L()&&(j("touchstart",U,{passive:!0}),j("touchend",Y,{passive:!0})),function(t){return t.split(/\s+/).filter(Boolean)}(b.props.trigger).forEach((function(t){if("manual"!==t)switch(j(t,U),t){case"mouseenter":j("mouseleave",Y);break;case"focus":j(Tf?"focusout":"blur",X);break;case"focusin":j("focusout",X)}}))}function z(){m.forEach((function(t){var e=t.node,n=t.eventType,o=t.handler,r=t.options;e.removeEventListener(n,o,r)})),m=[]}function U(t){var e,n=!1;if(b.state.isEnabled&&!K(t)&&!f){var o="focus"===(null==(e=i)?void 0:e.type);i=t,c=t.currentTarget,B(),!b.state.isVisible&&function(t){return lf(t,"MouseEvent")}(t)&&Rf.forEach((function(e){return e(t)})),"click"===t.type&&(b.props.trigger.indexOf("mouseenter")<0||d)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:tt(t),"click"===t.type&&(d=!n),n&&!o&&et(t)}}function V(t){var e=t.target,n=k().contains(e)||x.contains(e);if("mousemove"!==t.type||!n){var o=Z().concat(x).map((function(t){var e,n=null==(e=t._tippy.popperInstance)?void 0:e.state;return n?{popperRect:t.getBoundingClientRect(),popperState:n,props:u}:null})).filter(Boolean);(function(t,e){var n=e.clientX,o=e.clientY;return t.every((function(t){var e=t.popperRect,r=t.popperState,i=t.props.interactiveBorder,a=r.placement.split("-")[0],s=r.modifiersData.offset;if(!s)return!0;var c="bottom"===a?s.top.y:0,l="top"===a?s.bottom.y:0,u="right"===a?s.left.x:0,d="left"===a?s.right.x:0,f=e.top-o+c>i,h=o-e.bottom-l>i,p=e.left-n+u>i,m=n-e.right-d>i;return f||h||p||m}))})(o,t)&&(I(),et(t))}}function Y(t){K(t)||b.props.trigger.indexOf("click")>=0&&d||(b.props.interactive?b.hideWithInteractivity(t):et(t))}function X(t){b.props.trigger.indexOf("focusin")<0&&t.target!==k()||b.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||et(t)}function K(t){return!!_f.isTouch&&L()!==t.type.indexOf("touch")>=0}function Q(){J();var e=b.props,n=e.popperOptions,o=e.placement,r=e.offset,i=e.getReferenceClientRect,a=e.moveTransition,c=T()?If(x).arrow:null,l=i?{getBoundingClientRect:i,contextElement:i.contextElement||k()}:t,u=[{name:"offset",options:{offset:r}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(T()){var n=E().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?n.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?n.setAttribute("data-"+t,""):n.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];T()&&c&&u.push({name:"arrow",options:{element:c,padding:3}}),u.push.apply(u,(null==n?void 0:n.modifiers)||[]),b.popperInstance=tf(l,x,Object.assign({},n,{placement:o,onFirstUpdate:s,modifiers:u}))}function J(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Z(){return pf(x.querySelectorAll("[data-tippy-root]"))}function tt(t){b.clearDelayTimeouts(),t&&N("onTrigger",[b,t]),H();var e=P(!0),o=S(),r=o[0],i=o[1];_f.isTouch&&"hold"===r&&i&&(e=i),e?n=setTimeout((function(){b.show()}),e):b.show()}function et(t){if(b.clearDelayTimeouts(),N("onUntrigger",[b,t]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&d)){var e=P(!1);e?o=setTimeout((function(){b.state.isVisible&&b.hide()}),e):r=requestAnimationFrame((function(){b.hide()}))}}else G()}}function Wf(t,e){void 0===e&&(e={});var n=kf.plugins.concat(e.plugins||[]);document.addEventListener("touchstart",Cf,af),window.addEventListener("blur",Lf);var o=Object.assign({},e,{plugins:n}),r=function(t){return yf(t)?[t]:function(t){return lf(t,"NodeList")}(t)?pf(t):Array.isArray(t)?t:pf(document.querySelectorAll(t))}(t).reduce((function(t,e){var n=e&&Gf(e,o);return n&&t.push(n),t}),[]);return yf(t)?r[0]:r}Wf.defaultProps=kf,Wf.setDefaultProps=function(t){Object.keys(t).forEach((function(e){kf[e]=t[e]}))},Wf.currentInput=_f,Object.assign({},Id,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),Wf.setDefaultProps({render:$f});const jf=Wf,qf='.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}';function zf(t){return Math.round(performance.now()-t)}function Uf(){const t=this.annotDescriptions.annots,e=Object.values(t).slice(),n=e.filter((t=>t.type&&t.type.includes("paralogous"))),o=e.filter((t=>t.type&&t.type.includes("interacting gene")));return{related:e,paralogous:n,interacting:o,searched:Object.entries(t).filter((t=>t[1].type&&t[1].type.includes("searched gene")))[0][0]}}function Vf(t){const e=this,n=performance.now()-e.time.prevTooltipOff,o=e.time.prevTooltipAnnotDomId;if(n<300&&t.domId===o)return null;const r=t.name,i=e.annotDescriptions.annots[t.name].type.split(" ")[0],a=Yf(e);return Object.assign({tooltipGene:r,tooltipRelatedType:i},a)}function Yf(t){const e=t.getRelatedGenesByType();return{numRelatedGenes:e.related.length,numParalogs:e.paralogous.length,numInteractingGenes:e.interacting.length,searchedGene:e.searched}}const Xf="#AAA",Kf="#555",Qf="#D8D8D8",Jf="#888",Zf="#888",th="#333",eh="#F55",nh="#A00",oh="#922D5E",rh="#D26D9E",ih="#CAA",ah="#866",sh="#E88",ch="#A55",lh="#FFC0CB",uh="#CF909B",dh="#99D",fh="#22C",hh="#CCF",ph="#33D",mh="#EEF",gh="#AAF",yh="#66B",vh="#116",bh="#7D7",wh="#393",xh="#3A3",_h="#060",Ah="#93E9BE",Ch="#53AC7E",Sh="#51087E",Lh="#8138AE",Th="#880ED4",kh="#5800A4",Mh="#B24BF3",Eh="#520B83",Ph="#D7A1F9",Dh="#A771C9",Nh="#EEDDFF",Fh="#A771C9",Bh="#964B00",Ih="#660B00",$h="#C87D32",Oh="#722810",Rh="#DACDBA",Hh="#A99A89",Gh="#FFA500",Wh="#DD8000",jh="#DD8300",qh="#883000",zh="#FFEA66",Uh="#FFB466",Vh="#EEBB00",Yh="#A99A89",Xh="#FF3",Kh="#AA0",Qh="#FFFBCC",Jh="#CCC89A",Zh="#BCB",tp="#9A9",ep="#DFD",np="#CDC";function op(t){return"_"===t[0][0]}const rp={_H:"Helical",_E:"Extracellular",_C:"Cytoplasmic"};function ip(t,e,n,o){let r=t[0];const i=t[3];let a=e.px.start+i.x,s=i.width;n||(a=e.px.length+e.px.start-(i.x+i.width));let c=30,l=14;const u=op(t),d=function(t){return"S"===t[0]}(t);let f="";if(o&&(c=38,u)){r=function(t){return t in rp?rp[t]:t.slice(1)}(t[0]),c=30,l=30;const o=`${t[0]} ${t[1]} ${t[2]}`;if((n&&i.x+i.width>e.px.length+3||!n&&i.x+i.width>e.px.length+3)&&(console.debug(`Truncate protein topology feature: ${o}`),s-=i.x+i.width-e.px.length,n||(a+=s)),f='data-topology="true"',s<0){const t="Width < 0, omit protein topology feature";return console.debug(`${t}: ${o}`),""}}const[h,p]="S"===(m=r)?["#FF2","#F99"]:"Extracellular"===m?[mh,gh]:"Cytoplasmic"===m?[Qh,Jh]:"Helical"===m||m.startsWith("Helical ---")?[Rh,Hh]:"Lumenal"===m?[zh,Uh]:"Lumenal, melanosome"===m?[Vh,Yh]:"Mitochondrial matrix"===m?[ep,np]:"Mitochondrial intermembrane"===m?[Zh,tp]:"Perinuclear space"===m?[Nh,Fh]:"Nuclear"===m?[Ph,Dh]:"Beta stranded"===m?[dh,fh]:m.includes("conserved site")||m.includes("conserved domain")||"WGR domain"===m||"R3H domain"===m||m.includes("QLQ")||"Sema domain"===m||"Proteasome component (PCI) domain"===m||"Sterol-sensing domain"===m||"Erythropoietin/thrombopoietin"===m||"SPRY domain"===m||"Anaphylatoxin/fibulin"===m||"Tetratricopeptide repeat"===m||"Doublecortin domain"===m||m.includes("Glycosyl transferase")||m.toLowerCase().includes("lethal")&&m.toLowerCase().includes("c-terminal")||m.includes("PUB")||m.includes("Myogenic determination")||"Globin"===m||"GPS motif"===m||m.includes("D-like")||m.toLowerCase().includes("insertion domain")||"Macro domain"===m?[oh,rh]:m.includes("active site")||m.includes("hydroxylation site")||m.includes("catalytic domain")||m.includes("Lipid transport")||"BRCA1, serine-rich domain"===m||"Tower domain"===m||m.endsWith("attachment site")||m.endsWith("amyloid-beta peptide")||"Reverse transcriptase domain"===m||"Membrane attack complex component/perforin (MACPF) domain"===m||"Alpha-2-macroglobulin"===m||"Kinesin motor domain"===m||"Adenomatous polyposis coli tumour suppressor protein"===m||m.includes("endostatin")?[eh,nh]:"Cyclin, C-terminal domain"===m||m.includes("OB C-terminal domain")||"Cationic amino acid transporter, C-terminal"===m||"High mobility group box domain"===m||"HMG-box domain"===m||m.includes("CUB domain")||"C-5 cytosine methyltransferase"===m||m.includes("(G-protein), alpha subunit")||"SCAN domain"===m||"Apolipoprotein A/E"===m||m.includes("Clusterin")||m.includes("SMAD domain")||"PLAC"===m||m.endsWith("tripeptidyl peptidase II")||"Prohormone convertase enzyme"===m||m.includes("rod domain")||"Osteopontin"===m||"SPRY-associated"===m||"C1q domain"===m||"OAR domain"===m||m.includes("FTO, C-terminal")||m.includes("ATPase, C-terminal")||m.includes("Hint domain")||"Laminin IV"===m||"NACHT-associated domain"===m||m.includes("FANCD2")||m.startsWith("Acyl-CoA")&&m.endsWith("C-terminal")||"Kinesin-like"===m||"GUCT"===m||m.includes("(APC) repeat")||m.includes("IP3R")?[ih,ah]:m.includes("trypsin domain")||m.includes("scaffold dimerization")||m.includes("eIF-4 gamma, MA3")||"Troponin"===m||"SKI/SNO/DAC domain"===m||m.toLowerCase().includes("large ribosom")||m.includes("KA1")||"V(D)J recombination-activating protein 1"===m||m.toLowerCase().includes("opiod")||"Corticotropin-releasing factor"===m||m.includes("2Fe-2S ferredoxin")||m.includes("acidic domain")?[sh,ch]:"EGF-like calcium-binding domain"===m||m.includes("PTX/LNS")||"HSR domain"===m||m.includes("MutS, clamp")||m.includes("S5 domain 2-like")||m.endsWith("CC1/2")||m.includes("MUN")||m.includes("second molybdopterin")?[xh,_h]:m.includes("binding site")||"EF-hand domain"===m||m.includes("EF hand-like")||"Zinc finger, nuclear hormone receptor-type"===m||m.includes("Serpin domain")||"Peptidase C14, p20 domain"===m||"PWWP domain"===m||"Peptidoglycan binding-like"===m||"MAD homology 1, Dwarfin-type"===m||"F-actin binding"===m||m.includes("Glycoside hydrolase")&&m.endsWith("domain")||"p53 tumour suppressor family"===m||"Menin"===m||m.includes("von Hippel")&&m.includes("beta")||"Pointed domain"===m||m.includes("DNA binding")||"Helix-hairpin-helix domain"===m||"Helix-hairpin-helix motif"===m||"MIR motif"===m||"Rad52 family"===m||"Oxidoreductase FAD/NAD(P)-binding"===m||m.endsWith("NAD-binding")||m.endsWith("NAD binding")||m.includes("Bromo adjacent")||"HARP domain"===m||"FATC domain"===m||m.startsWith("XRN2-binding")||"SRCR-like domain"===m||m.includes("SRCR")||"Gamma-carboxyglutamic acid-rich (GLA) domain"===m||"Pterin-binding domain"===m||"Receptor, ligand binding region"===m||m.includes("DHEX domain")||"SANT/Myb domain"===m||m.includes("Forkhead-associated")||"Rap/Ran-GAP domain"===m||m.endsWith("C2 domain")||m.includes("tri-helix bundle domain")||m.includes("Cx50")||m.includes("tyrosine-rich")||"Filaggrin"===m?[dh,fh]:m.includes("dehydrogenase, molybdopterin binding")||"Zinc finger CCHC HIVEP-type"===m||"Cyclin, N-terminal"===m||"MAD homology, MH1"===m||"Sodium ion transport-associated"===m||"Sodium ion transport-associated domain"===m||m.endsWith("head")||m.includes("Pleckstrin homology domain")||"PH domain"===m||m.endsWith("pleckstrin homology-like domain")||"DEP domain"===m||"Post-SET domain"===m||m.includes("Glycoside hydrolase")||"Pyridoxal phosphate-dependent decarboxylase"===m||m.includes("OB1")||m.includes("OB3")||m.includes("OB domain")||"Fork head domain"===m||"Histone deacetylase domain"===m||m.includes("MG1")||"Homocysteine-binding domain"===m||m.startsWith("Acyl-CoA")&&m.endsWith("N-terminal")||"Clathrin light chain"===m||"Hexokinase, N-terminal"===m?[hh,ph]:m.includes("zinc-binding")||m.includes("DNA-binding")||"RUNT domain"===m||"G protein-coupled receptor, rhodopsin-like"===m||m.includes("CXC domain")||m.includes("Homeobox domain")||m.includes("BRCT domain")||m.includes("EF-hand")||"Laminin G domain"===m||"Peptidase C14, caspase non-catalytic subunit p10"===m||"ADD domain"===m||"PDZ domain"===m||"Krueppel-associated box"===m||"Ets domain"===m||"P domain"===m||m.includes("bHLH")||"Ras-associating (RA) domain"===m||"Ras-associating domain"===m||"Calcium/calmodulin-dependent protein kinase II, association-domain"===m||"Bromodomain"===m||"Bromodomain associated domain"===m||"SLIDE domain"===m||"Peptidase M24"===m||"Pentraxin-related"===m||m.includes("Notch ligand")||"Anti-proliferative protein"===m||m.includes("transpeptidase")||"Tuberin-type domain"===m||"Ras-like guanine nucleotide exchange factor, N-terminal"===m||m.includes("factor-binding protein")||m.includes("GPD")||"ELM2 domain"===m?[yh,vh]:"SH2 domain"===m||m.includes("SH2-like domain")||m.includes("Furin-like")||m.includes("heparin-binding")||"SRCR domain"===m||"EGF-like domain"===m||"Basic leucine zipper domain, Maf-type"===m||m.startsWith("Leucine zipper")||m.includes("Interleukin")&&m.includes("propeptide")||"Sirtuin family"===m||"Amino acid/polyamine transporter I"===m||"Peptidase M10, metallopeptidase"===m||"Metallothionein"===m||"DDHD domain"===m||"Zinc finger C2H2-type"===m||"Zinc finger, PARP-type"===m||m.endsWith("tail domain")||"SET domain"===m||"Hamartin"===m||m.includes("von Hippel")&&m.includes("alpha")||m.includes("transactivation domain 2")||"Phosphopantetheine binding ACP domain"===m||"Multicopper oxidase, second cupredoxin domain"===m||"Helicase, C-terminal"===m||m.includes("Carboxylesterase")||m.includes("presequence")||m.endsWith("CC3")?[bh,wh]:"Insulin-like"===m||"Fibroblast growth factor family"===m||"Nerve growth factor-related"===m||"Transforming growth factor-beta, C-terminal"===m||"Telomere-length maintenance and DNA damage repair"===m||"PDGF/VEGF domain"===m||m.includes("SH3-RhoGEF")||m.includes("MG4")||m.includes("RING domain")||m.includes("RING-type")||m.startsWith("DEAD/DEAH")||"Laminin alpha, domain I"===m||m.toLowerCase().includes("nuclear/hormone receptor")||"P-type trefoil domain"===m||m.includes("KHDRBS")?[xh,_h]:"SH3 domain"===m||"Variant SH3 domain"===m||m.endsWith("SH3 domain")||m.includes("copper-binding")||"Sushi/SCR/CCP domain"===m||m.includes("Coagulation factor 5/8")||"Basic-leucine zipper domain"===m||"Basic region leucine zipper"===m||"Sirtuin family, catalytic core domain"===m||"Amine oxidase"===m||m.includes("peroxidase")||m.includes("lid domain")||m.includes("prodomain")||"Pre-SET domain"===m||m.includes("transactivation domain")||m.includes(" activation domain")||m.includes("activating region")||"Thioesterase"===m||m.toLowerCase().includes("thiored")||m.includes("esterase")||m.endsWith("Claudin superfamily")||"Retinoblastoma-associated protein, A-box"===m||m.includes("Between PH and SH2")||m.includes("inter-SH2")||"Chromogranin A/B/C"===m||m.toLowerCase().includes("helicase")||m.endsWith("pro-domain")||"Brix domain"===m||"Coagulation Factor Xa inhibitory site"===m||"Trypsin Inhibitor-like, cysteine rich domain"===m||"WIF domain"===m||m.toLowerCase().includes("cystatin")||"EGF domain"===m||"Axin beta-catenin binding"===m||"Peptidase M2, peptidyl-dipeptidase A"===m||m.endsWith("phosphatase domain")||"PIGA, GPI anchor biosynthesis"===m||m.startsWith("Acyl-CoA")&&m.endsWith("middle domain")||m.includes("(COR)")||"K Homology domain, type 2"===m||m.includes("Phox")||m.includes("PB1")||m.includes("multifunctional domain")||m.includes("MutS, core")||"RAP domain"===m||m.endsWith("CC5")||m.includes("first molybdopterin")?[Ah,Ch]:"Immunoglobulin-like domain"===m||m.toLowerCase().endsWith("immunoglobulin-like domain")||m.endsWith("Ig domain")||m.endsWith("Ig-like domain")||"Major facilitator superfamily domain"===m||m.includes("interface")||"Class I myosin tail homology domain"===m||"Myosin tail"===m||"Acyl transferase"===m||m.endsWith("transferase")||m.startsWith("Acyl-CoA")||"JAK, FERM F2 lobe domain"===m||"Sodium/solute symporter"===m||m.includes("foci domain")||m.includes("Receptor L-domain")||"Wnt"===m||"R-spondin, Fu-CRD domain"===m||m.endsWith("merisation domain")||m.endsWith("merization domain")||m.endsWith("merisation motif")||m.endsWith("merization motif")||m.endsWith("BTB/POZ domain")||m.includes("CBS domain")||"DZF domain"===m||"GS domain"===m||m.includes("kinase domain")||m.includes("FAT")||m.startsWith("von Willebrand factor, type A")||m.includes("VWA")||"Reeler domain"===m||"BMP/retinoic acid-inducible neural-specific protein"===m||"Low-density lipoprotein (LDL) receptor class A repeat"===m||"TILa domain"===m||m.includes("chromosome condensation")||"Immunoglobulin I-set"===m||"Kinesin-associated"===m||"SMCs flexible hinge"===m||m.includes("Cys-His rich domain")?[lh,uh]:"Immunoglobulin"===m||"Immunoglobulin domain"===m||"CD20-like family"===m||"Calponin homology domain"===m||m.endsWith("Calponin-homology domain")||m.includes("ATPase")||m.includes("ATP coupling domain")||m.includes("globular domain")||"Mitochondrial substrate/solute carrier"===m||"Major facilitator, sugar transporter-like"===m||"Major facilitator, sugar transporter-like"===m||"Sodium:neurotransmitter symporter"===m||m.toLowerCase().includes("methyltransferase")||"Rhodanese-like domain"===m||m.startsWith("Thyroglobulin")||"Retinoblastoma-associated protein, B-box"===m||"C-type lectin-like"===m||"Galectin, carbohydrate recognition domain"===m||"VWFC domain"===m||m.includes("CFC domain")||"POLO box domain"===m||m.endsWith("domain 1")||m.endsWith("domain II")||"Fibronectin, type I"===m||"Cadherin-like"===m||"G-protein gamma-like domain"===m||"GoLoco motif"===m||"MyTH4 domain"===m||m.endsWith("isomerase")||"BTB/Kelch-associated"===m||"Stathmin family"===m?[Ph,Dh]:"Immunoglobulin C1-set"===m||m.includes("GTPase")||"RGS domain"===m||"Major facilitator superfamily"===m||"Fibronectin type II domain"===m||m.includes("ectodomain")||m.endsWith("receptor domain")||m.endsWith("receptor domain 4")||"MAM domain"===m||"IPT domain"===m||m.endsWith("extracellular")||"Link domain"===m||m.includes("connector domain")||"WW domain"===m||"WHIM1 domain"===m||"TNFR/NGFR cysteine-rich region"===m||"Frizzled domain"===m||"Netrin module, non-TIMP type"===m||"CFTR regulator domain"===m||m.endsWith("domain 2")||"GNAT domain"===m||"NIDO domain"===m||"Myosin head, motor domain"===m||"von Willebrand domain, type D domain"===m||"Kinesin-like KIF1-type"===m||m.includes("Paxillin")||"Clathrin, heavy chain/VPS, 7-fold repeat"===m||"Collagen IV, non-collagenous"===m?[Mh,Eh]:"Fibronectin type III"===m||"Tissue factor"===m||"Immunoglobulin C2-set"===m||m.includes("immunoglobulin C2-set")||m.includes("protein interaction")||"SWIRM domain"===m||m.includes("(DSL) protein")||"Dishevelled protein domain"===m||m.endsWith("domain 3")||"DnaJ domain"===m||m.toLowerCase().includes("nuclear receptor")||"Gonadal family"===m?[Th,kh]:"Immunoglobulin V-set domain"===m||m.includes("V-set domain")||m.includes("V-like")||"Frizzled/Smoothened, 7TM"===m||m.endsWith("domain 4")||"Integrin alpha-2"===m||"Calcium-activated potassium channel BK, alpha subunit"===m||m.includes("Dbl homology (DH) domain")||m.includes("Glycine rich")||m.toLowerCase().includes("exonuclease")||"WHIM2 domain"===m||m.includes("Coactivator CBP")||m.includes("cryptic polo")?[Sh,Lh]:"Desmoplakin, spectrin-like domain"===m||"Spectrin repeat"===m||m.endsWith("TED domain")||"Polyadenylate-binding protein/Hyperplastic disc protein"===m||m.includes(" cap domain")||m.toLowerCase().includes("agenet")||m.includes("TATA")||m.includes("Citron")||"RIH domain"===m||m.toLowerCase().includes("sclerostin")||"ZU5 domain"===m||"Piezo domain"===m||"Histone H2A/H2B/H3"===m?[Xh,Kh]:"Armadillo"===m||m.includes("Apple domain")||"Protocadherin"===m||"DIX domain"===m||"Ferritin-like diiron domain"===m||"4Fe-4S dicluster domain"===m||"Transferrin-like domain"===m||"PAS domain"===m||"PAS fold"===m||"Polyketide synthase, dehydratase domain"===m||"Flavodoxin/nitric oxide synthase"===m||"Flavodoxin-like fold"===m||"G-patch domain"===m||"Chromo domain"===m||m.toLowerCase().includes("tudor")||"Cytochrome P450"===m||"Potassium channel domain"===m||"G2 nidogen/fibulin G2F"===m||m.includes("bait region")||"WWE domain"===m||m.endsWith("deiodinase")||"Cobalamin (vitamin B12)-binding domain"===m||"Laminin domain II"===m||"Troponin I residues 1-32"===m||"KI67R"===m||m.includes("FAD-binding")?[Gh,Wh]:m.includes("Kringle")||m.includes("Peptidase M12A")||"TGF-beta, propeptide"===m||m.includes("autopeptidase")||m.includes("GAIN")||"PIK-related kinase"===m||m.includes("(PIK) domain")||"LDLR class B repeat"===m||"Actin family"===m||"Ferritin/DPS protein domain"===m||"PAS fold-3"===m||"Polyketide synthase, ketoreductase domain"===m||m.startsWith("Heat shock protein")&&m.endsWith("family")||"BAG domain"===m||"MCM domain"===m||m.endsWith("reductase-like")||"Lipase"===m||"Phospholipase A2 domain"===m||"Notch domain"===m||m.includes("LCCL domain")||m.includes("SANT-like")||"VWF/SSPO/Zonadhesin-like, cysteine-rich domain"===m||"Kappa casein"===m||"Casein, alpha/beta"===m||"Natriuretic peptide"===m||"EMI domain"===m||"Neurohypophysial hormone"===m||"Synuclein"===m||m.includes("Hydroxymethylglutaryl-CoA reductase")||m.includes("Perilipin")||m.includes("lipase")||m.includes("CRAL")||m.includes("SAND")||m.toLowerCase().includes("hsp")||m.toLowerCase().includes("bombesin")?[Rh,Hh]:"Notch, NOD domain"===m||"Cadherin, Y-type LIR-motif"===m||"Protein patched/dispatched"===m||m.includes("membrane-proximal")||"LicD family"===m||m.includes("MoaB/Mog")?[$h,Oh]:m.includes("transmembrane domain")||m.includes("trans-membrane domain")||m.includes("Transmembrane protein")||m.includes("7TM")||"Major intrinsic protein"===m||m.includes("Triadin")||m.includes("Collectrin")||m.includes("membrane glycoprotein")||"SEA domain"===m||"CD36 family"===m||m.includes("CD34")||"Hypoxia-inducible factor, alpha subunit"===m||"Hypoxia-inducible factor, alpha subunit-like"===m||"PKD domain"===m||m.includes("regulatory domain")||m.endsWith("E2 domain")||"PLAT/LH2 domain"===m||"Notch, NODP domain"===m||"Syndecan/Neurexin domain"===m||"Zona pellucida domain"===m||m.includes("Ion transport domain")||m.endsWith("Membrane transport protein MMPL domain")||m.includes("Caveolin")||"Band 7 domain"===m||m.includes("Shisa")||"ABC-2 family transporter protein"===m||"Anoctamin"===m||"Sodium-dependent phosphate transport protein"===m||m.includes("MHC II-interacting")?[Bh,Ih]:"DAPIN domain"===m||"Death effector domain"===m||"Death domain"===m||m.includes("death protein")||m.toLowerCase().includes("lethal")||m.includes("UBA domain")||m.includes("HECT domain")||m.toLowerCase().includes("ubiquitin")||m.includes("necrosis")||m.toLowerCase().includes("death")||m.includes("Bcl-2")||m.includes("CIDE-N")||"Disintegrin domain"===m||m.includes("TRAF")||m.includes("TIR")||m.toLowerCase().includes("caspase")||"Pellino family"===m?[Zf,th]:m.includes("unknown function")||m.toLowerCase().includes("unstructured")||m.startsWith("Uncharacterised")?[Xf,Kf]:m.toLowerCase().includes("leucine rich repeat")||m.includes("HIN")||m.includes("calcium")||m.toLowerCase().includes("calreticulin")||m.includes("cytokine receptor")||m.includes("pore forming")||m.includes("RHIM")||m.includes("SWIB")||"Ryanodine receptor Ryr"===m||m.includes("Armadillo")||"UME domain"===m||m.includes("WD40 domain")||"WSTF/Acf1/Cbp146"===m||"BCL7"===m||m.endsWith("repeat ring region")||m.includes("PANDER")||"GPCR, rhodopsin-like, 7TM"===m||"GPCR, family 2, secretin-like"===m||"GPCR, family 3, nine cysteines domain"===m||"G-protein coupled receptor"===m||m.toLowerCase().includes("orexin")||"[2Fe-2S]-binding"===m?[jh,qh]:m.includes("repeat")||"Vitellinogen, open beta-sheet"===m||m.includes("Interleukin")&&m.includes("family")||/Interleukin-\d+$/.test(m)||"Chemokine interleukin-8-like domain"===m||m.includes("beta-ribbon")||m.includes("cytoplasmic domain")||m.toLowerCase().includes("interleukin")||"Citrate transporter-like domain"===m||m.toLowerCase().includes("calsequestrin")?[Gh,Wh]:m.includes("inhibit")||m.includes("central")||m.endsWith("tail")||m.endsWith("helical domain")||m.endsWith("helical domain HD2")||m.endsWith("coiled-coil domain")||m.endsWith("coiled-coil region")||m.includes("zinc ribbon fold")||m.includes("zinc-ribbon")||m.toLowerCase().includes("anhydrase")||"Macroglobulin domain"===m||m.includes("KH0")||m.includes("EGF")||m.toLowerCase().includes("olfact")||m.toLowerCase().includes("mucin")?[Ah,Ch]:m.includes("Peptidase")||m.includes("Ras-binding")||m.includes("CRIB domain")?[dh,fh]:m.toLowerCase().includes("zinc finger")||m.toLowerCase().includes("zinc-finger")||m.includes("RING finger")||m.toLowerCase().includes("transcription factor")||"Paired domain"===m||"JmjC domain"===m||"BRK domain"===m||m.includes("MG3")||m.toLowerCase().includes("polycomb")||m.toLowerCase().includes("metallopeptidase")||m.toLowerCase().includes("metallo-peptidase")||m.toLowerCase().includes("metalloenzyme")||"K Homology domain, type 1"===m||m.includes("winged helix")||m.toLowerCase().includes("dehydrogenase")||m.includes("BAR")||m.includes("metal")||m.includes("redoxin")?[bh,wh]:m.startsWith("Tyrosine-protein kinase receptor")||"PTB/PI domain"===m||m.endsWith("receptor")||m.includes("cysteine rich")||m.includes("cysteine-rich")||"AWS domain"===m||m.toLowerCase().includes("somatomedin b")||m.includes("MHC class II")&&!m.includes("C-terminal")?[Mh,Eh]:m.toLowerCase().includes("golgi")||"GOLD domain"===m||m.includes("deaminase")||m.includes("C-terminal core")||m.includes("nucleoside triphosphatase")||m.includes("globin")||m.includes("IspD/TarI")||"Telethonin"===m||m.includes("Sarcoglycan")||m.includes("toxin")||m.includes("ShKT")||m.includes("SAM")||m.includes("Sterile alpha motif")||m.includes("Unconventional myosin-X")||"CARD domain"===m||m.includes("endonuclease")||m.toLowerCase().includes("splicing factor")||m.toLowerCase().includes("interferon")||"Tropomyosin"===m||m.includes("R1 domain")?[oh,rh]:m.includes("TM")||m.toLowerCase().includes("transmembrane")||m.toLowerCase().includes("trans-membrane")?[Bh,Ih]:m.includes("binding domain")||m.includes("binding protein")?[yh,vh]:m.includes("Ribosomal protein")||m.toLowerCase().includes("ribosomal subunit")||m.toLowerCase().includes("ribosom")||m.toLowerCase().includes("ribonuclease")?[xh,_h]:m.includes("lectin")||m.includes("recognition")||m.toLowerCase().includes("solute carrier")||m.includes("isomerase")||"Clathrin-H-link"===m?[Ph,Dh]:m.startsWith("von Willebrand factor")||m.endsWith("receptor-binding")||m.toLowerCase().includes("link")||m.includes("basic domain")||m.includes("interacting")||m.includes("domain IV")||m.toLowerCase().includes("immunoglobulin domain")?[Th,kh]:m.includes("transferase")||m.includes("merisation")?[lh,uh]:m.includes("oxygenase")?[eh,nh]:m.includes("phosphatase")||m.includes("RNA polymerase")||m.includes("catenin")?[Ah,Ch]:m.includes("bind")||m.includes("EF")?[dh,fh]:m.includes("C-termin")||m.includes("C termin")||m.includes("kinase")?[ih,ah]:m.includes("N-termin")||m.includes("N-teminal")||m.includes("N termin")||m.toLowerCase().includes("decarboxylase")||m.toLowerCase().includes("hydrolase")||m.includes("PH domain")||m.includes("cytosolic")||m.toLowerCase().includes("homeobox")?[hh,ph]:[Qf,Jf];var m;d&&(r="Signal peptide",l=8,c+=3),u&&("Helical"===r?r="Transmembrane":r.startsWith("Helical --- Name=")&&(r=r.replace("Helical --- Name=","Transmembrane: ")));const g=`${t[2]} aa`,y=`data-subpart="${r} ${sp} ${g}"`,v=`x="${a}" width="${s}" y="${c}" height="${l}"`,b=`class="subpart domain${u?" topology":""}" `,w=function(t,e,n,o,r,i=!1){const a=e+o,s=`stroke="${r}"`,c=t+n;let l="",u="";return i&&(l=``,u=``),``+l+u}(a,c,s,l,p,!u);return``+w}const ap=5,sp="|",cp="5'-UTR",lp="3'-UTR",up={"5'-UTR":20,exon:20,intron:20,"3'-UTR":20},dp={"5'-UTR":"#155069",exon:"#DAA521",intron:"#FFFFFF00","3'-UTR":"#357089"},fp={"5'-UTR":"#70A099",exon:"#BA8501","3'-UTR":"#90C0B9"},hp={"5'-UTR":"five-prime-utr",exon:"exon","3'-UTR":"three-prime-utr",intron:"intron"},pp=``,mp='Hover for details';function gp(){return document.querySelector("._ideoGeneStructureFooter")}function yp(t){const e=gp(),n=t.querySelector("svg").getAttribute("data-ideo-footer");e.innerHTML=` 
    ${n}`}function vp(t,e=0){const[n,o]=wp(t,e),r=0===o;document.querySelector("#_ideoGeneStructureMenu").options[o].selected=!0;const i=Wp(n,t,t.spliceExons)[0],a=document.querySelector("._ideoGeneStructureSvgContainer");a.innerHTML=i,$p(t.spliceExons,r),yp(a),t.addedSubpartListeners=!1,Pp(t),Np(t)}function bp(t){return t.split("-").slice(0,-1).join("-")}function wp(t,e=0){let n,o;const r=document.querySelector("#_ideoGeneStructureMenu");if(r){const t=r.options.length;n=r.selectedIndex+e,n>=t?n=0:n<0&&(n=t-1),o=r.options[n].value}else{const t=document.querySelector("._ideoGeneStructure");if(!t)return null;o=t.getAttribute("data-ideo-gene-structure-name"),n=0}const i=bp(o);return[t.geneStructureCache[i].find((t=>t.name===o)),n]}function xp(t){if("s"===t.key){const t=document.querySelector("._ideoSpliceToggle input");if(!t)return;const e=document.querySelector("#_ideoSubpartText");e&&(e.innerHTML=" "),t.dispatchEvent(new MouseEvent("click"))}}function _p(t,e){const n=t.slice(),o=e?lp:cp,r=t.some((t=>t[0]===o));return t.forEach(((o,i)=>{if(0===i)return;const a=t[i-1],s=a[0]===lp,c=a[0]===cp;"exon"===o[0]&&r&&(!e&&s||e&&c)&&o[1]!==a[1]+a[2]-1&&2!==a[2]&&(n[i]=a,n[i-1]=o)})),n}function Ap(t,e){return t.classList.contains(e)}function Cp(t,e,n,o){const r="five-prime-utr",i="three-prime-utr",a=Ap(e,r),s=Ap(e,i),c=!Ap(t,i),l=!Ap(t,r);return o&&(!n&&s&&c||n&&a&&l)}function Sp(t,e,n,o){const r=e[0]===cp,i=e[0]===lp,a=t[0]!==lp,s=t[0]!==cp;return o&&(!n&&i&&a||n&&r&&s)}function Lp(){const t="_ideoHoveredSubpart";document.querySelectorAll(`.${t}`).forEach((e=>e.classList.remove(t)))}function Tp(t){const e=Array.from(document.querySelectorAll("rect.subpart")),n="+"===document.querySelector("._ideoGeneStructure").getAttribute("data-ideo-strand"),o=function(t,e){const n=t.slice(),o=Array.isArray(t[0]);let r;if(o){const n=e?lp:cp;r=t.some((t=>t[0]===n))}else{const n=e?"three-prime-utr":"five-prime-utr";r=t.some((t=>Ap(t,n)))}return t.forEach(((i,a)=>{if(a===n.length-1)return;const s=t[a+1];(o?Sp:Cp)(i,s,e,r)&&(n.splice(a,1,s),n.splice(a+1,1,i))})),n}(e,n);if(0===o.length)return;const r="_ideoHoveredSubpart",i=document.querySelector(`.${r}`);if(!i)return t.stopPropagation(),void t.preventDefault();let a;o.forEach(((t,e)=>{t.classList.contains(r)&&(a=e)}));const s={view:window,bubbles:!1,cancelable:!0},c=new MouseEvent("mouseenter",s),l=new MouseEvent("mouseleave",s),u=n?"ArrowLeft":"ArrowRight",d=n?"ArrowRight":"ArrowLeft";let f;if(t.key===u?f="left":t.key===d&&(f="right"),void 0===f||function(t,e,n){const o="left"===n;return 0===t&&o||t===e.length-1&&!o}(a,o,f))return t.stopPropagation(),void t.preventDefault();Lp();const h=t.altKey,p=t.metaKey;if(t.key===u){i.dispatchEvent(l);let t=a-1;h&&(t=a-10<0?0:a-10),p&&(t=0),o[t].dispatchEvent(c)}else if(t.key===d){i.dispatchEvent(l);const t=o.length-1;let e=a+1;h&&(e=a+10>t?t:a+10),p&&(e=t),o[e].dispatchEvent(c)}t.stopPropagation(),t.preventDefault()}function kp(){return document.querySelector("#_ideoGeneStructureMenuContainer")}function Mp(t,e){gp().innerHTML=t,Np(e)}function Ep(t,e){const n=t;n.addEventListener("mouseenter",(t=>{Lp(),t.target.classList.add("_ideoHoveredSubpart");const o=gp();e.originalTooltipFooter=o.innerHTML,Mp(`
    ${n.getAttribute("data-subpart")}
    ${o.innerHTML.replace(" ","")}`,e);const r=kp();r&&(r.style.marginTop="")})),n.addEventListener("mouseleave",(t=>{t.target.classList.remove("_ideoHoveredSubpart"),Mp(e.originalTooltipFooter,e);const n=kp();n&&(n.style.marginTop="4px")}))}function Pp(t){const e=document.querySelectorAll("rect.subpart");if(0===e.length)return;t.subparts=e;const n=document.querySelector("._ideoGeneStructureContainer");n.addEventListener("mouseenter",(()=>{document.addEventListener("keydown",Tp),t.addedMenuListeners||(t.addedMenuListeners=!0,yp(n),document.querySelector("._ideogramTooltip").addEventListener("change",(()=>{vp(t),t.oneTimeDelayTooltipHideMs=2e3})),t.tissueCache&&(document.querySelector("._ideoTooltipFooter").style.display="none"))})),n.addEventListener("mouseleave",(e=>{t.oneTimeDelayTooltipHideMs=2e3,t.tissueCache&&(document.querySelector("._ideoTooltipFooter").style.display="");const n=function(t){const e=document.querySelector("._ideogramTooltip").getBoundingClientRect(),n=t.screenX,o=t.screenY;return n>e.left&&ne.top&&o{Ep(e,t)})))}function Dp(t){return{theme:"light-border",popperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:t}}]},onShow:function(){document.querySelectorAll("[data-tippy-root]").forEach((t=>t.remove()))}}}function Np(t){const e=Dp(["top-start","top"]);t.tippy=jf("._ideoSpliceToggle[data-tippy-content]",e);const n=Dp(["bottom"]);n.popperOptions.modifiers.push({name:"offset",options:{offset:[-5,20]}});const o=jf("._ideoMenuArrow[data-tippy-content]",n);t.tippy=t.tippy.concat(o)}function Fp(t){null!==wp(t)&&(function(t){document.addEventListener("keydown",xp);const e=document.querySelector("._ideoGeneStructureContainer"),n=document.querySelector("._ideoSpliceToggle");e&&n.addEventListener("change",(e=>{!function(t){t.spliceExons=!t.spliceExons;const e=t.spliceExons,[n,o]=wp(t),r=0===o,[,i,a]=Wp(n,t,e),s=document.querySelector("#_ideoProtein");s&&!e&&(s.style.display="none");const c=document.querySelectorAll(".intron").length>0;e||c?document.querySelectorAll(".intron").forEach((t=>t.remove())):function(t,e,n){let o=0;const r=document.querySelectorAll(".subpart");t.forEach(((t,n)=>{const i=n-o;if(e[i][0]!==t[0]){const e=t[3].summary,n=``;r[i].insertAdjacentHTML("beforebegin",n),o+=1}})),document.querySelectorAll(".intron").forEach((t=>{Ep(t,n)}))}(i,a,t),document.querySelectorAll(".subpart-line.rna").forEach((t=>t.remove()));const l=e?a:i;Di.select("._ideoGeneStructure").selectAll(".subpart").data(l).transition().duration(750).attr("x",((t,e)=>l[e][3].x)).attr("width",((t,e)=>l[e][3].width)).on("end",((n,o)=>{if(o!==l.length-1)return;s&&e&&(s.style.display=""),document.querySelectorAll(".subpart:not(.domain)").forEach(((t,e)=>{const n=Gp(l[e]);t.insertAdjacentHTML("afterend",n)})),$p(e,r);const i=document.querySelector("#_ideoTranscriptLengthBp");if(!i)return;const a=Op(l,e).toLocaleString();i.innerText=`${a} bp`,t.tippy[0].show()}))}(t),Pp(t),e.stopPropagation()}))}(t),Pp(t),function(t){document.querySelector("._ideoGeneStructureContainer").addEventListener("click",(e=>{"_ideoGeneStructureMenu"===e.target.id&&e.stopPropagation();let n=e.target;if("svg"===n.parentElement.tagName&&(n=n.parentElement),Array.from(n.classList).includes("_ideoMenuArrow")){const o=n.getAttribute("data-dir");vp(t,"down"===o?1:-1),e.stopPropagation()}}))}(t),function(t){const e=wp(t)[0].strand;if("+"===e)return;const n=document.querySelector("._ideoTooltipFooter");n.innerText=n.innerText.replace(")",`, ${e})`)}(t),Np(t))}function Bp(t){return t?"Unsplice exons (s)":"Splice exons (s)"}function Ip(t,e=!0){let n="",o=" and protein",r="without";t||(n="pre-",o="",r="with");const i=e?"Canonical":"Alternative";return{title:`${i} transcript per Ensembl, ${r} introns`,name:`${i} ${n}mRNA ${o}`}}function $p(t,e){const n=document.querySelector("._ideoGeneStructureContainerName"),o=document.querySelector("._ideoSpliceToggle");if(n&&o){[n,o].forEach((t=>t.classList.remove("pre-mRNA"))),t||[n,o].forEach((t=>t.classList.add("pre-mRNA")));const{title:r,name:i}=Ip(t,e);n.textContent=i,n.title=r}}function Op(t,e=!1){const n=t.filter((t=>"exon"===t[0]));e&&(t=n);const o=t.slice(-1)[0];return o[1]+o[2]+(e?n.length-1:0)}function Rp(t,e=null){const n=Op(t)/250/(e?3:1),o=e??t;for(let t=0;t1?`${n} of ${e} `:"",a=t[0].toUpperCase()+t.slice(1),s=r.toLocaleString();return`data-subpart="${a} ${i}${sp} ${s} bp"`}function Gp(t){const e=t[0],n=t[3].x,o=up[e],r=ap+o,i=`stroke="${fp[e]}"`;return``}function Wp(t,e,n=!1){const o=t.strand,r=t.subparts;let i,a=function(t){const e=[];let n=0;for(let o=0;on){const t=n,o=i-n-1;e.push(["intron",t,o])}n=i+a,e.push(r)}return Rp(e)}(r),s=function(t){const e=[];let n=0,o=0;for(let r=0;r0&&([,u,d]=t[r-1]),f=l?s:r>0&&s===u?o:r>0&&s<=u+d?o+d-c:n;const h=f+c,p=[a,f,c+1];e.push(p),n=h,o=f}return Rp(e)}(r);i=n?s:a;const c=document.querySelector("._ideoSpliceToggle");if(c){const t=Bp(n);c.setAttribute("data-tippy-placement","right"),c.setAttribute("data-tippy-content",t),Np(e)}const l=[],u=``;l.push(u);const d={"5'-UTR":0,exon:0,intron:0,"3'-UTR":0},f={"5'-UTR":0,exon:0,intron:0,"3'-UTR":0},h="+"===o;i=_p(i,h),a=_p(a,h),s=_p(s,h);for(let t=0;t`+Gp(e);l.push(v)}const p="position: relative; width: 274px; margin: auto;";let m=`style="${p} left: 10px;"`;"-"===o&&(m=`transform="scale(-1 1)" style="${p} left: -10px;"`);const g=t.name,y=bp(g),v=function(t,e,n){const o="_ideoGeneStructureMenuContainer",r="margin-bottom: 4px; margin-top: 4px; clear: both;",i=e.geneStructureCache[t];if(1===i.length)return`
    Transcript: ${i[0].name}
    `;const a=i.map((t=>{const e=t.name;let o="";return n&&n===t.name&&(o=" selected"),``})).join(""),s="_ideoGeneStructureMenu",c=function(){const t="width: 12px; height: 12px; cursor: pointer;user-select: none;",e='class="_ideoMenuArrow"',n='data-tippy-placement="bottom-start"',o=`${`style="${t}; margin-left: 2px;"`} ${e} data-dir="up" data-tippy-content="Previous transcript" ${n}`;return`${gc({shape:"triangle",color:"#888"},{config:{orientation:"down"}})}${gc({shape:"triangle",color:"#888"},{config:""})}`}();return`
    `+c+"
    "}(y,e,g).replaceAll('"',"'"),b=function(t,e){var n;return null===(n=e.proteinCache[t])||void 0===n?void 0:n.some((t=>t.protein.some((t=>op(t)))))}(y,e),[w,x]=function(t,e,n,o,r){let i=[];const a=bp(t),s=function(t,e){return e.config.showProteinInTooltip&&!("proteinCache"in e==0||t in e.proteinCache==0||"spliceExons"in e==0||!1===e.spliceExons)}(a,r);if(!s)return["
    ",null];const c=r.proteinCache[a].find((e=>e.transcriptName===t));if(!c)return["
    ",null];const l=c.protein,u=function(t,e){e||(t=t.slice().reverse());const n=e?"5'-UTR":"3'-UTR",o=t.filter((t=>t[0]===n)).slice(-1)[0];let r,i;o?(r=o[3].x+o[3].width,i=o[1]+o[2]):(r=0,i=0);const a=e?"3'-UTR":"5'-UTR",s=t.filter((t=>t[0]===a)).slice(-1)[0];let c,l;if(s)c=s[3].x,l=s[1];else{const e=t.slice(-1)[0];c=e[3].x+e[3].width,l=e[1]+e[2]}return{px:{start:r,length:c-r},bp:{start:i,length:l-i}}}(e,n),d=Rp(e,l),f=[];for(let t=0;t`}(u,o);return f.push(h),i=f.concat(i),[`${i.join("")}`,null]}(g,i,h,b,e),_=Op(i,n).toLocaleString(),A=[`${f.exon} exons`,`${_} bp `];if(x){const t=x.toLocaleString();A.push(`${t} aa `)}const C=t.biotype.replace(/_/g," ");"protein coding"!==C&&A.push(C);let S=""===w?"30":"50";return b&&(S="60"),[``+l.join("")+w+"",a,s]}window.swapUTRsForward=_p;const jp={Arrow:["acts on","acted on by"],TBar:["inhibits","inhibited by"],"mim-binding":["binds","binds"],"mim-catalysis":["catalyzes","catalyzed by"],"mim-cleavage":["cleaves","cleaved by"],"mim-conversion":["converts","converted by"],"mim-gap":["interacts with","interacts with"],"mim-inhibition":["inhibits","inhibited by"],"mim-modification":["modifies","modified by"],"mim-necessary-stimulation":["necessarily stimulates","necessarily stimulated by"],"mim-stimulation":["stimulates","stimulated by"],"mim-transcription-translation":["transcribes / translates","transcribed / translated by"]};function qp(t){return Object.values(t).find((t=>t.length>0&&"ixnType"in t[0]))[0].ixnType.toLowerCase()}function zp(t,e){if(void 0===t||""===t)return[[],[]];const n=Array.from(t.querySelectorAll(`DataNode[TextLabel="${e}"]`)).map((t=>({type:"node",matchedLabel:e,textLabel:t.getAttribute("TextLabel"),graphId:t.getAttribute("GraphId"),groupRef:t.getAttribute("GroupRef")}))),o=n.map((t=>t.graphId)),r=n.map((t=>t.groupRef)).map((t=>`Group[GroupId="${t}"]`)).join(",");let i=[];if(""!==r){const n=t.querySelectorAll(r);i=Array.from(n).map((t=>({type:"group",matchedLabel:e,graphId:t.getAttribute("GraphId"),groupId:t.getAttribute("GroupId")})))}const a=i.map((t=>t.graphId));return[o.concat(a),n.concat(i)]}function Up(t,e){return null==t?e:"function"==typeof t?t:e=>e[t]}function Vp(t,e=!1){const n=new Float64Array(5),o=new Float64Array(4);!function(t,e,n){const o=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),r=Math.exp(-1.783/n),i=Math.exp(-1.723/n),a=.6318/n,s=1.997/n,c=Float64Array.of(-r*Math.cos(a),r*Math.sin(a),-r*Math.cos(-a),r*Math.sin(-a),-i*Math.cos(s),i*Math.sin(s),-i*Math.cos(-s),i*Math.sin(-s)),l=2.5066282746310007*n,u=Float64Array.of(o[0],o[1],0,0,0,0,0,0),d=Float64Array.of(1,0,c[0],c[1],0,0,0,0,0,0);let f,h;for(h=2;h<8;h+=2){for(u[h]=c[h]*u[h-2]-c[h+1]*u[h-1],u[h+1]=c[h]*u[h-1]+c[h+1]*u[h-2],f=h-2;f>0;f-=2)u[f]+=c[h]*u[f-2]-c[h+1]*u[f-1],u[f+1]+=c[h]*u[f-1]+c[h+1]*u[f-2];for(f=0;f<=h;f+=2)u[f]+=o[h]*d[f]-o[h+1]*d[f+1],u[f+1]+=o[h]*d[f+1]+o[h+1]*d[f];for(d[h+2]=c[h]*d[h]-c[h+1]*d[h+1],d[h+3]=c[h]*d[h+1]+c[h+1]*d[h],f=h;f>0;f-=2)d[f]+=c[h]*d[f-2]-c[h+1]*d[f-1],d[f+1]+=c[h]*d[f-1]+c[h+1]*d[f-2]}for(h=0;h<4;++h)f=h<<1,e[h]=u[f]/l,t[h+1]=d[f+2]}(n,o,t);const r=Float64Array.of(0,o[1]-n[1]*o[0],o[2]-n[2]*o[0],o[3]-n[3]*o[0],-n[4]*o[0]),i=1+n[1]+n[2]+n[3]+n[4];return{sigma:t,negative:e,a:n,b_causal:o,b_anticausal:r,sum_causal:(o[0]+o[1]+o[2]+o[3])/i,sum_anticausal:(r[1]+r[2]+r[3]+r[4])/i}}function Yp(t,e,n,o=1,r=new Float64Array(n),i=new Float64Array(n),a=new Float64Array(5),s=r,c=Xp){const l=2*o,u=3*o,d=4*o,f=o*n;let h,p;for(c(r,e,n,o,t.b_causal,3,t.a,4,t.sum_causal,a,t.sigma),p=4,h=d;p=0&&f0)for(p=0;p=1)return t[n-1];const o=(n-1)*e,r=Math.floor(o),i=t[r];return i+(t[r+1]-i)*(o-r)}function Qp(t,e={}){const{adjust:n=1,pad:o=3,bins:r=512}=e,i=Up(e.x,(t=>t)),a=Up(e.weight,(()=>1/t.length));let s=e.bandwidth??n*function(t,e){const n=t.map(e).filter((t=>null!=t&&t>=t));n.sort(((t,e)=>t-e));const o=function(t){const e=t.length;let n,o=0,r=0,i=0;for(let a=0;a1?Math.sqrt(i/(o-1)):NaN}(n),r=Kp(n,.25),i=Kp(n,.75),a=n.length,s=(i-r)/1.34;return 1.06*(Math.min(o,s)||o||Math.abs(r)||1)*Math.pow(a,-.2)}(t,i);const[c,l]=e.extent??function(t,e,n=0){const o=t.length;let r,i;for(let n=0;n=o&&(r=i=o):(oi&&(i=o)))}return[r-n,i+n]}(t,i,o*s),u=function(t,e,n,o,r,i){const a=new Float64Array(i),s=(i-1)/(r-o);for(let r=0;rt<0));let h,p=Vp(s/d,f);function*m(t="x",e="y"){const n=g.grid(),o=1/d;for(let i=0;ih||(h=Yp(p,u,r)),extent:()=>[c,l],bandwidth(t){return arguments.length?(t!==s&&(s=t,h=null,p=Vp(s/d,f)),g):s}};return g}const Jp=12,Zp=48;function tm(t,e,n=!0,o=0,r=null){const i=function(t,e){let n=0;for(let o=0;on&&(n=i)}return n}(t,r);let a=0;if(r){const e=t.find((t=>t.tissue===r));a=e.expression.min}const s=["max","q3","median","q1","min"];return t.map((t=>{if(t.px={},n)for(let n=0;ne&&(t.px[r+"Raw"]=l,l+=e-l),l+=o,t.px[r]=l}else{const n=t.expression.min,r=t.expression.max;for(let i=0;iZp&&(i=Zp+1,a=!0);let s=a?Jp:t[e+"Height"];isNaN(s)&&(s=Jp);const c=o-s,l=c+n+.5,u=c+n+s,d="median"===e,f=t.max-t.min<=8&&d;return{x:i,y1:l,y2:u,style:f?"display: none":"",endStyle:a&&d||f?"display: none;":""}}function nm(t,e,n,o,r,i=!1){const a=t[0].toUpperCase()+t.slice(1),{x:s,y1:c,y2:l,style:u}=em(e,t,o,r),d=""===u?"":`style="${u}"`;return``}function om(t,e,n,o){return[nm("median",t,o,e,n,!1),nm("q1",t,o,e,n,!0),nm("q3",t,o,e,n,!0)]}function rm(t,e,n,o=64,r=!1){const i=t.expression.quantiles,a=t.px,s=t.samples,c=[];i.map(((t,e)=>{for(let n=0;n=70?.7:1.5}),u=Array.from(l).filter((t=>0<=t.x&&t.x<=10));if(0===u.length)return"";const d=Math.max(...u.map((t=>t.y))),f=u[0].x,h=u.slice(-1)[0].x-f,p=(("maxRaw"in a?a.maxRaw:a.max)-a.min)/h,m=n+e;let g=0;const y=u.map(((t,e)=>{let o=(t.x-f)*p+a.min;r&&o>Zp&&(o=Zp);const i=n*(t.y/d),s=m-i;return e>0&&["q1","median","q3"].forEach((t=>{const e=a[t];gZp&&(v=Zp),a.min>Zp&&(b=Zp)),y.push(v+","+m),y.push(b+","+m);const w=y[0];return y.push(w),[y.join(" "),a]}function im(t,e,n,o,r,i=64){const[a,s]=rm(t,e,n,i);return[``,s]}function am(t,e){return 1+t*(e+2)}function sm(t,e,n){const o=Zp;e=tm(e,o,!0,0);const r=Jp,i=function(t,e,n,o){const r=function(t){return`Full detail: GTEx`}(t);if(n.length<=3)return`
    ${r}

    `;const i=`|${r}`,a=o.showTissuesMore?"More...":"Less...";return`
    ${a}${o.showTissuesMore?"":i}
    `}(t,r,e,n),a=n.showTissuesMore?3:10;let s;const c=e.slice(0,a).map(((e,n)=>{s=am(n,r);const i=function(t){let e=t.replace(/_/g," ").toLowerCase();return["ba24","ba9","basal ganglia","omentum","suprapubic","lower leg","cervical c-1"].forEach((t=>e=e.replace(t,"("+t+")"))),["ba24","ba9","ebv"].forEach((t=>{e=e.replace(t,t.toUpperCase())})),["adipose","artery","brain","breast","cells","cervix","colon","heart","kidney","muscle","nerve","skin","small intestine"].forEach((t=>{e=e.replace(t,t+" -")})),e=e.replace("basal ganglia","BG"),e=e[0].toUpperCase()+e.slice(1),e}(e.tissue),a=`#${e.color}`,c=ra(a,.85),[l,u]=im(e,s,r,a,c),[d]=om(u,s,r,a),f=`data-tissue="${e.tissue}"`,h=`height="${r+2}" width="${o}px" fill="#FFF" opacity="0" x="0" y="${s}" data-gene="${t}" `+f,p=`y="${s+r}" style="font-size: ${r}px;" x="${o+10}" `+f;return`${i}`+l+d+``})).join("");let l="";return t in n.geneStructureCache||(l='style="margin-bottom: 10px;"'),`
    \n
    Reference expression by tissue
    \n ${c}\n ${i}\n
    `}function cm(t,e){const n=t.getAttribute("data-tissue");document.querySelector(`text[data-tissue="${n}"]`).setAttribute("fill",e)}function lm(t){const e=document.querySelector("._ideoMoreOrLessTissue");e&&e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),t.showTissuesMore=!t.showTissuesMore,function(t){const e=document.querySelector("._ideoTissueExpressionPlot").parentElement,n=document.querySelector("#ideo-related-gene").innerText,o=sm(n,t.tissueExpressionsByGene[n],t);e.innerHTML=o,lm(t)}(t)}));const n=document.querySelectorAll("._ideoExpressionTrace");n.forEach((e=>{e.addEventListener("mouseenter",(()=>{cm(e,"#338"),um(e,t),function(t,e){const n=t.getAttribute("data-gene"),o=t.getAttribute("data-tissue");let r=e.tissueExpressionsByGene[n].find((t=>t.tissue===o));r=tm([r],225,!1,35)[0];const i=`#${r.color}`,a=ra(i,.85),[s,c]=im(r,1,50,i,a,256),[l,u,d]=om(c,0,50,i),f=function(t,e){const n=t.px.min,o=t.expression.min,r=t.px.max,i=t.expression.max,a=t.px.median,s=t.expression.median,c=r/2,l='stroke="#CCC" stroke-width="1px"',u={config:{weight:400,annotLabelSize:12}},d=`Max.${i}`,f=Xi("Min",u).width,h=Xi(o,u).width;let p=n-f/2,m=n-h/2;const g=n+f,y=`x1="${n}" x2="${n}" y1="52" y2="60" ${l}`;let v=a-Xi("Median",u).width/2,b=a-Xi(s,u).width/2;return g>=v&&(v=a,b=a),g>=v&&(v+=1.5,b+=1.5,p=n-f-1.5,m=n-h-1.5),`Min.${o}`+d+`Median${s}`+`Expression (TPM)`+`Samples: ${t.samples} | Source: GTEx`}(r);let h;const p=document.querySelector("._ideoGeneStructureContainer"),m=document.querySelector("._ideoTooltipFooter");p?(h=p,p.style.display="none",m.style.display="none"):(h=m,document.querySelector("._ideoTissuePlotContainer").setAttribute("style","margin-bottom: 20px"));const g='
    '+f+s+l+u+d+"
    ";h.insertAdjacentHTML("beforebegin",g)}(e,t)})),e.addEventListener("mouseleave",(()=>{cm(e,"#000"),um(n[0],t,!0),function(){const t=document.querySelector("._ideoDistributionContainer");if(!t)return;t.remove();const e=document.querySelector("._ideoGeneStructureContainer");e&&(e.style.display=""),document.querySelector("._ideoTooltipFooter").style.display=""}()}))}))}function um(t,e,n=!1){const o=t.getAttribute("data-gene"),r=n?null:t.getAttribute("data-tissue"),i=e.showTissuesMore?3:10;let a=e.tissueExpressionsByGene[o];a=tm(a,Zp,!0,0,r).slice(0,i);const s=Jp;a.forEach(((t,e)=>{const o=t.tissue,r=a.find((t=>t.tissue===o)),i=am(e,s),c=!n,[l,u]=rm(r,i,s,64,c);a[e].points=l;const d=em(u,"median",i,s,c);a[e].medianLine=d})),Di.select("._ideoTissueExpressionPlot").selectAll("polyline").data(a).transition().duration(500).attr("points",((t,e)=>a[e].points)),Di.select("._ideoTissueExpressionPlot").selectAll("._ideoExpressionMedian").data(a).attr("style",((t,e)=>a[e].medianLine.style)).transition().duration(500).attr("x1",((t,e)=>a[e].medianLine.x)).attr("x2",((t,e)=>a[e].medianLine.x)).attr("y1",((t,e)=>a[e].medianLine.y1)).attr("y2",((t,e)=>a[e].medianLine.y2)).attr("style",((t,e)=>a[e].medianLine.endStyle))}function dm(t){const e=t.name,n=t.genomic_pos.ensemblgene;let o=n;return void 0===n&&(o=t.genomic_pos.filter((t=>!t.chr.includes("_")))[0].ensemblgene),{name:e,ensemblId:o}}function fm(t,e){const n=e.organismScientificName;throw Error(`"${t}" is not a known gene in ${n}`)}function hm(t,e){var n;if(!e.synonymCache)return null;const o=t.toLowerCase();if(null===(n=e.synonymCache)||void 0===n||!n.nameCaseMap){const t={};for(const n in e.synonymCache.byGene){const o=e.synonymCache.byGene[n];t[n.toLowerCase()]=o.map((t=>t.toLowerCase()))}e.synonymCache.nameCaseMap=t}const r=e.synonymCache.nameCaseMap;for(const t in r)if(r[t].includes(o))return e.geneCache.nameCaseMap[t];return null}const pm={genes:0};async function mm(t,e,n){let o;"string"==typeof t&&(t=[t]);const r=`?q=${t.map((t=>`${e}:${t.trim()}`)).join(" OR ")}&species=${n.config.taxid}&fields=`;if(n.geneCache){const r=function(t,e,n){const o=n.geneCache,r="symbol"===e,i=r?o.lociByName:o.lociById,a=r?o.idsByName:o.namesById;return t.map((t=>{const e=t.toLowerCase();if(!i[t]&&!o.nameCaseMap[e]&&!hm(t,n)){if(!r)return;fm(t,n)}let s=!1,c=null;r&&!i[t]&&(o.nameCaseMap[e]?t=o.nameCaseMap[e]:(c=t,t=hm(c,n),s=!0));const l=i[t],u=r?t:a[t],d=r?a[t]:t;return{symbol:u,name:o.fullNamesById[d],source:"cache",genomic_pos:{chr:l[0],start:l[1],end:l[2],ensemblgene:d},isSynonym:s,synonym:c}})).filter((t=>void 0!==t))}(t,e,n);r.forEach((t=>{const e=t.symbol,o=t.name,r=t.isSynonym,i=t.synonym;e in n.annotDescriptions.annots?(n.annotDescriptions.annots[e].name=o,n.annotDescriptions.annots[e].isSynonym=t.isSynonym,n.annotDescriptions.annots[e].synonym=t.synonym):n.annotDescriptions.annots[e]={name:o,isSynonym:r,synonym:i}})),o={hits:r,fromGeneCache:!0}}else{const i=`${r}symbol,genomic_pos,name`;try{o=await async function(t){const e=await fetch("https://mygene.info/v3/query"+t+"&size=400");return await e.json()}(i)}catch(r){"Failed to fetch"===r.message&&navigator.onLine&&(o=await async function(t,e,n,o){const r=pm[t];if(r>e)throw new TypeError("Failed to fetch from Ideogram third-party service for: "+t);pm[t]+=1;const i=function(t,e){const n=10*Math.random();return Math.round(500+n)*t**2}(r);return console.log(`Failed fetch for ${t} ${r} times, retrying in ${i} ms`),await(a=i,new Promise((t=>setTimeout(t,a)))),await n(...o);var a}("genes",3,mm,[t,e,n]))}}return o}async function gm(t,e,n){const o=[],r=Object.keys(t);return 0===r.length||((await mm(r,"symbol",n)).hits.forEach((r=>{if("genomic_pos"in r==0||r.symbol===e.name)return;const i=wm(r,n,"purple");o.push(i);const a=t[r.symbol.toLowerCase()],s=function(t,e,n){const o=[],r=[];let i="";if(void 0!==e){let t=e.map((t=>{const e=`https://classic.wikipathways.org/index.php/Pathway:${t.pathwayId}`;return o.push(t.pathwayId),r.push(t.name),`${t.name}`}));t=t.join("
    "),i=`Interacts with ${n.name} in:
    ${t}`}const{name:a,ensemblId:s}=dm(t);return{description:i,ixnsDescription:i,ensemblId:s,name:a,type:"interacting gene",pathwayIds:o,pathwayNames:r}}(r,a,e);km(i,s,n)})),function(t){const e={};Object.entries(t.annotDescriptions.annots).forEach((([t,n])=>{"type"in n&&n.type.includes("interacting gene")&&(e[t]=n.pathwayIds)}));const n={};Object.entries(e).forEach((([t,e])=>{n[t]={},e.map((async e=>{const o=await async function(t){if(!navigator.onLine)return"";const e=`https://cdn.jsdelivr.net/npm/ixn2/${t}.xml.gz`,n=await fetch(e);if(!n.ok)return console.log(`Gracefully degrading as request failed for: ${e}`),"";const o=await n.blob(),r=za(Wa(new Uint8Array(await o.arrayBuffer())));return(new DOMParser).parseFromString(r,"text/xml")}(e);n[t][e]=o}))})),t.gpmlsByInteractingGene=n}(n)),o}function ym(t,e){t=Cm(t,e),e.drawAnnots(t,"overlay",!0,!0),Am(e)}function vm(t,e){var n;if(!e.config.showParalogNeighborhoods)return;if((null===(n=e.neighborhoodAnnots)||void 0===n?void 0:n.length)>0)return e.neighborhoodAnnots.forEach((t=>{e.annotDescriptions.annots[t.name]=t})),void ym(e.neighborhoodAnnots,e);const o=e.relatedAnnots[0];if((t=Cm(t,e)).unshift(o),t.length<2)return;const r={};r[t[0].chr]={},r[t[0].chr][t[0].start]=[t[0]];for(let e=1;e{const s=parseInt(Object.keys(n)[0]);let c=Object.values(n)[0];if(c.length<2)return{paralogs:c};let l=!1;c[0].name===o.name&&(c=c.slice(1),l=!0);const u=("paralog","paralog"+(c.length>1?"s":""));const d=`${c.length} nearby ${u} of ${a}`,f=e.chromosomes[e.config.taxid][t].bpLength;let h=s-75e5,p=s+75e5;p>f?(h=s-i,p=f):h<1&&(h=1,p=i),"geneCache"in e&&(c=c.map((t=>{t.fullName=e.geneCache.fullNamesById[t.id];const n=e.geneCache.interestingNames;return n.includes(t.name)?t.rank=n.indexOf(t.name)+1:t.rank=1e10,t})));const m={name:"paralogNeighborhood-"+r,chr:t,start:h,stop:p,color:"pink",description:d,paralogs:c,type:"paralog neighborhood",displayCoordinates:`chr${t}:${s.toLocaleString()} ± 2 Mbp`,includesSearched:l};return e.annotDescriptions.annots[m.name]=m,m})).filter((t=>t.paralogs.length>1||t.includesSearched));e.neighborhoodAnnots=s,s.length>0&&ym(s,e)}function bm(t,e){let n=null;return n=Array.isArray(t.genomic_pos)?t.genomic_pos.filter((t=>t.chr in e.chromosomes[e.config.taxid]))[0]:t.genomic_pos,n}function wm(t,e,n="red"){const o=bm(t,e);return{name:t.symbol,chr:o.chr,start:o.start,stop:o.end,id:o.ensemblgene,color:n}}function xm(t){const e=t.innerText.toLowerCase();let n;return e.includes("interacting")&&(n="interacting"),e.includes("paralogous")&&(n="paralogous"),e.includes("searched")&&(n="searched"),n}function _m(t){function e(e){(function(t,e){t.classList+=" active";const n=function(t){return{interacting:"purple",paralogous:"pink",searched:"red"}[xm(t)]}(t);if(e.config.showAnnotLabels){e.clearAnnotLabels(),e.flattenAnnots().forEach((t=>{t.color!==n&&(document.getElementById(t.domId).style.display="none")}));const t=e.flattenAnnots().sort(((t,n)=>e.annotSortFunction(t,n))).filter((t=>t.color===n)),o=Math.min(t.length,20);e.fillAnnotLabels(t,o)}})(e.target,t),t.onHoverLegendCallback&&t.onHoverLegendCallback()}function n(){!function(t){if(document.querySelectorAll("#_ideogramLegend li").forEach((t=>{t.classList.remove("active")})),t.flattenAnnots().forEach((t=>{document.getElementById(t.domId).style.display=null})),t.config.showAnnotLabels){const e=t.flattenAnnots().sort(((e,n)=>t.annotSortFunction(e,n)));t.fillAnnotLabels(e)}}(t)}document.querySelectorAll("#_ideogramLegend li._ideoLegendEntry").forEach((t=>{t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",n);const o=xm(t),r=`class="_ideoLegendEntry" style="position: inherit; left: inherit" data-tippy-content="${{interacting:"Adjacent to searched gene in a biochemical pathway, per WikiPathways",paralogous:"Evolutionarily related to searched gene by a duplication event, per Ensembl"}[o]}" `;"paralogous"===o?t.innerHTML=`Paralogous genes`:"interacting"===o&&(t.innerHTML=`Interacting genes`)}));const o=``;document.querySelector("#_ideogramLegend").insertAdjacentHTML("afterBegin",o);const r=ia();r.maxWidth=180,r.offset=[-30,10],t.legendTippy=jf("._ideoLegendEntry[data-tippy-content]",r)}function Am(t,e=0){const n=document.querySelector("#_ideogramInnerWrap"),o=`position: absolute; top: 15px; left: ${Rm({}).legendPad+20+e}px`,r=document.querySelector("#_ideogramLegend");n.prepend(r),r.style=o,_m(t)}function Cm(t,e){if("all"===e.config.annotsInList)return t;const n=[];return t.forEach((t=>{e.config.annotsInList.includes(t.name.toLowerCase())&&n.push(t)})),n}function Sm(t,e){return new Promise((async n=>{const o=performance.now(),r=await async function(t,e){const n={},o={},r=e.config.organism.replace(/-/g," "),i=t.name.toUpperCase();let a={result:[]};if(e.interactionCache)i in e.interactionCache&&(a=e.interactionCache[i]);else{const t=`https://cdn.jsdelivr.net/npm/ixn2/${i}.json.gz`,e=await fetch(t);if(e.ok){const t=await e.blob(),n=new Uint8Array(await t.arrayBuffer());a=JSON.parse(za(Wa(n)))}}return a.result.forEach((i=>{if(i.species.toLowerCase()===r){const r=i.fields.right.values,a=i.fields.left.values,s=r.concat(a),c=i.name,l=i.id,u=function(t,e){return e&&(t=Vc(t,e)),t.sort(((t,e)=>t.rank-e.rank))}(s.map((t=>({name:t,color:""}))),e).map((t=>t.name));u.forEach((r=>{const i=r.toLowerCase();if(i.includes(t.name.toLowerCase()))return;const a=c+l,s=function(t,e,n,o,r){let i;return i="geneCache"in r&&e.name?t.toLowerCase()in r.geneCache.nameCaseMap:function(t,e){return""!==t&&!t.includes(" ")&&!t.includes("/")&&t.toLowerCase()!==e.name.toLowerCase()}(t,e),i&&!(n in o)}(i,t,a,o,e);if(s){o[a]=1;const t={name:c,pathwayId:l};i in n?n[i].push(t):n[i]=[t]}}))}})),n}(t,e),i=await gm(r,t,e);e.relatedAnnots.push(...i),Pm("interacting",e),e.time.rg.interactions=zf(o),vm(i,e),n()}))}function Lm(t,e){return new Promise((async n=>{const o=performance.now(),r=await async function(t,e){const n=e.config.taxid;let o;if(e.paralogCache){const n=e.paralogCache.paralogsByName,r=t.name.toUpperCase();o=r in n?n[r]:[]}else{const e=`&format=condensed&type=paralogues&target_taxon=${n}`,r=`/homology/id/${t.id}?${e}`;o=(await Ideogram.fetchEnsembl(r)).data[0].homologies}let r=await async function(t,e,n){const o=[],r=t.length&&"string"==typeof t[0]?t:t.map((t=>t.id));return(await mm(r,"ensemblgene",n)).hits.forEach((t=>{if("genomic_pos"in t==0)return;if("name"in t==0)return;const r=wm(t,n,"pink");o.push(r);const i=n.tissueCache?"":`Paralog of ${e.name}`,{name:a,ensemblId:s}=dm(t);km(r,{description:i,ensemblId:s,name:a,type:"paralogous gene"},n)})),o}(o,t,e);return r=r.filter((t=>!t.name.match(/^AC[0-9.]+$/))),r}(t,e);e.relatedAnnots.push(...r),Pm("paralogous",e),vm(r,e),e.time.rg.paralogs=zf(o),n()}))}function Tm(t,e){var n,o,r,i;if("name"in t?(n=t.name,o=e.name,r=t.color,i=e.color):([n,r]=[t[0],t[3]],[o,i]=[e[0],e[3]]),"initRank"in t==0){if("red"===r)return-1;if("red"===i)return 1;if("purple"===r&&"pink"===i)return-1;if("purple"===i&&"pink"===r)return 1}return t.rank-e.rank}function km(t,e,n){let o;const r=n.annotDescriptions.annots;if(t.name in r){const i=r[t.name];if(o=e,e.type===i.type)return;Object.keys(i).forEach((function(t){t in o==0&&(o[t]=i[t])})),"type"in i&&!n.tissueCache&&(o.type+=", "+i.type,o.description+=`

    ${i.description}`)}else o=e;n.annotDescriptions.annots[t.name]=o}function Mm(t,e,n){setTimeout((()=>{n<40&&(e.tissueCache?Em(t,e):Mm(t,e,n+1))}),50)}async function Em(t,e){if(!e.tissueCache)return void Mm(t,e,0);const n={},o=e.tissueCache,r=[];t.forEach((async t=>{const i=new Promise((async r=>{const i=await o.getTissueExpressions(t,e);n[t]=i,r()}));r.push(i)})),await Promise.all(r),e.tissueExpressionsByGene=n}function Pm(t,e){let n=e.relatedAnnots;if(n.length>1&&e.onFindGenesCallback&&e.onFindGenesCallback(),n=function(t){const e={};let n=[];return t.forEach((t=>{t.name in e==0?(n.push(t),e[t.name]=1):"purple"===t.color&&(n=n.map((e=>t.name===e.name?t:e)))})),n}(n),function(t,e){t=Cm(t,e),e.drawAnnots(t)}(n,e),e.config.showAnnotLabels){const t=e.flattenAnnots().sort(((t,n)=>e.annotSortFunction(t,n)));e.fillAnnotLabels(t)}Am(e),function(t,e){if("pathway"===t)return;const n=e.getRelatedGenesByType(),o={paralogous:"interacting",interacting:"paralogous"}[t],r=n[t].length,i=n[o]?n[o].length:0;if(e._didRelatedGenesFirstPlot)if(r>0&&i>0){const t=e.time.rg.timestampFirstPlot;e.time.rg.totalLastPlotDiff=zf(t)}else r>0&&0===i?(e.time.rg.timestampFirstPlot=performance.now(),e.time.rg.totalFirstPlot=zf(e.time.rg.t0),e._relatedGenesFirstPlotType=t,e.time.rg.totalLastPlotDiff=0):(0===r&&i>0||(e._relatedGenesFirstPlotType="searched"),e.time.rg.totalLastPlotDiff=0);else e._didRelatedGenesFirstPlot=!0,e.time.rg.totalFirstPlot=zf(e.time.rg.t0),r>0&&(e.time.rg.timestampFirstPlot=performance.now(),e._relatedGenesFirstPlotType=t)}(t,e)}function Dm(t){var e=document.querySelector(t.config.container);e.style.visibility="",e.style.position="absolute",e.style.width="100%";var n=document.querySelector("#_ideogramInnerWrap");n.style.position="relative",n.style.marginLeft="auto",n.style.marginRight="auto",n.style.overflowY="hidden",document.querySelector("#_ideogramMiddleWrap").style.overflowY="hidden";const o=t.config.legendPad;if(void 0===t.didAdjustIdeogramLegend){var r=document.querySelector("#_ideogram");const e=160;n.style.maxWidth=parseInt(n.style.maxWidth)+e+o+"px",r.style.minWidth=parseInt(r.style.minWidth)+o+"px",r.style.maxWidth=parseInt(r.style.minWidth)+o+"px",r.style.position="relative",r.style.left=e+"px",t.didAdjustIdeogramLegend=!0}}async function Nm(t=null){const e=this;if(!t)return Gm();e.clearAnnotLabels();const n=document.querySelector("#_ideogramLegend");n&&n.remove(),e.config=Rm(e.config),function(t,e){const n=[`# ${e}`,`# Organism: ${t.getScientificName(t.config.taxid)}`,`# Generated by Ideogram.js version ${Ideogram.version}, https://github.com/eweitz/ideogram`,`# Generated at ${window.location.href}`].join("\n");delete t.annotDescriptions,t.annotDescriptions={headers:n,annots:{}}}(e,`Related genes for ${t}`);const o=e.selector+" .annot";document.querySelectorAll(o).forEach((t=>t.remove())),e.startHideAnnotTooltipTimeout(),document.querySelectorAll(".chromosome").forEach((t=>{t.style.cursor=""})),Dm(e),e.relatedAnnots=[],e.neighborhoodAnnots=[];const r=await async function(t,e){const n=performance.now(),o=await mm(t,"symbol",e);if(0===o.hits.length)return;const r=o.hits.find((t=>{const n=bm(t,e);return n&&n.ensemblgene}));let i={description:"",ensemblId:r.genomic_pos.ensemblgene,type:"searched gene"};if(r.symbol in e.annotDescriptions.annots){const t=e.annotDescriptions.annots[r.symbol];i=Object.assign(t,i)}else i.name=r.name;e.annotDescriptions.annots[r.symbol]=i;const a=wm(r,e);return e.relatedAnnots.push(a),e.time.rg.searchedGene=zf(n),a}(t,e);void 0===r&&fm(t,e),e.config.legend=$m,bc(e),Am(e),await Promise.all([Sm(r,e),Lm(r,e)]),e.time.rg.total=zf(e.time.rg.t0),function(t){const e=Yf(t),n=t.time.rg.total,o=t.time.rg.totalFirstPlot,r=t.time.rg.totalLastPlotDiff,i=t.time.rg.paralogs,a=t.time.rg.interactions,s=t.time.rg.searchedGene,c=t._relatedGenesFirstPlotType,l=Object.assign({firstPlotType:c,timeTotal:n,timeTotalFirstPlot:o,timeTotalLastPlotDiff:r,timeSearchedGene:s,timeInteractingGenes:a,timeParalogs:i},e);t.relatedGenesAnalytics=l}(e),e.onPlotFoundGenesCallback&&e.onPlotFoundGenesCallback()}function Fm(t,e,n){if("type"in e&&e.type.includes("interacting gene")){const o=e.pathwayIds,r=function(t){return Object.entries(t.annotDescriptions.annots).find((([t,e])=>"searched gene"===e.type))[0]}(n),i=n.gpmlsByInteractingGene[t.name],a=function(t,e,n,o){let r=null;if(!navigator.onLine)return"Interacts with";const i=function(t,e,n,o){const r={};return n.map((n=>{const i=o[n],a=function(t,e,n){if(void 0===n||""===n)return[];const[o,r]=zp(n,e),[i,a]=zp(n,t),s={searchedGene:r,interactingGene:a},c=o.concat(i),l={searchedGeneGraphIds:o,matchingGraphIds:c},u=[],d=n.querySelectorAll("Interaction Graphics");return Array.from(d).forEach((t=>{const e=function(t,e){let n=null;const{searchedGeneGraphIds:o,matchingGraphIds:r}=e,i=[];let a=0,s=!1,c=null,l=null;return Array.from(t.children).forEach((t=>{if("Point"!==t.nodeName)return;const e=t,n=e.getAttribute("GraphRef");if(null!==n&&r.includes(n)&&(a+=1,i.push(n),o.includes(n)&&(s=!0),e.getAttribute("ArrowHead"))){const t=e.getAttribute("ArrowHead"),r=o.includes(n);null===l&&(l=r?0:1);try{c=jp[t][r?0:1]}catch(t){}}})),a>=2&&s&&(null!==l&&null!==c||(c="interacts with"),c=c[0].toUpperCase()+c.slice(1),n={interactionId:t.parentNode.getAttribute("GraphId"),endIds:i,ixnType:c}),n}(t,l);null!==e&&(e.elements=s,u.push(e))})),u}(t,e,i);r[n]=a})),r}(t,e,n,o),a=i[n[0]];if(a.length>0){let t={ixnsByPwid:i,isSameByPwid:{},isSame:null,isDirectionSameByPwid:{},isDirectionSame:null,directionsByPwid:{}};t=function(t){let e=!0;const n=t.ixnsByPwid,o=qp(n);return Object.entries(n).map((([n,r])=>{const{isRefMatch:i,thisIsSame:a}=function(t,e){let n=!0,o=!0;if(0===t.length)return{isRefMatch:n,thisIsSame:o};const r=t[0].ixnType.toLowerCase();return t.forEach((t=>{const i=t.ixnType.toLowerCase();i!==e&&(n=!1),i!==r&&(o=!1)})),{isRefMatch:n,thisIsSame:o}}(r,o);a&&i||(e=!1),t.isSameByPwid[n]=a})),t.isSame=e,t}(t),t.isSame?r=a[0].ixnType:(t=function(t){let e=!0;const n=[],o=[];Object.values(jp).forEach((t=>{o.push(t[0]),n.push(t[1])}));const r="Acts on",i="Acted on by",a=t.ixnsByPwid,s=qp(a),c=o.includes(s)?r:i;return Object.entries(a).map((([n,a])=>{let s=!0;if(a.length>0){const l=a[0].ixnType.toLowerCase(),u=o.includes(l)?r:i;a.forEach((a=>{const l=a.ixnType.toLowerCase(),d=o.includes(l)?r:i;t.directionsByPwid[n]=d,d!==c&&(e=!1),d!==u&&(s=!1)}))}t.isDirectionSameByPwid[n]=s})),t.isDirectionSame=e,!0===e&&(t.direction=c),t}(t),r=t.isDirectionSame?t.direction:"Interacts with")}return r}(t.name,r,o,i);if(null!==a){const t="Interacts with";e.description=e.description.replace(t,a)}}return e}const Bm="triangle";function Im(t,e=null){let n=`
    ${t}
    `;return e&&(n=e),`\n
    \n ${n}\n Click gene to search\n
    \n `}const $m=[{name:Im("Related genes"),nameHeight:50,rows:[{name:"Interacting gene",color:"purple",shape:Bm},{name:"Paralogous gene",color:"pink",shape:Bm},{name:"Searched gene",color:"red",shape:Bm}]}];Im("Related genes");const Om=[{name:Im("Highly cited genes"),nameHeight:30,rows:[]}];function Rm(t){return t.legendPad=t.showAnnotLabels?70:30,t}const Hm={chrWidth:9,chrHeight:100,chrLabelSize:12,annotationHeight:7,showFullyBanded:!1,rotatable:!1,legend:$m,chrBorderColor:"#333",chrLabelColor:"#333",onBeforeDrawAnnots:function(){const t=this;!function(t){const e=[],n=t.chromosomesArray.map((t=>t.name));if("relatedAnnots"in t){t.relatedAnnots=Cm(t.relatedAnnots,t);const e={};t.relatedAnnots=t.relatedAnnots.filter((t=>!(t.name in e)&&(e[t.name]=1,!0)))}const o={};t.annots.forEach((e=>{const n=e.annots.sort(((e,n)=>-t.annotSortFunction(e,n)));o[e.chr]=n}));const r={};Object.entries(o).forEach((([t,o])=>{r[t]={chr:t,annots:[]},o.forEach(((e,o)=>{const i=n.indexOf(t);e.domId=Ic(i,o),r[t].annots.push(e)})),e.push(r[t])})),t.annots=e}(t);const e=[],n=t.annots;for(let r=0;r0?`
    ${r.description}`:"",a=r.name,s="color: #0366d6; cursor: pointer;";let c=a;"rank"in t&&(c=`${a}`);let l="";null!==(n=r)&&void 0!==n&&n.isSynonym&&(l=`
    Synonym: ${r.synonym}
    `);const u=t.name.includes("paralogNeighborhood"),d=function(t,e,n){let o="";const r=t.name;if(e.config.showGeneStructureInTooltip&&!n&&"geneStructureCache"in e!=0&&r in e.geneStructureCache!=0){e.addedSubpartListeners=!1,"spliceExons"in e==0&&(e.spliceExons=!0);const t=e.spliceExons,n=Wp(e.geneStructureCache[r][0],e,t)[0],i='class="_ideoGeneStructureContainer"',a=function(t){const e=t.spliceExons,n=e?"checked":"";return``}(e),s=`class="_ideoGeneStructureContainerName${t?"":" pre-mRNA"}"`,{name:c,title:l}=Ip(t);o="

    "+pp+`
    `+`
    ${c}${a}
    `+n+'
    '+mp+"
    "}return o}(t,o,u),f=function(t,e){if(!e.tissueCache||!(t.name in e.tissueCache.byteRangesByName))return"
    ";void 0===e.showTissuesMore&&(e.showTissuesMore=!0);const n=t.name,o=e.tissueExpressionsByGene[n];return o?sm(n,o,e):void 0}(t,o);let h=`\n ${t.name}
    ${c}
    \n
    `+l+i+f+d;return u&&([t,h]=function(t,e,n){const o=e.paralogs.sort(((t,e)=>t.rank-e.rank)),r="Paralog neighborhood

    "+e.description+":
    "+`${o.map((t=>{let e="";return t.fullName&&(e=t.fullName),t.rank&&(e+=` Ranked ${t.rank} in general or scholarly interest`),""!==e&&(e=`title="${e}"`),`${t.name}`})).join("
    ")}
    `;return t.displayCoordinates=e.displayCoordinates,[t,r]}(t,r,s)),t.displayName=h,t},onDidShowAnnotTooltip:function(){const t=this;t.tissueCache&&function(){const t=document.querySelector("#_ideogramTooltip"),e=t.getBoundingClientRect().top,n=document.querySelector("#_ideogram").getBoundingClientRect().top;e>n&&(t.style.top=n+"px")}(),function(t){const e=document.querySelector("._ideogramTooltip");t.addedTooltipClickHandler||(e.addEventListener("click",(e=>{if(["input","label"].includes(e.target.localName))return;let n=document.querySelector("#ideo-related-gene");n||(n=e.target);const o=function(t,e){var n;return e.annots.forEach((e=>{e.annots.forEach((e=>{t===e.name&&(n=e)}))})),null===n&&(n=e.annotDescriptions.annots[t]),n}(n.textContent,t);t.onClickAnnot(o)})),t.addedTooltipClickHandler=!0)}(t),Fp(t),lm(t),t.tissueTippy=jf("._ideoGeneTissues[data-tippy-content]",ia())},showTools:!0,showAnnotLabels:!0,chrFillColor:{centromere:"#DAAAAA"}};function Gm(){const t=this;if(!t||"annotDescriptions"in t)return;t.annotDescriptions={annots:{}},t.flattenAnnots().map((e=>{let n=[];"significance"in e&&"n/a"!==e.significance&&n.push(e.significance),"citations"in e&&void 0!==e.citations&&n.push(e.citations),n=n.join("

    "),t.annotDescriptions.annots[e.name]={description:n,name:decodeURIComponent(e.fullName)}})),Dm(t),Am(t,-60);const e=t.config.container;if(document.querySelector(e).style.visibility="",t.config.showAnnotLabels){const e=t.flattenAnnots().sort(((e,n)=>t.annotSortFunction(e,n)));t.fillAnnotLabels(e)}}function Wm(t,e,n){if("all"!==n&&(n=n.map((t=>t.toLowerCase()))),e.annotsInList=n,t.legendPad=t.showAnnotLabels?80:30,"onWillShowAnnotTooltip"in e){const n="onWillShowAnnotTooltip",o=e[n],r=t[n],i=function(t){return t=r.bind(this)(t),o.bind(this)(t)};t[n]=i,delete e[n]}if("onDidShowAnnotTooltip"in e){const n="onDidShowAnnotTooltip",o=e[n],r=t[n],i=function(t){return t=r.bind(this)(t),o.bind(this)(t)};t[n]=i,delete e[n]}if("onBeforeDrawAnnots"in e){const n="onBeforeDrawAnnots",o=e[n],r=t[n],i=function(){r&&r.bind(this)(),o.bind(this)()};t[n]=i,delete e[n]}if("onDrawAnnots"in e){const n="onDrawAnnots",o=e[n],r=t[n],i=function(){r&&r.bind(this)(),o.bind(this)()};t[n]=i,delete e[n]}const o=Object.assign(t,e),r=new Ideogram(o);var i;return e.onFindGenes&&(r.onFindGenesCallback=e.onFindGenes),e.onPlotFoundGenes&&(r.onPlotFoundGenesCallback=e.onPlotFoundGenes),e.onHoverLegend&&(r.onHoverLegendCallback=e.onHoverLegend),r.getTooltipAnalytics=Vf,r.annotSortFunction=Tm,(i=r).time={rg:{t0:performance.now()}},"_didRelatedGenesFirstPlot"in i&&delete i._didRelatedGenesFirstPlot,r}class jm{constructor(t){this.configure=ca,this.initDrawChromosomes=As,this.onLoad=Ss,this.handleRotateOnClick=Cs,this.init=Ds,this.finishInit=cs,this.writeContainer=ys,this.onLoadAnnots=Qs,this.onDrawAnnots=Js,this.processAnnotData=Rc,this.restoreDefaultTracks=Pc,this.updateDisplayedTracks=Dc,this.initAnnotSettings=Wc,this.fetchAnnots=zc,this.drawAnnots=wc,this.getHistogramBars=pc,this.drawHeatmaps=Ys,this.deserializeAnnotsForHeatmap=Ks,this.fillAnnots=Uc,this.drawProcessedAnnots=xc,this.drawSynteny=Ec,this.startHideAnnotTooltipTimeout=tc,this.showAnnotTooltip=rc,this.onWillShowAnnotTooltip=ec,this.onDidShowAnnotTooltip=nc,this.onClickAnnot=oc,this.setOriginalTrackIndexes=Nc,this.afterRawAnnots=jc,this.downloadAnnotations=Gc,this.addAnnotLabel=uc,this.removeAnnotLabel=fc,this.fillAnnotLabels=dc,this.clearAnnotLabels=hc,this.flattenAnnots=qc,this.highlight=Yc,this.unhighlight=Xc,this.esearch=Jc,this.esummary=Zc,this.elink=tl,this.getOrganismFromEutils=nl,this.getTaxids=al,this.getAssemblyAndChromosomesFromEutils=cl,this.drawBandLabels=gl,this.getBandColorGradients=vl,this.processBandData=Al,this.setBandsToShow=hl,this.hideUnshownBandLabels=ll,this.drawBandLabelText=pl,this.drawBandLabelStalk=ml,this.onBrushMove=Cl,this.onBrushEnd=Sl,this.createBrush=Ll,this.createClickCursor=kl,this.onCursorMove=Tl,this.drawSexChromosomes=Ml,this.setSexChromosomes=El,this.convertBpToPx=Pl,this.convertPxToBp=Nl,this.unpackAnnots=gu,this.packAnnots=yu,this.initCrossFilter=vu,this.filterAnnots=bu,this.assemblyIsAccession=Ni,this.getDataDir=Ii,this.round=$i,this.onDidRotate=Oi,this.getSvg=Ri,this.fetch=Hi,this.getTaxid=Gi,this.getCommonName=Wi,this.getScientificName=ji,this.getChromosomeModel=xu,this.getChromosomePixels=wu,this.drawChromosomeLabels=Hu,this.rotateChromosomeLabels=Gu,this.appendHomolog=Iu,this.drawChromosome=$u,this.rotateAndToggleDisplay=Ou,this.setOverflowScroll=Ru,this.plotRelatedGenes=Nm,this.getRelatedGenesByType=Uf,this.configure(t)}static get version(){return a}static get d3(){return Di}static async fetchEnsembl(t,e=null,n="GET"){const o={method:n};if(null!==e&&(o.body=JSON.stringify(e)),"GET"===n){const e=t.includes("&")?"&":"?";t+=e+"content-type=application/json"}else o.headers={"Content-Type":"application/json"};const r=await fetch(`https://rest.ensembl.org${t}`,o);return await r.json()}static getChrSortNamesAndTypes(t,e){var n,o,r,i,a,s,c,l,u,d;return"string"==typeof t||"chr"in t&&"annots"in t?(a="MT"===(n="string"==typeof t?t:t.chr),s="MT"===(o="string"==typeof e?e:e.chr),c="AP"===n,l="AP"===o,u=!(r="CP"===n)&&!a&&!c,d=!(i="CP"===o)&&!s&&!l):(n=t.name,o=e.name,r="chloroplast"===t.type,i="chloroplast"===e.type,a="mitochondrion"===t.type,s="mitochondrion"===e.type,c="apicoplast"===t.type,l="apicoplast"===e.type,u="nuclear"===t.type,d="nuclear"===e.type),[n,o,{aIsNuclear:u,bIsNuclear:d,aIsCP:r,bIsCP:i,aIsMT:a,bIsMT:s,aIsAP:c,bIsAP:l}]}static sortChromosomes(t,e){let[n,o,r]=jm.getChrSortNamesAndTypes(t,e);const{aIsNuclear:i,bIsNuclear:a,aIsCP:s,bIsCP:c,aIsMT:l,bIsMT:u,aIsAP:d,bIsAP:f}=r;return i&&a?(Ui(n)&&Ui(o)&&(n=Vi(n).toString(),o=Vi(o).toString()),n.localeCompare(o,"en",{numeric:!0})):!i&&a||l&&c?1:s&&u?-1:d||l||s||!(u||c||f)?void 0:-1}static initRelatedGenes(t,e="all"){return function(t,e){return"leads"===t.relatedGenesMode&&(delete t.onDrawAnnots,delete t.relatedGenesMode),Wm(Object.assign({showParalogNeighborhoods:!0,isLegendInteractive:!0,relatedGenesMode:"related",useCache:!0,awaitCache:!0},Hm),t,e)}(t,e)}static initGeneLeads(t,e="all"){return function(t,e){if(delete t.onPlotFoundGenes,t.legendName)if(t.legendContent)Om[0].name=Im(t.legendName,t.legendContent);else if(t.geneLeadsDE){const e=`Gene leads from
    ${fileIcon} Publication
    ${deltaIcon} Differential expression

    `;Om[0].name=Im(t.legendName,e)}else Om[0].name=Im(t.legendName);let n,o;return t.legend=Om,t.geneLeadsDE?(o="leads",n="annotations/gene_leads.tsv"):(o="hints",n="cache/homo-sapiens-top-genes.tsv"),Wm(Object.assign({relatedGenesMode:o,chrMargin:-4,annotationsPath:Fi(n),onDrawAnnots:Gm,useCache:!0},Hm),t,e)}(t,e)}}window.Ideogram=jm;const qm=jm})(),o})())); +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(self,(()=>(()=>{"use strict";var t={913:()=>{try{self["workbox:core:7.0.0"]&&_()}catch(t){}},762:()=>{try{self["workbox:range-requests:7.0.0"]&&_()}catch(t){}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{default:()=>qm});var t={};n.r(t),n.d(t,{blob:()=>xt,buffer:()=>At,csv:()=>Gt,dsv:()=>Ht,html:()=>Yt,image:()=>jt,json:()=>zt,svg:()=>Xt,text:()=>Ot,tsv:()=>Wt,xml:()=>Vt});var e={};n.r(e),n.d(e,{brush:()=>qr,brushSelection:()=>Gr,brushX:()=>Wr,brushY:()=>jr});var r={};n.r(r),n.d(r,{dispatch:()=>ee});var i={};n.r(i),n.d(i,{FormatSpecifier:()=>Qr,format:()=>ni,formatDefaultLocale:()=>si,formatLocale:()=>ai,formatPrefix:()=>oi,formatSpecifier:()=>Kr,precisionFixed:()=>ci,precisionPrefix:()=>li,precisionRound:()=>ui});const a="1.45.1";function s(){}function c(t){return null==t?s:function(){return this.querySelector(t)}}function l(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function u(){return[]}function d(t){return null==t?u:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function h(t){return function(e){return e.matches(t)}}var p=Array.prototype.find;function m(){return this.firstElementChild}var g=Array.prototype.filter;function y(){return this.children}function v(t){return new Array(t.length)}function b(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function w(t,e,n,o,r,i){for(var a,s=0,c=e.length,l=i.length;se?1:t>=e?0:NaN}b.prototype={constructor:b,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)}};var C="http://www.w3.org/1999/xhtml";const S={svg:"http://www.w3.org/2000/svg",xhtml:C,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function L(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),S.hasOwnProperty(e)?{space:S[e],local:t}:t}function T(t){return function(){this.removeAttribute(t)}}function k(t){return function(){this.removeAttributeNS(t.space,t.local)}}function M(t,e){return function(){this.setAttribute(t,e)}}function E(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function D(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function N(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function F(t){return function(){this.style.removeProperty(t)}}function B(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var o=e.apply(this,arguments);null==o?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function $(t,e){return t.style.getPropertyValue(e)||N(t).getComputedStyle(t,null).getPropertyValue(e)}function O(t){return function(){delete this[t]}}function R(t,e){return function(){this[t]=e}}function H(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function G(t){return t.trim().split(/^|\s+/)}function W(t){return t.classList||new j(t)}function j(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function q(t,e){for(var n=W(t),o=-1,r=e.length;++o=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var mt=[null];function gt(t,e){this._groups=t,this._parents=e}function yt(){return new gt([[document.documentElement]],mt)}gt.prototype=yt.prototype={constructor:gt,select:function(t){"function"!=typeof t&&(t=c(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r=C&&(C=A+1);!(b=y[C])&&++C=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=A);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i1?this.each((null==e?F:"function"==typeof e?I:B)(t,e,null==n?"":n)):$(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?O:"function"==typeof e?H:R)(t,e)):this.node()[t]},classed:function(t,e){var n=G(t+"");if(arguments.length<2){for(var o=W(this.node()),r=-1,i=n.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=e?dt:ut,o=0;o=i?c=!0:(o=t.charCodeAt(a++))===Tt?l=!0:o===kt&&(l=!0,t.charCodeAt(a)===Tt&&++a),t.slice(r+1,e-1).replace(/""/g,'"')}for(;a9999?"+"+Pt(e,6):Pt(e,4))+"-"+Pt(t.getUTCMonth()+1,2)+"-"+Pt(t.getUTCDate(),2)+(i?"T"+Pt(n,2)+":"+Pt(o,2)+":"+Pt(r,2)+"."+Pt(i,3)+"Z":r?"T"+Pt(n,2)+":"+Pt(o,2)+":"+Pt(r,2)+"Z":o||n?"T"+Pt(n,2)+":"+Pt(o,2)+"Z":"")}(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,r,i=o(t,(function(t,o){if(n)return n(t,o-1);r=t,n=e?function(t,e){var n=Mt(t);return function(o,r){return e(n(o),r,t)}}(t,e):Mt(t)}));return i.columns=r||[],i},parseRows:o,format:function(e,n){return null==n&&(n=Et(e)),[n.map(a).join(t)].concat(r(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Et(t)),r(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var Nt=Dt(","),Ft=Nt.parse,Bt=(Nt.parseRows,Nt.format,Nt.formatBody,Nt.formatRows,Nt.formatRow,Nt.formatValue,Dt("\t")),It=Bt.parse;function $t(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Ot(t,e){return fetch(t,e).then($t)}function Rt(t){return function(e,n,o){return 2===arguments.length&&"function"==typeof n&&(o=n,n=void 0),Ot(e,n).then((function(e){return t(e,o)}))}}function Ht(t,e,n,o){3===arguments.length&&"function"==typeof n&&(o=n,n=void 0);var r=Dt(t);return Ot(e,n).then((function(t){return r.parse(t,o)}))}Bt.parseRows,Bt.format,Bt.formatBody,Bt.formatRows,Bt.formatRow,Bt.formatValue;var Gt=Rt(Ft),Wt=Rt(It);function jt(t,e){return new Promise((function(n,o){var r=new Image;for(var i in e)r[i]=e[i];r.onerror=o,r.onload=function(){n(r)},r.src=t}))}function qt(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function zt(t,e){return fetch(t,e).then(qt)}function Ut(t){return(e,n)=>Ot(e,n).then((e=>(new DOMParser).parseFromString(e,t)))}const Vt=Ut("application/xml");var Yt=Ut("text/html"),Xt=Ut("image/svg+xml"),Kt={value:()=>{}};function Qt(){for(var t,e=0,n=arguments.length,o={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!o.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,o,r=new Array(n),i=0;i>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ae(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ae(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=fe.exec(t))?new Se(e[1],e[2],e[3],1):(e=he.exec(t))?new Se(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=pe.exec(t))?Ae(e[1],e[2],e[3],e[4]):(e=me.exec(t))?Ae(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ge.exec(t))?Pe(e[1],e[2]/100,e[3]/100,1):(e=ye.exec(t))?Pe(e[1],e[2]/100,e[3]/100,e[4]):ve.hasOwnProperty(t)?_e(ve[t]):"transparent"===t?new Se(NaN,NaN,NaN,0):null}function _e(t){return new Se(t>>16&255,t>>8&255,255&t,1)}function Ae(t,e,n,o){return o<=0&&(t=e=n=NaN),new Se(t,e,n,o)}function Ce(t,e,n,o){return 1===arguments.length?((r=t)instanceof ie||(r=xe(r)),r?new Se((r=r.rgb()).r,r.g,r.b,r.opacity):new Se):new Se(t,e,n,null==o?1:o);var r}function Se(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}function Le(){return`#${Ee(this.r)}${Ee(this.g)}${Ee(this.b)}`}function Te(){const t=ke(this.opacity);return`${1===t?"rgb(":"rgba("}${Me(this.r)}, ${Me(this.g)}, ${Me(this.b)}${1===t?")":`, ${t})`}`}function ke(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Me(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ee(t){return((t=Me(t))<16?"0":"")+t.toString(16)}function Pe(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ne(t,e,n,o)}function De(t){if(t instanceof Ne)return new Ne(t.h,t.s,t.l,t.opacity);if(t instanceof ie||(t=xe(t)),!t)return new Ne;if(t instanceof Ne)return t;var e=(t=t.rgb()).r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,s=i-r,c=(i+r)/2;return s?(a=e===i?(n-o)/s+6*(n0&&c<1?0:a,new Ne(a,s,c,t.opacity)}function Ne(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}function Fe(t){return(t=(t||0)%360)<0?t+360:t}function Be(t){return Math.max(0,Math.min(1,t||0))}function Ie(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function $e(t,e,n,o,r){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*n+(1+3*t+3*i-3*a)*o+a*r)/6}oe(ie,xe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:be,formatHex:be,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return De(this).formatHsl()},formatRgb:we,toString:we}),oe(Se,Ce,re(ie,{brighter(t){return t=null==t?se:Math.pow(se,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ae:Math.pow(ae,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Se(Me(this.r),Me(this.g),Me(this.b),ke(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Le,formatHex:Le,formatHex8:function(){return`#${Ee(this.r)}${Ee(this.g)}${Ee(this.b)}${Ee(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Te,toString:Te})),oe(Ne,(function(t,e,n,o){return 1===arguments.length?De(t):new Ne(t,e,n,null==o?1:o)}),re(ie,{brighter(t){return t=null==t?se:Math.pow(se,t),new Ne(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ae:Math.pow(ae,t),new Ne(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new Se(Ie(t>=240?t-240:t+120,r,o),Ie(t,r,o),Ie(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new Ne(Fe(this.h),Be(this.s),Be(this.l),ke(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ke(this.opacity);return`${1===t?"hsl(":"hsla("}${Fe(this.h)}, ${100*Be(this.s)}%, ${100*Be(this.l)}%${1===t?")":`, ${t})`}`}}));const Oe=t=>()=>t;function Re(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Oe(isNaN(t)?e:t)}const He=function t(e){var n=function(t){return 1==(t=+t)?Re:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}(e,n,t):Oe(isNaN(e)?n:e)}}(e);function o(t,e){var o=n((t=Ce(t)).r,(e=Ce(e)).r),r=n(t.g,e.g),i=n(t.b,e.b),a=Re(t.opacity,e.opacity);return function(e){return t.r=o(e),t.g=r(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function Ge(t){return function(e){var n,o,r=e.length,i=new Array(r),a=new Array(r),s=new Array(r);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),r=t[o],i=t[o+1],a=o>0?t[o-1]:2*r-i,s=oi&&(r=e.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,c.push({i:a,x:qe(n,o)})),i=Ve.lastIndex;return ie?1:t>=e?0:NaN}sn.prototype={constructor:sn,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)}};var hn="http://www.w3.org/1999/xhtml";const pn={svg:"http://www.w3.org/2000/svg",xhtml:hn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function mn(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),pn.hasOwnProperty(e)?{space:pn[e],local:t}:t}function gn(t){return function(){this.removeAttribute(t)}}function yn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vn(t,e){return function(){this.setAttribute(t,e)}}function bn(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function wn(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function xn(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function _n(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function An(t){return function(){this.style.removeProperty(t)}}function Cn(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Sn(t,e,n){return function(){var o=e.apply(this,arguments);null==o?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ln(t){return function(){delete this[t]}}function Tn(t,e){return function(){this[t]=e}}function kn(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Mn(t){return t.trim().split(/^|\s+/)}function En(t){return t.classList||new Pn(t)}function Pn(t){this._node=t,this._names=Mn(t.getAttribute("class")||"")}function Dn(t,e){for(var n=En(t),o=-1,r=e.length;++o=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var oo=[null];function ro(t,e){this._groups=t,this._parents=e}function io(t){return"string"==typeof t?new ro([[document.querySelector(t)]],[document.documentElement]):new ro([[t]],oo)}function ao(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 n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}ro.prototype=function(){return new ro([[document.documentElement]],oo)}.prototype={constructor:ro,select:function(t){"function"!=typeof t&&(t=Je(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r=w&&(w=b+1);!(v=g[w])&&++w=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=fn);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i1?this.each((null==e?An:"function"==typeof e?Sn:Cn)(t,e,null==n?"":n)):function(t,e){return t.style.getPropertyValue(e)||_n(t).getComputedStyle(t,null).getPropertyValue(e)}(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ln:"function"==typeof e?kn:Tn)(t,e)):this.node()[t]},classed:function(t,e){var n=Mn(t+"");if(arguments.length<2){for(var o=En(this.node()),r=-1,i=n.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=e?Zn:Jn,o=0;o=0&&e._call.call(void 0,t),e=e._next;--lo}()}finally{lo=0,function(){for(var t,e,n=so,o=1/0;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:so=e);co=t,So(o)}(),mo=0}}function Co(){var t=yo.now(),e=t-po;e>ho&&(go-=e,po=t)}function So(t){lo||(uo&&(uo=clearTimeout(uo)),t-mo>24?(t<1/0&&(uo=setTimeout(Ao,t-yo.now()-go)),fo&&(fo=clearInterval(fo))):(fo||(po=yo.now(),fo=setInterval(Co,ho)),lo=1,vo(Ao)))}function Lo(t,e,n){var o=new xo;return e=null==e?0:+e,o.restart((n=>{o.stop(),t(n+e)}),e,n),o}xo.prototype=_o.prototype={constructor:xo,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?bo():+n)+(null==e?0:+e),this._next||co===this||(co?co._next=this:so=this,co=this),this._call=t,this._time=n,So()},stop:function(){this._call&&(this._call=null,this._time=1/0,So())}};var To=ee("start","end","cancel","interrupt"),ko=[],Mo=0,Eo=2,Po=3,Do=5,No=6;function Fo(t,e,n,o,r,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var o,r=t.__transition;function i(c){var l,u,d,f;if(1!==n.state)return s();for(l in r)if((f=r[l]).name===n.name){if(f.state===Po)return Lo(i);4===f.state?(f.state=No,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[l]):+lMo)throw new Error("too late; already scheduled");return n}function Io(t,e){var n=$o(t,e);if(n.state>Po)throw new Error("too late; already running");return n}function $o(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Oo(t,e){var n,o,r,i=t.__transition,a=!0;if(i){for(r in e=null==e?null:e+"",i)(n=i[r]).name===e?(o=n.state>Eo&&n.state180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:qe(t,e)})):e&&n.push(r(n)+"rotate("+e+o)}(i.rotate,a.rotate,s,c),function(t,e,n,i){t!==e?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:qe(t,e)}):e&&n.push(r(n)+"skewX("+e+o)}(i.skewX,a.skewX,s,c),function(t,e,n,o,i,a){if(t!==n||e!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:qe(t,n)},{i:s-2,x:qe(e,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,c),i=a=null,function(t){for(var e,n=-1,o=c.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Bo:Io;return function(){var a=i(this,t),s=a.on;s!==o&&(r=(o=s).copy()).on(e,n),a.on=r}}(n,t,e))},attr:function(t,e){var n=L(t),o="transform"===n?zo:Xo;return this.attrTween(t,"function"==typeof e?(n.local?er:tr)(n,o,Yo(this,"attr."+t,e)):null==e?(n.local?Qo:Ko)(n):(n.local?Zo:Jo)(n,o,e))},attrTween:function(t,e){var n="attr."+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;var o=L(t);return this.tween(n,(o.local?nr:or)(o,e))},style:function(t,e,n){var o="transform"==(t+="")?qo:Xo;return null==e?this.styleTween(t,function(t,e){var n,o,r;return function(){var i=$(this,t),a=(this.style.removeProperty(t),$(this,t));return i===a?null:i===n&&a===o?r:r=e(n=i,o=a)}}(t,o)).on("end.style."+t,lr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var o,r,i;return function(){var a=$(this,t),s=n(this),c=s+"";return null==s&&(this.style.removeProperty(t),c=s=$(this,t)),a===c?null:a===o&&c===r?i:(r=c,i=e(o=a,s))}}(t,o,Yo(this,"style."+t,e))).each(function(t,e){var n,o,r,i,a="style."+e,s="end."+a;return function(){var c=Io(this,t),l=c.on,u=null==c.value[a]?i||(i=lr(e)):void 0;l===n&&r===u||(o=(n=l).copy()).on(s,r=u),c.on=o}}(this._id,t)):this.styleTween(t,function(t,e,n){var o,r,i=n+"";return function(){var a=$(this,t);return a===i?null:a===o?r:r=e(o=a,n)}}(t,o,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==e)return this.tween(o,null);if("function"!=typeof e)throw new Error;return this.tween(o,function(t,e,n){var o,r;function i(){var i=e.apply(this,arguments);return i!==r&&(o=(r=i)&&function(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}(t,i,n)),o}return i._value=e,i}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Yo(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,n;function o(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&function(t){return function(e){this.textContent=t.call(this,e)}}(o)),e}return o._value=t,o}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o,r=$o(this.node(),n).tween,i=0,a=r.length;i()=>t;function yr(t,{sourceEvent:e,target:n,selection:o,mode:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:o,enumerable:!0,configurable:!0},mode:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function vr(t){t.preventDefault(),t.stopImmediatePropagation()}var br={name:"drag"},wr={name:"space"},xr={name:"handle"},_r={name:"center"};const{abs:Ar,max:Cr,min:Sr}=Math;function Lr(t){return[+t[0],+t[1]]}function Tr(t){return[Lr(t[0]),Lr(t[1])]}var kr={name:"x",handles:["w","e"].map(Ir),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Mr={name:"y",handles:["n","s"].map(Ir),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Er={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Ir),input:function(t){return null==t?null:Tr(t)},output:function(t){return t}},Pr={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Dr={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Nr={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Fr={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Br={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ir(t){return{type:t}}function $r(t){return!t.ctrlKey&&!t.button}function Or(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Rr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Hr(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Gr(t){var e=t.__brush;return e?e.dim.output(e.selection):null}function Wr(){return zr(kr)}function jr(){return zr(Mr)}function qr(){return zr(Er)}function zr(t){var e,n=Or,o=$r,r=Rr,i=!0,a=ee("start","brush","end"),s=6;function c(e){var n=e.property("__brush",m).selectAll(".overlay").data([Ir("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Pr.overlay).merge(n).each((function(){var t=Hr(this).extent;io(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),e.selectAll(".selection").data([Ir("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Pr.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var o=e.selectAll(".handle").data(t.handles,(function(t){return t.type}));o.exit().remove(),o.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return Pr[t.type]})),e.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(r).on("touchstart.brush",f).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function l(){var t=io(this),e=Hr(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2})).attr("y",(function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s})).attr("height",(function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var o=t.__brush.emitter;return!o||n&&o.clean?new d(t,e,n):o}function d(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&o.apply(this,arguments)){var r,a,s,c,d,f,h,p,m,g,y,v=this,b=n.target.__data__.type,w="selection"===(i&&n.metaKey?b="overlay":b)?br:i&&n.altKey?_r:xr,x=t===Mr?null:Fr[b],_=t===kr?null:Br[b],A=Hr(v),C=A.extent,S=A.selection,L=C[0][0],T=C[0][1],k=C[1][0],M=C[1][1],E=0,P=0,D=x&&_&&i&&n.shiftKey,N=Array.from(n.touches||[n],(t=>{const e=t.identifier;return(t=ao(t,v)).point0=t.slice(),t.identifier=e,t}));Oo(v);var F=u(v,arguments,!0).beforestart();if("overlay"===b){S&&(m=!0);const e=[N[0],N[1]||N[0]];A.selection=S=[[r=t===Mr?L:Sr(e[0][0],e[1][0]),s=t===kr?T:Sr(e[0][1],e[1][1])],[d=t===Mr?k:Cr(e[0][0],e[1][0]),h=t===kr?M:Cr(e[0][1],e[1][1])]],N.length>1&&R(n)}else r=S[0][0],s=S[0][1],d=S[1][0],h=S[1][1];a=r,c=s,f=d,p=h;var B=io(v).attr("pointer-events","none"),I=B.selectAll(".overlay").attr("cursor",Pr[b]);if(n.touches)F.moved=O,F.ended=H;else{var $=io(n.view).on("mousemove.brush",O,!0).on("mouseup.brush",H,!0);i&&$.on("keydown.brush",(function(t){switch(t.keyCode){case 16:D=x&&_;break;case 18:w===xr&&(x&&(d=f-E*x,r=a+E*x),_&&(h=p-P*_,s=c+P*_),w=_r,R(t));break;case 32:w!==xr&&w!==_r||(x<0?d=f-E:x>0&&(r=a-E),_<0?h=p-P:_>0&&(s=c-P),w=wr,I.attr("cursor",Pr.selection),R(t));break;default:return}vr(t)}),!0).on("keyup.brush",(function(t){switch(t.keyCode){case 16:D&&(g=y=D=!1,R(t));break;case 18:w===_r&&(x<0?d=f:x>0&&(r=a),_<0?h=p:_>0&&(s=c),w=xr,R(t));break;case 32:w===wr&&(t.altKey?(x&&(d=f-E*x,r=a+E*x),_&&(h=p-P*_,s=c+P*_),w=_r):(x<0?d=f:x>0&&(r=a),_<0?h=p:_>0&&(s=c),w=xr),I.attr("cursor",Pr[b]),R(t));break;default:return}vr(t)}),!0),function(t){var e=t.document.documentElement,n=bt(t).on("dragstart.drag",ne,!0);"onselectstart"in e?n.on("selectstart.drag",ne,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(n.view)}l.call(v),F.start(n,w.name)}function O(t){for(const e of t.changedTouches||[t])for(const t of N)t.identifier===e.identifier&&(t.cur=ao(e,v));if(D&&!g&&!y&&1===N.length){const t=N[0];Ar(t.cur[0]-t[0])>Ar(t.cur[1]-t[1])?y=!0:g=!0}for(const t of N)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);m=!0,vr(t),R(t)}function R(t){const e=N[0],n=e.point0;var o;switch(E=e[0]-n[0],P=e[1]-n[1],w){case wr:case br:x&&(E=Cr(L-r,Sr(k-d,E)),a=r+E,f=d+E),_&&(P=Cr(T-s,Sr(M-h,P)),c=s+P,p=h+P);break;case xr:N[1]?(x&&(a=Cr(L,Sr(k,N[0][0])),f=Cr(L,Sr(k,N[1][0])),x=1),_&&(c=Cr(T,Sr(M,N[0][1])),p=Cr(T,Sr(M,N[1][1])),_=1)):(x<0?(E=Cr(L-r,Sr(k-r,E)),a=r+E,f=d):x>0&&(E=Cr(L-d,Sr(k-d,E)),a=r,f=d+E),_<0?(P=Cr(T-s,Sr(M-s,P)),c=s+P,p=h):_>0&&(P=Cr(T-h,Sr(M-h,P)),c=s,p=h+P));break;case _r:x&&(a=Cr(L,Sr(k,r-E*x)),f=Cr(L,Sr(k,d+E*x))),_&&(c=Cr(T,Sr(M,s-P*_)),p=Cr(T,Sr(M,h+P*_)))}f1?o[0]+o.slice(2):o,+t.slice(n+1)]}function Vr(t){return(t=Ur(Math.abs(t)))?t[1]:NaN}var Yr,Xr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Kr(t){if(!(e=Xr.exec(t)))throw new Error("invalid format: "+t);var e;return new Qr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Qr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Jr(t,e){var n=Ur(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}Kr.prototype=Qr.prototype,Qr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Zr={"%":(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)=>Jr(100*t,e),r:Jr,s:function(t,e){var n=Ur(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(Yr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=o.length;return i===a?o:i>a?o+new Array(i-a+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+Ur(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ti(t){return t}var ei,ni,oi,ri=Array.prototype.map,ii=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ai(t){var e,n,o=void 0===t.grouping||void 0===t.thousands?ti:(e=ri.call(t.grouping,Number),n=t.thousands+"",function(t,o){for(var r=t.length,i=[],a=0,s=e[0],c=0;r>0&&s>0&&(c+s+1>o&&(s=Math.max(1,o-c)),i.push(t.substring(r-=s,r+s)),!((c+=s+1)>o));)s=e[a=(a+1)%e.length];return i.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?ti:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ri.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=Kr(t)).fill,n=t.align,d=t.sign,f=t.symbol,h=t.zero,p=t.width,m=t.comma,g=t.precision,y=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Zr[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===e&&"="===n)&&(h=!0,e="0",n="=");var b="$"===f?r:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",w="$"===f?i:/[%p]/.test(v)?c:"",x=Zr[v],_=/[defgprs%]/.test(v);function A(t){var r,i,c,f=b,A=w;if("c"===v)A=x(t)+A,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),g),y&&(t=function(t){t:for(var e,n=t.length,o=1,r=-1;o0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0==+t&&"+"!==d&&(C=!1),f=(C?"("===d?d:l:"-"===d||"("===d?"":d)+f,A=("s"===v?ii[8+Yr/3]:"")+A+(C&&"("===d?")":""),_)for(r=-1,i=t.length;++r(c=t.charCodeAt(r))||c>57){A=(46===c?a+t.slice(r+1):t.slice(r))+A,t=t.slice(0,r);break}}m&&!h&&(t=o(t,1/0));var S=f.length+t.length+A.length,L=S>1)+f+t+A+L.slice(S);break;default:t=L+f+t+A}return s(t)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),A.toString=function(){return t+""},A}return{format:d,formatPrefix:function(t,e){var n=d(((t=Kr(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3))),r=Math.pow(10,-o),i=ii[8+o/3];return function(t){return n(r*t)+i}}}}function si(t){return ei=ai(t),ni=ei.format,oi=ei.formatPrefix,ei}function ci(t){return Math.max(0,-Vr(Math.abs(t)))}function li(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3)))-Vr(Math.abs(t)))}function ui(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vr(e)-Vr(t))+1}si({thousands:",",grouping:[3],currency:["$",""]});var di=Math.sqrt(50),fi=Math.sqrt(10),hi=Math.sqrt(2);function pi(t,e,n){var o=(e-t)/Math.max(0,n),r=Math.floor(Math.log(o)/Math.LN10),i=o/Math.pow(10,r);return r>=0?(i>=di?10:i>=fi?5:i>=hi?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(i>=di?10:i>=fi?5:i>=hi?2:1)}function mi(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function gi(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function yi(t){let e,n,o;function r(t,o,r=0,i=t.length){if(r>>1;n(t[e],o)<0?r=e+1:i=e}while(rmi(t(e),n),o=(e,n)=>t(e)-n):(e=t===mi||t===gi?t:vi,n=t,o=t),{left:r,center:function(t,e,n=0,i=t.length){const a=r(t,e,n,i-1);return a>n&&o(t[a-1],e)>-o(t[a],e)?a-1:a},right:function(t,o,r=0,i=t.length){if(r>>1;n(t[e],o)<=0?r=e+1:i=e}while(r0)return[t];if((o=e0){let n=Math.round(t/a),o=Math.round(e/a);for(n*ae&&--o,i=new Array(r=o-n+1);++se&&--o,i=new Array(r=o-n+1);++s=di?r*=10:i>=fi?r*=5:i>=hi&&(r*=2),e0;){if((r=pi(c,l,n))===o)return i[a]=c,i[s]=l,e(i);if(r>0)c=Math.floor(c/r)*r,l=Math.ceil(l/r)*r;else{if(!(r<0))break;c=Math.ceil(c*r)/r,l=Math.floor(l*r)/r}o=r}return t},t}var Pi={9606:{commonName:"Human",scientificName:"Homo sapiens",assemblies:{default:"GCF_000001405.26",GRCh38:"GCF_000001405.26",GRCh37:"GCF_000001405.13",NCBI36:"GCF_000001405.12"},hasGeneCache:!0,hasParalogCache:!0,hasInteractionCache:!0,hasGeneStructureCache:!0,hasProteinCache:!0,hasSynonymCache:!0,hasTissueCache:!0},10090:{commonName:"Mouse",scientificName:"Mus musculus",assemblies:{default:"GCF_000001635.27",GRCm39:"GCF_000001635.27",GRCm38:"GCF_000001635.20",MGSCv37:"GCF_000001635.18"},hasGeneCache:!0,hasParalogCache:!0,hasInteractionCache:!0,hasGeneStructureCache:!0,hasProteinCache:!0,hasSynonymCache:!0},9598:{commonName:"Chimpanzee",scientificName:"Pan troglodytes",assemblies:{default:"GCF_028858775.1","NHGRI_mPanTro3-v1.1-hic.freeze_pri":"GCF_028858775.1","Pan_tro 3.0":"GCF_000001515.7"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},10116:{commonName:"Rat",scientificName:"Rattus norvegicus",assemblies:{default:"GCF_000001895.5","Rnor_6.0":"GCF_000001895.5"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},3702:{commonName:"Thale cress",scientificName:"Arabidopsis thaliana",assemblies:{default:"GCF_000001735.3",TAIR10:"GCF_000001735.3"}},4530:{commonName:"Rice",scientificName:"Oryza sativa",assemblies:{default:"GCA_001433935.1","IRGSP-1.0":"GCA_001433935.1"}},4577:{commonName:"Maize",scientificName:"Zea mays",assemblies:{default:"GCA_000005005.5","IRGSP-1.0":"GCA_001433935.1"}},4641:{commonName:"Banana",scientificName:"Musa acuminata",assemblies:{default:"mock"}},7227:{commonName:"Fly",scientificName:"Drosophila melanogaster",assemblies:{default:"GCA_000001215.4","Release 6 plus ISO1 MT":"GCA_000001215.4"},hasSynonymCache:!0},7165:{commonName:"Mosquito",scientificName:"Anopheles gambiae",assemblies:{default:"GCF_000005575.2"}},746128:{commonName:"Aspergillis fumigatus",scientificName:"Aspergillis fumigatus",assemblies:{default:"GCF_000002655.1"}},227321:{scientificName:"Aspergillus nidulans",assemblies:{default:"GCF_000149205.2"}},5061:{commonName:"black mold",scientificName:"Aspergillus niger",assemblies:{default:"GCF_003184595.1"}},5062:{commonName:"koji",scientificName:"Aspergillus oryzae",assemblies:{default:"GCF_000184455.2"}},15368:{commonName:"stiff brome",scientificName:"Brachypodium distachyon",assemblies:{default:"GCF_000005505.3"}},60711:{commonName:"green monkey",scientificName:"Chlorocebus sabaeus",assemblies:{default:"GCF_015252025.1"}},7719:{commonName:"Vase tunicate",scientificName:"Ciona intestinalis",assemblies:{default:"GCF_000224145.3"}},9685:{commonName:"Cat",scientificName:"Felis catus",assemblies:{default:"GCF_000181335.3"},hasGeneCache:!0},9031:{commonName:"Chicken",scientificName:"Gallus gallus",assemblies:{default:"GCF_000002315.6"},hasGeneCache:!0,hasParalogCache:!0},9593:{commonName:"Gorilla",scientificName:"Gorilla gorilla",assemblies:{default:"GCF_008122165.1"}},4513:{commonName:"Barley",scientificName:"Hordeum vulgare",assemblies:{default:"GCA_901482405.1"}},9541:{commonName:"Crab-eating macaque",scientificName:"Macaca fascicularis",assemblies:{default:"GCF_000364345.1"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},9544:{commonName:"Rhesus macaque",scientificName:"Macaca mulatta",assemblies:{default:"GCF_003339765.1"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},9597:{commonName:"Bonobo",scientificName:"Pan paniscus",assemblies:{default:"GCF_013052645.1"}},9615:{commonName:"Dog",scientificName:"Canis lupus familiaris",assemblies:{default:"GCF_014441545.1"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},9823:{commonName:"Pig",scientificName:"Sus scrofa",assemblies:{default:"GCF_000003025.6"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},4932:{commonName:"Yeast",scientificName:"Saccharomyces cerevisiae",assemblies:{default:"GCA_000146045.2",R64:"GCA_000146045.2"}},5833:{commonName:"malaria parasite",scientificName:"Plasmodium falciparum",assemblies:{default:"GCA_000002765.3",GCA_000002765:"GCA_000002765.3"}},6239:{commonName:"worm",scientificName:"Caenorhabditis elegans",assemblies:{default:"GCF_000002985.6"},hasGeneCache:!0,hasParalogCache:!0,hasSynonymCache:!0},4081:{commonName:"tomato",scientificName:"Solanum lycopersicum",assemblies:{default:"GCF_000188115.4"}},4072:{commonName:"pepper",scientificName:"Capsicum annuum",assemblies:{default:"GCF_000710875.1"}},3694:{commonName:"black cottonwood",scientificName:"Populus trichocarpa",assemblies:{default:"GCF_000002775.5"}}},Di=Object.assign({},t,e,r,i);function Ni(){return"assembly"in this.config&&/(GCF_|GCA_)/.test(this.config.assembly)}function Fi(t){var e,n,o,r=document.scripts,i=Ideogram.version;if(!1===location.pathname.includes("/examples/vanilla/"))return`https://cdn.jsdelivr.net/npm/ideogram@${i}/dist/data/${t}`;for(var a=0;a{if(n.ok)return n;if(!1===e)return Bi(t.replace(".json",""),!0);throw Error("Fetch failed for "+t)}))}function Ii(){return Fi("bands/native/")}function $i(t){return Math.round(100*t)/100}function Oi(t){call(this.onDidRotateCallback,t)}function Ri(){return Di.select(this.selector).node()}function Hi(t,e){var n=this.config,o=new Headers;return n.accessToken&&(o=new Headers({Authorization:"Bearer "+n.accessToken})),"text"===e?Di.text(t,{headers:o}):Di.json(t,{headers:o})}function Gi(t){var e,n,o,r,i=this.organisms;for(n in t=zi(t),i)if(o=zi((e=i[n]).commonName),r=zi(e.scientificName),o===t||r===t)return n;return null}function Wi(t){return t in this.organisms?this.organisms[t].commonName:null}function ji(t){return t in this.organisms?this.organisms[t].scientificName:null}function qi(t){const e=t.split(/[ _-]/g).map(((t,e)=>e>0?t[0].toUpperCase()+t.slice(1):t)).join("");return e}function zi(t){return void 0===t?"":t.toLowerCase().replace(/ /g,"-")}function Ui(t){return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(t)}function Vi(t){var e={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};return t.toUpperCase().split("").reduce((function(t,n,o,r){return e[n]150&&n.g>150&&n.b>150&&(t=`rgb(${n.r-30}, ${n.g-30}, ${n.b-30})`),n.r>200&&n.g>200&&n.b>200&&(t=`rgb(${n.r-50}, ${n.g-50}, ${n.b-50})`);else{const s=Ki(e);o=[n.r,n.g,n.b],r=[s.r,s.g,s.b],i=oa(...o),a=oa(...r),(Math.max(i,a)+.05)/(Math.min(i,a)+.05)<3&&(t="rgb(230, 230, 230)")}var o,r,i,a;return t}Di.select=bt,Di.selectAll=function(t){return"string"==typeof t?new gt([document.querySelectorAll(t)],[document.documentElement]):new gt([null==t?[]:l(t)],mt)},Di.scaleLinear=function t(){var e=function(){var t,e,n,o,r,i,a=Ci,s=Ci,c=Ke,l=Si;function u(){var t,e,n,c=Math.min(a.length,s.length);return l!==Si&&(t=a[0],e=a[c-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),o=c>2?ki:Ti,r=i=null,d}function d(e){return null==e||isNaN(e=+e)?n:(r||(r=o(a.map(t),s,c)))(t(l(e)))}return d.invert=function(n){return l(e((i||(i=o(s,a.map(t),qe)))(n)))},d.domain=function(t){return arguments.length?(a=Array.from(t,Ai),u()):a.slice()},d.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},d.rangeRound=function(t){return s=Array.from(t),c=_i,u()},d.clamp=function(t){return arguments.length?(l=!!t||Si,u()):l!==Si},d.interpolate=function(t){return arguments.length?(c=t,u()):c},d.unknown=function(t){return arguments.length?(n=t,d):n},function(n,o){return t=n,e=o,u()}}()(Si,Si);return e.copy=function(){return n=e,t().domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());var n},Mi.apply(e,arguments),Ei(e)},Di.max=function(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n=e)&&(n=e);else{let o=-1;for(let r of t)null!=(r=e(r,++o,t))&&(n=r)&&(n=r)}return n};const Zi=.2126,ta=.7152,ea=.0722,na=2.4;function oa(t,e,n){var o=[t,e,n].map((t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,na)));return o[0]*Zi+o[1]*ta+o[2]*ea}function ra(t,e){if("#"!==t[0])return t;const n=Ki(t),o=e;return`rgb(${n.r*o}, ${n.g*o}, ${n.b*o})`}function ia(){return{theme:"light-border",allowHTML:!0,popperOptions:{modifiers:[{name:"flip"}]},onShow:function(){document.querySelectorAll("[data-tippy-root]").forEach((t=>t.remove()))}}}var aa;aa=[["gneg","#FFF","#FFF","#DDD"],["gpos25","#C8C8C8","#DDD","#BBB"],["gpos33","#BBB","#BBB","#AAA"],["gpos50","#999","#AAA","#888"],["gpos66","#888","#888","#666"],["gpos75","#777","#777","#444"],["gpos100","#444","#666","#000"],["acen","#FEE","#FEE","#FDD"],["noBands","#BBB","#BBB","#AAA"]];let sa='#_ideogram {padding-left: 5px;} #_ideogram .labeled {padding-left: 15px;} #_ideogram.labeledLeft {padding-left: 15px; padding-top: 15px;} #_ideogram text {font: 9px Tahoma; fill: #000;} #_ideogram .italic {font-style: italic;} #_ideogram .chromosome {cursor: pointer; fill: #AAA;}#_ideogram.no-rotate .chromosome {cursor: default;} #_ideogram .chrLabel, #_ideogram .annot {cursor: pointer;}#_ideogram .chrSetLabel {font-weight: bolder;}#_ideogram .ghost {opacity: 0.2;}#_ideogram .hidden {display: none;}#_ideogram .bandLabelStalk line {stroke: #AAA; stroke-width: 1;}#_ideogram .syntenyBorder {stroke:#AAA;stroke-width:1;}#_ideogram rect.cursor { fill: #F00; stroke: #F00; fill-opacity: .3; shape-rendering: crispEdges;}#_ideogram .brush .selection { fill: #F00; stroke: #F00; fill-opacity: .3; shape-rendering: crispEdges;}#_ideogram .noBands {fill: #AAA;}#_ideogram .gneg {fill: #FFF}#_ideogram .gpos25 {fill: #BBB}#_ideogram .gpos33 {fill: #AAA}#_ideogram .gpos50 {fill: #888}#_ideogram .gpos66 {fill: #666}#_ideogram .gpos75 {fill: #444}#_ideogram .gpos100 {fill: #000}#_ideogram .gpos {fill: #000}#_ideogram .acen {fill: #FDD}#_ideogram .stalk {fill: #CCE;}#_ideogram .gvar {fill: #DDF}#_ideogram.faint .gneg {fill: #FFF}#_ideogram.faint .gpos25 {fill: #EEE}#_ideogram.faint .gpos33 {fill: #EEE}#_ideogram.faint .gpos50 {fill: #EEE}#_ideogram.faint .gpos66 {fill: #EEE}#_ideogram.faint .gpos75 {fill: #EEE}#_ideogram.faint .gpos100 {fill: #DDD}#_ideogram.faint .gpos {fill: #DDD}#_ideogram.faint .acen {fill: #FEE}#_ideogram.faint .stalk {fill: #EEF;}#_ideogram.faint .gvar {fill: #EEF}#_ideogram .gneg {fill: url("#gneg")} #_ideogram .gpos25 {fill: url("#gpos25")} #_ideogram .gpos33 {fill: url("#gpos33")} #_ideogram .gpos50 {fill: url("#gpos50")} #_ideogram .gpos66 {fill: url("#gpos66")} #_ideogram .gpos75 {fill: url("#gpos75")} #_ideogram .gpos100 {fill: url("#gpos100")} #_ideogram .gpos {fill: url("#gpos100")} #_ideogram .acen {fill: url("#acen")} #_ideogram .stalk {fill: url("#stalk")} #_ideogram .gvar {fill: url("#gvar")} #_ideogram .noBands {fill: url("#noBands")} #_ideogram .chromosome {fill: url("#noBands")} ';function ca(t){var e;this.config=JSON.parse(JSON.stringify(t)),(e=this).chromosomesArray=[],e.coordinateSystem="iscn",e.maxLength={bp:0,iscn:0},e.chromosomes={},e.numChromosomes=0,e.config.debug||(e.config.debug=!1),e.config.dataDir||(e.config.dataDir=e.getDataDir()),e.config.container||(e.config.container="body"),e.selector=e.config.container+" #_ideogram",e.config.resolution||(e.config.resolution=""),e.config.orientation||(e.config.orientation="vertical"),e.config.brush||(e.config.brush=null),e.config.rows||(e.config.rows=1),"showChromosomeLabels"in e.config==0&&(e.config.showChromosomeLabels=!0),e.config.showNonNuclearChromosomes||(e.config.showNonNuclearChromosomes=!1),e.config.chromosomeScale||(e.config.chromosomeScale="absolute"),e.config.showTools||(e.config.showTools=!1),function(t){t.config.ploidy||(t.config.ploidy=1),t.config.ploidy>1&&(t.sexChromosomes={},t.config.sex||(t.config.sex="male"),2!==t.config.ploidy||t.config.ancestors||(t.config.ancestors={M:"#ffb6c1",P:"#add8e6"},t.config.ploidyDesc="MP"))}(this),function(t){t.config.showBandLabels||(t.config.showBandLabels=!1),"showFullyBanded"in t.config==0&&(t.config.showFullyBanded=!0),t.bandsToShow=[],t.bandData={}}(this),function(t){var e,n,o;t.config.chrHeight||(e=t.config.container,n=document.querySelector(e).getBoundingClientRect(),o="vertical"===t.config.orientation?n.height:n.width,"body"!==e&&0!==o||(o=400),t.config.chrHeight=o)}(this),function(t){var e,n;t.config.chrWidth||(e=10,(n=t.config.chrHeight)<900&&n>500?e=Math.round(n/40):n>=900&&(e=Math.round(n/45)),t.config.chrWidth=e)}(this),function(t){t.config.geometry&&"collinear"===t.config.geometry?"chrMargin"in t.config==0&&(t.config.chrMargin=0):(t.config.chrMargin||(1===t.config.ploidy?t.config.chrMargin=10:t.config.chrMargin=Math.round(t.config.chrWidth/4)),t.config.showBandLabels&&(t.config.chrMargin+=20))}(this),function(t,e){t.onLoad&&(e.onLoadCallback=t.onLoad),t.onLoadAnnots&&(e.onLoadAnnotsCallback=t.onLoadAnnots),t.onBeforeDrawAnnots&&(e.onBeforeDrawAnnotsCallback=t.onBeforeDrawAnnots),t.onDrawAnnots&&(e.onDrawAnnotsCallback=t.onDrawAnnots),t.onBrushMove&&(e.onBrushMoveCallback=t.onBrushMove),t.onBrushEnd&&(e.onBrushEndCallback=t.onBrushEnd),t.onCursorMove&&(e.onCursorMoveCallback=t.onCursorMove),t.onDidRotate&&(e.onDidRotateCallback=t.onDidRotate),t.onWillShowAnnotTooltip&&(e.onWillShowAnnotTooltipCallback=t.onWillShowAnnotTooltip),t.onDidShowAnnotTooltip&&(e.onDidShowAnnotTooltipCallback=t.onDidShowAnnotTooltip),t.onClickAnnot&&(e.onClickAnnotCallback=t.onClickAnnot)}(t,this),function(t,e){e.organisms=Object.assign({},Pi),t.taxid&&t.organismMetadata&&(e.organisms[t.taxid]=t.organismMetadata),e.organismsWithBands=Object.assign({},e.organisms)}(t,this),function(t){t.bump=Math.round(t.config.chrHeight/125),t.adjustedBump=!1,t.config.chrHeight<200&&(t.adjustedBump=!0,t.bump=4)}(this),function(t,e){t.chromosome&&(e.config.chromosomes=[t.chromosome],"showBandLabels"in t==0&&(e.config.showBandLabels=!0),"rotatable"in t==0&&(e.config.rotatable=!1))}(t,this),function(t){const e=t.config;e.chrLabelSize||(t.config.chrLabelSize=9),e.chrLabelColor||(t.config.chrLabelColor="#000"),e.fontFamily||(t.config.fontFamily="");const n=`font-size: ${e.chrLabelSize}px`,o=`fill: ${e.chrLabelColor}`,r=`font-family: ${e.fontFamily}`;sa+=`#_ideogram text {${r}; ${n}; ${o};}`,sa+=`#_ideogramLabel text {${r};}`}(this),this.initAnnotSettings(),this.config.geometry&&"parallel"!==this.config.geometry||(this.config.chrMargin+=this.config.chrWidth,"heatmap"===this.config.annotationsLayout?this.config.chrMargin+=this.config.annotTracksHeight:this.config.chrMargin+=2*this.config.annotTracksHeight),this.init()}const la=function(t){var e,n,o,r,i=t.config;if(t.config.annotLabelHeight=12,"demarcateCollinearChromosomes"in t.config==0&&(t.config.demarcateCollinearChromosomes=!0),n=function(t,e){var n,o,r,i,a,s,c,l={};for(n=[],o=0;o tspan");t.setAttribute("x",s),t.setAttribute("dy",f-8),i.querySelector(".chrLabel").setAttribute("text-anchor","start")}i.setAttribute("transform","rotate(90) translate("+a+","+c+")"),i.querySelector(".chromosome").setAttribute("transform","translate(-13, 10)")}!function(t){t.config.taxids.forEach(((e,n)=>{var o=t.organisms[e].scientificName;Di.select(t.selector).append("text").attr("class","genomeLabel italic").attr("x",55+200*n).attr("y",10).text(o).attr("text-anchor","middle")}))}(o)}(e,n,-40,t),r=Math.round(n.slice(-1)[0]+70),i.multiorganism){o*=8;var a=0;n.forEach((t=>{t>a&&(a=t)})),o=a+30}else o=xOffsets.slice(-1)[0]+30;Di.select(t.selector).attr("height",o).attr("width",r),Di.select("#_ideogramTrackLabelContainer").remove(),Di.select("#_ideogramInnerWrap").insert("div",":first-child").attr("id","_ideogramTrackLabelContainer").style("position","absolute")};const ua=function(t){var e,n,o,r,i,a=t.config,s=a.annotationHeight||0;if("vertical"!==a.orientation){t.config.annotLabelHeight=12;var c=t.config.annotLabelHeight;if("demarcateCollinearChromosomes"in t.config==0&&(t.config.demarcateCollinearChromosomes=!0),e=document.querySelectorAll(".chromosome-set"),o=a.numAnnotTracks*(s+c+4)-a.chrWidth+1,n=function(t,e){var n,o,r,i,a,s,c,l={};for(n=[],o=0;o{var o=t.organisms[e],r=t.config,i=o.scientificName;Di.select(t.selector).append("text").attr("class","genomeLabel italic").attr("x",5).attr("y",r.chrLabelSize+(200+3*r.chrWidth)*n).text(i)}))}(o)}(e,n,o,t),r=o+2*a.chrWidth+20,a.multiorganism){r*=8;var l=0;n.forEach((t=>{t>l&&(l=t)})),i=l+20}else i=n.slice(-1)[0]+20;Di.select(t.selector).attr("width",i).attr("height",r),Di.select("#_ideogramTrackLabelContainer").remove(),Di.select("#_ideogramInnerWrap").insert("div",":first-child").attr("id","_ideogramTrackLabelContainer").style("position","absolute")}else la(t)};var da=Uint8Array,fa=Uint16Array,ha=Uint32Array,pa=new da([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ma=new da([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ga=new da([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ya=function(t,e){for(var n=new fa(31),o=0;o<31;++o)n[o]=e+=1<>>1|(21845&Ca)<<1;Sa=(61680&(Sa=(52428&Sa)>>>2|(13107&Sa)<<2))>>>4|(3855&Sa)<<4,Aa[Ca]=((65280&Sa)>>>8|(255&Sa)<<8)>>>1}var La=function(t,e,n){for(var o=t.length,r=0,i=new fa(e);r>>c]=l}else for(a=new fa(o),r=0;r>>15-t[r]);return a},Ta=new da(288);for(Ca=0;Ca<144;++Ca)Ta[Ca]=8;for(Ca=144;Ca<256;++Ca)Ta[Ca]=9;for(Ca=256;Ca<280;++Ca)Ta[Ca]=7;for(Ca=280;Ca<288;++Ca)Ta[Ca]=8;var ka=new da(32);for(Ca=0;Ca<32;++Ca)ka[Ca]=5;var Ma=La(Ta,9,1),Ea=La(ka,5,1),Pa=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},Da=function(t,e,n){var o=e/8|0;return(t[o]|t[o+1]<<8)>>(7&e)&n},Na=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},Fa=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var o=new(2==t.BYTES_PER_ELEMENT?fa:4==t.BYTES_PER_ELEMENT?ha:da)(n-e);return o.set(t.subarray(e,n)),o},Ba=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ia=function(t,e,n){var o=new Error(e||Ba[t]);if(o.code=t,Error.captureStackTrace&&Error.captureStackTrace(o,Ia),!n)throw o;return o},$a=function(t,e,n){var o=t.length;if(!o||n&&n.f&&!n.l)return e||new da(0);var r=!e||n,i=!n||n.i;n||(n={}),e||(e=new da(3*o));var a,s=function(t){var n=e.length;if(t>n){var o=new da(Math.max(2*n,t));o.set(e),e=o}},c=n.f||0,l=n.p||0,u=n.b||0,d=n.l,f=n.d,h=n.m,p=n.n,m=8*o;do{if(!d){c=Da(t,l,1);var g=Da(t,l+1,3);if(l+=3,!g){var y=t[(a=l,(k=4+((a+7)/8|0))-4)]|t[k-3]<<8,v=k+y;if(v>o){i&&Ia(0);break}r&&s(u+y),e.set(t.subarray(k,v),u),n.b=u+=y,n.p=l=8*v,n.f=c;continue}if(1==g)d=Ma,f=Ea,h=9,p=5;else if(2==g){var b=Da(t,l,31)+257,w=Da(t,l+10,15)+4,x=b+Da(t,l+5,31)+1;l+=14;for(var _=new da(x),A=new da(19),C=0;C>>4)<16)_[C++]=k;else{var E=0,P=0;for(16==k?(P=3+Da(t,l,3),l+=2,E=_[C-1]):17==k?(P=3+Da(t,l,7),l+=3):18==k&&(P=11+Da(t,l,127),l+=7);P--;)_[C++]=E}}var D=_.subarray(0,b),N=_.subarray(b);h=Pa(D),p=Pa(N),d=La(D,h,1),f=La(N,p,1)}else Ia(1);if(l>m){i&&Ia(0);break}}r&&s(u+131072);for(var F=(1<>>4;if((l+=15&E)>m){i&&Ia(0);break}if(E||Ia(2),$<256)e[u++]=$;else{if(256==$){I=l,d=null;break}var O=$-254;if($>264){var R=pa[C=$-257];O=Da(t,l,(1<>>4;if(H||Ia(3),l+=15&H,N=_a[G],G>3&&(R=ma[G],N+=Na(t,l)&(1<m){i&&Ia(0);break}r&&s(u+131072);for(var W=u+O;u>3&1)+(e>>4&1);o>0;o-=!t[n++]);return n+(2&e)},Ha=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},Ga=function(t){(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&Ia(6,"invalid zlib data"),32&t[1]&&Ia(6,"invalid zlib data: preset dictionaries not supported")};function Wa(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){return $a(t.subarray(Ra(t),-8),e||new da(Ha(t)))}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return $a(t,e)}(t,e):function(t,e){return $a((Ga(t),t.subarray(2,-4)),e)}(t,e)}var ja="undefined"!=typeof TextDecoder&&new TextDecoder;try{ja.decode(Oa,{stream:!0})}catch(t){}var qa=function(t){for(var e="",n=0;;){var o=t[n++],r=(o>127)+(o>223)+(o>239);if(n+r>t.length)return[e,Fa(t,n-1)];r?3==r?(o=((15&o)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|o>>10,56320|1023&o)):e+=1&r?String.fromCharCode((31&o)<<6|63&t[n++]):String.fromCharCode((15&o)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(o)}};function za(t,e){if(e){for(var n="",o=0;o{let n=t;return e.length>0&&(n+=` :: ${JSON.stringify(e)}`),n})(t,e)),this.name=t,this.details=e}}async function Va(t,e){try{if(206===e.status)return e;const n=t.headers.get("range");if(!n)throw new Ua("no-range-header");const o=function(t){const e=t.trim().toLowerCase();if(!e.startsWith("bytes="))throw new Ua("unit-must-be-bytes",{normalizedRangeHeader:e});if(e.includes(","))throw new Ua("single-range-only",{normalizedRangeHeader:e});const n=/(\d*)-(\d*)/.exec(e);if(!n||!n[1]&&!n[2])throw new Ua("invalid-range-values",{normalizedRangeHeader:e});return{start:""===n[1]?void 0:Number(n[1]),end:""===n[2]?void 0:Number(n[2])}}(n),r=await e.blob(),i=function(t,e,n){const o=t.size;if(n&&n>o||e&&e<0)throw new Ua("range-not-satisfiable",{size:o,end:n,start:e});let r,i;return void 0!==e&&void 0!==n?(r=e,i=n+1):void 0!==e&&void 0===n?(r=e,i=o):void 0!==n&&void 0===e&&(r=o-n,i=o),{start:r,end:i}}(r,o.start,o.end),a=r.slice(i.start,i.end),s=a.size,c=new Response(a,{status:206,statusText:"Partial Content",headers:e.headers});return c.headers.set("Content-Length",String(s)),c.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/${r.size}`),c}catch(t){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}function Ya(t,e,n,o="tsv"){const r=zi(t);return e?e+=n+"/":e=Fi("cache/"+n+"/"),e+r+"-"+n+"."+o+".gz"}function Xa(t,e,n=11){return"WBGene"===t&&(n=8),t+e.padStart(n,"0")}async function Ka(){const t=`ideogram-${a}`;return(await caches.keys()).forEach((e=>{e.startsWith("ideogram-")&&e!==t&&caches.delete(e)})),await caches.open(t)}async function Qa(t){const e=await Ka();window.ideoCache=e,window.createPartialResponse=Va;const n=t.replace(".gz","");if(void 0===await e.match(n)){const o=await fetch(t),r=await o.blob(),i=za(Wa(new Uint8Array(await r.arrayBuffer()))),a=i.length,s=new Response(new Blob([i],{type:"text/tab-separated-values"}),{headers:new Headers({"Content-Length":a})});return await e.put(n,s),await e.match(n)}return await e.match(n)}async function Ja(t,e){t=t.replace(".gz","");const n=e[0]+1,o=e[1]-1,r=new Headers({"content-type":"multipart/byteranges",range:`bytes=${n}-${o}`}),i=new Request(t,{headers:r}),a=await Ka(),s=await a.match(i),c=await Va(i,s);return await c.text()}function Za(t,e){const n=[];for(let o=0;o{const e=t.split(" = ");o[e[0]]=e[1]})),[n,o]}function es(t,e){const n=[];for(let o=0;o{const e=t.split(" = ");o[e[0]]=e[1]})),[n,o]}function os(t){const e=[],n=[],o=[];return t.split(";").forEach((t=>{const r=t.split(",");e.push(r[0]),n.push(r[1]),o.push(r[2])})),[e,n,o]}async function rs(t,e){const n=e.tissueCache,o=n.byteRangesByName[t];if(e.cacheRangeFetch||(e.cacheRangeFetch=Ja),!o)return null;const r=e.config;let i=null;r.cacheDir&&(i=r.cacheDir);const a=Ya("homo-sapiens",i,"tissues","tsv"),s=[],c=(await Ja(a,o)).split("\t").slice(1);for(let t=0;t""===t?0:t)),o=e.length;15===o?e.splice(1,0,0):14===o?(e.splice(1,0,0),e.splice(1,0,0)):13===o&&(e.splice(1,0,0),e.splice(1,0,0),e.splice(1,0,0));const r=e[0],i=e.slice(1,6),a={min:parseFloat(i[0]),q1:parseFloat(i[1]),median:parseFloat(i[2]),q3:parseFloat(i[3]),max:parseFloat(i[4]),quantiles:e.slice(6).map((t=>parseInt(t)))},l=n.tissueNames[r],u=n.tissueColors[r],d=parseInt(n.tissueSamples[r]);s.push({tissue:l,expression:a,color:u,samples:d})}return s}n(762),window.cacheRangeFetch=Ja;const is={gene:{metadata:"Gene",dir:"genes",fn:function(t,e){const[n,o,r,i,a,s,c]=t;e.geneCache={interestingNames:n,nameCaseMap:o,namesById:r,fullNamesById:i,idsByName:a,lociByName:s,lociById:c}},parseFn:function(t,e){const n=[],o={},r={},i={},a={},s={},c={},l=[],u={};let d,f=performance.now();const h=t.split(/\r\n|\n/);e.rawTsvSplit=Math.round(performance.now()-f),f=performance.now();for(let t=0;t{if(r.fn(s,n,e),Ideogram[l][e]=n[l],i){console.timeEnd(`${t}Cache total`),c.total=Math.round(performance.now()-a);const e="perfTimes in init"+r.metadata+"Cache:";console.log(e,c)}o()}))}function ss(t){void 0!==t.timeout&&window.clearTimeout(t.timeout),t.rawAnnots=t.setOriginalTrackIndexes(t.rawAnnots),t.config.annotationsDisplayedTracks?t.annots=t.updateDisplayedTracks(t.config.annotationsDisplayedTracks):(t.annots=t.processAnnotData(t.rawAnnots),t.config.filterable&&t.initCrossFilter(),t.drawProcessedAnnots(t.annots))}function cs(t){var e=(new Date).getTime(),n=this,o=n.config,r=o.annotations;n.initDrawChromosomes(),o.annotationsPath&&function(t){t.rawAnnots?ss(t):function e(){t.timeout=setTimeout((function(){!t.rawAnnots||t.rawAnnots&&void 0!==t.rawAnnots.then?e():ss(t)}),50)}()}(n),function(t,e){var n,o,r,i;if(!0===t.showBandLabels&&(r=(new Date).getTime(),e.hideUnshownBandLabels(),i=(new Date).getTime(),t.debug&&console.log("Time in showing bands: "+(i-r)+" ms"),"vertical"===t.orientation))for(n=0;n{n.config.debug&&console.timeEnd("initCache: Ideogram"),n.onLoadCallback&&n.onLoadCallback()}))}class ls{constructor(t){this._config=t,this._description=this._normalize(this._config.ploidyDesc)}getChromosomesNumber(t){if(this._config.ploidyDesc){var e=this._config.ploidyDesc[t];return e instanceof Object?Object.keys(e)[0].length:e.length}return this._config.ploidy||1}_normalize(t){var e,n,o=[];if(!t)return t;for(e in t)"string"==typeof(n=t[e])?("vertical"===this._config.orientation&&(n=n.split("").reverse()),o.push({ancestors:n,existence:this._getexistenceArray(n.length)})):o.push({ancestors:Object.keys(n)[0],existence:n[Object.keys(n)[0]]});return o}_getexistenceArray(t){for(var e=[],n=0;n0}return!0}}class us{constructor(t){this._node=t}getLabel(){return Di.select(this._node.parentNode).select("text.chrLabel").text()}getSetLabel(){return Di.select(this._node.parentNode).select("text.chrSetLabel").text()}}const ds=class{constructor(t,e){if(this._config=t,this._ideo=e,this._ploidy=this._ideo._ploidy,this._translate=void 0,"chrSetMargin"in t)this.chrSetMargin=t.chrSetMargin;else{var n=this._config.chrMargin;this.chrSetMargin=this._config.ploidy>1?n:0}this._tickSize=8,this._isRotated=!1}_getLeftMargin(){return this.margin.left}_getYScale(){return 20/this._config.chrWidth}getChromosomeLabels(t){var e=new us(t),n=[];return this._ideo.config.ploidy>1&&n.push(e.getSetLabel()),n.push(e.getLabel()),n.filter((function(t){return t.length>0}))}getChromosomeBandLabelTranslate(t){var e,n,o,r=this._ideo,i=this._tickSize,a=r.config.orientation;return"vertical"===a?o="rotate(-90)translate("+(e=i)+","+(n=r.round(2+t.px.start+t.px.width/2))+")":"horizontal"===a&&(o="translate("+(e=r.round(-i+t.px.start+t.px.width/2))+","+(n=-10)+")"),{x:e,y:n,translate:o}}didRotate(t,e){var n,o,r,i,a,s,c,l,u;o=(n=this._ideo).config.taxid,r=e.id.split("-")[0].replace("chr",""),i=(a=n.chromosomes[o][r]).bands,l=(c=Di.select(e.parentNode)).attr("transform"),u=/scale\(.*\)/.exec(l),l=l.replace(u,""),c.attr("transform",l),s=a.width,(a=n.getChromosomeModel(i,r,o,t)).oldWidth=s,n.chromosomes[o][r]=a,n.drawChromosome(a),n.handleRotateOnClick(),n.rawAnnots&&(n.displayedTrackIndexes?n.updateDisplayedTracks(n.displayedTrackIndexes):(n.annots=n.processAnnotData(n.rawAnnots),n.drawProcessedAnnots(n.annots),n.config.filterable&&n.initCrossFilter())),!0===n.config.showBandLabels&&(n.drawBandLabels(n.chromosomes),n.hideUnshownBandLabels()),n.onDidRotateCallback&&n.onDidRotateCallback(a)}rotate(t,e,n){var o,r,i,a;o=this._ideo,a=o.selector+" .chrSetLabel, "+o.selector+" .chrLabel",i=document.querySelector(o.selector).getBoundingClientRect(),r=Di.selectAll(o.selector+" g.chromosome").filter((function(){return this!==n})),this._isRotated?(this._isRotated=!1,o.config.chrHeight=o.config.chrHeightOriginal,o.config.chrWidth=o.config.chrWidthOriginal,o.config.annotationHeight=o.config.annotationHeightOriginal,this.rotateBack(t,e,n,(function(){r.style("display",null),Di.selectAll(a).style("display",null),o._layout.didRotate(e,n)}))):(this._isRotated=!0,r.style("display","none"),Di.selectAll(a).style("display","none"),this.rotateForward(t,e,n,(function(){var t,r,a;o.config.chrHeightOriginal=o.config.chrHeight,o.config.chrWidthOriginal=o.config.chrWidth,o.config.annotationHeightOriginal=o.config.annotationHeight,"VerticalLayout"===o._layout._class?(r=i.width-20,a=window.innerWidth-20):(r=i.height-10,a=window.innerHeight-10),t=a0?e:e+4+2*t);if(!this._translate){var a;this._translate=[this._ploidy.getSetSize(0)*i*2];for(var s=1;s1&&(t*=1.8),t}rotateForward(t,e,n,o){var r;Di.select(n.parentNode).transition().attr("transform","rotate(90) translate(30, -37.5) ").on("end",o),r=this.getChromosomeLabels(n),Di.select(this._ideo.getSvg()).append("g").attr("class","tmp").selectAll("text").data(r).enter().append("text").attr("class",(function(t,e){return 0===e&&2===r.length?"chrSetLabel":null})).attr("x",26).attr("y",(function(t,e){return 12*(e+1+r.length%2)})).style("text-anchor","middle").style("opacity",0).text(String).transition().style("opacity",1),this._ideo.config.orientation="vertical"}rotateBack(t,e,n,o){var r=this.getChromosomeSetTranslate(t);Di.select(n.parentNode).transition().attr("transform",r).on("end",o),Di.selectAll(this._ideo.selector+" g.tmp").style("opacity",0).remove(),this._ideo.config.orientation="horizontal"}getHeight(t){void 0===t&&(t=this._config.taxids[0]);var e=this._config.chromosomes[t].length,n=this.getChromosomeSetYTranslate(e-1);return(n+=this._getChromosomeSetSize(e-1))+2*this._getAdditionalOffset()}getWidth(){return this._config.chrHeight+1.5*this.margin.top}getChromosomeSetLabelAnchor(){return"end"}getChromosomeBandLabelAnchor(){return null}getChromosomeBandTickY1(){return 2}getChromosomeBandTickY2(){return 10}getChromosomeSetLabelTranslate(){return null}getChromosomeSetTranslate(t){return"translate("+this._getLeftMargin()+", "+this.getChromosomeSetYTranslate(t)+")"}getChromosomeSetYTranslate(t){if(!this._config.ploidyDesc)return this._config.chrMargin*(t+1);if(!this._translate){this._translate=[1];for(var e=1;ethis.chrsPerRow-1?(e=this.margin.left+1.3*this._config.chrHeight,n=this.getChromosomeSetYTranslate(t-this.chrsPerRow)):(e=this.margin.left,n=this.getChromosomeSetYTranslate(t)),"rotate(90) translate("+e+", -"+n+")"}getChromosomeSetYTranslate(t){var e=.3*this._getAdditionalOffset();return this.margin.left*t+this._config.chrWidth+2*e+e*t}getChromosomeSetLabelXPosition(t){return(this._ploidy.getSetSize(t)*this._config.chrWidth+20)/-2+(this._config.ploidy>1?0:this._config.chrWidth)}getChromosomeLabelXPosition(){return this._config.chrWidth/-2}};function gs(t){if(27===t.keyCode){const t=document.querySelector("#_ideogramTooltip");if(!t)return;t.style.opacity=0}}function ys(t){var e=this;e.config.annotationsPath&&e.fetchAnnots(e.config.annotationsPath),function(t){if("ploidyDesc"in t.config&&"string"==typeof t.config.ploidyDesc){for(var e=[],n=0;n1?new ms(e,t):"vertical"===e.orientation?new fs(e,t):"horizontal"===e.orientation?new hs(e,t):new fs(e,t)}(e),function(t){Di.selectAll(t.config.container+" #_ideogramOuterWrap").remove(),Di.select(t.config.container).append("div").attr("id","_ideogramOuterWrap").append("div").attr("id","_ideogramTrackLabelContainer").style("position","absolute"),Di.select(t.config.container+" #_ideogramOuterWrap").append("div").attr("id","_ideogramMiddleWrap").style("position","relative").style("overflow-x","auto").style("transform","translateZ(0)").append("div").attr("id","_ideogramInnerWrap").append("svg").attr("id","_ideogram").attr("class",function(t){var e="";return t.config.showChromosomeLabels&&("horizontal"===t.config.orientation?e+="labeledLeft ":e+="labeled "),!1===t.config.rotatable&&(e+="no-rotate "),t.config.annotationsLayout&&"overlay"===t.config.annotationsLayout&&(e+="faint"),e}(t)).attr("width",t._layout.getWidth()).attr("height",t._layout.getHeight()).html(t.getBandColorGradients())}(e),e.isOnlyIdeogram=1===document.querySelectorAll("#_ideogram").length,function(t){Di.select(t.config.container+" #_ideogramOuterWrap").append("div").attr("class","_ideogramTooltip").attr("id","_ideogramTooltip").style("opacity",0).style("position","fixed").style("text-align","center").style("padding","4px").style("font","12px sans-serif").style("background","white").style("border","1px solid black").style("border-radius","5px").style("z-index","1000").style("margin-left","-2px"),document.removeEventListener("keydown",gs),document.addEventListener("keydown",gs)}(e),e.finishInit(t)}var vs="";function bs(t,e,n){return n.config.dataDir+t[e]}function ws(t,e,n){var o=n.config.ploidy;return"sex"in n.config&&(2===o&&n.sexChromosomes.index+1===e||"female"===n.config.sex&&"Y"===t.name)}function xs(t,e,n,o){var r,i,a,s,c;for(r=0;r=chrBands.length/2&&(e.coordinateSystem="bp")}function As(){var t,e,n,o,r=this,i=r.config.taxids;for(e=0;e"MT"!==t)),void 0!==o&&(o=o.filter((t=>"MT"!==t[0].chr)))),_s(n,r),r.chromosomes[t]={},r.setSexChromosomes(n),xs(o,n,t,r),r.config.showBandLabels&&r.drawBandLabels(r.chromosomes),r.handleRotateOnClick(),r._gotChrModels=!0}function Cs(){var t=this;"rotatable"in t.config&&!1===t.config.rotatable?Di.selectAll(t.selector).style("cursor","default"):Di.selectAll(t.selector+" .chromosome-set").on("click",(function(){const e=this.children[1];t.rotateAndToggleDisplay(e)}))}function Ss(){call(this.onLoadCallback)}function Ls(t,e,n){var o=n.organisms[t],r=[zi(o.scientificName)],i=o.assemblies,a=n.config.resolution;return e!==i.default&&r.push(e),"9606"===t&&(e in i==="false"&&Object.values(i).includes(config.assembly)||""!==a&&850!==a)&&r.push(a),r=r.join("-"),["9606","10090","10116"].includes(t)&&!n.config.showFullyBanded&&(r+="-no-bands"),r+".json"}function Ts(t,e,n){var o,r,i,a=n.config;o=n.organisms[t],a.assembly||(n.config.assembly="default"),r=o.assemblies,i=Ls(t,n.assemblyIsAccession()?a.assembly:r[a.assembly],n);var s="-1"===t;return(t in n.organismsWithBands||s)&&(e[t]=i),e}function ks(t,e,n,o){return function(t,e,n){var o=bs(t,e,n);return(!(void 0!==window.chrBands&&""===vs)||vs!==o)&&function(t){return"assembly"in t.config&&!1===/(GCA_)/.test(t.config.assembly)}(n)&&e in t}(e,t,o)?function(t,e,n,o){var r=bs(t,e,o);return o.numBandDataResponses||(o.numBandDataResponses=0),Bi(r).then((function(e){return e.json().then((function(n){vs=r,delete window.chrBands,window.chrBands=n.chrBands,function(t,e,n,o){var r,i,a;for(r in e)a=e[r],t.includes(a)&&""!==a&&(i=r);o.bandData[i]=n}(e.url,t,chrBands,o)}))}))}(e,t,0,o).then((function(){return o.processBandData(t)})):new Promise((function(e){o.processBandData(t),e([t,void 0])}))}var Ms={},Es={},Ps={};function Ds(t){var e=(t=t||this).config.container;Ps[e]?(Es[e]=!0,Ms[e]=t):(Ps[e]=!0,function(t){return new Promise((function(e){var n=t.config.organism;"number"==typeof n?t.getOrganismFromEutils(n,(function(){t.getTaxids(e)})):t.getTaxids(e)}))}(t).then((function(n){var o=n[0];t.config.taxid=o,t.config.taxids=n,t.organismScientificName=t.getScientificName(t.config.taxid),function(t,e,n){var o,r,i,a=[];for(i in o={},Pi)o[i]="";for(r=0;r=4&&(l=u[3],o[0]=l),u.length>=8&&(s=u[8].split(","),c=Ns.rgbToHex(s[0],s[1],s[2]),o.push(c)),[r,o])}parseRawAnnots(t,e,n,o){var r,i,a,s,c,l;for(l=!0,!1===isNaN(parseInt(n[e],10))&&(l=!1),r=e;r=8&&c.push("color"),{keys:c,annots:t}}parseBed(t,e){var n,o,r,i,a=[],s=t.split(/\r\n|\n/);for(o=Object.keys(e.chromosomes[e.config.taxid]),n=0;n1){const e=t[0].slice(3),n=t[1].split(";");a[qi(e)]=n}}else i=e.slice(1).trim().split(/\t/).map((t=>qi(t))),i.slice(4).forEach(((t,e)=>s.push(qi(t))));continue}const c=e.trim().split(/\t/),l=c[0],[u,d,f]=this.parseGenomicCoordinates(c),h=o.indexOf(u);if(-1===h)continue;const p=c.slice(4);for(let t=0;t<4;t++){const e=s[t];if(e in a){const n=a[e],o=c[4+t].split(";"),r=[];if(""!==o[0])for(let t=0;t!Bs.includes(t)));return t.displayedTrackIndexes&&(e=e.filter((function(e,n){return t.displayedTrackIndexes.includes(n+1)}))),e}function Os(t){var e,n,o=t.rawAnnots;if(!o.metadata||o.metadata.heatmapThresholds||t.config.heatmapThresholds)return e=t.config.heatmapThresholds?t.config.heatmapThresholds:t.rawAnnots.metadata.heatmapThresholds,n=Is[e.length+1],e=e.map(((t,e)=>[t,"#"+n[e]])),e.push(["+","#"+n.slice(-1)[0]]),e}function Rs(t,e,n,o,r){return t===e&&"+"===r&&n>o||n===r||0!==t&&t!==e&&n<=r&&n>o||0===t&&n<=r}function Hs(t,e){var n,o,r,i,a,s,c,l;for(n=0;n0&&(r+=n.config.chrMargin*t.chrIndex-1),a=Di.select(n.config.container+" #_ideogramInnerWrap").append("canvas").attr("id",s).attr("width",c+1).attr("height",i).style("position","absolute").style("left",r+"px").style("top",i*o+1+"px").nodes()[0].getContext("2d"),l.push([a,t]);return l}function Ws(t,e,n){var o,r,i,a,s=n.config.annotLabelHeight,c=n.config.annotationHeight,l=n.config.demarcateCollinearChromosomes,u=c+s+4;for(o=0;oa.width-1)continue;i.fillRect(r.startPx,1,.5,u)}else i.fillRect(r.startPx,s+1,.5,c);if(l)for(o=0;o"),Di.select(e.config.container+" #_ideogramTrackLabel").interrupt().style("top","").style("left","").style("transform",null).style("transform","rotate(-90deg)").html(n),[o,r]=function(t,e,n){var o,r,i,a,s;return o=e.id.split("-").slice(0,-1).join("-")+"-0",r=Di.select(n.config.container+" #"+o).nodes()[0].getBoundingClientRect(),i=Di.select(n.config.container+" #_ideogramTrackLabel").nodes()[0].getBoundingClientRect(),a=Di.select(n.config.container).nodes()[0].getBoundingClientRect(),s=Math.round(r.left+i.width)-r.width-1,[s-=a.left-7,-(t.split("
    ").length-2)*r.width+2]}(n,t,e),function(t,e,n){Di.select(n.config.container+" #_ideogramTrackLabel").style("opacity",1).style("left",e+"px").style("top",t+"px").style("width","max-content").style("transform-origin","bottom left").style("text-align","left").on("mouseover",(function(){clearTimeout(n.hideTrackLabelTimeout)})).on("mouseout",(function(){zs(n)}))}(r,o,e)}(this,i)})).on("mouseout",(function(){zs(i)})),i.onDrawAnnotsCallback&&i.onDrawAnnotsCallback()}function Xs(t,e,n){var o,r,i,a,s,c,l,u=[];for(o=0;o0&&(r+="-"+t.stop.toLocaleString(),e&&(r+=" ("+function(t){const e=Math.abs(t.stop-t.start);return n=e,((o=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"},{value:1e12,symbol:"T"},{value:1e15,symbol:"P"},{value:1e18,symbol:"E"}].slice().reverse().find((function(t){return n>=t.value})))?(n/o.value).toFixed(void 0).replace(/\.0+$|(\.[0-9]*[1-9])0+$/,"$1")+" "+o.symbol:"0")+"bp";var n,o}(t)+")")),n=`
    ${r}
    `,o=24,t.name&&(n=(t.displayName?t.displayName:t.name)+n,o+=8),[n,o]}(t,!0),function(t,e,n,o,r){t.html(e).style("opacity",1).style("left",n.e+"px").style("top",n.f-o+"px").style("font-family",r.config.fontFamily).style("pointer-events",null).on("mouseover",(function(){clearTimeout(r.hideAnnotTooltipTimeout)})).on("mouseout",(function(){r.startHideAnnotTooltipTimeout()}))}(i,o,n,r,c),c.onDidShowAnnotTooltipCallback&&c.onDidShowAnnotTooltipCallback()):Zs())}function ic(t){return"ideogramLabel_"+t.domId}function ac(t,e,n){Di.selectAll("._ideoActive").classed("_ideoActive",!1),Di.select("#"+e).attr("class","_ideogramLabel "+t),Di.select("#"+n+" > path").attr("class",t)}function sc(t,e){let n,o;const r=t.target,i=t.type;if(Array.from(r.classList).includes("_ideogramLabel"))n=r.id,o=r.id.split("ideogramLabel_")[1],Di.select("#"+o+" path").dispatch(i);else{const t=r.parentElement;n="ideogramLabel_"+t.id,o=t.id}"mouseout"===i&&(e.time.prevTooltipOff=performance.now(),e.time.prevTooltipAnnotDomId=o),"mouseover"===i?(clearTimeout(window._ideoActiveTimeout),ac("_ideoActive",n,o)):window._ideoActiveTimeout=window.setTimeout((function(){ac("",n,o)}),250)}function cc(t,e){var n,o=!1;return e.annots.forEach((e=>{o||e.annots.forEach((e=>{o||e.name===t&&(n=e,o=!0)}))})),n}function lc(t,e){var n,o,r,i,a,s,c,l,u,d=e.config;return null===(n=document.querySelector("#"+t.domId))?null:(o=n.getBoundingClientRect(),r=document.querySelector("#_ideogram").getBoundingClientRect(),i=Xi(t.name,e).width,i+=d.fontFamily?9:7,a=d.annotLabelSize?d.annotLabelSize:13,c=(s=o.top-r.top+a-1)+a,u=(l=o.left-r.left-i)+i,name=t.name,{top:s,bottom:c,right:u,left:l,width:i,height:a,name})}function uc(t,e,n){var o,r=this;const i=lc(o=cc(t,r),r);null!==i&&function(t,e,n){n.didSetLabelStyle||(document.querySelector("#_ideogramInnerWrap").insertAdjacentHTML("afterbegin","\n \n "),n.didSetLabelStyle=!0);const o=ic(t),r=Yi(n);let i="pink"===t.color?"#CF406B":t.color;i=Ji(i),Di.select("#_ideogram").append("text").attr("id",o).attr("class","_ideogramLabel").attr("x",e.left).attr("y",e.top).style("font",r).style("fill",i).style("pointer-events",null).html(t.name)}(o,Object.assign(i,{backgroundColor:e,borderColor:n}),r)}function dc(t=[],e=10){const n=this;t=function(t){return JSON.parse(JSON.stringify(t))}(t),n.clearAnnotLabels();let o=[];const r=[];0===t.length&&(t=n.flattenAnnots()),t.forEach(((t,e)=>{const i=lc(t,n);null!==i?r.length>0&&r.some(((t,e)=>{const n=function(t,e,n){const o=t.left-0,r=e.left-0,i=t.right+0,a=e.right+0;return o<=r&&o<=a&&i<=a&&i>=r||o>=r&&o<=a&&i>=a&&i>=r||o<=r&&o<=a&&i>=a&&i>=r||o>=r&&o<=a&&i>=r&&i<=a}(t,i),o=function(t,e,n){const o=t.top-0,r=e.top-0,i=t.bottom+0,a=e.bottom+0;return o<=r&&o<=a&&i<=a&&i>=r||o>=r&&o<=a&&i>=a&&i>=r}(t,i);return n&&o}))||(o.push(t),r.push(i)):console.debug(t.name+" has null layout")}));const i=n.config;"relatedGenesMode"in i&&["hints"].includes(i.relatedGenesMode)&&(e=20),o=o.sort(n.annotSortFunction).slice(0,e),o.reverse(),o.forEach((t=>{n.addAnnotLabel(t.name)})),Di.selectAll("._ideogramLabel, .annot").on("mouseover",(t=>sc(t))).on("mouseout",(t=>sc(t,n))).on("click",(t=>sc(t)))}function fc(t){const e=ic(cc(t,this));document.querySelector("#"+e).remove()}function hc(){document.querySelectorAll("._ideogramLabel").forEach((t=>{t.remove()}))}function pc(t){var e,n,o=!1,r=(new Date).getTime(),i=this;return e=i.chromosomes[i.config.taxid],function(t){"histogramScaling"in t.config==0&&(t.config.histogramScaling="absolute")}(i),void 0===i.maxAnnotsPerBar&&(i.maxAnnotsPerBar={},o=!0),n=function(t,e){var n,o,r,i,a,s,c,l,u=e.config.barWidth,d=[];for(s=0;s=f&&ui&&(i=l),l>o&&(o=l);n.maxAnnotsPerBar[s]=i}n.maxAnnotsPerBarAllChrs=o}}(n,o,i),n=function(t,e){var n,o,r,i,a,s,c,l=e._layout._isRotated;for(n=0;n";else if("triangle"===r){var i="";"vertical"===e.config.orientation&&(i=' transform="rotate(90, 7, 7)"'),"down"===e.config.orientation&&(i=' transform="rotate(180, 7, 7)"'),n='"}}else n='";return n}function yc(t,e,n,o,r){var i,a,s,c=vc(r);for(i=0;i'+(s=n.rows[i]).name+"",a=c*(i-1)+o+1,"name"in n&&(a+=c),e+=''+gc(s,r)+"";return[t,e]}function vc(t){return 2*$i(Xi("A",t).height)+.5}function bc(t){var e,n,o,r,i,a,s=t.config,c=vc(t);for(Di.select(s.container+" #_ideogramLegend").remove(),n=s.legend,a="",e=0;e`+i.name+""),o='',[r,o]=yc(r,o,i,s,t),a+=(o+="")+"
      "+r+"
    "}var l=`font-family: ${s.fontFamily};`,u=`line-height: ${vc(t)}px;`;mc+=`#_ideogramLegend {${l} ${u}}`;var d=Di.select(s.container+" #_ideogramOuterWrap");d.append("style").html(mc),d.append("div").attr("id","_ideogramLegend").html(a)}function wc(t,e,n=!1,o=!1){var r,i,a=[],s=this,c=s.chromosomes[s.config.taxid];if(0===t.length)return void(s.annots=[]);if("annots"in t[0]||"values"in t[0])return s.drawProcessedAnnots(t,e);for(i in c)a.push({chr:i,annots:[]});a=function(t,e){var n,o,r,i;for(n=0;n2e3&&console.warn('Rendering more than 2000 annotations in Ideogram?\nTry setting "annotationsLayout" to "heatmap" or "histogram" in your Ideogram configuration object for better layout and performance.')}}(t,e),"histogram"===t&&(e=n.getHistogramBars(e)),o=function(t,e){return Di.selectAll(e.selector+" .chromosome").data(t).selectAll("path.annot").data((function(t){return t.annots})).enter()}(n.fillAnnots(e),n),"tracks"===t?function(t,e){var n,o=e.config.annotationHeight;n=function(t){var e;return{triangle:"m0,0 l -"+t+" "+2*t+" l "+2*t+" 0 z",circle:"m -"+(e=t)+", "+e+"a "+e+","+e+" 0 1,0 "+2*e+",0a "+e+","+e+" 0 1,0 -"+2*e+",0",rectangle:"m0,0 l 0 "+2*t+"l "+t+" 0l 0 -"+2*t+"z"}}(o),t.append("g").attr("id",(function(t){return t.domId})).attr("class","annot").attr("transform",(function(t){var n=e.config.chrWidth+t.trackIndex*o*2;return"translate("+t.px+","+n+")"})).append("path").attr("d",(function(t){return function(t,e){return t.shape&&"triangle"!==t.shape?"circle"===t.shape?e.circle:"rectangle"===t.shape?e.rectangle:t.shape:e.triangle}(t,n)})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t,n){e.showAnnotTooltip(n,this)})).on("mouseout",(function(){e.startHideAnnotTooltipTimeout()})).on("click",(function(t,n){e.onClickAnnot(n)}))}(o,n):"overlay"===t?function(t,e){t.append("polygon").attr("id",(function(t){return t.id})).attr("class","annot").attr("points",(function(t){var n,o,r=e.config.chrWidth;return t.stopPx-t.startPx>1?(n=t.startPx,o=t.stopPx):(n=t.px-.5,o=t.px+.5),n+","+r+" "+o+","+r+" "+o+",0 "+n+",0"})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t,n){e.showAnnotTooltip(n,this)})).on("mouseout",(function(){e.startHideAnnotTooltipTimeout()}))}(o,n):"histogram"===t&&function(t,e){var n,o,r={},i=e.config.chrWidth;for(o in n=e.chromosomes[e.config.taxid])r[o]=n[o];t.append("polygon").attr("class","annot").attr("points",(function(t){return function(t,e,n,o){var r,i,a,s;r=t.px+o.bump,i=t.px+o.config.barWidth+o.bump,a=e,s=e+t.height;var c=n[t.chr];return i>c&&(i=c),r+","+a+" "+i+","+a+" "+i+","+s+" "+r+","+s}(t,i,r,e)})).attr("fill",(function(t){return t.color}))}(o,n)}(e,t,o),o.onDrawAnnotsCallback&&o.onDrawAnnotsCallback())}function _c(t,e,n){return t.append("g").attr("class","syntenicRegion").attr("id",e).on("click",(function(){var t=this,e=Di.selectAll(n.selector+" .syntenicRegion").filter((function(){return this!==t}));e.classed("hidden",!e.classed("hidden"))})).on("mouseover",(function(){var t=this;Di.selectAll(n.selector+" .syntenicRegion").filter((function(){return this!==t})).classed("ghost",!0)})).on("mouseout",(function(){Di.selectAll(n.selector+" .syntenicRegion").classed("ghost",!1)}))}function Ac(t,e,n,o,r,i){var a,s;a="color"in i?i.color:"#CFC",s="opacity"in i?i.opacity:1,t.append("polygon").attr("points",e+", "+o.startPx+" "+e+", "+o.stopPx+" "+n+", "+r.stopPx+" "+n+", "+r.startPx).style("fill",a).style("fill-opacity",s)}function Cc(t,e,n,o,r,i){var a,s;a="color"in i?i.color:"#CFC",s="opacity"in i?i.opacity:1,t.append("polygon").attr("points",o.startPx-15+", "+e+" "+(o.stopPx-15)+", "+e+" "+(r.stopPx-15)+", "+n+" "+(r.startPx-15)+", "+n).style("fill",a).style("fill-opacity",s)}function Sc(t,e,n=null){var o,r,i,a;if(o=t.r1,r=t.r2,"string"==typeof o.chr){const t=e.config.taxids;e.config.multiorganism?(o.chr=e.chromosomes[t[0]][o.chr],r.chr=e.chromosomes[t[1]][r.chr]):(o.chr=e.chromosomes[t[0]][o.chr],r.chr=e.chromosomes[t[0]][r.chr])}var s=document.querySelector("#"+o.chr.id+"-chromosome-set"),c=s.getCTM().e,l=s.getCTM().f,u=document.querySelector("#"+r.chr.id+"-chromosome-set"),d=u.getCTM().e,f=u.getCTM().f;return null===n?"vertical"===e.config.orientation?(i=l-12,a=f-12):(i=c,a=d):(i=n,a=n),o.startPx=e.convertBpToPx(o.chr,o.start)+i,o.stopPx=e.convertBpToPx(o.chr,o.stop)+i,r.startPx=e.convertBpToPx(r.chr,r.start)+a,r.stopPx=e.convertBpToPx(r.chr,r.stop)+a,[o,r]}function Lc(t,e,n,o,r){t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.startPx).attr("y2",r.startPx),t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.stopPx).attr("y2",r.stopPx)}function Tc(t,e,n,o,r){t.append("line").attr("class","syntenyBorder").attr("x1",o.startPx-15).attr("x2",r.startPx-15).attr("y1",e).attr("y2",n),t.append("line").attr("class","syntenyBorder").attr("x1",o.stopPx-15).attr("x2",r.stopPx-15).attr("y1",e).attr("y2",n)}function kc(t,e,n,o,r,i){var a,s;Math.abs(o.startPx-o.startPx)<2&&Math.abs(o.stopPx-o.stopPx)<2?(a=i.color,s=i.width):(a="",s=""),t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.startPx).attr("y2",r.startPx).style("stroke",a).style("stroke-width",s),t.append("line").attr("class","syntenyBorder").attr("x1",e).attr("x2",n).attr("y1",o.stopPx).attr("y2",r.stopPx).style("stroke",a).style("stroke-width",a)}function Mc(t,e,n,o,r,i){var a=i.split("__").map((t=>"label_"+t));if("name"in o){t.append("text").attr("id",a[0]).attr("y",o.startPx+3).text(o.name);var s=document.querySelector("#"+a[0]).getBoundingClientRect().width;Di.select("#"+a[0]).attr("x",e-15-s)}"name"in r&&t.append("text").attr("id",a[1]).text(r.name).attr("x",n+15).attr("y",r.startPx+3).text(r.name)}function Ec(t){var e=(new Date).getTime(),n=this,o=n.config;if(n.syntenicRegions=t,o.multiorganism&&"collinear"===o.geometry)return"vertical"===o.orientation?function(t,e){var n=(new Date).getTime();(function(t,e,n){var o,r,i,a,s,c,l,u;for(o=0;oc&&(c=s+1),i.splice(4,0,s),a.push(i);l.push({chr:r.chr,annots:a})}return e.numAvailTracks=c,l}(t.annots,o),e.splice(4,0,"trackIndexOriginal"),t={keys:e,annots:n},o.rawAnnots.metadata&&(t.metadata=o.rawAnnots.metadata)),t}var Fc=[["F00"],["F00","88F"],["F00","CCC","88F"],["F00","FA0","0AF","88F"],["F00","FA0","CCC","0AF","88F"],["F00","FA0","875","578","0AF","88F"],["F00","FA0","875","CCC","578","0AF","88F"],["F00","FA0","7A0","875","0A7","578","0AF","88F"],["F00","FA0","7A0","875","CCC","0A7","578","0AF","88F"],["F00","FA0","7A0","875","552","255","0A7","578","0AF","88F"]];function Bc(t,e,n,o,r,i,a){return a.config.annotationTracks?r=function(t,e,n,o,r){var i;return e.trackIndex=n[3],(i=r.config.annotationTracks[e.trackIndex]).color&&(e.color=i.color),i.shape&&(e.shape=i.shape),t[o].annots.push(e),t}(r,t,n,i,a):"trackIndex"===e[3]&&1!==a.numAvailTracks?[r,o]=function(t,e,n,o,r,i){var a=Fc[i.numAvailTracks-1];return t.trackIndex=e[3],t.trackIndexOriginal=e[4],t.color="#"+a[t.trackIndexOriginal],t.trackIndex>i.config.numTracks-1?(t.trackIndex in n?n[t.trackIndex].push(t):n[t.trackIndex]=[t],[o,n]):(o[r].annots.push(t),[o,n])}(t,n,o,r,i,a):r=function(t,e,n,o){return e.trackIndex=0,e.color||(e.color=o.config.annotationsColor),e.shape||(e.shape="triangle"),t[n].annots.push(e),t}(r,t,i,a),[r,o]}function Ic(t,e){return"_c"+t+"_a"+e}function $c(t,e,n,o,r,i,a){var s,c,l,u;const d=!a.config.annotationsLayout||"tracks"===a.config.annotationsLayout;for(s=0;s-a.annotSortFunction(t,e)))):t[r].annots.sort(((t,e)=>t[1]-e[1])),s=0;s10&&console.error("Ideogram only displays up to 10 tracks at a time. You specified "+r+" tracks. Perhaps consider a different way to visualize your data."),(n=Object.keys(t).length)&&console.warn("Ideogram configuration specified "+r+" tracks, but loaded annotations contain "+n+" extra tracks.")}(o,r),n}class Hc{constructor(t,e){this.matrix=t,this.ideo=e}setRawAnnots(){var t,e,n;return t=this,e=this.ideo,n=this.matrix,new Promise((function(o){t.rawAnnots=t.fetchCoordinates(e).then((function(r){t.coordinates=r,o(t.parseExpressionMatrix(n,e))}))}))}fetchCoordinates(t){var e={};if("human"===t.config.organism){var n=t.config.dataDir+"../../annotations/Homo_sapiens,_Ensembl_80.tsv";return new Promise((function(o){t.fetch(n,"text").then((function(t){var n,r,i,a,s,c,l;for(n=t.split(/\r\n|\n/).slice(1),r=0;rparseFloat(t))),[o,r,length]=this.coordinates[i],-1===(n=e.indexOf(o))?[null,null]:[n,[i,r,length].concat(a)])}parseExpressionMatrix(t,e){var n,o,r,i,a,s,c=[],l=t.split(/\r\n|\n/);for(o=Object.keys(e.chromosomes[e.config.taxid]),n=0;n{n.annots.forEach((n=>{const o=t.annotDescriptions.annots[n.name];e[n.name]=[n.name,o.ensemblId,n.chr,n.start,n.stop,n.length,o.type]}))}));const n=[["# Gene name","Ensembl ID","Chromosome","Start","Stop","Length","Type"]].concat(Object.values(e)),o=t.annotDescriptions.headers+"\n#\n"+n.map((t=>t.join("\t"))).join("\n"),r="data:text/plain;charset=utf-8,"+encodeURIComponent(o);var i=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),a=document.createElement("a");a.setAttribute("download","ideogram.tsv"),a.setAttribute("href",r),a.setAttribute("target","_blank"),a.setAttribute("id","_ideo-undisplayed-dl-annots-link"),a.setAttribute("style","display: none;"),document.body.appendChild(a),a.dispatchEvent(i)}function Wc(){var t=this,e=t.config;!function(t){var e,n=t.config;n.annotationHeight||("heatmap"===n.annotationsLayout?e=n.chrWidth-1:(e=Math.round(n.chrHeight/100))<3&&(e=3),t.config.annotationHeight=e)}(t),e.annotationsPath||e.localAnnotationsPath||t.annots||e.annotations?function(t,e){e.annotationTracks?t.config.numAnnotTracks=e.annotationTracks.length:e.annotationsNumTracks?t.config.numAnnotTracks=e.annotationsNumTracks:t.config.numAnnotTracks=1,t.config.annotTracksHeight=e.annotationHeight*e.numAnnotTracks,void 0===e.barWidth&&(t.config.barWidth=3)}(t,e):(t.config.annotTracksHeight=0,t.config.numAnnotTracks=0),void 0===e.annotationsColor&&(t.config.annotationsColor="#F00"),e.onClickAnnot&&(t.onClickAnnotCallback=e.onClickAnnot),function(t,e){!1!==e.showAnnotTooltip&&(t.config.showAnnotTooltip=!0),e.onWillShowAnnotTooltip&&(t.onWillShowAnnotTooltipCallback=e.onWillShowAnnotTooltip),e.onDidShowAnnotTooltip&&(t.onDidShowAnnotTooltipCallback=e.onDidShowAnnotTooltip)}(t,e),function(t,e){!1!==e.addAnnotLabel&&(t.config.addAnnotLabel=!0),e.onWillAddAnnotLabel&&(t.onWillAddAnnotLabelCallback=e.onWillAddAnnotLabel)}(t,e)}function jc(){var t=this,e=t.config;t.rawAnnots.annots=t.rawAnnots.annots.sort(Ideogram.sortChromosomes),t.onLoadAnnotsCallback&&t.onLoadAnnotsCallback(),("heatmapThresholds"in e||"metadata"in t.rawAnnots&&"heatmapThresholds"in t.rawAnnots.metadata)&&("heatmap"===e.annotationsLayout?function(t){var e,n,o,r,i,a,s=t.config.heatmapThresholds;for(o=[],n=(i=t.rawAnnots).keys.slice(3),r=[],a=[],!i.metadata&&isNaN(s[0])||(s=Os(t)),e=0;et.chr));if(o.forEach((t=>{t in e&&n.push(t),e[t]=1})),n.length>0)throw Error(`Duplicate chromosomes detected.\nChromosome list: ${o}. Duplicates: ${n}.\nTo fix this, edit your raw annotations JSON data to remove redundant chromosomes.`)}(t)}function qc(){return this.annots.reduce(((t,e)=>[...t,...e.annots]),[])}function zc(t){var e,n=this,o=n.config;e="heatmap-2d"===o.annotationsLayout;var r=function(t){var e,n;return n=(e=t.split("?")[0].split("."))[e.length-1],!1===["bed","json","tsv"].includes(n)?(n=n.toUpperCase(),void alert("Ideogram.js only supports BED and Ideogram JSON and TSV at the moment. Sorry, check back soon for "+n+" support!")):n}(t);"http"===t.slice(0,4)||e||"tsv"===r?(r=e?"":r,n.fetch(t,"text").then((function(t){n.rawAnnotsResponse=t,e?new Hc(t,n).setRawAnnots().then((function(t){n.rawAnnots=t,n.afterRawAnnots()})):(n.rawAnnots="tsv"===r?new Fs(t,n).rawAnnots:"bed"===r?new Ns(t,n).rawAnnots:JSON.parse(t),n.afterRawAnnots())}))):n.fetch(t).then((function(t){n.rawAnnotsResponse=t,n.rawAnnots=t,n.afterRawAnnots()}))}function Uc(t){var e,n,o,r,i,a,s;for(e=[],n=[],o=this.chromosomesArray,r=0;r(n.includes(t.name)?t.rank=n.indexOf(t.name)+1:t.rank=1e10,t)))}return t.map((t=>(t.rank=t.initRank,t)))}function Yc(t,e="red"){const n=this,o=n.config.taxid,r=t.map((t=>{const r=n.chromosomes[o][t].id,i=`${n.selector} #${r}-chromosome-set`,a=document.querySelector(i),s=a.getBoundingClientRect();return``})).join();document.querySelector(n.selector).insertAdjacentHTML("afterBegin",r)}function Xc(t){const e=this;let n=`${e.selector} .ideo-highlight`;if(void 0!==t){const o=e.config.taxid;n=t.map((t=>{const n=e.chromosomes[o][t].id;return`${e.selector} #ideo-highlight-${n}`}))}document.querySelectorAll(n).forEach((t=>{t.remove()}))}var Kc="&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",Qc="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/",Jc=Qc+"esearch.fcgi?retmode=json"+Kc,Zc=Qc+"esummary.fcgi?retmode=json"+Kc,tl=Qc+"elink.fcgi?retmode=json"+Kc;function el(t,e){var n,o;return n=e.esearch+"&db=taxonomy&term="+t,Di.json(n).then((function(e){if(0===e.esearchresult.idlist.length)throw'Organism "'+t+"\" is generally unknown; it was not found in the NCBI Taxonomy database. If you did not intend to specify a novel or custom taxon, then try using the organism's scientific name, e.g. Homo sapiens or Arabidopsis thaliana.";return o=e.esearchresult.idlist[0],[t,o]}))}function nl(t,e){var n,o,r=this;t=r.config.organism,o=r.esummary+"&db=taxonomy&id="+t,Di.json(o).then((function(o){return n=o.result[String(t)].commonname,r.config.organism=n,e(n)}))}function ol(t,e,n){var o,r,i,a,s,c=n.config;(function(t,e){var n,o,r;if(e.assemblyIsAccession())return new Promise((function(n){e.coordinateSystem="bp",e.getAssemblyAndChromosomesFromEutils(t,n)}));n=e.config.dataDir,o=zi(e.organisms[t].scientificName),r=[t],["9606","10090","10116"].includes(t)&&!e.config.showFullyBanded&&(o+="-no-bands");var i=n+o+".json",a=new Promise(((t,e)=>Bi(i).then((e=>e.json().then((function(e){t(e)})))).catch((t=>{e(t)}))));return a.then((function(n){var o,i,a,s,c=n.chrBands,l=[""],u=[],d={};e.bandData[n.taxid]=c;for(var f=0;f{t.length>i.bp&&(i.bp=t.length)})),e.maxLength[t]=i,l.push(u),l.push(r),l}),(function(){return new Promise((function(n){e.coordinateSystem="bp",e.getAssemblyAndChromosomesFromEutils(t,n)}))}))})(t,n).then((function(l){o=l[0],r=l[1],"chromosomes"in c==0||null===c.chromosomes?(n.config.chromosomes={},n.config.chromosomes[t]=r):(c.multiorganism?t in c.chromosomes?i=c.chromosomes[t]:(a=zi(n.getScientificName(t)),n.config.chromosomes[t]=c.chromosomes[a].slice(),i=n.config.chromosomes[t]):i=c.chromosomes,s=r.filter((t=>i.includes(t.name))),n.config.chromosomes[t]=s),n.chromosomes[t]=n.config.chromosomes[t].slice(),n.organisms[t].assemblies={default:o},e()}))}function rl(t,e){var n,o;for(n in e.organisms)if(o=e.organisms[n],n===zi(t)||zi(o.commonName)===zi(t)||zi(o.scientificName)===zi(t))return!0;return!1}function il(t,e){(function(t){var e,n,o,r,i,a=t.config;return e=[],n={},function(t,e){var n,o,r,i=[],a={};for(r=0;rzi(t))),i.includes(zi(s.scientificName))?o=s.scientificName:i.includes(zi(s.commonName))&&(o=s.commonName),zi(o)in a.chromosomes?n[r]=a.chromosomes[zi(o)]:n[r]=a.chromosomes[o.toLowerCase()]):n=null);return[n,e]}))})(e).then((function([n,o]){var r,i,a,s,c,l=e.config,u=[];for(r=0;r{t.length>a.bp&&(a.bp=t.length)})),a.bp>n.maxLength.bp&&(n.maxLength.bp=a.bp),n.maxLength[e]=a,n.coordinateSystem="bp",c}(r.result,t,o);return e([n,i])}),(function(t){console.warn(t)}))}function ll(){var t=this,e=t.bandsToShow.join(",");0!==t.bandsToShow.length&&(Di.selectAll(t.selector+" .bandLabel, .bandLabelStalk").style("display","none"),Di.selectAll(e).style("display",""))}function ul(t,e,n,o,r){return e!==n&&(t=o[r.id][n]+36),t}function dl(t,e,n,o,r,i,a){var s,c;return n"pter"!==t.name)),s=a.drawBandLabelText(n,i,o,s),a.drawBandLabelStalk(n,i,o,s);a.setBandsToShow(r,s)}function yl(t,e){return[e[t][0],e[t][1],e[t][2],e[t][3]]}function vl(){var t="";return t=function(t){var e,n,o,r,i,a="";for(e=0;e',a+="gneg"===n?'':'',a+="";return a}(aa),``+(t+=' ')+""}function bl(t,e,n){var o,r,i;return(o=e[0])in t==0&&(t[o]=[]),r=function(t){var e=t[7];return t[8]&&(e+=t[8]),e}(e),i=function(t,e,n,o){return{chr:t,bp:{start:parseInt(e[5],10),stop:parseInt(e[6],10)},iscn:{start:parseInt(e[3],10),stop:parseInt(e[4],10)},px:{start:-1,stop:-1,width:-1},name:e[1]+e[2],stain:n,taxid:o}}(o,e,r,n),t[o].push(i),t}function wl(t,e,n,o){var r,i,a=o.config.multiorganism;return null!=t&&(i=(r=Array.isArray(t))&&-1===t.indexOf(e),!(!r||"object"==typeof t||!i)||(n in t!=0||!a)&&(a?"string"==typeof t[n][0]?!1===t[n].includes(e):0===t[n].filter((t=>t.name===e)).length:0===t.filter((t=>t===e)).length))}function xl(t,e,n,o){var r,i,a=[];return r=e[t],a.push(r),i={iscn:r[r.length-1].iscn.stop,bp:r[r.length-1].bp.stop},n in o.maxLength==0&&(o.maxLength[n]={bp:0,iscn:0}),i.iscn>o.maxLength[n].iscn&&(o.maxLength[n].iscn=i.iscn,i.iscn>o.maxLength.iscn&&(o.maxLength.iscn=i.iscn)),i.bp>o.maxLength[n].bp&&(o.maxLength[n].bp=i.bp,i.bp>o.maxLength.bp&&(o.maxLength.bp=i.bp)),a}function _l(t,e,n,o){var r,i;if(t in o.bandData||t in Pi&&!1===o.assemblyIsAccession())n=function(t,e,n,o){var r,i,a;r=function(t,e,n){var o,r,i,a,s,c,l={};c=n.bandData[t],Array.isArray(c)&&(s="native"),e=function(t){var e,n;if(t instanceof Array&&"object"==typeof t[0]){for(e=[],n=0;n0&&(o.config.chromosomes[t]=e.slice()),o.numChromosomes+=o.config.chromosomes[t].length;for(i=0;io.maxLength.bp&&(o.maxLength.bp=r.length);return n}function Al(t){var e,n,o=this,r=o.config,i=(new Date).getTime();return e=[],"chromosomes"in r&&(n=r.multiorganism?r.chromosomes:t in r.chromosomes?r.chromosomes[t].slice():r.chromosomes.slice()),e=_l(t,n,e,o),function(t,e){var n=(new Date).getTime();e.config.debug&&console.log("Time in processBandData: "+(n-t)+" ms")}(i,o),[t,e]}function Cl(){call(this.onBrushMoveCallback)}function Sl(){call(this.onBrushEndCallback)}function Ll(t,e,n){var o,r,i,a,s=this,c=s.config.chrWidth+6.5,l=s._layout.margin.left;[t,e,n]=function(t,e,n){var o,r;return o=t.split(":"),r=t.split("-"),o.length>1&&r.length>1&&(t=o[0].replace("chr",""),r=o[1].split("-"),e=parseInt(r[0]),n=parseInt(r[1]-1)),[t,e,n]}(t,e,n),o=function(t,e){var n,o;for(n=0;n1||"MT"===t.name){if([o,n]=function(t,e){var n,o,r,i,a,s,c,l,u;for(n=0;n=a&&e<=s)return[l+u*(r+i/c*(e-a)-r)/i,o];return[null,o]}(t,e),null!==o)return o}else if(e>=1&&e<=t.length)return t.scale.bp*e;!function(t,e,n){throw new Error("Base pair out of range. bp: "+t+"; length of chr"+e.name+": "+n.bp.stop)}(e,t,n)}function Dl(t,e,n,o,r,i,a){var s,c,l,u;return a=t-e,s=o-r,c=i.bp.stop-i.bp.start,l=e+a/s*(n-r),u=i.bp.start+c*(l-e)/a,Math.round(u)}function Nl(t,e){var n,o,r,i,a,s;for(0===e&&(e=t.bands[0].px.start),n=0;n=r&&e<=i)return Dl(s,a,e,i,r,o,void 0);!function(t,e,n){throw new Error("Pixel out of range. px: "+t+"; length of chr"+e.name+": "+n)}(e,t,i)}let Fl=Rl,Bl=Rl,Il=Rl,$l=Hl,Ol=Gl;function Rl(t){for(var e=new Array(t),n=-1;++n32)throw new Error("invalid array width!");return t}function Wl(t){this.length=t,this.subarrays=1,this.width=8,this.masks={0:0},this[0]=Fl(t)}"undefined"!=typeof Uint8Array&&(Fl=function(t){return new Uint8Array(t)},Bl=function(t){return new Uint16Array(t)},Il=function(t){return new Uint32Array(t)},$l=function(t,e){if(t.length>=e)return t;var n=new t.constructor(e);return n.set(t),n},Ol=function(t,e){var n;switch(e){case 16:n=Bl(t.length);break;case 32:n=Il(t.length);break;default:throw new Error("invalid array width!")}return n.set(t),n}),Wl.prototype.lengthen=function(t){var e,n;for(e=0,n=this.subarrays;e>>0,!((e=this.width-32*o)>=32)||n)return e<32&&n&1<=t;o--)this[e][o]=0;this.length=t},Wl.prototype.zero=function(t){var e,n;for(e=0,n=this.subarrays;e[0,t.length],zl=t=>t,Ul=()=>null,Vl=()=>0;function Yl(t){function e(t,e,o){for(var r=o-e,i=1+(r>>>1);--i>0;)n(t,i,r,e);return t}function n(e,n,o,r){for(var i,a=e[--r+n],s=t(a);(i=n<<1)<=o&&(it(e[r+i+1])&&i++,!(s<=t(e[r+i])));)e[r+n]=e[r+i],n=i;e[r+n]=a}return e.sort=function(t,e,o){for(var r,i=o-e;--i>0;)r=t[e],t[e]=t[e+i],t[e+i]=r,n(t,1,i,e);return t},e}const Xl=Yl(zl);Xl.by=Yl;const Kl=Xl;function Ql(t){var e=Kl.by(t);return function(n,o,r,i){var a,s,c,l=new Array(i=Math.min(r-o,i));for(s=0;sa&&(l[0]=c,a=t(e(l,0,i)[0]))}while(++o>>1;n>>1;t(e[i]){for(var o=0,r=e.length,i=n?JSON.parse(JSON.stringify(t)):new Array(r);ot+1,iu=t=>t-1,au=t=>function(e,n){return e+ +t(n)},su=t=>function(e,n){return e-t(n)},cu=(t,e)=>{const n=t[e];return"function"==typeof n?n.call(t):n},lu=/\[([\w\d]+)\]/g;var uu=-1;fu.heap=Kl,fu.heapselect=Zl,fu.bisect=nu,fu.permute=ou;const du=fu;function fu(){var t,e={add:c,remove:function(e){for(var i=new Array(o),s=[],c="function"==typeof e,l=function(o){return c?e(n[o],o):t.zero(o)},d=0,f=0;d0&&(c=o);--a>=E&&e>0;)t.zero(r=m[a])&&(c>0?--c:(i.push(n[r]),--e));if(s)for(a=0;a0;a++)t.zero(r=S[a])&&(c>0?--c:(i.push(n[r]),--e));return i},bottom:function(e,o){var r,i,a=[],c=0;if(o&&o>0&&(c=o),s)for(r=0;r0;r++)t.zero(i=S[r])&&(c>0?--c:(a.push(n[i]),--e));for(r=E;r0;)t.zero(i=m[r])&&(c>0?--c:(a.push(n[i]),--e)),r++;return a},group:j,groupAll:function(){var t=j(Ul),e=t.all;return delete t.all,delete t.top,delete t.order,delete t.orderNatural,delete t.size,t.value=function(){return e()[0].value},t},dispose:q,remove:q,accessor:e,id:function(){return h}},S=[],L=function(t){return pu(t).sort((function(t,e){var n=g[t],o=g[e];return no?1:t-e}))},T=ql,k=[],M=[],E=0,P=0,D=0;i.unshift(F),i.push(B),a.push(I);var N=t.add();function F(n,r,i){var a,c;if(s){D=0,W=0,A=[];for(var u=0;uE)for(i=E,a=Math.min(n,P);iP)for(i=Math.max(n,P),a=o;ifunction(n){var o=n.length;return[t.left(n,e,0,o),t.right(n,e,0,o)]})(nu,t))(p))}function R(t){return x=t,_=!0,$((T=((t,e)=>{var n=e[0],o=e[1];return function(e){var r=e.length;return[t.left(e,n,0,r),t.left(e,o,0,r)]}})(nu,t))(p))}function H(){return x=void 0,_=!1,$((T=ql)(p))}function G(t){x=t,_=!0,w=t,T=ql,W(t,!1);var e=T(p);return E=e[0],P=e[1],C}function W(e,n){var o,i,a,c=[],h=[],g=[],y=[],w=p.length;if(!s)for(o=0;o1?jl.arrayLengthen(u,o):hu(o,_),G&&(k=(g=I[0]).key);j=M);)++j;for(;j=h));)M=e(i[j]);z()}for(;WW)if(s)for(W=0;W1||s?(C=D,S=F):(!A&&T&&(A=1,c=[{key:null,value:H()}]),1===A?(C=N,S=B):(C=Ul,S=Ul),u=null),r[m]=C}function P(t){if(A>1||s){var e,n,i,a=A,l=c,d=hu(a,a);if(s){for(e=0,i=0;e1||s)if(s)for(e=0;e1||s?(S=F,C=D):1===A?(S=B,C=N):S=C=Ul}else if(1===A){if(T)return;for(var f=0;f=0&&r.splice(t,1),(t=k.indexOf(E))>=0&&k.splice(t,1),(t=a.indexOf(P))>=0&&a.splice(t,1),(t=M.indexOf(i))>=0&&M.splice(t,1),i}return arguments.length<1&&(e=zl),r.push(C),k.push(E),a.push(P),E(p,m,0,o),O().orderNatural()}function q(){M.forEach((function(t){t.dispose()}));var e=i.indexOf(F);return e>=0&&i.splice(e,1),(e=i.indexOf(B))>=0&&i.splice(e,1),(e=a.indexOf(I))>=0&&a.splice(e,1),t.masks[f]&=d,H()}return f=N.offset,l=N.one,d=~l,h=f<<7|Math.log(l)/Math.log(2),F(n,0,o),B(0,0,o),C},groupAll:function(){var e,a,s,c,l={reduce:h,reduceCount:p,reduceSum:function(t){return h(au(t),su(t),Vl)},value:function(){return u&&(function(){var r;for(e=c(),r=0;r=0&&r.splice(t,1),(t=i.indexOf(d))>=0&&i.splice(t,1),l}return r.push(f),i.push(d),d(0,0),p()},size:function(){return o},all:function(){return n},allFiltered:function(e){var r=[],i=0,a=l(e||[]);for(i=0;i>7]&=~(1<<(63&i));return a}function u(t){for(var e=0;e{t.classList.remove("active")}))}function Su(){Cu(document.querySelectorAll("#tools > ul > li")),document.querySelectorAll(".ideo-modal, .ideo-tool-panel").forEach((t=>{t.remove()})),document.querySelector("#tools").style.display="none"}function Lu(t){const e=document.querySelectorAll("#tools > ul > li");e.forEach((n=>{const o=function(t){return Array.from(t.classList).includes("ideo-tool-hover")?"mouseenter":"click"}(n);n.addEventListener(o,(r=>{Cu(e),n.classList+=" active";const i=n.id.split("-")[0],s=function(t,e){var n;return"download"===t&&(n=`\n
    \n
  • Image
  • \n
  • 0?"":"ideo-disabled"}">Annotations
  • \n
    \n `),"about"===t&&(n=`\n
    \n \n \n Ideogram.js, version ${a} x
    \n Chromosome visualization for the web\n
    `),n.trim()}(i);"mouseenter"===o?(n.insertAdjacentHTML("beforeend",s),function(t,e,n,o){"mouseenter"===t&&n.addEventListener("mouseleave",(t=>{const n=t.toElement,r=n.id,i=document.querySelector(".ideo-tool-panel");document.querySelector("#tools").contains(n)&&i&&!i.contains(n)&&r!==e&&(Cu(o),i.remove())}))}(o,i,n,e),"download"===i&&(document.querySelector("#download-image").addEventListener("click",(e=>{Su(),function(t){var e=document.querySelector(t.selector),n="_ideo-undisplayed-dl-canvas";(o=document.createElement("canvas")).setAttribute("style","display: none"),o.setAttribute("id",n);var o,r=e.width.baseVal.value+30,i=e.cloneNode(!0);i.style.left="",o.setAttribute("width",r),document.body.appendChild(o),(o=document.getElementById(n)).width*=2,o.height*=2;var a=o.getContext("2d");a.setTransform(2,0,0,2,0,0),a.imageSmoothingEnabled=!1;var s=(new XMLSerializer).serializeToString(i),c=window.URL||window.webkitURL||window,l=new Image,u=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),d=c.createObjectURL(u);l.onload=function(){var t,e,n;a.drawImage(l,0,0),c.revokeObjectURL(d),t=o.toDataURL("image/png").replace("image/png","image/octet-stream"),e=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),(n=document.createElement("a")).setAttribute("download","ideogram.png"),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.setAttribute("id","_ideo-undisplayed-dl-image-link"),n.setAttribute("style","display: none;"),document.body.appendChild(n),n.dispatchEvent(e),o.remove()},l.src=d}(t)})),document.querySelector("#download-annots").addEventListener("click",(e=>{const n=document.querySelector("#download-annots");!1===Array.from(n.classList).includes("ideo-disabled")&&(Su(),t.downloadAnnotations())})))):document.querySelector("#gear").insertAdjacentHTML("beforeend",s)}))})),document.querySelectorAll("#close").forEach((t=>{t.addEventListener("click",(()=>{Su()}))}))}function Tu(t){const e=`\n ${_u}\n \n `;document.querySelector(t.selector).insertAdjacentHTML("beforebegin",e),function(t){document.querySelector("#gear").addEventListener("click",(t=>{var e=document.querySelector("#tools");"none"===e.style.display?(e.style.display="",function(t){const e=document.querySelectorAll("#gear, #tools"),n=t=>{let n=0;e.forEach((e=>{e.contains(t.target)||(n+=1)})),n===e.length&&(Su(),o())},o=()=>{document.removeEventListener("click",n)};document.addEventListener("click",n)}()):(e.style.display="none",Su())})),Lu(t)}(t),function(t){const e=document.querySelector(t.selector),n=document.querySelector("#gear"),o=document.querySelector("#tools");e.addEventListener("mouseover",(()=>n.style.display="")),e.addEventListener("mouseout",(()=>{"none"===o.style.display&&(n.style.display="none")})),n.addEventListener("mouseover",(()=>n.style.display=""))}(t)}class ku{constructor(t){this._model=t,this._class="ModelAdapter"}static getInstance(t){return t.bands?new ku(t):new Mu(t)}getModel(){return this._model}getCssClass(){return""}}class Mu extends ku{constructor(t){super(t),this._class="ModelNoBandsAdapter"}getModel(){this._model.bands=[];const t="MT"===this._model.name,e=this._model.width;return(e>1||t)&&this._model.bands.push({name:"q",px:{start:0,stop:e,width:e},bp:{start:1,stop:this._model.bpLength??this._model.length},iscn:{start:1,stop:this._model.length}}),this._model}getCssClass(){return"noBands"}}class Eu{constructor(t){this._config=t,this._ploidy=new ls(this._config)}getArmColor(t,e,n){return this._config.armColors?this._config.armColors[n]:this._config.ancestors?this._getPolyploidArmColor(t,e,n):null}getBorderColor(t,e,n){const o=this._config,r=o.chrBorderColor?o.chrBorderColor:"#000";return e1&&(o=this._ploidy.getChromosomesNumber(e)),i=0;i1||""===e.orientation)&&(t-=1),t}(e,s),r=-4,!0===s.showBandLabels&&(r=s.chrMargin+s.chrWidth+26),i=s.chrMargin*e,s.numAnnotTracks>1==0&&(i+=1),a=i+r,t.selectAll("text.chrLabel").attr("transform",n.scaleSvg).selectAll("tspan").attr("x",n.x).attr("y",a)}(t,e,r,this):function(t,e,n,o){var r,i,a,s=o.config;r=-s.chrWidth-2,!0===s.showBandLabels&&(r=s.chrMargin+8),i=s.annotTracksHeight,"overlay"!==s.annotationsLayout&&(i*=2),a=3-(s.chrMargin*e+r)+i,a/=n.scale.x,t.selectAll("text.chrLabel").attr("transform","rotate(-90)"+n.scaleSvg).selectAll("tspan").attr("x",a).attr("y",n.y)}(t,e,r,this)}function Wu(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function ju(t){return t instanceof Wu(t).Element||t instanceof Element}function qu(t){return t instanceof Wu(t).HTMLElement||t instanceof HTMLElement}function zu(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Wu(t).ShadowRoot||t instanceof ShadowRoot)}var Uu=Math.max,Vu=Math.min,Yu=Math.round;function Xu(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Ku(){return!/^((?!chrome|android).)*safari/i.test(Xu())}function Qu(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&qu(t)&&(r=t.offsetWidth>0&&Yu(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&Yu(o.height)/t.offsetHeight||1);var a=(ju(t)?Wu(t):window).visualViewport,s=!Ku()&&n,c=(o.left+(s&&a?a.offsetLeft:0))/r,l=(o.top+(s&&a?a.offsetTop:0))/i,u=o.width/r,d=o.height/i;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function Ju(t){var e=Wu(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Zu(t){return t?(t.nodeName||"").toLowerCase():null}function td(t){return((ju(t)?t.ownerDocument:t.document)||window.document).documentElement}function ed(t){return Qu(td(t)).left+Ju(t).scrollLeft}function nd(t){return Wu(t).getComputedStyle(t)}function od(t){var e=nd(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function rd(t,e,n){void 0===n&&(n=!1);var o,r,i=qu(e),a=qu(e)&&function(t){var e=t.getBoundingClientRect(),n=Yu(e.width)/t.offsetWidth||1,o=Yu(e.height)/t.offsetHeight||1;return 1!==n||1!==o}(e),s=td(e),c=Qu(t,a,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(i||!i&&!n)&&(("body"!==Zu(e)||od(s))&&(l=(o=e)!==Wu(o)&&qu(o)?{scrollLeft:(r=o).scrollLeft,scrollTop:r.scrollTop}:Ju(o)),qu(e)?((u=Qu(e,!0)).x+=e.clientLeft,u.y+=e.clientTop):s&&(u.x=ed(s))),{x:c.left+l.scrollLeft-u.x,y:c.top+l.scrollTop-u.y,width:c.width,height:c.height}}function id(t){var e=Qu(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function ad(t){return"html"===Zu(t)?t:t.assignedSlot||t.parentNode||(zu(t)?t.host:null)||td(t)}function sd(t){return["html","body","#document"].indexOf(Zu(t))>=0?t.ownerDocument.body:qu(t)&&od(t)?t:sd(ad(t))}function cd(t,e){var n;void 0===e&&(e=[]);var o=sd(t),r=o===(null==(n=t.ownerDocument)?void 0:n.body),i=Wu(o),a=r?[i].concat(i.visualViewport||[],od(o)?o:[]):o,s=e.concat(a);return r?s:s.concat(cd(ad(a)))}function ld(t){return["table","td","th"].indexOf(Zu(t))>=0}function ud(t){return qu(t)&&"fixed"!==nd(t).position?t.offsetParent:null}function dd(t){for(var e=Wu(t),n=ud(t);n&&ld(n)&&"static"===nd(n).position;)n=ud(n);return n&&("html"===Zu(n)||"body"===Zu(n)&&"static"===nd(n).position)?e:n||function(t){var e=/firefox/i.test(Xu());if(/Trident/i.test(Xu())&&qu(t)&&"fixed"===nd(t).position)return null;var n=ad(t);for(zu(n)&&(n=n.host);qu(n)&&["html","body"].indexOf(Zu(n))<0;){var o=nd(n);if("none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||-1!==["transform","perspective"].indexOf(o.willChange)||e&&"filter"===o.willChange||e&&o.filter&&"none"!==o.filter)return n;n=n.parentNode}return null}(t)||e}var fd="top",hd="bottom",pd="right",md="left",gd="auto",yd=[fd,hd,pd,md],vd="start",bd="end",wd="viewport",xd="popper",_d=yd.reduce((function(t,e){return t.concat([e+"-"+vd,e+"-"+bd])}),[]),Ad=[].concat(yd,[gd]).reduce((function(t,e){return t.concat([e,e+"-"+vd,e+"-"+bd])}),[]),Cd=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Sd(t){var e=new Map,n=new Set,o=[];function r(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var o=e.get(t);o&&r(o)}})),o.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||r(t)})),o}var Ld={placement:"bottom",modifiers:[],strategy:"absolute"};function Td(){for(var t=arguments.length,e=new Array(t),n=0;n=0?"x":"y"}function Nd(t){var e,n=t.reference,o=t.element,r=t.placement,i=r?Ed(r):null,a=r?Pd(r):null,s=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2;switch(i){case fd:e={x:s,y:n.y-o.height};break;case hd:e={x:s,y:n.y+n.height};break;case pd:e={x:n.x+n.width,y:c};break;case md:e={x:n.x-o.width,y:c};break;default:e={x:n.x,y:n.y}}var l=i?Dd(i):null;if(null!=l){var u="y"===l?"height":"width";switch(a){case vd:e[l]=e[l]-(n[u]/2-o[u]/2);break;case bd:e[l]=e[l]+(n[u]/2-o[u]/2)}}return e}var Fd={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Bd(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,a=t.offsets,s=t.position,c=t.gpuAcceleration,l=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=a.x,h=void 0===f?0:f,p=a.y,m=void 0===p?0:p,g="function"==typeof u?u({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var y=a.hasOwnProperty("x"),v=a.hasOwnProperty("y"),b=md,w=fd,x=window;if(l){var _=dd(n),A="clientHeight",C="clientWidth";_===Wu(n)&&"static"!==nd(_=td(n)).position&&"absolute"===s&&(A="scrollHeight",C="scrollWidth"),(r===fd||(r===md||r===pd)&&i===bd)&&(w=hd,m-=(d&&_===x&&x.visualViewport?x.visualViewport.height:_[A])-o.height,m*=c?1:-1),r!==md&&(r!==fd&&r!==hd||i!==bd)||(b=pd,h-=(d&&_===x&&x.visualViewport?x.visualViewport.width:_[C])-o.width,h*=c?1:-1)}var S,L=Object.assign({position:s},l&&Fd),T=!0===u?function(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:Yu(n*r)/r||0,y:Yu(o*r)/r||0}}({x:h,y:m},Wu(n)):{x:h,y:m};return h=T.x,m=T.y,c?Object.assign({},L,((S={})[w]=v?"0":"",S[b]=y?"0":"",S.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",S)):Object.assign({},L,((e={})[w]=v?m+"px":"",e[b]=y?h+"px":"",e.transform="",e))}const Id={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},o=e.attributes[t]||{},r=e.elements[t];qu(r)&&Zu(r)&&(Object.assign(r.style,n),Object.keys(o).forEach((function(t){var e=o[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var o=e.elements[t],r=e.attributes[t]||{},i=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});qu(o)&&Zu(o)&&(Object.assign(o.style,i),Object.keys(r).forEach((function(t){o.removeAttribute(t)})))}))}},requires:["computeStyles"]},$d={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=void 0===r?[0,0]:r,a=Ad.reduce((function(t,n){return t[n]=function(t,e,n){var o=Ed(t),r=[md,fd].indexOf(o)>=0?-1:1,i="function"==typeof n?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*r,[md,pd].indexOf(o)>=0?{x:s,y:a}:{x:a,y:s}}(n,e.rects,i),t}),{}),s=a[e.placement],c=s.x,l=s.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=l),e.modifiersData[o]=a}};var Od={left:"right",right:"left",bottom:"top",top:"bottom"};function Rd(t){return t.replace(/left|right|bottom|top/g,(function(t){return Od[t]}))}var Hd={start:"end",end:"start"};function Gd(t){return t.replace(/start|end/g,(function(t){return Hd[t]}))}function Wd(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&zu(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function jd(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function qd(t,e,n){return e===wd?jd(function(t,e){var n=Wu(t),o=td(t),r=n.visualViewport,i=o.clientWidth,a=o.clientHeight,s=0,c=0;if(r){i=r.width,a=r.height;var l=Ku();(l||!l&&"fixed"===e)&&(s=r.offsetLeft,c=r.offsetTop)}return{width:i,height:a,x:s+ed(t),y:c}}(t,n)):ju(e)?function(t,e){var n=Qu(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(e,n):jd(function(t){var e,n=td(t),o=Ju(t),r=null==(e=t.ownerDocument)?void 0:e.body,i=Uu(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=Uu(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-o.scrollLeft+ed(t),c=-o.scrollTop;return"rtl"===nd(r||n).direction&&(s+=Uu(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:s,y:c}}(td(t)))}function zd(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Ud(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}function Vd(t,e){void 0===e&&(e={});var n=e,o=n.placement,r=void 0===o?t.placement:o,i=n.strategy,a=void 0===i?t.strategy:i,s=n.boundary,c=void 0===s?"clippingParents":s,l=n.rootBoundary,u=void 0===l?wd:l,d=n.elementContext,f=void 0===d?xd:d,h=n.altBoundary,p=void 0!==h&&h,m=n.padding,g=void 0===m?0:m,y=zd("number"!=typeof g?g:Ud(g,yd)),v=f===xd?"reference":xd,b=t.rects.popper,w=t.elements[p?v:f],x=function(t,e,n,o){var r="clippingParents"===e?function(t){var e=cd(ad(t)),n=["absolute","fixed"].indexOf(nd(t).position)>=0&&qu(t)?dd(t):t;return ju(n)?e.filter((function(t){return ju(t)&&Wd(t,n)&&"body"!==Zu(t)})):[]}(t):[].concat(e),i=[].concat(r,[n]),a=i[0],s=i.reduce((function(e,n){var r=qd(t,n,o);return e.top=Uu(r.top,e.top),e.right=Vu(r.right,e.right),e.bottom=Vu(r.bottom,e.bottom),e.left=Uu(r.left,e.left),e}),qd(t,a,o));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}(ju(w)?w:w.contextElement||td(t.elements.popper),c,u,a),_=Qu(t.elements.reference),A=Nd({reference:_,element:b,strategy:"absolute",placement:r}),C=jd(Object.assign({},b,A)),S=f===xd?C:_,L={top:x.top-S.top+y.top,bottom:S.bottom-x.bottom+y.bottom,left:x.left-S.left+y.left,right:S.right-x.right+y.right},T=t.modifiersData.offset;if(f===xd&&T){var k=T[r];Object.keys(L).forEach((function(t){var e=[pd,hd].indexOf(t)>=0?1:-1,n=[fd,hd].indexOf(t)>=0?"y":"x";L[t]+=k[n]*e}))}return L}const Yd={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=void 0===h||h,m=n.allowedAutoPlacements,g=e.options.placement,y=Ed(g),v=c||(y!==g&&p?function(t){if(Ed(t)===gd)return[];var e=Rd(t);return[Gd(t),e,Gd(e)]}(g):[Rd(g)]),b=[g].concat(v).reduce((function(t,n){return t.concat(Ed(n)===gd?function(t,e){void 0===e&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=void 0===c?Ad:c,u=Pd(o),d=u?s?_d:_d.filter((function(t){return Pd(t)===u})):yd,f=d.filter((function(t){return l.indexOf(t)>=0}));0===f.length&&(f=d);var h=f.reduce((function(e,n){return e[n]=Vd(t,{placement:n,boundary:r,rootBoundary:i,padding:a})[Ed(n)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}(e,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:p,allowedAutoPlacements:m}):n)}),[]),w=e.rects.reference,x=e.rects.popper,_=new Map,A=!0,C=b[0],S=0;S=0,E=M?"width":"height",P=Vd(e,{placement:L,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),D=M?k?pd:md:k?hd:fd;w[E]>x[E]&&(D=Rd(D));var N=Rd(D),F=[];if(i&&F.push(P[T]<=0),s&&F.push(P[D]<=0,P[N]<=0),F.every((function(t){return t}))){C=L,A=!1;break}_.set(L,F)}if(A)for(var B=function(t){var e=b.find((function(e){var n=_.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return C=e,"break"},I=p?3:1;I>0&&"break"!==B(I);I--);e.placement!==C&&(e.modifiersData[o]._skip=!0,e.placement=C,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Xd(t,e,n){return Uu(t,Vu(e,n))}const Kd={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0!==a&&a,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=void 0===f||f,p=n.tetherOffset,m=void 0===p?0:p,g=Vd(e,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),y=Ed(e.placement),v=Pd(e.placement),b=!v,w=Dd(y),x="x"===w?"y":"x",_=e.modifiersData.popperOffsets,A=e.rects.reference,C=e.rects.popper,S="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,L="number"==typeof S?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(_){if(i){var M,E="y"===w?fd:md,P="y"===w?hd:pd,D="y"===w?"height":"width",N=_[w],F=N+g[E],B=N-g[P],I=h?-C[D]/2:0,$=v===vd?A[D]:C[D],O=v===vd?-C[D]:-A[D],R=e.elements.arrow,H=h&&R?id(R):{width:0,height:0},G=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},W=G[E],j=G[P],q=Xd(0,A[D],H[D]),z=b?A[D]/2-I-q-W-L.mainAxis:$-q-W-L.mainAxis,U=b?-A[D]/2+I+q+j+L.mainAxis:O+q+j+L.mainAxis,V=e.elements.arrow&&dd(e.elements.arrow),Y=V?"y"===w?V.clientTop||0:V.clientLeft||0:0,X=null!=(M=null==T?void 0:T[w])?M:0,K=N+U-X,Q=Xd(h?Vu(F,N+z-X-Y):F,N,h?Uu(B,K):B);_[w]=Q,k[w]=Q-N}if(s){var J,Z="x"===w?fd:md,tt="x"===w?hd:pd,et=_[x],nt="y"===x?"height":"width",ot=et+g[Z],rt=et-g[tt],it=-1!==[fd,md].indexOf(y),at=null!=(J=null==T?void 0:T[x])?J:0,st=it?ot:et-A[nt]-C[nt]-at+L.altAxis,ct=it?et+A[nt]+C[nt]-at-L.altAxis:rt,lt=h&&it?function(t,e,n){var o=Xd(t,e,n);return o>n?n:o}(st,et,ct):Xd(h?st:ot,et,h?ct:rt);_[x]=lt,k[x]=lt-et}e.modifiersData[o]=k}},requiresIfExists:["offset"]},Qd={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=Ed(n.placement),c=Dd(s),l=[md,pd].indexOf(s)>=0?"height":"width";if(i&&a){var u=function(t,e){return zd("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Ud(t,yd))}(r.padding,n),d=id(i),f="y"===c?fd:md,h="y"===c?hd:pd,p=n.rects.reference[l]+n.rects.reference[c]-a[c]-n.rects.popper[l],m=a[c]-n.rects.reference[c],g=dd(i),y=g?"y"===c?g.clientHeight||0:g.clientWidth||0:0,v=p/2-m/2,b=u[f],w=y-d[l]-u[h],x=y/2-d[l]/2+v,_=Xd(b,x,w),A=c;n.modifiersData[o]=((e={})[A]=_,e.centerOffset=_-x,e)}},effect:function(t){var e=t.state,n=t.options.element,o=void 0===n?"[data-popper-arrow]":n;null!=o&&("string"!=typeof o||(o=e.elements.popper.querySelector(o)))&&Wd(e.elements.popper,o)&&(e.elements.arrow=o)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Jd(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Zd(t){return[fd,pd,hd,md].some((function(e){return t[e]>=0}))}var tf=kd({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=void 0===r||r,a=o.resize,s=void 0===a||a,c=Wu(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&l.forEach((function(t){t.addEventListener("scroll",n.update,Md)})),s&&c.addEventListener("resize",n.update,Md),function(){i&&l.forEach((function(t){t.removeEventListener("scroll",n.update,Md)})),s&&c.removeEventListener("resize",n.update,Md)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=Nd({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=void 0===o||o,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,c=void 0===s||s,l={placement:Ed(e.placement),variation:Pd(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Bd(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:c})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Bd(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Id,$d,Yd,Kd,Qd,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,a=Vd(e,{elementContext:"reference"}),s=Vd(e,{altBoundary:!0}),c=Jd(a,o),l=Jd(s,r,i),u=Zd(c),d=Zd(l);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),ef="tippy-content",nf="tippy-backdrop",of="tippy-arrow",rf="tippy-svg-arrow",af={passive:!0,capture:!0},sf=function(){return document.body};function cf(t,e,n){if(Array.isArray(t)){var o=t[e];return null==o?Array.isArray(n)?n[e]:n:o}return t}function lf(t,e){var n={}.toString.call(t);return 0===n.indexOf("[object")&&n.indexOf(e+"]")>-1}function uf(t,e){return"function"==typeof t?t.apply(void 0,e):t}function df(t,e){return 0===e?t:function(o){clearTimeout(n),n=setTimeout((function(){t(o)}),e)};var n}function ff(t){return[].concat(t)}function hf(t,e){-1===t.indexOf(e)&&t.push(e)}function pf(t){return[].slice.call(t)}function mf(t){return Object.keys(t).reduce((function(e,n){return void 0!==t[n]&&(e[n]=t[n]),e}),{})}function gf(){return document.createElement("div")}function yf(t){return["Element","Fragment"].some((function(e){return lf(t,e)}))}function vf(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function bf(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function wf(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[o](e,n)}))}function xf(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=null==n.getRootNode||null==(o=n.getRootNode())?void 0:o.host}return!1}var _f={isTouch:!1},Af=0;function Cf(){_f.isTouch||(_f.isTouch=!0,window.performance&&document.addEventListener("mousemove",Sf))}function Sf(){var t=performance.now();t-Af<20&&(_f.isTouch=!1,document.removeEventListener("mousemove",Sf)),Af=t}function Lf(){var t=document.activeElement;if(function(t){return!(!t||!t._tippy||t._tippy.reference!==t)}(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}var Tf=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),kf=Object.assign({appendTo:sf,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Mf=Object.keys(kf);function Ef(t){var e=(t.plugins||[]).reduce((function(e,n){var o,r=n.name,i=n.defaultValue;return r&&(e[r]=void 0!==t[r]?t[r]:null!=(o=kf[r])?o:i),e}),{});return Object.assign({},t,e)}function Pf(t,e){var n=Object.assign({},e,{content:uf(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(Ef(Object.assign({},kf,{plugins:e}))):Mf).reduce((function(e,n){var o=(t.getAttribute("data-tippy-"+n)||"").trim();if(!o)return e;if("content"===n)e[n]=o;else try{e[n]=JSON.parse(o)}catch(t){e[n]=o}return e}),{})}(t,e.plugins));return n.aria=Object.assign({},kf.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?e.interactive:n.aria.expanded,content:"auto"===n.aria.content?e.interactive?null:"describedby":n.aria.content},n}var Df=function(){return"innerHTML"};function Nf(t,e){t[Df()]=e}function Ff(t){var e=gf();return!0===t?e.className=of:(e.className=rf,yf(t)?e.appendChild(t):Nf(e,t)),e}function Bf(t,e){yf(e.content)?(Nf(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?Nf(t,e.content):t.textContent=e.content)}function If(t){var e=t.firstElementChild,n=pf(e.children);return{box:e,content:n.find((function(t){return t.classList.contains(ef)})),arrow:n.find((function(t){return t.classList.contains(of)||t.classList.contains(rf)})),backdrop:n.find((function(t){return t.classList.contains(nf)}))}}function $f(t){var e=gf(),n=gf();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=gf();function r(n,o){var r=If(e),i=r.box,a=r.content,s=r.arrow;o.theme?i.setAttribute("data-theme",o.theme):i.removeAttribute("data-theme"),"string"==typeof o.animation?i.setAttribute("data-animation",o.animation):i.removeAttribute("data-animation"),o.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof o.maxWidth?o.maxWidth+"px":o.maxWidth,o.role?i.setAttribute("role",o.role):i.removeAttribute("role"),n.content===o.content&&n.allowHTML===o.allowHTML||Bf(a,t.props),o.arrow?s?n.arrow!==o.arrow&&(i.removeChild(s),i.appendChild(Ff(o.arrow))):i.appendChild(Ff(o.arrow)):s&&i.removeChild(s)}return o.className=ef,o.setAttribute("data-state","hidden"),Bf(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props),{popper:e,onUpdate:r}}$f.$$tippy=!0;var Of=1,Rf=[],Hf=[];function Gf(t,e){var n,o,r,i,a,s,c,l,u=Pf(t,Object.assign({},kf,Ef(mf(e)))),d=!1,f=!1,h=!1,p=!1,m=[],g=df(V,u.interactiveDebounce),y=Of++,v=(l=u.plugins).filter((function(t,e){return l.indexOf(t)===e})),b={id:y,reference:t,popper:gf(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(n),clearTimeout(o),cancelAnimationFrame(r)},setProps:function(e){if(!b.state.isDestroyed){N("onBeforeUpdate",[b,e]),z();var n=b.props,o=Pf(t,Object.assign({},n,mf(e),{ignoreAttributes:!0}));b.props=o,q(),n.interactiveDebounce!==o.interactiveDebounce&&(I(),g=df(V,o.interactiveDebounce)),n.triggerTarget&&!o.triggerTarget?ff(n.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):o.triggerTarget&&t.removeAttribute("aria-expanded"),B(),D(),_&&_(n,o),b.popperInstance&&(Q(),Z().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)}))),N("onAfterUpdate",[b,e])}},setContent:function(t){b.setProps({content:t})},show:function(){var t=b.state.isVisible,e=b.state.isDestroyed,n=!b.state.isEnabled,o=_f.isTouch&&!b.props.touch,r=cf(b.props.duration,0,kf.duration);if(!(t||e||n||o||k().hasAttribute("disabled")||(N("onShow",[b],!1),!1===b.props.onShow(b)))){if(b.state.isVisible=!0,T()&&(x.style.visibility="visible"),D(),H(),b.state.isMounted||(x.style.transition="none"),T()){var i=E();vf([i.box,i.content],0)}var a,c,l;s=function(){var t;if(b.state.isVisible&&!p){if(p=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,T()&&b.props.animation){var e=E(),n=e.box,o=e.content;vf([n,o],r),bf([n,o],"visible")}F(),B(),hf(Hf,b),null==(t=b.popperInstance)||t.forceUpdate(),N("onMount",[b]),b.props.animation&&T()&&function(t,e){W(t,(function(){b.state.isShown=!0,N("onShown",[b])}))}(r)}},c=b.props.appendTo,l=k(),(a=b.props.interactive&&c===sf||"parent"===c?l.parentNode:uf(c,[l])).contains(x)||a.appendChild(x),b.state.isMounted=!0,Q()}},hide:function(){var t=!b.state.isVisible,e=b.state.isDestroyed,n=!b.state.isEnabled,o=cf(b.props.duration,1,kf.duration);if(!(t||e||n)&&(N("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,p=!1,d=!1,T()&&(x.style.visibility="hidden"),I(),G(),D(!0),T()){var r=E(),i=r.box,a=r.content;b.props.animation&&(vf([i,a],o),bf([i,a],"hidden"))}F(),B(),b.props.animation?T()&&function(t,e){W(t,(function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&e()}))}(o,b.unmount):b.unmount()}},hideWithInteractivity:function(t){M().addEventListener("mousemove",g),hf(Rf,g),g(t)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(J(),Z().forEach((function(t){t._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),Hf=Hf.filter((function(t){return t!==b})),b.state.isMounted=!1,N("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),z(),delete t._tippy,b.state.isDestroyed=!0,N("onDestroy",[b]))}};if(!u.render)return b;var w=u.render(b),x=w.popper,_=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,t._tippy=b,x._tippy=b;var A=v.map((function(t){return t.fn(b)})),C=t.hasAttribute("aria-expanded");return q(),B(),D(),N("onCreate",[b]),u.showOnCreate&&tt(),x.addEventListener("mouseenter",(function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&M().addEventListener("mousemove",g)})),b;function S(){var t=b.props.touch;return Array.isArray(t)?t:[t,0]}function L(){return"hold"===S()[0]}function T(){var t;return!(null==(t=b.props.render)||!t.$$tippy)}function k(){return c||t}function M(){var t,e,n=k().parentNode;return n?null!=(e=ff(n)[0])&&null!=(t=e.ownerDocument)&&t.body?e.ownerDocument:document:document}function E(){return If(x)}function P(t){return b.state.isMounted&&!b.state.isVisible||_f.isTouch||i&&"focus"===i.type?0:cf(b.props.delay,t?0:1,kf.delay)}function D(t){void 0===t&&(t=!1),x.style.pointerEvents=b.props.interactive&&!t?"":"none",x.style.zIndex=""+b.props.zIndex}function N(t,e,n){var o;void 0===n&&(n=!0),A.forEach((function(n){n[t]&&n[t].apply(n,e)})),n&&(o=b.props)[t].apply(o,e)}function F(){var e=b.props.aria;if(e.content){var n="aria-"+e.content,o=x.id;ff(b.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(n);if(b.state.isVisible)t.setAttribute(n,e?e+" "+o:o);else{var r=e&&e.replace(o,"").trim();r?t.setAttribute(n,r):t.removeAttribute(n)}}))}}function B(){!C&&b.props.aria.expanded&&ff(b.props.triggerTarget||t).forEach((function(t){b.props.interactive?t.setAttribute("aria-expanded",b.state.isVisible&&t===k()?"true":"false"):t.removeAttribute("aria-expanded")}))}function I(){M().removeEventListener("mousemove",g),Rf=Rf.filter((function(t){return t!==g}))}function $(e){if(!_f.isTouch||!h&&"mousedown"!==e.type){var n=e.composedPath&&e.composedPath()[0]||e.target;if(!b.props.interactive||!xf(x,n)){if(ff(b.props.triggerTarget||t).some((function(t){return xf(t,n)}))){if(_f.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else N("onClickOutside",[b,e]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),f=!0,setTimeout((function(){f=!1})),b.state.isMounted||G())}}}function O(){h=!0}function R(){h=!1}function H(){var t=M();t.addEventListener("mousedown",$,!0),t.addEventListener("touchend",$,af),t.addEventListener("touchstart",R,af),t.addEventListener("touchmove",O,af)}function G(){var t=M();t.removeEventListener("mousedown",$,!0),t.removeEventListener("touchend",$,af),t.removeEventListener("touchstart",R,af),t.removeEventListener("touchmove",O,af)}function W(t,e){var n=E().box;function o(t){t.target===n&&(wf(n,"remove",o),e())}if(0===t)return e();wf(n,"remove",a),wf(n,"add",o),a=o}function j(e,n,o){void 0===o&&(o=!1),ff(b.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,n,o),m.push({node:t,eventType:e,handler:n,options:o})}))}function q(){L()&&(j("touchstart",U,{passive:!0}),j("touchend",Y,{passive:!0})),function(t){return t.split(/\s+/).filter(Boolean)}(b.props.trigger).forEach((function(t){if("manual"!==t)switch(j(t,U),t){case"mouseenter":j("mouseleave",Y);break;case"focus":j(Tf?"focusout":"blur",X);break;case"focusin":j("focusout",X)}}))}function z(){m.forEach((function(t){var e=t.node,n=t.eventType,o=t.handler,r=t.options;e.removeEventListener(n,o,r)})),m=[]}function U(t){var e,n=!1;if(b.state.isEnabled&&!K(t)&&!f){var o="focus"===(null==(e=i)?void 0:e.type);i=t,c=t.currentTarget,B(),!b.state.isVisible&&function(t){return lf(t,"MouseEvent")}(t)&&Rf.forEach((function(e){return e(t)})),"click"===t.type&&(b.props.trigger.indexOf("mouseenter")<0||d)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:tt(t),"click"===t.type&&(d=!n),n&&!o&&et(t)}}function V(t){var e=t.target,n=k().contains(e)||x.contains(e);if("mousemove"!==t.type||!n){var o=Z().concat(x).map((function(t){var e,n=null==(e=t._tippy.popperInstance)?void 0:e.state;return n?{popperRect:t.getBoundingClientRect(),popperState:n,props:u}:null})).filter(Boolean);(function(t,e){var n=e.clientX,o=e.clientY;return t.every((function(t){var e=t.popperRect,r=t.popperState,i=t.props.interactiveBorder,a=r.placement.split("-")[0],s=r.modifiersData.offset;if(!s)return!0;var c="bottom"===a?s.top.y:0,l="top"===a?s.bottom.y:0,u="right"===a?s.left.x:0,d="left"===a?s.right.x:0,f=e.top-o+c>i,h=o-e.bottom-l>i,p=e.left-n+u>i,m=n-e.right-d>i;return f||h||p||m}))})(o,t)&&(I(),et(t))}}function Y(t){K(t)||b.props.trigger.indexOf("click")>=0&&d||(b.props.interactive?b.hideWithInteractivity(t):et(t))}function X(t){b.props.trigger.indexOf("focusin")<0&&t.target!==k()||b.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||et(t)}function K(t){return!!_f.isTouch&&L()!==t.type.indexOf("touch")>=0}function Q(){J();var e=b.props,n=e.popperOptions,o=e.placement,r=e.offset,i=e.getReferenceClientRect,a=e.moveTransition,c=T()?If(x).arrow:null,l=i?{getBoundingClientRect:i,contextElement:i.contextElement||k()}:t,u=[{name:"offset",options:{offset:r}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(T()){var n=E().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?n.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?n.setAttribute("data-"+t,""):n.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];T()&&c&&u.push({name:"arrow",options:{element:c,padding:3}}),u.push.apply(u,(null==n?void 0:n.modifiers)||[]),b.popperInstance=tf(l,x,Object.assign({},n,{placement:o,onFirstUpdate:s,modifiers:u}))}function J(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Z(){return pf(x.querySelectorAll("[data-tippy-root]"))}function tt(t){b.clearDelayTimeouts(),t&&N("onTrigger",[b,t]),H();var e=P(!0),o=S(),r=o[0],i=o[1];_f.isTouch&&"hold"===r&&i&&(e=i),e?n=setTimeout((function(){b.show()}),e):b.show()}function et(t){if(b.clearDelayTimeouts(),N("onUntrigger",[b,t]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&d)){var e=P(!1);e?o=setTimeout((function(){b.state.isVisible&&b.hide()}),e):r=requestAnimationFrame((function(){b.hide()}))}}else G()}}function Wf(t,e){void 0===e&&(e={});var n=kf.plugins.concat(e.plugins||[]);document.addEventListener("touchstart",Cf,af),window.addEventListener("blur",Lf);var o=Object.assign({},e,{plugins:n}),r=function(t){return yf(t)?[t]:function(t){return lf(t,"NodeList")}(t)?pf(t):Array.isArray(t)?t:pf(document.querySelectorAll(t))}(t).reduce((function(t,e){var n=e&&Gf(e,o);return n&&t.push(n),t}),[]);return yf(t)?r[0]:r}Wf.defaultProps=kf,Wf.setDefaultProps=function(t){Object.keys(t).forEach((function(e){kf[e]=t[e]}))},Wf.currentInput=_f,Object.assign({},Id,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),Wf.setDefaultProps({render:$f});const jf=Wf,qf='.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}';function zf(t){return Math.round(performance.now()-t)}function Uf(){const t=this.annotDescriptions.annots,e=Object.values(t).slice(),n=e.filter((t=>t.type&&t.type.includes("paralogous"))),o=e.filter((t=>t.type&&t.type.includes("interacting gene")));return{related:e,paralogous:n,interacting:o,searched:Object.entries(t).filter((t=>t[1].type&&t[1].type.includes("searched gene")))[0][0]}}function Vf(t){const e=this,n=performance.now()-e.time.prevTooltipOff,o=e.time.prevTooltipAnnotDomId;if(n<300&&t.domId===o)return null;const r=t.name,i=e.annotDescriptions.annots[t.name].type.split(" ")[0],a=Yf(e);return Object.assign({tooltipGene:r,tooltipRelatedType:i},a)}function Yf(t){const e=t.getRelatedGenesByType();return{numRelatedGenes:e.related.length,numParalogs:e.paralogous.length,numInteractingGenes:e.interacting.length,searchedGene:e.searched}}const Xf="#AAA",Kf="#555",Qf="#D8D8D8",Jf="#888",Zf="#888",th="#333",eh="#F55",nh="#A00",oh="#922D5E",rh="#D26D9E",ih="#CAA",ah="#866",sh="#E88",ch="#A55",lh="#FFC0CB",uh="#CF909B",dh="#99D",fh="#22C",hh="#CCF",ph="#33D",mh="#EEF",gh="#AAF",yh="#66B",vh="#116",bh="#7D7",wh="#393",xh="#3A3",_h="#060",Ah="#93E9BE",Ch="#53AC7E",Sh="#51087E",Lh="#8138AE",Th="#880ED4",kh="#5800A4",Mh="#B24BF3",Eh="#520B83",Ph="#D7A1F9",Dh="#A771C9",Nh="#EEDDFF",Fh="#A771C9",Bh="#964B00",Ih="#660B00",$h="#C87D32",Oh="#722810",Rh="#DACDBA",Hh="#A99A89",Gh="#FFA500",Wh="#DD8000",jh="#DD8300",qh="#883000",zh="#FFEA66",Uh="#FFB466",Vh="#EEBB00",Yh="#A99A89",Xh="#FF3",Kh="#AA0",Qh="#FFFBCC",Jh="#CCC89A",Zh="#BCB",tp="#9A9",ep="#DFD",np="#CDC";function op(t){return"_"===t[0][0]}const rp={_H:"Helical",_E:"Extracellular",_C:"Cytoplasmic"};function ip(t,e,n,o){let r=t[0];const i=t[3];let a=e.px.start+i.x,s=i.width;n||(a=e.px.length+e.px.start-(i.x+i.width));let c=30,l=14;const u=op(t),d=function(t){return"S"===t[0]}(t);let f="";if(o&&(c=38,u)){r=function(t){return t in rp?rp[t]:t.slice(1)}(t[0]),c=30,l=30;const o=`${t[0]} ${t[1]} ${t[2]}`;if((n&&i.x+i.width>e.px.length+3||!n&&i.x+i.width>e.px.length+3)&&(console.debug(`Truncate protein topology feature: ${o}`),s-=i.x+i.width-e.px.length,n||(a+=s)),f='data-topology="true"',s<0){const t="Width < 0, omit protein topology feature";return console.debug(`${t}: ${o}`),""}}const[h,p]="S"===(m=r)?["#FF2","#F99"]:"Extracellular"===m?[mh,gh]:"Cytoplasmic"===m?[Qh,Jh]:"Helical"===m||m.startsWith("Helical ---")?[Rh,Hh]:"Lumenal"===m?[zh,Uh]:"Lumenal, melanosome"===m?[Vh,Yh]:"Mitochondrial matrix"===m?[ep,np]:"Mitochondrial intermembrane"===m?[Zh,tp]:"Perinuclear space"===m?[Nh,Fh]:"Nuclear"===m?[Ph,Dh]:"Beta stranded"===m?[dh,fh]:m.includes("conserved site")||m.includes("conserved domain")||"WGR domain"===m||"R3H domain"===m||m.includes("QLQ")||"Sema domain"===m||"Proteasome component (PCI) domain"===m||"Sterol-sensing domain"===m||"Erythropoietin/thrombopoietin"===m||"SPRY domain"===m||"Anaphylatoxin/fibulin"===m||"Tetratricopeptide repeat"===m||"Doublecortin domain"===m||m.includes("Glycosyl transferase")||m.toLowerCase().includes("lethal")&&m.toLowerCase().includes("c-terminal")||m.includes("PUB")||m.includes("Myogenic determination")||"Globin"===m||"GPS motif"===m||m.includes("D-like")||m.toLowerCase().includes("insertion domain")||"Macro domain"===m?[oh,rh]:m.includes("active site")||m.includes("hydroxylation site")||m.includes("catalytic domain")||m.includes("Lipid transport")||"BRCA1, serine-rich domain"===m||"Tower domain"===m||m.endsWith("attachment site")||m.endsWith("amyloid-beta peptide")||"Reverse transcriptase domain"===m||"Membrane attack complex component/perforin (MACPF) domain"===m||"Alpha-2-macroglobulin"===m||"Kinesin motor domain"===m||"Adenomatous polyposis coli tumour suppressor protein"===m||m.includes("endostatin")?[eh,nh]:"Cyclin, C-terminal domain"===m||m.includes("OB C-terminal domain")||"Cationic amino acid transporter, C-terminal"===m||"High mobility group box domain"===m||"HMG-box domain"===m||m.includes("CUB domain")||"C-5 cytosine methyltransferase"===m||m.includes("(G-protein), alpha subunit")||"SCAN domain"===m||"Apolipoprotein A/E"===m||m.includes("Clusterin")||m.includes("SMAD domain")||"PLAC"===m||m.endsWith("tripeptidyl peptidase II")||"Prohormone convertase enzyme"===m||m.includes("rod domain")||"Osteopontin"===m||"SPRY-associated"===m||"C1q domain"===m||"OAR domain"===m||m.includes("FTO, C-terminal")||m.includes("ATPase, C-terminal")||m.includes("Hint domain")||"Laminin IV"===m||"NACHT-associated domain"===m||m.includes("FANCD2")||m.startsWith("Acyl-CoA")&&m.endsWith("C-terminal")||"Kinesin-like"===m||"GUCT"===m||m.includes("(APC) repeat")||m.includes("IP3R")?[ih,ah]:m.includes("trypsin domain")||m.includes("scaffold dimerization")||m.includes("eIF-4 gamma, MA3")||"Troponin"===m||"SKI/SNO/DAC domain"===m||m.toLowerCase().includes("large ribosom")||m.includes("KA1")||"V(D)J recombination-activating protein 1"===m||m.toLowerCase().includes("opiod")||"Corticotropin-releasing factor"===m||m.includes("2Fe-2S ferredoxin")||m.includes("acidic domain")?[sh,ch]:"EGF-like calcium-binding domain"===m||m.includes("PTX/LNS")||"HSR domain"===m||m.includes("MutS, clamp")||m.includes("S5 domain 2-like")||m.endsWith("CC1/2")||m.includes("MUN")||m.includes("second molybdopterin")?[xh,_h]:m.includes("binding site")||"EF-hand domain"===m||m.includes("EF hand-like")||"Zinc finger, nuclear hormone receptor-type"===m||m.includes("Serpin domain")||"Peptidase C14, p20 domain"===m||"PWWP domain"===m||"Peptidoglycan binding-like"===m||"MAD homology 1, Dwarfin-type"===m||"F-actin binding"===m||m.includes("Glycoside hydrolase")&&m.endsWith("domain")||"p53 tumour suppressor family"===m||"Menin"===m||m.includes("von Hippel")&&m.includes("beta")||"Pointed domain"===m||m.includes("DNA binding")||"Helix-hairpin-helix domain"===m||"Helix-hairpin-helix motif"===m||"MIR motif"===m||"Rad52 family"===m||"Oxidoreductase FAD/NAD(P)-binding"===m||m.endsWith("NAD-binding")||m.endsWith("NAD binding")||m.includes("Bromo adjacent")||"HARP domain"===m||"FATC domain"===m||m.startsWith("XRN2-binding")||"SRCR-like domain"===m||m.includes("SRCR")||"Gamma-carboxyglutamic acid-rich (GLA) domain"===m||"Pterin-binding domain"===m||"Receptor, ligand binding region"===m||m.includes("DHEX domain")||"SANT/Myb domain"===m||m.includes("Forkhead-associated")||"Rap/Ran-GAP domain"===m||m.endsWith("C2 domain")||m.includes("tri-helix bundle domain")||m.includes("Cx50")||m.includes("tyrosine-rich")||"Filaggrin"===m?[dh,fh]:m.includes("dehydrogenase, molybdopterin binding")||"Zinc finger CCHC HIVEP-type"===m||"Cyclin, N-terminal"===m||"MAD homology, MH1"===m||"Sodium ion transport-associated"===m||"Sodium ion transport-associated domain"===m||m.endsWith("head")||m.includes("Pleckstrin homology domain")||"PH domain"===m||m.endsWith("pleckstrin homology-like domain")||"DEP domain"===m||"Post-SET domain"===m||m.includes("Glycoside hydrolase")||"Pyridoxal phosphate-dependent decarboxylase"===m||m.includes("OB1")||m.includes("OB3")||m.includes("OB domain")||"Fork head domain"===m||"Histone deacetylase domain"===m||m.includes("MG1")||"Homocysteine-binding domain"===m||m.startsWith("Acyl-CoA")&&m.endsWith("N-terminal")||"Clathrin light chain"===m||"Hexokinase, N-terminal"===m?[hh,ph]:m.includes("zinc-binding")||m.includes("DNA-binding")||"RUNT domain"===m||"G protein-coupled receptor, rhodopsin-like"===m||m.includes("CXC domain")||m.includes("Homeobox domain")||m.includes("BRCT domain")||m.includes("EF-hand")||"Laminin G domain"===m||"Peptidase C14, caspase non-catalytic subunit p10"===m||"ADD domain"===m||"PDZ domain"===m||"Krueppel-associated box"===m||"Ets domain"===m||"P domain"===m||m.includes("bHLH")||"Ras-associating (RA) domain"===m||"Ras-associating domain"===m||"Calcium/calmodulin-dependent protein kinase II, association-domain"===m||"Bromodomain"===m||"Bromodomain associated domain"===m||"SLIDE domain"===m||"Peptidase M24"===m||"Pentraxin-related"===m||m.includes("Notch ligand")||"Anti-proliferative protein"===m||m.includes("transpeptidase")||"Tuberin-type domain"===m||"Ras-like guanine nucleotide exchange factor, N-terminal"===m||m.includes("factor-binding protein")||m.includes("GPD")||"ELM2 domain"===m?[yh,vh]:"SH2 domain"===m||m.includes("SH2-like domain")||m.includes("Furin-like")||m.includes("heparin-binding")||"SRCR domain"===m||"EGF-like domain"===m||"Basic leucine zipper domain, Maf-type"===m||m.startsWith("Leucine zipper")||m.includes("Interleukin")&&m.includes("propeptide")||"Sirtuin family"===m||"Amino acid/polyamine transporter I"===m||"Peptidase M10, metallopeptidase"===m||"Metallothionein"===m||"DDHD domain"===m||"Zinc finger C2H2-type"===m||"Zinc finger, PARP-type"===m||m.endsWith("tail domain")||"SET domain"===m||"Hamartin"===m||m.includes("von Hippel")&&m.includes("alpha")||m.includes("transactivation domain 2")||"Phosphopantetheine binding ACP domain"===m||"Multicopper oxidase, second cupredoxin domain"===m||"Helicase, C-terminal"===m||m.includes("Carboxylesterase")||m.includes("presequence")||m.endsWith("CC3")?[bh,wh]:"Insulin-like"===m||"Fibroblast growth factor family"===m||"Nerve growth factor-related"===m||"Transforming growth factor-beta, C-terminal"===m||"Telomere-length maintenance and DNA damage repair"===m||"PDGF/VEGF domain"===m||m.includes("SH3-RhoGEF")||m.includes("MG4")||m.includes("RING domain")||m.includes("RING-type")||m.startsWith("DEAD/DEAH")||"Laminin alpha, domain I"===m||m.toLowerCase().includes("nuclear/hormone receptor")||"P-type trefoil domain"===m||m.includes("KHDRBS")?[xh,_h]:"SH3 domain"===m||"Variant SH3 domain"===m||m.endsWith("SH3 domain")||m.includes("copper-binding")||"Sushi/SCR/CCP domain"===m||m.includes("Coagulation factor 5/8")||"Basic-leucine zipper domain"===m||"Basic region leucine zipper"===m||"Sirtuin family, catalytic core domain"===m||"Amine oxidase"===m||m.includes("peroxidase")||m.includes("lid domain")||m.includes("prodomain")||"Pre-SET domain"===m||m.includes("transactivation domain")||m.includes(" activation domain")||m.includes("activating region")||"Thioesterase"===m||m.toLowerCase().includes("thiored")||m.includes("esterase")||m.endsWith("Claudin superfamily")||"Retinoblastoma-associated protein, A-box"===m||m.includes("Between PH and SH2")||m.includes("inter-SH2")||"Chromogranin A/B/C"===m||m.toLowerCase().includes("helicase")||m.endsWith("pro-domain")||"Brix domain"===m||"Coagulation Factor Xa inhibitory site"===m||"Trypsin Inhibitor-like, cysteine rich domain"===m||"WIF domain"===m||m.toLowerCase().includes("cystatin")||"EGF domain"===m||"Axin beta-catenin binding"===m||"Peptidase M2, peptidyl-dipeptidase A"===m||m.endsWith("phosphatase domain")||"PIGA, GPI anchor biosynthesis"===m||m.startsWith("Acyl-CoA")&&m.endsWith("middle domain")||m.includes("(COR)")||"K Homology domain, type 2"===m||m.includes("Phox")||m.includes("PB1")||m.includes("multifunctional domain")||m.includes("MutS, core")||"RAP domain"===m||m.endsWith("CC5")||m.includes("first molybdopterin")?[Ah,Ch]:"Immunoglobulin-like domain"===m||m.toLowerCase().endsWith("immunoglobulin-like domain")||m.endsWith("Ig domain")||m.endsWith("Ig-like domain")||"Major facilitator superfamily domain"===m||m.includes("interface")||"Class I myosin tail homology domain"===m||"Myosin tail"===m||"Acyl transferase"===m||m.endsWith("transferase")||m.startsWith("Acyl-CoA")||"JAK, FERM F2 lobe domain"===m||"Sodium/solute symporter"===m||m.includes("foci domain")||m.includes("Receptor L-domain")||"Wnt"===m||"R-spondin, Fu-CRD domain"===m||m.endsWith("merisation domain")||m.endsWith("merization domain")||m.endsWith("merisation motif")||m.endsWith("merization motif")||m.endsWith("BTB/POZ domain")||m.includes("CBS domain")||"DZF domain"===m||"GS domain"===m||m.includes("kinase domain")||m.includes("FAT")||m.startsWith("von Willebrand factor, type A")||m.includes("VWA")||"Reeler domain"===m||"BMP/retinoic acid-inducible neural-specific protein"===m||"Low-density lipoprotein (LDL) receptor class A repeat"===m||"TILa domain"===m||m.includes("chromosome condensation")||"Immunoglobulin I-set"===m||"Kinesin-associated"===m||"SMCs flexible hinge"===m||m.includes("Cys-His rich domain")?[lh,uh]:"Immunoglobulin"===m||"Immunoglobulin domain"===m||"CD20-like family"===m||"Calponin homology domain"===m||m.endsWith("Calponin-homology domain")||m.includes("ATPase")||m.includes("ATP coupling domain")||m.includes("globular domain")||"Mitochondrial substrate/solute carrier"===m||"Major facilitator, sugar transporter-like"===m||"Major facilitator, sugar transporter-like"===m||"Sodium:neurotransmitter symporter"===m||m.toLowerCase().includes("methyltransferase")||"Rhodanese-like domain"===m||m.startsWith("Thyroglobulin")||"Retinoblastoma-associated protein, B-box"===m||"C-type lectin-like"===m||"Galectin, carbohydrate recognition domain"===m||"VWFC domain"===m||m.includes("CFC domain")||"POLO box domain"===m||m.endsWith("domain 1")||m.endsWith("domain II")||"Fibronectin, type I"===m||"Cadherin-like"===m||"G-protein gamma-like domain"===m||"GoLoco motif"===m||"MyTH4 domain"===m||m.endsWith("isomerase")||"BTB/Kelch-associated"===m||"Stathmin family"===m?[Ph,Dh]:"Immunoglobulin C1-set"===m||m.includes("GTPase")||"RGS domain"===m||"Major facilitator superfamily"===m||"Fibronectin type II domain"===m||m.includes("ectodomain")||m.endsWith("receptor domain")||m.endsWith("receptor domain 4")||"MAM domain"===m||"IPT domain"===m||m.endsWith("extracellular")||"Link domain"===m||m.includes("connector domain")||"WW domain"===m||"WHIM1 domain"===m||"TNFR/NGFR cysteine-rich region"===m||"Frizzled domain"===m||"Netrin module, non-TIMP type"===m||"CFTR regulator domain"===m||m.endsWith("domain 2")||"GNAT domain"===m||"NIDO domain"===m||"Myosin head, motor domain"===m||"von Willebrand domain, type D domain"===m||"Kinesin-like KIF1-type"===m||m.includes("Paxillin")||"Clathrin, heavy chain/VPS, 7-fold repeat"===m||"Collagen IV, non-collagenous"===m?[Mh,Eh]:"Fibronectin type III"===m||"Tissue factor"===m||"Immunoglobulin C2-set"===m||m.includes("immunoglobulin C2-set")||m.includes("protein interaction")||"SWIRM domain"===m||m.includes("(DSL) protein")||"Dishevelled protein domain"===m||m.endsWith("domain 3")||"DnaJ domain"===m||m.toLowerCase().includes("nuclear receptor")||"Gonadal family"===m?[Th,kh]:"Immunoglobulin V-set domain"===m||m.includes("V-set domain")||m.includes("V-like")||"Frizzled/Smoothened, 7TM"===m||m.endsWith("domain 4")||"Integrin alpha-2"===m||"Calcium-activated potassium channel BK, alpha subunit"===m||m.includes("Dbl homology (DH) domain")||m.includes("Glycine rich")||m.toLowerCase().includes("exonuclease")||"WHIM2 domain"===m||m.includes("Coactivator CBP")||m.includes("cryptic polo")?[Sh,Lh]:"Desmoplakin, spectrin-like domain"===m||"Spectrin repeat"===m||m.endsWith("TED domain")||"Polyadenylate-binding protein/Hyperplastic disc protein"===m||m.includes(" cap domain")||m.toLowerCase().includes("agenet")||m.includes("TATA")||m.includes("Citron")||"RIH domain"===m||m.toLowerCase().includes("sclerostin")||"ZU5 domain"===m||"Piezo domain"===m||"Histone H2A/H2B/H3"===m?[Xh,Kh]:"Armadillo"===m||m.includes("Apple domain")||"Protocadherin"===m||"DIX domain"===m||"Ferritin-like diiron domain"===m||"4Fe-4S dicluster domain"===m||"Transferrin-like domain"===m||"PAS domain"===m||"PAS fold"===m||"Polyketide synthase, dehydratase domain"===m||"Flavodoxin/nitric oxide synthase"===m||"Flavodoxin-like fold"===m||"G-patch domain"===m||"Chromo domain"===m||m.toLowerCase().includes("tudor")||"Cytochrome P450"===m||"Potassium channel domain"===m||"G2 nidogen/fibulin G2F"===m||m.includes("bait region")||"WWE domain"===m||m.endsWith("deiodinase")||"Cobalamin (vitamin B12)-binding domain"===m||"Laminin domain II"===m||"Troponin I residues 1-32"===m||"KI67R"===m||m.includes("FAD-binding")?[Gh,Wh]:m.includes("Kringle")||m.includes("Peptidase M12A")||"TGF-beta, propeptide"===m||m.includes("autopeptidase")||m.includes("GAIN")||"PIK-related kinase"===m||m.includes("(PIK) domain")||"LDLR class B repeat"===m||"Actin family"===m||"Ferritin/DPS protein domain"===m||"PAS fold-3"===m||"Polyketide synthase, ketoreductase domain"===m||m.startsWith("Heat shock protein")&&m.endsWith("family")||"BAG domain"===m||"MCM domain"===m||m.endsWith("reductase-like")||"Lipase"===m||"Phospholipase A2 domain"===m||"Notch domain"===m||m.includes("LCCL domain")||m.includes("SANT-like")||"VWF/SSPO/Zonadhesin-like, cysteine-rich domain"===m||"Kappa casein"===m||"Casein, alpha/beta"===m||"Natriuretic peptide"===m||"EMI domain"===m||"Neurohypophysial hormone"===m||"Synuclein"===m||m.includes("Hydroxymethylglutaryl-CoA reductase")||m.includes("Perilipin")||m.includes("lipase")||m.includes("CRAL")||m.includes("SAND")||m.toLowerCase().includes("hsp")||m.toLowerCase().includes("bombesin")?[Rh,Hh]:"Notch, NOD domain"===m||"Cadherin, Y-type LIR-motif"===m||"Protein patched/dispatched"===m||m.includes("membrane-proximal")||"LicD family"===m||m.includes("MoaB/Mog")?[$h,Oh]:m.includes("transmembrane domain")||m.includes("trans-membrane domain")||m.includes("Transmembrane protein")||m.includes("7TM")||"Major intrinsic protein"===m||m.includes("Triadin")||m.includes("Collectrin")||m.includes("membrane glycoprotein")||"SEA domain"===m||"CD36 family"===m||m.includes("CD34")||"Hypoxia-inducible factor, alpha subunit"===m||"Hypoxia-inducible factor, alpha subunit-like"===m||"PKD domain"===m||m.includes("regulatory domain")||m.endsWith("E2 domain")||"PLAT/LH2 domain"===m||"Notch, NODP domain"===m||"Syndecan/Neurexin domain"===m||"Zona pellucida domain"===m||m.includes("Ion transport domain")||m.endsWith("Membrane transport protein MMPL domain")||m.includes("Caveolin")||"Band 7 domain"===m||m.includes("Shisa")||"ABC-2 family transporter protein"===m||"Anoctamin"===m||"Sodium-dependent phosphate transport protein"===m||m.includes("MHC II-interacting")?[Bh,Ih]:"DAPIN domain"===m||"Death effector domain"===m||"Death domain"===m||m.includes("death protein")||m.toLowerCase().includes("lethal")||m.includes("UBA domain")||m.includes("HECT domain")||m.toLowerCase().includes("ubiquitin")||m.includes("necrosis")||m.toLowerCase().includes("death")||m.includes("Bcl-2")||m.includes("CIDE-N")||"Disintegrin domain"===m||m.includes("TRAF")||m.includes("TIR")||m.toLowerCase().includes("caspase")||"Pellino family"===m?[Zf,th]:m.includes("unknown function")||m.toLowerCase().includes("unstructured")||m.startsWith("Uncharacterised")?[Xf,Kf]:m.toLowerCase().includes("leucine rich repeat")||m.includes("HIN")||m.includes("calcium")||m.toLowerCase().includes("calreticulin")||m.includes("cytokine receptor")||m.includes("pore forming")||m.includes("RHIM")||m.includes("SWIB")||"Ryanodine receptor Ryr"===m||m.includes("Armadillo")||"UME domain"===m||m.includes("WD40 domain")||"WSTF/Acf1/Cbp146"===m||"BCL7"===m||m.endsWith("repeat ring region")||m.includes("PANDER")||"GPCR, rhodopsin-like, 7TM"===m||"GPCR, family 2, secretin-like"===m||"GPCR, family 3, nine cysteines domain"===m||"G-protein coupled receptor"===m||m.toLowerCase().includes("orexin")||"[2Fe-2S]-binding"===m?[jh,qh]:m.includes("repeat")||"Vitellinogen, open beta-sheet"===m||m.includes("Interleukin")&&m.includes("family")||/Interleukin-\d+$/.test(m)||"Chemokine interleukin-8-like domain"===m||m.includes("beta-ribbon")||m.includes("cytoplasmic domain")||m.toLowerCase().includes("interleukin")||"Citrate transporter-like domain"===m||m.toLowerCase().includes("calsequestrin")?[Gh,Wh]:m.includes("inhibit")||m.includes("central")||m.endsWith("tail")||m.endsWith("helical domain")||m.endsWith("helical domain HD2")||m.endsWith("coiled-coil domain")||m.endsWith("coiled-coil region")||m.includes("zinc ribbon fold")||m.includes("zinc-ribbon")||m.toLowerCase().includes("anhydrase")||"Macroglobulin domain"===m||m.includes("KH0")||m.includes("EGF")||m.toLowerCase().includes("olfact")||m.toLowerCase().includes("mucin")?[Ah,Ch]:m.includes("Peptidase")||m.includes("Ras-binding")||m.includes("CRIB domain")?[dh,fh]:m.toLowerCase().includes("zinc finger")||m.toLowerCase().includes("zinc-finger")||m.includes("RING finger")||m.toLowerCase().includes("transcription factor")||"Paired domain"===m||"JmjC domain"===m||"BRK domain"===m||m.includes("MG3")||m.toLowerCase().includes("polycomb")||m.toLowerCase().includes("metallopeptidase")||m.toLowerCase().includes("metallo-peptidase")||m.toLowerCase().includes("metalloenzyme")||"K Homology domain, type 1"===m||m.includes("winged helix")||m.toLowerCase().includes("dehydrogenase")||m.includes("BAR")||m.includes("metal")||m.includes("redoxin")?[bh,wh]:m.startsWith("Tyrosine-protein kinase receptor")||"PTB/PI domain"===m||m.endsWith("receptor")||m.includes("cysteine rich")||m.includes("cysteine-rich")||"AWS domain"===m||m.toLowerCase().includes("somatomedin b")||m.includes("MHC class II")&&!m.includes("C-terminal")?[Mh,Eh]:m.toLowerCase().includes("golgi")||"GOLD domain"===m||m.includes("deaminase")||m.includes("C-terminal core")||m.includes("nucleoside triphosphatase")||m.includes("globin")||m.includes("IspD/TarI")||"Telethonin"===m||m.includes("Sarcoglycan")||m.includes("toxin")||m.includes("ShKT")||m.includes("SAM")||m.includes("Sterile alpha motif")||m.includes("Unconventional myosin-X")||"CARD domain"===m||m.includes("endonuclease")||m.toLowerCase().includes("splicing factor")||m.toLowerCase().includes("interferon")||"Tropomyosin"===m||m.includes("R1 domain")?[oh,rh]:m.includes("TM")||m.toLowerCase().includes("transmembrane")||m.toLowerCase().includes("trans-membrane")?[Bh,Ih]:m.includes("binding domain")||m.includes("binding protein")?[yh,vh]:m.includes("Ribosomal protein")||m.toLowerCase().includes("ribosomal subunit")||m.toLowerCase().includes("ribosom")||m.toLowerCase().includes("ribonuclease")?[xh,_h]:m.includes("lectin")||m.includes("recognition")||m.toLowerCase().includes("solute carrier")||m.includes("isomerase")||"Clathrin-H-link"===m?[Ph,Dh]:m.startsWith("von Willebrand factor")||m.endsWith("receptor-binding")||m.toLowerCase().includes("link")||m.includes("basic domain")||m.includes("interacting")||m.includes("domain IV")||m.toLowerCase().includes("immunoglobulin domain")?[Th,kh]:m.includes("transferase")||m.includes("merisation")?[lh,uh]:m.includes("oxygenase")?[eh,nh]:m.includes("phosphatase")||m.includes("RNA polymerase")||m.includes("catenin")?[Ah,Ch]:m.includes("bind")||m.includes("EF")?[dh,fh]:m.includes("C-termin")||m.includes("C termin")||m.includes("kinase")?[ih,ah]:m.includes("N-termin")||m.includes("N-teminal")||m.includes("N termin")||m.toLowerCase().includes("decarboxylase")||m.toLowerCase().includes("hydrolase")||m.includes("PH domain")||m.includes("cytosolic")||m.toLowerCase().includes("homeobox")?[hh,ph]:[Qf,Jf];var m;d&&(r="Signal peptide",l=8,c+=3),u&&("Helical"===r?r="Transmembrane":r.startsWith("Helical --- Name=")&&(r=r.replace("Helical --- Name=","Transmembrane: ")));const g=`${t[2]} aa`,y=`data-subpart="${r} ${sp} ${g}"`,v=`x="${a}" width="${s}" y="${c}" height="${l}"`,b=`class="subpart domain${u?" topology":""}" `,w=function(t,e,n,o,r,i=!1){const a=e+o,s=`stroke="${r}"`,c=t+n;let l="",u="";return i&&(l=``,u=``),``+l+u}(a,c,s,l,p,!u);return``+w}const ap=5,sp="|",cp="5'-UTR",lp="3'-UTR",up={"5'-UTR":20,exon:20,intron:20,"3'-UTR":20},dp={"5'-UTR":"#155069",exon:"#DAA521",intron:"#FFFFFF00","3'-UTR":"#357089"},fp={"5'-UTR":"#70A099",exon:"#BA8501","3'-UTR":"#90C0B9"},hp={"5'-UTR":"five-prime-utr",exon:"exon","3'-UTR":"three-prime-utr",intron:"intron"},pp=``,mp='Hover for details';function gp(){return document.querySelector("._ideoGeneStructureFooter")}function yp(t){const e=gp(),n=t.querySelector("svg").getAttribute("data-ideo-footer");e.innerHTML=` 
    ${n}`}function vp(t,e=0){const[n,o]=wp(t,e),r=0===o;document.querySelector("#_ideoGeneStructureMenu").options[o].selected=!0;const i=Wp(n,t,t.spliceExons)[0],a=document.querySelector("._ideoGeneStructureSvgContainer");a.innerHTML=i,$p(t.spliceExons,r),yp(a),t.addedSubpartListeners=!1,Pp(t),Np(t)}function bp(t){return t.split("-").slice(0,-1).join("-")}function wp(t,e=0){let n,o;const r=document.querySelector("#_ideoGeneStructureMenu");if(r){const t=r.options.length;n=r.selectedIndex+e,n>=t?n=0:n<0&&(n=t-1),o=r.options[n].value}else{const t=document.querySelector("._ideoGeneStructure");if(!t)return null;o=t.getAttribute("data-ideo-gene-structure-name"),n=0}const i=bp(o);return[t.geneStructureCache[i].find((t=>t.name===o)),n]}function xp(t){if("s"===t.key){const t=document.querySelector("._ideoSpliceToggle input");if(!t)return;const e=document.querySelector("#_ideoSubpartText");e&&(e.innerHTML=" "),t.dispatchEvent(new MouseEvent("click"))}}function _p(t,e){const n=t.slice(),o=e?lp:cp,r=t.some((t=>t[0]===o));return t.forEach(((o,i)=>{if(0===i)return;const a=t[i-1],s=a[0]===lp,c=a[0]===cp;"exon"===o[0]&&r&&(!e&&s||e&&c)&&o[1]!==a[1]+a[2]-1&&2!==a[2]&&(n[i]=a,n[i-1]=o)})),n}function Ap(t,e){return t.classList.contains(e)}function Cp(t,e,n,o){const r="five-prime-utr",i="three-prime-utr",a=Ap(e,r),s=Ap(e,i),c=!Ap(t,i),l=!Ap(t,r);return o&&(!n&&s&&c||n&&a&&l)}function Sp(t,e,n,o){const r=e[0]===cp,i=e[0]===lp,a=t[0]!==lp,s=t[0]!==cp;return o&&(!n&&i&&a||n&&r&&s)}function Lp(){const t="_ideoHoveredSubpart";document.querySelectorAll(`.${t}`).forEach((e=>e.classList.remove(t)))}function Tp(t){const e=Array.from(document.querySelectorAll("rect.subpart")),n="+"===document.querySelector("._ideoGeneStructure").getAttribute("data-ideo-strand"),o=function(t,e){const n=t.slice(),o=Array.isArray(t[0]);let r;if(o){const n=e?lp:cp;r=t.some((t=>t[0]===n))}else{const n=e?"three-prime-utr":"five-prime-utr";r=t.some((t=>Ap(t,n)))}return t.forEach(((i,a)=>{if(a===n.length-1)return;const s=t[a+1];(o?Sp:Cp)(i,s,e,r)&&(n.splice(a,1,s),n.splice(a+1,1,i))})),n}(e,n);if(0===o.length)return;const r="_ideoHoveredSubpart",i=document.querySelector(`.${r}`);if(!i)return t.stopPropagation(),void t.preventDefault();let a;o.forEach(((t,e)=>{t.classList.contains(r)&&(a=e)}));const s={view:window,bubbles:!1,cancelable:!0},c=new MouseEvent("mouseenter",s),l=new MouseEvent("mouseleave",s),u=n?"ArrowLeft":"ArrowRight",d=n?"ArrowRight":"ArrowLeft";let f;if(t.key===u?f="left":t.key===d&&(f="right"),void 0===f||function(t,e,n){const o="left"===n;return 0===t&&o||t===e.length-1&&!o}(a,o,f))return t.stopPropagation(),void t.preventDefault();Lp();const h=t.altKey,p=t.metaKey;if(t.key===u){i.dispatchEvent(l);let t=a-1;h&&(t=a-10<0?0:a-10),p&&(t=0),o[t].dispatchEvent(c)}else if(t.key===d){i.dispatchEvent(l);const t=o.length-1;let e=a+1;h&&(e=a+10>t?t:a+10),p&&(e=t),o[e].dispatchEvent(c)}t.stopPropagation(),t.preventDefault()}function kp(){return document.querySelector("#_ideoGeneStructureMenuContainer")}function Mp(t,e){gp().innerHTML=t,Np(e)}function Ep(t,e){const n=t;n.addEventListener("mouseenter",(t=>{Lp(),t.target.classList.add("_ideoHoveredSubpart");const o=gp();e.originalTooltipFooter=o.innerHTML,Mp(`
    ${n.getAttribute("data-subpart")}
    ${o.innerHTML.replace(" ","")}`,e);const r=kp();r&&(r.style.marginTop="")})),n.addEventListener("mouseleave",(t=>{t.target.classList.remove("_ideoHoveredSubpart"),Mp(e.originalTooltipFooter,e);const n=kp();n&&(n.style.marginTop="4px")}))}function Pp(t){const e=document.querySelectorAll("rect.subpart");if(0===e.length)return;t.subparts=e;const n=document.querySelector("._ideoGeneStructureContainer");n.addEventListener("mouseenter",(()=>{document.addEventListener("keydown",Tp),t.addedMenuListeners||(t.addedMenuListeners=!0,yp(n),document.querySelector("._ideogramTooltip").addEventListener("change",(()=>{vp(t),t.oneTimeDelayTooltipHideMs=2e3})),t.tissueCache&&(document.querySelector("._ideoTooltipFooter").style.display="none"))})),n.addEventListener("mouseleave",(e=>{t.oneTimeDelayTooltipHideMs=2e3,t.tissueCache&&(document.querySelector("._ideoTooltipFooter").style.display="");const n=function(t){const e=document.querySelector("._ideogramTooltip").getBoundingClientRect(),n=t.screenX,o=t.screenY;return n>e.left&&ne.top&&o{Ep(e,t)})))}function Dp(t){return{theme:"light-border",popperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:t}}]},onShow:function(){document.querySelectorAll("[data-tippy-root]").forEach((t=>t.remove()))}}}function Np(t){const e=Dp(["top-start","top"]);t.tippy=jf("._ideoSpliceToggle[data-tippy-content]",e);const n=Dp(["bottom"]);n.popperOptions.modifiers.push({name:"offset",options:{offset:[-5,20]}});const o=jf("._ideoMenuArrow[data-tippy-content]",n);t.tippy=t.tippy.concat(o)}function Fp(t){null!==wp(t)&&(function(t){document.addEventListener("keydown",xp);const e=document.querySelector("._ideoGeneStructureContainer"),n=document.querySelector("._ideoSpliceToggle");e&&n.addEventListener("change",(e=>{!function(t){t.spliceExons=!t.spliceExons;const e=t.spliceExons,[n,o]=wp(t),r=0===o,[,i,a]=Wp(n,t,e),s=document.querySelector("#_ideoProtein");s&&!e&&(s.style.display="none");const c=document.querySelectorAll(".intron").length>0;e||c?document.querySelectorAll(".intron").forEach((t=>t.remove())):function(t,e,n){let o=0;const r=document.querySelectorAll(".subpart");t.forEach(((t,n)=>{const i=n-o;if(e[i][0]!==t[0]){const e=t[3].summary,n=``;r[i].insertAdjacentHTML("beforebegin",n),o+=1}})),document.querySelectorAll(".intron").forEach((t=>{Ep(t,n)}))}(i,a,t),document.querySelectorAll(".subpart-line.rna").forEach((t=>t.remove()));const l=e?a:i;Di.select("._ideoGeneStructure").selectAll(".subpart").data(l).transition().duration(750).attr("x",((t,e)=>l[e][3].x)).attr("width",((t,e)=>l[e][3].width)).on("end",((n,o)=>{if(o!==l.length-1)return;s&&e&&(s.style.display=""),document.querySelectorAll(".subpart:not(.domain)").forEach(((t,e)=>{const n=Gp(l[e]);t.insertAdjacentHTML("afterend",n)})),$p(e,r);const i=document.querySelector("#_ideoTranscriptLengthBp");if(!i)return;const a=Op(l,e).toLocaleString();i.innerText=`${a} bp`,t.tippy[0].show()}))}(t),Pp(t),e.stopPropagation()}))}(t),Pp(t),function(t){document.querySelector("._ideoGeneStructureContainer").addEventListener("click",(e=>{"_ideoGeneStructureMenu"===e.target.id&&e.stopPropagation();let n=e.target;if("svg"===n.parentElement.tagName&&(n=n.parentElement),Array.from(n.classList).includes("_ideoMenuArrow")){const o=n.getAttribute("data-dir");vp(t,"down"===o?1:-1),e.stopPropagation()}}))}(t),function(t){const e=wp(t)[0].strand;if("+"===e)return;const n=document.querySelector("._ideoTooltipFooter");n.innerText=n.innerText.replace(")",`, ${e})`)}(t),Np(t))}function Bp(t){return t?"Unsplice exons (s)":"Splice exons (s)"}function Ip(t,e=!0){let n="",o=" and protein",r="without";t||(n="pre-",o="",r="with");const i=e?"Canonical":"Alternative";return{title:`${i} transcript per Ensembl, ${r} introns`,name:`${i} ${n}mRNA ${o}`}}function $p(t,e){const n=document.querySelector("._ideoGeneStructureContainerName"),o=document.querySelector("._ideoSpliceToggle");if(n&&o){[n,o].forEach((t=>t.classList.remove("pre-mRNA"))),t||[n,o].forEach((t=>t.classList.add("pre-mRNA")));const{title:r,name:i}=Ip(t,e);n.textContent=i,n.title=r}}function Op(t,e=!1){const n=t.filter((t=>"exon"===t[0]));e&&(t=n);const o=t.slice(-1)[0];return o[1]+o[2]+(e?n.length-1:0)}function Rp(t,e=null){const n=Op(t)/250/(e?3:1),o=e??t;for(let t=0;t1?`${n} of ${e} `:"",a=t[0].toUpperCase()+t.slice(1),s=r.toLocaleString();return`data-subpart="${a} ${i}${sp} ${s} bp"`}function Gp(t){const e=t[0],n=t[3].x,o=up[e],r=ap+o,i=`stroke="${fp[e]}"`;return``}function Wp(t,e,n=!1){const o=t.strand,r=t.subparts;let i,a=function(t){const e=[];let n=0;for(let o=0;on){const t=n,o=i-n-1;e.push(["intron",t,o])}n=i+a,e.push(r)}return Rp(e)}(r),s=function(t){const e=[];let n=0,o=0;for(let r=0;r0&&([,u,d]=t[r-1]),f=l?s:r>0&&s===u?o:r>0&&s<=u+d?o+d-c:n;const h=f+c,p=[a,f,c+1];e.push(p),n=h,o=f}return Rp(e)}(r);i=n?s:a;const c=document.querySelector("._ideoSpliceToggle");if(c){const t=Bp(n);c.setAttribute("data-tippy-placement","right"),c.setAttribute("data-tippy-content",t),Np(e)}const l=[],u=``;l.push(u);const d={"5'-UTR":0,exon:0,intron:0,"3'-UTR":0},f={"5'-UTR":0,exon:0,intron:0,"3'-UTR":0},h="+"===o;i=_p(i,h),a=_p(a,h),s=_p(s,h);for(let t=0;t`+Gp(e);l.push(v)}const p="position: relative; width: 274px; margin: auto;";let m=`style="${p} left: 10px;"`;"-"===o&&(m=`transform="scale(-1 1)" style="${p} left: -10px;"`);const g=t.name,y=bp(g),v=function(t,e,n){const o="_ideoGeneStructureMenuContainer",r="margin-bottom: 4px; margin-top: 4px; clear: both;",i=e.geneStructureCache[t];if(1===i.length)return`
    Transcript: ${i[0].name}
    `;const a=i.map((t=>{const e=t.name;let o="";return n&&n===t.name&&(o=" selected"),``})).join(""),s="_ideoGeneStructureMenu",c=function(){const t="width: 12px; height: 12px; cursor: pointer;user-select: none;",e='class="_ideoMenuArrow"',n='data-tippy-placement="bottom-start"',o=`${`style="${t}; margin-left: 2px;"`} ${e} data-dir="up" data-tippy-content="Previous transcript" ${n}`;return`${gc({shape:"triangle",color:"#888"},{config:{orientation:"down"}})}${gc({shape:"triangle",color:"#888"},{config:""})}`}();return`
    `+c+"
    "}(y,e,g).replaceAll('"',"'"),b=function(t,e){var n;return null===(n=e.proteinCache[t])||void 0===n?void 0:n.some((t=>t.protein.some((t=>op(t)))))}(y,e),[w,x]=function(t,e,n,o,r){let i=[];const a=bp(t),s=function(t,e){return e.config.showProteinInTooltip&&!("proteinCache"in e==0||t in e.proteinCache==0||"spliceExons"in e==0||!1===e.spliceExons)}(a,r);if(!s)return["
    ",null];const c=r.proteinCache[a].find((e=>e.transcriptName===t));if(!c)return["
    ",null];const l=c.protein,u=function(t,e){e||(t=t.slice().reverse());const n=e?"5'-UTR":"3'-UTR",o=t.filter((t=>t[0]===n)).slice(-1)[0];let r,i;o?(r=o[3].x+o[3].width,i=o[1]+o[2]):(r=0,i=0);const a=e?"3'-UTR":"5'-UTR",s=t.filter((t=>t[0]===a)).slice(-1)[0];let c,l;if(s)c=s[3].x,l=s[1];else{const e=t.slice(-1)[0];c=e[3].x+e[3].width,l=e[1]+e[2]}return{px:{start:r,length:c-r},bp:{start:i,length:l-i}}}(e,n),d=Rp(e,l),f=[];for(let t=0;t`}(u,o);return f.push(h),i=f.concat(i),[`${i.join("")}`,null]}(g,i,h,b,e),_=Op(i,n).toLocaleString(),A=[`${f.exon} exons`,`${_} bp `];if(x){const t=x.toLocaleString();A.push(`${t} aa `)}const C=t.biotype.replace(/_/g," ");"protein coding"!==C&&A.push(C);let S=""===w?"30":"50";return b&&(S="60"),[``+l.join("")+w+"",a,s]}window.swapUTRsForward=_p;const jp={Arrow:["acts on","acted on by"],TBar:["inhibits","inhibited by"],"mim-binding":["binds","binds"],"mim-catalysis":["catalyzes","catalyzed by"],"mim-cleavage":["cleaves","cleaved by"],"mim-conversion":["converts","converted by"],"mim-gap":["interacts with","interacts with"],"mim-inhibition":["inhibits","inhibited by"],"mim-modification":["modifies","modified by"],"mim-necessary-stimulation":["necessarily stimulates","necessarily stimulated by"],"mim-stimulation":["stimulates","stimulated by"],"mim-transcription-translation":["transcribes / translates","transcribed / translated by"]};function qp(t){return Object.values(t).find((t=>t.length>0&&"ixnType"in t[0]))[0].ixnType.toLowerCase()}function zp(t,e){if(void 0===t||""===t)return[[],[]];const n=Array.from(t.querySelectorAll(`DataNode[TextLabel="${e}"]`)).map((t=>({type:"node",matchedLabel:e,textLabel:t.getAttribute("TextLabel"),graphId:t.getAttribute("GraphId"),groupRef:t.getAttribute("GroupRef")}))),o=n.map((t=>t.graphId)),r=n.map((t=>t.groupRef)).map((t=>`Group[GroupId="${t}"]`)).join(",");let i=[];if(""!==r){const n=t.querySelectorAll(r);i=Array.from(n).map((t=>({type:"group",matchedLabel:e,graphId:t.getAttribute("GraphId"),groupId:t.getAttribute("GroupId")})))}const a=i.map((t=>t.graphId));return[o.concat(a),n.concat(i)]}function Up(t,e){return null==t?e:"function"==typeof t?t:e=>e[t]}function Vp(t,e=!1){const n=new Float64Array(5),o=new Float64Array(4);!function(t,e,n){const o=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),r=Math.exp(-1.783/n),i=Math.exp(-1.723/n),a=.6318/n,s=1.997/n,c=Float64Array.of(-r*Math.cos(a),r*Math.sin(a),-r*Math.cos(-a),r*Math.sin(-a),-i*Math.cos(s),i*Math.sin(s),-i*Math.cos(-s),i*Math.sin(-s)),l=2.5066282746310007*n,u=Float64Array.of(o[0],o[1],0,0,0,0,0,0),d=Float64Array.of(1,0,c[0],c[1],0,0,0,0,0,0);let f,h;for(h=2;h<8;h+=2){for(u[h]=c[h]*u[h-2]-c[h+1]*u[h-1],u[h+1]=c[h]*u[h-1]+c[h+1]*u[h-2],f=h-2;f>0;f-=2)u[f]+=c[h]*u[f-2]-c[h+1]*u[f-1],u[f+1]+=c[h]*u[f-1]+c[h+1]*u[f-2];for(f=0;f<=h;f+=2)u[f]+=o[h]*d[f]-o[h+1]*d[f+1],u[f+1]+=o[h]*d[f+1]+o[h+1]*d[f];for(d[h+2]=c[h]*d[h]-c[h+1]*d[h+1],d[h+3]=c[h]*d[h+1]+c[h+1]*d[h],f=h;f>0;f-=2)d[f]+=c[h]*d[f-2]-c[h+1]*d[f-1],d[f+1]+=c[h]*d[f-1]+c[h+1]*d[f-2]}for(h=0;h<4;++h)f=h<<1,e[h]=u[f]/l,t[h+1]=d[f+2]}(n,o,t);const r=Float64Array.of(0,o[1]-n[1]*o[0],o[2]-n[2]*o[0],o[3]-n[3]*o[0],-n[4]*o[0]),i=1+n[1]+n[2]+n[3]+n[4];return{sigma:t,negative:e,a:n,b_causal:o,b_anticausal:r,sum_causal:(o[0]+o[1]+o[2]+o[3])/i,sum_anticausal:(r[1]+r[2]+r[3]+r[4])/i}}function Yp(t,e,n,o=1,r=new Float64Array(n),i=new Float64Array(n),a=new Float64Array(5),s=r,c=Xp){const l=2*o,u=3*o,d=4*o,f=o*n;let h,p;for(c(r,e,n,o,t.b_causal,3,t.a,4,t.sum_causal,a,t.sigma),p=4,h=d;p=0&&f0)for(p=0;p=1)return t[n-1];const o=(n-1)*e,r=Math.floor(o),i=t[r];return i+(t[r+1]-i)*(o-r)}function Qp(t,e={}){const{adjust:n=1,pad:o=3,bins:r=512}=e,i=Up(e.x,(t=>t)),a=Up(e.weight,(()=>1/t.length));let s=e.bandwidth??n*function(t,e){const n=t.map(e).filter((t=>null!=t&&t>=t));n.sort(((t,e)=>t-e));const o=function(t){const e=t.length;let n,o=0,r=0,i=0;for(let a=0;a1?Math.sqrt(i/(o-1)):NaN}(n),r=Kp(n,.25),i=Kp(n,.75),a=n.length,s=(i-r)/1.34;return 1.06*(Math.min(o,s)||o||Math.abs(r)||1)*Math.pow(a,-.2)}(t,i);const[c,l]=e.extent??function(t,e,n=0){const o=t.length;let r,i;for(let n=0;n=o&&(r=i=o):(oi&&(i=o)))}return[r-n,i+n]}(t,i,o*s),u=function(t,e,n,o,r,i){const a=new Float64Array(i),s=(i-1)/(r-o);for(let r=0;rt<0));let h,p=Vp(s/d,f);function*m(t="x",e="y"){const n=g.grid(),o=1/d;for(let i=0;ih||(h=Yp(p,u,r)),extent:()=>[c,l],bandwidth(t){return arguments.length?(t!==s&&(s=t,h=null,p=Vp(s/d,f)),g):s}};return g}const Jp=12,Zp=48;function tm(t,e,n=!0,o=0,r=null){const i=function(t,e){let n=0;for(let o=0;on&&(n=i)}return n}(t,r);let a=0;if(r){const e=t.find((t=>t.tissue===r));a=e.expression.min}const s=["max","q3","median","q1","min"];return t.map((t=>{if(t.px={},n)for(let n=0;ne&&(t.px[r+"Raw"]=l,l+=e-l),l+=o,t.px[r]=l}else{const n=t.expression.min,r=t.expression.max;for(let i=0;iZp&&(i=Zp+1,a=!0);let s=a?Jp:t[e+"Height"];isNaN(s)&&(s=Jp);const c=o-s,l=c+n+.5,u=c+n+s,d="median"===e,f=t.max-t.min<=8&&d;return{x:i,y1:l,y2:u,style:f?"display: none":"",endStyle:a&&d||f?"display: none;":""}}function nm(t,e,n,o,r,i=!1){const a=t[0].toUpperCase()+t.slice(1),{x:s,y1:c,y2:l,style:u}=em(e,t,o,r),d=""===u?"":`style="${u}"`;return``}function om(t,e,n,o){return[nm("median",t,o,e,n,!1),nm("q1",t,o,e,n,!0),nm("q3",t,o,e,n,!0)]}function rm(t,e,n,o=64,r=!1){const i=t.expression.quantiles,a=t.px,s=t.samples,c=[];i.map(((t,e)=>{for(let n=0;n=70?.7:1.5}),u=Array.from(l).filter((t=>0<=t.x&&t.x<=10));if(0===u.length)return"";const d=Math.max(...u.map((t=>t.y))),f=u[0].x,h=u.slice(-1)[0].x-f,p=(("maxRaw"in a?a.maxRaw:a.max)-a.min)/h,m=n+e;let g=0;const y=u.map(((t,e)=>{let o=(t.x-f)*p+a.min;r&&o>Zp&&(o=Zp);const i=n*(t.y/d),s=m-i;return e>0&&["q1","median","q3"].forEach((t=>{const e=a[t];gZp&&(v=Zp),a.min>Zp&&(b=Zp)),y.push(v+","+m),y.push(b+","+m);const w=y[0];return y.push(w),[y.join(" "),a]}function im(t,e,n,o,r,i=64){const[a,s]=rm(t,e,n,i);return[``,s]}function am(t,e){return 1+t*(e+2)}function sm(t,e,n){const o=Zp;e=tm(e,o,!0,0);const r=Jp,i=function(t,e,n,o){const r=function(t){return`Full detail: GTEx`}(t);if(n.length<=3)return`
    ${r}

    `;const i=`|${r}`,a=o.showTissuesMore?"More...":"Less...";return`
    ${a}${o.showTissuesMore?"":i}
    `}(t,r,e,n),a=n.showTissuesMore?3:10;let s;const c=e.slice(0,a).map(((e,n)=>{s=am(n,r);const i=function(t){let e=t.replace(/_/g," ").toLowerCase();return["ba24","ba9","basal ganglia","omentum","suprapubic","lower leg","cervical c-1"].forEach((t=>e=e.replace(t,"("+t+")"))),["ba24","ba9","ebv"].forEach((t=>{e=e.replace(t,t.toUpperCase())})),["adipose","artery","brain","breast","cells","cervix","colon","heart","kidney","muscle","nerve","skin","small intestine"].forEach((t=>{e=e.replace(t,t+" -")})),e=e.replace("basal ganglia","BG"),e=e[0].toUpperCase()+e.slice(1),e}(e.tissue),a=`#${e.color}`,c=ra(a,.85),[l,u]=im(e,s,r,a,c),[d]=om(u,s,r,a),f=`data-tissue="${e.tissue}"`,h=`height="${r+2}" width="${o}px" fill="#FFF" opacity="0" x="0" y="${s}" data-gene="${t}" `+f,p=`y="${s+r}" style="font-size: ${r}px;" x="${o+10}" `+f;return`${i}`+l+d+``})).join("");let l="";return t in n.geneStructureCache||(l='style="margin-bottom: 10px;"'),`
    \n
    Reference expression by tissue
    \n ${c}\n ${i}\n
    `}function cm(t,e){const n=t.getAttribute("data-tissue");document.querySelector(`text[data-tissue="${n}"]`).setAttribute("fill",e)}function lm(t){const e=document.querySelector("._ideoMoreOrLessTissue");e&&e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),t.showTissuesMore=!t.showTissuesMore,function(t){const e=document.querySelector("._ideoTissueExpressionPlot").parentElement,n=document.querySelector("#ideo-related-gene").innerText,o=sm(n,t.tissueExpressionsByGene[n],t);e.innerHTML=o,lm(t)}(t)}));const n=document.querySelectorAll("._ideoExpressionTrace");n.forEach((e=>{e.addEventListener("mouseenter",(()=>{cm(e,"#338"),um(e,t),function(t,e){const n=t.getAttribute("data-gene"),o=t.getAttribute("data-tissue");let r=e.tissueExpressionsByGene[n].find((t=>t.tissue===o));r=tm([r],225,!1,35)[0];const i=`#${r.color}`,a=ra(i,.85),[s,c]=im(r,1,50,i,a,256),[l,u,d]=om(c,0,50,i),f=function(t,e){const n=t.px.min,o=t.expression.min,r=t.px.max,i=t.expression.max,a=t.px.median,s=t.expression.median,c=r/2,l='stroke="#CCC" stroke-width="1px"',u={config:{weight:400,annotLabelSize:12}},d=`Max.${i}`,f=Xi("Min",u).width,h=Xi(o,u).width;let p=n-f/2,m=n-h/2;const g=n+f,y=`x1="${n}" x2="${n}" y1="52" y2="60" ${l}`;let v=a-Xi("Median",u).width/2,b=a-Xi(s,u).width/2;return g>=v&&(v=a,b=a),g>=v&&(v+=1.5,b+=1.5,p=n-f-1.5,m=n-h-1.5),`Min.${o}`+d+`Median${s}`+`Expression (TPM)`+`Samples: ${t.samples} | Source: GTEx`}(r);let h;const p=document.querySelector("._ideoGeneStructureContainer"),m=document.querySelector("._ideoTooltipFooter");p?(h=p,p.style.display="none",m.style.display="none"):(h=m,document.querySelector("._ideoTissuePlotContainer").setAttribute("style","margin-bottom: 20px"));const g='
    '+f+s+l+u+d+"
    ";h.insertAdjacentHTML("beforebegin",g)}(e,t)})),e.addEventListener("mouseleave",(()=>{cm(e,"#000"),um(n[0],t,!0),function(){const t=document.querySelector("._ideoDistributionContainer");if(!t)return;t.remove();const e=document.querySelector("._ideoGeneStructureContainer");e&&(e.style.display=""),document.querySelector("._ideoTooltipFooter").style.display=""}()}))}))}function um(t,e,n=!1){const o=t.getAttribute("data-gene"),r=n?null:t.getAttribute("data-tissue"),i=e.showTissuesMore?3:10;let a=e.tissueExpressionsByGene[o];a=tm(a,Zp,!0,0,r).slice(0,i);const s=Jp;a.forEach(((t,e)=>{const o=t.tissue,r=a.find((t=>t.tissue===o)),i=am(e,s),c=!n,[l,u]=rm(r,i,s,64,c);a[e].points=l;const d=em(u,"median",i,s,c);a[e].medianLine=d})),Di.select("._ideoTissueExpressionPlot").selectAll("polyline").data(a).transition().duration(500).attr("points",((t,e)=>a[e].points)),Di.select("._ideoTissueExpressionPlot").selectAll("._ideoExpressionMedian").data(a).attr("style",((t,e)=>a[e].medianLine.style)).transition().duration(500).attr("x1",((t,e)=>a[e].medianLine.x)).attr("x2",((t,e)=>a[e].medianLine.x)).attr("y1",((t,e)=>a[e].medianLine.y1)).attr("y2",((t,e)=>a[e].medianLine.y2)).attr("style",((t,e)=>a[e].medianLine.endStyle))}function dm(t){const e=t.name,n=t.genomic_pos.ensemblgene;let o=n;return void 0===n&&(o=t.genomic_pos.filter((t=>!t.chr.includes("_")))[0].ensemblgene),{name:e,ensemblId:o}}function fm(t,e){const n=e.organismScientificName;throw Error(`"${t}" is not a known gene in ${n}`)}function hm(t,e){var n;if(!e.synonymCache)return null;const o=t.toLowerCase();if(null===(n=e.synonymCache)||void 0===n||!n.nameCaseMap){const t={};for(const n in e.synonymCache.byGene){const o=e.synonymCache.byGene[n];t[n.toLowerCase()]=o.map((t=>t.toLowerCase()))}e.synonymCache.nameCaseMap=t}const r=e.synonymCache.nameCaseMap;for(const t in r)if(r[t].includes(o))return e.geneCache.nameCaseMap[t];return null}const pm={genes:0};async function mm(t,e,n){let o;"string"==typeof t&&(t=[t]);const r=`?q=${t.map((t=>`${e}:${t.trim()}`)).join(" OR ")}&species=${n.config.taxid}&fields=`;if(n.geneCache){const r=function(t,e,n){const o=n.geneCache,r="symbol"===e,i=r?o.lociByName:o.lociById,a=r?o.idsByName:o.namesById;return t.map((t=>{const e=t.toLowerCase();if(!i[t]&&!o.nameCaseMap[e]&&!hm(t,n)){if(!r)return;fm(t,n)}let s=!1,c=null;r&&!i[t]&&(o.nameCaseMap[e]?t=o.nameCaseMap[e]:(c=t,t=hm(c,n),s=!0));const l=i[t],u=r?t:a[t],d=r?a[t]:t;return{symbol:u,name:o.fullNamesById[d],source:"cache",genomic_pos:{chr:l[0],start:l[1],end:l[2],ensemblgene:d},isSynonym:s,synonym:c}})).filter((t=>void 0!==t))}(t,e,n);r.forEach((t=>{const e=t.symbol,o=t.name,r=t.isSynonym,i=t.synonym;e in n.annotDescriptions.annots?(n.annotDescriptions.annots[e].name=o,n.annotDescriptions.annots[e].isSynonym=t.isSynonym,n.annotDescriptions.annots[e].synonym=t.synonym):n.annotDescriptions.annots[e]={name:o,isSynonym:r,synonym:i}})),o={hits:r,fromGeneCache:!0}}else{const i=`${r}symbol,genomic_pos,name`;try{o=await async function(t){const e=await fetch("https://mygene.info/v3/query"+t+"&size=400");return await e.json()}(i)}catch(r){"Failed to fetch"===r.message&&navigator.onLine&&(o=await async function(t,e,n,o){const r=pm[t];if(r>e)throw new TypeError("Failed to fetch from Ideogram third-party service for: "+t);pm[t]+=1;const i=function(t,e){const n=10*Math.random();return Math.round(500+n)*t**2}(r);return console.log(`Failed fetch for ${t} ${r} times, retrying in ${i} ms`),await(a=i,new Promise((t=>setTimeout(t,a)))),await n(...o);var a}("genes",3,mm,[t,e,n]))}}return o}async function gm(t,e,n){const o=[],r=Object.keys(t);return 0===r.length||((await mm(r,"symbol",n)).hits.forEach((r=>{if("genomic_pos"in r==0||r.symbol===e.name)return;const i=wm(r,n,"purple");o.push(i);const a=t[r.symbol.toLowerCase()],s=function(t,e,n){const o=[],r=[];let i="";if(void 0!==e){let t=e.map((t=>{const e=`https://classic.wikipathways.org/index.php/Pathway:${t.pathwayId}`;return o.push(t.pathwayId),r.push(t.name),`${t.name}`}));t=t.join("
    "),i=`Interacts with ${n.name} in:
    ${t}`}const{name:a,ensemblId:s}=dm(t);return{description:i,ixnsDescription:i,ensemblId:s,name:a,type:"interacting gene",pathwayIds:o,pathwayNames:r}}(r,a,e);km(i,s,n)})),function(t){const e={};Object.entries(t.annotDescriptions.annots).forEach((([t,n])=>{"type"in n&&n.type.includes("interacting gene")&&(e[t]=n.pathwayIds)}));const n={};Object.entries(e).forEach((([t,e])=>{n[t]={},e.map((async e=>{const o=await async function(t){if(!navigator.onLine)return"";const e=`https://cdn.jsdelivr.net/npm/ixn2/${t}.xml.gz`,n=await fetch(e);if(!n.ok)return console.log(`Gracefully degrading as request failed for: ${e}`),"";const o=await n.blob(),r=za(Wa(new Uint8Array(await o.arrayBuffer())));return(new DOMParser).parseFromString(r,"text/xml")}(e);n[t][e]=o}))})),t.gpmlsByInteractingGene=n}(n)),o}function ym(t,e){t=Cm(t,e),e.drawAnnots(t,"overlay",!0,!0),Am(e)}function vm(t,e){var n;if(!e.config.showParalogNeighborhoods)return;if((null===(n=e.neighborhoodAnnots)||void 0===n?void 0:n.length)>0)return e.neighborhoodAnnots.forEach((t=>{e.annotDescriptions.annots[t.name]=t})),void ym(e.neighborhoodAnnots,e);const o=e.relatedAnnots[0];if((t=Cm(t,e)).unshift(o),t.length<2)return;const r={};r[t[0].chr]={},r[t[0].chr][t[0].start]=[t[0]];for(let e=1;e{const s=parseInt(Object.keys(n)[0]);let c=Object.values(n)[0];if(c.length<2)return{paralogs:c};let l=!1;c[0].name===o.name&&(c=c.slice(1),l=!0);const u=("paralog","paralog"+(c.length>1?"s":""));const d=`${c.length} nearby ${u} of ${a}`,f=e.chromosomes[e.config.taxid][t].bpLength;let h=s-75e5,p=s+75e5;p>f?(h=s-i,p=f):h<1&&(h=1,p=i),"geneCache"in e&&(c=c.map((t=>{t.fullName=e.geneCache.fullNamesById[t.id];const n=e.geneCache.interestingNames;return n.includes(t.name)?t.rank=n.indexOf(t.name)+1:t.rank=1e10,t})));const m={name:"paralogNeighborhood-"+r,chr:t,start:h,stop:p,color:"pink",description:d,paralogs:c,type:"paralog neighborhood",displayCoordinates:`chr${t}:${s.toLocaleString()} ± 2 Mbp`,includesSearched:l};return e.annotDescriptions.annots[m.name]=m,m})).filter((t=>t.paralogs.length>1||t.includesSearched));e.neighborhoodAnnots=s,s.length>0&&ym(s,e)}function bm(t,e){let n=null;return n=Array.isArray(t.genomic_pos)?t.genomic_pos.filter((t=>t.chr in e.chromosomes[e.config.taxid]))[0]:t.genomic_pos,n}function wm(t,e,n="red"){const o=bm(t,e);return{name:t.symbol,chr:o.chr,start:o.start,stop:o.end,id:o.ensemblgene,color:n}}function xm(t){const e=t.innerText.toLowerCase();let n;return e.includes("interacting")&&(n="interacting"),e.includes("paralogous")&&(n="paralogous"),e.includes("searched")&&(n="searched"),n}function _m(t){function e(e){(function(t,e){t.classList+=" active";const n=function(t){return{interacting:"purple",paralogous:"pink",searched:"red"}[xm(t)]}(t);if(e.config.showAnnotLabels){e.clearAnnotLabels(),e.flattenAnnots().forEach((t=>{t.color!==n&&(document.getElementById(t.domId).style.display="none")}));const t=e.flattenAnnots().sort(((t,n)=>e.annotSortFunction(t,n))).filter((t=>t.color===n)),o=Math.min(t.length,20);e.fillAnnotLabels(t,o)}})(e.target,t),t.onHoverLegendCallback&&t.onHoverLegendCallback()}function n(){!function(t){if(document.querySelectorAll("#_ideogramLegend li").forEach((t=>{t.classList.remove("active")})),t.flattenAnnots().forEach((t=>{document.getElementById(t.domId).style.display=null})),t.config.showAnnotLabels){const e=t.flattenAnnots().sort(((e,n)=>t.annotSortFunction(e,n)));t.fillAnnotLabels(e)}}(t)}document.querySelectorAll("#_ideogramLegend li._ideoLegendEntry").forEach((t=>{t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",n);const o=xm(t),r=`class="_ideoLegendEntry" style="position: inherit; left: inherit" data-tippy-content="${{interacting:"Adjacent to searched gene in a biochemical pathway, per WikiPathways",paralogous:"Evolutionarily related to searched gene by a duplication event, per Ensembl"}[o]}" `;"paralogous"===o?t.innerHTML=`Paralogous genes`:"interacting"===o&&(t.innerHTML=`Interacting genes`)}));const o=``;document.querySelector("#_ideogramLegend").insertAdjacentHTML("afterBegin",o);const r=ia();r.maxWidth=180,r.offset=[-30,10],t.legendTippy=jf("._ideoLegendEntry[data-tippy-content]",r)}function Am(t,e=0){const n=document.querySelector("#_ideogramInnerWrap"),o=`position: absolute; top: 15px; left: ${Rm({}).legendPad+20+e}px`,r=document.querySelector("#_ideogramLegend");n.prepend(r),r.style=o,_m(t)}function Cm(t,e){if("all"===e.config.annotsInList)return t;const n=[];return t.forEach((t=>{e.config.annotsInList.includes(t.name.toLowerCase())&&n.push(t)})),n}function Sm(t,e){return new Promise((async n=>{const o=performance.now(),r=await async function(t,e){const n={},o={},r=e.config.organism.replace(/-/g," "),i=t.name.toUpperCase();let a={result:[]};if(e.interactionCache)i in e.interactionCache&&(a=e.interactionCache[i]);else{const t=`https://cdn.jsdelivr.net/npm/ixn2/${i}.json.gz`,e=await fetch(t);if(e.ok){const t=await e.blob(),n=new Uint8Array(await t.arrayBuffer());a=JSON.parse(za(Wa(n)))}}return a.result.forEach((i=>{if(i.species.toLowerCase()===r){const r=i.fields.right.values,a=i.fields.left.values,s=r.concat(a),c=i.name,l=i.id,u=function(t,e){return e&&(t=Vc(t,e)),t.sort(((t,e)=>t.rank-e.rank))}(s.map((t=>({name:t,color:""}))),e).map((t=>t.name));u.forEach((r=>{const i=r.toLowerCase();if(i.includes(t.name.toLowerCase()))return;const a=c+l,s=function(t,e,n,o,r){let i;return i="geneCache"in r&&e.name?t.toLowerCase()in r.geneCache.nameCaseMap:function(t,e){return""!==t&&!t.includes(" ")&&!t.includes("/")&&t.toLowerCase()!==e.name.toLowerCase()}(t,e),i&&!(n in o)}(i,t,a,o,e);if(s){o[a]=1;const t={name:c,pathwayId:l};i in n?n[i].push(t):n[i]=[t]}}))}})),n}(t,e),i=await gm(r,t,e);e.relatedAnnots.push(...i),Pm("interacting",e),e.time.rg.interactions=zf(o),vm(i,e),n()}))}function Lm(t,e){return new Promise((async n=>{const o=performance.now(),r=await async function(t,e){const n=e.config.taxid;let o;if(e.paralogCache){const n=e.paralogCache.paralogsByName,r=t.name.toUpperCase();o=r in n?n[r]:[]}else{const e=`&format=condensed&type=paralogues&target_taxon=${n}`,r=`/homology/id/${t.id}?${e}`;o=(await Ideogram.fetchEnsembl(r)).data[0].homologies}let r=await async function(t,e,n){const o=[],r=t.length&&"string"==typeof t[0]?t:t.map((t=>t.id));return(await mm(r,"ensemblgene",n)).hits.forEach((t=>{if("genomic_pos"in t==0)return;if("name"in t==0)return;const r=wm(t,n,"pink");o.push(r);const i=n.tissueCache?"":`Paralog of ${e.name}`,{name:a,ensemblId:s}=dm(t);km(r,{description:i,ensemblId:s,name:a,type:"paralogous gene"},n)})),o}(o,t,e);return r=r.filter((t=>!t.name.match(/^AC[0-9.]+$/))),r}(t,e);e.relatedAnnots.push(...r),Pm("paralogous",e),vm(r,e),e.time.rg.paralogs=zf(o),n()}))}function Tm(t,e){var n,o,r,i;if("name"in t?(n=t.name,o=e.name,r=t.color,i=e.color):([n,r]=[t[0],t[3]],[o,i]=[e[0],e[3]]),"initRank"in t==0){if("red"===r)return-1;if("red"===i)return 1;if("purple"===r&&"pink"===i)return-1;if("purple"===i&&"pink"===r)return 1}return t.rank-e.rank}function km(t,e,n){let o;const r=n.annotDescriptions.annots;if(t.name in r){const i=r[t.name];if(o=e,e.type===i.type)return;Object.keys(i).forEach((function(t){t in o==0&&(o[t]=i[t])})),"type"in i&&!n.tissueCache&&(o.type+=", "+i.type,o.description+=`

    ${i.description}`)}else o=e;n.annotDescriptions.annots[t.name]=o}function Mm(t,e,n){setTimeout((()=>{n<40&&(e.tissueCache?Em(t,e):Mm(t,e,n+1))}),50)}async function Em(t,e){if(!e.tissueCache)return void Mm(t,e,0);const n={},o=e.tissueCache,r=[];t.forEach((async t=>{const i=new Promise((async r=>{const i=await o.getTissueExpressions(t,e);n[t]=i,r()}));r.push(i)})),await Promise.all(r),e.tissueExpressionsByGene=n}function Pm(t,e){let n=e.relatedAnnots;if(n.length>1&&e.onFindGenesCallback&&e.onFindGenesCallback(),n=function(t){const e={};let n=[];return t.forEach((t=>{t.name in e==0?(n.push(t),e[t.name]=1):"purple"===t.color&&(n=n.map((e=>t.name===e.name?t:e)))})),n}(n),function(t,e){t=Cm(t,e),e.drawAnnots(t)}(n,e),e.config.showAnnotLabels){const t=e.flattenAnnots().sort(((t,n)=>e.annotSortFunction(t,n)));e.fillAnnotLabels(t)}Am(e),function(t,e){if("pathway"===t)return;const n=e.getRelatedGenesByType(),o={paralogous:"interacting",interacting:"paralogous"}[t],r=n[t].length,i=n[o]?n[o].length:0;if(e._didRelatedGenesFirstPlot)if(r>0&&i>0){const t=e.time.rg.timestampFirstPlot;e.time.rg.totalLastPlotDiff=zf(t)}else r>0&&0===i?(e.time.rg.timestampFirstPlot=performance.now(),e.time.rg.totalFirstPlot=zf(e.time.rg.t0),e._relatedGenesFirstPlotType=t,e.time.rg.totalLastPlotDiff=0):(0===r&&i>0||(e._relatedGenesFirstPlotType="searched"),e.time.rg.totalLastPlotDiff=0);else e._didRelatedGenesFirstPlot=!0,e.time.rg.totalFirstPlot=zf(e.time.rg.t0),r>0&&(e.time.rg.timestampFirstPlot=performance.now(),e._relatedGenesFirstPlotType=t)}(t,e)}function Dm(t){var e=document.querySelector(t.config.container);e.style.visibility="",e.style.position="absolute",e.style.width="100%";var n=document.querySelector("#_ideogramInnerWrap");n.style.position="relative",n.style.marginLeft="auto",n.style.marginRight="auto",n.style.overflowY="hidden",document.querySelector("#_ideogramMiddleWrap").style.overflowY="hidden";const o=t.config.legendPad;if(void 0===t.didAdjustIdeogramLegend){var r=document.querySelector("#_ideogram");const e=160;n.style.maxWidth=parseInt(n.style.maxWidth)+e+o+"px",r.style.minWidth=parseInt(r.style.minWidth)+o+"px",r.style.maxWidth=parseInt(r.style.minWidth)+o+"px",r.style.position="relative",r.style.left=e+"px",t.didAdjustIdeogramLegend=!0}}async function Nm(t=null){const e=this;if(!t)return Gm();e.clearAnnotLabels();const n=document.querySelector("#_ideogramLegend");n&&n.remove(),e.config=Rm(e.config),function(t,e){const n=[`# ${e}`,`# Organism: ${t.getScientificName(t.config.taxid)}`,`# Generated by Ideogram.js version ${Ideogram.version}, https://github.com/eweitz/ideogram`,`# Generated at ${window.location.href}`].join("\n");delete t.annotDescriptions,t.annotDescriptions={headers:n,annots:{}}}(e,`Related genes for ${t}`);const o=e.selector+" .annot";document.querySelectorAll(o).forEach((t=>t.remove())),e.startHideAnnotTooltipTimeout(),document.querySelectorAll(".chromosome").forEach((t=>{t.style.cursor=""})),Dm(e),e.relatedAnnots=[],e.neighborhoodAnnots=[];const r=await async function(t,e){const n=performance.now(),o=await mm(t,"symbol",e);if(0===o.hits.length)return;const r=o.hits.find((t=>{const n=bm(t,e);return n&&n.ensemblgene}));let i={description:"",ensemblId:r.genomic_pos.ensemblgene,type:"searched gene"};if(r.symbol in e.annotDescriptions.annots){const t=e.annotDescriptions.annots[r.symbol];i=Object.assign(t,i)}else i.name=r.name;e.annotDescriptions.annots[r.symbol]=i;const a=wm(r,e);return e.relatedAnnots.push(a),e.time.rg.searchedGene=zf(n),a}(t,e);void 0===r&&fm(t,e),e.config.legend=$m,bc(e),Am(e),await Promise.all([Sm(r,e),Lm(r,e)]),e.time.rg.total=zf(e.time.rg.t0),function(t){const e=Yf(t),n=t.time.rg.total,o=t.time.rg.totalFirstPlot,r=t.time.rg.totalLastPlotDiff,i=t.time.rg.paralogs,a=t.time.rg.interactions,s=t.time.rg.searchedGene,c=t._relatedGenesFirstPlotType,l=Object.assign({firstPlotType:c,timeTotal:n,timeTotalFirstPlot:o,timeTotalLastPlotDiff:r,timeSearchedGene:s,timeInteractingGenes:a,timeParalogs:i},e);t.relatedGenesAnalytics=l}(e),e.onPlotFoundGenesCallback&&e.onPlotFoundGenesCallback()}function Fm(t,e,n){if("type"in e&&e.type.includes("interacting gene")){const o=e.pathwayIds,r=function(t){return Object.entries(t.annotDescriptions.annots).find((([t,e])=>"searched gene"===e.type))[0]}(n),i=n.gpmlsByInteractingGene[t.name],a=function(t,e,n,o){let r=null;if(!navigator.onLine)return"Interacts with";const i=function(t,e,n,o){const r={};return n.map((n=>{const i=o[n],a=function(t,e,n){if(void 0===n||""===n)return[];const[o,r]=zp(n,e),[i,a]=zp(n,t),s={searchedGene:r,interactingGene:a},c=o.concat(i),l={searchedGeneGraphIds:o,matchingGraphIds:c},u=[],d=n.querySelectorAll("Interaction Graphics");return Array.from(d).forEach((t=>{const e=function(t,e){let n=null;const{searchedGeneGraphIds:o,matchingGraphIds:r}=e,i=[];let a=0,s=!1,c=null,l=null;return Array.from(t.children).forEach((t=>{if("Point"!==t.nodeName)return;const e=t,n=e.getAttribute("GraphRef");if(null!==n&&r.includes(n)&&(a+=1,i.push(n),o.includes(n)&&(s=!0),e.getAttribute("ArrowHead"))){const t=e.getAttribute("ArrowHead"),r=o.includes(n);null===l&&(l=r?0:1);try{c=jp[t][r?0:1]}catch(t){}}})),a>=2&&s&&(null!==l&&null!==c||(c="interacts with"),c=c[0].toUpperCase()+c.slice(1),n={interactionId:t.parentNode.getAttribute("GraphId"),endIds:i,ixnType:c}),n}(t,l);null!==e&&(e.elements=s,u.push(e))})),u}(t,e,i);r[n]=a})),r}(t,e,n,o),a=i[n[0]];if(a.length>0){let t={ixnsByPwid:i,isSameByPwid:{},isSame:null,isDirectionSameByPwid:{},isDirectionSame:null,directionsByPwid:{}};t=function(t){let e=!0;const n=t.ixnsByPwid,o=qp(n);return Object.entries(n).map((([n,r])=>{const{isRefMatch:i,thisIsSame:a}=function(t,e){let n=!0,o=!0;if(0===t.length)return{isRefMatch:n,thisIsSame:o};const r=t[0].ixnType.toLowerCase();return t.forEach((t=>{const i=t.ixnType.toLowerCase();i!==e&&(n=!1),i!==r&&(o=!1)})),{isRefMatch:n,thisIsSame:o}}(r,o);a&&i||(e=!1),t.isSameByPwid[n]=a})),t.isSame=e,t}(t),t.isSame?r=a[0].ixnType:(t=function(t){let e=!0;const n=[],o=[];Object.values(jp).forEach((t=>{o.push(t[0]),n.push(t[1])}));const r="Acts on",i="Acted on by",a=t.ixnsByPwid,s=qp(a),c=o.includes(s)?r:i;return Object.entries(a).map((([n,a])=>{let s=!0;if(a.length>0){const l=a[0].ixnType.toLowerCase(),u=o.includes(l)?r:i;a.forEach((a=>{const l=a.ixnType.toLowerCase(),d=o.includes(l)?r:i;t.directionsByPwid[n]=d,d!==c&&(e=!1),d!==u&&(s=!1)}))}t.isDirectionSameByPwid[n]=s})),t.isDirectionSame=e,!0===e&&(t.direction=c),t}(t),r=t.isDirectionSame?t.direction:"Interacts with")}return r}(t.name,r,o,i);if(null!==a){const t="Interacts with";e.description=e.description.replace(t,a)}}return e}const Bm="triangle";function Im(t,e=null){let n=`
    ${t}
    `;return e&&(n=e),`\n
    \n ${n}\n Click gene to search\n
    \n `}const $m=[{name:Im("Related genes"),nameHeight:50,rows:[{name:"Interacting gene",color:"purple",shape:Bm},{name:"Paralogous gene",color:"pink",shape:Bm},{name:"Searched gene",color:"red",shape:Bm}]}];Im("Related genes");const Om=[{name:Im("Highly cited genes"),nameHeight:30,rows:[]}];function Rm(t){return t.legendPad=t.showAnnotLabels?70:30,t}const Hm={chrWidth:9,chrHeight:100,chrLabelSize:12,annotationHeight:7,showFullyBanded:!1,rotatable:!1,legend:$m,chrBorderColor:"#333",chrLabelColor:"#333",onBeforeDrawAnnots:function(){const t=this;!function(t){const e=[],n=t.chromosomesArray.map((t=>t.name));if("relatedAnnots"in t){t.relatedAnnots=Cm(t.relatedAnnots,t);const e={};t.relatedAnnots=t.relatedAnnots.filter((t=>!(t.name in e)&&(e[t.name]=1,!0)))}const o={};t.annots.forEach((e=>{const n=e.annots.sort(((e,n)=>-t.annotSortFunction(e,n)));o[e.chr]=n}));const r={};Object.entries(o).forEach((([t,o])=>{r[t]={chr:t,annots:[]},o.forEach(((e,o)=>{const i=n.indexOf(t);e.domId=Ic(i,o),r[t].annots.push(e)})),e.push(r[t])})),t.annots=e}(t);const e=[],n=t.annots;for(let r=0;r0?`
    ${r.description}`:"",a=r.name,s="color: #0366d6; cursor: pointer;";let c=a;"rank"in t&&(c=`${a}`);let l="";null!==(n=r)&&void 0!==n&&n.isSynonym&&(l=`
    Synonym: ${r.synonym}
    `);const u=t.name.includes("paralogNeighborhood"),d=function(t,e,n){let o="";const r=t.name;if(e.config.showGeneStructureInTooltip&&!n&&"geneStructureCache"in e!=0&&r in e.geneStructureCache!=0){e.addedSubpartListeners=!1,"spliceExons"in e==0&&(e.spliceExons=!0);const t=e.spliceExons,n=Wp(e.geneStructureCache[r][0],e,t)[0],i='class="_ideoGeneStructureContainer"',a=function(t){const e=t.spliceExons,n=e?"checked":"";return``}(e),s=`class="_ideoGeneStructureContainerName${t?"":" pre-mRNA"}"`,{name:c,title:l}=Ip(t);o="

    "+pp+`
    `+`
    ${c}${a}
    `+n+'
    '+mp+"
    "}return o}(t,o,u),f=function(t,e){if(!e.tissueCache||!(t.name in e.tissueCache.byteRangesByName))return"
    ";void 0===e.showTissuesMore&&(e.showTissuesMore=!0);const n=t.name,o=e.tissueExpressionsByGene[n];return o?sm(n,o,e):void 0}(t,o);let h=`\n ${t.name}
    ${c}
    \n
    `+l+i+f+d;return u&&([t,h]=function(t,e,n){const o=e.paralogs.sort(((t,e)=>t.rank-e.rank)),r="Paralog neighborhood

    "+e.description+":
    "+`${o.map((t=>{let e="";return t.fullName&&(e=t.fullName),t.rank&&(e+=` Ranked ${t.rank} in general or scholarly interest`),""!==e&&(e=`title="${e}"`),`${t.name}`})).join("
    ")}
    `;return t.displayCoordinates=e.displayCoordinates,[t,r]}(t,r,s)),t.displayName=h,t},onDidShowAnnotTooltip:function(){const t=this;t.tissueCache&&function(){const t=document.querySelector("#_ideogramTooltip"),e=t.getBoundingClientRect().top,n=document.querySelector("#_ideogram").getBoundingClientRect().top;e>n&&(t.style.top=n+"px")}(),function(t){const e=document.querySelector("._ideogramTooltip");t.addedTooltipClickHandler||(e.addEventListener("click",(e=>{if(["input","label"].includes(e.target.localName))return;let n=document.querySelector("#ideo-related-gene");n||(n=e.target);const o=function(t,e){var n;return e.annots.forEach((e=>{e.annots.forEach((e=>{t===e.name&&(n=e)}))})),null===n&&(n=e.annotDescriptions.annots[t]),n}(n.textContent,t);t.onClickAnnot(o)})),t.addedTooltipClickHandler=!0)}(t),Fp(t),lm(t),t.tissueTippy=jf("._ideoGeneTissues[data-tippy-content]",ia())},showTools:!0,showAnnotLabels:!0,chrFillColor:{centromere:"#DAAAAA"}};function Gm(){const t=this;if(!t||"annotDescriptions"in t)return;t.annotDescriptions={annots:{}},t.flattenAnnots().map((e=>{let n=[];"significance"in e&&"n/a"!==e.significance&&n.push(e.significance),"citations"in e&&void 0!==e.citations&&n.push(e.citations),n=n.join("

    "),t.annotDescriptions.annots[e.name]={description:n,name:decodeURIComponent(e.fullName)}})),Dm(t),Am(t,-60);const e=t.config.container;if(document.querySelector(e).style.visibility="",t.config.showAnnotLabels){const e=t.flattenAnnots().sort(((e,n)=>t.annotSortFunction(e,n)));t.fillAnnotLabels(e)}}function Wm(t,e,n){if("all"!==n&&(n=n.map((t=>t.toLowerCase()))),e.annotsInList=n,t.legendPad=t.showAnnotLabels?80:30,"onWillShowAnnotTooltip"in e){const n="onWillShowAnnotTooltip",o=e[n],r=t[n],i=function(t){return t=r.bind(this)(t),o.bind(this)(t)};t[n]=i,delete e[n]}if("onDidShowAnnotTooltip"in e){const n="onDidShowAnnotTooltip",o=e[n],r=t[n],i=function(t){return t=r.bind(this)(t),o.bind(this)(t)};t[n]=i,delete e[n]}if("onBeforeDrawAnnots"in e){const n="onBeforeDrawAnnots",o=e[n],r=t[n],i=function(){r&&r.bind(this)(),o.bind(this)()};t[n]=i,delete e[n]}if("onDrawAnnots"in e){const n="onDrawAnnots",o=e[n],r=t[n],i=function(){r&&r.bind(this)(),o.bind(this)()};t[n]=i,delete e[n]}const o=Object.assign(t,e),r=new Ideogram(o);var i;return e.onFindGenes&&(r.onFindGenesCallback=e.onFindGenes),e.onPlotFoundGenes&&(r.onPlotFoundGenesCallback=e.onPlotFoundGenes),e.onHoverLegend&&(r.onHoverLegendCallback=e.onHoverLegend),r.getTooltipAnalytics=Vf,r.annotSortFunction=Tm,(i=r).time={rg:{t0:performance.now()}},"_didRelatedGenesFirstPlot"in i&&delete i._didRelatedGenesFirstPlot,r}class jm{constructor(t){this.configure=ca,this.initDrawChromosomes=As,this.onLoad=Ss,this.handleRotateOnClick=Cs,this.init=Ds,this.finishInit=cs,this.writeContainer=ys,this.onLoadAnnots=Qs,this.onDrawAnnots=Js,this.processAnnotData=Rc,this.restoreDefaultTracks=Pc,this.updateDisplayedTracks=Dc,this.initAnnotSettings=Wc,this.fetchAnnots=zc,this.drawAnnots=wc,this.getHistogramBars=pc,this.drawHeatmaps=Ys,this.deserializeAnnotsForHeatmap=Ks,this.fillAnnots=Uc,this.drawProcessedAnnots=xc,this.drawSynteny=Ec,this.startHideAnnotTooltipTimeout=tc,this.showAnnotTooltip=rc,this.onWillShowAnnotTooltip=ec,this.onDidShowAnnotTooltip=nc,this.onClickAnnot=oc,this.setOriginalTrackIndexes=Nc,this.afterRawAnnots=jc,this.downloadAnnotations=Gc,this.addAnnotLabel=uc,this.removeAnnotLabel=fc,this.fillAnnotLabels=dc,this.clearAnnotLabels=hc,this.flattenAnnots=qc,this.highlight=Yc,this.unhighlight=Xc,this.esearch=Jc,this.esummary=Zc,this.elink=tl,this.getOrganismFromEutils=nl,this.getTaxids=al,this.getAssemblyAndChromosomesFromEutils=cl,this.drawBandLabels=gl,this.getBandColorGradients=vl,this.processBandData=Al,this.setBandsToShow=hl,this.hideUnshownBandLabels=ll,this.drawBandLabelText=pl,this.drawBandLabelStalk=ml,this.onBrushMove=Cl,this.onBrushEnd=Sl,this.createBrush=Ll,this.createClickCursor=kl,this.onCursorMove=Tl,this.drawSexChromosomes=Ml,this.setSexChromosomes=El,this.convertBpToPx=Pl,this.convertPxToBp=Nl,this.unpackAnnots=gu,this.packAnnots=yu,this.initCrossFilter=vu,this.filterAnnots=bu,this.assemblyIsAccession=Ni,this.getDataDir=Ii,this.round=$i,this.onDidRotate=Oi,this.getSvg=Ri,this.fetch=Hi,this.getTaxid=Gi,this.getCommonName=Wi,this.getScientificName=ji,this.getChromosomeModel=xu,this.getChromosomePixels=wu,this.drawChromosomeLabels=Hu,this.rotateChromosomeLabels=Gu,this.appendHomolog=Iu,this.drawChromosome=$u,this.rotateAndToggleDisplay=Ou,this.setOverflowScroll=Ru,this.plotRelatedGenes=Nm,this.getRelatedGenesByType=Uf,this.configure(t)}static get version(){return a}static get d3(){return Di}static async fetchEnsembl(t,e=null,n="GET"){const o={method:n};if(null!==e&&(o.body=JSON.stringify(e)),"GET"===n){const e=t.includes("&")?"&":"?";t+=e+"content-type=application/json"}else o.headers={"Content-Type":"application/json"};const r=await fetch(`https://rest.ensembl.org${t}`,o);return await r.json()}static getChrSortNamesAndTypes(t,e){var n,o,r,i,a,s,c,l,u,d;return"string"==typeof t||"chr"in t&&"annots"in t?(a="MT"===(n="string"==typeof t?t:t.chr),s="MT"===(o="string"==typeof e?e:e.chr),c="AP"===n,l="AP"===o,u=!(r="CP"===n)&&!a&&!c,d=!(i="CP"===o)&&!s&&!l):(n=t.name,o=e.name,r="chloroplast"===t.type,i="chloroplast"===e.type,a="mitochondrion"===t.type,s="mitochondrion"===e.type,c="apicoplast"===t.type,l="apicoplast"===e.type,u="nuclear"===t.type,d="nuclear"===e.type),[n,o,{aIsNuclear:u,bIsNuclear:d,aIsCP:r,bIsCP:i,aIsMT:a,bIsMT:s,aIsAP:c,bIsAP:l}]}static sortChromosomes(t,e){let[n,o,r]=jm.getChrSortNamesAndTypes(t,e);const{aIsNuclear:i,bIsNuclear:a,aIsCP:s,bIsCP:c,aIsMT:l,bIsMT:u,aIsAP:d,bIsAP:f}=r;return i&&a?(Ui(n)&&Ui(o)&&(n=Vi(n).toString(),o=Vi(o).toString()),n.localeCompare(o,"en",{numeric:!0})):!i&&a||l&&c?1:s&&u?-1:d||l||s||!(u||c||f)?void 0:-1}static initRelatedGenes(t,e="all"){return function(t,e){return"leads"===t.relatedGenesMode&&(delete t.onDrawAnnots,delete t.relatedGenesMode),Wm(Object.assign({showParalogNeighborhoods:!0,isLegendInteractive:!0,relatedGenesMode:"related",useCache:!0,awaitCache:!0},Hm),t,e)}(t,e)}static initGeneLeads(t,e="all"){return function(t,e){if(delete t.onPlotFoundGenes,t.legendName)if(t.legendContent)Om[0].name=Im(t.legendName,t.legendContent);else if(t.geneLeadsDE){const e=`Gene leads from
    ${fileIcon} Publication
    ${deltaIcon} Differential expression

    `;Om[0].name=Im(t.legendName,e)}else Om[0].name=Im(t.legendName);let n,o;return t.legend=Om,t.geneLeadsDE?(o="leads",n="annotations/gene_leads.tsv"):(o="hints",n="cache/homo-sapiens-top-genes.tsv"),Wm(Object.assign({relatedGenesMode:o,chrMargin:-4,annotationsPath:Fi(n),onDrawAnnots:Gm,useCache:!0},Hm),t,e)}(t,e)}}window.Ideogram=jm;const qm=jm})(),o})())); //# sourceMappingURL=ideogram.min.js.map \ No newline at end of file diff --git a/dist/js/ideogram.min.js.LICENSE.txt b/dist/js/ideogram.min.js.LICENSE.txt index d5e8cc13..8e93000c 100644 --- a/dist/js/ideogram.min.js.LICENSE.txt +++ b/dist/js/ideogram.min.js.LICENSE.txt @@ -1 +1 @@ -/*! Ideogram.js, version 1.45.1-beta. Developed by Eric Weitz. https://github.com/eweitz/ideogram. Public domain (CC0 1.0). */ +/*! Ideogram.js, version 1.45.1. Developed by Eric Weitz. https://github.com/eweitz/ideogram. Public domain (CC0 1.0). */ diff --git a/dist/js/ideogram.min.js.map b/dist/js/ideogram.min.js.map index f9491f3a..644df3a8 100644 --- a/dist/js/ideogram.min.js.map +++ b/dist/js/ideogram.min.js.map @@ -1 +1 @@ -{"version":3,"file":"ideogram.min.js","mappings":";CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,EACvE,CACA,CATD,CASGC,MAAM,IACT,mCCRA,IACIA,KAAK,uBAAyBC,GAClC,CACA,MAAOC,GAAK,YCHZ,IACIF,KAAK,iCAAmCC,GAC5C,CACA,MAAOC,GAAK,ICJRC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaZ,QAGrB,IAAIC,EAASQ,EAAyBE,GAAY,CAGjDX,QAAS,CAAC,GAOX,OAHAc,EAAoBH,GAAUV,EAAQA,EAAOD,QAASU,GAG/CT,EAAOD,OACf,CCrBAU,EAAoBK,EAAI,CAACf,EAASgB,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAElB,EAASiB,IAC5EE,OAAOC,eAAepB,EAASiB,EAAK,CAAEI,YAAY,EAAMC,IAAKN,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AAc06E,GACdpjE,UAAU,GACT0nE,IAEoCjoF,EAAQ0/E,EACjD,CChpDW2M,CAAersF,EAAQ0/E,EAChC,EClVF5yG,OAAO2zB,SAAWA,GAGlB,mBnWIA","sources":["webpack://ideogram/webpack/universalModuleDefinition","webpack://ideogram/./node_modules/workbox-core/_version.js","webpack://ideogram/./node_modules/workbox-range-requests/_version.js","webpack://ideogram/webpack/bootstrap","webpack://ideogram/webpack/runtime/define property getters","webpack://ideogram/webpack/runtime/hasOwnProperty shorthand","webpack://ideogram/webpack/runtime/make namespace object","webpack://ideogram/./src/js/version.js","webpack://ideogram/./node_modules/d3-selection/src/selector.js","webpack://ideogram/./node_modules/d3-selection/src/array.js","webpack://ideogram/./node_modules/d3-selection/src/selectorAll.js","webpack://ideogram/./node_modules/d3-selection/src/matcher.js","webpack://ideogram/./node_modules/d3-selection/src/selection/selectChild.js","webpack://ideogram/./node_modules/d3-selection/src/selection/selectChildren.js","webpack://ideogram/./node_modules/d3-selection/src/selection/sparse.js","webpack://ideogram/./node_modules/d3-selection/src/selection/enter.js","webpack://ideogram/./node_modules/d3-selection/src/selection/data.js","webpack://ideogram/./node_modules/d3-selection/src/selection/sort.js","webpack://ideogram/./node_modules/d3-selection/src/namespaces.js","webpack://ideogram/./node_modules/d3-selection/src/namespace.js","webpack://ideogram/./node_modules/d3-selection/src/selection/attr.js","webpack://ideogram/./node_modules/d3-selection/src/window.js","webpack://ideogram/./node_modules/d3-selection/src/selection/style.js","webpack://ideogram/./node_modules/d3-selection/src/selection/property.js","webpack://ideogram/./node_modules/d3-selection/src/selection/classed.js","webpack://ideogram/./node_modules/d3-selection/src/selection/text.js","webpack://ideogram/./node_modules/d3-selection/src/selection/html.js","webpack://ideogram/./node_modules/d3-selection/src/selection/raise.js","webpack://ideogram/./node_modules/d3-selection/src/selection/lower.js","webpack://ideogram/./node_modules/d3-selection/src/creator.js","webpack://ideogram/./node_modules/d3-selection/src/selection/insert.js","webpack://ideogram/./node_modules/d3-selection/src/selection/remove.js","webpack://ideogram/./node_modules/d3-selection/src/selection/clone.js","webpack://ideogram/./node_modules/d3-selection/src/selection/on.js","webpack://ideogram/./node_modules/d3-selection/src/selection/dispatch.js","webpack://ideogram/./node_modules/d3-selection/src/selection/index.js","webpack://ideogram/./node_modules/d3-selection/src/selection/select.js","webpack://ideogram/./node_modules/d3-selection/src/selection/selectAll.js","webpack://ideogram/./node_modules/d3-selection/src/selection/filter.js","webpack://ideogram/./node_modules/d3-selection/src/constant.js","webpack://ideogram/./node_modules/d3-selection/src/selection/exit.js","webpack://ideogram/./node_modules/d3-selection/src/selection/join.js","webpack://ideogram/./node_modules/d3-selection/src/selection/merge.js","webpack://ideogram/./node_modules/d3-selection/src/selection/order.js","webpack://ideogram/./node_modules/d3-selection/src/selection/call.js","webpack://ideogram/./node_modules/d3-selection/src/selection/nodes.js","webpack://ideogram/./node_modules/d3-selection/src/selection/node.js","webpack://ideogram/./node_modules/d3-selection/src/selection/size.js","webpack://ideogram/./node_modules/d3-selection/src/selection/empty.js","webpack://ideogram/./node_modules/d3-selection/src/selection/each.js","webpack://ideogram/./node_modules/d3-selection/src/selection/append.js","webpack://ideogram/./node_modules/d3-selection/src/selection/datum.js","webpack://ideogram/./node_modules/d3-selection/src/selection/iterator.js","webpack://ideogram/./node_modules/d3-selection/src/select.js","webpack://ideogram/./node_modules/d3-fetch/src/blob.js","webpack://ideogram/./node_modules/d3-fetch/src/buffer.js","webpack://ideogram/./node_modules/d3-dsv/src/dsv.js","webpack://ideogram/./node_modules/d3-dsv/src/csv.js","webpack://ideogram/./node_modules/d3-dsv/src/tsv.js","webpack://ideogram/./node_modules/d3-fetch/src/text.js","webpack://ideogram/./node_modules/d3-fetch/src/dsv.js","webpack://ideogram/./node_modules/d3-fetch/src/image.js","webpack://ideogram/./node_modules/d3-fetch/src/json.js","webpack://ideogram/./node_modules/d3-fetch/src/xml.js","webpack://ideogram/./node_modules/d3-dispatch/src/dispatch.js","webpack://ideogram/./node_modules/d3-drag/src/noevent.js","webpack://ideogram/./node_modules/d3-color/src/define.js","webpack://ideogram/./node_modules/d3-color/src/color.js","webpack://ideogram/./node_modules/d3-interpolate/src/basis.js","webpack://ideogram/./node_modules/d3-interpolate/src/constant.js","webpack://ideogram/./node_modules/d3-interpolate/src/color.js","webpack://ideogram/./node_modules/d3-interpolate/src/rgb.js","webpack://ideogram/./node_modules/d3-interpolate/src/array.js","webpack://ideogram/./node_modules/d3-interpolate/src/date.js","webpack://ideogram/./node_modules/d3-interpolate/src/number.js","webpack://ideogram/./node_modules/d3-interpolate/src/object.js","webpack://ideogram/./node_modules/d3-interpolate/src/basisClosed.js","webpack://ideogram/./node_modules/d3-interpolate/src/string.js","webpack://ideogram/./node_modules/d3-interpolate/src/numberArray.js","webpack://ideogram/./node_modules/d3-interpolate/src/value.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selector.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selectorAll.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/matcher.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/selectChild.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/selectChildren.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/sparse.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/enter.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/data.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/sort.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/namespaces.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/namespace.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/attr.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/window.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/style.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/property.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/classed.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/text.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/html.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/raise.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/lower.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/creator.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/insert.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/remove.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/clone.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/on.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/dispatch.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/index.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/select.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/pointer.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/sourceEvent.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/select.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/selectAll.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/array.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/filter.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/constant.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/exit.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/join.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/merge.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/order.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/call.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/nodes.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/node.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/size.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/empty.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/each.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/append.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/datum.js","webpack://ideogram/./node_modules/d3-brush/node_modules/d3-selection/src/selection/iterator.js","webpack://ideogram/./node_modules/d3-timer/src/timer.js","webpack://ideogram/./node_modules/d3-timer/src/timeout.js","webpack://ideogram/./node_modules/d3-transition/src/transition/schedule.js","webpack://ideogram/./node_modules/d3-transition/src/interrupt.js","webpack://ideogram/./node_modules/d3-interpolate/src/transform/decompose.js","webpack://ideogram/./node_modules/d3-interpolate/src/transform/parse.js","webpack://ideogram/./node_modules/d3-interpolate/src/transform/index.js","webpack://ideogram/./node_modules/d3-transition/src/transition/tween.js","webpack://ideogram/./node_modules/d3-transition/src/transition/interpolate.js","webpack://ideogram/./node_modules/d3-transition/src/transition/attr.js","webpack://ideogram/./node_modules/d3-transition/src/transition/attrTween.js","webpack://ideogram/./node_modules/d3-transition/src/transition/delay.js","webpack://ideogram/./node_modules/d3-transition/src/transition/duration.js","webpack://ideogram/./node_modules/d3-transition/src/transition/selection.js","webpack://ideogram/./node_modules/d3-transition/src/transition/style.js","webpack://ideogram/./node_modules/d3-transition/src/transition/index.js","webpack://ideogram/./node_modules/d3-transition/src/transition/select.js","webpack://ideogram/./node_modules/d3-transition/src/transition/selectAll.js","webpack://ideogram/./node_modules/d3-transition/src/transition/filter.js","webpack://ideogram/./node_modules/d3-transition/src/transition/merge.js","webpack://ideogram/./node_modules/d3-transition/src/transition/transition.js","webpack://ideogram/./node_modules/d3-transition/src/transition/on.js","webpack://ideogram/./node_modules/d3-transition/src/transition/styleTween.js","webpack://ideogram/./node_modules/d3-transition/src/transition/text.js","webpack://ideogram/./node_modules/d3-transition/src/transition/textTween.js","webpack://ideogram/./node_modules/d3-transition/src/transition/remove.js","webpack://ideogram/./node_modules/d3-transition/src/transition/ease.js","webpack://ideogram/./node_modules/d3-transition/src/transition/easeVarying.js","webpack://ideogram/./node_modules/d3-transition/src/transition/end.js","webpack://ideogram/./node_modules/d3-transition/src/selection/transition.js","webpack://ideogram/./node_modules/d3-ease/src/cubic.js","webpack://ideogram/./node_modules/d3-transition/src/selection/index.js","webpack://ideogram/./node_modules/d3-transition/src/selection/interrupt.js","webpack://ideogram/./node_modules/d3-brush/src/constant.js","webpack://ideogram/./node_modules/d3-brush/src/event.js","webpack://ideogram/./node_modules/d3-brush/src/noevent.js","webpack://ideogram/./node_modules/d3-brush/src/brush.js","webpack://ideogram/./node_modules/d3-drag/src/nodrag.js","webpack://ideogram/./node_modules/d3-format/src/formatDecimal.js","webpack://ideogram/./node_modules/d3-format/src/exponent.js","webpack://ideogram/./node_modules/d3-format/src/formatSpecifier.js","webpack://ideogram/./node_modules/d3-format/src/formatPrefixAuto.js","webpack://ideogram/./node_modules/d3-format/src/formatRounded.js","webpack://ideogram/./node_modules/d3-format/src/formatTypes.js","webpack://ideogram/./node_modules/d3-format/src/identity.js","webpack://ideogram/./node_modules/d3-format/src/locale.js","webpack://ideogram/./node_modules/d3-format/src/defaultLocale.js","webpack://ideogram/./node_modules/d3-format/src/formatGroup.js","webpack://ideogram/./node_modules/d3-format/src/formatNumerals.js","webpack://ideogram/./node_modules/d3-format/src/formatTrim.js","webpack://ideogram/./node_modules/d3-format/src/precisionFixed.js","webpack://ideogram/./node_modules/d3-format/src/precisionPrefix.js","webpack://ideogram/./node_modules/d3-format/src/precisionRound.js","webpack://ideogram/./node_modules/d3-scale/node_modules/d3-array/src/ticks.js","webpack://ideogram/./node_modules/d3-scale/node_modules/d3-array/src/ascending.js","webpack://ideogram/./node_modules/d3-scale/node_modules/d3-array/src/descending.js","webpack://ideogram/./node_modules/d3-scale/node_modules/d3-array/src/bisector.js","webpack://ideogram/./node_modules/d3-scale/node_modules/d3-array/src/bisect.js","webpack://ideogram/./node_modules/d3-scale/node_modules/d3-array/src/number.js","webpack://ideogram/./node_modules/d3-interpolate/src/round.js","webpack://ideogram/./node_modules/d3-scale/src/number.js","webpack://ideogram/./node_modules/d3-scale/src/continuous.js","webpack://ideogram/./node_modules/d3-scale/src/constant.js","webpack://ideogram/./node_modules/d3-scale/src/init.js","webpack://ideogram/./node_modules/d3-scale/src/linear.js","webpack://ideogram/./node_modules/d3-scale/src/tickFormat.js","webpack://ideogram/./src/js/init/organism-metadata.js","webpack://ideogram/./src/js/lib.js","webpack://ideogram/./node_modules/d3-selection/src/selectAll.js","webpack://ideogram/./node_modules/d3-array/src/max.js","webpack://ideogram/./src/js/bands/styles.js","webpack://ideogram/./src/js/init/configure.js","webpack://ideogram/./src/js/collinear-vertical.js","webpack://ideogram/./src/js/collinear.js","webpack://ideogram/./node_modules/fflate/esm/browser.js","webpack://ideogram/./node_modules/workbox-core/_private/WorkboxError.js","webpack://ideogram/./node_modules/workbox-core/models/messages/messageGenerator.js","webpack://ideogram/./node_modules/workbox-range-requests/createPartialResponse.js","webpack://ideogram/./node_modules/workbox-range-requests/utils/parseRangeHeader.js","webpack://ideogram/./node_modules/workbox-range-requests/utils/calculateEffectiveBoundaries.js","webpack://ideogram/./src/js/init/caches/cache-lib.js","webpack://ideogram/./src/js/init/caches/gene-structure-cache-worker.js","webpack://ideogram/./src/js/init/caches/protein-cache-worker.js","webpack://ideogram/./src/js/init/caches/tissue-cache-worker.js","webpack://ideogram/./src/js/init/caches/cache.js","webpack://ideogram/./src/js/init/caches/gene-cache-worker.js","webpack://ideogram/./src/js/init/caches/paralog-cache-worker.js","webpack://ideogram/./src/js/init/caches/interaction-cache-worker.js","webpack://ideogram/./src/js/init/caches/synonym-cache-worker.js","webpack://ideogram/./src/js/init/finish-init.js","webpack://ideogram/./src/js/ploidy.js","webpack://ideogram/./src/js/views/chromosome-util.js","webpack://ideogram/./src/js/layouts/layout.js","webpack://ideogram/./src/js/layouts/vertical-layout.js","webpack://ideogram/./src/js/layouts/horizontal-layout.js","webpack://ideogram/./src/js/layouts/paired-layout.js","webpack://ideogram/./src/js/layouts/small-layout.js","webpack://ideogram/./src/js/init/write-container.js","webpack://ideogram/./src/js/layouts/layout-adapter.js","webpack://ideogram/./src/js/bands/fetch.js","webpack://ideogram/./src/js/init/init.js","webpack://ideogram/./src/js/parsers/bed-parser.js","webpack://ideogram/./src/js/parsers/tsv-parser.js","webpack://ideogram/./src/js/annotations/heatmap-lib.js","webpack://ideogram/./src/js/annotations/heatmap-collinear.js","webpack://ideogram/./src/js/annotations/heatmap-2d.js","webpack://ideogram/./src/js/annotations/track-labels.js","webpack://ideogram/./src/js/annotations/heatmap.js","webpack://ideogram/./src/js/annotations/track-labels-collinear.js","webpack://ideogram/./src/js/annotations/events.js","webpack://ideogram/./src/js/annotations/labels.js","webpack://ideogram/./src/js/annotations/histogram.js","webpack://ideogram/./src/js/annotations/legend.js","webpack://ideogram/./src/js/annotations/draw.js","webpack://ideogram/./src/js/annotations/synteny-lib.js","webpack://ideogram/./src/js/annotations/synteny-collinear.js","webpack://ideogram/./src/js/annotations/synteny-collinear-horizontal.js","webpack://ideogram/./src/js/annotations/synteny.js","webpack://ideogram/./src/js/annotations/filter.js","webpack://ideogram/./src/js/annotations/process.js","webpack://ideogram/./src/js/parsers/expression-matrix-parser.js","webpack://ideogram/./src/js/annotations/download.js","webpack://ideogram/./src/js/annotations/annotations.js","webpack://ideogram/./src/js/annotations/highlight.js","webpack://ideogram/./src/js/services/eutils-config.js","webpack://ideogram/./src/js/services/organisms.js","webpack://ideogram/./src/js/services/services.js","webpack://ideogram/./src/js/bands/show.js","webpack://ideogram/./src/js/bands/draw.js","webpack://ideogram/./src/js/bands/parse.js","webpack://ideogram/./src/js/bands/bands.js","webpack://ideogram/./src/js/brush.js","webpack://ideogram/./src/js/cursor.js","webpack://ideogram/./src/js/sex-chromosomes.js","webpack://ideogram/./src/js/coordinate-converters.js","webpack://ideogram/./node_modules/crossfilter2/src/array.js","webpack://ideogram/./node_modules/crossfilter2/src/filter.js","webpack://ideogram/./node_modules/crossfilter2/src/identity.js","webpack://ideogram/./node_modules/crossfilter2/src/null.js","webpack://ideogram/./node_modules/crossfilter2/src/zero.js","webpack://ideogram/./node_modules/crossfilter2/src/heap.js","webpack://ideogram/./node_modules/crossfilter2/src/heapselect.js","webpack://ideogram/./node_modules/crossfilter2/src/bisect.js","webpack://ideogram/./node_modules/crossfilter2/src/permute.js","webpack://ideogram/./node_modules/crossfilter2/src/reduce.js","webpack://ideogram/./node_modules/crossfilter2/src/result.js","webpack://ideogram/./node_modules/crossfilter2/src/index.js","webpack://ideogram/./node_modules/@ranfdev/deepobj/dist/deepobj.m.js","webpack://ideogram/./src/js/filter.js","webpack://ideogram/./src/js/views/chromosome-model.js","webpack://ideogram/./src/js/tools/tools.js","webpack://ideogram/./src/js/model-adapter.js","webpack://ideogram/./src/js/color.js","webpack://ideogram/./src/js/range.js","webpack://ideogram/./src/js/views/chromosome.js","webpack://ideogram/./src/js/views/draw-chromosomes.js","webpack://ideogram/./src/js/views/chromosome-labels.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getWindow.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/math.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/userAgent.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","webpack://ideogram/./node_modules/@popperjs/core/lib/enums.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/orderModifiers.js","webpack://ideogram/./node_modules/@popperjs/core/lib/createPopper.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/debounce.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/mergeByName.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/eventListeners.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getBasePlacement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getVariation.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/computeOffsets.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/computeStyles.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/applyStyles.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/offset.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/contains.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/rectToClientRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/expandToHashMap.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/detectOverflow.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/flip.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/within.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","webpack://ideogram/./node_modules/@popperjs/core/lib/utils/getAltAxis.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/arrow.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/hide.js","webpack://ideogram/./node_modules/@popperjs/core/lib/popper.js","webpack://ideogram/./node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","webpack://ideogram/./node_modules/tippy.js/dist/tippy.esm.js","webpack://ideogram/./src/js/kit/tippy-styles.js","webpack://ideogram/./src/js/kit/analyze-related-genes.js","webpack://ideogram/./src/js/kit/protein-color.js","webpack://ideogram/./src/js/kit/protein.js","webpack://ideogram/./src/js/kit/gene-structure.js","webpack://ideogram/./src/js/kit/wikipathways.js","webpack://ideogram/./node_modules/fast-kde/src/accessor.js","webpack://ideogram/./node_modules/fast-kde/src/deriche.js","webpack://ideogram/./node_modules/fast-kde/src/nrd.js","webpack://ideogram/./node_modules/fast-kde/src/density1d.js","webpack://ideogram/./node_modules/fast-kde/src/extent.js","webpack://ideogram/./node_modules/fast-kde/src/bin1d.js","webpack://ideogram/./src/js/kit/tissue.js","webpack://ideogram/./src/js/kit/related-genes.js","webpack://ideogram/./src/js/ideogram.js","webpack://ideogram/./src/js/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, () => {\nreturn ","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.0.0'] && _();\n}\ncatch (e) { }\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:range-requests:7.0.0'] && _();\n}\ncatch (e) { }\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var version = '1.45.1-beta';\nexport default version;\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","export default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return this.children;\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport array from \"../array.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = array(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n var group = select.apply(this, arguments);\n return group == null ? [] : array(group);\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n enter = typeof onenter === \"function\" ? onenter(enter) : enter.append(onenter + \"\");\n if (onupdate != null) update = onupdate(update);\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(selection) {\n if (!(selection instanceof Selection)) throw new Error(\"invalid merge\");\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","function responseBlob(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.blob();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseBlob);\n}\n","function responseArrayBuffer(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.arrayBuffer();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseArrayBuffer);\n}\n","var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"] || \\\"\\\"\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nfunction pad(value, width) {\n var s = value + \"\", length = s.length;\n return length < width ? new Array(width - length + 1).join(0) + s : s;\n}\n\nfunction formatYear(year) {\n return year < 0 ? \"-\" + pad(-year, 6)\n : year > 9999 ? \"+\" + pad(year, 6)\n : pad(year, 4);\n}\n\nfunction formatDate(date) {\n var hours = date.getUTCHours(),\n minutes = date.getUTCMinutes(),\n seconds = date.getUTCSeconds(),\n milliseconds = date.getUTCMilliseconds();\n return isNaN(date) ? \"Invalid Date\"\n : formatYear(date.getUTCFullYear(), 4) + \"-\" + pad(date.getUTCMonth() + 1, 2) + \"-\" + pad(date.getUTCDate(), 2)\n + (milliseconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \".\" + pad(milliseconds, 3) + \"Z\"\n : seconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \"Z\"\n : minutes || hours ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \"Z\"\n : \"\");\n}\n\nexport default function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function preformatBody(rows, columns) {\n return rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n });\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join(\"\\n\");\n }\n\n function formatBody(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return preformatBody(rows, columns).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(value) {\n return value == null ? \"\"\n : value instanceof Date ? formatDate(value)\n : reFormat.test(value += \"\") ? \"\\\"\" + value.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : value;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatBody: formatBody,\n formatRows: formatRows,\n formatRow: formatRow,\n formatValue: formatValue\n };\n}\n","import dsv from \"./dsv.js\";\n\nvar csv = dsv(\",\");\n\nexport var csvParse = csv.parse;\nexport var csvParseRows = csv.parseRows;\nexport var csvFormat = csv.format;\nexport var csvFormatBody = csv.formatBody;\nexport var csvFormatRows = csv.formatRows;\nexport var csvFormatRow = csv.formatRow;\nexport var csvFormatValue = csv.formatValue;\n","import dsv from \"./dsv.js\";\n\nvar tsv = dsv(\"\\t\");\n\nexport var tsvParse = tsv.parse;\nexport var tsvParseRows = tsv.parseRows;\nexport var tsvFormat = tsv.format;\nexport var tsvFormatBody = tsv.formatBody;\nexport var tsvFormatRows = tsv.formatRows;\nexport var tsvFormatRow = tsv.formatRow;\nexport var tsvFormatValue = tsv.formatValue;\n","function responseText(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.text();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseText);\n}\n","import {csvParse, dsvFormat, tsvParse} from \"d3-dsv\";\nimport text from \"./text.js\";\n\nfunction dsvParse(parse) {\n return function(input, init, row) {\n if (arguments.length === 2 && typeof init === \"function\") row = init, init = undefined;\n return text(input, init).then(function(response) {\n return parse(response, row);\n });\n };\n}\n\nexport default function dsv(delimiter, input, init, row) {\n if (arguments.length === 3 && typeof init === \"function\") row = init, init = undefined;\n var format = dsvFormat(delimiter);\n return text(input, init).then(function(response) {\n return format.parse(response, row);\n });\n}\n\nexport var csv = dsvParse(csvParse);\nexport var tsv = dsvParse(tsvParse);\n","export default function(input, init) {\n return new Promise(function(resolve, reject) {\n var image = new Image;\n for (var key in init) image[key] = init[key];\n image.onerror = reject;\n image.onload = function() { resolve(image); };\n image.src = input;\n });\n}\n","function responseJson(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n if (response.status === 204 || response.status === 205) return;\n return response.json();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseJson);\n}\n","import text from \"./text.js\";\n\nfunction parser(type) {\n return (input, init) => text(input, init)\n .then(text => (new DOMParser).parseFromString(text, type));\n}\n\nexport default parser(\"application/xml\");\n\nexport var html = parser(\"text/html\");\n\nexport var svg = parser(\"image/svg+xml\");\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n","export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","export default x => () => x;\n","export default function BrushEvent(type, {\n sourceEvent,\n target,\n selection,\n mode,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n selection: {value: selection, enumerable: true, configurable: true},\n mode: {value: mode, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n","export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n","import {select} from \"d3-selection\";\nimport noevent from \"./noevent.js\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, true);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, true);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n}\n\nexport function yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, true);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","var e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nexport default function ticks(start, stop, count) {\n var reverse,\n i = -1,\n n,\n ticks,\n step;\n\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n if (step > 0) {\n let r0 = Math.round(start / step), r1 = Math.round(stop / step);\n if (r0 * step < start) ++r0;\n if (r1 * step > stop) --r1;\n ticks = new Array(n = r1 - r0 + 1);\n while (++i < n) ticks[i] = (r0 + i) * step;\n } else {\n step = -step;\n let r0 = Math.round(start * step), r1 = Math.round(stop * step);\n if (r0 / step < start) ++r0;\n if (r1 / step > stop) --r1;\n ticks = new Array(n = r1 - r0 + 1);\n while (++i < n) ticks[i] = (r0 + i) / step;\n }\n\n if (reverse) ticks.reverse();\n\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log(step) / Math.LN10),\n error = step / Math.pow(10, power);\n return power >= 0\n ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nexport function tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count),\n step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n}\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","var organismMetadata = {\n 9606: {\n commonName: 'Human',\n scientificName: 'Homo sapiens',\n assemblies: {\n default: 'GCF_000001405.26', // GRCh38\n GRCh38: 'GCF_000001405.26',\n GRCh37: 'GCF_000001405.13',\n NCBI36: 'GCF_000001405.12'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasInteractionCache: true,\n hasGeneStructureCache: true,\n hasProteinCache: true,\n hasSynonymCache: true,\n hasTissueCache: true\n },\n 10090: {\n commonName: 'Mouse',\n scientificName: 'Mus musculus',\n assemblies: {\n default: 'GCF_000001635.27', // GRCm39\n GRCm39: 'GCF_000001635.27',\n GRCm38: 'GCF_000001635.20',\n MGSCv37: 'GCF_000001635.18'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasInteractionCache: true,\n hasGeneStructureCache: true,\n hasProteinCache: true,\n hasSynonymCache: true\n },\n 9598: {\n commonName: 'Chimpanzee',\n scientificName: 'Pan troglodytes',\n assemblies: {\n 'default': 'GCF_028858775.1',\n 'NHGRI_mPanTro3-v1.1-hic.freeze_pri': 'GCF_028858775.1',\n 'Pan_tro 3.0': 'GCF_000001515.7'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 10116: {\n commonName: 'Rat',\n scientificName: 'Rattus norvegicus',\n assemblies: {\n 'default': 'GCF_000001895.5',\n 'Rnor_6.0': 'GCF_000001895.5'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 3702: {\n commonName: 'Thale cress',\n scientificName: 'Arabidopsis thaliana',\n assemblies: {\n default: 'GCF_000001735.3', // TAIR10\n TAIR10: 'GCF_000001735.3'\n }\n },\n 4530: {\n commonName: 'Rice',\n scientificName: 'Oryza sativa',\n assemblies: {\n 'default': 'GCA_001433935.1',\n 'IRGSP-1.0': 'GCA_001433935.1'\n }\n },\n 4577: {\n commonName: 'Maize',\n scientificName: 'Zea mays',\n assemblies: {\n 'default': 'GCA_000005005.5',\n 'IRGSP-1.0': 'GCA_001433935.1'\n }\n },\n 4641: {\n commonName: 'Banana',\n scientificName: 'Musa acuminata',\n assemblies: {\n default: 'mock'\n }\n },\n 7227: {\n commonName: 'Fly',\n scientificName: 'Drosophila melanogaster',\n assemblies: {\n 'default': 'GCA_000001215.4',\n 'Release 6 plus ISO1 MT': 'GCA_000001215.4'\n },\n hasSynonymCache: true\n },\n 7165: {\n commonName: 'Mosquito',\n scientificName: 'Anopheles gambiae',\n assemblies: {\n default: 'GCF_000005575.2'\n }\n },\n 746128: {\n commonName: 'Aspergillis fumigatus',\n scientificName: 'Aspergillis fumigatus',\n assemblies: {\n default: 'GCF_000002655.1'\n }\n },\n 227321: {\n scientificName: 'Aspergillus nidulans',\n assemblies: {\n default: 'GCF_000149205.2'\n }\n },\n 5061: {\n commonName: 'black mold',\n scientificName: 'Aspergillus niger',\n assemblies: {\n default: 'GCF_003184595.1'\n }\n },\n 5062: {\n commonName: 'koji',\n scientificName: 'Aspergillus oryzae',\n assemblies: {\n default: 'GCF_000184455.2'\n }\n },\n 15368: {\n commonName: 'stiff brome',\n scientificName: 'Brachypodium distachyon',\n assemblies: {\n default: 'GCF_000005505.3'\n }\n },\n 60711: {\n commonName: 'green monkey',\n scientificName: 'Chlorocebus sabaeus',\n assemblies: {\n default: 'GCF_015252025.1'\n }\n },\n 7719: {\n commonName: 'Vase tunicate',\n scientificName: 'Ciona intestinalis',\n assemblies: {\n default: 'GCF_000224145.3'\n }\n },\n 9685: {\n commonName: 'Cat',\n scientificName: 'Felis catus',\n assemblies: {\n default: 'GCF_000181335.3'\n },\n hasGeneCache: true\n },\n 9031: {\n commonName: 'Chicken',\n scientificName: 'Gallus gallus',\n assemblies: {\n default: 'GCF_000002315.6'\n },\n hasGeneCache: true,\n hasParalogCache: true\n },\n 9593: {\n commonName: 'Gorilla',\n scientificName: 'Gorilla gorilla',\n assemblies: {\n default: 'GCF_008122165.1'\n }\n },\n 4513: {\n commonName: 'Barley',\n scientificName: 'Hordeum vulgare',\n assemblies: {\n default: 'GCA_901482405.1'\n }\n },\n 9541: {\n commonName: 'Crab-eating macaque',\n scientificName: 'Macaca fascicularis',\n assemblies: {\n default: 'GCF_000364345.1'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 9544: {\n commonName: 'Rhesus macaque',\n scientificName: 'Macaca mulatta',\n assemblies: {\n default: 'GCF_003339765.1'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 9597: {\n commonName: 'Bonobo',\n scientificName: 'Pan paniscus',\n assemblies: {\n default: 'GCF_013052645.1'\n }\n },\n 9615: {\n commonName: 'Dog',\n scientificName: 'Canis lupus familiaris',\n assemblies: {\n default: 'GCF_014441545.1'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 9823: {\n commonName: 'Pig',\n scientificName: 'Sus scrofa',\n assemblies: {\n default: 'GCF_000003025.6'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 4932: {\n commonName: 'Yeast',\n scientificName: 'Saccharomyces cerevisiae',\n assemblies: {\n default: 'GCA_000146045.2',\n R64: 'GCA_000146045.2'\n }\n },\n 5833: {\n commonName: 'malaria parasite',\n scientificName: 'Plasmodium falciparum',\n assemblies: {\n default: 'GCA_000002765.3',\n GCA_000002765: 'GCA_000002765.3'\n }\n },\n 6239: {\n commonName: 'worm',\n scientificName: 'Caenorhabditis elegans',\n assemblies: {\n default: 'GCF_000002985.6'\n },\n hasGeneCache: true,\n hasParalogCache: true,\n hasSynonymCache: true\n },\n 4081: {\n commonName: 'tomato',\n scientificName: 'Solanum lycopersicum',\n assemblies: {\n default: 'GCF_000188115.4'\n }\n },\n 4072: {\n commonName: 'pepper',\n scientificName: 'Capsicum annuum',\n assemblies: {\n default: 'GCF_000710875.1'\n }\n },\n 3694: {\n commonName: 'black cottonwood',\n scientificName: 'Populus trichocarpa',\n assemblies: {\n default: 'GCF_000002775.5'\n }\n }\n};\n\nexport {organismMetadata};\n","/**\n * @fileoverview A collection of Ideogram methods that don't fit elsewhere.\n */\n\nimport {select, selectAll} from 'd3-selection';\nimport * as d3fetch from 'd3-fetch';\nimport * as d3brush from 'd3-brush';\nimport * as d3dispatch from 'd3-dispatch';\nimport * as d3format from 'd3-format';\nimport {scaleLinear} from 'd3-scale';\nimport {max} from 'd3-array';\n\nimport {organismMetadata} from './init/organism-metadata';\n\nvar d3 = Object.assign(\n {}, d3fetch, d3brush, d3dispatch, d3format\n);\n\nd3.select = select;\nd3.selectAll = selectAll;\nd3.scaleLinear = scaleLinear;\nd3.max = max;\n\n/**\n * Is the assembly in this.config an NCBI Assembly accession?\n *\n * @returns {boolean}\n */\nfunction assemblyIsAccession() {\n return (\n 'assembly' in this.config &&\n /(GCF_|GCA_)/.test(this.config.assembly)\n );\n}\n\n/**\n * Is the assembly in this.config not from GenBank?\n *\n * @returns {boolean}\n */\nfunction hasNonGenBankAssembly(ideo) {\n return (\n 'assembly' in ideo.config &&\n /(GCA_)/.test(ideo.config.assembly) === false\n );\n}\n\n/**\n * Is the assembly in this.config from GenBank?\n *\n * @returns {boolean}\n */\nfunction hasGenBankAssembly(ideo) {\n return (\n 'assembly' in ideo.config &&\n /(GCA_)/.test(ideo.config.assembly)\n );\n}\n\nfunction getDir(dir) {\n var script, tmp, protocol, dataDir, ideogramInLeaf,\n scripts = document.scripts,\n version = Ideogram.version;\n\n if (location.pathname.includes('/examples/vanilla/') === false) {\n return (\n `https://cdn.jsdelivr.net/npm/ideogram@${version}/dist/data/${dir}`\n );\n }\n\n for (var i = 0; i < scripts.length; i++) {\n script = scripts[i];\n ideogramInLeaf = /ideogram/.test(script.src.split('/').slice(-1));\n if ('src' in script && ideogramInLeaf) {\n tmp = script.src.split('//');\n protocol = tmp[0];\n tmp = '/' + tmp[1].split('/').slice(0, -2).join('/');\n dataDir = protocol + '//' + tmp + '/data/' + dir;\n return dataDir;\n }\n }\n\n return '../data/' + dir;\n}\n\n/** Try request, and if failed then retry with URL lacking extension */\nfunction fetchWithRetry(url, isRetry=false) {\n return fetch(url)\n .then((response) => {\n if (response.ok) {\n return response;\n } else {\n if (isRetry === false) {\n var urlWithoutExtension = url.replace('.json', '');\n return fetchWithRetry(urlWithoutExtension, true);\n } else {\n throw Error('Fetch failed for ' + url);\n }\n }\n });\n}\n\n/**\n * Returns directory used to fetch data for bands and annotations\n *\n * This simplifies ideogram configuration. By default, the dataDir is\n * set to an external CDN unless we're serving from the local Ideogram\n * working directory\n *\n * @returns {String}\n */\nfunction getDataDir() {\n return getDir('bands/native/');\n}\n\n/**\n * Rounds a float (e.g. SVG coordinate) to two decimal places\n *\n * @param coord Floating-point number, e.g. 42.1234567890\n * @returns {number} Rounded value, e.g. 42.12\n */\nfunction round(coord) {\n // Per http://stackoverflow.com/a/9453447, below method is fastest\n return Math.round(coord * 100) / 100;\n}\n\n/**\n * Convert e.g. 1000 to 1 k, 1500000 to 1.5 M, etc.\n * Used to format 1500000 base pairs to e.g. 1.5 Mbp\n *\n * Adapted from https://stackoverflow.com/a/9462382/10564415\n */\nfunction formatSiPrefix(num, digits) {\n const lookup = [\n {value: 1, symbol: ''},\n {value: 1e3, symbol: 'k'},\n {value: 1e6, symbol: 'M'},\n {value: 1e9, symbol: 'G'},\n {value: 1e12, symbol: 'T'},\n {value: 1e15, symbol: 'P'},\n {value: 1e18, symbol: 'E'}\n ];\n const rx = /\\.0+$|(\\.[0-9]*[1-9])0+$/;\n var item = lookup.slice().reverse().find(function(item) {\n return num >= item.value;\n });\n // eslint-disable-next-line max-len\n return item ? (num / item.value).toFixed(digits).replace(rx, '$1') + ' ' + item.symbol : '0';\n}\n\nfunction onDidRotate(chrModel) {\n call(this.onDidRotateCallback, chrModel);\n}\n\n/**\n * Get ideogram SVG container\n */\nfunction getSvg() {\n return d3.select(this.selector).node();\n}\n\n/** Request data with Ideogram's authorization bearer token */\nfunction fetchWithAuth(url, contentType) {\n var ideo = this,\n config = ideo.config,\n headers = new Headers();\n\n if (config.accessToken) {\n headers = new Headers({Authorization: 'Bearer ' + config.accessToken});\n }\n\n if (contentType === 'text') {\n return d3.text(url, {headers: headers});\n } else {\n return d3.json(url, {headers: headers});\n }\n}\n\n/** getTaxid(), but without need to initialize ideogram */\nfunction getEarlyTaxid(name) {\n name = slug(name);\n for (const taxid in organismMetadata) {\n const organism = organismMetadata[taxid];\n const commonName = slug(organism.commonName);\n const scientificName = slug(organism.scientificName);\n if (commonName === name || scientificName === name) {\n return taxid;\n }\n }\n\n return null;\n}\n\n/**\n * Get organism's taxid (NCBI Taxonomy ID) given its common or scientific name\n */\nfunction getTaxid(name) {\n var organism, taxid, commonName, scientificName,\n ideo = this,\n organisms = ideo.organisms;\n\n name = slug(name);\n\n for (taxid in organisms) {\n organism = organisms[taxid];\n commonName = slug(organism.commonName);\n scientificName = slug(organism.scientificName);\n if (commonName === name || scientificName === name) {\n return taxid;\n }\n }\n\n return null;\n}\n\n/**\n * Get organism's common name given its taxid\n */\nfunction getCommonName(taxid) {\n var ideo = this;\n if (taxid in ideo.organisms) {\n return ideo.organisms[taxid].commonName;\n }\n return null;\n}\n\n/**\n * Get organism's scientific name given its taxid\n */\nfunction getScientificName(taxid) {\n var ideo = this;\n if (taxid in ideo.organisms) {\n return ideo.organisms[taxid].scientificName;\n }\n return null;\n}\n\n/** Convert string to camelcase */\nexport function camel(str) {\n const camelCaseString = str\n .split(/[ _-]/g)\n .map((token, i) => {\n if (i > 0) {\n return token[0].toUpperCase() + token.slice(1);\n } else {\n return token;\n }\n })\n .join('');\n\n return camelCaseString;\n}\n\n/**\n* Examples:\n* \"Homo sapiens\" -> \"homo-sapiens\"\n* \"Canis lupus familiaris\" -> \"canis-lupus-familiaris\"\n*/\nfunction slug(value) {\n if (typeof value === 'undefined') return '';\n return value.toLowerCase().replace(/ /g, '-');\n}\n\n// Determine if a string is a Roman numeral\n// From https://stackoverflow.com/a/48601418\nfunction isRoman(s) {\n // http://stackoverflow.com/a/267405/1447675\n return /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(s);\n}\n\n// Convert Roman numeral to integer\n// From https://stackoverflow.com/a/48601418\nfunction parseRoman(s) {\n var val = {M: 1000, D: 500, C: 100, L: 50, X: 10, V: 5, I: 1};\n return s.toUpperCase().split('').reduce(function(r, a, i, aa) {\n return val[a] < val[aa[i + 1]] ? r - val[a] : r + val[a];\n }, 0);\n}\n\n/**\n* Download a PNG image of the ideogram\n*\n* Includes any annotations, but not legend.\n*/\nfunction downloadPng(ideo) {\n var ideoSvg = document.querySelector(ideo.selector);\n\n // Create a hidden canvas. This will contain the raster image to download.\n var canvas = document.createElement('canvas');\n var canvasId = '_ideo-undisplayed-dl-canvas';\n canvas.setAttribute('style', 'display: none');\n canvas.setAttribute('id', canvasId);\n var width = ideoSvg.width.baseVal.value + 30;\n var ideoSvgClone = ideoSvg.cloneNode(true);\n ideoSvgClone.style.left = '';\n canvas.setAttribute('width', width);\n document.body.appendChild(canvas);\n\n // Called after PNG image is created from data URL\n function triggerDownload(imgUrl) {\n var evt = new MouseEvent('click', {\n view: window,\n bubbles: false,\n cancelable: true\n });\n\n var a = document.createElement('a');\n a.setAttribute('download', 'ideogram.png');\n a.setAttribute('href', imgUrl);\n a.setAttribute('target', '_blank');\n\n // Enables easy testing\n a.setAttribute('id', '_ideo-undisplayed-dl-image-link');\n a.setAttribute('style', 'display: none;');\n document.body.appendChild(a);\n\n a.dispatchEvent(evt);\n canvas.remove();\n }\n\n var canvas = document.getElementById(canvasId);\n\n // Enlarge canvas and disable smoothing, for higher resolution PNG\n canvas.width *= 2;\n canvas.height *= 2;\n var ctx = canvas.getContext('2d');\n ctx.setTransform(2, 0, 0, 2, 0, 0);\n ctx.imageSmoothingEnabled = false;\n\n var data = (new XMLSerializer()).serializeToString(ideoSvgClone);\n var domUrl = window.URL || window.webkitURL || window;\n\n var img = new Image();\n var svgBlob = new Blob([data], {type: 'image/svg+xml;charset=utf-8'});\n var url = domUrl.createObjectURL(svgBlob);\n\n img.onload = function() {\n ctx.drawImage(img, 0, 0);\n domUrl.revokeObjectURL(url);\n\n var imgUrl = canvas\n .toDataURL('image/png')\n .replace('image/png', 'image/octet-stream');\n\n triggerDownload(imgUrl);\n };\n\n img.src = url;\n}\n\nfunction getFont(ideo) {\n const config = ideo.config;\n\n let family = 'sans-serif';\n if (config.fontFamily) {\n family = config.fontFamily;\n }\n let weight = 600;\n if (config.fontWeight) {\n weight = config.fontWeight;\n }\n\n const labelSize = config.annotLabelSize ? config.annotLabelSize : 13;\n const font = weight + ' ' + labelSize + 'px ' + family;\n\n return font;\n}\n\n/**\n * Get width and height of given text in pixels.\n *\n * Background: https://erikonarheim.com/posts/canvas-text-metrics/\n */\nfunction getTextSize(text, ideo) {\n var font = getFont(ideo);\n\n // re-use canvas object for better performance\n var canvas =\n getTextSize.canvas ||\n (getTextSize.canvas = document.createElement('canvas'));\n var context = canvas.getContext('2d');\n context.font = font;\n var metrics = context.measureText(text);\n\n // metrics.width is less precise than technique below\n var right = metrics.actualBoundingBoxRight;\n var left = metrics.actualBoundingBoxLeft;\n var width = Math.abs(left) + Math.abs(right);\n\n const height =\n Math.abs(metrics.actualBoundingBoxAscent) +\n Math.abs(metrics.actualBoundingBoxDescent);\n\n return {width, height};\n}\n\n/** Clone a nested array */\nfunction deepCopy(array) {\n return JSON.parse(JSON.stringify(array));\n}\n\n/** Naively pluralizes a word, if count is > 1 */\nexport function pluralize(word, count) {\n return word + (count > 1 ? 's' : '');\n}\n\n/**\n * Convert hexadecimal color to RGB color\n * Source: https://stackoverflow.com/a/5624139/10564415\n */\nexport function hexToRgb(hex) {\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n var shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16)\n } : null;\n}\n\n// http://stackoverflow.com/a/5624139\nfunction componentToHex(c) {\n var hex = parseInt(c, 10).toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n}\n\nfunction rgbToHex(r, g, b) {\n return (\n '#' +\n componentToHex(r) +\n componentToHex(g) +\n componentToHex(b)\n );\n}\n\nfunction rgbColorToHex(color) {\n const rgb = color.split('rgb(')[1].trim(')').split(', ');\n const hex = rgbToHex(rgb[0], rgb[1], rgb[2]);\n return hex;\n}\n\n/**\n * If hex color is low contrast with white, then darken it.\n *\n * @param {String} color Initial color that fills the shape, in hex\n */\nexport function ensureContrast(color, bgColor='#FFF') {\n if (color.slice(0, 3) === 'rgb') color = rgbColorToHex(color);\n if (color[0] !== '#') return color; // preserve non-hex color, e.g. \"purple\"\n const rgb = hexToRgb(color);\n\n if (bgColor === '#FFF') {\n // If low contrast, darken\n if (rgb.r > 150 && rgb.g > 150 && rgb.b > 150) {\n color = `rgb(${rgb.r - 30}, ${rgb.g - 30}, ${rgb.b - 30})`;\n }\n\n // If lower contrast, darken more\n if (rgb.r > 200 && rgb.g > 200 && rgb.b > 200) {\n color = `rgb(${rgb.r - 50}, ${rgb.g - 50}, ${rgb.b - 50})`;\n }\n } else {\n const bgRgb = hexToRgb(bgColor);\n const contrast = getContrast(\n [rgb.r, rgb.g, rgb.b],\n [bgRgb.r, bgRgb.g, bgRgb.b]\n );\n if (contrast < 3) {\n color = `rgb(230, 230, 230)`;\n }\n }\n\n return color;\n}\n\n/** https://stackoverflow.com/a/9733420 */\nconst RED = 0.2126;\nconst GREEN = 0.7152;\nconst BLUE = 0.0722;\n\nconst GAMMA = 2.4;\n\n/** https://stackoverflow.com/a/9733420 */\nfunction luminance(r, g, b) {\n var a = [r, g, b].map((v) => {\n v /= 255;\n return (\n v <= 0.03928\n ? v / 12.92\n : Math.pow((v + 0.055) / 1.055, GAMMA)\n );\n });\n return a[0] * RED + a[1] * GREEN + a[2] * BLUE;\n}\n\n/** https://stackoverflow.com/a/9733420 */\nfunction getContrast(rgb1, rgb2) {\n var lum1 = luminance(...rgb1);\n var lum2 = luminance(...rgb2);\n var brightest = Math.max(lum1, lum2);\n var darkest = Math.min(lum1, lum2);\n return (brightest + 0.05) / (darkest + 0.05);\n}\n\n\nexport function adjustBrightness(color, brightness) {\n if (color[0] !== '#') return color; // preserve non-hex color, e.g. \"purple\"\n const rgb = hexToRgb(color);\n const br = brightness;\n const newRgb = {r: rgb.r * br, g: rgb.g * br, b: rgb.b * br};\n const newColor = `rgb(${newRgb.r}, ${newRgb.g}, ${newRgb.b})`;\n\n return newColor;\n}\n\nexport function getTippyConfig() {\n return {\n theme: 'light-border',\n allowHTML: true,\n popperOptions: { // Docs: https://atomiks.github.io/tippyjs/v6/all-props/#popperoptions\n modifiers: [ // Docs: https://popper.js.org/docs/v2/modifiers\n {\n name: 'flip'\n }\n ]\n },\n onShow: function() {\n // Ensure only 1 tippy tooltip is displayed at a time\n document.querySelectorAll('[data-tippy-root]')\n .forEach(tippyNode => tippyNode.remove());\n }\n };\n}\n\nexport {\n assemblyIsAccession, hasNonGenBankAssembly, hasGenBankAssembly, getDataDir,\n getDir, round, formatSiPrefix, onDidRotate, getSvg, d3, getEarlyTaxid,\n getTaxid, getCommonName, getScientificName, slug, isRoman, parseRoman,\n downloadPng, fetchWithRetry, getTextSize, getFont, deepCopy,\n fetchWithAuth as fetch\n};\n","import array from \"./array.js\";\nimport {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([document.querySelectorAll(selector)], [document.documentElement])\n : new Selection([selector == null ? [] : array(selector)], root);\n}\n","export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n","var staticColors, staticCss, staticGradients;\n\n// Gradient colors for each class, for polished rendering\nstaticColors = [\n ['gneg', '#FFF', '#FFF', '#DDD'],\n ['gpos25', '#C8C8C8', '#DDD', '#BBB'],\n ['gpos33', '#BBB', '#BBB', '#AAA'],\n ['gpos50', '#999', '#AAA', '#888'],\n ['gpos66', '#888', '#888', '#666'],\n ['gpos75', '#777', '#777', '#444'],\n ['gpos100', '#444', '#666', '#000'],\n ['acen', '#FEE', '#FEE', '#FDD'],\n ['noBands', '#BBB', '#BBB', '#AAA']\n];\n\nstaticCss =\n '#_ideogram {padding-left: 5px;} ' +\n '#_ideogram .labeled {padding-left: 15px;} ' +\n '#_ideogram.labeledLeft {padding-left: 15px; padding-top: 15px;} ' +\n // Tahoma has great readability and space utilization at small sizes\n // More: http://ux.stackexchange.com/a/3334\n '#_ideogram text {font: 9px Tahoma; fill: #000;} ' +\n '#_ideogram .italic {font-style: italic;} ' +\n '#_ideogram .chromosome {cursor: pointer; fill: #AAA;}' +\n '#_ideogram.no-rotate .chromosome {cursor: default;} ' +\n '#_ideogram .chrLabel, #_ideogram .annot {cursor: pointer;}' +\n '#_ideogram .chrSetLabel {font-weight: bolder;}' +\n '#_ideogram .ghost {opacity: 0.2;}' +\n '#_ideogram .hidden {display: none;}' +\n '#_ideogram .bandLabelStalk line {stroke: #AAA; stroke-width: 1;}' +\n '#_ideogram .syntenyBorder {stroke:#AAA;stroke-width:1;}' +\n '#_ideogram rect.cursor {' +\n ' fill: #F00;' +\n ' stroke: #F00;' +\n ' fill-opacity: .3;' +\n ' shape-rendering: crispEdges;' +\n '}' +\n '#_ideogram .brush .selection {' +\n ' fill: #F00;' +\n ' stroke: #F00;' +\n ' fill-opacity: .3;' +\n ' shape-rendering: crispEdges;' +\n '}' +\n '#_ideogram .noBands {fill: #AAA;}' +\n // NCBI stain density colors\n '#_ideogram .gneg {fill: #FFF}' +\n '#_ideogram .gpos25 {fill: #BBB}' +\n '#_ideogram .gpos33 {fill: #AAA}' +\n '#_ideogram .gpos50 {fill: #888}' +\n '#_ideogram .gpos66 {fill: #666}' +\n '#_ideogram .gpos75 {fill: #444}' +\n '#_ideogram .gpos100 {fill: #000}' +\n '#_ideogram .gpos {fill: #000}' +\n '#_ideogram .acen {fill: #FDD}' +\n '#_ideogram .stalk {fill: #CCE;}' +\n '#_ideogram .gvar {fill: #DDF}' +\n // Used when overlaid with annotations\n '#_ideogram.faint .gneg {fill: #FFF}' +\n '#_ideogram.faint .gpos25 {fill: #EEE}' +\n '#_ideogram.faint .gpos33 {fill: #EEE}' +\n '#_ideogram.faint .gpos50 {fill: #EEE}' +\n '#_ideogram.faint .gpos66 {fill: #EEE}' +\n '#_ideogram.faint .gpos75 {fill: #EEE}' +\n '#_ideogram.faint .gpos100 {fill: #DDD}' +\n '#_ideogram.faint .gpos {fill: #DDD}' +\n '#_ideogram.faint .acen {fill: #FEE}' +\n '#_ideogram.faint .stalk {fill: #EEF;}' +\n '#_ideogram.faint .gvar {fill: #EEF}' +\n // For sheen, i.e. the soft shine in chromosomes\n '#_ideogram .gneg {fill: url(\"#gneg\")} ' +\n '#_ideogram .gpos25 {fill: url(\"#gpos25\")} ' +\n '#_ideogram .gpos33 {fill: url(\"#gpos33\")} ' +\n '#_ideogram .gpos50 {fill: url(\"#gpos50\")} ' +\n '#_ideogram .gpos66 {fill: url(\"#gpos66\")} ' +\n '#_ideogram .gpos75 {fill: url(\"#gpos75\")} ' +\n '#_ideogram .gpos100 {fill: url(\"#gpos100\")} ' +\n '#_ideogram .gpos {fill: url(\"#gpos100\")} ' +\n '#_ideogram .acen {fill: url(\"#acen\")} ' +\n '#_ideogram .stalk {fill: url(\"#stalk\")} ' +\n '#_ideogram .gvar {fill: url(\"#gvar\")} ' +\n '#_ideogram .noBands {fill: url(\"#noBands\")} ' +\n '#_ideogram .chromosome {fill: url(\"#noBands\")} ';\n\nstaticGradients =\n '' +\n ' ' +\n '' +\n '' +\n '' +\n ' ' +\n '' +\n '';\n\nexport {staticColors, staticCss, staticGradients};\n","import {organismMetadata} from './organism-metadata';\nimport {staticCss} from './../bands/styles';\n\nfunction configurePloidy(ideo) {\n if (!ideo.config.ploidy) ideo.config.ploidy = 1;\n\n if (ideo.config.ploidy > 1) {\n ideo.sexChromosomes = {};\n if (!ideo.config.sex) {\n // Default to 'male' per human, mouse reference genomes.\n // TODO: The default sex value should probably be the heterogametic sex,\n // i.e. whichever sex has allosomes that differ in morphology.\n // In mammals and most insects that is the male.\n // However, in birds and reptiles, that is female.\n ideo.config.sex = 'male';\n }\n if (ideo.config.ploidy === 2 && !ideo.config.ancestors) {\n ideo.config.ancestors = {M: '#ffb6c1', P: '#add8e6'};\n ideo.config.ploidyDesc = 'MP';\n }\n }\n}\n\nfunction configureHeight(ideo) {\n var container, rect, chrHeight;\n\n if (!ideo.config.chrHeight) {\n container = ideo.config.container;\n rect = document.querySelector(container).getBoundingClientRect();\n\n if (ideo.config.orientation === 'vertical') {\n chrHeight = rect.height;\n } else {\n chrHeight = rect.width;\n }\n\n if (container === 'body' || chrHeight === 0) chrHeight = 400;\n ideo.config.chrHeight = chrHeight;\n }\n}\n\nfunction configureWidth(ideo) {\n var chrWidth, chrHeight;\n\n if (!ideo.config.chrWidth) {\n chrWidth = 10;\n chrHeight = ideo.config.chrHeight;\n\n if (chrHeight < 900 && chrHeight > 500) {\n chrWidth = Math.round(chrHeight / 40);\n } else if (chrHeight >= 900) {\n chrWidth = Math.round(chrHeight / 45);\n }\n ideo.config.chrWidth = chrWidth;\n }\n}\n\nfunction configureMargin(ideo) {\n if (ideo.config.geometry && ideo.config.geometry === 'collinear') {\n if ('chrMargin' in ideo.config === false) {\n ideo.config.chrMargin = 0;\n }\n return;\n }\n if (!ideo.config.chrMargin) {\n if (ideo.config.ploidy === 1) {\n ideo.config.chrMargin = 10;\n } else {\n // Defaults polyploid chromosomes to relatively small interchromatid gap\n ideo.config.chrMargin = Math.round(ideo.config.chrWidth / 4);\n }\n }\n if (ideo.config.showBandLabels) ideo.config.chrMargin += 20;\n}\n\nfunction configureBump(ideo) {\n ideo.bump = Math.round(ideo.config.chrHeight / 125);\n ideo.adjustedBump = false;\n if (ideo.config.chrHeight < 200) {\n ideo.adjustedBump = true;\n ideo.bump = 4;\n }\n}\n\nfunction configureSingleChromosome(config, ideo) {\n if (config.chromosome) {\n ideo.config.chromosomes = [config.chromosome];\n if ('showBandLabels' in config === false) {\n ideo.config.showBandLabels = true;\n }\n if ('rotatable' in config === false) ideo.config.rotatable = false;\n }\n}\n\nfunction configureOrganisms(config, ideo) {\n ideo.organisms = Object.assign({}, organismMetadata);\n if (config.taxid && config.organismMetadata) ideo.organisms[config.taxid] = config.organismMetadata\n ideo.organismsWithBands = Object.assign({}, ideo.organisms);\n}\n\nfunction configureCallbacks(config, ideo) {\n if (config.onLoad) ideo.onLoadCallback = config.onLoad;\n if (config.onLoadAnnots) ideo.onLoadAnnotsCallback = config.onLoadAnnots;\n if (config.onBeforeDrawAnnots) {\n ideo.onBeforeDrawAnnotsCallback = config.onBeforeDrawAnnots;\n }\n if (config.onDrawAnnots) ideo.onDrawAnnotsCallback = config.onDrawAnnots;\n if (config.onBrushMove) ideo.onBrushMoveCallback = config.onBrushMove;\n if (config.onBrushEnd) ideo.onBrushEndCallback = config.onBrushEnd;\n if (config.onCursorMove) ideo.onCursorMoveCallback = config.onCursorMove;\n if (config.onDidRotate) ideo.onDidRotateCallback = config.onDidRotate;\n if (config.onWillShowAnnotTooltip) {\n ideo.onWillShowAnnotTooltipCallback = config.onWillShowAnnotTooltip;\n }\n if (config.onDidShowAnnotTooltip) {\n ideo.onDidShowAnnotTooltipCallback = config.onDidShowAnnotTooltip;\n }\n if (config.onClickAnnot) {\n ideo.onClickAnnotCallback = config.onClickAnnot;\n }\n}\n\nfunction configureMiscellaneous(ideo) {\n ideo.chromosomesArray = [];\n ideo.coordinateSystem = 'iscn';\n ideo.maxLength = {bp: 0, iscn: 0};\n ideo.chromosomes = {};\n ideo.numChromosomes = 0;\n if (!ideo.config.debug) ideo.config.debug = false;\n if (!ideo.config.dataDir) ideo.config.dataDir = ideo.getDataDir();\n if (!ideo.config.container) ideo.config.container = 'body';\n ideo.selector = ideo.config.container + ' #_ideogram';\n if (!ideo.config.resolution) ideo.config.resolution = '';\n if (!ideo.config.orientation) ideo.config.orientation = 'vertical';\n if (!ideo.config.brush) ideo.config.brush = null;\n if (!ideo.config.rows) ideo.config.rows = 1;\n if ('showChromosomeLabels' in ideo.config === false) {\n ideo.config.showChromosomeLabels = true;\n }\n if (!ideo.config.showNonNuclearChromosomes) {\n ideo.config.showNonNuclearChromosomes = false;\n }\n if (!ideo.config.chromosomeScale) {\n ideo.config.chromosomeScale = 'absolute';\n }\n if (!ideo.config.showTools) ideo.config.showTools = false;\n}\n\nfunction configureBands(ideo) {\n if (!ideo.config.showBandLabels) ideo.config.showBandLabels = false;\n\n if ('showFullyBanded' in ideo.config === false) {\n ideo.config.showFullyBanded = true;\n }\n\n ideo.bandsToShow = [];\n ideo.bandData = {};\n}\n\nlet configuredCss = staticCss;\nfunction configureTextStyle(ideo) {\n const config = ideo.config;\n if (!config.chrLabelSize) ideo.config.chrLabelSize = 9;\n if (!config.chrLabelColor) ideo.config.chrLabelColor = '#000';\n if (!config.fontFamily) ideo.config.fontFamily = '';\n\n const size = `font-size: ${config.chrLabelSize}px`;\n const color = `fill: ${config.chrLabelColor}`;\n const fontFamily = `font-family: ${config.fontFamily}`;\n configuredCss += `#_ideogram text {${fontFamily}; ${size}; ${color};}`;\n configuredCss += `#_ideogramLabel text {${fontFamily};}`;\n}\n\n/**\n * High-level helper method for Ideogram constructor.\n *\n * @param config Configuration object. Enables setting Ideogram properties.\n *\n * Docs: https://github.com/eweitz/ideogram/blob/master/api.md\n */\nfunction configure(config) {\n // Clone the config object, to allow multiple instantiations\n // without picking up prior ideogram's settings\n this.config = JSON.parse(JSON.stringify(config));\n\n configureMiscellaneous(this);\n configurePloidy(this);\n configureBands(this);\n configureHeight(this);\n configureWidth(this);\n configureMargin(this);\n configureCallbacks(config, this);\n configureOrganisms(config, this);\n configureBump(this);\n configureSingleChromosome(config, this);\n configureTextStyle(this);\n this.initAnnotSettings();\n if (!this.config.geometry || this.config.geometry === 'parallel') {\n this.config.chrMargin += this.config.chrWidth;\n if (this.config.annotationsLayout === 'heatmap') {\n this.config.chrMargin += this.config.annotTracksHeight;\n } else {\n this.config.chrMargin += this.config.annotTracksHeight * 2;\n }\n }\n this.init();\n}\n\nexport {configure, configuredCss};\n","/**\n * @fileoverview Functions for collinear chromosomes.\n * Collinear chromosomes form a line together, unlike the default parallel\n * geometry.\n */\n\nimport {d3} from './lib';\n\nfunction labelGenomes(ideo) {\n\n ideo.config.taxids.forEach((taxid, i) => {\n var org = ideo.organisms[taxid];\n // var commonName = slug(org.commonName);\n var scientificName = org.scientificName;\n d3.select(ideo.selector)\n .append('text')\n .attr('class', 'genomeLabel italic')\n .attr('x', 55 + 200 * i)\n .attr('y', 10)\n .text(scientificName)\n .attr('text-anchor', 'middle');\n });\n}\n\n/**\n* Rearrange chromosomes from parallel vertical to collinear vertical\n*\n* Parallel vertical (as in https://eweitz.github.io/ideogram/human)\n* | | |\n*\n* Collinear vertical (as in https://eweitz.github.io/ideogram/orthologs?loci=2:150000000,5:20000000;3:100000000,10:80000000&org=homo-sapiens&org2=mus-musculus)\n* |\n* |\n* |\n*/\nfunction rearrangeChromosomes(chrSets, yOffsets, x, ideo) {\n var i, chrSet, y, chrLabelX, adjustedX, chr, taxid, orgIndex,\n config = ideo.config,\n chrLabelSize = config.chrLabelSize;\n\n for (i = 0; i < chrSets.length; i++) {\n chrSet = chrSets[i];\n y = yOffsets[i] + 23 - chrLabelSize;\n\n chr = ideo.chromosomesArray[i];\n taxid = chr.id.split('-')[1];\n orgIndex = ideo.config.taxids.indexOf(taxid);\n adjustedX = x - orgIndex * 200 - 30 - 5;\n if (orgIndex === 0) {\n chrLabelX = -34;\n adjustedX += ideo.config.chrWidth * 2 - 16;\n } else {\n chrLabelX = ideo.config.chrWidth * 2 - 24;\n }\n\n if (config.showChromosomeLabels) {\n const labelSpan = chrSet.querySelector('.chrLabel > tspan');\n labelSpan.setAttribute('x', chrLabelX);\n labelSpan.setAttribute('dy', chrLabelSize - 8);\n chrSet.querySelector('.chrLabel').setAttribute('text-anchor', 'start');\n }\n chrSet.setAttribute(\n 'transform', 'rotate(90) translate(' + y + ',' + adjustedX + ')'\n );\n chrSet.querySelector('.chromosome').setAttribute(\n 'transform', 'translate(-13, 10)'\n );\n }\n\n labelGenomes(ideo);\n}\n\n/**\n* Get pixel coordinates to use for rearrangement\n*/\nfunction getYOffsets(chrSets, ideo) {\n var yOffsets, i, index, chr, prevChr, y, prevWidth, prevY, yBump, taxid,\n seenTaxids = {};\n\n yOffsets = [];\n for (i = 0; i < chrSets.length; i++) {\n chr = ideo.chromosomesArray[i];\n taxid = chr.id.split('-')[1];\n index = (i === 0) ? i : i - 1;\n prevChr = ideo.chromosomesArray[index];\n if (i === 0 || taxid in seenTaxids === false) {\n y = 20;\n seenTaxids[taxid] = 1;\n } else {\n prevWidth = prevChr.width;\n prevY = yOffsets[index];\n yBump = (ideo.config.showChromosomeLabels ? 0 : 2);\n y = prevY + prevWidth + yBump + ideo.config.chrMargin;\n }\n yOffsets.push(y);\n }\n\n return yOffsets;\n}\n\nfunction collinearizeVerticalChromosomes(ideo) {\n var chrSets, yOffsets, x, height, width,\n config = ideo.config;\n\n ideo.config.annotLabelHeight = 12;\n // var annotLabelHeight = ideo.config.annotLabelHeight;\n\n if ('demarcateCollinearChromosomes' in ideo.config === false) {\n ideo.config.demarcateCollinearChromosomes = true;\n }\n\n chrSets = document.querySelectorAll('.chromosome-set');\n\n x = -40;\n\n yOffsets = getYOffsets(chrSets, ideo);\n rearrangeChromosomes(chrSets, yOffsets, x, ideo);\n\n width = Math.round(yOffsets.slice(-1)[0] + 70);\n\n if (config.multiorganism) {\n height *= 8;\n var maxHeight = 0;\n yOffsets.forEach(d => {\n if (d > maxHeight) maxHeight = d;\n });\n height = maxHeight + 30;\n } else {\n height = xOffsets.slice(-1)[0] + 30;\n }\n\n d3.select(ideo.selector)\n .attr('height', height)\n .attr('width', width);\n\n d3.select('#_ideogramTrackLabelContainer').remove();\n d3.select('#_ideogramInnerWrap')\n .insert('div', ':first-child')\n .attr('id', '_ideogramTrackLabelContainer')\n .style('position', 'absolute');\n}\n\nexport default collinearizeVerticalChromosomes;\n","/**\n * @fileoverview Functions for collinear chromosomes.\n * Collinear chromosomes form a line together, unlike the default parallel\n * geometry.\n */\n\nimport {d3} from './lib';\nimport collinearizeVerticalChromosomes from './collinear-vertical';\n\nfunction labelGenomes(ideo) {\n\n ideo.config.taxids.forEach((taxid, i) => {\n var org = ideo.organisms[taxid];\n var config = ideo.config;\n // var commonName = slug(org.commonName);\n var scientificName = org.scientificName;\n d3.select(ideo.selector)\n .append('text')\n .attr('class', 'genomeLabel italic')\n .attr('x', 5)\n .attr('y', config.chrLabelSize + (200 + (3 * config.chrWidth)) * i)\n .text(scientificName);\n });\n}\n\n/**\n* Rearrange chromosomes from parallel horizontal to collinear horizontal\n*\n* Parallel horizontal (as in https://eweitz.github.io/ideogram/mouse)\n* ---\n* ---\n* ---\n*\n* Collinear horizontal (as in https://eweitz.github.io/ideogram/geometry-collinear):\n* --- --- ---\n*/\nfunction rearrangeChromosomes(chrSets, xOffsets, y, ideo) {\n var i, chr, chrSet, taxid, x, adjustedY, orgIndex, chrLabelY,\n config = ideo.config,\n chrWidth = config.chrWidth,\n chrLabelSize = config.chrLabelSize;\n\n for (i = 0; i < chrSets.length; i++) {\n chrSet = chrSets[i];\n x = xOffsets[i];\n\n chr = ideo.chromosomesArray[i];\n taxid = chr.id.split('-')[1];\n orgIndex = config.taxids.indexOf(taxid);\n adjustedY = y + orgIndex * 200;\n if (orgIndex === 0 && ideo.config.multiorganism) {\n chrLabelY = chrLabelSize - 4;\n adjustedY += chrWidth * 2 + chrLabelSize;\n } else {\n chrLabelY = chrWidth * 2 + chrLabelSize + 2;\n }\n\n if (ideo.config.showChromosomeLabels) {\n chrSet.querySelector('.chrLabel').setAttribute('y', chrLabelY);\n chrSet.querySelector('.chrLabel').setAttribute('text-anchor', 'middle');\n }\n chrSet.setAttribute('transform', 'translate(' + x + ',' + adjustedY + ')');\n chrSet.querySelector('.chromosome').setAttribute(\n 'transform', 'translate(-13, 10)'\n );\n }\n\n if (config.multiorganism) {\n labelGenomes(ideo);\n }\n}\n\n/**\n* Get pixel coordinates to use for rearrangement\n*/\nfunction getXOffsets(chrSets, ideo) {\n var xOffsets, i, index, chr, prevChr, x, prevWidth, prevX, xBump, taxid,\n seenTaxids = {};\n\n xOffsets = [];\n for (i = 0; i < chrSets.length; i++) {\n chr = ideo.chromosomesArray[i];\n taxid = chr.id.split('-')[1];\n index = (i === 0) ? i : i - 1;\n prevChr = ideo.chromosomesArray[index];\n if (i === 0 || taxid in seenTaxids === false) {\n x = 20;\n seenTaxids[taxid] = 1;\n } else {\n prevWidth = prevChr.width;\n prevX = xOffsets[index];\n xBump = (ideo.config.showChromosomeLabels ? 0 : 2);\n x = prevX + prevWidth + xBump + ideo.config.chrMargin;\n }\n xOffsets.push(x);\n }\n\n return xOffsets;\n}\n\n// /**\n// * Track number of chromosomes in preceding organisms.\n// * Adds an instance variable to the ideogram object to offset\n// * chromosome indices. Needed for multiorganism collinear ideograms.\n// */\n// function setTaxidChrOffsets(ideo) {\n// var taxidChrOffsets, taxidChrOffset;\n\n// taxidChrOffsets = {};\n\n// taxidChrOffset = 0;\n// ideo.config.organism.forEach((org) => {\n// var taxid, numChrs;\n// taxid = ideo.getTaxid(org);\n// taxidChrOffsets[taxid] = taxidChrOffset;\n// numChrs = Object.keys(ideo.chromosomes[taxid]).length;\n// taxidChrOffset += numChrs;\n// });\n\n// ideo.taxidChrOffsets = taxidChrOffsets;\n// }\n\n// /**\n// * Change chromosome indices for multiorganism collinear ideograms\n// * This is needed to account for x-offsets.\n// */\n// function adjustChrIndex(ideo) {\n// setTaxidChrOffsets(ideo);\n\n// ideo.chromosomesArray.map((chr) => {\n// var taxid = chr.id.split('-')[1];\n// var taxidChrOffset = ideo.taxidChrOffsets[taxid];\n// chr.chrIndex -= taxidChrOffset;\n// ideo.chromosomes[taxid][chr.name].chrIndex = chr.chrIndex;\n// });\n// }\n\nfunction collinearizeChromosomes(ideo) {\n var chrSets, xOffsets, y, height, width,\n config = ideo.config,\n annotHeight = config.annotationHeight || 0;\n\n if (config.orientation === 'vertical') {\n collinearizeVerticalChromosomes(ideo);\n return;\n }\n\n // if (config.multiorganism) adjustChrIndex(ideo);\n\n ideo.config.annotLabelHeight = 12;\n var annotLabelHeight = ideo.config.annotLabelHeight;\n\n if ('demarcateCollinearChromosomes' in ideo.config === false) {\n ideo.config.demarcateCollinearChromosomes = true;\n }\n\n chrSets = document.querySelectorAll('.chromosome-set');\n\n y = (\n (config.numAnnotTracks * (annotHeight + annotLabelHeight + 4)) -\n config.chrWidth + 1\n );\n\n xOffsets = getXOffsets(chrSets, ideo);\n rearrangeChromosomes(chrSets, xOffsets, y, ideo);\n\n height = y + config.chrWidth * 2 + 20;\n\n if (config.multiorganism) {\n height *= 8;\n var maxWidth = 0;\n xOffsets.forEach(d => {\n if (d > maxWidth) maxWidth = d;\n });\n width = maxWidth + 20;\n } else {\n width = xOffsets.slice(-1)[0] + 20;\n }\n\n d3.select(ideo.selector)\n .attr('width', width)\n .attr('height', height);\n\n d3.select('#_ideogramTrackLabelContainer').remove();\n d3.select('#_ideogramInnerWrap')\n .insert('div', ':first-child')\n .attr('id', '_ideogramTrackLabelContainer')\n .style('position', 'absolute');\n}\n\nexport default collinearizeChromosomes;\n","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([\n c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'\n ], { type: 'text/javascript' }))));\n w.onmessage = function (e) {\n var d = e.data, ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n }\n else\n cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\n// see fleb note\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new u32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return [b, r];\n};\nvar _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 0; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >>> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new (v.BYTES_PER_ELEMENT == 2 ? u16 : v.BYTES_PER_ELEMENT == 4 ? u32 : u8)(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n ,\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, buf, st) {\n // source length\n var sl = dat.length;\n if (!sl || (st && st.f && !st.l))\n return buf || new u8(0);\n // have to estimate size\n var noBuf = !buf || st;\n // no state\n var noSt = !st || st.i;\n if (!st)\n st = {};\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >>> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17;\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n d[o + 2] |= v >>> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return [et, 0];\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return [v, 1];\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return [new u8(tr), mbt];\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return [cl.subarray(0, cli), s];\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >>> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];\n var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];\n var _c = lc(dlt), lclt = _c[0], nlc = _c[1];\n var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n lcfreq[lclt[i] & 31]++;\n for (var i = 0; i < lcdt.length; ++i)\n lcfreq[lcdt[i] & 31]++;\n var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);\n if (flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n if (syms[i] > 255) {\n var len = (syms[i] >>> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];\n var dst = syms[i] & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, lst) {\n var s = dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var pos = 0;\n if (!lvl || s < 8) {\n for (var i = 0; i <= s; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[pos >> 3] = lst;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n }\n else {\n var opt = deo[lvl - 1];\n var n = opt >>> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = new u16(32768), head = new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new u32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx bitpos\n var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;\n for (; i < s; ++i) {\n // hash value\n // deopt when i > s - 3 - at end, deopt acceptable\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && rem > 423) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = (i - dif + j + 32768) & 32767;\n var pti = prev[ti];\n var cd = (ti - pti + 32768) & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += (imod - pimod + 32768) & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one Uint32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n // this is the easiest way to avoid needing to maintain state\n if (!lst && pos & 7)\n pos = wfblk(w, pos + 1, et);\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Alder32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return [fnStr, td];\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n var _a;\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];\n ch[id] = wcln(fns[m], fnStr, td_1);\n }\n var td = mrg({}, ch[id][1]);\n return wk(ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gu8]; };\nvar bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zlv]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get u8\nvar gu8 = function (o) { return o && o.size && new u8(o.size); };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += d[10] | (d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return ((d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) | (d[l - 1] << 24)) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);\n};\n// zlib valid\nvar zlv = function (d) {\n if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if (d[1] & 32)\n err(6, 'invalid zlib data: preset dictionaries not supported');\n};\nfunction AsyncCmpStrm(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n// zlib footer: -4 to -0 is Adler32\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, !f), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.d = final;\n this.p(chunk, final || false);\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n /**\n * Creates an inflation stream\n * @param cb The callback to call whenever data is inflated\n */\n function Inflate(cb) {\n this.s = {};\n this.p = new u8(0);\n this.ondata = cb;\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n var l = this.p.length;\n var n = new u8(l + c.length);\n n.set(this.p), n.set(c, l), this.p = n;\n };\n Inflate.prototype.c = function (final) {\n this.d = this.s.i = final || false;\n var bts = this.s.b;\n var dt = inflt(this.p, this.o, this.s);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous inflation stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncInflate(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, 0, function () {\n var strm = new Inflate();\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, out) {\n return inflt(data, out);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n this.c.p(c);\n this.l += c.length;\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n /**\n * Creates a GUNZIP stream\n * @param cb The callback to call whenever data is inflated\n */\n function Gunzip(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n var s = this.p.length > 3 ? gzs(this.p) : 4;\n if (s >= this.p.length && !final)\n return;\n this.p = this.p.subarray(s), this.v = 0;\n }\n if (final) {\n if (this.p.length < 8)\n err(6, 'invalid gzip data');\n this.p = this.p.subarray(0, -8);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous GUNZIP stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncGunzip(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, 0, function () {\n var strm = new Gunzip();\n onmessage = astrm(strm);\n }, 9);\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, out) {\n return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n this.c.p(c);\n var raw = dopt(c, this.o, this.v && 2, f && 4, !f);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n /**\n * Creates a Zlib decompression stream\n * @param cb The callback to call whenever data is inflated\n */\n function Unzlib(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 2 && !final)\n return;\n this.p = this.p.subarray(2), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous Zlib decompression stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncUnzlib(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, 0, function () {\n var strm = new Unzlib();\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, out) {\n return inflt((zlv(data), data.subarray(2, -4)), out);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function Decompress(cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_1 = this;\n var cb = function () { _this_1.ondata.apply(_this_1, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(cb)\n : new this.Z(cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function AsyncDecompress(cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, out) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, out)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, out)\n : unzlibSync(data, out);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8)\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return [r, slc(d, i - 1)];\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), ch = _a[0], np = _a[1];\n if (final) {\n if (np.length)\n err(8);\n this.p = null;\n }\n else\n this.p = np;\n this.ondata(ch, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td)\n return td.decode(dat);\n else {\n var _a = dutf8(dat), out = _a[0], ext = _a[1];\n if (ext.length)\n err(8);\n return out;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c == null && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1)), b += 4;\n if (c != null) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this_1 = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this_1.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this_1.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this_1.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this_1.ondata(err, dat, final);\n _this_1.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this_1 = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this_1.d & 1))\n return;\n _this_1.u.splice(-1, 1);\n _this_1.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, f.c, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this_1 = this;\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this_1 = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this_1 = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this_1.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this_1.k[0] == chks_3 && _this_1.c)\n _this_1.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n c = lft = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, new u8(su)));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50)\n err(13);\n c = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { messageGenerator } from '../models/messages/messageGenerator.js';\nimport '../_version.js';\n/**\n * Workbox errors should be thrown with this class.\n * This allows use to ensure the type easily in tests,\n * helps developers identify errors from workbox\n * easily and allows use to optimise error\n * messages correctly.\n *\n * @private\n */\nclass WorkboxError extends Error {\n /**\n *\n * @param {string} errorCode The error code that\n * identifies this particular error.\n * @param {Object=} details Any relevant arguments\n * that will help developers identify issues should\n * be added as a key on the context object.\n */\n constructor(errorCode, details) {\n const message = messageGenerator(errorCode, details);\n super(message);\n this.name = errorCode;\n this.details = details;\n }\n}\nexport { WorkboxError };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { messages } from './messages.js';\nimport '../../_version.js';\nconst fallback = (code, ...args) => {\n let msg = code;\n if (args.length > 0) {\n msg += ` :: ${JSON.stringify(args)}`;\n }\n return msg;\n};\nconst generatorFunction = (code, details = {}) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n return message(details);\n};\nexport const messageGenerator = process.env.NODE_ENV === 'production' ? fallback : generatorFunction;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { calculateEffectiveBoundaries } from './utils/calculateEffectiveBoundaries.js';\nimport { parseRangeHeader } from './utils/parseRangeHeader.js';\nimport './_version.js';\n/**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * If the original `Response` already contains partial content (i.e. it has\n * a status of 206), then this assumes it already fulfills the `Range:`\n * requirements, and will return it as-is.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse A response.\n * @return {Promise} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox-range-requests\n */\nasync function createPartialResponse(request, originalResponse) {\n try {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request',\n });\n assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse',\n });\n }\n if (originalResponse.status === 206) {\n // If we already have a 206, then just pass it through as-is;\n // see https://github.com/GoogleChrome/workbox/issues/1720\n return originalResponse;\n }\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError('no-range-header');\n }\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = await originalResponse.blob();\n const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers,\n });\n slicedResponse.headers.set('Content-Length', String(slicedBlobSize));\n slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` +\n `${originalBlob.size}`);\n return slicedResponse;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to construct a partial response; returning a ` +\n `416 Range Not Satisfiable response instead.`);\n logger.groupCollapsed(`View details here.`);\n logger.log(error);\n logger.log(request);\n logger.log(originalResponse);\n logger.groupEnd();\n }\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable',\n });\n }\n}\nexport { createPartialResponse };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { assert } from 'workbox-core/_private/assert.js';\nimport '../_version.js';\n/**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\nfunction parseRangeHeader(rangeHeader) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader',\n });\n }\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError('unit-must-be-bytes', { normalizedRangeHeader });\n }\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError('single-range-only', { normalizedRangeHeader });\n }\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (!rangeParts || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError('invalid-range-values', { normalizedRangeHeader });\n }\n return {\n start: rangeParts[1] === '' ? undefined : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? undefined : Number(rangeParts[2]),\n };\n}\nexport { parseRangeHeader };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { assert } from 'workbox-core/_private/assert.js';\nimport '../_version.js';\n/**\n * @param {Blob} blob A source blob.\n * @param {number} [start] The offset to use as the start of the\n * slice.\n * @param {number} [end] The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\nfunction calculateEffectiveBoundaries(blob, start, end) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob',\n });\n }\n const blobSize = blob.size;\n if ((end && end > blobSize) || (start && start < 0)) {\n throw new WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start,\n });\n }\n let effectiveStart;\n let effectiveEnd;\n if (start !== undefined && end !== undefined) {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n else if (start !== undefined && end === undefined) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n }\n else if (end !== undefined && start === undefined) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n }\n return {\n start: effectiveStart,\n end: effectiveEnd,\n };\n}\nexport { calculateEffectiveBoundaries };\n","/** @fileoverview Functions used by multiple content-specific cache modules */\n\nimport {decompressSync, strFromU8} from 'fflate';\nimport {createPartialResponse} from 'workbox-range-requests';\n\nimport version from '../../version';\nimport {getEarlyTaxid, slug, getDir} from '../../lib';\nimport {organismMetadata} from '../organism-metadata';\n\nasync function fetchByteRangesByName(url) {\n const byteRangesByName = {};\n\n const path = `${url.replace('.tsv.gz', '')}.tsv.li.gz`;\n\n const response = await cacheFetch(path);\n const text = await response.text();\n const lines = text.split('\\n');\n for (let i = 0; i < lines.length - 1; i++) {\n const [gene, rawOffset] = lines[i].split('\\t');\n if (gene[0] === '#') continue;\n const offset = parseInt(rawOffset);\n const offsetEnd = parseInt(lines[i + 1].split('\\t')[1]);\n byteRangesByName[gene] = [offset, offsetEnd];\n }\n\n return byteRangesByName;\n}\n\n/** Reports if current organism has a gene structure cache */\nexport function supportsCache(orgName, cacheName) {\n const metadata = parseOrgMetadata(orgName);\n const cacheProp = 'has' + cacheName + 'Cache';\n return metadata[cacheProp] && metadata[cacheProp] === true;\n}\n\n/** Get URL for gene structure cache file */\nexport function getCacheUrl(orgName, cacheDir, cacheType, fileType='tsv') {\n const organism = slug(orgName);\n if (!cacheDir) {\n cacheDir = getDir('cache/' + cacheType + '/');\n } else {\n cacheDir += cacheType + '/';\n }\n\n const cacheUrl =\n cacheDir + organism + '-' + cacheType + '.' + fileType + '.gz';\n\n return cacheUrl;\n}\n\n/**\n * Build full ID from prefix (e.g. ENSG or IPR) and slim ID (e.g. 223972)\n *\n * Example output ID: ENSG00000223972\n * */\nexport function getFullId(prefix, slimId, fullNumLength=11) {\n\n // C. elegans (prefix: WBGene) has special IDs, e.g. WBGene00197333\n if (prefix === 'WBGene') fullNumLength = 8;\n\n // Zero-pad the slim ID, e.g. 223972 -> 00000223972\n const zeroPaddedId = slimId.padStart(fullNumLength, '0');\n\n return prefix + zeroPaddedId;\n}\n\n\nasync function getServiceWorkerCache() {\n const currentIdeogram = `ideogram-${version}`;\n\n // Delete other versions of Ideogram cache; there should be 1 per dodmain\n const cacheNames = await caches.keys();\n cacheNames.forEach(name => {\n if (name.startsWith('ideogram-') && name !== currentIdeogram) {\n caches.delete(name);\n }\n });\n\n const cache = await caches.open(currentIdeogram);\n\n return cache;\n}\n\nexport async function cacheFetch(url) {\n\n const cache = await getServiceWorkerCache();\n window.ideoCache = cache;\n window.createPartialResponse = createPartialResponse;\n\n const decompressedUrl = url.replace('.gz', '');\n const response = await cache.match(decompressedUrl);\n if (typeof response === 'undefined') {\n // If cache miss, then fetch, decompress, and put response in cache\n const rawResponse = await fetch(url);\n const blob = await rawResponse.blob();\n const uint8Array = new Uint8Array(await blob.arrayBuffer());\n const data = strFromU8(decompressSync(uint8Array));\n const contentLength = data.length;\n const decompressedResponse = new Response(\n new Blob([data], {type: 'text/tab-separated-values'}),\n {headers: new Headers({'Content-Length': contentLength})}\n );\n await cache.put(decompressedUrl, decompressedResponse);\n return await cache.match(decompressedUrl);\n }\n return await cache.match(decompressedUrl);\n}\n\nexport async function cacheRangeFetch(url, byteRange) {\n url = url.replace('.gz', '');\n\n // +/- 1 to trim newlines\n const rangeStart = byteRange[0] + 1;\n const rangeEnd = byteRange[1] - 1;\n\n const headers = new Headers({\n 'content-type': 'multipart/byteranges',\n 'range': `bytes=${rangeStart}-${rangeEnd}`\n });\n\n const request = new Request(url, {headers});\n\n const cache = await getServiceWorkerCache();\n\n const fullResponse = await cache.match(request);\n const partialResponse = await createPartialResponse(request, fullResponse);\n\n const text = await partialResponse.text();\n\n return text;\n}\n\nwindow.cacheRangeFetch = cacheRangeFetch;\n\n/** Get organism's metadata fields */\nexport function parseOrgMetadata(orgName) {\n const taxid = getEarlyTaxid(orgName);\n return organismMetadata[taxid] || {};\n}\n\n/** Fetch URL from service worker cache, call given parsing function */\nexport async function fetchAndParse(\n cacheUrl, perfTimes, parseFn, orgName=null\n) {\n const fetchStartTime = performance.now();\n const response = await cacheFetch(cacheUrl);\n let data;\n if (cacheUrl.includes('.json')) {\n data = await response.json();\n } else {\n data = await response.text();\n }\n const fetchEndTime = performance.now();\n perfTimes.fetch = Math.round(fetchEndTime - fetchStartTime);\n\n let parsedCache;\n if (cacheUrl.includes('tissue')) {\n const byteRangesByName = await fetchByteRangesByName(cacheUrl);\n parsedCache = parseFn(data, perfTimes, byteRangesByName);\n } else {\n parsedCache = parseFn(data, perfTimes, orgName);\n }\n\n perfTimes.parseCache = Math.round(performance.now() - fetchEndTime);\n\n return [parsedCache, perfTimes];\n}\n\n/** Print size and time of given parsed cache */\nexport function inspectWorker(cacheName, json) {\n const size = new TextEncoder().encode(JSON.stringify(json)).length;\n const kiloBytes = size / 1024;\n const megaBytes = kiloBytes / 1024;\n console.log(`Parsed ${cacheName}Cache size: ${megaBytes} MiB`);\n console.timeEnd(`${cacheName}CacheWorker`);\n}\n","import {fetchAndParse, inspectWorker} from './cache-lib';\n\n/** Parse compressed feature subparts to more easily computable format */\nfunction deserializeSubparts(rawSubparts, subpartKeys) {\n const subparts = [];\n for (let i = 0; i < rawSubparts.length; i++) {\n const rawSubpart = rawSubparts[i].split(';');\n const subpartType = subpartKeys[parseInt(rawSubpart[0])];\n const start = parseInt(rawSubpart[1]);\n const length = parseInt(rawSubpart[2]);\n const subpart = [subpartType, start, length];\n subparts.push(subpart);\n }\n return subparts;\n}\n\n/** Parse metainformation header lines, i.e. those beginning \"## \"\" */\nfunction parseMetainformationHeader(line) {\n const splitHead = line.split(' keys: ');\n if (splitHead.length < 2) return [null];\n const metaHeader = splitHead[0].split('## ')[1];\n const keys = {};\n splitHead[1].split(', ').forEach(entry => {\n const splitEntry = entry.split(' = ');\n keys[splitEntry[0]] = splitEntry[1];\n });\n return [metaHeader, keys];\n}\n\n/** Parse a gene structure cache TSV file, return array of useful transforms */\nexport function parseGeneStructureCache(rawTsv, perfTimes) {\n const featuresByGene = {};\n\n let t0 = performance.now();\n const lines = rawTsv.split(/\\r\\n|\\n/);\n perfTimes.rawTsvSplit = Math.round(performance.now() - t0);\n\n let biotypeKeys, subpartKeys;\n\n t0 = performance.now();\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '') continue; // Skip empty lines\n\n // Parse header\n if (line[0] === '#') {\n\n // Parse metainformation headers\n if (line[1] === '#') {\n const [metaHeader, keys] = parseMetainformationHeader(line);\n if (metaHeader === 'biotype') {\n biotypeKeys = keys;\n } else if (metaHeader === 'subpart') {\n subpartKeys = keys;\n }\n }\n continue;\n }\n const splitLine = line.trim().split(/\\t/);\n\n const [\n name, biotypeCompressed, strand\n ] = splitLine.slice(0, 3);\n\n const gene = name.split('-').slice(0, -1).join('-');\n\n const rawSubparts = splitLine.slice(3);\n const subparts = deserializeSubparts(rawSubparts, subpartKeys);\n\n const biotype = biotypeKeys[biotypeCompressed];\n\n // E.g. ACE2-201, protein_coding, -, \n const feature = {\n name,\n biotype,\n strand,\n subparts\n };\n\n if (gene in featuresByGene) {\n featuresByGene[gene].push(feature);\n } else {\n featuresByGene[gene] = [feature];\n }\n\n };\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n return featuresByGene;\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('geneStructureCacheWorker');\n// const [cacheUrl, perfTimes, debug] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache);\n// postMessage(result);\n// if (debug) inspectWorker('geneStructure', result[0]);\n// });\n","import {fetchAndParse, inspectWorker, getFullId} from './cache-lib';\n\n/** Parse compressed protein to more easily computable format */\nfunction deserializeProtein(rawProtein, domainKeys) {\n const domains = [];\n for (let i = 0; i < rawProtein.length; i++) {\n const rawDomain = rawProtein[i].split(';');\n // const domainID = getFullId('IPR', rawDomain[0], 6);\n const domainName = domainKeys[rawDomain[0]];\n const start = parseInt(rawDomain[1]);\n const length = parseInt(rawDomain[2]);\n const domain = [domainName, start, length];\n domains.push(domain);\n }\n return domains;\n}\n\n/** Parse metainformation header lines, i.e. those beginning \"## \"\" */\nfunction parseMetainformationHeader(line) {\n const splitHead = line.split(' keys: ');\n if (splitHead.length < 2) return [null];\n const metaHeader = splitHead[0].split('## ')[1];\n const keys = {};\n splitHead[1].split('; ').forEach(entry => {\n const splitEntry = entry.split(' = ');\n keys[splitEntry[0]] = splitEntry[1];\n });\n return [metaHeader, keys];\n}\n\n/** Parse a protein cache TSV file, return array of useful transforms */\nexport function parseProteinCache(rawTsv, perfTimes) {\n const featuresByGene = {};\n\n let t0 = performance.now();\n const lines = rawTsv.split(/\\r\\n|\\n/);\n perfTimes.rawTsvSplit = Math.round(performance.now() - t0);\n\n let domainKeys;\n\n t0 = performance.now();\n\n let gene = null;\n let refTxBaseNum;\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '') continue; // Skip empty lines\n\n // Parse header\n if (line[0] === '#') {\n\n // Parse metainformation headers\n if (line[1] === '#') {\n const [metaHeader, keys] = parseMetainformationHeader(line);\n if (metaHeader === 'domain') {\n domainKeys = keys;\n }\n }\n continue;\n }\n const splitLine = line.trim().split(/\\t/);\n\n let transcriptName = splitLine[0];\n if (isNaN(transcriptName)) {\n const splitTxName = transcriptName.split('-');\n const txNum = splitTxName.slice(-1)[0]; // e.g. 208 in ACE2-208\n const highestDigit = parseInt(txNum[0]); // e.g. 2 in 208\n const numDigits = txNum.length;\n refTxBaseNum = highestDigit * (10 ** (numDigits - 1));\n gene = splitTxName.slice(0, -1).join('-');\n } else {\n transcriptName = refTxBaseNum + parseInt(transcriptName);\n transcriptName = gene + '-' + transcriptName;\n }\n\n const rawProtein = splitLine.slice(1);\n const protein = deserializeProtein(rawProtein, domainKeys);\n\n // E.g. ACE2-201, >\n const feature = {\n transcriptName,\n protein\n };\n\n if (gene in featuresByGene) {\n featuresByGene[gene].push(feature);\n } else {\n featuresByGene[gene] = [feature];\n }\n\n };\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n return featuresByGene;\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('proteinCacheWorker');\n// const [cacheUrl, perfTimes, debug] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache);\n// postMessage(result);\n// if (debug) inspectWorker('proteinStructure', result[0]);\n// });\n","import {\n fetchAndParse, getFullId, inspectWorker,\n cacheFetch, cacheRangeFetch, getCacheUrl\n} from './cache-lib';\n\n\nfunction parseTissueKeys(rawTissuesString) {\n const tissueNames = [];\n const tissueColors = [];\n const tissueSamples = [];\n rawTissuesString.split(';').forEach(entry => {\n const splitEntry = entry.split(',');\n tissueNames.push(splitEntry[0]);\n tissueColors.push(splitEntry[1]);\n tissueSamples.push(splitEntry[2]);\n });\n return [tissueNames, tissueColors, tissueSamples];\n}\n\n/** Transform a stringified list of integers into an actual list of integers */\nfunction processIds(ids) {\n const processedIds = [];\n const splitIds = ids.split(',');\n for (let i = 0; i < splitIds.length; i++) {\n processedIds.push(parseInt(splitIds[i], 10));\n }\n return processedIds;\n}\n\nasync function getTissueExpressions(gene, ideo) {\n const cache = ideo.tissueCache;\n const byteRange = cache.byteRangesByName[gene];\n\n // Easier debuggability\n if (!ideo.cacheRangeFetch) ideo.cacheRangeFetch = cacheRangeFetch;\n\n if (!byteRange) return null;\n\n const config = ideo.config;\n let cacheDir = null;\n if (config.cacheDir) cacheDir = config.cacheDir;\n const cacheType = 'tissues';\n const extension = 'tsv';\n\n const orgName = 'homo-sapiens';\n const cacheUrl = getCacheUrl(orgName, cacheDir, cacheType, extension);\n\n const geneDataLine = await cacheRangeFetch(cacheUrl, byteRange);\n\n const tissueExpressions = [];\n const rawExpressions = geneDataLine.split('\\t').slice(1);\n for (let i = 0; i < rawExpressions.length; i++) {\n const rawValues = rawExpressions[i].split(';').map(\n v => v === '' ? 0 : v // inflate empty string to 0-integer\n );\n const numValues = rawValues.length;\n if (numValues === 15) {\n rawValues.splice(1, 0, 0); // Insert number 0 at position 1\n } else if (numValues === 14) {\n // Min. and Q1 are 0\n rawValues.splice(1, 0, 0);\n rawValues.splice(1, 0, 0);\n } else if (numValues === 13) {\n // Min., Q1, and median are 0\n rawValues.splice(1, 0, 0);\n rawValues.splice(1, 0, 0);\n rawValues.splice(1, 0, 0);\n }\n const tissueId = rawValues[0];\n const boxMetrics = rawValues.slice(1, 6);\n const min = parseFloat(boxMetrics[0]);\n const q1 = parseFloat(boxMetrics[1]);\n const median = parseFloat(boxMetrics[2]);\n const q3 = parseFloat(boxMetrics[3]);\n const max = parseFloat(boxMetrics[4]);\n const quantiles = rawValues.slice(6).map(v => parseInt(v));\n const expression = {\n min, q1, median, q3, max,\n quantiles\n };\n const tissue = cache.tissueNames[tissueId];\n const color = cache.tissueColors[tissueId];\n const samples = parseInt(cache.tissueSamples[tissueId]);\n tissueExpressions.push({tissue, expression, color, samples});\n }\n\n return tissueExpressions;\n}\n\n/** Parse a tissue cache TSV file */\nexport function parseTissueCache(rawTsv, perfTimes, byteRangesByName) {\n let tissueNames;\n let tissueColors;\n let tissueSamples;\n\n let t0 = performance.now();\n const lines = rawTsv.split(/\\r\\n|\\n/);\n perfTimes.rawTsvSplit = Math.round(performance.now() - t0);\n\n t0 = performance.now();\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '') continue; // Skip empty lines\n if (line[0] === '#') {\n if (line.slice(0, 10) === '## tissues') {\n const parsedTissueKeys = parseTissueKeys(line.split('tissues: ')[1]);\n [tissueNames, tissueColors, tissueSamples] = parsedTissueKeys;\n }\n continue;\n }\n\n };\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n return {\n getTissueExpressions,\n byteRangesByName,\n tissueNames,\n tissueColors,\n tissueSamples\n };\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('tissueCacheWorker');\n// const [cacheUrl, perfTimes, debug] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache);\n// postMessage(result);\n// if (debug) inspectWorker('paralog', result[0]);\n// });\n","import {\n supportsCache, getCacheUrl, fetchAndParse,\n cacheFetch\n} from './cache-lib';\n\n// Uncomment when workers work outside localhost\n// const geneCacheWorker = new Worker(\n// new URL('./gene-cache-worker.js', import.meta.url), {type: 'module'}\n// );\n// const paralogCacheWorker = new Worker(\n// new URL('./paralog-cache-worker.js', import.meta.url), {type: 'module'}\n// );\n// const interactionCacheWorker = new Worker(\n// new URL('./interaction-cache-worker.js', import.meta.url), {type: 'module'}\n// );\n// const geneStructureCacheWorker = new Worker(\n// new URL('./gene-structure-cache-worker.js', import.meta.url), {type: 'module'}\n// );\n\nimport {parseGeneCache} from './gene-cache-worker';\nimport {parseParalogCache} from './paralog-cache-worker';\nimport {parseInteractionCache} from './interaction-cache-worker';\nimport {parseGeneStructureCache} from './gene-structure-cache-worker';\nimport {parseProteinCache} from './protein-cache-worker';\nimport {parseSynonymCache} from './synonym-cache-worker';\nimport {parseTissueCache} from './tissue-cache-worker';\n\n/**\n * Populates in-memory content caches from on-disk service worker (SW) caches.\n *\n * This warms the following content caches:\n * - Gene cache: gene symbol -> full name, Ensembl ID, genomic coordinates\n * - Paralog cache: gene symbol -> paralogs (evolutionarily related genes)\n * - Interaction cache: gene symbol -> adjacent genes in biochemical pathways\n *\n * And, optionally:\n * - Gene structure cache: gene symbol -> canonical transcript, exons, UTRs\n * - Protein cache: gene symbol -> protein domains & families, per transcript\n * - Synonym cache: gene symbol -> list of synonyms, a.k.a. aliases\n *\n * Used for related genes kit now, likely worth generalizing in the future.\n *\n * This approach makes navigating related genes ideogram instant and\n * possible completely offline (i.e. a progressive web component) -- but only\n * once caches are populated.\n */\nexport async function initCaches(ideo) {\n\n const config = ideo.config;\n if (!config.useCache) return;\n\n const organism = config.organism;\n\n let cacheDir = null;\n if (config.cacheDir) cacheDir = config.cacheDir;\n\n if (config.awaitCache) {\n // Start all these in parallel. Only initGeneCache blocks; it internally\n // resolves a Promise, whereas the others return upon completing their\n // respective initializations.\n const cachePromise = Promise.all([\n cacheFactory('gene', organism, ideo, cacheDir),\n cacheFactory('paralog', organism, ideo, cacheDir),\n cacheFactory('interaction', organism, ideo, cacheDir),\n cacheFactory('synonym', organism, ideo, cacheDir),\n cacheFactory('tissue', organism, ideo, cacheDir)\n ]);\n\n if (config.showGeneStructureInTooltip) {\n cacheFactory('geneStructure', organism, ideo, cacheDir);\n cacheFactory('protein', organism, ideo, cacheDir);\n }\n\n return cachePromise;\n\n } else {\n cacheFactory('gene', organism, ideo, cacheDir);\n cacheFactory('paralog', organism, ideo, cacheDir);\n cacheFactory('interaction', organism, ideo, cacheDir);\n if (config.showGeneStructureInTooltip) {\n cacheFactory('geneStructure', organism, ideo, cacheDir);\n cacheFactory('protein', organism, ideo, cacheDir);\n cacheFactory('synonym', organism, ideo, cacheDir);\n cacheFactory('tissue', organism, ideo, cacheDir);\n }\n }\n}\n\nconst allCacheProps = {\n gene: {\n metadata: 'Gene', dir: 'genes',\n fn: setGeneCache,\n // worker: geneCacheWorker // Uncomment when workers work\n parseFn: parseGeneCache // Remove when workers work\n },\n paralog: {\n metadata: 'Paralog', dir: 'paralogs',\n fn: setParalogCache,\n // worker: paralogCacheWorker // Uncomment when workers work\n parseFn: parseParalogCache // Remove when workers work\n },\n interaction: {\n metadata: 'Interaction', dir: 'interactions',\n fn: setInteractionCache, extension: 'json',\n // worker: interactionCacheWorker, // Uncomment when workers work\n parseFn: parseInteractionCache // Remove when workers work\n },\n geneStructure: {\n metadata: 'GeneStructure', dir: 'gene-structures',\n fn: setGeneStructureCache,\n // worker: geneStructureCacheWorker // Uncomment when workers work\n parseFn: parseGeneStructureCache // Remove when workers work\n },\n protein: {\n metadata: 'Protein', dir: 'proteins',\n fn: setProteinCache,\n // worker: proteinCacheWorker // Uncomment when workers work\n parseFn: parseProteinCache // Remove when workers work\n },\n synonym: {\n metadata: 'Synonym', dir: 'synonyms',\n fn: setSynonymCache,\n // worker: synonymCacheWorker // Uncomment when workers work\n parseFn: parseSynonymCache // Remove when workers work\n },\n tissue: {\n metadata: 'Tissue', dir: 'tissues',\n fn: setTissueCache,\n // worker: tissueCacheWorker // Uncomment when workers work\n parseFn: parseTissueCache // Remove when workers work\n }\n};\n\nfunction setGeneCache(parsedCache, ideo) {\n const [\n interestingNames, nameCaseMap, namesById, fullNamesById,\n idsByName, lociByName, lociById\n //, sortedAnnots\n ] = parsedCache;\n\n ideo.geneCache = {\n interestingNames, // Array ordered by general or scholarly interest\n nameCaseMap, // Maps of lowercase gene names to proper gene names\n namesById,\n fullNamesById,\n idsByName,\n lociByName, // Object of gene positions, keyed by gene name\n lociById\n //, sortedAnnots // Ideogram annotations sorted by genomic position\n };\n}\n\nfunction setParalogCache(parsedCache, ideo) {\n const paralogsByName = parsedCache;\n // Array of paralog Ensembl IDs by (uppercase) gene name\n ideo.paralogCache = {paralogsByName};\n}\n\nfunction setInteractionCache(parsedCache, ideo) {\n const interactionsByName = parsedCache;\n ideo.interactionCache = interactionsByName;\n}\n\nfunction setGeneStructureCache(parsedCache, ideo) {\n const featuresByGene = parsedCache;\n ideo.geneStructureCache = featuresByGene;\n}\n\nfunction setProteinCache(parsedCache, ideo) {\n ideo.proteinCache = parsedCache;\n}\n\nfunction setSynonymCache(parsedCache, ideo) {\n ideo.synonymCache = parsedCache;\n}\n\nfunction setTissueCache(parsedCache, ideo) {\n ideo.tissueCache = parsedCache;\n}\n\nasync function cacheFactory(cacheName, orgName, ideo, cacheDir=null) {\n\n const cacheProps = allCacheProps[cacheName];\n const debug = ideo.config.debug;\n\n /**\n * Fetch cached gene data, transform it usefully, and set it as ideo prop\n */\n const startTime = performance.now();\n let perfTimes = {};\n\n let parsedCache;\n\n // Skip initialization if files needed to make cache don't exist\n if (!supportsCache(orgName, cacheProps.metadata)) return;\n\n const staticProp = cacheName + 'Cache';\n // Skip initialization if cache is already populated\n if (Ideogram[staticProp] && Ideogram[staticProp][orgName]) {\n // Simplify chief use case, i.e. for single organism\n ideo[staticProp] = Ideogram[staticProp][orgName];\n return;\n }\n\n if (!Ideogram[staticProp]) {\n Ideogram[staticProp] = {};\n }\n\n const extension = cacheProps?.extension ?? 'tsv';\n const cacheUrl = getCacheUrl(orgName, cacheDir, cacheProps.dir, extension);\n\n [parsedCache, perfTimes] =\n await fetchAndParse(cacheUrl, perfTimes, cacheProps.parseFn, orgName);\n\n // const cacheWorker = cacheProps.worker;\n if (debug) console.time(`${cacheName}Cache total`);\n return new Promise(resolve => {\n // const message = [cacheUrl, perfTimes, debug];\n // if (cacheName === 'interaction') message.push(orgName);\n // cacheWorker.postMessage(message);\n // cacheWorker.addEventListener('message', event => {\n // [parsedCache, perfTimes] = event.data;\n cacheProps.fn(parsedCache, ideo, orgName);\n Ideogram[staticProp][orgName] = ideo[staticProp];\n\n if (debug) {\n console.timeEnd(`${cacheName}Cache total`);\n perfTimes.total = Math.round(performance.now() - startTime);\n const preamble = 'perfTimes in init' + cacheProps.metadata + 'Cache:';\n console.log(preamble, perfTimes);\n }\n\n resolve();\n // });\n });\n}\n","import {fetchAndParse, getFullId, inspectWorker} from './cache-lib';\n\n/**\n * Convert pre-annotation arrays to annotation objects\n * sorted by genomic position.\n */\nfunction parseAnnots(preAnnots) {\n const chromosomes = {};\n\n for (let i = 0; i < preAnnots.length; i++) {\n const [chromosome, start, stop, ensemblId, gene] = preAnnots[i];\n\n if (!(chromosome in chromosomes)) {\n chromosomes[chromosome] = {chr: chromosome, annots: []};\n } else {\n const annot = {name: gene, start, stop, ensemblId};\n chromosomes[chromosome].annots.push(annot);\n }\n }\n\n const annotsSortedByPosition = {};\n\n Object.entries(chromosomes).forEach(([chr, annotsByChr]) => {\n annotsSortedByPosition[chr] = {\n chr,\n annots: annotsByChr.annots.sort((a, b) => a.start - b.start)\n };\n });\n\n return annotsSortedByPosition;\n}\n\n/** Parse a gene cache TSV file, return array of useful transforms */\nexport function parseGeneCache(rawTsv, perfTimes) {\n const names = [];\n const nameCaseMap = {};\n const namesById = {};\n const fullNamesById = {};\n const idsByName = {};\n const lociByName = {};\n const lociById = {};\n const preAnnots = [];\n\n // If the gene has among top 2% expression in a tissue (per GTEx), that's\n // tracked here.\n const tissueIdsByName = {};\n\n let ensemblPrefix;\n\n let t0 = performance.now();\n const lines = rawTsv.split(/\\r\\n|\\n/);\n perfTimes.rawTsvSplit = Math.round(performance.now() - t0);\n\n t0 = performance.now();\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '') continue; // Skip empty lines\n if (line[0] === '#') {\n if (line.slice(0, 9) === '## prefix') {\n ensemblPrefix = line.split('prefix: ')[1];\n }\n continue;\n }\n const [\n chromosome, rawStart, rawLength, slimEnsemblId, gene,\n rawFullName, tissueIds\n ] = line.trim().split(/\\t/);\n const fullName = decodeURIComponent(rawFullName);\n const start = parseInt(rawStart);\n const stop = start + parseInt(rawLength);\n const ensemblId = getFullId(ensemblPrefix, slimEnsemblId);\n preAnnots.push([chromosome, start, stop, ensemblId, gene, fullName]);\n const locus = [chromosome, start, stop];\n\n names.push(gene);\n nameCaseMap[gene.toLowerCase()] = gene;\n namesById[ensemblId] = gene;\n fullNamesById[ensemblId] = fullName;\n idsByName[gene] = ensemblId;\n lociByName[gene] = locus;\n lociById[ensemblId] = locus;\n\n if (tissueIds !== undefined) {\n const processedTissueIds = [];\n const splitTissueIds = tissueIds.split(',');\n for (let i = 0; i < splitTissueIds.length; i++) {\n processedTissueIds.push(parseInt(splitTissueIds[i], 10));\n }\n tissueIdsByName[gene] = processedTissueIds;\n }\n };\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n // const sortedAnnots = parseAnnots(preAnnots);\n perfTimes.parseAnnots = Math.round(performance.now() - t1);\n\n return [\n names, nameCaseMap, namesById,\n fullNamesById,\n idsByName, lociByName, lociById\n // , sortedAnnots\n ];\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('geneCacheWorker');\n// // console.log('in gene cache worker message handler');\n// const [cacheUrl, perfTimes, debug] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache);\n// postMessage(result);\n// if (debug) inspectWorker('gene', result[0]);\n// });\n","import {fetchAndParse, getFullId, inspectWorker} from './cache-lib';\n\n/** Parse a paralog cache TSV file, return array of useful transforms */\nexport function parseParalogCache(rawTsv, perfTimes) {\n const paralogsByName = {};\n let ensemblPrefix;\n\n let t0 = performance.now();\n const lines = rawTsv.split(/\\r\\n|\\n/);\n perfTimes.rawTsvSplit = Math.round(performance.now() - t0);\n\n t0 = performance.now();\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '') continue; // Skip empty lines\n if (line[0] === '#') {\n if (line.slice(0, 9) === '## prefix') {\n ensemblPrefix = line.split('prefix: ')[1];\n }\n continue;\n }\n const columns = line.trim().split(/\\t/);\n const gene = columns[0];\n const geneSlimId = columns[1];\n\n const paralogs = [];\n if (columns[2][0] === '_') {\n const pointer = columns[2].slice(1).toUpperCase();\n const paralogSuperList = paralogsByName[pointer];\n const geneId = getFullId(ensemblPrefix, geneSlimId);\n for (let j = 0; j < paralogSuperList.length; j++) {\n const id = paralogSuperList[j];\n if (id !== geneId) {\n paralogs.push(id);\n }\n }\n paralogs.unshift(getFullId(ensemblPrefix, columns[3]));\n } else {\n const slimEnsemblIds = columns.slice(2);\n for (let j = 0; j < slimEnsemblIds.length; j++) {\n const slimId = slimEnsemblIds[j];\n if (slimId !== geneSlimId) {\n paralogs.push(getFullId(ensemblPrefix, slimId));\n }\n }\n }\n\n paralogsByName[gene.toUpperCase()] = paralogs;\n };\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n return paralogsByName;\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('paralogCacheWorker');\n// const [cacheUrl, perfTimes, debug] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache);\n// postMessage(result);\n// if (debug) inspectWorker('paralog', result[0]);\n// });\n","import {fetchAndParse, inspectWorker} from './cache-lib';\n\n/** Parse an interaction cache JSON file, return array of useful transforms */\nexport function parseInteractionCache(rawJson, perfTimes, orgName) {\n let t0 = performance.now();\n const interactionsByName = {};\n const tmp = orgName.replace('-', ' ');\n const desluggedOrg = tmp[0].toUpperCase() + tmp.slice(1);\n\n t0 = performance.now();\n for (const gene in rawJson['interactions']) {\n const ixnLists = rawJson['interactions'][gene];\n interactionsByName[gene] = {result: []};\n for (let i = 0; i < ixnLists.length; i++) {\n const compressedIxn = ixnLists[i];\n const slimPwId = compressedIxn[0];\n interactionsByName[gene].result.push({\n fields: {\n left: {values: compressedIxn[1]},\n right: {values: compressedIxn[2]}\n },\n id: 'WP' + slimPwId,\n name: rawJson['pathwayNamesById'][slimPwId],\n species: desluggedOrg\n });\n }\n }\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n return interactionsByName;\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('interactionCacheWorker');\n// const [cacheUrl, perfTimes, debug, orgName] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache, orgName);\n// postMessage(result);\n// if (debug) inspectWorker('interaction', result[0]);\n// });\n","import {fetchAndParse, inspectWorker} from './cache-lib';\n\n/** Parse synonym cache TSV data, return array of useful transforms */\nexport function parseSynonymCache(rawTsv, perfTimes) {\n const byGene = {};\n // const nameCaseMap = {};\n\n let t0 = performance.now();\n const lines = rawTsv.split(/\\r\\n|\\n/);\n perfTimes.rawTsvSplit = Math.round(performance.now() - t0);\n\n t0 = performance.now();\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '' || line[0] === '#') continue; // Skip empty lines, headers\n\n const splitLine = line.trim().split(/\\t/);\n\n const gene = splitLine[0];\n const synonyms = splitLine.slice(1);\n\n byGene[gene] = synonyms;\n\n // For now, initialization is JITed in related-genes.js, as use is rare.\n // nameCaseMap[gene.toLowerCase()] = synonyms.map(s => s.toLowerCase());\n };\n const t1 = performance.now();\n perfTimes.parseCacheLoop = Math.round(t1 - t0);\n\n return {byGene};\n}\n\n// Uncomment when workers work outside localhost\n// addEventListener('message', async event => {\n// console.time('geneSynonymCacheWorker');\n// const [cacheUrl, perfTimes, debug] = event.data;\n// const result = await fetchAndParse(cacheUrl, perfTimes, parseCache);\n// postMessage(result);\n// if (debug) inspectWorker('geneStructure', result[0]);\n// });\n","import {d3} from '../lib';\nimport collinearizeChromosomes from '../collinear';\nimport {initCaches} from './caches/cache';\n\nfunction processLabels(config, ideo) {\n var i, chrID, t0C, t1C;\n\n if (config.showBandLabels === true) {\n t0C = new Date().getTime();\n ideo.hideUnshownBandLabels();\n t1C = new Date().getTime();\n if (config.debug) {\n console.log('Time in showing bands: ' + (t1C - t0C) + ' ms');\n }\n\n if (config.orientation === 'vertical') {\n for (i = 0; i < ideo.chromosomesArray.length; i++) {\n chrID = '#' + ideo.chromosomesArray[i].id;\n ideo.rotateChromosomeLabels(d3.select(chrID), i);\n }\n }\n }\n\n if (config.showChromosomeLabels === true) {\n ideo.drawChromosomeLabels(ideo.chromosomes);\n }\n}\n\nfunction processAnnots(ideo) {\n if (typeof ideo.timeout !== 'undefined') window.clearTimeout(ideo.timeout);\n\n ideo.rawAnnots = ideo.setOriginalTrackIndexes(ideo.rawAnnots);\n\n if (ideo.config.annotationsDisplayedTracks) {\n ideo.annots =\n ideo.updateDisplayedTracks(ideo.config.annotationsDisplayedTracks);\n } else {\n ideo.annots = ideo.processAnnotData(ideo.rawAnnots);\n if (ideo.config.filterable) ideo.initCrossFilter();\n ideo.drawProcessedAnnots(ideo.annots);\n }\n}\n\n/**\n * Load (potentially large) annotation dataset, then process it.\n */\nfunction waitForAndProcessAnnots(ideo) {\n if (ideo.rawAnnots) {\n processAnnots(ideo);\n } else {\n (function checkAnnotData() {\n ideo.timeout = setTimeout(function() {\n if (\n !ideo.rawAnnots ||\n (ideo.rawAnnots && typeof ideo.rawAnnots.then !== 'undefined')\n ) {\n // Ensure rawAnnots is defined and not a Promise (not \"then\"-able)\n checkAnnotData();\n } else {\n processAnnots(ideo);\n }\n }, 50);\n })();\n }\n}\n\nfunction reportDebugTimings(config, t0, t0A) {\n\n var t1A = new Date().getTime();\n if (config.debug) {\n console.log('Time in drawChromosome: ' + (t1A - t0A) + ' ms');\n }\n\n var t1 = new Date().getTime();\n if (config.debug) {\n console.log('Time constructing ideogram: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Completes high-level initialization.\n * Draws chromosomes and band labels, rotating as needed;\n * processes and draws annotations;\n * creates brush, emits notification of load completion, etc.\n */\nfunction finishInit(t0) {\n var t0A = new Date().getTime(),\n ideo = this,\n config = ideo.config,\n confAnnots = config.annotations;\n\n ideo.initDrawChromosomes();\n\n if (config.annotationsPath) waitForAndProcessAnnots(ideo);\n\n processLabels(config, ideo);\n\n // Create a brush or a click cursor if specified\n if (config.brush) ideo.createBrush(config.brush);\n else if (config.cursorPosition) ideo.createClickCursor(config.cursorPosition);\n\n if (confAnnots) {\n if (Array.isArray(confAnnots)) {\n ideo.drawAnnots(confAnnots);\n } else {\n // Enable client-side-defined annotations to be formatted\n // like the wider variety of server-side-defined annotations.\n // Supports https://github.com/eweitz/ideogram/issues/137\n ideo.rawAnnots = confAnnots;\n ideo.afterRawAnnots();\n processAnnots(ideo);\n }\n }\n\n reportDebugTimings(config, t0, t0A);\n\n ideo.setOverflowScroll();\n\n if (config.geometry === 'collinear') collinearizeChromosomes(ideo);\n\n if (ideo.config.debug) console.time('initCache: Ideogram');\n initCaches(ideo).then(() => {\n if (ideo.config.debug) console.timeEnd('initCache: Ideogram');\n if (ideo.onLoadCallback) ideo.onLoadCallback();\n });\n}\n\nexport {finishInit};\n","export class Ploidy {\n\n constructor(config) {\n this._config = config;\n this._description = this._normalize(this._config.ploidyDesc);\n }\n\n // Get number of chromosomes in a chromosome set\n getChromosomesNumber(setIndex) {\n if (this._config.ploidyDesc) {\n var chrSetCode = this._config.ploidyDesc[setIndex];\n if (chrSetCode instanceof Object) {\n return Object.keys(chrSetCode)[0].length;\n } else {\n return chrSetCode.length;\n }\n } else {\n return this._config.ploidy || 1;\n }\n }\n\n // Normalize use defined description\n _normalize(description) {\n var key, descValue,\n normalized = [];\n\n if (!description) return description;\n\n // Loop through description and normalize\n for (key in description) {\n descValue = description[key];\n if (typeof descValue === 'string') {\n if (this._config.orientation === 'vertical') {\n descValue = descValue.split('').reverse();\n }\n normalized.push({\n ancestors: descValue,\n existence: this._getexistenceArray(descValue.length)\n });\n } else {\n normalized.push({\n ancestors: Object.keys(descValue)[0],\n existence: descValue[Object.keys(descValue)[0]]\n });\n }\n }\n\n return normalized;\n }\n\n // Get array filled by '11' elements\n _getexistenceArray(length) {\n var array = [];\n\n for (var i = 0; i < length; i++) {\n array.push('11');\n }\n\n return array;\n }\n\n getSetSize(chrSetIndex) {\n if (this._description) {\n return this._description[chrSetIndex].ancestors.length;\n } else {\n return 1;\n }\n }\n\n // Get ancestor letter\n getAncestor(chrSetIndex, chrIndex) {\n if (this._description) {\n return this._description[chrSetIndex].ancestors[chrIndex];\n } else {\n return '';\n }\n }\n\n // Check if chromosome's arm should be rendered.\n // If no description was provided, method returns true and\n // something another depending on user provided description.\n exists(chrSetIndex, chrIndex, armIndex) {\n if (this._description) {\n var desc =\n this._description[chrSetIndex].existence[chrIndex][armIndex];\n return Number(desc) > 0;\n } else {\n return true;\n }\n }\n\n}\n","import {d3} from '../lib';\n\n/**\n * Chromosome's view utility class\n */\nexport class ChromosomeUtil {\n\n constructor(node) {\n this._node = node;\n }\n\n getLabel() {\n var label =\n d3\n .select(this._node.parentNode)\n .select('text.chrLabel')\n .text();\n return label;\n }\n\n /**\n * Get chromosome set label\n */\n getSetLabel() {\n var setLabel =\n d3\n .select(this._node.parentNode)\n .select('text.chrSetLabel')\n .text();\n return setLabel;\n }\n}\n","import {d3} from '../lib';\nimport {ChromosomeUtil} from './../views/chromosome-util';\n\nclass Layout {\n\n constructor(config, ideo) {\n this._config = config;\n this._ideo = ideo;\n this._ploidy = this._ideo._ploidy;\n this._translate = undefined;\n\n if ('chrSetMargin' in config) {\n this.chrSetMargin = config.chrSetMargin;\n } else {\n var chrMargin = this._config.chrMargin;\n this.chrSetMargin = (this._config.ploidy > 1 ? chrMargin : 0);\n }\n\n // Chromosome band's size.\n this._tickSize = 8;\n\n // Chromosome rotation state.\n this._isRotated = false;\n }\n\n // Get chart left margin\n _getLeftMargin() {\n return this.margin.left;\n }\n\n // Get rotated chromosome y scale\n _getYScale() {\n // 20 is width of rotated chromosome.\n return 20 / this._config.chrWidth;\n }\n\n // Get chromosome labels\n getChromosomeLabels(chrElement) {\n var util = new ChromosomeUtil(chrElement),\n labels = [];\n\n if (this._ideo.config.ploidy > 1) {\n labels.push(util.getSetLabel());\n }\n labels.push(util.getLabel());\n\n return labels.filter(function(d) {\n return d.length > 0;\n });\n }\n\n getChromosomeBandLabelTranslate(band) {\n var x, y, translate,\n ideo = this._ideo,\n tickSize = this._tickSize,\n orientation = ideo.config.orientation;\n\n if (orientation === 'vertical') {\n x = tickSize;\n y = ideo.round(2 + band.px.start + band.px.width / 2);\n translate = 'rotate(-90)translate(' + x + ',' + y + ')';\n } else if (orientation === 'horizontal') {\n x = ideo.round(-tickSize + band.px.start + band.px.width / 2);\n y = -10;\n translate = 'translate(' + x + ',' + y + ')';\n }\n\n return {\n x: x,\n y: y,\n translate: translate\n };\n }\n\n didRotate(chrIndex, chrElement) {\n var ideo, taxid, chrName, bands, chrModel, oldWidth,\n chrSetElement, transform, scale, scaleRE;\n\n ideo = this._ideo;\n taxid = ideo.config.taxid;\n chrName = chrElement.id.split('-')[0].replace('chr', '');\n chrModel = ideo.chromosomes[taxid][chrName];\n bands = chrModel.bands;\n\n chrSetElement = d3.select(chrElement.parentNode);\n transform = chrSetElement.attr('transform');\n scaleRE = /scale\\(.*\\)/;\n scale = scaleRE.exec(transform);\n transform = transform.replace(scale, '');\n chrSetElement.attr('transform', transform);\n\n oldWidth = chrModel.width;\n\n chrModel = ideo.getChromosomeModel(bands, chrName, taxid, chrIndex);\n\n chrModel.oldWidth = oldWidth;\n\n ideo.chromosomes[taxid][chrName] = chrModel;\n ideo.drawChromosome(chrModel);\n\n ideo.handleRotateOnClick();\n\n if (ideo.rawAnnots) {\n if (ideo.displayedTrackIndexes) {\n ideo.updateDisplayedTracks(ideo.displayedTrackIndexes);\n } else {\n ideo.annots = ideo.processAnnotData(ideo.rawAnnots);\n ideo.drawProcessedAnnots(ideo.annots);\n\n if (ideo.config.filterable) {\n ideo.initCrossFilter();\n }\n }\n }\n\n if (ideo.config.showBandLabels === true) {\n ideo.drawBandLabels(ideo.chromosomes);\n ideo.hideUnshownBandLabels();\n }\n\n if (ideo.onDidRotateCallback) {\n ideo.onDidRotateCallback(chrModel);\n }\n }\n\n rotate(chrSetIndex, chrIndex, chrElement) {\n var ideo, otherChrs, ideoBounds, labelSelectors;\n ideo = this._ideo;\n\n labelSelectors = (\n ideo.selector + ' .chrSetLabel, ' + ideo.selector + ' .chrLabel'\n );\n\n ideoBounds = document.querySelector(ideo.selector).getBoundingClientRect();\n\n // Find chromosomes which should be hidden\n otherChrs = d3.selectAll(ideo.selector + ' g.chromosome')\n .filter(function() {return this !== chrElement;});\n\n if (this._isRotated) {\n\n this._isRotated = false;\n\n ideo.config.chrHeight = ideo.config.chrHeightOriginal;\n ideo.config.chrWidth = ideo.config.chrWidthOriginal;\n ideo.config.annotationHeight = ideo.config.annotationHeightOriginal;\n\n // Rotate chromosome back\n this.rotateBack(chrSetIndex, chrIndex, chrElement, function() {\n // Show all other chromosomes and chromosome labels\n otherChrs.style('display', null);\n d3.selectAll(labelSelectors).style('display', null);\n ideo._layout.didRotate(chrIndex, chrElement);\n });\n\n } else {\n\n this._isRotated = true;\n\n // Hide all other chromosomes and chromosome labels\n otherChrs.style('display', 'none');\n d3.selectAll(labelSelectors).style('display', 'none');\n\n // Rotate chromosome\n this.rotateForward(chrSetIndex, chrIndex, chrElement, function() {\n\n var chrHeight, elementLength, windowLength;\n\n ideo.config.chrHeightOriginal = ideo.config.chrHeight;\n ideo.config.chrWidthOriginal = ideo.config.chrWidth;\n ideo.config.annotationHeightOriginal = ideo.config.annotationHeight;\n\n const settingsGearWidth = 20;\n\n if (ideo._layout._class === 'VerticalLayout') {\n elementLength = ideoBounds.width - settingsGearWidth;\n windowLength = window.innerWidth - settingsGearWidth;\n } else {\n elementLength = ideoBounds.height - 10;\n windowLength = window.innerHeight - 10;\n }\n\n // Set chromosome height to window length or ideogram element length,\n // whichever is smaller. This keeps whole chromosome viewable, while\n // also ensuring the height doesn't exceed what the user specified.\n if (windowLength < elementLength) {\n chrHeight = windowLength;\n } else {\n chrHeight = elementLength;\n }\n chrHeight -= ideo.config.chrMargin * 2;\n ideo.config.chrHeight = chrHeight;\n\n // Account for chromosome label\n // TODO: Make this dynamic, not hard-coded\n ideo.config.chrWidth *= 2.3;\n\n ideo.config.annotationHeight *= 1.7;\n\n ideo._layout.didRotate(chrIndex, chrElement);\n });\n }\n }\n\n getChromosomeLabelClass() {\n if (this._config.ploidy === 1) {\n return 'chrLabel';\n } else {\n return 'chrSetLabel';\n }\n }\n\n _getAdditionalOffset() {\n var config = this._config;\n var numTracks = config.annotationsNumTracks || config.numAnnotTracks || 1;\n return (config.annotationHeight || 0) * numTracks;\n }\n\n _getChromosomeSetSize(chrSetIndex) {\n // Get last chromosome set size.\n var setSize = this._ploidy.getSetSize(chrSetIndex);\n\n // Increase offset by last chromosome set size\n return (\n setSize * this._config.chrWidth * 2 + (this.chrSetMargin)\n );\n }\n\n // Get chromosome set label anchor property\n getChromosomeSetLabelAnchor() {\n return 'middle';\n }\n\n // Get chromosome label y position.\n getChromosomeLabelYPosition() {\n return -5.5;\n }\n\n getChromosomeSetLabelYPosition(chrIndex) {\n if (this._config.ploidy === 1) {\n return this.getChromosomeLabelYPosition(chrIndex);\n } else {\n return -2 * this._config.chrWidth;\n }\n }\n\n}\n\nexport default Layout;\n","/**\n* @fileoverview Vertical layout class\n* Ideogram instances with vertical layout are oriented with each chromosome\n* starting at top and ending at bottom, and aligned as columns.\n*/\n\nimport {d3} from '../lib';\nimport Layout from './layout';\n\nclass VerticalLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n this._class = 'VerticalLayout';\n // Layout margins\n this.margin = {\n top: 30,\n left: 15\n };\n }\n\n rotateForward(chrSetIndex, chrIndex, chrElement, callback) {\n // TODO: Integrate chrSetIndex and chrIndex to support polyploid rotation.\n\n var self = this;\n\n var xOffset = 20;\n\n var scale = this.getChromosomeScale(chrElement);\n\n var transform =\n 'translate(' + xOffset + ', 25) ' + scale;\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr('transform', transform)\n .on('end', callback);\n\n // Append new chromosome labels\n var labels = this.getChromosomeLabels(chrElement);\n var y = (xOffset + self._config.chrWidth) * 1.3;\n d3.select(this._ideo.getSvg())\n .append('g')\n .attr('class', 'tmp')\n .selectAll('text')\n .data(labels)\n .enter()\n .append('text')\n .attr('class', function(d, i) {\n return i === 0 && labels.length === 2 ? 'chrSetLabel' : null;\n })\n .attr('x', 0)\n .attr('y', y).style('opacity', 0)\n .text(String)\n .transition()\n .style('opacity', 1);\n\n this._ideo.config.orientation = 'horizontal';\n }\n\n rotateBack(setIndex, chrIndex, chrElement, callback) {\n\n var scale = this.getChromosomeScaleBack(chrElement);\n var translate = this.getChromosomeSetTranslate(setIndex);\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr('transform', translate + ' ' + scale)\n .on('end', callback);\n\n d3.selectAll(this._ideo.selector + ' g.tmp')\n .style('opacity', 0)\n .remove();\n\n this._ideo.config.orientation = 'vertical';\n }\n\n getHeight() {\n return this._config.chrHeight + this.margin.top * 1.5;\n }\n\n getWidth() {\n return '97%';\n }\n\n getChromosomeBandTickY1() {\n return 2;\n }\n\n getChromosomeBandTickY2() {\n return 10;\n }\n\n getChromosomeSetLabelTranslate() {\n return 'rotate(-90)';\n }\n\n getChromosomeBandLabelAnchor() {\n return null;\n }\n\n getChromosomeScale(chrElement) {\n var ideoBox, chrBox, scaleX, scaleY;\n\n ideoBox = d3.select(this._ideo.selector).node().getBoundingClientRect();\n chrBox = chrElement.getBoundingClientRect();\n\n scaleX = (ideoBox.width / chrBox.height) * 0.97;\n scaleY = this._getYScale();\n\n return 'scale(' + scaleX + ', ' + scaleY + ')';\n }\n\n getChromosomeScaleBack(chrElement) {\n var scale, scaleX, scaleY, chrName, chrModel, taxid, ideo, config;\n\n ideo = this._ideo;\n config = ideo.config;\n taxid = config.taxid;\n\n chrName = chrElement.id.split('-')[0].replace('chr', '');\n chrModel = this._ideo.chromosomes[taxid][chrName];\n scaleX = (chrModel.oldWidth / (config.chrHeight * 3)) * 0.97;\n scaleY = 1 / this._getYScale();\n scale = 'scale(' + scaleX + ', ' + scaleY + ')';\n return scale;\n }\n\n getChromosomeSetTranslate(setIndex) {\n var marginTop = this.margin.top;\n var chromosomeSetYTranslate = this.getChromosomeSetYTranslate(setIndex);\n return (\n 'rotate(90) ' +\n 'translate(' + marginTop + ', -' + chromosomeSetYTranslate + ')'\n );\n }\n\n getChromosomeSetYTranslate(setIndex) {\n // Get additional padding caused by annotation/histogram tracks\n var pad = this._getAdditionalOffset(),\n config = this._config,\n margin = config.chrMargin,\n width = config.chrWidth,\n translate;\n\n // If no detailed description provided just use one formula for all cases\n if (!config.ploidyDesc) {\n // TODO:\n // This part of code contains a lot magic numbers and if\n // statements for exactly corresponing to original ideogram examples.\n // But all this stuff should be removed. Calculation of translate\n // should be a simple formula applied for all cases listed below.\n // Now they are diffirent because of Layout:_getAdditionalOffset do\n // not meet for cases when no annotation, when annotation exists and\n // when histogram used\n\n if (config.annotationsLayout === 'histogram') {\n var barWidth = config.barWidth;\n return margin + setIndex * (margin + width + 3) + barWidth * 2;\n } else {\n const decorPad =\n 'legendPad' in config ? config.legendPad : 0;\n translate = width + setIndex * (margin + width) + pad * 2 + decorPad;\n if (pad > 0) {\n return translate;\n } else {\n return translate + 4 + (2 * setIndex);\n }\n }\n }\n\n // If detailed description provided start to calculate offsets\n // for each chromosome set separately. This should be done only once\n if (!this._translate) {\n // First offset equals to zero\n this._translate = [this._ploidy.getSetSize(0) * width * 2];\n var prevTranslate;\n // Loop through description set\n for (var i = 1; i < this._config.ploidyDesc.length; i++) {\n prevTranslate = this._translate[i - 1];\n this._translate[i] = prevTranslate + this._getChromosomeSetSize(i - 1);\n }\n }\n\n return this._translate[setIndex];\n }\n\n getChromosomeSetLabelXPosition() {\n return (this._config.chrWidth * this._config.ploidy) / -2;\n }\n\n getChromosomeLabelXPosition() {\n return this._config.chrWidth / -2;\n }\n}\n\nexport default VerticalLayout;\n","/**\n* @fileoverview Horizontal layout class\n* Ideogram instances with horizontal layout are oriented with each chromosome\n* starting at left and ending at right, and aligned as rows.\n*/\n\nimport {d3} from '../lib';\nimport Layout from './layout';\n\nclass HorizontalLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n this._class = 'HorizontalLayout';\n this.margin = {\n left: 20,\n top: 30\n };\n }\n\n _getLeftMargin() {\n var margin = Layout.prototype._getLeftMargin.call(this);\n if (this._config.ploidy > 1) {\n margin *= 1.8;\n }\n\n return margin;\n }\n\n rotateForward(setIndex, chrIndex, chrElement, callback) {\n\n var xOffset, yOffset, transform, labels;\n\n xOffset = 30;\n\n yOffset = xOffset + 7.5;\n\n transform = (\n 'rotate(90) ' +\n 'translate(' + xOffset + ', -' + yOffset + ') '\n );\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr('transform', transform)\n .on('end', callback);\n\n // Append new chromosome labels\n labels = this.getChromosomeLabels(chrElement);\n d3.select(this._ideo.getSvg())\n .append('g')\n .attr('class', 'tmp')\n .selectAll('text')\n .data(labels)\n .enter()\n .append('text')\n .attr('class', function(d, i) {\n return i === 0 && labels.length === 2 ? 'chrSetLabel' : null;\n })\n .attr('x', xOffset - 4)\n .attr('y', function(d, i) {\n return (i + 1 + labels.length % 2) * 12;\n })\n .style('text-anchor', 'middle')\n .style('opacity', 0)\n .text(String)\n .transition()\n .style('opacity', 1);\n\n this._ideo.config.orientation = 'vertical';\n }\n\n rotateBack(setIndex, chrIndex, chrElement, callback) {\n var translate = this.getChromosomeSetTranslate(setIndex);\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr('transform', translate)\n .on('end', callback);\n\n d3.selectAll(this._ideo.selector + ' g.tmp')\n .style('opacity', 0)\n .remove();\n\n this._ideo.config.orientation = 'horizontal';\n }\n\n getHeight(taxid) {\n if (typeof taxid === 'undefined') taxid = this._config.taxids[0];\n // Get last chromosome set offset.\n var numChromosomes = this._config.chromosomes[taxid].length;\n var lastSetOffset = this.getChromosomeSetYTranslate(numChromosomes - 1);\n\n // Get last chromosome set size.\n var lastSetSize = this._getChromosomeSetSize(numChromosomes - 1);\n\n // Increase offset by last chromosome set size\n lastSetOffset += lastSetSize;\n\n return lastSetOffset + this._getAdditionalOffset() * 2;\n }\n\n getWidth() {\n return this._config.chrHeight + this.margin.top * 1.5;\n }\n\n getChromosomeSetLabelAnchor() {\n return 'end';\n }\n\n getChromosomeBandLabelAnchor() {\n return null;\n }\n\n getChromosomeBandTickY1() {\n return 2;\n }\n\n getChromosomeBandTickY2() {\n return 10;\n }\n\n getChromosomeSetLabelTranslate() {\n return null;\n }\n\n getChromosomeSetTranslate(setIndex) {\n var leftMargin = this._getLeftMargin();\n var yTranslate = this.getChromosomeSetYTranslate(setIndex);\n return 'translate(' + leftMargin + ', ' + yTranslate + ')';\n }\n\n getChromosomeSetYTranslate(setIndex) {\n // If no detailed description provided just use one formula for all cases.\n if (!this._config.ploidyDesc) {\n return this._config.chrMargin * (setIndex + 1);\n }\n\n // Id detailed description provided start to calculate offsets\n // for each chromosome set separately. This should be done only once.\n if (!this._translate) {\n // First offset equals to zero.\n this._translate = [1];\n\n // Loop through description set\n for (var i = 1; i < this._config.ploidyDesc.length; i++) {\n this._translate[i] =\n this._translate[i - 1] + this._getChromosomeSetSize(i - 1);\n }\n }\n\n return this._translate[setIndex];\n }\n\n getChromosomeSetLabelXPosition(i) {\n if (this._config.ploidy === 1) {\n return this.getChromosomeLabelXPosition(i);\n } else {\n return -20;\n }\n }\n\n getChromosomeSetLabelYPosition(i) {\n var setSize = this._ploidy.getSetSize(i),\n config = this._config,\n chrMargin = config.chrMargin,\n chrWidth = config.chrWidth,\n y;\n\n if (config.ploidy === 1) {\n y = chrWidth / 2 + 3;\n } else {\n y = (setSize * chrMargin) / 2;\n }\n\n return y;\n }\n\n getChromosomeLabelXPosition() {\n return -8;\n }\n\n getChromosomeLabelYPosition() {\n return this._config.chrWidth;\n }\n\n}\n\nexport default HorizontalLayout;\n","/**\n* @fileoverview Paired layout class\n* Ideograms with paired layout group each chromosome in a chromosome set.\n* This enables ploidy support beyond the default haploid; e.g. diploid genomes.\n*/\n\nimport Layout from './layout';\n\nclass PairedLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n\n this._class = 'PairedLayout';\n\n this.margin = {\n left: 30\n };\n }\n\n getHeight() {\n return this._config.chrHeight + this.margin.left * 1.5;\n }\n\n getWidth() {\n return '97%';\n }\n\n getChromosomeBandTickY1(chrIndex) {\n return chrIndex % 2 ? this._config.chrWidth : this._config.chrWidth * 2;\n }\n\n getChromosomeBandTickY2(chrIndex) {\n var width = this._config.chrWidth;\n return chrIndex % 2 ? width - this._tickSize : width * 2 + this._tickSize;\n }\n\n getChromosomeBandLabelAnchor(chrIndex) {\n return chrIndex % 2 ? null : 'end';\n }\n\n getChromosomeBandLabelTranslate(band, chrIndex) {\n var x = chrIndex % 2 ? 10 : -this._config.chrWidth - 10;\n var y = this._ideo.round(band.px.start + band.px.width / 2) + 3;\n\n return {\n x: y,\n y: y,\n translate: 'rotate(-90) translate(' + x + ', ' + y + ')'\n };\n }\n\n getChromosomeLabelXPosition() {\n return -this._tickSize;\n }\n\n getChromosomeSetLabelXPosition() {\n return this._config.chrWidth / -2;\n }\n\n getChromosomeSetLabelTranslate() {\n return 'rotate(-90)';\n }\n\n getChromosomeSetTranslate(setIndex) {\n var chromosomeSetYTranslate = this.getChromosomeSetYTranslate(setIndex);\n return (\n 'rotate(90) ' +\n 'translate(' + this.margin.left + ', -' + chromosomeSetYTranslate + ')'\n );\n }\n\n getChromosomeSetYTranslate(setIndex) {\n return 200 * (setIndex + 1);\n }\n\n}\n\nexport default PairedLayout;\n","import Layout from './layout';\n\nclass SmallLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n\n this._class = 'SmallLayout';\n\n this.margin = {\n left: 36.5,\n top: 10\n };\n\n var taxid = this._ideo.getTaxid(this._ideo.config.organism);\n\n this.chrs = config.chromosomes[taxid];\n var numChrs = this.chrs.length;\n\n // Number of chromosomes per row\n this.chrsPerRow = Math.ceil(numChrs / config.rows);\n }\n\n // rotateForward(setIndex, chrIndex, chrElement, callback) {\n // var ideoBox =\n // d3.select(this._ideo.selector).node().getBoundingClientRect();\n // var chrBox = chrElement.getBoundingClientRect();\n //\n // var scaleX = (ideoBox.width / chrBox.height) * 0.97;\n // var scaleY = this._getYScale();\n //\n // transform = 'translate(5, 25) scale(' + scaleX + ', ' + scaleY + ')';\n //\n // d3.select(chrElement.parentNode)\n // .transition()\n // .attr('transform', transform)\n // .on('end', callback);\n // }\n //\n // rotateBack(setIndex, chrIndex, chrElement, callback) {\n // var translate = this.getChromosomeSetTranslate(setIndex);\n //\n // d3.select(chrElement.parentNode)\n // .transition()\n // .attr('transform', translate)\n // .on('end', callback);\n // }\n\n /**\n * eweitz 2020-04-13:\n * This height metric is crude because it is calculated before\n * the height (\"width\") of each chromosome is calculated.\n *\n * It calculates height by multiplying the max height of all chromosomes\n * (specified in the Ideogram configuration object) by the number of rows.\n * This ensures the ideogram height doesn't truncate in cases like dog\n * (where chrX on the second row is longer than chr1 on the first), but it\n * often leaves too much space on the second row, e.g. for human.\n *\n * Ideally, ideogram height would be cumulative height per row, plus top\n * margin. This would require calling getHeight _after_ all chromosomes\n * have had their height (technically, chr.width) assigned. See draft new\n * getHeight method below this getHeight method.\n */\n getHeight() {\n var config = this._config;\n var chrHeight = config.chrHeight * 1.25;\n return this._config.rows * (chrHeight + this.margin.top);\n }\n\n /**\n * eweitz 2020-04-13:\n * Draft refinement of getHeight. See note in classic version above.\n *\n * Total height is cumulative height per row, plus top margin\n */\n // getHeight() {\n // let height = 0;\n // const rows = this._config.rows;\n // const chrEntries = Object.entries(this.chrs);\n\n // for (let i = 0; i < rows; i++) {\n // let rowHeight = 0;\n // // Starting and ending indexes of chromosomes of this row\n // const startIndex = this.chrsPerRow * i;\n // const endIndex = this.chrsPerRow * (i + 1) - 1;\n\n // for (let j = startIndex; j < endIndex; j++) {\n // const thisChrHeight = chrEntries[j][1].width;\n // if (thisChrHeight > rowHeight) {\n // rowHeight = thisChrHeight;\n // }\n // }\n // height += rowHeight + this.margin.top;\n // }\n\n // return height;\n // }\n\n getWidth() {\n return '97%';\n }\n\n getChromosomeBandLabelTranslate() {\n\n }\n\n getChromosomeSetLabelTranslate() {\n return 'rotate(-90)';\n }\n\n getChromosomeSetTranslate(setIndex) {\n var xOffset, yOffset;\n\n if (setIndex > this.chrsPerRow - 1) {\n xOffset = this.margin.left + this._config.chrHeight * 1.3;\n yOffset = this.getChromosomeSetYTranslate(setIndex - this.chrsPerRow);\n } else {\n xOffset = this.margin.left;\n yOffset = this.getChromosomeSetYTranslate(setIndex);\n }\n\n return 'rotate(90) translate(' + xOffset + ', -' + yOffset + ')';\n }\n\n getChromosomeSetYTranslate(setIndex) {\n // Get additional padding caused by annotation tracks\n var additionalPadding = this._getAdditionalOffset() * 0.3;\n // If no detailed description provided just use one formula for all cases\n return (\n this.margin.left * (setIndex) + this._config.chrWidth +\n additionalPadding * 2 + additionalPadding * setIndex\n );\n }\n\n getChromosomeSetLabelXPosition(setIndex) {\n return (\n ((this._ploidy.getSetSize(setIndex) * this._config.chrWidth + 20) / -2) +\n (this._config.ploidy > 1 ? 0 : this._config.chrWidth)\n );\n }\n\n getChromosomeLabelXPosition() {\n return this._config.chrWidth / -2;\n }\n\n}\n\nexport default SmallLayout;\n","import {d3} from '../lib';\nimport {Ploidy} from '../ploidy';\nimport {getLayout} from '../layouts/layout-adapter';\n\n/**\n * If ploidy description is a string, then convert it to the canonical\n * array format. String ploidyDesc is used when depicting e.g. parental\n * origin each member of chromosome pair in a human genome.\n * See ploidy-basic.html for usage example.\n */\nfunction setPloidy(ideo) {\n if (\n 'ploidyDesc' in ideo.config &&\n typeof ideo.config.ploidyDesc === 'string'\n ) {\n var tmp = [];\n for (var i = 0; i < ideo.numChromosomes; i++) {\n tmp.push(ideo.config.ploidyDesc);\n }\n ideo.config.ploidyDesc = tmp;\n }\n // Organism ploidy description\n ideo._ploidy = new Ploidy(ideo.config);\n}\n\nfunction getContainerSvgClass(ideo) {\n var svgClass = '';\n if (ideo.config.showChromosomeLabels) {\n if (ideo.config.orientation === 'horizontal') {\n svgClass += 'labeledLeft ';\n } else {\n svgClass += 'labeled ';\n }\n }\n\n if (ideo.config.rotatable === false) {\n svgClass += 'no-rotate ';\n }\n\n if (\n ideo.config.annotationsLayout &&\n ideo.config.annotationsLayout === 'overlay'\n ) {\n svgClass += 'faint';\n }\n\n return svgClass;\n}\n\n/** Hide tooltip upon pressing \"esc\" on keyboard */\nfunction handleEscape(event) {\n if (event.keyCode === 27) { // \"Escape\" key pressed\n const tooltip = document.querySelector('#_ideogramTooltip');\n if (!tooltip) return;\n tooltip.style.opacity = 0;\n }\n}\n\n/**\n * Write tooltip div setup with default styling.\n */\nfunction writeTooltipContainer(ideo) {\n d3.select(ideo.config.container + ' #_ideogramOuterWrap').append('div')\n .attr('class', '_ideogramTooltip')\n .attr('id', '_ideogramTooltip')\n .style('opacity', 0)\n .style('position', 'fixed')\n .style('text-align', 'center')\n .style('padding', '4px')\n .style('font', '12px sans-serif')\n .style('background', 'white')\n .style('border', '1px solid black')\n .style('border-radius', '5px')\n .style('z-index', '1000')\n .style('margin-left', '-2px'); // Mitigate crowding, e.g. BRCA1 for RAD51\n\n document.removeEventListener('keydown', handleEscape);\n document.addEventListener('keydown', handleEscape);\n}\n\nfunction writeContainerDom(ideo) {\n\n // Remove any previous container content\n d3.selectAll(ideo.config.container + ' #_ideogramOuterWrap').remove();\n\n d3.select(ideo.config.container)\n .append('div')\n .attr('id', '_ideogramOuterWrap')\n .append('div')\n .attr('id', '_ideogramTrackLabelContainer')\n .style('position', 'absolute');\n\n d3.select(ideo.config.container + ' #_ideogramOuterWrap').append('div')\n .attr('id', '_ideogramMiddleWrap') // needed for overflow and scrolling\n .style('position', 'relative')\n .style('overflow-x', 'auto')\n .style('transform', 'translateZ(0)') // add compositing layer for ideogram\n .append('div')\n .attr('id', '_ideogramInnerWrap') // needed for overflow and scrolling\n .append('svg')\n .attr('id', '_ideogram')\n .attr('class', getContainerSvgClass(ideo))\n .attr('width', ideo._layout.getWidth())\n .attr('height', ideo._layout.getHeight())\n .html(ideo.getBandColorGradients());\n}\n\n/**\n * Writes the HTML elements that contain this ideogram instance.\n */\nfunction writeContainer(t0) {\n var ideo = this;\n\n if (ideo.config.annotationsPath) {\n ideo.fetchAnnots(ideo.config.annotationsPath);\n }\n\n setPloidy(ideo);\n\n ideo._layout = getLayout(ideo);\n\n writeContainerDom(ideo);\n\n ideo.isOnlyIdeogram = document.querySelectorAll('#_ideogram').length === 1;\n writeTooltipContainer(ideo);\n ideo.finishInit(t0);\n}\n\nexport {writeContainer};\n","import VerticalLayout from './vertical-layout';\nimport HorizontalLayout from './horizontal-layout';\nimport PairedLayout from './paired-layout';\nimport SmallLayout from './small-layout';\n\nfunction getLayout(ideo) {\n var config = ideo.config;\n\n if ('perspective' in config && config.perspective === 'comparative') {\n return new PairedLayout(config, ideo);\n } else if ('rows' in config && config.rows > 1) {\n return new SmallLayout(config, ideo);\n } else if (config.orientation === 'vertical') {\n return new VerticalLayout(config, ideo);\n } else if (config.orientation === 'horizontal') {\n return new HorizontalLayout(config, ideo);\n } else {\n return new VerticalLayout(config, ideo);\n }\n}\n\nexport {getLayout};\n","import {hasNonGenBankAssembly, fetchWithRetry} from '../lib';\n\nvar lastBandDataUrl = '';\n\nfunction getBandUrl(bandDataFileNames, taxid, ideo) {\n return ideo.config.dataDir + bandDataFileNames[taxid];\n}\n\nfunction shouldFetchBands(bandDataFileNames, taxid, ideo) {\n var bandDataUrl = getBandUrl(bandDataFileNames, taxid, ideo);\n return (\n !(typeof window.chrBands !== 'undefined' && lastBandDataUrl === '') ||\n lastBandDataUrl !== bandDataUrl\n ) &&\n hasNonGenBankAssembly(ideo) &&\n taxid in bandDataFileNames;\n}\n\nfunction setBandData(url, fileNames, chrBands, ideo) {\n var taxid, fetchedTaxid, fileName;\n\n // Ensures correct taxid is processed in response callback;\n // using simply upstream 'taxid' variable gives the last\n // *requested* taxid, which fails when dealing with multiple taxa.\n for (taxid in fileNames) {\n fileName = fileNames[taxid];\n if (url.includes(fileName) && fileName !== '') {\n fetchedTaxid = taxid;\n }\n }\n\n ideo.bandData[fetchedTaxid] = chrBands;\n}\n\nfunction fetchBands(bandDataFileNames, taxid, t0, ideo) {\n var bandDataUrl = getBandUrl(bandDataFileNames, taxid, ideo);\n\n if (!ideo.numBandDataResponses) ideo.numBandDataResponses = 0;\n\n return fetchWithRetry(bandDataUrl)\n .then(function(response) {\n return response.json().then(function(rawBands) {\n lastBandDataUrl = bandDataUrl;\n\n delete window.chrBands; // Remove any previous chrBands variable\n window.chrBands = rawBands.chrBands;\n\n setBandData(response.url, bandDataFileNames, chrBands, ideo);\n });\n });\n}\n\nexport {shouldFetchBands, fetchBands};\n","/**\n * @fileoveriew Methods for initialization\n */\n\nimport {d3, slug} from '../lib';\nimport {configure} from './configure';\nimport {finishInit} from './finish-init';\nimport {writeContainer} from './write-container';\nimport {shouldFetchBands, fetchBands} from '../bands/fetch';\nimport {organismMetadata} from './organism-metadata';\n\nfunction isHeterogameticChromosome(chrModel, chrIndex, ideo) {\n var ploidy = ideo.config.ploidy;\n return (\n 'sex' in ideo.config &&\n (\n ploidy === 2 && ideo.sexChromosomes.index + 1 === chrIndex ||\n ideo.config.sex === 'female' && chrModel.name === 'Y'\n )\n );\n}\n\nfunction prepareChromosomes(bandsArray, chrs, taxid, ideo) {\n var j, bands, chromosome, chrModel, chrIndex;\n\n for (j = 0; j < chrs.length; j++) {\n chromosome = chrs[j];\n if (typeof bandsArray !== 'undefined') bands = bandsArray[j];\n\n chrIndex = j + ideo.config.taxids.indexOf(taxid);\n chrModel = ideo.getChromosomeModel(bands, chromosome, taxid, chrIndex);\n\n if (typeof chromosome !== 'string') {\n chromosome = chromosome.name.split(' ').slice(-1)[0].replace('chr', '');\n }\n\n ideo.chromosomes[taxid][chromosome] = chrModel;\n ideo.chromosomesArray.push(chrModel);\n\n if (isHeterogameticChromosome(chrModel, j, ideo)) continue;\n\n ideo.drawChromosome(chrModel);\n }\n}\n\nfunction setCoordinateSystem(chrs, ideo) {\n if (\n typeof chrBands !== 'undefined' &&\n chrs.length >= chrBands.length / 2\n ) {\n ideo.coordinateSystem = 'bp';\n }\n}\n\n/**\n * Configures chromosome data and calls downstream chromosome drawing functions\n */\nfunction initDrawChromosomes() {\n var taxid, i, chrs, bandsArray,\n ideo = this,\n taxids = ideo.config.taxids;\n\n for (i = 0; i < taxids.length; i++) {\n taxid = taxids[i];\n chrs = ideo.config.chromosomes[taxid];\n\n bandsArray = ideo.bandsArray[taxid];\n\n if (!ideo.config.showNonNuclearChromosomes) {\n // Remove MT\n // TODO: Handle other non-nuclear chromosomes, e.g. CP, AP\n chrs = chrs.filter(chr => chr !== 'MT');\n if (typeof bandsArray !== 'undefined') {\n bandsArray = bandsArray.filter(bands => {\n return bands[0].chr !== 'MT';\n });\n }\n }\n\n setCoordinateSystem(chrs, ideo);\n\n ideo.chromosomes[taxid] = {};\n ideo.setSexChromosomes(chrs);\n\n prepareChromosomes(bandsArray, chrs, taxid, ideo);\n\n if (ideo.config.showBandLabels) ideo.drawBandLabels(ideo.chromosomes);\n ideo.handleRotateOnClick();\n ideo._gotChrModels = true; // Prevent issue with errant rat centromeres\n }\n}\n\n/**\n * Attach any click handlers to rotate and toggle chromosomes\n */\nfunction handleRotateOnClick() {\n var ideo = this;\n\n if (!('rotatable' in ideo.config && ideo.config.rotatable === false)) {\n d3.selectAll(ideo.selector + ' .chromosome-set').on('click', function() {\n // Handles click on chromosome graphic or label.\n // Label click needed to toggle e.g. human MT\n const element = this.children[1];\n\n ideo.rotateAndToggleDisplay(element);\n });\n } else {\n d3.selectAll(ideo.selector).style('cursor', 'default');\n }\n}\n\n/**\n * Called when Ideogram has finished initializing.\n * Accounts for certain ideogram properties not being set until\n * asynchronous requests succeed, etc.\n */\nfunction onLoad() {\n call(this.onLoadCallback);\n}\n\nfunction getBandFileName(taxid, accession, ideo) {\n var organism = ideo.organisms[taxid];\n var bandFileName = [slug(organism.scientificName)];\n var assemblies = organism.assemblies;\n var resolution = ideo.config.resolution;\n\n if (accession !== assemblies.default) {\n bandFileName.push(accession);\n }\n if (\n taxid === '9606' &&\n (accession in assemblies === 'false' &&\n Object.values(assemblies).includes(config.assembly) ||\n (resolution !== '' && resolution !== 850))\n ) {\n bandFileName.push(resolution);\n }\n\n bandFileName = bandFileName.join('-');\n\n var fullyBandedTaxids = ['9606', '10090', '10116'];\n if (fullyBandedTaxids.includes(taxid) && !ideo.config.showFullyBanded) {\n bandFileName += '-no-bands';\n }\n\n bandFileName += '.json';\n\n return bandFileName;\n}\n\nfunction getBandFileNames(taxid, bandFileNames, ideo) {\n var organism, assemblies, accession, bandFileName,\n config = ideo.config;\n\n organism = ideo.organisms[taxid];\n\n if (!config.assembly) ideo.config.assembly = 'default';\n\n assemblies = organism.assemblies;\n\n if (ideo.assemblyIsAccession()) {\n accession = config.assembly;\n } else {\n accession = assemblies[config.assembly];\n }\n\n bandFileName = getBandFileName(taxid, accession, ideo);\n var isCustomOrganism = taxid === '-1';\n\n if (taxid in ideo.organismsWithBands || isCustomOrganism) {\n bandFileNames[taxid] = bandFileName;\n }\n return bandFileNames;\n}\n\nfunction prepareContainer(taxid, bandFileNames, t0, ideo) {\n\n if (shouldFetchBands(bandFileNames, taxid, ideo)) {\n return fetchBands(bandFileNames, taxid, t0, ideo).then(function() {\n return ideo.processBandData(taxid);\n });\n } else {\n return new Promise(function(resolve) {\n ideo.processBandData(taxid);\n resolve([taxid, undefined]);\n });\n }\n}\n\nfunction initializeTaxids(ideo) {\n return new Promise(function(resolve) {\n var organism = ideo.config.organism;\n if (typeof organism === 'number') {\n // 'organism' is a taxid, e.g. 9606\n ideo.getOrganismFromEutils(organism, function() {\n ideo.getTaxids(resolve);\n });\n } else {\n ideo.getTaxids(resolve);\n }\n\n });\n}\n\nfunction getBandsAndPrepareContainer(taxids, t0, ideo) {\n var bandFileNames, i, taxid,\n promises = [];\n\n bandFileNames = {};\n for (taxid in organismMetadata) {\n bandFileNames[taxid] = '';\n }\n\n for (i = 0; i < taxids.length; i++) {\n taxid = String(taxids[i]);\n bandFileNames = getBandFileNames(taxid, bandFileNames, ideo);\n promises.push(prepareContainer(taxid, bandFileNames, t0, ideo));\n }\n\n Promise.all(promises).then(function(taxidsAndBandsArrays) {\n var taxidAndBandsArray, taxid, bandsArray;\n\n for (i = 0; i < taxidsAndBandsArrays.length; i++) {\n taxidAndBandsArray = taxidsAndBandsArrays[i];\n taxid = taxidAndBandsArray[0];\n bandsArray = taxidAndBandsArray[1];\n\n if ('bandsArray' in ideo === false) {\n ideo.bandsArray = {};\n }\n\n ideo.bandsArray[taxid] = bandsArray;\n }\n ideo.writeContainer(t0);\n });\n}\n\n/**\n * Initializes an ideogram.\n * Sets some high-level properties based on instance configuration,\n * fetches band and annotation data if needed, and\n * writes an SVG element to the document to contain the ideogram\n */\n// Prevents race condition when init is called multiple times in\n// quick succession.\n// See https://github.com/eweitz/ideogram/pull/154.\nvar ideoNext = {};\nvar ideoQueued = {};\nvar ideoWait = {};\n\nfunction init(ideo) {\n ideo = ideo || this;\n var containerId = ideo.config.container;\n\n if (ideoWait[containerId]) {\n ideoQueued[containerId] = true;\n ideoNext[containerId] = ideo;\n } else {\n ideoWait[containerId] = true;\n initializeTaxids(ideo)\n .then(function(taxids) {\n\n var taxid = taxids[0];\n ideo.config.taxid = taxid;\n ideo.config.taxids = taxids;\n\n ideo.organismScientificName =\n ideo.getScientificName(ideo.config.taxid);\n\n var t0 = new Date().getTime();\n getBandsAndPrepareContainer(taxids, t0, ideo);\n\n ideoWait[containerId] = false;\n if (ideoQueued[containerId]) {\n ideoQueued[containerId] = false;\n init(ideoNext[containerId]);\n }\n });\n }\n}\n\nexport {\n configure, initDrawChromosomes, handleRotateOnClick,\n onLoad, init, finishInit, writeContainer\n};\n","/**\n * @fileoverview Parse raw Ideogram.js annotations from a BED file\n * BED documentation: https://genome.ucsc.edu/FAQ/FAQformat#format1\n */\n\nexport class BedParser {\n\n constructor(bed, ideo) {\n this.rawAnnots = this.parseBed(bed, ideo);\n }\n\n // http://stackoverflow.com/a/5624139\n static componentToHex(c) {\n var hex = parseInt(c, 10).toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n }\n\n static rgbToHex(r, g, b) {\n return (\n '#' +\n BedParser.componentToHex(r) +\n BedParser.componentToHex(g) +\n BedParser.componentToHex(b)\n );\n }\n\n parseGenomicCoordinates(columns, ucscStyle) {\n var chr, start, stop, length;\n\n // These three columns (i.e. fields) are required\n chr = columns[0];\n start = parseInt(columns[1], 10);\n stop = parseInt(columns[2], 10);\n\n length = stop - start;\n\n if (ucscStyle) {\n chr = chr.slice(3);\n }\n\n return [chr, start, stop, length];\n }\n\n /**\n * Parses an annotation from a tab-separated line of a BED file\n */\n parseAnnotFromTsvLine(tsvLine, chrs, ucscStyle) {\n var annot, chrIndex, chr, start, rgb, color, label,\n columns = tsvLine.split(/\\s/g);\n\n [chr, start, stop, length] =\n this.parseGenomicCoordinates(columns, ucscStyle);\n\n chrIndex = chrs.indexOf(chr);\n if (chrIndex === -1) return [null, null];\n\n annot = ['', start, length, 0];\n\n if (columns.length >= 4) {\n label = columns[3];\n annot[0] = label;\n }\n\n if (columns.length >= 8) {\n rgb = columns[8].split(',');\n color = BedParser.rgbToHex(rgb[0], rgb[1], rgb[2]);\n annot.push(color);\n }\n\n return [chrIndex, annot];\n }\n\n parseRawAnnots(annots, bedStartIndex, tsvLines, chrs) {\n var i, line, chrIndex, annot, keys, rawAnnots, ucscStyle;\n\n ucscStyle = true;\n if (isNaN(parseInt(tsvLines[bedStartIndex], 10)) === false) {\n ucscStyle = false;\n }\n\n for (i = bedStartIndex; i < tsvLines.length; i++) {\n line = tsvLines[i];\n [chrIndex, annot] = this.parseAnnotFromTsvLine(line, chrs, ucscStyle);\n if (chrIndex !== null) annots[chrIndex].annots.push(annot);\n }\n\n keys = ['name', 'start', 'length', 'trackIndex'];\n if (tsvLines[bedStartIndex].length >= 8) keys.push('color');\n\n rawAnnots = {keys: keys, annots: annots};\n\n return rawAnnots;\n }\n\n /**\n * Parses a BED file, returns raw annotations\n */\n parseBed(bed, ideo) {\n var i, chrs, chr, bedStartIndex, rawAnnots,\n annots = [],\n tsvLines = bed.split(/\\r\\n|\\n/);\n\n chrs = Object.keys(ideo.chromosomes[ideo.config.taxid]);\n\n for (i = 0; i < chrs.length; i++) {\n chr = chrs[i];\n annots.push({chr: chr, annots: []});\n }\n\n bedStartIndex = 0; // 1 if BED has header (i.e. track line), 0 otherwise\n if (tsvLines[0].slice(0, 3) === 'chr' || isNaN(parseInt(tsvLines[0], 10))) {\n bedStartIndex = 1;\n }\n\n rawAnnots = this.parseRawAnnots(annots, bedStartIndex, tsvLines, chrs);\n return rawAnnots;\n }\n\n}\n","/**\n * @fileoverview Parse raw Ideogram.js annotations from a TSV file\n */\n\nimport {camel} from './../lib';\n\nexport class TsvParser {\n\n constructor(tsv, ideo) {\n this.rawAnnots = this.parseTsv(tsv, ideo);\n }\n\n parseGenomicCoordinates(columns) {\n // These three columns (i.e. fields) are required\n const chr = columns[1];\n const start = parseInt(columns[2], 10);\n const length = parseInt(columns[3], 10);\n\n return [chr, start, length];\n }\n\n /**\n * Parses a TSV file, returns raw annotations\n */\n parseTsv(tsv, ideo) {\n const lines = tsv.split(/\\r\\n|\\n/);\n\n const chrs = Object.keys(ideo.chromosomes[ideo.config.taxid]);\n\n const annots = [];\n\n for (let i = 0; i < chrs.length; i++) {\n const chr = chrs[i];\n annots.push({chr, annots: []});\n }\n\n let headers;\n const innerKeysByField = {};\n const customHeaders = [];\n\n const numRequired = 4;\n // let numColumns;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === '') continue; // Skip empty lines\n\n // Parse headers\n if (line[0] === '#') {\n if (line[1] === '#') {\n // Parse inner field keys in metainformation lines\n // E.g. ## differential_expression keys: gene;log2fc;pval_adj\n const keySplit = line.split(' keys: ');\n if (keySplit.length > 1) {\n const field = keySplit[0].slice(3);\n const keys = keySplit[1].split(';');\n innerKeysByField[camel(field)] = keys;\n }\n } else {\n // Slice/trim off \"# \", take columns 5 and onward, e.g.:\n // full_name\\tmentions\\tdifferential_expression\\tinterest_rank\n headers = line.slice(1).trim().split(/\\t/).map(h => camel(h));\n // numColumns = headers.length;\n const customs = headers.slice(numRequired);\n customs.forEach((custom, i) => customHeaders.push(camel(custom)));\n }\n continue;\n }\n\n const columns = line.trim().split(/\\t/);\n const name = columns[0];\n\n const [chr, start, length] = this.parseGenomicCoordinates(columns);\n const chrIndex = chrs.indexOf(chr);\n if (chrIndex === -1) continue;\n\n const customValues = columns.slice(numRequired);\n for (let j = 0; j < numRequired; j++) {\n const customHeader = customHeaders[j];\n if (customHeader in innerKeysByField) {\n const innerKeys = innerKeysByField[customHeader]\n const block = columns[numRequired + j];\n const group = block.split(';');\n const customValue = [];\n if (group[0] !== '') {\n for (let k = 0; k < group.length; k++) {\n const innerObj = {};\n const innerValues = group[k].split('!');\n for (let m = 0; m < innerValues.length; m++) {\n const innerKey = innerKeys[m];\n const innerValue = innerValues[m];\n innerObj[camel(innerKey)] = innerValue;\n }\n customValue.push(innerObj);\n }\n }\n customValues[j] = customValue;\n }\n }\n\n const annot = [name, chr, start, length].concat(customValues);\n annot.push(i); // Rank in initial file\n\n annots[chrIndex].annots.push(annot);\n };\n\n headers.push('initRank');\n const rawAnnots = {keys: headers, annots, innerKeysByField};\n return rawAnnots;\n }\n}\n","/**\n * @fileoverview Functions used by parallel and collinear heatmaps.\n */\n\nvar reservedTrackKeys = [\n 'name', 'start', 'length', 'trackIndex', 'trackIndexOriginal', 'color'\n];\n\nvar defaultHeatmapColors = {\n 3: ['00B', 'DDD', 'F00'],\n 5: ['00D', '66D', 'DDD', 'F88', 'F00'],\n 17: [\n '00D', '00D', '00D', '00D', '00D', '44D', '44D', 'DDD', 'DDD',\n 'DDD', 'DDD', 'F88', 'F66', 'F22', 'F22', 'F00', 'F00', 'F00'\n ]\n};\n\n/**\n * Get label text for displayed tracks from annotation container metadata,\n * heatmap keys, or annotation container keys\n */\nfunction getLabels(ideo) {\n var annotKeys, labels, heatmaps, i;\n\n if (ideo.rawAnnots.metadata && ideo.rawAnnots.metadata.trackLabels) {\n labels = ideo.rawAnnots.metadata.trackLabels;\n } else if (ideo.config.heatmaps) {\n labels = [];\n heatmaps = ideo.config.heatmaps;\n for (i = 0; i < heatmaps.length; i++) {\n labels.push(heatmaps[i].key);\n }\n } else {\n annotKeys = ideo.rawAnnots.keys.slice(0);\n labels = annotKeys.filter(d => !reservedTrackKeys.includes(d));\n }\n\n if (ideo.displayedTrackIndexes) {\n labels = labels.filter(function(d, i) {\n return ideo.displayedTrackIndexes.includes(i + 1);\n });\n }\n\n return labels;\n}\n\n/**\n * Apply heatmap thresholds that are passed in as annotation metadata\n */\nfunction inflateThresholds(ideo) {\n var thresholds, colors,\n rawAnnots = ideo.rawAnnots;\n\n if (\n rawAnnots.metadata && !rawAnnots.metadata.heatmapThresholds &&\n !ideo.config.heatmapThresholds\n ) {\n return;\n }\n\n if (ideo.config.heatmapThresholds) {\n thresholds = ideo.config.heatmapThresholds;\n } else {\n thresholds = ideo.rawAnnots.metadata.heatmapThresholds;\n }\n\n colors = defaultHeatmapColors[thresholds.length + 1];\n thresholds = thresholds.map((d, i) => {\n return [d, '#' + colors[i]];\n });\n\n thresholds.push(['+', '#' + colors.slice(-1)[0]]);\n\n return thresholds;\n}\n\n/**\n * Set needed configuration options from raw annotation data.\n * Simplifies heatmap API by inferring reasonable defaults.\n */\nfunction inflateHeatmaps(ideo) {\n var i, labels, heatmaps, annotationTracks, rawAnnots, displayedTracks,\n thresholds = ideo.config.heatmapThresholds;\n\n heatmaps = [];\n rawAnnots = ideo.rawAnnots;\n labels = rawAnnots.keys.slice(3);\n\n annotationTracks = [];\n displayedTracks = [];\n if (rawAnnots.metadata || !isNaN(thresholds[0])) {\n thresholds = inflateThresholds(ideo);\n }\n\n for (i = 0; i < labels.length; i++) {\n heatmaps.push({key: labels[i], thresholds: thresholds});\n annotationTracks.push({id: labels[i]});\n displayedTracks.push(i + 1);\n }\n ideo.config.annotationsNumTracks = labels.length;\n ideo.config.annotationsDisplayedTracks = displayedTracks;\n ideo.config.heatmaps = heatmaps;\n ideo.config.annotationTracks = annotationTracks;\n}\n\n/**\n * Given annotation value (m), should it use the color in this threshold?\n */\nfunction shouldUseThresholdColor(m, numThresholds, value, prevThreshold,\n threshold) {\n\n return (\n // If this is the last threshold, and\n // its value is \"+\" and the value is above the previous threshold...\n m === numThresholds && (\n threshold === '+' && value > prevThreshold\n ) ||\n\n // ... or if the value matches the threshold...\n value === threshold ||\n\n // ... or if this isn't the first or last threshold, and\n // the value is between this threshold and the previous one...\n m !== 0 && m !== numThresholds && (\n value <= threshold &&\n value > prevThreshold\n ) ||\n\n // ... or if this is the first threshold and the value is\n // at or below the threshold\n m === 0 && value <= threshold\n );\n}\n\n/**\n * Determine the color of the heatmap annotation.\n */\nfunction getHeatmapAnnotColor(thresholds, value) {\n var m, numThresholds, thresholdList, threshold, tvNum, thresholdColor,\n prevThreshold, useThresholdColor, color;\n\n for (m = 0; m < thresholds.length; m++) {\n numThresholds = thresholds.length - 1;\n thresholdList = thresholds[m];\n threshold = thresholdList[0];\n\n // The threshold value is usually a number,\n // but can also be a \"+\" character indicating that\n // this threshold is anything greater than the previous threshold.\n tvNum = parseFloat(threshold);\n if (isNaN(tvNum) === false) threshold = tvNum;\n if (m !== 0) prevThreshold = parseFloat(thresholds[m - 1][0]);\n thresholdColor = thresholdList[1];\n\n useThresholdColor = shouldUseThresholdColor(m, numThresholds, value,\n prevThreshold, threshold);\n\n if (useThresholdColor) color = thresholdColor;\n }\n\n return color;\n}\n\nexport {\n getLabels, inflateHeatmaps, inflateThresholds, defaultHeatmapColors,\n getHeatmapAnnotColor\n};\n","/**\n * @fileoverview Functions for collinear heatmaps of genome annotations.\n * See heatmap.js for more.\n */\n\nimport {d3} from '../lib';\nimport {writeTrackLabels} from './track-labels-collinear';\nimport {inflateHeatmaps} from './heatmap-lib';\n\n/**\n * Add canvases that will contain annotations. One canvas per track.\n */\nfunction writeCanvases(chr, chrLeft, ideo) {\n var j, trackLeft, trackWidth, canvas, context, id,\n chrWidth = chr.width,\n contextArray = [],\n annotLabelHeight = ideo.config.annotLabelHeight,\n numAnnotTracks = ideo.config.numAnnotTracks;\n\n // Create a canvas for each annotation track on this chromosome\n for (j = 0; j < numAnnotTracks; j++) {\n trackWidth = ideo.config.annotationHeight + annotLabelHeight + 4;\n id = chr.id + '-canvas-' + j; // e.g. chr1-9606-canvas-0\n trackLeft = chrLeft;\n if (chr.chrIndex > 0) {\n trackLeft += (ideo.config.chrMargin * chr.chrIndex) - 1;\n }\n canvas = d3.select(ideo.config.container + ' #_ideogramInnerWrap')\n .append('canvas')\n .attr('id', id)\n .attr('width', chrWidth + 1)\n .attr('height', trackWidth)\n .style('position', 'absolute')\n .style('left', trackLeft + 'px')\n .style('top', (trackWidth * j + 1) + 'px');\n context = canvas.nodes()[0].getContext('2d');\n contextArray.push([context, chr]);\n }\n\n return contextArray;\n}\n\n/**\n * Render annotations on the canvas\n */\nfunction fillCanvasAnnots(annots, contextArray, ideo) {\n var j, annot, context, chr,\n annotLabelHeight = ideo.config.annotLabelHeight,\n annotHeight = ideo.config.annotationHeight,\n demarcateChrs = ideo.config.demarcateCollinearChromosomes;\n\n var trackWidth = annotHeight + annotLabelHeight + 4;\n\n // Fill in the canvas(es) with annotation colors to draw a heatmap\n for (j = 0; j < annots.length; j++) {\n annot = annots[j];\n context = contextArray[annot.trackIndex][0];\n chr = contextArray[annot.trackIndex][1];\n context.fillStyle = annot.color;\n if (demarcateChrs) {\n if (annot.startPx < 1 || annot.startPx > chr.width - 1) continue;\n context.fillRect(annot.startPx, 1, 0.5, trackWidth);\n } else {\n context.fillRect(annot.startPx, annotLabelHeight + 1, 0.5, annotHeight);\n }\n }\n\n if (demarcateChrs) {\n for (j = 0; j < contextArray.length; j++) {\n context = contextArray[j][0];\n chr = contextArray[j][1];\n context.fillStyle = '#555';\n if (chr.chrIndex === 0) context.fillRect(0, 0, 1, trackWidth);\n context.fillRect(chr.width - 1, 0, 1.1, trackWidth);\n context.fillRect(0, 0, chr.width + 1, 1);\n if (ideo.config.chrMargin) context.fillRect(0, 0, 1.1, trackWidth);\n }\n }\n}\n\n/**\n * Draw a 1D heatmap of annotations along each chromosome.\n * Ideal for representing very dense annotation sets in a granular manner\n * without subsampling.\n *\n * TODO:\n * - Support in 'vertical' orientation\n * - Support after rotating chromosome on click\n */\nfunction drawHeatmapsCollinear(annotContainers, ideo) {\n var annots, chrLeft, contextArray, i, chr,\n prevX = 0,\n xBump = (ideo.config.showChromosomesLabels) ? 2 : -0.1;\n\n d3.select(ideo.selector).classed('labeledLeft', false);\n d3.selectAll(ideo.config.container + ' canvas').remove();\n\n // Each \"annotationContainer\" represents annotations for a chromosome\n for (i = 0; i < annotContainers.length; i++) {\n annots = annotContainers[i].annots;\n chr = ideo.chromosomesArray[i];\n if (i === 0) {\n chrLeft = 12;\n } else {\n chrLeft = prevX + ideo.chromosomesArray[i - 1].width + 14;\n prevX += ideo.chromosomesArray[i - 1].width + xBump;\n }\n contextArray = writeCanvases(chr, chrLeft, ideo);\n fillCanvasAnnots(annots, contextArray, ideo);\n }\n\n writeTrackLabels(ideo);\n\n if (ideo.onDrawAnnotsCallback) ideo.onDrawAnnotsCallback();\n}\n\nexport {drawHeatmapsCollinear, inflateHeatmaps};\n","/**\n * @fileoverview Functions for 2D heatmaps of genome annotations.\n * 2D heatmaps enable showing many (100+) tracks of data in one dimension,\n * for features (e.g. genes) along a dimension of genomic coordinates in\n * chromosome context.\n *\n * TO DO:\n * - Horizontal orientation\n * - Multiple chromosomes\n * - Non-human organisms\n */\n\nimport {d3} from '../lib';\nimport {getHeatmapAnnotColor} from './heatmap-lib';\n\n/**\n * Add one canvas that will contain all annotations. One canvas per chromosome.\n */\nfunction writeCanvas(chr, ideoHeight, width, ideo) {\n var left, canvas, context, id;\n\n id = chr.id + '-canvas'; // e.g. chr1-9606-canvas\n left = (ideo.config.chrWidth * 2) + ideo.config.annotationHeight - 0.5;\n canvas = d3.select(ideo.config.container + ' #_ideogramInnerWrap')\n .append('canvas')\n .attr('id', id)\n .attr('width', width)\n .attr('height', ideoHeight)\n .style('position', 'absolute')\n .style('left', left + 'px')\n .style('top', '0px');\n context = canvas.nodes()[0].getContext('2d');\n\n return context;\n}\n\n/**\n * Render annotations on the canvas.\n *\n * These annotations are 2D; each annotation has many values, each on a track.\n */\nfunction fillCanvasAnnotValues(annot, context, ideo) {\n var i, x, values,\n annotHeight = ideo.config.annotationHeight,\n ideoMarginTop = ideo._layout.margin.top;\n\n values = annot.values;\n\n // Fill canvas with annotation colors to draw the heatmap\n for (i = 0; i < values.length; i++) {\n context.fillStyle = values[i];\n x = (i - 1) * annotHeight;\n context.fillRect(x, annot.startPx + ideoMarginTop, annotHeight, 2);\n }\n}\n\n/**\n * Draw a 2D heatmap of annotations along one chromosome.\n *\n * TODO:\n * - Support in 'horizontal' orientation\n * - Support after rotating chromosome on click\n */\nfunction drawHeatmaps2d(annotContainers, ideo) {\n var annot, context, i, chr,\n container = ideo.config.container,\n ideoMarginTop = ideo._layout.margin.top,\n ideoHeight = ideo.config.chrHeight + ideoMarginTop,\n width = ideo.config.annotationHeight * annotContainers[0].values.length;\n\n d3.selectAll(container + ' canvas').remove();\n\n d3.select(container + ' #_ideogramInnerWrap')\n .style('max-width', width + 'px');\n d3.select(container + ' #_ideogram').attr('width', width);\n\n chr = ideo.chromosomesArray[0];\n\n context = writeCanvas(chr, ideoHeight, width, ideo);\n\n // Each \"annotationContainer\" represents annotations for a chromosome\n for (i = 0; i < annotContainers.length; i++) {\n annot = annotContainers[i];\n fillCanvasAnnotValues(annot, context, ideo);\n }\n\n if (ideo.onDrawAnnotsCallback) {\n ideo.onDrawAnnotsCallback();\n }\n}\n\nfunction add2dAnnotsForChr(annots, omittedAnnots, annotsByChr, chrModel,\n m, keys, ideo) {\n var j, k, annot, ra, stop, stopPx, color,\n thresholds = ideo.config.heatmapThresholds;\n\n for (j = 0; j < annotsByChr.annots.length; j++) {\n ra = annotsByChr.annots[j];\n annot = {};\n\n annot.values = []; // one value per track\n\n for (k = 0; k < 3; k++) {\n annot[keys[k]] = ra[k];\n }\n\n for (k = 3; k < keys.length; k++) {\n color = getHeatmapAnnotColor(thresholds, ra[k]);\n annot.values.push(color);\n }\n\n stop = annot.start + annot.length;\n\n annot.chr = annotsByChr.chr;\n annot.chrIndex = m;\n annot.startPx = ideo.convertBpToPx(chrModel, annot.start);\n stopPx = ideo.convertBpToPx(chrModel, stop);\n annot.px = Math.round((annot.startPx + stopPx) / 2);\n\n annots.push(annot);\n }\n\n annots.shift();\n\n return [annots, omittedAnnots];\n}\n\nexport {drawHeatmaps2d, add2dAnnotsForChr};\n","/**\n * @fileoverview Functions for labeling tracks of genome annotations.\n * Tracks are columns of annotations that run beside a chromosome.\n * Labeling tracks with descriptive names makes them easier to understand.\n */\n\nimport {d3} from '../lib';\nimport {getLabels} from './heatmap-lib';\n\n/**\n * Start a timer that, upon expiring, hides the track label.\n *\n * To enable users to copy label content to their clipboard, a timer is\n * used to control when the label disappears. It starts when the user's\n * cursor leaves the track or the label. If the user moves the cursor\n * back over the annot or label after the timer starts and before it expires,\n * then the timer is cleared.\n */\nfunction startHideTrackLabelTimeout(ideo) {\n if (ideo.config.showTrackLabel === false) return;\n\n ideo.hideTrackLabelTimeout = window.setTimeout(function() {\n d3.select(ideo.config.container + ' #_ideogramTrackLabel').transition()\n .duration(500)\n .style('opacity', 0);\n }, 250);\n}\n\n/**\n * Write label div setup with default styling.\n */\nfunction writeTrackLabelContainer(ideo) {\n d3.select(ideo.config.container + ' #_ideogramTrackLabelContainer')\n .append('div')\n .attr('id', '_ideogramTrackLabel')\n .style('opacity', 0)\n .style('position', 'absolute')\n .style('text-align', 'center')\n .style('padding', '1px')\n .style('font', '11px sans-serif')\n .style('background', 'white')\n .style('line-height', '10px')\n .style('z-index', '9000');\n}\n\n/**\n * Display track labels on the page\n */\nfunction renderTrackLabels(top, left, ideo) {\n d3.select(ideo.config.container + ' #_ideogramTrackLabel')\n .style('opacity', 1) // Make label visible\n .style('left', left + 'px')\n .style('top', top + 'px')\n .style('width', 'max-content')\n .style('transform-origin', 'bottom left')\n .style('text-align', 'left')\n .on('mouseover', function() {\n clearTimeout(ideo.hideTrackLabelTimeout);\n })\n .on('mouseout', function() {\n startHideTrackLabelTimeout(ideo);\n });\n}\n\n/**\n * Get left and top (x and y) offset for track label text\n */\nfunction getTrackLabelOffsets(labels, trackCanvas, ideo) {\n var firstTrackId, firstTrack, trackBox, labelBox, ideoBox, left, top,\n marginHack = 7; // TODO: Make this dynamic\n\n firstTrackId = trackCanvas.id.split('-').slice(0, -1).join('-') + '-0';\n firstTrack = d3.select(ideo.config.container + ' #' + firstTrackId)\n .nodes()[0];\n trackBox = firstTrack.getBoundingClientRect();\n\n labelBox = d3.select(ideo.config.container + ' #_ideogramTrackLabel')\n .nodes()[0].getBoundingClientRect();\n ideoBox = d3.select(ideo.config.container).nodes()[0]\n .getBoundingClientRect();\n\n left = Math.round(trackBox.left + labelBox.width) - trackBox.width - 1;\n left -= ideoBox.left - marginHack;\n top = -(labels.split('
    ').length - 2) * trackBox.width + 2;\n\n return [left, top];\n}\n\n/**\n * Show the label for this track\n */\nfunction showTrackLabel(trackCanvas, ideo) {\n var labels, left, top;\n\n clearTimeout(ideo.hideTrackLabelTimeout);\n\n labels = getLabels(ideo);\n labels = labels.join('
    ');\n\n // Clear any previous positioning, write track label text to DOM\n d3.select(ideo.config.container + ' #_ideogramTrackLabel')\n .interrupt() // Stop any in-progress disapperance\n .style('top', '')\n .style('left', '')\n .style('transform', null)\n .style('transform', 'rotate(-90deg)')\n .html(labels);\n\n [left, top] = getTrackLabelOffsets(labels, trackCanvas, ideo);\n\n renderTrackLabels(top, left, ideo);\n}\n\nexport {\n startHideTrackLabelTimeout, writeTrackLabelContainer, showTrackLabel\n};\n","/**\n * @fileoverview Functions for 2D heatmaps of genome annotations.\n * Heatmaps provide an easy way to visualize very dense annotation data.\n * Unlike the rest of Ideogram's graphics, which use SVG, heatmaps are\n * rendered using the Canvas element.\n */\n\nimport {d3} from '../lib';\nimport {drawHeatmapsCollinear} from './heatmap-collinear';\nimport {drawHeatmaps2d} from './heatmap-2d';\nimport {getHeatmapAnnotColor} from './heatmap-lib';\n\nimport {\n startHideTrackLabelTimeout, writeTrackLabelContainer, showTrackLabel\n} from './track-labels';\n\n/**\n * Add canvases that will contain annotations. One canvas per track.\n */\nfunction writeCanvases(chr, chrLeft, ideoHeight, ideo) {\n var j, trackLeft, trackWidth, canvas, context, id,\n contextArray = [],\n numAnnotTracks = ideo.config.numAnnotTracks;\n\n var marginHack = 7; // TODO: Make this dynamic\n\n // Create a canvas for each annotation track on this chromosome\n for (j = 0; j < numAnnotTracks; j++) {\n trackWidth = ideo.config.annotationHeight;\n id = chr.id + '-canvas-' + j; // e.g. chr1-9606-canvas-0\n trackLeft = chrLeft - trackWidth * (numAnnotTracks - j) - marginHack;\n canvas = d3.select(ideo.config.container + ' #_ideogramInnerWrap')\n .append('canvas')\n .attr('id', id)\n .attr('width', trackWidth)\n .attr('height', ideoHeight)\n .style('position', 'absolute')\n .style('left', trackLeft + 'px');\n context = canvas.nodes()[0].getContext('2d');\n contextArray.push(context);\n }\n\n return contextArray;\n}\n\n/**\n * Render annotations on the canvas\n */\nfunction fillCanvasAnnots(annots, contextArray, chrWidth, ideoMarginTop) {\n var j, annot, context, x;\n\n // Fill in the canvas(es) with annotation colors to draw a heatmap\n for (j = 0; j < annots.length; j++) {\n annot = annots[j];\n context = contextArray[annot.trackIndex];\n context.fillStyle = annot.color;\n x = annot.trackIndex - 1;\n context.fillRect(x, annot.startPx + ideoMarginTop, chrWidth, 0.5);\n }\n}\n\n/**\n * Draw a 1D heatmap of annotations along each chromosome.\n * Ideal for representing very dense annotation sets in a granular manner\n * without subsampling.\n *\n * TODO:\n * - Support in 'horizontal' orientation\n * - Support after rotating chromosome on click\n */\nfunction drawHeatmaps(annotContainers) {\n var annots, chrLeft, contextArray, chrWidth, i, chr,\n ideo = this,\n config = ideo.config,\n ideoMarginTop = ideo._layout.margin.top,\n ideoHeight = config.chrHeight + ideoMarginTop;\n\n if (config.geometry === 'collinear') {\n return drawHeatmapsCollinear(annotContainers, ideo);\n } else if (config.annotationsLayout === 'heatmap-2d') {\n return drawHeatmaps2d(annotContainers, ideo);\n }\n\n d3.selectAll(ideo.config.container + ' canvas').remove();\n\n writeTrackLabelContainer(ideo);\n\n // Each \"annotationContainer\" represents annotations for a chromosome\n for (i = 0; i < annotContainers.length; i++) {\n\n annots = annotContainers[i].annots;\n chr = ideo.chromosomesArray[i];\n chrWidth = ideo.config.chrWidth;\n chrLeft = ideo._layout.getChromosomeSetYTranslate(i);\n\n contextArray = writeCanvases(chr, chrLeft, ideoHeight, ideo);\n fillCanvasAnnots(annots, contextArray, chrWidth, ideoMarginTop);\n }\n\n d3.selectAll(ideo.config.container + ' canvas')\n .on('mouseover', function() {showTrackLabel(this, ideo);})\n .on('mouseout', function() {startHideTrackLabelTimeout(ideo);});\n\n if (ideo.onDrawAnnotsCallback) {\n ideo.onDrawAnnotsCallback();\n }\n}\n\n/**\n * Set color and track index for raw annotation objects.\n */\nfunction getNewRawAnnots(heatmapKeyIndexes, rawAnnots, ideo) {\n var j, k, ra, newRa, value, thresholds, color, trackIndex,\n newRas = [];\n\n for (j = 0; j < rawAnnots.length; j++) {\n ra = rawAnnots[j];\n for (k = 0; k < heatmapKeyIndexes.length; k++) {\n newRa = ra.slice(0, 3); // name, start, length\n\n value = ra[heatmapKeyIndexes[k]];\n thresholds = ideo.config.heatmaps[k].thresholds;\n color = getHeatmapAnnotColor(thresholds, value);\n\n trackIndex = k;\n newRa.push(trackIndex, color, value);\n newRas.push(newRa);\n }\n }\n\n return newRas;\n}\n\nfunction getNewRawAnnotContainers(heatmapKeyIndexes, rawAnnotBoxes, ideo) {\n var raContainer, chr, rawAnnots, newRas, i,\n newRaContainers = [];\n\n for (i = 0; i < rawAnnotBoxes.length; i++) {\n raContainer = rawAnnotBoxes[i];\n chr = raContainer.chr;\n\n rawAnnots = raContainer.annots;\n newRas = getNewRawAnnots(heatmapKeyIndexes, rawAnnots, ideo);\n\n newRaContainers.push({chr: chr, annots: newRas});\n }\n return newRaContainers;\n}\n\nfunction reportPerformance(t0, ideo) {\n var t1 = new Date().getTime();\n if (ideo.config.debug) {\n console.log('Time in deserializeAnnotsForHeatmap: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Deserialize compressed annotation data into a format suited for heatmaps.\n *\n * This enables the annotations to be downloaded from a server without the\n * requested annotations JSON needing to explicitly specify track index or\n * color. The track index and color are inferred from the \"heatmaps\" Ideogram\n * configuration option defined before ideogram initialization.\n *\n * This saves time for the user.\n *\n * @param rawAnnotsContainer {Object} Raw annotations as passed from server\n */\nfunction deserializeAnnotsForHeatmap(rawAnnotsContainer) {\n var newRaContainers, heatmapKey, heatmapKeyIndexes, i,\n t0 = new Date().getTime(),\n keys = rawAnnotsContainer.keys,\n rawAnnotBoxes = rawAnnotsContainer.annots,\n ideo = this;\n\n heatmapKeyIndexes = [];\n for (i = 0; i < ideo.config.heatmaps.length; i++) {\n heatmapKey = ideo.config.heatmaps[i].key;\n heatmapKeyIndexes.push(keys.indexOf(heatmapKey));\n }\n\n newRaContainers =\n getNewRawAnnotContainers(heatmapKeyIndexes, rawAnnotBoxes, ideo);\n\n keys.splice(3, 0, 'trackIndex');\n keys.splice(4, 0, 'color');\n\n ideo.rawAnnots.keys = keys;\n ideo.rawAnnots.annots = newRaContainers;\n\n reportPerformance(t0, ideo);\n}\n\nexport {drawHeatmaps, deserializeAnnotsForHeatmap};\n","/**\n * @fileoverview Functions for labeling collinear tracks of genome annotations.\n * See track-labels.js for more.\n */\n\nimport {d3} from '../lib';\nimport {getLabels} from './heatmap-lib';\n\nfunction renderTrackLabels(labels, ideo) {\n var i, x, y, labelContainer, markBump,\n annotLabelHeight = ideo.config.annotLabelHeight,\n demarcateChrs = ideo.config.demarcateCollinearChromosomes;\n\n x = 11; // Close to chrLeft in heatmap-collinear.js. For tabs.\n markBump = (demarcateChrs ? 2 : 0); // Make labels flush with demarcations\n\n labelContainer =\n d3.select(ideo.config.container + ' #_ideogramTrackLabelContainer');\n labelContainer.html('');\n\n y = ideo.config.annotationHeight + annotLabelHeight + 4;\n\n for (i = 0; i < labels.length; i++) {\n labelContainer\n .style('position', 'absolute')\n .append('div')\n .attr('class', '_ideogramTrackLabel')\n .style('opacity', 1)\n .style('position', 'absolute')\n .style('text-align', 'center')\n .style('padding', '1px')\n .style('font', '11px sans-serif')\n .style('background', 'white')\n .style('line-height', '10px')\n .style('z-index', '5')\n .style('left', (x + markBump) + 'px')\n .style('top', (y * i + markBump) + 'px')\n .style('width', 'max-content')\n .style('transform-origin', 'bottom left')\n .style('text-align', 'left')\n .html(labels[i]);\n }\n\n}\n\n/**\n * Show the label for this track\n */\nfunction writeTrackLabels(ideo) {\n var labels = getLabels(ideo);\n renderTrackLabels(labels, ideo);\n}\n\nexport {writeTrackLabels};\n","import {d3, formatSiPrefix} from '../lib';\n// import {getShapes} from './draw';\n\n/**\n * Optional callback, invoked when annotations are loaded\n */\nfunction onLoadAnnots() {\n call(this.onLoadAnnotsCallback);\n}\n\nfunction onBeforeDrawAnnots() {\n call(this.onBeforeDrawAnnotsCallback);\n}\n\n/**\n * Optional callback, invoked when annotations are drawn\n */\nfunction onDrawAnnots() {\n call(this.onDrawAnnotsCallback);\n}\n\nfunction hideAnnotTooltip() {\n d3.select('._ideogramTooltip').transition()\n .duration(500) // fade out for half second\n .style('opacity', 0)\n .style('pointer-events', 'none');\n}\n\n/**\n * Starts a timer that, upon expiring, hides the annotation tooltip.\n *\n * To enable users to copy tooltip content to their clipboard, a timer is\n * used to control when the tooltip disappears. It starts when the user's\n * cursor leaves the annotation or the tooltip. If the user moves the cursor\n * back over the annot or tooltip after the timer starts and before it expires,\n * then the timer is cleared.\n */\nfunction startHideAnnotTooltipTimeout() {\n const ideo = this;\n\n if (ideo.config.showAnnotTooltip === false) {\n return;\n }\n\n // See \"Without this...\" note in gene-structure.js\n const hideMs = ideo.oneTimeDelayTooltipHideMs ?? 250;\n delete ideo.oneTimeDelayTooltipHideMs;\n\n // Hide tooltip after `hideMs` milliseconds\n ideo.hideAnnotTooltipTimeout = window.setTimeout(function() {\n hideAnnotTooltip();\n }, hideMs);\n\n // Enable clients to not show tooltip immediately after clicking gene,\n // e.g. in related genes kit\n ideo.isTooltipCooling = true;\n ideo.hideAnnotTooltipCounter = window.setTimeout(function() {\n ideo.isTooltipCooling = false;\n }, 500);\n}\n\nfunction renderTooltip(tooltip, content, matrix, yOffset, ideo) {\n tooltip.html(content)\n .style('opacity', 1) // Make tooltip visible\n .style('left', matrix.e + 'px')\n .style('top', (matrix.f - yOffset) + 'px')\n .style('font-family', ideo.config.fontFamily)\n .style('pointer-events', null) // Prevent bug in clicking chromosome\n .on('mouseover', function() {\n clearTimeout(ideo.hideAnnotTooltipTimeout);\n })\n .on('mouseout', function() {\n ideo.startHideAnnotTooltipTimeout();\n });\n}\n\nfunction getCoarseBpLength(annot) {\n const length = Math.abs(annot.stop - annot.start);\n return formatSiPrefix(length) + 'bp';\n}\n\nfunction getContentAndYOffset(annot, includeLength=false) {\n var content, yOffset, range, displayName;\n\n range = 'chr' + annot.chr + ':' + annot.start.toLocaleString();\n if (annot.displayCoordinates) {\n range = annot.displayCoordinates;\n } else if (annot.length > 0) {\n // Only show range if stop differs from start\n range += '-' + annot.stop.toLocaleString();\n if (includeLength) range += ' (' + getCoarseBpLength(annot) + ')';\n }\n content = `
    ${range}
    `;\n yOffset = 24;\n\n if (annot.name) {\n displayName = annot.displayName ? annot.displayName : annot.name;\n content = displayName + content;\n yOffset += 8;\n }\n\n return [content, yOffset];\n}\n\n/**\n * Optional callback, invoked before showing annotation tooltip\n */\nfunction onWillShowAnnotTooltip(annot) {\n call(this.onWillShowAnnotTooltipCallback, annot);\n}\n\nfunction onDidShowAnnotTooltip() {\n call(this.onDidShowAnnotTooltipCallback);\n}\n\n/**\n * Optional callback, invoked on clicking annotation\n */\nfunction onClickAnnot(annot) {\n this.prevClickedAnnot = annot;\n this.onClickAnnotCallback(annot);\n}\n\n// /** Get list of annotation objects by names, e.g. [\"BRCA1\", \"APOE\"] */\n// function getAnnotsByName(annotNames, ideo) {\n// return annotNames.map(name => getAnnotByName(name, ideo));\n// }\n\n/**\n * Shows a tooltip for the given annotation.\n *\n * See notes in startHideAnnotTooltipTimeout about show/hide logic.\n *\n * @param annot {Object} Processed annotation object\n * @param context {Object} \"This\" of the caller -- an SVG path DOM object\n */\nfunction showAnnotTooltip(annot, context) {\n var matrix, content, yOffset, tooltip,\n cx = Number(context.getAttribute('cx')),\n cy = Number(context.getAttribute('cy')),\n ideo = this;\n\n if (ideo.config.showAnnotTooltip === false) return;\n\n clearTimeout(ideo.hideAnnotTooltipTimeout);\n\n if (ideo.onWillShowAnnotTooltipCallback) {\n annot = ideo.onWillShowAnnotTooltipCallback(annot);\n }\n\n // Enable onWillShowAnnotTooltipCallback to cancel showing tooltip\n if (annot === null) {\n hideAnnotTooltip();\n return;\n }\n\n ideo.prevTooltipAnnotName = annot.name;\n\n tooltip = d3.select('._ideogramTooltip');\n tooltip.interrupt(); // Stop any in-progress disapperance\n\n matrix = context.getScreenCTM().translate(cx, cy);\n\n const includeLength = true;\n [content, yOffset] = getContentAndYOffset(annot, includeLength);\n\n renderTooltip(tooltip, content, matrix, yOffset, ideo);\n\n if (ideo.onDidShowAnnotTooltipCallback) {\n ideo.onDidShowAnnotTooltipCallback();\n }\n}\n\nexport {\n onLoadAnnots, onBeforeDrawAnnots, onDrawAnnots, startHideAnnotTooltipTimeout,\n onWillShowAnnotTooltip, showAnnotTooltip, onClickAnnot,\n onDidShowAnnotTooltip\n};\n","import {d3, getFont, getTextSize, deepCopy, ensureContrast} from '../lib';\n\nimport {sortAnnotsByRank} from './annotations';\n\nconst allLabelStyle = `\n \n `;\n\n/** Return DOM ID of annotation object */\nfunction getAnnotDomLabelId(annot) {\n return 'ideogramLabel_' + annot.domId;\n}\n\nfunction changeAnnotState(state, labelId, annotId) {\n d3.selectAll('._ideoActive').classed('_ideoActive', false);\n d3.select('#' + labelId).attr('class', '_ideogramLabel ' + state);\n d3.select('#' + annotId + ' > path').attr('class', state);\n}\n\nfunction triggerAnnotEvent(event, ideo) {\n let labelId, annotId;\n const target = event.target;\n const type = event.type;\n\n const targetClasses = Array.from(target.classList);\n if (targetClasses.includes('_ideogramLabel')) {\n labelId = target.id;\n annotId = target.id.split('ideogramLabel_')[1];\n d3.select('#' + annotId + ' path').dispatch(type);\n } else {\n const annotElement = target.parentElement;\n labelId = 'ideogramLabel_' + annotElement.id;\n annotId = annotElement.id;\n }\n\n if (type === 'mouseout') {\n ideo.time.prevTooltipOff = performance.now();\n ideo.time.prevTooltipAnnotDomId = annotId;\n }\n\n // On mouseover, activate immediately\n // Otherwise, wait a moment (250 ms), then deactivate.\n // Delayed deactivation mitigates flicker when moving from\n // annot label to annot triangle.\n if (type === 'mouseover') {\n clearTimeout(window._ideoActiveTimeout);\n changeAnnotState('_ideoActive', labelId, annotId);\n } else {\n window._ideoActiveTimeout = window.setTimeout(function() {\n changeAnnotState('', labelId, annotId);\n }, 250);\n }\n}\n\nfunction renderLabel(annot, style, ideo) {\n\n if (!ideo.didSetLabelStyle) {\n document.querySelector('#_ideogramInnerWrap')\n .insertAdjacentHTML('afterbegin', allLabelStyle);\n ideo.didSetLabelStyle = true;\n }\n\n const id = getAnnotDomLabelId(annot);\n\n const font = getFont(ideo);\n\n let fill = annot.color === 'pink' ? '#CF406B' : annot.color;\n\n fill = ensureContrast(fill);\n\n d3.select('#_ideogram').append('text')\n .attr('id', id)\n .attr('class', '_ideogramLabel')\n .attr('x', style.left)\n .attr('y', style.top)\n .style('font', font)\n .style('fill', fill)\n .style('pointer-events', null) // Prevent bug in clicking chromosome\n .html(annot.name);\n}\n\n/** Get annotation object by name, e.g. \"BRCA1\" */\nfunction getAnnotByName(annotName, ideo) {\n var annot;\n var found = false;\n ideo.annots.forEach((annotsByChr) => {\n if (found) return;\n annotsByChr.annots.forEach((thisAnnot) => {\n if (found) return;\n if (thisAnnot.name === annotName) {\n annot = thisAnnot;\n found = true;\n }\n });\n });\n\n return annot;\n}\n\n/** Get label's top and left offsets relative to chromosome, and width */\nfunction getAnnotLabelLayout(annot, ideo) {\n var annotDom, annotRect, ideoRect, width, height, top, bottom, left, right,\n config = ideo.config;\n\n annotDom = document.querySelector('#' + annot.domId);\n\n // Handles cases when annotation is not yet in DOM\n if (annotDom === null) return null;\n\n annotRect = annotDom.getBoundingClientRect();\n\n ideoRect =\n document.querySelector('#_ideogram').getBoundingClientRect();\n\n const textSize = getTextSize(annot.name, ideo);\n width = textSize.width;\n\n // `pad` is a heuristic that accounts for:\n // 1px left pad, 1px right pad, 1px right border, 1px left border\n // as set in renderLabel\n const pad = (config.fontFamily) ? 9 : 7;\n width += pad;\n\n const labelSize = config.annotLabelSize ? config.annotLabelSize : 13;\n\n // Accounts for 1px top border, 1px bottom border as set in renderLabel\n height = labelSize;\n\n top = annotRect.top - ideoRect.top + height - 1;\n bottom = top + height;\n left = annotRect.left - ideoRect.left - width;\n right = left + width;\n name = annot.name;\n\n return {top, bottom, right, left, width, height, name};\n}\n\n/**\n * Label an annotation.\n *\n * @param annotName {String} Name of annotation, e.g. \"BRCA1\"\n * @param backgroundColor {String} Background color. Default: white.\n * @param backgroundColor {String} Border color. Default: black.\n */\nfunction addAnnotLabel(annotName, backgroundColor, borderColor) {\n var annot,\n ideo = this;\n\n annot = getAnnotByName(annotName, ideo);\n\n const layout = getAnnotLabelLayout(annot, ideo);\n if (layout === null) return;\n\n const style = Object.assign(layout, {backgroundColor, borderColor});\n\n renderLabel(annot, style, ideo);\n}\n\nfunction getIsXOverlap(o, n, p) {\n const oLeft = o.left - p;\n const nLeft = n.left - p;\n const oRight = o.right + p;\n const nRight = n.right + p;\n // A) oLeft < nLeft && oLeft < nRight && oRight < nRight && oRight > nLeft\n // o o\n // o o\n // o o\n //\n // n n\n // n n\n // n n\n //\n // B) oLeft > nLeft && oLeft < nRight && oRight > nRight && oRight > nLeft\n // o o\n // o o\n // o o\n //\n // n n\n // n n\n // n n\n //\n // C) oLeft < nLeft && oLeft < nRight && oRight > nRight && oRight > nLeft\n // o o\n // o o\n // o o\n //\n // n n\n // n n\n //\n // D) oLeft > nLeft && oLeft < nRight && oRight > nLeft && oRight < nRight\n // o o\n // o o\n // o o\n //\n // n n\n // n n\n // n n\n return (\n (oLeft <= nLeft && oLeft <= nRight && oRight <= nRight && oRight >= nLeft) ||\n (oLeft >= nLeft && oLeft <= nRight && oRight >= nRight && oRight >= nLeft) ||\n (oLeft <= nLeft && oLeft <= nRight && oRight >= nRight && oRight >= nLeft) ||\n (oLeft >= nLeft && oLeft <= nRight && oRight >= nLeft && oRight <= nRight)\n )\n}\n\nfunction getIsYOverlap(o, n, p) {\n const oTop = o.top - p;\n const nTop = n.top - p;\n const oBottom = o.bottom + p;\n const nBottom = n.bottom + p;\n // Top of old annot (o) is above bottom of new annot (n),\n // and bottom of old annot is below top of new annot\n //\n // A) yOverlap = true\n // o.top < n.top && o.top < n.bottom && o.bottom < n.bottom && o.bottom > n.top\n // ooooo\n // nnnnn\n //\n // ooooo\n // nnnnn\n //\n // A.2)\n //\n // ppppp\n // ppppp\n // ooooo\n //\n // ppppp\n // ooooo ppppp\n // ppppp nnnnn\n // ppppp\n //\n // nnnnn\n // ppppp\n // ppppp\n //\n // B) yOverlap = true\n // o.top > n.top && o.top < n.bottom && o.bottom > n.bottom && o.bottom > n.top\n // nnnnn\n // ooooo\n //\n // nnnnn\n // ooooo\n //\n // B.2)\n //\n // ppppp\n // ppppp ppppp\n // ppppp nnnnn\n // ooooo\n //\n // nnnnn\n // ooooo ppppp\n // ppppp ppppp\n // ppppp\n //\n //\n // C) yOverlap = false\n // old.top < new.top && old.bottom < new.top\n // ooooo\n //\n //\n // ooooo\n //\n // nnnnn\n //\n //\n // nnnnn\n //\n // D) yOverlap = false\n // nnnnn\n //\n //\n // nnnnn\n //\n // ooooo\n //\n //\n // ooooo\n // sl.top - p < layout.bottom && sl.bottom > layout.top - p ||\n // layout.top - p < sl.bottom && layout.bottom > sl.bottom\n\n // XY overlap\n // A)\n //\n // ooooooo\n // o o\n // o nonnnnn\n // ooooooo n\n // n n\n // nnnnnnn\n //\n //\n // B)\n // ooooooo\n // o o\n // nnnnnnn o\n // n onooooo\n // n n\n // nnnnnnn\n //\n // C)\n //\n // ooooooo nnnnnnn\n // o o n n\n // o o n n\n // ooooooo nnnnnnn\n //\n // D)\n //\n // ooooooo\n // o o\n // o o\n // ooooooo\n //\n // nnnnnnn\n // n n\n // n n\n // nnnnnnn\n return (\n // false\n (oTop <= nTop && oTop <= nBottom && oBottom <= nBottom && oBottom >= nTop) ||\n (oTop >= nTop && oTop <= nBottom && oBottom >= nBottom && oBottom >= nTop)\n );\n\n // (sl.top - p < layout.bottom || sl.bottom > layout.top - p) &&\n // (layout.top - p < sl.bottom || layout.bottom > sl.bottom)\n}\n\n/** Label as many annotations as possible, without overlap */\nfunction fillAnnotLabels(sortedAnnots=[], numLabels=10) {\n const ideo = this;\n\n sortedAnnots = deepCopy(sortedAnnots); // copy by value\n\n // Remove any pre-existing annotation labels, to avoid duplicates\n ideo.clearAnnotLabels();\n\n let spacedAnnots = [];\n const spacedLayouts = [];\n\n // sortedAnnots = applyRankCutoff(sortedAnnots, 100, ideo);\n\n // sortedAnnots = sortedAnnots.sort(ideo.annotSortFunction);\n\n if (sortedAnnots.length === 0) {\n sortedAnnots = ideo.flattenAnnots();\n }\n\n const strokeWidth = 0; // like padding\n\n sortedAnnots.forEach((annot, i) => {\n const layout = getAnnotLabelLayout(annot, ideo);\n\n if (layout === null) {\n console.debug(annot.name + ' has null layout');\n return;\n }\n\n const hasOverlap =\n spacedLayouts.length > 0 && spacedLayouts.some((sl, j) => {\n const xOverlap = getIsXOverlap(sl, layout, strokeWidth);\n const yOverlap = getIsYOverlap(sl, layout, strokeWidth);\n\n // if (annot.name === 'AKT1' || annot.name === 'XRCC3') {\n // const spacedAnnot = spacedAnnots[j].name;\n // if (spacedAnnot === 'HIF1A' || spacedAnnot === 'RAD51') {\n // // if (xOverlap && yOverlap) {\n // // console.log('sl.top - strokeWidth', sl.top - strokeWidth)\n // // console.log('sl.top - strokeWidth < layout.bottom')\n // // console.log(sl.top - strokeWidth < layout.bottom)\n // // console.log('sl.bottom > layout.top - strokeWidth')\n // // console.log(sl.bottom > layout.top - strokeWidth)\n // // console.log('layout.top - strokeWidth < sl.bottom')\n // // console.log(layout.top - strokeWidth < sl.bottom)\n // // console.log('layout.bottom > sl.bottom')\n // // console.log(layout.bottom > sl.bottom)\n // console.log(\n // 'xOverlap, yOverlap, spacedAnnot, sl, annot.name, layout'\n // );\n // console.log(\n // xOverlap, yOverlap, spacedAnnot, sl, annot.name, layout\n // );\n // }\n // }\n\n // if (xOverlap && yOverlap) {\n // console.log('overlap! annot');\n // console.log(annot.name, annot.chr, annot.color);\n // }\n return xOverlap && yOverlap;\n });\n\n if (hasOverlap) return;\n\n spacedAnnots.push(annot);\n spacedLayouts.push(layout);\n });\n\n const config = ideo.config;\n if (\n 'relatedGenesMode' in config &&\n ['hints'].includes(config.relatedGenesMode)\n ) {\n numLabels = 20;\n }\n // spacedAnnots = applyRankCutoff(spacedAnnots, numLabels, ideo);\n spacedAnnots = spacedAnnots.sort(ideo.annotSortFunction).slice(0, numLabels);\n\n\n // Ensure highest-ranked annots are ordered last in SVG,\n // to ensure the are written before lower-ranked annots\n // (which, due to SVG z-index being tied to layering)\n spacedAnnots.reverse();\n\n spacedAnnots.forEach((annot) => {\n ideo.addAnnotLabel(annot.name);\n });\n\n d3.selectAll('._ideogramLabel, .annot')\n .on('mouseover', (event) => triggerAnnotEvent(event))\n .on('mouseout', (event) => triggerAnnotEvent(event, ideo))\n .on('click', (event) => triggerAnnotEvent(event));\n}\n\nfunction removeAnnotLabel(annotName) {\n const ideo = this;\n const annot = getAnnotByName(annotName, ideo);\n const id = getAnnotDomLabelId(annot);\n document.querySelector('#' + id).remove();\n}\n\nfunction clearAnnotLabels() {\n const labels = document.querySelectorAll('._ideogramLabel');\n labels.forEach((label) => {label.remove();});\n}\n\nexport {\n addAnnotLabel, clearAnnotLabels, fillAnnotLabels, getAnnotLabelLayout,\n removeAnnotLabel\n};\n","/**\n * Get containers to group individual annotations into higher-level \"bar\"\n * annotations.\n */\nfunction getRawBars(chrModels, ideo) {\n var chr, chrModel, lastBand, numBins, bar, h, i, px,\n barWidth = ideo.config.barWidth,\n bars = [];\n\n for (h = 0; h < ideo.chromosomesArray.length; h++) {\n chr = ideo.chromosomesArray[h].name;\n chrModel = chrModels[chr];\n lastBand = chrModel.bands[chrModel.bands.length - 1];\n numBins = Math.round(lastBand.px.stop / barWidth); // chrPxStop / barWidth\n bar = {chr: chr, annots: []};\n\n for (i = 0; i < numBins; i++) {\n px = i * barWidth - ideo.bump;\n bar.annots.push({\n bp: ideo.convertPxToBp(chrModel, px + ideo.bump),\n px: px,\n count: 0,\n chrIndex: chrModel.chrIndex,\n chrName: chr,\n color: ideo.config.annotationsColor,\n annots: []\n });\n }\n bars.push(bar);\n }\n return bars;\n}\n\n/**\n * Assign how many, and which annotations each histogram bar contains\n */\nfunction assignAnnotsToBars(annots, bars, chrModels, ideo) {\n var chrAnnots, chrModel, barAnnots, h, i, annot, px, j, barPx, nextBarPx,\n barWidth = ideo.config.barWidth;\n\n for (h = 0; h < annots.length; h++) {\n chrAnnots = annots[h].annots;\n chrModel = chrModels[annots[h].chr]; // get chr by name\n barAnnots = bars[chrModel.chrIndex].annots;\n for (i = 0; i < chrAnnots.length; i++) {\n annot = chrAnnots[i];\n px = annot.px - ideo.bump;\n for (j = 0; j < barAnnots.length; j++) {\n barPx = barAnnots[j].px;\n nextBarPx = barPx + barWidth;\n if (j === barAnnots.length - 1) nextBarPx += barWidth;\n if (px >= barPx && px < nextBarPx) {\n bars[chrModel.chrIndex].annots[j].count += 1;\n bars[chrModel.chrIndex].annots[j].annots.push(annot);\n break;\n }\n }\n }\n }\n return bars;\n}\n\nfunction setIdeoMaxAnnotsPerBar(bars, isFirstGet, ideo) {\n var maxAnnotsPerBarAllChrs, i, maxAnnotsPerBar, annots, chr, j, barCount;\n\n if (isFirstGet || ideo.config.histogramScaling === 'relative') {\n maxAnnotsPerBarAllChrs = 0;\n for (i = 0; i < bars.length; i++) {\n maxAnnotsPerBar = 0;\n annots = bars[i].annots;\n chr = bars[i].chr;\n for (j = 0; j < annots.length; j++) {\n barCount = annots[j].count;\n if (barCount > maxAnnotsPerBar) maxAnnotsPerBar = barCount;\n if (barCount > maxAnnotsPerBarAllChrs) {\n maxAnnotsPerBarAllChrs = barCount;\n }\n }\n ideo.maxAnnotsPerBar[chr] = maxAnnotsPerBar;\n }\n ideo.maxAnnotsPerBarAllChrs = maxAnnotsPerBarAllChrs;\n }\n}\n\n/**\n * Set each bar's height to be proportional to the height of the bar with the\n * most annotations\n */\nfunction setProportionalBarHeight(bars, ideo) {\n var i, annots, chr, j, barCount, barCountRatio, height,\n ideoIsRotated = ideo._layout._isRotated;\n\n for (i = 0; i < bars.length; i++) {\n annots = bars[i].annots;\n chr = bars[i].chr;\n for (j = 0; j < annots.length; j++) {\n barCount = annots[j].count;\n if (ideo.config.histogramScaling === 'relative') {\n barCountRatio = barCount / ideo.maxAnnotsPerBar[chr];\n } else {\n barCountRatio = barCount / ideo.maxAnnotsPerBarAllChrs;\n }\n if (ideoIsRotated === false) {\n height = barCountRatio * ideo.config.chrMargin;\n } else {\n height = barCountRatio * ideo.config.chrHeightOriginal * 3;\n }\n if (isNaN(height)) {\n height = 0;\n }\n bars[i].annots[j].height = height;\n }\n }\n return bars;\n}\n\nfunction reportGetHistogramBarPerformance(t0, ideo) {\n var t1 = new Date().getTime();\n if (ideo.config.debug) {\n console.log('Time spent in getHistogramBars: ' + (t1 - t0) + ' ms');\n }\n}\n\nfunction setIdeoHistogramScaling(ideo) {\n if ('histogramScaling' in ideo.config === false) {\n ideo.config.histogramScaling = 'absolute';\n }\n}\n\n/**\n * Returns and sets bars used for histogram\n */\nfunction getHistogramBars(annots) {\n var chrModels, bars,\n isFirstGet = false,\n t0 = new Date().getTime(),\n ideo = this;\n\n chrModels = ideo.chromosomes[ideo.config.taxid];\n\n setIdeoHistogramScaling(ideo);\n\n if (typeof ideo.maxAnnotsPerBar === 'undefined') {\n ideo.maxAnnotsPerBar = {};\n isFirstGet = true;\n }\n\n bars = getRawBars(chrModels, ideo);\n bars = assignAnnotsToBars(annots, bars, chrModels, ideo);\n\n setIdeoMaxAnnotsPerBar(bars, isFirstGet, ideo);\n bars = setProportionalBarHeight(bars, ideo);\n\n reportGetHistogramBarPerformance(t0, ideo);\n ideo.bars = bars;\n return bars;\n}\n\nfunction getHistogramPoints(d, chrWidth, chrWidths, ideo) {\n var x1, x2, y1, y2;\n\n x1 = d.px + ideo.bump;\n x2 = d.px + ideo.config.barWidth + ideo.bump;\n y1 = chrWidth;\n y2 = chrWidth + d.height;\n\n var thisChrWidth = chrWidths[d.chr];\n\n if (x2 > thisChrWidth) {\n x2 = thisChrWidth;\n }\n\n return (\n x1 + ',' + y1 + ' ' +\n x2 + ',' + y1 + ' ' +\n x2 + ',' + y2 + ' ' +\n x1 + ',' + y2\n );\n}\n\nfunction writeHistogramAnnots(chrAnnot, ideo) {\n var chrs, chr,\n chrWidths = {},\n chrWidth = ideo.config.chrWidth;\n\n chrs = ideo.chromosomes[ideo.config.taxid];\n for (chr in chrs) {\n chrWidths[chr] = chrs[chr];\n }\n\n chrAnnot.append('polygon')\n // .attr('id', function(d, i) { return d.id; })\n .attr('class', 'annot')\n .attr('points', function(d) {\n return getHistogramPoints(d, chrWidth, chrWidths, ideo);\n })\n .attr('fill', function(d) {return d.color;});\n}\n\nexport {getHistogramBars, writeHistogramAnnots};\n","/**\n * @fileoverview Functions for drawing a legend for genome annotations.\n * A legend consists of rows, each with a colored icon and a text label.\n * Icons may have different shapes. A legend may also have a name.\n */\n\nimport {d3, getTextSize, round} from '../lib';\n\nvar legendStyle =\n '#_ideogramLegend {font: 12px Arial; overflow: auto; cursor: default;} ' +\n '#_ideogramLegend svg {float: left;} ' +\n '#_ideogramLegend ul {' +\n 'position: relative; left: -14px; list-style: none; float: left; ' +\n 'padding-left: 10px; margin: 0 0 1em 0; width: auto; border: none;' +\n '} ' +\n '#_ideogramLegend li {float: none; margin: 0;}' +\n '#_ideogramLegend ul span {position: relative; left: -15px;} ';\n\nexport function getIcon(row, ideo) {\n var icon, triangleAttrs, circleAttrs, rectAttrs,\n fill = 'fill=\"' + row.color + '\" style=\"stroke: #AAA;\"',\n shape = row.shape;\n\n triangleAttrs = 'd=\"m7,3 l -5 9 l 9 0 z\"';\n circleAttrs = 'd=\"m2,9a 4.5,4.5 0 1,0 9,0a 4.5,4.5 0 1,0 -9,0\"';\n rectAttrs = 'height=\"10\" width=\"10\" y=\"3\"';\n\n if ('shape' in row && ['circle', 'triangle'].includes(shape)) {\n if (shape === 'circle') {\n icon = '';\n } else if (shape === 'triangle') {\n var transform = '';\n if (ideo.config.orientation === 'vertical') {\n // Orient arrows in legend as they are in annotations\n transform = ' transform=\"rotate(90, 7, 7)\"';\n }\n if (ideo.config.orientation === 'down') {\n transform = ' transform=\"rotate(180, 7, 7)\"';\n }\n icon = '';\n }\n } else {\n icon = '';\n }\n\n return icon;\n}\n\nfunction getListItems(labels, svg, list, nameHeight, ideo) {\n var i, icon, y, row,\n lineHeight = getLineHeight(ideo);\n\n for (i = 0; i < list.rows.length; i++) {\n row = list.rows[i];\n labels += '
  • ' + row.name + '
  • ';\n y = lineHeight * (i - 1) + nameHeight + 1;\n if ('name' in list) y += lineHeight;\n icon = getIcon(row, ideo);\n const transform = 'translate(0, ' + y + ')';\n svg += '' + icon + '';\n }\n\n return [labels, svg];\n}\n\nfunction getLineHeight(ideo) {\n return round(getTextSize('A', ideo).height) * 2 + 0.5;\n}\n\n/**\n * Display a legend for genome annotations, using `legend` configuration option\n */\nfunction writeLegend(ideo) {\n var i, legend, svg, labels, list, content,\n config = ideo.config,\n lineHeight = getLineHeight(ideo);\n\n d3.select(config.container + ' #_ideogramLegend').remove();\n\n legend = config.legend;\n content = '';\n\n for (i = 0; i < legend.length; i++) {\n list = legend[i];\n let nameHeight = lineHeight;\n if (list.nameHeight) {\n nameHeight = list.nameHeight;\n }\n let nameStyle = '';\n if (nameHeight) {\n nameStyle =\n `style=\"height: ${nameHeight}px; ` +\n `position: relative; ` +\n `left: -${nameHeight - 5}px;\"`;\n }\n if ('name' in list) {\n labels =\n `
  • ` + list.name + `
  • `;\n }\n svg = '';\n [labels, svg] = getListItems(labels, svg, list, nameHeight, ideo);\n svg += '';\n content += svg + '
      ' + labels + '
    ';\n }\n\n var fontFamily = `font-family: ${config.fontFamily};`;\n var lineHeightCss = `line-height: ${getLineHeight(ideo)}px;`;\n legendStyle +=\n `#_ideogramLegend {${fontFamily} ${lineHeightCss}}`;\n\n var target = d3.select(config.container + ' #_ideogramOuterWrap');\n target.append('style').html(legendStyle);\n target.append('div').attr('id', '_ideogramLegend').html(content);\n}\n\nexport {writeLegend};\n","import {d3} from '../lib';\nimport {writeHistogramAnnots} from './histogram';\nimport {writeLegend} from './legend';\n\nfunction parseFriendlyAnnots(friendlyAnnots, rawAnnots) {\n var i, j, annot, rawAnnot;\n\n for (i = 0; i < friendlyAnnots.length; i++) {\n annot = friendlyAnnots[i];\n\n for (j = 0; j < rawAnnots.length; j++) {\n if (annot.chr === rawAnnots[j].chr) {\n rawAnnot = [\n annot.name,\n annot.start,\n annot.stop - annot.start\n ];\n if ('color' in annot) rawAnnot.push(annot.color);\n if ('shape' in annot) rawAnnot.push(annot.shape);\n rawAnnots[j].annots.push(rawAnnot);\n break;\n }\n }\n }\n\n return rawAnnots;\n}\n\nfunction parseFriendlyKeys(friendlyAnnots) {\n var keys = ['name', 'start', 'length'];\n if ('color' in friendlyAnnots[0]) {\n keys.push('color');\n }\n if ('shape' in friendlyAnnots[0]) {\n keys.push('shape');\n }\n return keys;\n}\n\n/**\n * Draws annotations defined by user\n */\nfunction drawAnnots(friendlyAnnots, layout, keep=false, isOtherLayout=false) {\n var keys, chr,\n rawAnnots = [],\n ideo = this,\n chrs = ideo.chromosomes[ideo.config.taxid]; // TODO: multiorganism\n\n if (friendlyAnnots.length === 0) {\n ideo.annots = [];\n return;\n }\n\n if (\n 'annots' in friendlyAnnots[0] || // When filtering\n 'values' in friendlyAnnots[0] // When drawing cached expression matrices\n ) {\n return ideo.drawProcessedAnnots(friendlyAnnots, layout);\n }\n\n for (chr in chrs) {\n rawAnnots.push({chr: chr, annots: []});\n }\n rawAnnots = parseFriendlyAnnots(friendlyAnnots, rawAnnots);\n\n keys = parseFriendlyKeys(friendlyAnnots);\n\n ideo.rawAnnots = {keys: keys, annots: rawAnnots};\n\n const processedAnnots = ideo.processAnnotData(ideo.rawAnnots);\n if (!isOtherLayout) {\n ideo.annots = processedAnnots;\n } else {\n ideo.annotsOther = processedAnnots;\n }\n\n ideo.drawProcessedAnnots(processedAnnots, layout, keep);\n}\n\nfunction getShapes(annotHeight) {\n var triangle, circle, rectangle, r;\n\n triangle =\n 'm0,0 l -' + annotHeight + ' ' + (2 * annotHeight) +\n ' l ' + (2 * annotHeight) + ' 0 z';\n\n // From http://stackoverflow.com/a/10477334, with a minor change (\"m -r, r\")\n // Circles are supported natively via , but having it as a path\n // simplifies handling triangles, circles and other shapes in the same\n // D3 call\n r = annotHeight;\n circle =\n 'm -' + r + ', ' + r +\n 'a ' + r + ',' + r + ' 0 1,0 ' + (r * 2) + ',0' +\n 'a ' + r + ',' + r + ' 0 1,0 -' + (r * 2) + ',0';\n\n rectangle =\n 'm0,0 l 0 ' + (2 * annotHeight) +\n 'l ' + annotHeight + ' 0' +\n 'l 0 -' + (2 * annotHeight) + 'z';\n\n return {triangle: triangle, circle: circle, rectangle: rectangle};\n}\n\nfunction getChrAnnotNodes(filledAnnots, ideo) {\n return d3.selectAll(ideo.selector + ' .chromosome')\n .data(filledAnnots)\n .selectAll('path.annot')\n .data(function(d) {\n return d.annots;\n })\n .enter();\n}\n\nfunction determineShape(d, shapes) {\n if (!d.shape || d.shape === 'triangle') {\n return shapes.triangle;\n } else if (d.shape === 'circle') {\n return shapes.circle;\n } else if (d.shape === 'rectangle') {\n return shapes.rectangle;\n } else {\n return d.shape;\n }\n}\n\nfunction writeTrackAnnots(chrAnnot, ideo) {\n var shapes,\n annotHeight = ideo.config.annotationHeight;\n\n shapes = getShapes(annotHeight);\n\n chrAnnot.append('g')\n .attr('id', function(d) {return d.domId;})\n .attr('class', 'annot')\n .attr('transform', function(d) {\n var y = ideo.config.chrWidth + (d.trackIndex * annotHeight * 2);\n return 'translate(' + d.px + ',' + y + ')';\n })\n .append('path')\n .attr('d', function(d) {return determineShape(d, shapes);})\n .attr('fill', function(d) {return d.color;})\n .on('mouseover', function(event, d) {ideo.showAnnotTooltip(d, this);})\n .on('mouseout', function() {ideo.startHideAnnotTooltipTimeout();})\n .on('click', function(event, d) {ideo.onClickAnnot(d);});\n}\n\n/**\n * Overlaid annotations appear directly on chromosomes\n */\nfunction writeOverlayAnnots(chrAnnot, ideo) {\n chrAnnot.append('polygon')\n .attr('id', function(d) {return d.id;})\n .attr('class', 'annot')\n .attr('points', function(d) {\n var x1, x2,\n chrWidth = ideo.config.chrWidth;\n\n if (d.stopPx - d.startPx > 1) {\n x1 = d.startPx;\n x2 = d.stopPx;\n } else {\n x1 = d.px - 0.5;\n x2 = d.px + 0.5;\n }\n\n return (\n x1 + ',' + chrWidth + ' ' + x2 + ',' + chrWidth + ' ' +\n x2 + ',0 ' + x1 + ',0'\n );\n })\n .attr('fill', function(d) {return d.color;})\n .on('mouseover', function(event, d) {ideo.showAnnotTooltip(d, this);})\n .on('mouseout', function() {ideo.startHideAnnotTooltipTimeout();});\n}\n\nfunction warnIfTooManyAnnots(layout, annots) {\n var i, numAnnots;\n\n if (!/heatmap/.test(layout) && layout !== 'histogram') {\n numAnnots = 0;\n for (i = 0; i < annots.length; i++) {\n numAnnots += annots[i].annots.length;\n }\n if (numAnnots > 2000) {\n console.warn(\n 'Rendering more than 2000 annotations in Ideogram?\\n' +\n 'Try setting \"annotationsLayout\" to \"heatmap\" or \"histogram\" in your ' +\n 'Ideogram configuration object for better layout and performance.'\n );\n }\n }\n}\n\nfunction drawAnnotsByLayoutType(layout, annots, ideo) {\n var filledAnnots, chrAnnot;\n\n warnIfTooManyAnnots(layout, annots);\n\n if (layout === 'histogram') annots = ideo.getHistogramBars(annots);\n\n filledAnnots = ideo.fillAnnots(annots);\n\n chrAnnot = getChrAnnotNodes(filledAnnots, ideo);\n\n if (layout === 'tracks') {\n writeTrackAnnots(chrAnnot, ideo);\n } else if (layout === 'overlay') {\n writeOverlayAnnots(chrAnnot, ideo);\n } else if (layout === 'histogram') {\n writeHistogramAnnots(chrAnnot, ideo);\n }\n}\n\n/**\n * Draws genome annotations on chromosomes.\n * Annotations can be rendered as either overlaid directly\n * on a chromosome, or along one or more \"tracks\"\n * running parallel to each chromosome.\n */\nfunction drawProcessedAnnots(annots, layout, keep=false) {\n var ideo = this;\n\n if (ideo.onBeforeDrawAnnotsCallback) {\n ideo.onBeforeDrawAnnotsCallback();\n }\n\n if (!keep) {\n d3.selectAll(ideo.selector + ' .annot').remove();\n }\n\n if (layout === undefined) layout = 'tracks';\n if (ideo.config.annotationsLayout) layout = ideo.config.annotationsLayout;\n\n if ('legend' in ideo.config) writeLegend(ideo);\n\n if (/heatmap/.test(layout)) {\n ideo.drawHeatmaps(annots);\n return;\n }\n\n drawAnnotsByLayoutType(layout, annots, ideo);\n if (ideo.onDrawAnnotsCallback) ideo.onDrawAnnotsCallback();\n}\n\nexport {drawAnnots, drawProcessedAnnots, getShapes};\n","import {d3} from '../lib';\n\nexport function writeSyntenicRegion(syntenies, regionID, ideo) {\n return syntenies.append('g')\n .attr('class', 'syntenicRegion')\n .attr('id', regionID)\n .on('click', function() {\n var activeRegion = this;\n var others = d3.selectAll(ideo.selector + ' .syntenicRegion')\n .filter(function() {return (this !== activeRegion);});\n\n others.classed('hidden', !others.classed('hidden'));\n })\n .on('mouseover', function() {\n var activeRegion = this;\n d3.selectAll(ideo.selector + ' .syntenicRegion')\n .filter(function() {return (this !== activeRegion);})\n .classed('ghost', true);\n })\n .on('mouseout', function() {\n d3.selectAll(ideo.selector + ' .syntenicRegion')\n .classed('ghost', false);\n });\n}\n\nexport function writeSyntenicRegionPolygons(\n syntenicRegion, x1, x2, r1, r2, regions\n) {\n var color, opacity;\n\n color = ('color' in regions) ? regions.color : '#CFC';\n opacity = ('opacity' in regions) ? regions.opacity : 1;\n\n syntenicRegion.append('polygon')\n .attr('points',\n x1 + ', ' + r1.startPx + ' ' +\n x1 + ', ' + r1.stopPx + ' ' +\n x2 + ', ' + r2.stopPx + ' ' +\n x2 + ', ' + r2.startPx\n )\n .style('fill', color)\n .style('fill-opacity', opacity);\n}\n\nexport function writeSyntenicRegionPolygonsHorizontal(\n syntenicRegion, y1, y2, r1, r2, regions\n) {\n var color, opacity;\n\n color = ('color' in regions) ? regions.color : '#CFC';\n opacity = ('opacity' in regions) ? regions.opacity : 1;\n\n syntenicRegion.append('polygon')\n .attr('points',\n (r1.startPx - 15) + ', ' + y1 + ' ' +\n (r1.stopPx - 15) + ', ' + y1 + ' ' +\n (r2.stopPx - 15) + ', ' + y2 + ' ' +\n (r2.startPx - 15) + ', ' + y2\n )\n .style('fill', color)\n .style('fill-opacity', opacity);\n}\n\nexport function getRegionsR1AndR2(regions, ideo, xOffset = null) {\n var r1, r2,\n r1Offset, r2Offset;\n\n r1 = regions.r1;\n r2 = regions.r2;\n\n if (typeof r1.chr === 'string') {\n const taxids = ideo.config.taxids;\n if (ideo.config.multiorganism) {\n r1.chr = ideo.chromosomes[taxids[0]][r1.chr];\n r2.chr = ideo.chromosomes[taxids[1]][r2.chr];\n } else {\n r1.chr = ideo.chromosomes[taxids[0]][r1.chr];\n r2.chr = ideo.chromosomes[taxids[0]][r2.chr];\n }\n }\n\n var r1ChrDom = document.querySelector('#' + r1.chr.id + '-chromosome-set');\n var r1GenomeHorizontalXOffset = r1ChrDom.getCTM().e;\n var r1GenomeVerticalXOffset = r1ChrDom.getCTM().f;\n var r2ChrDom = document.querySelector('#' + r2.chr.id + '-chromosome-set');\n // var r2GenomeOffset = r2ChrDom.getBoundingClientRect().top;\n var r2GenomeHorizontalXOffset = r2ChrDom.getCTM().e;\n var r2GenomeVerticalXOffset = r2ChrDom.getCTM().f;\n\n if (xOffset === null) {\n if (ideo.config.orientation === 'vertical') {\n // When vertical collinear\n // http://localhost:8080/examples/vanilla/compare-whole-genomes?chromosome-scale=absolute&orientation=vertical\n r1Offset = r1GenomeVerticalXOffset - 12;\n r2Offset = r2GenomeVerticalXOffset - 12;\n } else {\n // When horizontal collinear, e.g.\n // http://localhost:8080/examples/vanilla/compare-whole-genomes?chromosome-scale=absolute&orientation=horizontal\n r1Offset = r1GenomeHorizontalXOffset;\n r2Offset = r2GenomeHorizontalXOffset;\n }\n } else {\n // When horizontal parallel\n r1Offset = xOffset;\n r2Offset = xOffset;\n }\n\n r1.startPx = ideo.convertBpToPx(r1.chr, r1.start) + r1Offset;\n r1.stopPx = ideo.convertBpToPx(r1.chr, r1.stop) + r1Offset;\n r2.startPx = ideo.convertBpToPx(r2.chr, r2.start) + r2Offset;\n r2.stopPx = ideo.convertBpToPx(r2.chr, r2.stop) + r2Offset;\n\n return [r1, r2];\n}\n","import {d3} from '../lib';\nimport {\n getRegionsR1AndR2, writeSyntenicRegionPolygons, writeSyntenicRegion\n} from './synteny-lib';\n\nfunction writeSyntenicRegionLines(syntenicRegion, x1, x2, r1, r2) {\n syntenicRegion.append('line')\n .attr('class', 'syntenyBorder')\n .attr('x1', x1)\n .attr('x2', x2)\n .attr('y1', r1.startPx)\n .attr('y2', r2.startPx);\n\n syntenicRegion.append('line')\n .attr('class', 'syntenyBorder')\n .attr('x1', x1)\n .attr('x2', x2)\n .attr('y1', r1.stopPx)\n .attr('y2', r2.stopPx);\n}\n\nfunction writeSyntenicRegions(syntenicRegions, syntenies, ideo) {\n var i, regions, r1, r2, regionID, syntenicRegion, chrWidth, x1, x2;\n\n for (i = 0; i < syntenicRegions.length; i++) {\n regions = syntenicRegions[i];\n\n [r1, r2] = getRegionsR1AndR2(regions, ideo);\n\n regionID = (\n r1.chr.id + '_' + r1.start + '_' + r1.stop + '_' +\n '__' +\n r2.chr.id + '_' + r2.start + '_' + r2.stop\n );\n\n syntenicRegion = writeSyntenicRegion(syntenies, regionID, ideo);\n\n chrWidth = ideo.config.chrWidth;\n x1 = chrWidth + 51;\n x2 = chrWidth + 245; // Genomes are spaced ~200 pixels apart\n\n writeSyntenicRegionPolygons(syntenicRegion, x1, x2, r1, r2, regions);\n writeSyntenicRegionLines(syntenicRegion, x1, x2, r1, r2);\n }\n}\n\nfunction reportPerformance(t0, ideo) {\n var t1 = new Date().getTime();\n if (ideo.config.debug) {\n console.log('Time in drawSyntenicRegions: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Draws a trapezoid connecting a genomic range on\n * one chromosome to a genomic range on another chromosome;\n * a syntenic region.\n */\nfunction drawSyntenyCollinear(syntenicRegions, ideo) {\n var syntenies,\n t0 = new Date().getTime();\n\n syntenies = d3.select(ideo.selector)\n .insert('g', ':first-child')\n .attr('class', 'synteny');\n\n writeSyntenicRegions(syntenicRegions, syntenies, ideo);\n\n reportPerformance(t0, ideo);\n}\n\nexport {drawSyntenyCollinear};\n","import {d3} from '../lib';\nimport {\n getRegionsR1AndR2, writeSyntenicRegionPolygonsHorizontal, writeSyntenicRegion\n} from './synteny-lib';\n\nfunction writeSyntenicRegionLines(syntenicRegion, y1, y2, r1, r2) {\n syntenicRegion.append('line')\n .attr('class', 'syntenyBorder')\n .attr('x1', r1.startPx - 15)\n .attr('x2', r2.startPx - 15)\n .attr('y1', y1)\n .attr('y2', y2);\n\n syntenicRegion.append('line')\n .attr('class', 'syntenyBorder')\n .attr('x1', r1.stopPx - 15)\n .attr('x2', r2.stopPx - 15)\n .attr('y1', y1)\n .attr('y2', y2);\n}\n\nfunction writeSyntenicRegions(syntenicRegions, syntenies, ideo) {\n var i, regions, r1, r2, regionID, syntenicRegion, chrWidth, y1, y2;\n\n for (i = 0; i < syntenicRegions.length; i++) {\n regions = syntenicRegions[i];\n\n [r1, r2] = getRegionsR1AndR2(regions, ideo);\n\n regionID = (\n r1.chr.id + '_' + r1.start + '_' + r1.stop + '_' +\n '__' +\n r2.chr.id + '_' + r2.start + '_' + r2.stop\n );\n\n syntenicRegion = writeSyntenicRegion(syntenies, regionID, ideo);\n\n chrWidth = ideo.config.chrWidth;\n y1 = chrWidth + 31;\n y2 = chrWidth + 191; // Genomes are spaced ~200 pixels apart\n\n writeSyntenicRegionPolygonsHorizontal(\n syntenicRegion, y1, y2, r1, r2, regions\n );\n writeSyntenicRegionLines(syntenicRegion, y1, y2, r1, r2);\n }\n}\n\nfunction reportPerformance(t0, ideo) {\n var t1 = new Date().getTime();\n if (ideo.config.debug) {\n console.log('Time in drawSyntenicRegions: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Draws a trapezoid connecting a genomic range on\n * one chromosome to a genomic range on another chromosome;\n * a syntenic region.\n */\nfunction drawSyntenyCollinearHorizontal(syntenicRegions, ideo) {\n var syntenies,\n t0 = new Date().getTime();\n\n syntenies = d3.select(ideo.selector)\n .insert('g', ':first-child')\n .attr('class', 'synteny');\n\n writeSyntenicRegions(syntenicRegions, syntenies, ideo);\n\n reportPerformance(t0, ideo);\n}\n\nexport {drawSyntenyCollinearHorizontal};\n","import {d3} from '../lib';\nimport {drawSyntenyCollinear} from './synteny-collinear';\nimport {drawSyntenyCollinearHorizontal} from './synteny-collinear-horizontal';\nimport {\n getRegionsR1AndR2, writeSyntenicRegionPolygons, writeSyntenicRegion\n} from './synteny-lib';\n\nfunction writeSyntenicRegionLines(syntenicRegion, x1, x2, r1, r2, regions) {\n\n var stroke, width;\n if (\n Math.abs(r1.startPx - r1.startPx) < 2 &&\n Math.abs(r1.stopPx - r1.stopPx) < 2\n ) {\n stroke = regions.color;\n width = regions.width;\n } else {\n stroke = '';\n width = '';\n }\n\n syntenicRegion.append('line')\n .attr('class', 'syntenyBorder')\n .attr('x1', x1)\n .attr('x2', x2)\n .attr('y1', r1.startPx)\n .attr('y2', r2.startPx)\n .style('stroke', stroke)\n .style('stroke-width', width);\n\n syntenicRegion.append('line')\n .attr('class', 'syntenyBorder')\n .attr('x1', x1)\n .attr('x2', x2)\n .attr('y1', r1.stopPx)\n .attr('y2', r2.stopPx)\n .style('stroke', stroke)\n .style('stroke-width', stroke);\n}\n\nfunction writeSyntenicRegionLabels(syntenicRegion, x1, x2, r1, r2, regionId) {\n var rangeIds = regionId.split('__').map(d => 'label_' + d);\n if ('name' in r1) {\n syntenicRegion.append('text')\n .attr('id', rangeIds[0])\n .attr('y', r1.startPx + 3)\n .text(r1.name);\n var r1Width =\n document.querySelector('#' + rangeIds[0]).getBoundingClientRect().width;\n d3.select('#' + rangeIds[0]).attr('x', x1 - 15 - r1Width);\n }\n if ('name' in r2) {\n syntenicRegion.append('text')\n .attr('id', rangeIds[1])\n .text(r2.name)\n .attr('x', x2 + 15)\n .attr('y', r2.startPx + 3)\n .text(r2.name);\n }\n}\n\nfunction writeSyntenicRegions(syntenicRegions, syntenies, xOffset, ideo) {\n var i, regions, r1, r2, regionID, syntenicRegion, chrWidth, x1, x2;\n\n for (i = 0; i < syntenicRegions.length; i++) {\n regions = syntenicRegions[i];\n\n [r1, r2] = getRegionsR1AndR2(regions, ideo, xOffset);\n\n regionID = (\n r1.chr.id + '_' + r1.start + '_' + r1.stop + '_' +\n '__' +\n r2.chr.id + '_' + r2.start + '_' + r2.stop\n );\n\n syntenicRegion = writeSyntenicRegion(syntenies, regionID, ideo);\n\n chrWidth = ideo.config.chrWidth;\n x1 = ideo._layout.getChromosomeSetYTranslate(0);\n x2 = ideo._layout.getChromosomeSetYTranslate(1) - chrWidth;\n\n writeSyntenicRegionPolygons(syntenicRegion, x1, x2, r1, r2, regions);\n writeSyntenicRegionLines(syntenicRegion, x1, x2, r1, r2, regions);\n writeSyntenicRegionLabels(syntenicRegion, x1, x2, r1, r2, regionID);\n }\n}\n\nfunction reportPerformance(t0, ideo) {\n var t1 = new Date().getTime();\n if (ideo.config.debug) {\n console.log('Time in drawSyntenicRegions: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Draws a trapezoid connecting a genomic range on\n * one chromosome to a genomic range on another chromosome;\n * a syntenic region.\n */\nfunction drawSynteny(syntenicRegions) {\n var syntenies, xOffset,\n t0 = new Date().getTime(),\n ideo = this,\n config = ideo.config;\n\n // Make synteny / orthologs readable from client apps\n ideo.syntenicRegions = syntenicRegions;\n\n if (\n config.multiorganism &&\n config.geometry === 'collinear'\n ) {\n if (config.orientation === 'vertical') {\n return drawSyntenyCollinear(syntenicRegions, ideo);\n } else {\n return drawSyntenyCollinearHorizontal(syntenicRegions, ideo);\n }\n }\n\n syntenies = d3.select(ideo.selector)\n .insert('g', ':first-child')\n .attr('class', 'synteny');\n\n xOffset = ideo._layout.margin.left;\n\n writeSyntenicRegions(syntenicRegions, syntenies, xOffset, ideo);\n\n reportPerformance(t0, ideo);\n}\n\nexport {drawSynteny};\n","import {d3} from '../lib';\nimport collinearizeChromosomes from '../collinear';\n\n/**\n * Reset displayed tracks to those originally displayed\n */\nfunction restoreDefaultTracks() {\n var ideo = this;\n ideo.config.numAnnotTracks = ideo.config.annotationsNumTracks;\n d3.selectAll(ideo.selector + ' .annot').remove();\n ideo.drawAnnots(ideo.processAnnotData(ideo.rawAnnots));\n}\n\nfunction getDisplayedRawAnnotsByChr(annotsByChr, trackIndexes) {\n var annot, displayedRawAnnotsByChr, annots, i, displayedAnnots, j,\n trackIndex;\n\n displayedRawAnnotsByChr = [];\n\n // Filter displayed tracks by selected track indexes\n for (i = 0; i < annotsByChr.length; i++) {\n annots = annotsByChr[i];\n displayedAnnots = [];\n for (j = 0; j < annots.annots.length; j++) {\n annot = annots.annots[j].slice(); // copy array by value\n trackIndex = annot[3] + 1;\n if (trackIndexes.includes(trackIndex)) {\n annot[3] = trackIndexes.indexOf(trackIndex);\n displayedAnnots.push(annot);\n }\n }\n displayedRawAnnotsByChr.push({chr: annots.chr, annots: displayedAnnots});\n }\n\n return displayedRawAnnotsByChr;\n}\n\n/**\n * Adds or removes tracks from the displayed list of tracks.\n * Only works when raw annotations are dense.\n *\n * @param trackIndexes Array of indexes of tracks to display\n */\nfunction updateDisplayedTracks(trackIndexes) {\n var displayedRawAnnotsByChr, displayedAnnots, rawAnnots,\n ideo = this,\n annotsByChr = ideo.rawAnnots.annots;\n\n ideo.config.numAnnotTracks = trackIndexes.length;\n\n displayedRawAnnotsByChr =\n getDisplayedRawAnnotsByChr(annotsByChr, trackIndexes);\n rawAnnots = {keys: ideo.rawAnnots.keys, annots: displayedRawAnnotsByChr};\n\n if (ideo.config.geometry === 'collinear') {\n collinearizeChromosomes(ideo);\n }\n\n displayedAnnots = ideo.processAnnotData(rawAnnots);\n\n d3.selectAll(ideo.selector + ' .annot').remove();\n ideo.displayedTrackIndexes = trackIndexes;\n ideo.drawAnnots(displayedAnnots);\n\n return displayedAnnots;\n}\n\nfunction getSetAnnotsByChr(annotsByChr, ideo) {\n var i, j, annots, annot, setAnnots, trackIndexOriginal, numAvailTracks,\n setAnnotsByChr = [];\n\n numAvailTracks = 1;\n\n for (i = 0; i < annotsByChr.length; i++) {\n annots = annotsByChr[i];\n setAnnots = [];\n for (j = 0; j < annots.annots.length; j++) {\n annot = annots.annots[j].slice();\n trackIndexOriginal = annot[3];\n if (trackIndexOriginal + 1 > numAvailTracks) {\n numAvailTracks = trackIndexOriginal + 1;\n }\n annot.splice(4, 0, trackIndexOriginal);\n setAnnots.push(annot);\n }\n setAnnotsByChr.push({chr: annots.chr, annots: setAnnots});\n }\n\n ideo.numAvailTracks = numAvailTracks;\n\n return setAnnotsByChr;\n}\n\nfunction setOriginalTrackIndexes(rawAnnots) {\n var keys, annotsByChr, setAnnotsByChr,\n ideo = this;\n\n keys = rawAnnots.keys;\n\n // If this method is unnecessary, pass through\n if (\n keys.length < 4 ||\n keys[3] !== 'trackIndex' ||\n keys[4] === 'trackIndexOriginal'\n ) {\n return rawAnnots;\n }\n\n annotsByChr = rawAnnots.annots;\n setAnnotsByChr = getSetAnnotsByChr(annotsByChr, ideo);\n\n keys.splice(4, 0, 'trackIndexOriginal');\n rawAnnots = {keys: keys, annots: setAnnotsByChr};\n if (ideo.rawAnnots.metadata) rawAnnots.metadata = ideo.rawAnnots.metadata;\n\n return rawAnnots;\n}\n\nexport {restoreDefaultTracks, setOriginalTrackIndexes, updateDisplayedTracks};\n","import {add2dAnnotsForChr} from './heatmap-2d';\nimport {setAnnotRanks} from './annotations';\n\n// Default colors for tracks of annotations\nvar colorMap = [\n ['F00'], // If there is 1 track, then color it red.\n ['F00', '88F'], // If 2 tracks, color one red and one light blue.\n ['F00', 'CCC', '88F'], // If 3, color one red, one grey, one light blue.\n ['F00', 'FA0', '0AF', '88F'], // And so on.\n ['F00', 'FA0', 'CCC', '0AF', '88F'],\n ['F00', 'FA0', '875', '578', '0AF', '88F'],\n ['F00', 'FA0', '875', 'CCC', '578', '0AF', '88F'],\n ['F00', 'FA0', '7A0', '875', '0A7', '578', '0AF', '88F'],\n ['F00', 'FA0', '7A0', '875', 'CCC', '0A7', '578', '0AF', '88F'],\n ['F00', 'FA0', '7A0', '875', '552', '255', '0A7', '578', '0AF', '88F']\n];\n\n/**\n * Ensure annotation containers are ordered by chromosome.\n */\nfunction orderAnnotContainers(annots, ideo) {\n var unorderedAnnots, i, j, annot, chr, chrs;\n\n unorderedAnnots = annots;\n annots = [];\n chrs = ideo.chromosomesArray;\n for (i = 0; i < chrs.length; i++) {\n chr = chrs[i].name;\n for (j = 0; j < unorderedAnnots.length; j++) {\n annot = unorderedAnnots[j];\n if (annot.chr === chr) {\n annots.push(annot);\n }\n }\n }\n\n return annots;\n}\n\n/**\n * Add client annotations, as in annotations-tracks.html\n */\nfunction addClientAnnot(annots, annot, ra, m, ideo) {\n var annotTrack;\n\n annot.trackIndex = ra[3];\n annotTrack = ideo.config.annotationTracks[annot.trackIndex];\n if (annotTrack.color) {\n annot.color = annotTrack.color;\n }\n if (annotTrack.shape) {\n annot.shape = annotTrack.shape;\n }\n\n annots[m].annots.push(annot);\n\n return annots;\n}\n\n/**\n * Add sparse server annotations, as in annotations-track-filters.html\n */\nfunction addSparseServerAnnot(annot, ra, omittedAnnots, annots, m, ideo) {\n var colors = colorMap[ideo.numAvailTracks - 1];\n\n annot.trackIndex = ra[3];\n annot.trackIndexOriginal = ra[4];\n annot.color = '#' + colors[annot.trackIndexOriginal];\n\n // Catch annots that will be omitted from display\n if (annot.trackIndex > ideo.config.numTracks - 1) {\n if (annot.trackIndex in omittedAnnots) {\n omittedAnnots[annot.trackIndex].push(annot);\n } else {\n omittedAnnots[annot.trackIndex] = [annot];\n }\n return [annots, omittedAnnots];\n }\n annots[m].annots.push(annot);\n\n return [annots, omittedAnnots];\n}\n\n/**\n * Basic client annotations, as in annotations-basic.html\n * and annotations-external.html\n */\nfunction addBasicClientAnnot(annots, annot, m, ideo) {\n annot.trackIndex = 0;\n if (!annot.color) {\n annot.color = ideo.config.annotationsColor;\n }\n if (!annot.shape) {\n annot.shape = 'triangle';\n }\n annots[m].annots.push(annot);\n\n return annots;\n}\n\nfunction addAnnot(annot, keys, ra, omittedAnnots, annots, m, ideo) {\n\n if (ideo.config.annotationTracks) {\n annots = addClientAnnot(annots, annot, ra, m, ideo);\n } else if (keys[3] === 'trackIndex' && ideo.numAvailTracks !== 1) {\n [annots, omittedAnnots] =\n addSparseServerAnnot(annot, ra, omittedAnnots, annots, m, ideo);\n // } else if (\n // keys.length > 3 &&\n // keys[3] in {trackIndex: 1, color: 1, shape: 1} === false &&\n // keys[4] === 'trackIndexOriginal'\n // ) {\n // annots = addDenseServerAnnot(keys, annots, annot, m);\n } else {\n annots = addBasicClientAnnot(annots, annot, m, ideo);\n }\n\n return [annots, omittedAnnots];\n}\n\nfunction getAnnotDomId(chrIndex, annotIndex) {\n return '_c' + chrIndex + '_a' + annotIndex;\n}\n\nfunction addAnnotsForChr(annots, omittedAnnots, annotsByChr, chrModel,\n m, keys, ideo) {\n var j, k, annot, ra;\n\n // Assign DOM ID if annots are rendered as individual DOM elements\n const shouldAssignDomId = (\n !ideo.config.annotationsLayout ||\n ideo.config.annotationsLayout === 'tracks'\n );\n\n for (j = 0; j < annotsByChr.annots.length; j++) {\n ra = annotsByChr.annots[j];\n annot = {};\n\n for (k = 0; k < keys.length; k++) {\n annot[keys[k]] = ra[k];\n }\n\n annot.stop = annot.start + annot.length;\n\n annot.chr = annotsByChr.chr;\n annot.chrIndex = m;\n annot.startPx = ideo.convertBpToPx(chrModel, annot.start);\n annot.stopPx = ideo.convertBpToPx(chrModel, annot.stop);\n annot.px = Math.round((annot.startPx + annot.stopPx) / 2);\n if (shouldAssignDomId) annot.domId = getAnnotDomId(m, j);\n\n [annots, omittedAnnots] =\n addAnnot(annot, keys, ra, omittedAnnots, annots, m, ideo);\n }\n\n if (shouldAssignDomId) {\n if (ideo.annotSortFunction) {\n annots[m].annots = setAnnotRanks(annots[m].annots, ideo);\n annots[m].annots.sort((a, b) => {\n // Reverse-sort, so first annots are drawn last, and thus at top layer\n return -ideo.annotSortFunction(a, b);\n });\n } else {\n // Sort by genomic position, in ascending order\n annots[m].annots.sort((a, b) => a[1] - b[1]);\n }\n\n for (j = 0; j < annots[m].annots.length; j++) {\n annots[m].annots[j].domId = getAnnotDomId(m, j);\n }\n }\n\n return [annots, omittedAnnots];\n}\n\nfunction warnOfUndefinedChromosome(annotsByChr) {\n console.warn(\n 'Chromosome \"' + annotsByChr.chr + '\" undefined in ideogram; ' +\n annotsByChr.annots.length + ' annotations not shown'\n );\n}\n\nfunction addAnnots(rawAnnots, keys, ideo) {\n var m, i, annotsByChr, chrModel,\n annots = [],\n omittedAnnots = {};\n\n m = -1;\n for (i = 0; i < rawAnnots.length; i++) {\n annotsByChr = rawAnnots[i];\n chrModel = ideo.chromosomes[ideo.config.taxid][annotsByChr.chr];\n\n if (typeof chrModel === 'undefined') {\n warnOfUndefinedChromosome(annotsByChr);\n continue;\n }\n\n m++;\n annots.push({chr: annotsByChr.chr, annots: []});\n\n if (ideo.config.annotationsLayout !== 'heatmap-2d') {\n [annots, omittedAnnots] =\n addAnnotsForChr(annots, omittedAnnots, annotsByChr, chrModel, m,\n keys, ideo);\n } else {\n [annots, omittedAnnots] =\n add2dAnnotsForChr(annots, omittedAnnots, annotsByChr, chrModel, m,\n keys, ideo);\n }\n }\n return [annots, omittedAnnots];\n}\n\nfunction sendTrackAndAnnotWarnings(omittedAnnots, ideo) {\n var numOmittedTracks,\n layout = ideo.config.annotationsLayout,\n numTracks = ideo.config.numAnnotTracks;\n\n if (!/heatmap/.test(layout) && numTracks > 10) {\n console.error(\n 'Ideogram only displays up to 10 tracks at a time. ' +\n 'You specified ' + numTracks + ' tracks. ' +\n 'Perhaps consider a different way to visualize your data.'\n );\n }\n\n numOmittedTracks = Object.keys(omittedAnnots).length;\n if (numOmittedTracks) {\n console.warn(\n 'Ideogram configuration specified ' + numTracks + ' tracks, ' +\n 'but loaded annotations contain ' + numOmittedTracks + ' ' +\n 'extra tracks.'\n );\n }\n}\n\n/**\n * Proccesses genome annotation data.\n *\n * This method converts raw annotation data from server, which is structured as\n * an array of arrays, into a more verbose data structure consisting of an\n * array of objects. It also adds pixel offset information.\n */\nfunction processAnnotData(rawAnnots) {\n var keys, annots, omittedAnnots,\n ideo = this;\n\n keys = rawAnnots.keys;\n rawAnnots = rawAnnots.annots;\n\n [annots, omittedAnnots] = addAnnots(rawAnnots, keys, ideo);\n annots = orderAnnotContainers(annots, ideo);\n\n sendTrackAndAnnotWarnings(omittedAnnots, ideo);\n\n return annots;\n}\n\nexport {processAnnotData, getAnnotDomId};\n","/**\n * @fileoverview Parse raw Ideogram.js annotations from an expression matrix.\n * This module handles dense gene expression matrixes.\n * In gene expression expressions, rows are genes and columns are cells.\n */\n\nexport class ExpressionMatrixParser {\n\n /**\n * @param {String} matrix Tab-delimited gene expression matrix\n * @param {Object} coordinates Coordinates [chr, start, length] by gene name\n * @param {Object} ideo Ideogram object\n */\n constructor(matrix, ideo) {\n this.matrix = matrix;\n this.ideo = ideo;\n }\n\n /**\n * Initialize rawAnnots by fetching genomic coordinates, then merging them\n * with the gene expression matrix supplied in constructor.\n */\n setRawAnnots() {\n var parser, ideo, matrix;\n parser = this;\n ideo = this.ideo;\n matrix = this.matrix;\n\n return new Promise(function(resolve) {\n parser.rawAnnots = parser.fetchCoordinates(ideo)\n .then(function(coordinates) {\n parser.coordinates = coordinates;\n resolve(parser.parseExpressionMatrix(matrix, ideo));\n });\n });\n }\n\n /**\n * Get chromosome, start and stop coordinates from genome annotation file\n *\n * TODO: Support non-human organisms\n */\n fetchCoordinates(ideo) {\n var coordinates = {};\n\n if (ideo.config.organism === 'human') {\n var ensemblData =\n ideo.config.dataDir +\n '../../annotations/Homo_sapiens,_Ensembl_80.tsv';\n\n return new Promise(function(resolve) {\n ideo.fetch(ensemblData, 'text').then(function(data) {\n // eslint-disable-next-line no-unused-vars\n var tsvLines, i, start, stop, gene, chr, length;\n\n tsvLines = data.split(/\\r\\n|\\n/).slice(1);\n for (i = 0; i < tsvLines.length; i++) {\n [start, stop, gene, , chr] = tsvLines[i].split(/\\s/g);\n start = parseInt(start);\n stop = parseInt(stop);\n length = stop - start;\n coordinates[gene] = [chr, start, length];\n }\n resolve(coordinates);\n });\n });\n } else {\n throw Error('Expression matrix parsing is only supported for human');\n }\n }\n\n /**\n * Parses an annotation from a tab-separated line of a matrix file\n */\n parseAnnotFromTsvLine(tsvLine, chrs) {\n var annot, chrIndex, chr, start, gene, expressions,\n columns = tsvLine.split(/\\s/g);\n\n gene = columns[0];\n if (gene in this.coordinates === false) return [null, null];\n\n expressions = columns.slice(1).map(d => parseFloat(d));\n [chr, start, length] = this.coordinates[gene];\n\n chrIndex = chrs.indexOf(chr);\n if (chrIndex === -1) return [null, null];\n\n annot = [gene, start, length];\n annot = annot.concat(expressions);\n\n return [chrIndex, annot];\n }\n\n /**\n * Parses a gene expression matrix file, returns raw annotations\n */\n parseExpressionMatrix(matrix, ideo) {\n var i, chrs, rawAnnots, cells, line, chrIndex, annot, keys,\n annots = [],\n tsvLines = matrix.split(/\\r\\n|\\n/);\n\n chrs = Object.keys(ideo.chromosomes[ideo.config.taxid]);\n for (i = 0; i < chrs.length; i++) {\n annots.push({chr: chrs[i], annots: []});\n }\n\n for (i = 1; i < tsvLines.length; i++) {\n line = tsvLines[i];\n [chrIndex, annot] = this.parseAnnotFromTsvLine(line, chrs);\n if (chrIndex !== null) annots[chrIndex].annots.push(annot);\n }\n\n cells = tsvLines[0].split(/\\s/g);\n keys = ['name', 'start', 'length'].concat(cells);\n rawAnnots = {keys: keys, annots: annots};\n\n return rawAnnots;\n }\n\n}\n","function downloadAnnotations() {\n\n const ideo = this;\n const annots = {};\n\n ideo.annots.forEach(chrAnnots => {\n chrAnnots.annots.forEach(annot => {\n const desc = ideo.annotDescriptions.annots[annot.name];\n\n annots[annot.name] = [\n annot.name, desc.ensemblId,\n annot.chr, annot.start, annot.stop, annot.length,\n desc.type\n ];\n });\n });\n\n const header = [\n '# Gene name', 'Ensembl ID', 'Chromosome', 'Start', 'Stop', 'Length', 'Type'\n ];\n const rows = [header].concat(Object.values(annots));\n const annotsTsv =\n ideo.annotDescriptions.headers + '\\n#\\n' +\n rows.map(row => row.join('\\t')).join('\\n');\n\n const annotsHref =\n 'data:text/plain;charset=utf-8,' + encodeURIComponent(annotsTsv);\n\n var evt = new MouseEvent('click', {\n view: window,\n bubbles: false,\n cancelable: true\n });\n\n var a = document.createElement('a');\n a.setAttribute('download', 'ideogram.tsv');\n a.setAttribute('href', annotsHref);\n a.setAttribute('target', '_blank');\n\n // Enables easy testing\n a.setAttribute('id', '_ideo-undisplayed-dl-annots-link');\n a.setAttribute('style', 'display: none;');\n document.body.appendChild(a);\n\n a.dispatchEvent(evt);\n}\n\nexport {downloadAnnotations};\n","/**\n * @fileoverview Methods for ideogram annotations.\n * Annotations are graphical objects that represent features of interest\n * located on the chromosomes, e.g. genes or variations. They can\n * appear beside a chromosome, overlaid on top of it, or between multiple\n * chromosomes.\n */\n\nimport {BedParser} from '../parsers/bed-parser';\nimport {TsvParser} from '../parsers/tsv-parser';\nimport {drawHeatmaps, deserializeAnnotsForHeatmap} from './heatmap';\nimport {inflateThresholds} from './heatmap-lib';\nimport {inflateHeatmaps} from './heatmap-collinear';\nimport {\n onLoadAnnots, onDrawAnnots, startHideAnnotTooltipTimeout,\n onWillShowAnnotTooltip, onDidShowAnnotTooltip, showAnnotTooltip, onClickAnnot\n} from './events';\n\nimport {\n addAnnotLabel, removeAnnotLabel, fillAnnotLabels, clearAnnotLabels\n // fadeOutAnnotLabels\n} from './labels';\n\nimport {drawAnnots, drawProcessedAnnots} from './draw';\nimport {getHistogramBars} from './histogram';\nimport {drawSynteny} from './synteny';\nimport {\n restoreDefaultTracks, setOriginalTrackIndexes, updateDisplayedTracks\n} from './filter';\nimport {processAnnotData} from './process';\nimport {ExpressionMatrixParser} from '../parsers/expression-matrix-parser';\nimport {downloadAnnotations} from './download';\n\nfunction initNumTracksAndBarWidth(ideo, config) {\n\n if (config.annotationTracks) {\n ideo.config.numAnnotTracks = config.annotationTracks.length;\n } else if (config.annotationsNumTracks) {\n ideo.config.numAnnotTracks = config.annotationsNumTracks;\n } else {\n ideo.config.numAnnotTracks = 1;\n }\n ideo.config.annotTracksHeight =\n config.annotationHeight * config.numAnnotTracks;\n\n if (typeof config.barWidth === 'undefined') {\n ideo.config.barWidth = 3;\n }\n}\n\nfunction initTooltip(ideo, config) {\n if (config.showAnnotTooltip !== false) {\n ideo.config.showAnnotTooltip = true;\n }\n\n if (config.onWillShowAnnotTooltip) {\n ideo.onWillShowAnnotTooltipCallback = config.onWillShowAnnotTooltip;\n }\n\n if (config.onDidShowAnnotTooltip) {\n ideo.onDidShowAnnotTooltipCallback = config.onDidShowAnnotTooltip;\n }\n}\n\nfunction initAnnotLabel(ideo, config) {\n if (config.addAnnotLabel !== false) {\n ideo.config.addAnnotLabel = true;\n }\n\n if (config.onWillAddAnnotLabel) {\n ideo.onWillAddAnnotLabelCallback = config.onWillAddAnnotLabel;\n }\n}\n\nfunction initAnnotHeight(ideo) {\n var config = ideo.config;\n var annotHeight;\n\n if (!config.annotationHeight) {\n if (config.annotationsLayout === 'heatmap') {\n annotHeight = config.chrWidth - 1;\n } else {\n annotHeight = Math.round(config.chrHeight / 100);\n if (annotHeight < 3) annotHeight = 3;\n }\n ideo.config.annotationHeight = annotHeight;\n }\n}\n\n/**\n * Initializes various annotation settings. Constructor help function.\n */\nfunction initAnnotSettings() {\n var ideo = this,\n config = ideo.config;\n\n initAnnotHeight(ideo);\n\n if (\n config.annotationsPath || config.localAnnotationsPath ||\n ideo.annots || config.annotations\n ) {\n initNumTracksAndBarWidth(ideo, config);\n } else {\n ideo.config.annotTracksHeight = 0;\n ideo.config.numAnnotTracks = 0;\n }\n\n if (typeof config.annotationsColor === 'undefined') {\n ideo.config.annotationsColor = '#F00';\n }\n\n if (config.onClickAnnot) {\n ideo.onClickAnnotCallback = config.onClickAnnot;\n }\n\n initTooltip(ideo, config);\n initAnnotLabel(ideo, config);\n}\n\nfunction validateAnnotsUrl(annotsUrl) {\n var tmp, extension;\n\n tmp = annotsUrl.split('?')[0].split('.');\n extension = tmp[tmp.length - 1];\n\n if (['bed', 'json', 'tsv'].includes(extension) === false) {\n extension = extension.toUpperCase();\n alert(\n 'Ideogram.js only supports BED and Ideogram JSON and TSV ' +\n 'at the moment. ' +\n 'Sorry, check back soon for ' + extension + ' support!'\n );\n return;\n }\n return extension;\n}\n\n/** Find redundant chromosomes in raw annotations */\nfunction detectDuplicateChrsInRawAnnots(ideo) {\n const seen = {};\n const duplicates = [];\n const chrs = ideo.rawAnnots.annots.map(annot => annot.chr);\n\n chrs.forEach((chr) => {\n if (chr in seen) duplicates.push(chr);\n seen[chr] = 1;\n });\n\n if (duplicates.length > 0) {\n const message =\n `Duplicate chromosomes detected.\\n` +\n `Chromosome list: ${chrs}. Duplicates: ${duplicates}.\\n` +\n `To fix this, edit your raw annotations JSON data to remove redundant ` +\n `chromosomes.`;\n throw Error(message);\n }\n}\n\nfunction afterRawAnnots() {\n var ideo = this,\n config = ideo.config;\n\n // Ensure annots are ordered by chromosome\n ideo.rawAnnots.annots = ideo.rawAnnots.annots.sort(Ideogram.sortChromosomes);\n\n if (ideo.onLoadAnnotsCallback) {\n ideo.onLoadAnnotsCallback();\n }\n\n if (\n 'heatmapThresholds' in config ||\n 'metadata' in ideo.rawAnnots &&\n 'heatmapThresholds' in ideo.rawAnnots.metadata\n ) {\n if (config.annotationsLayout === 'heatmap') {\n inflateHeatmaps(ideo);\n } else if (config.annotationsLayout === 'heatmap-2d') {\n ideo.config.heatmapThresholds = inflateThresholds(ideo);\n }\n }\n\n if (config.heatmaps) {\n ideo.deserializeAnnotsForHeatmap(ideo.rawAnnots);\n }\n\n detectDuplicateChrsInRawAnnots(ideo);\n}\n\n/**\n * Converts list of annotation-by-chromosome objects to list of annot objects\n */\nfunction flattenAnnots() {\n const ideo = this;\n return ideo.annots.reduce((accumulator, annots) => {\n return [...accumulator, ...annots.annots];\n }, []);\n}\n\n/**\n * Requests annotations URL via HTTP, sets ideo.rawAnnots for downstream\n * processing.\n *\n * @param annotsUrl Absolute or relative URL for native or BED annotations file\n */\nfunction fetchAnnots(annotsUrl) {\n var extension, is2dHeatmap,\n ideo = this,\n config = ideo.config;\n\n is2dHeatmap = config.annotationsLayout === 'heatmap-2d';\n\n var extension = validateAnnotsUrl(annotsUrl);\n\n if (annotsUrl.slice(0, 4) !== 'http' && !is2dHeatmap && extension !== 'tsv') {\n ideo.fetch(annotsUrl)\n .then(function(data) {\n ideo.rawAnnotsResponse = data; // Preserve truly raw response content\n ideo.rawAnnots = data; // Sometimes gets partially processed\n ideo.afterRawAnnots();\n });\n return;\n }\n\n extension = (is2dHeatmap ? '' : extension);\n\n ideo.fetch(annotsUrl, 'text')\n .then(function(text) {\n ideo.rawAnnotsResponse = text;\n if (is2dHeatmap) {\n var parser = new ExpressionMatrixParser(text, ideo);\n parser.setRawAnnots().then(function(d) {\n ideo.rawAnnots = d;\n ideo.afterRawAnnots();\n });\n } else {\n if (extension === 'tsv') {\n ideo.rawAnnots = new TsvParser(text, ideo).rawAnnots;\n } else if (extension === 'bed') {\n ideo.rawAnnots = new BedParser(text, ideo).rawAnnots;\n } else {\n ideo.rawAnnots = JSON.parse(text);\n }\n ideo.afterRawAnnots();\n }\n });\n}\n\n/**\n * Fills out annotations data structure such that its top-level list of arrays\n * matches that of this ideogram's chromosomes list in order and number\n * Fixes https://github.com/eweitz/ideogram/issues/66\n */\nfunction fillAnnots(annots) {\n var filledAnnots, chrs, chrArray, i, chr, annot, chrIndex;\n\n filledAnnots = [];\n chrs = [];\n chrArray = this.chromosomesArray;\n\n for (i = 0; i < chrArray.length; i++) {\n chr = chrArray[i].name;\n chrs.push(chr);\n filledAnnots.push({chr: chr, annots: []});\n }\n\n for (i = 0; i < annots.length; i++) {\n annot = annots[i];\n chrIndex = chrs.indexOf(annot.chr);\n if (chrIndex !== -1) {\n filledAnnots[chrIndex] = annot;\n }\n }\n\n return filledAnnots;\n}\n\nexport function applyRankCutoff(annots, cutoff, ideo) {\n const rankedAnnots = sortAnnotsByRank(annots, ideo);\n\n // Take the top N ranked genes, where N is `cutoff`\n annots = rankedAnnots.slice(0, cutoff);\n\n return annots;\n}\n\nexport function setAnnotRanks(annots, ideo) {\n if (annots.length === 0) return annots;\n if ('initRank' in annots[0] === false) {\n if ('geneCache' in ideo === false) return annots;\n\n const ranks = ideo.geneCache.interestingNames;\n\n return annots.map(annot => {\n if (ranks.includes(annot.name)) {\n annot.rank = ranks.indexOf(annot.name) + 1;\n } else {\n annot.rank = 1E10;\n }\n return annot;\n });\n } else {\n return annots.map(annot => {\n annot.rank = annot.initRank;\n return annot;\n });\n }\n}\n\nexport function sortAnnotsByRank(annots, ideo) {\n\n if (ideo) {\n annots = setAnnotRanks(annots, ideo);\n }\n // Ranks annots by popularity\n return annots.sort((a, b) => {\n\n // // Search gene is most important, regardless of popularity\n // if (a.color === 'red') return -1;\n // if (b.color === 'red') return 1;\n\n // Rank 3 is more important than rank 30\n return a.rank - b.rank;\n });\n}\n\nexport {\n onLoadAnnots, onDrawAnnots, processAnnotData, restoreDefaultTracks,\n updateDisplayedTracks, initAnnotSettings, fetchAnnots, drawAnnots,\n getHistogramBars, drawHeatmaps, deserializeAnnotsForHeatmap, fillAnnots,\n drawProcessedAnnots, drawSynteny, startHideAnnotTooltipTimeout,\n showAnnotTooltip, onWillShowAnnotTooltip, onDidShowAnnotTooltip,\n setOriginalTrackIndexes,\n afterRawAnnots, onClickAnnot, downloadAnnotations, addAnnotLabel,\n removeAnnotLabel, fillAnnotLabels, clearAnnotLabels, flattenAnnots\n // fadeOutAnnotLabels\n};\n","/** Adds boxes behind a list of chromosomes; can indicate selection, etc. */\nfunction highlight(chrNames, color='red') {\n const ideo = this;\n const taxid = ideo.config.taxid;\n\n const highlightsHtml = chrNames.map(chrName => {\n const chrId = ideo.chromosomes[taxid][chrName].id;\n const chrSet = `${ideo.selector} #${chrId}-chromosome-set`;\n const chrDom = document.querySelector(chrSet);\n const rect = chrDom.getBoundingClientRect();\n\n const style = `style=\"\n stroke-width: 1px;\n stroke: ${color};\n fill: ${color};\n fill-opacity: 0.05;\n position: absolute;\n rx: 4;\n ry: 4;\n height: ${rect.width + 15}px;\n width: ${rect.height + 15}px\"`;\n\n const left = chrDom.transform.baseVal[1].matrix.f - 7.5;\n const transform = `transform=\"rotate(90) translate(10, ${left})\"`;\n const id = `id=\"ideo-highlight-${chrId}\"`;\n\n return ``;\n }).join();\n\n const ideoDom = document.querySelector(ideo.selector);\n ideoDom.insertAdjacentHTML('afterBegin', highlightsHtml);\n}\n\n/** Removes highlight from a list of chromosomes (or all chromosomes) */\nfunction unhighlight(chrNames) {\n const ideo = this;\n\n let highlightsSelector = `${ideo.selector} .ideo-highlight`;\n if (typeof chrNames !== 'undefined') {\n const taxid = ideo.config.taxid;\n highlightsSelector = chrNames.map(chrName => {\n const chrId = ideo.chromosomes[taxid][chrName].id;\n return `${ideo.selector} #ideo-highlight-${chrId}`;\n });\n }\n\n document.querySelectorAll(highlightsSelector).forEach((element) => {\n element.remove();\n });\n\n}\n\nexport {highlight, unhighlight};\n","// The E-Utilies In Depth: Parameters, Syntax and More:\n// https://www.ncbi.nlm.nih.gov/books/NBK25499/\n\nvar apiKey = '&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808';\n\nvar eutils = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/';\nvar esearch = eutils + 'esearch.fcgi?retmode=json' + apiKey;\nvar esummary = eutils + 'esummary.fcgi?retmode=json' + apiKey;\nvar elink = eutils + 'elink.fcgi?retmode=json' + apiKey;\n\nfunction getAssemblySearchUrl(taxid, ideo) {\n var termStem, asmSearchUrl;\n\n if (ideo.assemblyIsAccession()) {\n termStem = ideo.config.assembly + '%22[Assembly%20Accession]';\n } else {\n termStem = (\n taxid + '%22[taxid]' +\n 'AND%20(%22latest%20refseq%22[filter])%20'\n );\n }\n\n asmSearchUrl =\n ideo.esearch +\n '&db=assembly' +\n '&term=%22' + termStem +\n 'AND%20(%22chromosome%20level%22[filter]%20' +\n 'OR%20%22complete%20genome%22[filter])';\n\n return asmSearchUrl;\n}\n\nexport {esearch, esummary, elink, getAssemblySearchUrl};\n","import {d3, slug, fetchWithRetry} from '../lib';\n\n/**\n * Returns NCBI Taxonomy identifier (taxid) for organism name\n */\nfunction getTaxidFromEutils(orgName, ideo) {\n var taxonomySearch, taxid;\n\n taxonomySearch = ideo.esearch + '&db=taxonomy&term=' + orgName;\n\n return d3.json(taxonomySearch).then(function(data) {\n var idlist = data.esearchresult.idlist;\n if (idlist.length === 0) {\n var warning =\n 'Organism \"' + orgName + '\" is generally unknown; it was not found ' +\n 'in the NCBI Taxonomy database. If you did not intend to specify a ' +\n 'novel or custom taxon, then try using the organism\\'s ' +\n 'scientific name, e.g. Homo sapiens or Arabidopsis thaliana.';\n throw warning;\n } else {\n taxid = data.esearchresult.idlist[0];\n return [orgName, taxid];\n }\n });\n}\n\n/**\n * Returns organism common name given an NCBI Taxonomy ID\n *\n * @param taxid NCBI Taxonomy ID\n * @param callback Function to call upon completing ESearch request\n */\nfunction getOrganismFromEutils(taxid, callback) {\n var organism, taxonomySearch,\n ideo = this;\n\n taxid = ideo.config.organism;\n\n taxonomySearch = ideo.esummary + '&db=taxonomy&id=' + taxid;\n\n d3.json(taxonomySearch).then(function(data) {\n organism = data.result[String(taxid)].commonname;\n ideo.config.organism = organism;\n return callback(organism);\n });\n}\n\nfunction setTaxidData(taxid, ideo) {\n\n var dataDir, urlOrg, taxids;\n\n if (ideo.assemblyIsAccession()) {\n return new Promise(function(resolve) {\n ideo.coordinateSystem = 'bp';\n ideo.getAssemblyAndChromosomesFromEutils(taxid, resolve);\n });\n }\n\n dataDir = ideo.config.dataDir;\n urlOrg = slug(ideo.organisms[taxid].scientificName);\n\n taxids = [taxid];\n\n var fullyBandedTaxids = ['9606', '10090', '10116'];\n if (fullyBandedTaxids.includes(taxid) && !ideo.config.showFullyBanded) {\n urlOrg += '-no-bands';\n }\n var chromosomesUrl = dataDir + urlOrg + '.json';\n\n var promise2 = new Promise((resolve, reject) => {\n return fetchWithRetry(chromosomesUrl)\n .then(response => {\n return response.json().then(function(json) {\n resolve(json);\n });\n })\n .catch((errorMessage) => {\n reject(errorMessage);\n });\n });\n\n return promise2\n .then(function(chrData) {\n // Check if chromosome data exists locally.\n // This is used for pre-processed centromere data,\n // which is not accessible via EUtils. See get_chromosomes.py.\n var chrBands = chrData.chrBands\n\n var asmAndChrTaxidsArray = [''],\n chromosomes = [],\n seenChrs = {},\n chr, maxLength, splitBand, length;\n\n ideo.bandData[chrData.taxid] = chrBands;\n\n for (var i = 0; i < chrBands.length; i++) {\n splitBand = chrBands[i].split(' ');\n chr = splitBand[0];\n length = splitBand.slice(-1)[0];\n if (chr in seenChrs) {\n continue;\n } else {\n chromosomes.push({name: chr, type: 'nuclear', length: length});\n seenChrs[chr] = 1;\n }\n }\n chromosomes = chromosomes.sort(Ideogram.sortChromosomes);\n maxLength = {bp: 0, iscn: 0};\n chromosomes.forEach(chr => {\n if (chr.length > maxLength.bp) maxLength.bp = chr.length;\n });\n ideo.maxLength[taxid] = maxLength;\n asmAndChrTaxidsArray.push(chromosomes);\n asmAndChrTaxidsArray.push(taxids);\n return asmAndChrTaxidsArray;\n },\n function() {\n // If request in `then` errs (404), fetch data from EUtils\n return new Promise(function(resolve) {\n ideo.coordinateSystem = 'bp';\n ideo.getAssemblyAndChromosomesFromEutils(taxid, resolve);\n });\n });\n}\n\nfunction setAssemblyAndChromosomes(taxid, resolve, ideo) {\n var assembly, chrs, originalChrs, orgName, filteredChrs,\n config = ideo.config;\n\n setTaxidData(taxid, ideo)\n .then(function(asmChrTaxidsArray) {\n assembly = asmChrTaxidsArray[0];\n chrs = asmChrTaxidsArray[1];\n\n if ('chromosomes' in config === false || config.chromosomes === null) {\n ideo.config.chromosomes = {};\n ideo.config.chromosomes[taxid] = chrs;\n } else {\n if (config.multiorganism) {\n if (taxid in config.chromosomes) {\n // Encountered when either organism has centromere data\n originalChrs = config.chromosomes[taxid];\n } else {\n // Encountered when neither organism has centromere data\n orgName = slug(ideo.getScientificName(taxid));\n ideo.config.chromosomes[taxid] =\n config.chromosomes[orgName].slice();\n originalChrs = ideo.config.chromosomes[taxid];\n // delete ideo.config.chromosomes[orgName];\n }\n } else {\n originalChrs = config.chromosomes;\n }\n\n filteredChrs = chrs.filter(d => originalChrs.includes(d.name));\n ideo.config.chromosomes[taxid] = filteredChrs;\n }\n ideo.chromosomes[taxid] = ideo.config.chromosomes[taxid].slice();\n ideo.organisms[taxid].assemblies = {\n default: assembly\n };\n resolve();\n });\n}\n\n/**\n * Determine if organism is natively supported, using its name.\n */\nfunction isOrganismSupported(org, ideo) {\n var taxid, ideoOrg;\n\n for (taxid in ideo.organisms) {\n ideoOrg = ideo.organisms[taxid];\n if (\n taxid === slug(org) ||\n slug(ideoOrg.commonName) === slug(org) ||\n slug(ideoOrg.scientificName) === slug(org)\n ) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Augment \"organisms\" metadata with for any requested organism that is\n * not natively supported (i.e., not in organism-metadata.js).\n*/\nfunction populateNonNativeOrg(orgs, ideo) {\n var org, promise, i,\n getTaxidFromEutilsPromises = [],\n augmentedOrganismMetadata = {};\n\n for (i = 0; i < orgs.length; i++) {\n org = orgs[i];\n if (isOrganismSupported(org, ideo) === false) {\n promise = getTaxidFromEutils(org, ideo)\n .then(function(orgNameAndTaxid) {\n\n var taxid = orgNameAndTaxid[1],\n orgName = orgNameAndTaxid[0],\n name, scientificName;\n\n name = orgName.replace('-', ' ');\n scientificName = name[0].toUpperCase() + name.slice(1);\n\n augmentedOrganismMetadata[taxid] = {\n scientificName: scientificName,\n commonName: '',\n assemblies: {default: ''}\n };\n\n Object.assign(ideo.organisms, augmentedOrganismMetadata);\n }, function(warning) {\n console.warn(warning);\n var customMetadata = {\n scientificName: org,\n commonName: org,\n assemblies: {default: ''}\n };\n\n // Use a negative number as unofficial taxid for custom organism.\n // Use case: https://github.com/eweitz/ideogram/issues/265\n //\n // If support for *multiple* custom specifies is ever\n // needed, we can decrement from -1.\n ideo.organisms['-1'] = customMetadata;\n augmentedOrganismMetadata['-1'] = customMetadata;\n });\n } else {\n promise = new Promise(function(resolve) {\n var taxid = ideo.getTaxid(org);\n augmentedOrganismMetadata[taxid] = ideo.organisms[taxid];\n resolve();\n });\n }\n getTaxidFromEutilsPromises.push(promise);\n }\n\n return Promise.all(getTaxidFromEutilsPromises).then(function() {\n return augmentedOrganismMetadata;\n });\n}\n\nfunction prepareTmpChrsAndTaxids(ideo) {\n var orgs, taxids, tmpChrs, org, taxid, chrsOrgSlugs,\n config = ideo.config;\n\n taxids = [];\n tmpChrs = {};\n orgs = (config.multiorganism) ? config.organism : [config.organism];\n\n return populateNonNativeOrg(orgs, ideo).then(function(orgMetadata) {\n var orgFields = orgMetadata[taxid];\n\n for (taxid in orgMetadata) {\n orgFields = orgMetadata[taxid];\n taxids.push(taxid);\n if (config.multiorganism) {\n if (typeof config.chromosomes !== 'undefined') {\n chrsOrgSlugs = Object.keys(config.chromosomes).map(org => slug(org));\n // Adjusts 'chromosomes' configuration parameter to make object\n // keys use taxid instead of common organism name\n if (chrsOrgSlugs.includes(slug(orgFields.scientificName))) {\n org = orgFields.scientificName;\n } else if (chrsOrgSlugs.includes(slug(orgFields.commonName))) {\n org = orgFields.commonName;\n }\n if (slug(org) in config.chromosomes) {\n tmpChrs[taxid] = config.chromosomes[slug(org)];\n } else {\n tmpChrs[taxid] = config.chromosomes[org.toLowerCase()];\n }\n } else {\n tmpChrs = null;\n }\n }\n }\n return [tmpChrs, taxids];\n });\n}\n\n/**\n * Sort taxids by the \"organism\" configuration option\n *\n * TODO: Handle taxid being passed as organism\n */\nfunction sortTaxidsByOriginalOrganismOption(ideo) {\n var configOrganisms, sortedTaxids, i;\n configOrganisms = ideo.config.organism;\n sortedTaxids = [];\n if (Array.isArray(configOrganisms)) {\n // Handling multi-organism ideogram\n for (i = 0; i < configOrganisms.length; i++) {\n sortedTaxids.push(ideo.getTaxid(configOrganisms[i]));\n }\n } else {\n // Handling single-organism ideogram\n sortedTaxids.push(ideo.getTaxid(configOrganisms));\n }\n return sortedTaxids;\n}\n\nfunction getTaxidsForOrganismsInConfig(callback, ideo) {\n\n prepareTmpChrsAndTaxids(ideo).then(function([tmpChrs, taxids]) {\n var i, taxid, promise, assemblies, asmAccs,\n config = ideo.config,\n asmAndChrPromises = [];\n\n for (i = 0; i < taxids.length; i++) {\n taxid = taxids[i];\n assemblies = ideo.organisms[taxid].assemblies;\n asmAccs = Object.values(assemblies);\n if (\n assemblies.default === '' ||\n ideo.assemblyIsAccession() && !asmAccs.includes(config.assembly)\n ) {\n promise = new Promise(function(resolve) {\n setAssemblyAndChromosomes(taxid, resolve, ideo);\n });\n } else {\n ideo.config.taxids = taxids;\n if (ideo.config.multiorganism) {\n ideo.config.chromosomes = tmpChrs;\n }\n promise = new Promise(function(resolve) {\n resolve();\n });\n }\n\n asmAndChrPromises.push(promise);\n }\n\n Promise.all(asmAndChrPromises).then(function() {\n taxids = sortTaxidsByOriginalOrganismOption(ideo);\n ideo.config.taxids = taxids;\n return callback(taxids);\n });\n });\n}\n\nfunction getIsMultiorganism(taxidInit, ideo) {\n return (\n ('organism' in ideo.config && ideo.config.organism instanceof Array) ||\n (taxidInit && ideo.config.taxid instanceof Array)\n );\n}\n\n/**\n * Configure Ideogram taxids when 'organism' is not in ideo.config\n */\nfunction getTaxidsForOrganismsNotInConfig(taxidInit, callback, ideo) {\n var taxids;\n\n if (ideo.config.multiorganism) {\n if (taxidInit) {\n taxids = ideo.config.taxid;\n }\n } else {\n if (taxidInit) {\n taxids = [ideo.config.taxid];\n }\n ideo.config.taxids = taxids;\n }\n callback(taxids);\n}\n\n/**\n * Returns an array of taxids for the current ideogram\n * Also sets configuration parameters related to taxid(s), whether ideogram is\n * multiorganism, and adjusts chromosomes parameters as needed\n **/\nfunction getTaxids(callback) {\n var taxidInit,\n ideo = this;\n\n taxidInit = 'taxid' in ideo.config;\n\n ideo.config.multiorganism = getIsMultiorganism(taxidInit, ideo);\n\n if (ideo.config.multiorganism) ideo.coordinateSystem = 'bp';\n\n if ('organism' in ideo.config) {\n const org = ideo.config.organism;\n if (typeof org === 'string') {\n // Canonicalize e.g. \"Homo sapiens\" to \"homo-sapiens\"\n ideo.config.organism = slug(org.toLowerCase());\n }\n\n getTaxidsForOrganismsInConfig(callback, ideo);\n } else {\n getTaxidsForOrganismsNotInConfig(taxidInit, callback, ideo);\n }\n}\n\nexport {\n getTaxids, getOrganismFromEutils\n};\n","import {d3} from '../lib';\nimport {\n esearch, esummary, elink, getAssemblySearchUrl\n} from './eutils-config.js';\nimport {\n getTaxids, getOrganismFromEutils\n} from './organisms.js';\n\n/**\n * Get a URL to ESearch the NCBI Nucleotide DB for an Assembly UID\n */\nfunction getESearchUrlForChromosomes(asmUid, ideo) {\n var qs;\n\n // Get a list of IDs for the chromosomes in this genome.\n //\n // Query chromosomes sequences in Nucleotide DB (nuccore) via\n // Assembly DB E-Utils link.\n qs = ('&db=nuccore&dbfrom=assembly&linkname=assembly_nuccore&' +\n 'cmd=neighbor_history&from_uid=' + asmUid);\n\n return d3.json(ideo.elink + qs)\n .then(function(data) {\n var webenv = data.linksets[0].webenv;\n qs =\n '&db=nuccore' +\n '&term=%231+AND+%28' +\n 'sequence_from_chromosome[Properties]+OR+' +\n 'sequence_from_plastid[Properties]+OR+' +\n 'sequence_from_mitochondrion[Properties]%29' +\n '&WebEnv=' + webenv + '&usehistory=y&retmax=1000';\n return ideo.esearch + qs;\n });\n}\n\n/**\n * Request basic data on a list of chromosome IDs from ESearch\n */\nfunction fetchNucleotideSummary(data, ideo) {\n var ids, ntSummary;\n ids = data.esearchresult.idlist.join(',');\n ntSummary = ideo.esummary + '&db=nucleotide&id=' + ids;\n return d3.json(ntSummary);\n}\n\n/**\n * Get name and type for mitochondrial chromosome\n *\n * See example of \"MT\" in yeast:\n * https://eweitz.github.io/ideogram/eukaryotes?org=saccharomyces-cerevisiae\n */\nfunction parseMitochondrion(result, ideo) {\n var type, cnIndex, chrName;\n\n if (ideo.config.showNonNuclearChromosomes) {\n type = result.genome;\n cnIndex = result.subtype.split('|').indexOf('plasmid');\n if (cnIndex === -1) {\n chrName = 'MT';\n } else {\n // Seen in e.g. rice genome IRGSP-1.0 (GCF_001433935.1),\n // From https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?retmode=json&db=nucleotide&id=996703432,996703431,996703430,996703429,996703428,996703427,996703426,996703425,996703424,996703423,996703422,996703421,194033210,11466763,7524755\n // genome: 'mitochondrion',\n // subtype: 'cell_line|plasmid',\n // subname: 'A-58 CMS|B1',\n chrName = result.subname.split('|')[cnIndex];\n }\n } else {\n return [null, null];\n }\n\n return [chrName, type];\n}\n\n/**\n * Get name and type for chloroplastic chromosome.\n *\n * Plants have chloroplasts. See e.g. green algae:\n * https://eweitz.github.io/ideogram/eukaryotes?org=micromonas-commoda\n */\nfunction parseChloroplastOrPlastid(ideo) {\n // Plastid encountered with rice genome IRGSP-1.0 (GCF_001433935.1)\n if (ideo.config.showNonNuclearChromosomes) {\n return ['CP', 'chloroplast'];\n }\n return [null, null];\n}\n\n/**\n * Get name and type for apicoplast chromosome\n *\n * Plasmodium falciparum (malaria parasite) has such a chromosome, see e.g.:\n * https://eweitz.github.io/ideogram/eukaryotes?org=plasmodium-falciparum\n */\nfunction parseApicoplast(ideo) {\n if (ideo.config.showNonNuclearChromosomes) {\n return ['AP', 'apicoplast'];\n }\n return [null, null];\n}\n\n/**\n * Get name and type for nuclear chromosome\n *\n * These are typical chromosomes, like chromosome 1.\n */\nfunction parseNuclear(result) {\n var type, cnIndex, chrName;\n\n type = 'nuclear';\n cnIndex = result.subtype.split('|').indexOf('chromosome');\n chrName = result.subname.split('|')[cnIndex];\n\n if (typeof chrName !== 'undefined' && chrName.substr(0, 3) === 'chr') {\n // Convert \"chr12\" to \"12\", e.g. for banana (GCF_000313855.2)\n chrName = chrName.substr(3);\n }\n\n return [chrName, type];\n}\n\n/**\n * Get name and type of any chromosome object from NCBI Nucleotide ESummary\n */\nfunction getChrNameAndType(result, ideo) {\n var genome = result.genome;\n if (genome === 'mitochondrion') {\n return parseMitochondrion(result, ideo);\n } else if (genome === 'chloroplast' || genome === 'plastid') {\n return parseChloroplastOrPlastid(ideo);\n } else if (genome === 'apicoplast') {\n return parseApicoplast(ideo);\n } else {\n return parseNuclear(result);\n }\n}\n\nfunction parseChromosome(result, ideo) {\n var chrName, type, chromosome;\n\n [chrName, type] = getChrNameAndType(result, ideo);\n\n chromosome = {\n name: chrName,\n length: result.slen,\n type: type\n };\n\n return chromosome;\n}\n\nfunction parseChromosomes(results, taxid, ideo) {\n var x, chromosome, seenChrId, maxLength,\n seenChrs = {},\n chromosomes = [];\n\n for (x in results) {\n // omit list of result uids\n if (x === 'uids') continue;\n\n chromosome = parseChromosome(results[x], ideo);\n seenChrId = chromosome.name + '_' + chromosome.length;\n if (chromosome.type !== null && seenChrId in seenChrs === false) {\n // seenChrs accounts for duplicate chromosomes seen with\n // pig (Sus scrofa), likely GenBank and RefSeq copies.\n chromosomes.push(chromosome);\n }\n\n seenChrs[seenChrId] = 1;\n }\n\n chromosomes = chromosomes.sort(Ideogram.sortChromosomes);\n\n maxLength = {bp: 0, iscn: 0};\n chromosomes.forEach(chr => {\n if (chr.length > maxLength.bp) maxLength.bp = chr.length;\n });\n if (maxLength.bp > ideo.maxLength.bp) ideo.maxLength.bp = maxLength.bp;\n ideo.maxLength[taxid] = maxLength;\n ideo.coordinateSystem = 'bp';\n\n return chromosomes;\n}\n\n/**\n * Request ESummary data from an ESearch on a genome assembly\n */\nfunction fetchAssemblySummary(data, ideo) {\n var asmUid, asmSummaryUrl;\n\n // NCBI Assembly database's internal identifier (uid) for this assembly\n asmUid = data.esearchresult.idlist[0];\n asmSummaryUrl = ideo.esummary + '&db=assembly&id=' + asmUid;\n\n return d3.json(asmSummaryUrl);\n}\n\n/**\n * Returns assembly accession, as well as names and lengths of chromosomes for\n * an organism's best-known genome assembly, or for a specified assembly.\n *\n * Gets data from NCBI EUtils web API.\n *\n * @param callback Function to call upon completion of this async method\n */\nfunction getAssemblyAndChromosomesFromEutils(taxid, callback) {\n var assemblyAccession,\n ideo = this;\n\n // Search for assembly, then\n // get summary of that assembly, then\n // get search URL for chromosomes in that assembly, then\n // get search results containing chromosome IDs, then\n // get summaries of each of those chromosome IDs, then\n // format the chromosome summaries and pass them into callback function.\n var asmSearchUrl = getAssemblySearchUrl(taxid, ideo);\n d3.json(asmSearchUrl)\n .then(function(data) {return fetchAssemblySummary(data, ideo);})\n .then(function(data) {\n var asmUid = data.result.uids[0];\n assemblyAccession = data.result[asmUid];\n return getESearchUrlForChromosomes(asmUid, ideo);\n }).then(function(esearchUrl) {return d3.json(esearchUrl);})\n .then(function(data) {return fetchNucleotideSummary(data, ideo);})\n .then(function(data) {\n var chromosomes = parseChromosomes(data.result, taxid, ideo);\n return callback([assemblyAccession, chromosomes]);\n }, function(rejectedReason) {\n console.warn(rejectedReason);\n });\n}\n\nexport {\n esearch, esummary, elink, getOrganismFromEutils,\n getTaxids, getAssemblyAndChromosomesFromEutils\n};\n","/**\n * @fileoverview Methods to show (or hide) cytogenetic banding data\n */\n\nimport {d3} from '../lib';\n\nfunction hideUnshownBandLabels() {\n var ideo = this;\n var bandsToShow = ideo.bandsToShow.join(',');\n\n // Handles edge-case when ideogram consists of one chromosome\n // that lacks bands in a genome that has bands (e.g. MT in human)\n if (ideo.bandsToShow.length === 0) return;\n\n // d3.selectAll resolves to querySelectorAll (QSA).\n // QSA takes a surprisingly long time to complete,\n // and scales with the number of selectors.\n // Most bands are hidden, so we can optimize by\n // Hiding all bands, then QSA'ing and displaying the\n // relatively few bands that are shown.\n d3.selectAll(ideo.selector + ' .bandLabel, .bandLabelStalk')\n .style('display', 'none');\n d3.selectAll(bandsToShow).style('display', '');\n}\n\nfunction getPrevRight(prevLabelXRight, prevHiddenBoxIndex, i,\n textOffsets, chrModel) {\n var prevTextBoxLeft, prevTextBoxWidth;\n\n if (prevHiddenBoxIndex !== i) {\n // This getBoundingClientRect() forces Chrome's\n // 'Recalculate Style' and 'Layout', which takes 30-40 ms on Chrome.\n // TODO: This forced synchronous layout would be nice to eliminate.\n // prevTextBox = texts[i].getBoundingClientRect();\n // prevLabelXRight = prevTextBox.left + prevTextBox.width;\n\n // TODO: Account for number of characters in prevTextBoxWidth,\n // maybe also zoom.\n prevTextBoxLeft = textOffsets[chrModel.id][i];\n prevTextBoxWidth = 36;\n\n prevLabelXRight = prevTextBoxLeft + prevTextBoxWidth;\n }\n\n return prevLabelXRight;\n}\n\nfunction updateShown(indexesToShow, overlapRight, left, pad, prevRight, i,\n isBefore) {\n var hiddenIndex, doSkip,\n thisRight = isBefore ? overlapRight : prevRight;\n\n if (left < pad + thisRight) {\n overlapRight = prevRight;\n hiddenIndex = i;\n doSkip = isBefore;\n } else {\n indexesToShow.push(i);\n }\n\n return [indexesToShow, overlapRight, hiddenIndex, doSkip];\n}\n\nfunction getIndexesToShow(offsets, chrModel) {\n var i, hiddenIndex, left, prevRight, doSkip,\n indexesToShow = [],\n textsLength = offsets[chrModel.id].length,\n overlapRight = 0, // Right X coordinate of overlapping label\n pad = 5; // text padding\n\n for (i = 0; i < textsLength; i++) {\n // Ensures band labels don't overlap\n left = offsets[chrModel.id][i];\n\n [indexesToShow, overlapRight, hiddenIndex, doSkip] =\n updateShown(indexesToShow, overlapRight, left, pad, prevRight, i, true);\n if (doSkip) continue;\n\n prevRight = getPrevRight(prevRight, hiddenIndex, i, offsets, chrModel);\n\n [indexesToShow, overlapRight, hiddenIndex, doSkip] =\n updateShown(indexesToShow, overlapRight, left, pad, prevRight, i, false);\n }\n\n return indexesToShow;\n}\n\n/**\n * Sets band labels to display on each chromosome, avoiding label overlap\n */\nfunction setBandsToShow(chrs, textOffsets) {\n var index, i, j, indexesToShow, chrModel, selectorsToShow, ithLength,\n ideo = this;\n\n ideo.bandsToShow = [];\n\n for (i = 0; i < chrs.length; i++) {\n\n chrModel = chrs[i];\n\n indexesToShow = getIndexesToShow(textOffsets, chrModel);\n\n selectorsToShow = [];\n ithLength = indexesToShow.length;\n\n for (j = 0; j < ithLength; j++) {\n index = indexesToShow[j];\n selectorsToShow.push('#' + chrModel.id + ' .bsbsl-' + index);\n }\n\n ideo.bandsToShow = ideo.bandsToShow.concat(selectorsToShow);\n }\n}\n\nexport {hideUnshownBandLabels, setBandsToShow};\n","/**\n * @fileoverview Methods to draw cytogenetic bands and their labels\n *\n */\n\nimport {d3} from '../lib';\nimport {hideUnshownBandLabels, setBandsToShow} from './show';\nimport {staticColors, staticGradients} from './styles';\nimport {configuredCss} from './../init/configure';\n\n/**\n * Draws text of cytoband label\n */\nfunction drawBandLabelText(chr, bandsToLabel, chrModel, textOffsets) {\n var ideo = this,\n layout = ideo._layout,\n chrIndex = chrModel.chrIndex;\n\n chr.selectAll('text')\n .data(bandsToLabel)\n .enter()\n .append('g')\n .attr('class', function(d, i) {\n return 'bandLabel bsbsl-' + i;\n })\n .attr('transform', function(d) {\n var transform = layout.getChromosomeBandLabelTranslate(d, chrIndex);\n\n if (ideo.config.orientation === 'horizontal') {\n textOffsets[chrModel.id].push(transform.x + 13);\n } else {\n textOffsets[chrModel.id].push(transform.y + 6);\n }\n\n return transform.translate;\n })\n .append('text')\n .attr('text-anchor', layout.getChromosomeBandLabelAnchor(chrIndex))\n .text(function(d) {return d.name;});\n\n return textOffsets;\n}\n\n/**\n * Draws line between cytoband and its text label\n */\nfunction drawBandLabelStalk(chr, bandsToLabel, chrModel, textOffsets) {\n var ideo = this;\n\n chr.selectAll('line.bandLabelStalk')\n .data(bandsToLabel)\n .enter()\n .append('g')\n .attr('class', function(d, i) {\n return 'bandLabelStalk bsbsl-' + i;\n })\n .attr('transform', function(d) {\n var x, y;\n\n x = ideo.round(d.px.start + d.px.width / 2);\n y = -10;\n\n textOffsets[chrModel.id].push(x + 13);\n\n return 'translate(' + x + ',' + y + ')';\n })\n .append('line')\n .attr('x1', 0)\n .attr('y1', ideo._layout.getChromosomeBandTickY1(chrModel.chrIndex))\n .attr('x2', 0)\n .attr('y2', ideo._layout.getChromosomeBandTickY2(chrModel.chrIndex));\n}\n\nfunction getChrModels(chromosomes) {\n var taxid, chr,\n chrModels = [];\n\n for (taxid in chromosomes) {\n for (chr in chromosomes[taxid]) {\n chrModels.push(chromosomes[taxid][chr]);\n }\n }\n\n return chrModels;\n}\n\n/**\n * Draws text and stalks for cytogenetic band labels.\n *\n * Band labels are text like \"p11.11\".\n * Stalks are small lines that visually connect labels to their bands.\n */\nfunction drawBandLabels(chromosomes) {\n var i, chr, chrModel, chrModels, bandsToLabel,\n ideo = this,\n textOffsets = {};\n\n chrModels = getChrModels(chromosomes);\n\n for (i = 0; i < chrModels.length; i++) {\n chrModel = chrModels[i];\n chr = d3.select(ideo.selector + ' #' + chrModel.id);\n textOffsets[chrModel.id] = [];\n\n // Don't show \"pter\" label for telocentric chromosomes, e.g. mouse\n bandsToLabel = chrModel.bands.filter(d => d.name !== 'pter');\n\n textOffsets =\n ideo.drawBandLabelText(chr, bandsToLabel, chrModel, textOffsets);\n\n ideo.drawBandLabelStalk(chr, bandsToLabel, chrModel, textOffsets);\n }\n\n ideo.setBandsToShow(chrModels, textOffsets);\n}\n\nfunction getStainAndColors(i, colors) {\n var stain, color1, color2, color3;\n\n stain = colors[i][0];\n color1 = colors[i][1];\n color2 = colors[i][2];\n color3 = colors[i][3];\n\n return [stain, color1, color2, color3];\n}\n\nfunction getGradients(colors) {\n var i, stain, color1, color2, color3,\n gradients = '';\n\n for (i = 0; i < colors.length; i++) {\n [stain, color1, color2, color3] = getStainAndColors(i, colors);\n gradients +=\n '';\n if (stain === 'gneg') {\n gradients +=\n '' +\n '' +\n '';\n } else {\n gradients +=\n '' +\n '' +\n '';\n }\n gradients +=\n '';\n }\n\n return gradients;\n}\n\n/**\n * Returns SVG gradients that give chromosomes a polished look\n */\nfunction getBandColorGradients() {\n var css,\n gradients = '';\n\n gradients = getGradients(staticColors);\n\n css = ``;\n\n gradients += staticGradients;\n gradients = '' + gradients + '';\n gradients = css + gradients;\n\n return gradients;\n}\n\nexport {\n drawBandLabels, getBandColorGradients, hideUnshownBandLabels, setBandsToShow,\n drawBandLabelText, drawBandLabelStalk\n};\n","\nfunction getDelimiterTsvLinesAndInit(source, content) {\n var delimiter, tsvLines, init;\n\n if (typeof chrBands === 'undefined' && source !== 'native') {\n delimiter = /\\t/;\n tsvLines = content.split(/\\r\\n|\\n/);\n init = 1;\n } else {\n delimiter = / /;\n tsvLines = content;\n init = 0;\n }\n\n return [delimiter, tsvLines, init];\n}\n\nfunction updateChromosomes(chromosomes) {\n var tmp, i;\n\n if (chromosomes instanceof Array && typeof chromosomes[0] === 'object') {\n tmp = [];\n for (i = 0; i < chromosomes.length; i++) {\n tmp.push(chromosomes[i].name);\n }\n chromosomes = tmp;\n }\n return chromosomes;\n}\n\nfunction getLineObject(chr, columns, stain, taxid) {\n return {\n chr: chr,\n bp: {\n start: parseInt(columns[5], 10),\n stop: parseInt(columns[6], 10)\n },\n iscn: {\n start: parseInt(columns[3], 10),\n stop: parseInt(columns[4], 10)\n },\n px: {\n start: -1,\n stop: -1,\n width: -1\n },\n name: columns[1] + columns[2],\n stain: stain,\n taxid: taxid\n };\n}\n\nfunction getStain(columns) {\n var stain = columns[7];\n // For e.g. acen and gvar, columns[8] (density) is undefined\n if (columns[8]) stain += columns[8];\n return stain;\n}\n\nfunction updateLines(lines, columns, taxid) {\n var chr, stain, line;\n\n chr = columns[0];\n if (chr in lines === false) lines[chr] = [];\n\n stain = getStain(columns);\n\n line = getLineObject(chr, columns, stain, taxid);\n lines[chr].push(line);\n\n return lines;\n}\n\n/**\n * Reports if a cytogenetic band should be included in parse results\n *\n * TODO:\n * Normalize ideogram.chromosomes upstream.\n *\n * This function is complex because ideogram.chromosomes is (likely\n * unnecessarily) complex. The \"ideogram.chromosomes\" object can\n * take many forms depending on the use case, and this results in\n * hard-to-reason-about functions like this.\n *\n * Normalizing ideogram.chromosomes to a common format somewhere upstream\n * would likely make this specific function and Ideogram in general much\n * more maintainable.\n */\nfunction shouldSkipBand(chrs, chr, taxid, ideo) {\n\n var hasChrs, chrsAreList, chrNotInList, chrsAreObject,\n innerChrsAreStrings, matchingChrObjs, chrNotInObject,\n multiorganism = ideo.config.multiorganism;\n\n hasChrs = typeof chrs !== 'undefined' && chrs !== null;\n if (!hasChrs) return false;\n\n chrsAreList = Array.isArray(chrs);\n chrNotInList = chrsAreList && chrs.indexOf(chr) === -1;\n chrsAreObject = typeof chrs === 'object';\n\n if (chrsAreList && !chrsAreObject && chrNotInList) return true;\n\n if (taxid in chrs === false && multiorganism) return false;\n\n if (!multiorganism) {\n // Encountered in single organism when showing subset of all chromosomes,\n // e.g. only human X and Y as in https://eweitz.github.io/ideogram/homology-basic\n matchingChrObjs = chrs.filter(thisChr => thisChr === chr);\n chrNotInObject = matchingChrObjs.length === 0;\n } else {\n innerChrsAreStrings = typeof chrs[taxid][0] === 'string';\n if (innerChrsAreStrings) {\n chrNotInObject = chrs[taxid].includes(chr) === false;\n } else {\n matchingChrObjs = chrs[taxid].filter(thisChr => thisChr.name === chr);\n chrNotInObject = matchingChrObjs.length === 0;\n }\n }\n return chrNotInObject;\n\n}\n\n/**\n * Parses cytogenetic band data from a TSV file, or, if band data is\n * prefetched, from an array\n *\n * NCBI:\n * #chromosome arm band iscn_start iscn_stop bp_start bp_stop stain density\n * ftp://ftp.ncbi.nlm.nih.gov/pub/gdp/ideogram_9606_GCF_000001305.14_550_V1\n */\nfunction parseBands(taxid, chromosomes, ideo) {\n var delimiter, tsvLines, columns, chr, i, init, source, content,\n lines = {};\n\n content = ideo.bandData[taxid];\n\n if (Array.isArray(content)) source = 'native';\n\n chromosomes = updateChromosomes(chromosomes);\n\n // Destructure assignment fails oddly when transpiled. 2019-05-23\n var result = getDelimiterTsvLinesAndInit(source, content);\n delimiter = result[0];\n tsvLines = result[1];\n init = result[2];\n\n for (i = init; i < tsvLines.length; i++) {\n columns = tsvLines[i].split(delimiter);\n\n chr = columns[0];\n if (shouldSkipBand(chromosomes, chr, taxid, ideo)) {\n // If specific chromosomes are configured, then skip processing all\n // other fetched chromosomes.\n continue;\n }\n\n lines = updateLines(lines, columns, taxid);\n }\n\n return lines;\n}\n\nexport {parseBands};\n","/**\n * @fileoverview Methods for processing chromosome length and banding data.\n *\n * Ideogram.js depicts chromosomes using data on their length, name, and\n * (if dealing with a very well-studied organism) cytogenetic banding data.\n * This file processes cytoband data that comes from biological research\n * institutions.\n *\n * For background on cytogenetic bands and how they are used in genomics, see:\n * https://ghr.nlm.nih.gov/primer/howgeneswork/genelocation\n *\n */\n\nimport {\n drawBandLabels, getBandColorGradients, hideUnshownBandLabels, setBandsToShow,\n drawBandLabelText, drawBandLabelStalk\n} from './draw';\nimport {parseBands} from './parse';\nimport {organismMetadata} from '../init/organism-metadata';\n\n/**\n * Gets bands array for given chromosomes, sets ideo.maxLength\n */\nfunction getBandsArray(chromosome, bandsByChr, taxid, ideo) {\n var bands, chrLength,\n bandsArray = [];\n\n bands = bandsByChr[chromosome];\n bandsArray.push(bands);\n\n chrLength = {\n iscn: bands[bands.length - 1].iscn.stop,\n bp: bands[bands.length - 1].bp.stop\n };\n\n if (taxid in ideo.maxLength === false) {\n ideo.maxLength[taxid] = {bp: 0, iscn: 0};\n }\n\n if (chrLength.iscn > ideo.maxLength[taxid].iscn) {\n ideo.maxLength[taxid].iscn = chrLength.iscn;\n if (chrLength.iscn > ideo.maxLength.iscn) {\n ideo.maxLength.iscn = chrLength.iscn;\n }\n }\n\n if (chrLength.bp > ideo.maxLength[taxid].bp) {\n ideo.maxLength[taxid].bp = chrLength.bp;\n if (chrLength.bp > ideo.maxLength.bp) {\n ideo.maxLength.bp = chrLength.bp;\n }\n }\n\n return bandsArray;\n}\n\n/**\n * Updates bandsArray, sets ideo.config.chromosomes and ideo.numChromosomes\n */\nfunction setChrsByTaxidsWithBands(taxid, chrs, bandsArray, ideo) {\n var bandsByChr, chromosome, k, chrBandsArray;\n\n bandsByChr = parseBands(taxid, chrs, ideo);\n\n chrs = Object.keys(bandsByChr).sort(Ideogram.sortChromosomes);\n\n if (\n 'chromosomes' in ideo.config === false ||\n ideo.config.chromosomes === null\n ) {\n ideo.config.chromosomes = {};\n }\n if (chrs.length > 0) {\n ideo.config.chromosomes[taxid] = chrs.slice();\n }\n ideo.numChromosomes += ideo.config.chromosomes[taxid].length;\n\n for (k = 0; k < chrs.length; k++) {\n chromosome = chrs[k];\n chrBandsArray = getBandsArray(chromosome, bandsByChr, taxid, ideo);\n bandsArray = bandsArray.concat(chrBandsArray);\n }\n\n return bandsArray;\n}\n\nfunction setChromosomesByTaxid(taxid, chrs, bandsArray, ideo) {\n var chr, i;\n\n if (\n taxid in ideo.bandData ||\n taxid in organismMetadata &&\n ideo.assemblyIsAccession() === false\n ) {\n bandsArray = setChrsByTaxidsWithBands(taxid, chrs, bandsArray, ideo);\n } else {\n // If lacking band-level data\n ideo.numChromosomes += chrs.length;\n\n for (i = 0; i < chrs.length; i++) {\n chr = chrs[i];\n if (chr.length > ideo.maxLength.bp) ideo.maxLength.bp = chr.length;\n }\n }\n\n return bandsArray;\n}\n\nfunction reportPerformance(t0, ideo) {\n var t1 = new Date().getTime();\n if (ideo.config.debug) {\n console.log('Time in processBandData: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Completes default ideogram initialization by calling downstream functions\n * to process raw band data into full JSON objects, render chromosome and\n * cytoband figures and labels, apply initial graphical transformations,\n * hide overlapping band labels, and execute callbacks defined by client code\n */\nfunction processBandData(taxid) {\n var bandsArray, chrs,\n ideo = this,\n config = ideo.config,\n t0 = new Date().getTime();\n\n bandsArray = [];\n\n if ('chromosomes' in config) {\n if (config.multiorganism) {\n // Copy object\n chrs = config.chromosomes;\n } else if (taxid in config.chromosomes) {\n // Copy array by value\n chrs = config.chromosomes[taxid].slice();\n } else {\n // Copy array by value. Needed for e.g. \"Homology, basic\"\n chrs = config.chromosomes.slice();\n }\n }\n\n bandsArray = setChromosomesByTaxid(taxid, chrs, bandsArray, ideo);\n\n reportPerformance(t0, ideo);\n return [taxid, bandsArray];\n}\n\nexport {\n drawBandLabels, getBandColorGradients, processBandData,\n setBandsToShow, hideUnshownBandLabels, drawBandLabelText, drawBandLabelStalk\n};\n","/**\n * @fileoverview Methods to create and handle a brush on a chromosome.\n *\n * Ideogram.js enables users to display a box around part of a chromosome\n * that represents a \"currently selected\" region. The user can move this\n * box like a sliding window, e.g. by clicking and dragging the mouse.\n *\n * For background, see:\n * https://github.com/d3/d3-brush\n */\n\nimport {d3} from './lib';\n\n/**\n * Custom event handler, fired upon dragging sliding window on chromosome\n */\nfunction onBrushMove() {\n call(this.onBrushMoveCallback);\n}\n\nfunction onBrushEnd() {\n call(this.onBrushEndCallback);\n}\n\nfunction setBrush(bpDomain, pxRange, xOffset, width, ideo) {\n var xScale,\n length = ideo.config.chrHeight;\n\n xScale = d3.scaleLinear().domain(bpDomain).range(pxRange);\n\n ideo.brush = d3.brushX()\n .extent([[xOffset, 0], [length + xOffset, width]])\n .on('brush', _onBrushMove)\n .on('end', _onBrushEnd);\n\n function _onBrushMove({selection}) {\n var extent = selection.map(xScale.invert),\n from = Math.floor(extent[0]),\n to = Math.ceil(extent[1]);\n\n ideo.selectedRegion = {from: from, to: to, extent: (to - from)};\n\n if (ideo.onBrushMoveCallback) {\n ideo.onBrushMoveCallback();\n }\n }\n\n function _onBrushEnd({selection}) {\n if (ideo.onBrushEndCallback) {\n ideo.onBrushEndCallback();\n }\n }\n}\n\nfunction getBasePairDomainAndPixelRange(chrModel, xOffset) {\n var band, i,\n bpDomain = [1],\n pxRange = [1],\n lastBand = chrModel.bands.slice(-1)[0];\n\n for (i = 0; i < chrModel.bands.length; i++) {\n band = chrModel.bands[i];\n bpDomain.push(band.bp.start);\n pxRange.push(band.px.start + xOffset);\n }\n\n bpDomain.push(lastBand.bp.stop - 1);\n pxRange.push(lastBand.px.stop + xOffset);\n\n return [bpDomain, pxRange];\n}\n\n/**\n * Account for calls like createBrush('chr1:104325484-119977655')\n */\nfunction refineGenomicCoordinates(chr, from, to) {\n var nameSplit, fromToSplit;\n\n // Account for calls like createBrush('chr1:104325484-119977655')\n nameSplit = chr.split(':');\n fromToSplit = chr.split('-');\n if (nameSplit.length > 1 && fromToSplit.length > 1) {\n chr = nameSplit[0].replace('chr', '');\n fromToSplit = nameSplit[1].split('-');\n from = parseInt(fromToSplit[0]);\n to = parseInt(fromToSplit[1] - 1);\n }\n\n return [chr, from, to];\n}\n\nfunction getChrModel(chr, ideo) {\n var i, cm, chrModel;\n\n for (i = 0; i < ideo.chromosomesArray.length; i++) {\n cm = ideo.chromosomesArray[i];\n if (cm.name === chr) {\n chrModel = cm;\n return chrModel;\n }\n }\n}\n\nfunction writeBrush(chrModel, from, to, xOffset, width, ideo) {\n var x0, x1, yTranslate, yOffset;\n\n x0 = ideo.convertBpToPx(chrModel, from) + xOffset;\n x1 = ideo.convertBpToPx(chrModel, to) + xOffset;\n\n yTranslate = ideo._layout.getChromosomeSetYTranslate(0);\n yOffset = yTranslate + (ideo.config.chrWidth - width) / 2;\n\n d3.select(ideo.selector).append('g')\n .attr('class', 'brush')\n .attr('transform', 'translate(0, ' + yOffset + ')')\n .call(ideo.brush)\n .call(ideo.brush.move, [x0, x1]);\n}\n\nfunction setSelectedRegion(from, to, ideo) {\n // Genomics web UIs are 1-based, fully closed.\n // I.e. If start = 20 bp and stop = 10 bp, then extent = 11 bp.\n // Details:\n // http://genome.ucsc.edu/blog/the-ucsc-genome-browser-coordinate-counting-systems/\n // https://www.biostars.org/p/84686/\n var extent = to - from + 1;\n ideo.selectedRegion = {from: from, to: to, extent: extent};\n}\n\n/**\n * Creates a sliding window along a chromosome\n *\n * @param chr Chromosome name (e.g. 1) or range, e.g. chr1:104325484-119977655\n * @param from Genomic start coordinate in base pairs, e.g. 104325484\n * @param to Genomic end coordinate in base pairs, e.g. 119977655\n */\nfunction createBrush(chr, from, to) {\n var chrModel, chrLengthBp, bpDomain, pxRange, lastBand,\n ideo = this,\n width = ideo.config.chrWidth + 6.5,\n xOffset = ideo._layout.margin.left;\n\n [chr, from, to] = refineGenomicCoordinates(chr, from, to);\n\n chrModel = getChrModel(chr, ideo);\n\n [bpDomain, pxRange] = getBasePairDomainAndPixelRange(chrModel, xOffset);\n\n lastBand = chrModel.bands.slice(-1)[0];\n chrLengthBp = lastBand.bp.stop;\n\n if (typeof from === 'undefined') from = Math.floor(chrLengthBp / 10);\n if (typeof to === 'undefined') to = Math.ceil(from * 2);\n\n setBrush(bpDomain, pxRange, xOffset, width, ideo);\n\n setSelectedRegion(from, to, ideo);\n writeBrush(chrModel, from, to, xOffset, width, ideo);\n}\n\nexport {onBrushMove, onBrushEnd, createBrush};\n","/**\n * @fileoverview Allows a click event handler to be attached to the ideogram\n *\n * This works similar to the \"brush\" which allows a region to be selected.\n * The click handler does not allow a region, but a precise location.\n *\n */\n\nimport {d3} from './lib';\n\n/**\n * Custom event handler, fired upon clicks on the chromosome (to change\n * position)\n */\nfunction onCursorMove() {\n call(this.onCursorMoveCallback);\n}\n\nfunction setCursor(position, bpDomain, pxRange, xOffset, width, ideo) {\n var xScale;\n\n xScale = d3.scaleLinear().domain(bpDomain).range(pxRange);\n\n if (!('rotatable' in ideo.config && ideo.config.rotatable === false)) {\n console.warn('Using the cursor with rotate is not supported.');\n }\n\n var yTranslate = ideo._layout.getChromosomeSetYTranslate(0);\n var yOffset = yTranslate + (ideo.config.chrWidth - width) / 2;\n\n // TODO: check if newPosition is valid value (in range)\n\n var cursorBrush = d3.select(ideo.selector).append('g')\n .attr('class', 'brush')\n .attr('transform', 'translate(0, ' + yOffset + ')')\n .append('rect')\n .attr('class', 'cursor')\n .attr('x', xScale(position))\n .attr('y', 0)\n .attr('width', 1) // this could be a configuration param\n .attr('height', 30); // MAGIC NUMBER! need help with this one\n\n // call the callback for the first time (onLoad)\n if (ideo.onCursorMove) {\n ideo.onCursorMoveCallback(position);\n }\n\n if (!ideo.setCursorPosition) {\n ideo.setCursorPosition = function(newPosition) {\n // TODO: check if newPosition is valid value (in range)\n cursorBrush.attr('x', xScale(newPosition));\n if (ideo.onCursorMove) {\n ideo.onCursorMoveCallback(newPosition);\n }\n };\n }\n\n d3.selectAll(ideo.selector + ' .chromosome').on('click', function(event) {\n var x = event.offsetX; // minimum value seems to be 25\n\n // adjust for screen (6 is a magic number that seems to work)\n x -=6;\n\n // move the cursor\n cursorBrush.attr('x', x);\n\n // calculate the new position and perform callback\n var newPosition = Math.floor(xScale.invert(x));\n if (ideo.onCursorMove) {\n ideo.onCursorMoveCallback(newPosition);\n }\n });\n}\n\nfunction getBasePairDomainAndPixelRange(chrModel, xOffset) {\n var band, i,\n bpDomain = [1],\n pxRange = [1],\n lastBand = chrModel.bands.slice(-1)[0];\n\n for (i = 0; i < chrModel.bands.length; i++) {\n band = chrModel.bands[i];\n bpDomain.push(band.bp.start);\n pxRange.push(band.px.start + xOffset);\n }\n\n bpDomain.push(lastBand.bp.stop - 1);\n pxRange.push(lastBand.px.stop + xOffset);\n\n return [bpDomain, pxRange];\n}\n\nfunction getChrModel(chr, ideo) {\n var i, cm, chrModel;\n\n for (i = 0; i < ideo.chromosomesArray.length; i++) {\n cm = ideo.chromosomesArray[i];\n if (cm.name === chr) {\n chrModel = cm;\n return chrModel;\n }\n }\n}\n\n/**\n * Creates a clickable cursor along a chromosome.\n *\n * @param position Genomic start coordinate in base pairs, e.g. 104325484\n */\nfunction createClickCursor(position) {\n var chrModel, bpDomain,\n pxRange,\n ideo = this,\n width = ideo.config.chrWidth + 6.5, // 6.5 magic number?\n xOffset = ideo._layout.margin.left;\n\n if (typeof position === 'undefined') {\n return false;\n }\n\n chrModel = getChrModel(ideo.config.chromosome, ideo);\n [bpDomain, pxRange] = getBasePairDomainAndPixelRange(chrModel, xOffset);\n\n // call setCursor to complete the job.\n setCursor(position, bpDomain, pxRange, xOffset, width, ideo);\n}\n\nexport {onCursorMove, createClickCursor};\n","/**\n * @fileoverview Instance methods for sex chromosomes (allosomes).\n *\n * This module provides methods for drawing karyotypically normal\n * male and female mammalian genomes.\n */\n\n/**\n * Appends SVG elements depicting sex chromosomes to the document.\n */\nfunction drawSexChromosomes(container, chrIndex) {\n var bandsArray, taxid, chrs,\n sexChromosomeIndexes, sciLength,\n chromosome, bands, chrModel, sci, homologIndex;\n\n bandsArray = this.bandsArray;\n taxid = this.config.taxid;\n chrs = this.config.chromosomes[taxid];\n\n if (this.config.sex === 'male') {\n sexChromosomeIndexes = [1, 0];\n } else {\n sexChromosomeIndexes = [0, 0];\n }\n\n sciLength = sexChromosomeIndexes.length;\n\n for (homologIndex = 0; homologIndex < sciLength; homologIndex++) {\n sci = sexChromosomeIndexes[homologIndex] + chrIndex;\n chromosome = chrs[sci];\n bands = bandsArray[taxid][sci];\n chrModel = this.getChromosomeModel(bands, chromosome, taxid, sci);\n this.appendHomolog(chrModel, chrIndex, homologIndex, container);\n }\n}\n\n/**\n * Sets instance properties regarding sex chromosomes.\n * Currently only supported for mammals.\n * TODO: Support all sexually reproducing taxa\n * XY sex-determination (mammals):\n * - Male: XY <- heterogametic\n * - Female: XX\n * ZW sex-determination (birds):\n * - Male: ZZ\n * - Female: ZW <- heterogametic\n * X0 sex-determination (some insects):\n * - Male: X0, i.e. only X <- heterogametic?\n * - Female: XX\n * TODO: Support sex chromosome aneuploidies in mammals\n * - Turner syndrome: X0\n * - Klinefelter syndome: XXY\n * More types:\n * https://en.wikipedia.org/wiki/Category:Sex_chromosome_aneuploidies\n */\nfunction setSexChromosomes(chrs) {\n var chr, i,\n ideo = this,\n sexChrs = {X: 1, Y: 1};\n\n if (this.config.ploidy !== 2 || !this.config.sex) return;\n\n ideo.sexChromosomes.list = [];\n\n for (i = 0; i < chrs.length; i++) {\n chr = chrs[i];\n if (ideo.config.sex === 'male' && chr in sexChrs) {\n ideo.sexChromosomes.list.push(chr);\n if (!ideo.sexChromosomes.index) {\n ideo.sexChromosomes.index = i;\n }\n } else if (chr === 'X') {\n ideo.sexChromosomes.list.push(chr, chr);\n ideo.sexChromosomes.index = i;\n }\n }\n}\n\nexport {drawSexChromosomes, setSexChromosomes};\n","/**\n * @fileoverview Methods to convert to and from different types of coordinates.\n *\n * Ideogram.js uses multiple coordinate systems, e.g. base pairs (bp) and\n * pixels (px). These methods interconvert between those coordinate systems.\n *\n * TODO:\n * - Add methods to interconvert between ISCN coordinates and base pairs,\n * pixels.\n */\n\nfunction throwBpToPxError(bp, chr, band) {\n throw new Error(\n 'Base pair out of range. ' +\n 'bp: ' + bp + '; length of chr' + chr.name + ': ' + band.bp.stop\n );\n}\n\nfunction getPx(chr, bp) {\n var i, px, band, bpToIscnScale, iscn, iscnStart, iscnStop, iscnLength,\n bpStart, bpStop, bpLength, pxStart, pxLength;\n\n for (i = 0; i < chr.bands.length; i++) {\n band = chr.bands[i];\n bpStart = band.bp.start;\n bpStop = band.bp.stop;\n bpLength = bpStop - bpStart;\n iscnStart = band.iscn.start;\n iscnStop = band.iscn.stop;\n iscnLength = iscnStop - iscnStart;\n pxStart = band.px.start;\n pxLength = band.px.width;\n\n if (bp >= bpStart && bp <= bpStop) {\n bpToIscnScale = iscnLength / bpLength;\n iscn = iscnStart + (bp - bpStart) * bpToIscnScale;\n px = pxStart + (pxLength * (iscn - iscnStart) / (iscnLength));\n\n return [px, band];\n }\n }\n return [null, band];\n}\n\n/**\n * Converts base pair coordinates to pixel offsets.\n * Bp-to-pixel scales differ among cytogenetic bands.\n *\n * For example, if we want to depict a gene on a chromosome, then we need\n * to convert the gene's location in base pairs to a location in pixels offset\n * from the start of the chromosome.\n */\nfunction convertBpToPx(chr, bp) {\n var band, px;\n\n if (chr.bands.length > 1 || chr.name === 'MT') {\n [px, band] = getPx(chr, bp);\n if (px !== null) return px;\n } else if (bp >= 1 && bp <= chr.length) {\n px = chr.scale.bp * bp;\n return px;\n }\n\n throwBpToPxError(bp, chr, band);\n}\n\nfunction throwPxToBpError(px, chr, pxStop) {\n throw new Error(\n 'Pixel out of range. ' +\n 'px: ' + px + '; length of chr' + chr.name + ': ' + pxStop\n );\n}\n\nfunction getBp(iscnStop, iscnStart, px, pxStop, pxStart, band, iscnLength) {\n var pxLength, bpLength, pxToIscnScale, iscn, bp;\n\n iscnLength = iscnStop - iscnStart;\n pxLength = pxStop - pxStart;\n bpLength = band.bp.stop - band.bp.start;\n\n pxToIscnScale = iscnLength / pxLength;\n iscn = iscnStart + (px - pxStart) * pxToIscnScale;\n\n bp = band.bp.start + (bpLength * (iscn - iscnStart) / iscnLength);\n\n return Math.round(bp);\n}\n\n/**\n * Converts pixel offsets to base pair coordinates.\n * Pixel-to-bp scales differ among cytogenetic bands.\n *\n * For example, if we want to determine the genomic location a user clicked on\n * (e.g. when creating a brush / sliding window region), then we need to\n * convert pixels to base pairs.\n */\nfunction convertPxToBp(chr, px) {\n var i, band, bp, pxStart, pxStop, iscnStart, iscnStop, iscnLength;\n\n if (px === 0) {\n px = chr.bands[0].px.start;\n }\n\n for (i = 0; i < chr.bands.length; i++) {\n band = chr.bands[i];\n\n pxStart = band.px.start;\n pxStop = band.px.stop;\n iscnStart = band.iscn.start;\n iscnStop = band.iscn.stop;\n\n if (px >= pxStart && px <= pxStop) {\n bp = getBp(iscnStop, iscnStart, px, pxStop, pxStart, band, iscnLength);\n return bp;\n }\n }\n throwPxToBpError(px, chr, pxStop);\n}\n\nexport {convertBpToPx, convertPxToBp};\n","let array8 = arrayUntyped,\n array16 = arrayUntyped,\n array32 = arrayUntyped,\n arrayLengthen = arrayLengthenUntyped,\n arrayWiden = arrayWidenUntyped;\nif (typeof Uint8Array !== \"undefined\") {\n array8 = function(n) { return new Uint8Array(n); };\n array16 = function(n) { return new Uint16Array(n); };\n array32 = function(n) { return new Uint32Array(n); };\n\n arrayLengthen = function(array, length) {\n if (array.length >= length) return array;\n var copy = new array.constructor(length);\n copy.set(array);\n return copy;\n };\n\n arrayWiden = function(array, width) {\n var copy;\n switch (width) {\n case 16: copy = array16(array.length); break;\n case 32: copy = array32(array.length); break;\n default: throw new Error(\"invalid array width!\");\n }\n copy.set(array);\n return copy;\n };\n}\n\nfunction arrayUntyped(n) {\n var array = new Array(n), i = -1;\n while (++i < n) array[i] = 0;\n return array;\n}\n\nfunction arrayLengthenUntyped(array, length) {\n var n = array.length;\n while (n < length) array[n++] = 0;\n return array;\n}\n\nfunction arrayWidenUntyped(array, width) {\n if (width > 32) throw new Error(\"invalid array width!\");\n return array;\n}\n\n// An arbitrarily-wide array of bitmasks\nfunction bitarray(n) {\n this.length = n;\n this.subarrays = 1;\n this.width = 8;\n this.masks = {\n 0: 0\n }\n\n this[0] = array8(n);\n}\n\nbitarray.prototype.lengthen = function(n) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n this[i] = arrayLengthen(this[i], n);\n }\n this.length = n;\n};\n\n// Reserve a new bit index in the array, returns {offset, one}\nbitarray.prototype.add = function() {\n var m, w, one, i, len;\n\n for (i = 0, len = this.subarrays; i < len; ++i) {\n m = this.masks[i];\n w = this.width - (32 * i);\n // isolate the rightmost zero bit and return it as an unsigned int of 32 bits, if NaN or -1, return a 0 \n one = (~m & (m + 1)) >>> 0;\n\n if (w >= 32 && !one) {\n continue;\n }\n\n if (w < 32 && (one & (1 << w))) {\n // widen this subarray\n this[i] = arrayWiden(this[i], w <<= 1);\n this.width = 32 * i + w;\n }\n\n this.masks[i] |= one;\n\n return {\n offset: i,\n one: one\n };\n }\n\n // add a new subarray\n this[this.subarrays] = array8(this.length);\n this.masks[this.subarrays] = 1;\n this.width += 8;\n return {\n offset: this.subarrays++,\n one: 1\n };\n};\n\n// Copy record from index src to index dest\nbitarray.prototype.copy = function(dest, src) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n this[i][dest] = this[i][src];\n }\n};\n\n// Truncate the array to the given length\nbitarray.prototype.truncate = function(n) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n for (var j = this.length - 1; j >= n; j--) {\n this[i][j] = 0;\n }\n }\n this.length = n;\n};\n\n// Checks that all bits for the given index are 0\nbitarray.prototype.zero = function(n) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n if (this[i][n]) {\n return false;\n }\n }\n return true;\n};\n\n// Checks that all bits for the given index are 0 except for possibly one\nbitarray.prototype.zeroExcept = function(n, offset, zero) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n if (i === offset ? this[i][n] & zero : this[i][n]) {\n return false;\n }\n }\n return true;\n};\n\n// Checks that all bits for the given index are 0 except for the specified mask.\n// The mask should be an array of the same size as the filter subarrays width.\nbitarray.prototype.zeroExceptMask = function(n, mask) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n if (this[i][n] & mask[i]) {\n return false;\n }\n }\n return true;\n}\n\n// Checks that only the specified bit is set for the given index\nbitarray.prototype.only = function(n, offset, one) {\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n if (this[i][n] != (i === offset ? one : 0)) {\n return false;\n }\n }\n return true;\n};\n\n// Checks that only the specified bit is set for the given index except for possibly one other\nbitarray.prototype.onlyExcept = function(n, offset, zero, onlyOffset, onlyOne) {\n var mask;\n var i, len;\n for (i = 0, len = this.subarrays; i < len; ++i) {\n mask = this[i][n];\n if (i === offset)\n mask &= zero;\n if (mask != (i === onlyOffset ? onlyOne : 0)) {\n return false;\n }\n }\n return true;\n};\n\nexport default {\n array8: arrayUntyped,\n array16: arrayUntyped,\n array32: arrayUntyped,\n arrayLengthen: arrayLengthenUntyped,\n arrayWiden: arrayWidenUntyped,\n bitarray: bitarray\n};\n","const filterExact = (bisect, value) => {\n return function(values) {\n var n = values.length;\n return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];\n };\n}\n\nconst filterRange = (bisect, range) => {\n var min = range[0],\n max = range[1];\n return function(values) {\n var n = values.length;\n return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];\n };\n}\n\nconst filterAll = values => {\n return [0, values.length];\n}\n\nexport default {\n filterExact,\n filterRange,\n filterAll\n};\n","export default d => {\n return d;\n};\n","export default () => {\n return null;\n}\n","export default () => {\n return 0;\n}\n","import identity from './identity';\n\nfunction heap_by(f) {\n\n // Builds a binary heap within the specified array a[lo:hi]. The heap has the\n // property such that the parent a[lo+i] is always less than or equal to its\n // two children: a[lo+2*i+1] and a[lo+2*i+2].\n function heap(a, lo, hi) {\n var n = hi - lo,\n i = (n >>> 1) + 1;\n while (--i > 0) sift(a, i, n, lo);\n return a;\n }\n\n // Sorts the specified array a[lo:hi] in descending order, assuming it is\n // already a heap.\n function sort(a, lo, hi) {\n var n = hi - lo,\n t;\n while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);\n return a;\n }\n\n // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous\n // slice of array a[lo:lo+n]. This method can also be used to update the heap\n // incrementally, without incurring the full cost of reconstructing the heap.\n function sift(a, i, n, lo) {\n var d = a[--lo + i],\n x = f(d),\n child;\n while ((child = i << 1) <= n) {\n if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;\n if (x <= f(a[lo + child])) break;\n a[lo + i] = a[lo + child];\n i = child;\n }\n a[lo + i] = d;\n }\n\n heap.sort = sort;\n return heap;\n}\n\nconst h = heap_by(identity);\nh.by = heap_by;\n\nexport default h;\n","import identity from './identity';\nimport xFilterHeap from './heap';\n\nfunction heapselect_by(f) {\n var heap = xFilterHeap.by(f);\n\n // Returns a new array containing the top k elements in the array a[lo:hi].\n // The returned array is not sorted, but maintains the heap property. If k is\n // greater than hi - lo, then fewer than k elements will be returned. The\n // order of elements in a is unchanged by this operation.\n function heapselect(a, lo, hi, k) {\n var queue = new Array(k = Math.min(hi - lo, k)),\n min,\n i,\n d;\n\n for (i = 0; i < k; ++i) queue[i] = a[lo++];\n heap(queue, 0, k);\n\n if (lo < hi) {\n min = f(queue[0]);\n do {\n if (f(d = a[lo]) > min) {\n queue[0] = d;\n min = f(heap(queue, 0, k)[0]);\n }\n } while (++lo < hi);\n }\n\n return queue;\n }\n\n return heapselect;\n}\n\n\nconst h = heapselect_by(identity);\nh.by = heapselect_by; // assign the raw function to the export as well\n\nexport default h;\n","import identity from './identity';\n\nfunction bisect_by(f) {\n\n // Locate the insertion point for x in a to maintain sorted order. The\n // arguments lo and hi may be used to specify a subset of the array which\n // should be considered; by default the entire array is used. If x is already\n // present in a, the insertion point will be before (to the left of) any\n // existing entries. The return value is suitable for use as the first\n // argument to `array.splice` assuming that a is already sorted.\n //\n // The returned insertion point i partitions the array a into two halves so\n // that all v < x for v in a[lo:i] for the left side and all v >= x for v in\n // a[i:hi] for the right side.\n function bisectLeft(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (f(a[mid]) < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n // Similar to bisectLeft, but returns an insertion point which comes after (to\n // the right of) any existing entries of x in a.\n //\n // The returned insertion point i partitions the array into two halves so that\n // all v <= x for v in a[lo:i] for the left side and all v > x for v in\n // a[i:hi] for the right side.\n function bisectRight(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (x < f(a[mid])) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n bisectRight.right = bisectRight;\n bisectRight.left = bisectLeft;\n return bisectRight;\n}\n\nconst bisect = bisect_by(identity);\nbisect.by = bisect_by; // assign the raw function to the export as well\n\nexport default bisect;\n\n","export default (array, index, deep) => {\n for (var i = 0, n = index.length, copy = deep ? JSON.parse(JSON.stringify(array)) : new Array(n); i < n; ++i) {\n copy[i] = array[index[i]];\n }\n return copy;\n}\n","const reduceIncrement = p => {\n return p + 1;\n}\n\nconst reduceDecrement = p => {\n return p - 1;\n}\n\nconst reduceAdd = f => {\n return function(p, v) {\n return p + +f(v);\n };\n}\n\nconst reduceSubtract = f => {\n return function(p, v) {\n return p - f(v);\n };\n}\n\nexport default {\n reduceIncrement,\n reduceDecrement,\n reduceAdd,\n reduceSubtract\n};\n","import deep from \"@ranfdev/deepobj\"\n// Note(cg): result was previsouly using lodash.result, not ESM compatible.\n \nconst get = (obj, prop) => {\n const value = obj[prop];\n return (typeof value === 'function') ? value.call(obj) : value;\n}\n\n/**\n * get value of object at a deep path.\n * if the resolved value is a function,\n * it's invoked with the `this` binding of \n * its parent object and its result is returned. \n * \n * @param {Object} obj the object (e.g. { 'a': [{ 'b': { 'c1': 3, 'c2': 4} }], 'd': {e:1} }; )\n * @param {String} path deep path (e.g. `d.e`` or `a[0].b.c1`. Dot notation (a.0.b)is also supported)\n * @return {Any} the resolved value\n */\nconst reg = /\\[([\\w\\d]+)\\]/g;\nexport default (obj, path) => {\n return deep(get, obj, path.replace(reg, '.$1'))\n}\n","import xfilterArray from './array';\nimport xfilterFilter from './filter';\nimport cr_identity from './identity';\nimport cr_null from './null';\nimport cr_zero from './zero';\nimport xfilterHeapselect from './heapselect';\nimport xfilterHeap from './heap';\nimport bisect from './bisect';\nimport permute from './permute';\nimport xfilterReduce from './reduce';\nimport result from './result';\n\n// constants\nvar REMOVED_INDEX = -1;\n\ncrossfilter.heap = xfilterHeap;\ncrossfilter.heapselect = xfilterHeapselect;\ncrossfilter.bisect = bisect;\ncrossfilter.permute = permute;\nexport default crossfilter;\n\nfunction crossfilter() {\n var crossfilter = {\n add: add,\n remove: removeData,\n dimension: dimension,\n groupAll: groupAll,\n size: size,\n all: all,\n allFiltered: allFiltered,\n onChange: onChange,\n isElementFiltered: isElementFiltered\n };\n\n var data = [], // the records\n n = 0, // the number of records; data.length\n filters, // 1 is filtered out\n filterListeners = [], // when the filters change\n dataListeners = [], // when data is added\n removeDataListeners = [], // when data is removed\n callbacks = [];\n\n filters = new xfilterArray.bitarray(0);\n\n // Adds the specified new records to this crossfilter.\n function add(newData) {\n var n0 = n,\n n1 = newData.length;\n\n // If there's actually new data to add…\n // Merge the new data into the existing data.\n // Lengthen the filter bitset to handle the new records.\n // Notify listeners (dimensions and groups) that new data is available.\n if (n1) {\n data = data.concat(newData);\n filters.lengthen(n += n1);\n dataListeners.forEach(function(l) { l(newData, n0, n1); });\n triggerOnChange('dataAdded');\n }\n\n return crossfilter;\n }\n\n // Removes all records that match the current filters, or if a predicate function is passed,\n // removes all records matching the predicate (ignoring filters).\n function removeData(predicate) {\n var // Mapping from old record indexes to new indexes (after records removed)\n newIndex = new Array(n),\n removed = [],\n usePred = typeof predicate === 'function',\n shouldRemove = function (i) {\n return usePred ? predicate(data[i], i) : filters.zero(i)\n };\n\n for (var index1 = 0, index2 = 0; index1 < n; ++index1) {\n if ( shouldRemove(index1) ) {\n removed.push(index1);\n newIndex[index1] = REMOVED_INDEX;\n } else {\n newIndex[index1] = index2++;\n }\n }\n\n // Remove all matching records from groups.\n filterListeners.forEach(function(l) { l(-1, -1, [], removed, true); });\n\n // Update indexes.\n removeDataListeners.forEach(function(l) { l(newIndex); });\n\n // Remove old filters and data by overwriting.\n for (var index3 = 0, index4 = 0; index3 < n; ++index3) {\n if ( newIndex[index3] !== REMOVED_INDEX ) {\n if (index3 !== index4) filters.copy(index4, index3), data[index4] = data[index3];\n ++index4;\n }\n }\n\n data.length = n = index4;\n filters.truncate(index4);\n triggerOnChange('dataRemoved');\n }\n\n function maskForDimensions(dimensions) {\n var n,\n d,\n len,\n id,\n mask = Array(filters.subarrays);\n for (n = 0; n < filters.subarrays; n++) { mask[n] = ~0; }\n for (d = 0, len = dimensions.length; d < len; d++) {\n // The top bits of the ID are the subarray offset and the lower bits are the bit\n // offset of the \"one\" mask.\n id = dimensions[d].id();\n mask[id >> 7] &= ~(0x1 << (id & 0x3f));\n }\n return mask;\n }\n\n // Return true if the data element at index i is filtered IN.\n // Optionally, ignore the filters of any dimensions in the ignore_dimensions list.\n function isElementFiltered(i, ignore_dimensions) {\n var mask = maskForDimensions(ignore_dimensions || []);\n return filters.zeroExceptMask(i,mask);\n }\n\n // Adds a new dimension with the specified value accessor function.\n function dimension(value, iterable) {\n\n if (typeof value === 'string') {\n var accessorPath = value;\n value = function(d) { return result(d, accessorPath); };\n }\n\n var dimension = {\n filter: filter,\n filterExact: filterExact,\n filterRange: filterRange,\n filterFunction: filterFunction,\n filterAll: filterAll,\n currentFilter: currentFilter,\n hasCurrentFilter: hasCurrentFilter,\n top: top,\n bottom: bottom,\n group: group,\n groupAll: groupAll,\n dispose: dispose,\n remove: dispose, // for backwards-compatibility\n accessor: value,\n id: function() { return id; }\n };\n\n var one, // lowest unset bit as mask, e.g., 00001000\n zero, // inverted one, e.g., 11110111\n offset, // offset into the filters arrays\n id, // unique ID for this dimension (reused when dimensions are disposed)\n values, // sorted, cached array\n index, // maps sorted value index -> record index (in data)\n newValues, // temporary array storing newly-added values\n newIndex, // temporary array storing newly-added index\n iterablesIndexCount,\n iterablesIndexFilterStatus,\n iterablesEmptyRows = [],\n sortRange = function(n) {\n return cr_range(n).sort(function(A, B) {\n var a = newValues[A], b = newValues[B];\n return a < b ? -1 : a > b ? 1 : A - B;\n });\n },\n refilter = xfilterFilter.filterAll, // for recomputing filter\n refilterFunction, // the custom filter function in use\n filterValue, // the value used for filtering (value, array, function or undefined)\n filterValuePresent, // true if filterValue contains something\n indexListeners = [], // when data is added\n dimensionGroups = [],\n lo0 = 0,\n hi0 = 0,\n t = 0,\n k;\n\n // Updating a dimension is a two-stage process. First, we must update the\n // associated filters for the newly-added records. Once all dimensions have\n // updated their filters, the groups are notified to update.\n dataListeners.unshift(preAdd);\n dataListeners.push(postAdd);\n\n removeDataListeners.push(removeData);\n\n // Add a new dimension in the filter bitmap and store the offset and bitmask.\n var tmp = filters.add();\n offset = tmp.offset;\n one = tmp.one;\n zero = ~one;\n\n // Create a unique ID for the dimension\n // IDs will be re-used if dimensions are disposed.\n // For internal use the ID is the subarray offset shifted left 7 bits or'd with the\n // bit offset of the set bit in the dimension's \"one\" mask.\n id = (offset << 7) | (Math.log(one) / Math.log(2));\n\n preAdd(data, 0, n);\n postAdd(data, 0, n);\n\n // Incorporates the specified new records into this dimension.\n // This function is responsible for updating filters, values, and index.\n function preAdd(newData, n0, n1) {\n var newIterablesIndexCount,\n newIterablesIndexFilterStatus;\n\n if (iterable){\n // Count all the values\n t = 0;\n j = 0;\n k = [];\n\n for (var i0 = 0; i0 < newData.length; i0++) {\n for(j = 0, k = value(newData[i0]); j < k.length; j++) {\n t++;\n }\n }\n\n newValues = [];\n newIterablesIndexCount = cr_range(newData.length);\n newIterablesIndexFilterStatus = cr_index(t,1);\n var unsortedIndex = cr_range(t);\n\n for (var l = 0, index1 = 0; index1 < newData.length; index1++) {\n k = value(newData[index1])\n //\n if(!k.length){\n newIterablesIndexCount[index1] = 0;\n iterablesEmptyRows.push(index1 + n0);\n continue;\n }\n newIterablesIndexCount[index1] = k.length\n for (j = 0; j < k.length; j++) {\n newValues.push(k[j]);\n unsortedIndex[l] = index1;\n l++;\n }\n }\n\n // Create the Sort map used to sort both the values and the valueToData indices\n var sortMap = sortRange(t);\n\n // Use the sortMap to sort the newValues\n newValues = permute(newValues, sortMap);\n\n\n // Use the sortMap to sort the unsortedIndex map\n // newIndex should be a map of sortedValue -> crossfilterData\n newIndex = permute(unsortedIndex, sortMap)\n\n } else{\n // Permute new values into natural order using a standard sorted index.\n newValues = newData.map(value);\n newIndex = sortRange(n1);\n newValues = permute(newValues, newIndex);\n }\n\n // Bisect newValues to determine which new records are selected.\n var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1];\n\n var index2, index3, index4;\n if(iterable) {\n n1 = t;\n if (refilterFunction) {\n for (index2 = 0; index2 < n1; ++index2) {\n if (!refilterFunction(newValues[index2], index2)) {\n if(--newIterablesIndexCount[newIndex[index2]] === 0) {\n filters[offset][newIndex[index2] + n0] |= one;\n }\n newIterablesIndexFilterStatus[index2] = 1;\n }\n }\n } else {\n for (index3 = 0; index3 < lo1; ++index3) {\n if(--newIterablesIndexCount[newIndex[index3]] === 0) {\n filters[offset][newIndex[index3] + n0] |= one;\n }\n newIterablesIndexFilterStatus[index3] = 1;\n }\n for (index4 = hi1; index4 < n1; ++index4) {\n if(--newIterablesIndexCount[newIndex[index4]] === 0) {\n filters[offset][newIndex[index4] + n0] |= one;\n }\n newIterablesIndexFilterStatus[index4] = 1;\n }\n }\n } else {\n if (refilterFunction) {\n for (index2 = 0; index2 < n1; ++index2) {\n if (!refilterFunction(newValues[index2], index2)) {\n filters[offset][newIndex[index2] + n0] |= one;\n }\n }\n } else {\n for (index3 = 0; index3 < lo1; ++index3) {\n filters[offset][newIndex[index3] + n0] |= one;\n }\n for (index4 = hi1; index4 < n1; ++index4) {\n filters[offset][newIndex[index4] + n0] |= one;\n }\n }\n }\n\n // If this dimension previously had no data, then we don't need to do the\n // more expensive merge operation; use the new values and index as-is.\n if (!n0) {\n values = newValues;\n index = newIndex;\n iterablesIndexCount = newIterablesIndexCount;\n iterablesIndexFilterStatus = newIterablesIndexFilterStatus;\n lo0 = lo1;\n hi0 = hi1;\n return;\n }\n\n\n\n var oldValues = values,\n oldIndex = index,\n oldIterablesIndexFilterStatus = iterablesIndexFilterStatus,\n old_n0,\n i1 = 0;\n\n i0 = 0;\n\n if(iterable){\n old_n0 = n0\n n0 = oldValues.length;\n n1 = t\n }\n\n // Otherwise, create new arrays into which to merge new and old.\n values = iterable ? new Array(n0 + n1) : new Array(n);\n index = iterable ? new Array(n0 + n1) : cr_index(n, n);\n if(iterable) iterablesIndexFilterStatus = cr_index(n0 + n1, 1);\n\n // Concatenate the newIterablesIndexCount onto the old one.\n if(iterable) {\n var oldiiclength = iterablesIndexCount.length;\n iterablesIndexCount = xfilterArray.arrayLengthen(iterablesIndexCount, n);\n for(var j=0; j+oldiiclength < n; j++) {\n iterablesIndexCount[j+oldiiclength] = newIterablesIndexCount[j];\n }\n }\n\n // Merge the old and new sorted values, and old and new index.\n var index5 = 0;\n for (; i0 < n0 && i1 < n1; ++index5) {\n if (oldValues[i0] < newValues[i1]) {\n values[index5] = oldValues[i0];\n if(iterable) iterablesIndexFilterStatus[index5] = oldIterablesIndexFilterStatus[i0];\n index[index5] = oldIndex[i0++];\n } else {\n values[index5] = newValues[i1];\n if(iterable) iterablesIndexFilterStatus[index5] = newIterablesIndexFilterStatus[i1];\n index[index5] = newIndex[i1++] + (iterable ? old_n0 : n0);\n }\n }\n\n // Add any remaining old values.\n for (; i0 < n0; ++i0, ++index5) {\n values[index5] = oldValues[i0];\n if(iterable) iterablesIndexFilterStatus[index5] = oldIterablesIndexFilterStatus[i0];\n index[index5] = oldIndex[i0];\n }\n\n // Add any remaining new values.\n for (; i1 < n1; ++i1, ++index5) {\n values[index5] = newValues[i1];\n if(iterable) iterablesIndexFilterStatus[index5] = newIterablesIndexFilterStatus[i1];\n index[index5] = newIndex[i1] + (iterable ? old_n0 : n0);\n }\n\n // Bisect again to recompute lo0 and hi0.\n bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];\n }\n\n // When all filters have updated, notify index listeners of the new values.\n function postAdd(newData, n0, n1) {\n indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });\n newValues = newIndex = null;\n }\n\n function removeData(reIndex) {\n if (iterable) {\n for (var i0 = 0, i1 = 0; i0 < iterablesEmptyRows.length; i0++) {\n if (reIndex[iterablesEmptyRows[i0]] !== REMOVED_INDEX) {\n iterablesEmptyRows[i1] = reIndex[iterablesEmptyRows[i0]];\n i1++;\n }\n }\n iterablesEmptyRows.length = i1;\n for (i0 = 0, i1 = 0; i0 < n; i0++) {\n if (reIndex[i0] !== REMOVED_INDEX) {\n if (i1 !== i0) iterablesIndexCount[i1] = iterablesIndexCount[i0];\n i1++;\n }\n }\n iterablesIndexCount = iterablesIndexCount.slice(0, i1);\n }\n // Rewrite our index, overwriting removed values\n var n0 = values.length;\n for (var i = 0, j = 0, oldDataIndex; i < n0; ++i) {\n oldDataIndex = index[i];\n if (reIndex[oldDataIndex] !== REMOVED_INDEX) {\n if (i !== j) values[j] = values[i];\n index[j] = reIndex[oldDataIndex];\n if (iterable) {\n iterablesIndexFilterStatus[j] = iterablesIndexFilterStatus[i];\n }\n ++j;\n }\n }\n values.length = j;\n if (iterable) iterablesIndexFilterStatus = iterablesIndexFilterStatus.slice(0, j);\n while (j < n0) index[j++] = 0;\n\n // Bisect again to recompute lo0 and hi0.\n var bounds = refilter(values);\n lo0 = bounds[0], hi0 = bounds[1];\n }\n\n // Updates the selected values based on the specified bounds [lo, hi].\n // This implementation is used by all the public filter methods.\n function filterIndexBounds(bounds) {\n\n var lo1 = bounds[0],\n hi1 = bounds[1];\n\n if (refilterFunction) {\n refilterFunction = null;\n filterIndexFunction(function(d, i) { return lo1 <= i && i < hi1; }, bounds[0] === 0 && bounds[1] === values.length);\n lo0 = lo1;\n hi0 = hi1;\n return dimension;\n }\n\n var i,\n j,\n k,\n added = [],\n removed = [],\n valueIndexAdded = [],\n valueIndexRemoved = [];\n\n\n // Fast incremental update based on previous lo index.\n if (lo1 < lo0) {\n for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {\n added.push(index[i]);\n valueIndexAdded.push(i);\n }\n } else if (lo1 > lo0) {\n for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {\n removed.push(index[i]);\n valueIndexRemoved.push(i);\n }\n }\n\n // Fast incremental update based on previous hi index.\n if (hi1 > hi0) {\n for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {\n added.push(index[i]);\n valueIndexAdded.push(i);\n }\n } else if (hi1 < hi0) {\n for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {\n removed.push(index[i]);\n valueIndexRemoved.push(i);\n }\n }\n\n if(!iterable) {\n // Flip filters normally.\n\n for(i=0; i 0) toSkip = top_offset;\n\n while (--i >= lo0 && k > 0) {\n if (filters.zero(j = index[i])) {\n if(toSkip > 0) {\n //skip matching row\n --toSkip;\n } else {\n array.push(data[j]);\n --k;\n }\n }\n }\n\n if(iterable){\n for(i = 0; i < iterablesEmptyRows.length && k > 0; i++) {\n // Add row with empty iterable column at the end\n if(filters.zero(j = iterablesEmptyRows[i])) {\n if(toSkip > 0) {\n //skip matching row\n --toSkip;\n } else {\n array.push(data[j]);\n --k;\n }\n }\n }\n }\n\n return array;\n }\n\n // Returns the bottom K selected records based on this dimension's order.\n // Note: observes this dimension's filter, unlike group and groupAll.\n function bottom(k, bottom_offset) {\n var array = [],\n i,\n j,\n toSkip = 0;\n\n if(bottom_offset && bottom_offset > 0) toSkip = bottom_offset;\n\n if(iterable) {\n // Add row with empty iterable column at the top\n for(i = 0; i < iterablesEmptyRows.length && k > 0; i++) {\n if(filters.zero(j = iterablesEmptyRows[i])) {\n if(toSkip > 0) {\n //skip matching row\n --toSkip;\n } else {\n array.push(data[j]);\n --k;\n }\n }\n }\n }\n\n i = lo0;\n\n while (i < hi0 && k > 0) {\n if (filters.zero(j = index[i])) {\n if(toSkip > 0) {\n //skip matching row\n --toSkip;\n } else {\n array.push(data[j]);\n --k;\n }\n }\n i++;\n }\n\n return array;\n }\n\n // Adds a new group to this dimension, using the specified key function.\n function group(key) {\n var group = {\n top: top,\n all: all,\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n order: order,\n orderNatural: orderNatural,\n size: size,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n // Ensure that this group will be removed when the dimension is removed.\n dimensionGroups.push(group);\n\n var groups, // array of {key, value}\n groupIndex, // object id ↦ group id\n groupWidth = 8,\n groupCapacity = capacity(groupWidth),\n k = 0, // cardinality\n select,\n heap,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n update = cr_null,\n reset = cr_null,\n resetNeeded = true,\n groupAll = key === cr_null,\n n0old;\n\n if (arguments.length < 1) key = cr_identity;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the associated reduce values. It must also listen to\n // the parent dimension for when data is added, and compute new keys.\n filterListeners.push(update);\n indexListeners.push(add);\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into the grouping.\n add(values, index, 0, n);\n\n // Incorporates the specified new values into this group.\n // This function is responsible for updating groups and groupIndex.\n function add(newValues, newIndex, n0, n1) {\n\n if(iterable) {\n n0old = n0\n n0 = values.length - newValues.length\n n1 = newValues.length;\n }\n\n var oldGroups = groups,\n reIndex = iterable ? [] : cr_index(k, groupCapacity),\n add = reduceAdd,\n remove = reduceRemove,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = cr_null;\n if (resetNeeded) remove = initial = cr_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n if(iterable){\n groupIndex = k0 ? groupIndex : [];\n }\n else{\n groupIndex = k0 > 1 ? xfilterArray.arrayLengthen(groupIndex, n) : cr_index(n, groupCapacity);\n }\n\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1), skipping NaN keys.\n while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n g0 = oldGroups[++i0];\n if (g0) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n\n while (x1 <= x) {\n j = newIndex[i1] + (iterable ? n0old : n0)\n\n\n if(iterable){\n if(groupIndex[j]){\n groupIndex[j].push(k)\n }\n else{\n groupIndex[j] = [k]\n }\n }\n else{\n groupIndex[j] = k;\n }\n\n // Always add new values to groups. Only remove when not in filter.\n // This gives groups full information on data life-cycle.\n g.value = add(g.value, data[j], true);\n if (!filters.zeroExcept(j, offset, zero)) g.value = remove(g.value, data[j], false);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater th1an all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n\n // Fill in gaps with empty arrays where there may have been rows with empty iterables\n if(iterable){\n for (var index1 = 0; index1 < n; index1++) {\n if(!groupIndex[index1]){\n groupIndex[index1] = [];\n }\n }\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if(k > i0){\n if(iterable){\n for (i0 = 0; i0 < n0old; ++i0) {\n for (index1 = 0; index1 < groupIndex[i0].length; index1++) {\n groupIndex[i0][index1] = reIndex[groupIndex[i0][index1]];\n }\n }\n }\n else{\n for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n }\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1 || iterable) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (!k && groupAll) {\n k = 1;\n groups = [{key: null, value: initial()}];\n }\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = cr_null;\n reset = cr_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if(iterable){\n k++\n return\n }\n if (++k === groupCapacity) {\n reIndex = xfilterArray.arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = xfilterArray.arrayWiden(groupIndex, groupWidth);\n groupCapacity = capacity(groupWidth);\n }\n }\n }\n\n function removeData(reIndex) {\n if (k > 1 || iterable) {\n var oldK = k,\n oldGroups = groups,\n seenGroups = cr_index(oldK, oldK),\n i,\n i0,\n j;\n\n // Filter out non-matches by copying matching group index entries to\n // the beginning of the array.\n if (!iterable) {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n seenGroups[groupIndex[j] = groupIndex[i]] = 1;\n ++j;\n }\n }\n } else {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n groupIndex[j] = groupIndex[i];\n for (i0 = 0; i0 < groupIndex[j].length; i0++) {\n seenGroups[groupIndex[j][i0]] = 1;\n }\n ++j;\n }\n }\n }\n\n // Reassemble groups including only those groups that were referred\n // to by matching group index entries. Note the new group index in\n // seenGroups.\n groups = [], k = 0;\n for (i = 0; i < oldK; ++i) {\n if (seenGroups[i]) {\n seenGroups[i] = k++;\n groups.push(oldGroups[i]);\n }\n }\n\n if (k > 1 || iterable) {\n // Reindex the group index using seenGroups to find the new index.\n if (!iterable) {\n for (i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];\n } else {\n for (i = 0; i < j; ++i) {\n for (i0 = 0; i0 < groupIndex[i].length; ++i0) {\n groupIndex[i][i0] = seenGroups[groupIndex[i][i0]];\n }\n }\n }\n } else {\n groupIndex = null;\n }\n filterListeners[filterListeners.indexOf(update)] = k > 1 || iterable\n ? (reset = resetMany, update = updateMany)\n : k === 1 ? (reset = resetOne, update = updateOne)\n : reset = update = cr_null;\n } else if (k === 1) {\n if (groupAll) return;\n for (var index3 = 0; index3 < n; ++index3) if (reIndex[index3] !== REMOVED_INDEX) return;\n groups = [], k = 0;\n filterListeners[filterListeners.indexOf(update)] =\n update = reset = cr_null;\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is greater than 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateMany(filterOne, filterOffset, added, removed, notFilter) {\n\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n j,\n k,\n n,\n g;\n\n if(iterable){\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceAdd(g.value, data[k], false, j);\n }\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceRemove(g.value, data[k], notFilter, j);\n }\n }\n }\n return;\n }\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g = groups[groupIndex[k]];\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g = groups[groupIndex[k]];\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateOne(filterOne, filterOffset, added, removed, notFilter) {\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n k,\n n,\n g = groups[0];\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is greater than 1.\n function resetMany() {\n var i,\n j,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n if(iterable){\n for (i = 0; i < n; ++i) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceAdd(g.value, data[i], true, j);\n }\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceRemove(g.value, data[i], false, j);\n }\n }\n }\n return;\n }\n\n for (i = 0; i < n; ++i) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i], true);\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is 1.\n function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n for (i = 0; i < n; ++i) {\n g.value = reduceAdd(g.value, data[i], true);\n }\n\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Returns the array of group values, in the dimension's natural order.\n function all() {\n if (resetNeeded) reset(), resetNeeded = false;\n return groups;\n }\n\n // Returns a new array containing the top K group values, in reduce order.\n function top(k) {\n var top = select(all(), 0, groups.length, k);\n return heap.sort(top, 0, top.length);\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce values, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, cr_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), cr_zero);\n }\n\n // Sets the reduce order, using the specified accessor.\n function order(value) {\n select = xfilterHeapselect.by(valueOf);\n heap = xfilterHeap.by(valueOf);\n function valueOf(d) { return value(d.value); }\n return group;\n }\n\n // A convenience method for natural ordering by reduce value.\n function orderNatural() {\n return order(cr_identity);\n }\n\n // Returns the cardinality of this group, irrespective of any filters.\n function size() {\n return k;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = indexListeners.indexOf(add);\n if (i >= 0) indexListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n i = dimensionGroups.indexOf(group);\n if (i >= 0) dimensionGroups.splice(i, 1);\n return group;\n }\n\n return reduceCount().orderNatural();\n }\n\n // A convenience function for generating a singleton group.\n function groupAll() {\n var g = group(cr_null), all = g.all;\n delete g.all;\n delete g.top;\n delete g.order;\n delete g.orderNatural;\n delete g.size;\n g.value = function() { return all()[0].value; };\n return g;\n }\n\n // Removes this dimension and associated groups and event listeners.\n function dispose() {\n dimensionGroups.forEach(function(group) { group.dispose(); });\n var i = dataListeners.indexOf(preAdd);\n if (i >= 0) dataListeners.splice(i, 1);\n i = dataListeners.indexOf(postAdd);\n if (i >= 0) dataListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n filters.masks[offset] &= zero;\n return filterAll();\n }\n\n return dimension;\n }\n\n // A convenience method for groupAll on a dummy dimension.\n // This implementation can be optimized since it always has cardinality 1.\n function groupAll() {\n var group = {\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n value: value,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n var reduceValue,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n resetNeeded = true;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the reduce value. It must also listen to the parent\n // dimension for when data is added.\n filterListeners.push(update);\n dataListeners.push(add);\n\n // For consistency; actually a no-op since resetNeeded is true.\n add(data, 0, n);\n\n // Incorporates the specified new values into this group.\n function add(newData, n0) {\n var i;\n\n if (resetNeeded) return;\n\n // Cycle through all the values.\n for (i = n0; i < n; ++i) {\n\n // Add all values all the time.\n reduceValue = reduceAdd(reduceValue, data[i], true);\n\n // Remove the value if filtered.\n if (!filters.zero(i)) {\n reduceValue = reduceRemove(reduceValue, data[i], false);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n function update(filterOne, filterOffset, added, removed, notFilter) {\n var i,\n k,\n n;\n\n if (resetNeeded) return;\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zero(k = added[i])) {\n reduceValue = reduceAdd(reduceValue, data[k], notFilter);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.only(k = removed[i], filterOffset, filterOne)) {\n reduceValue = reduceRemove(reduceValue, data[k], notFilter);\n }\n }\n }\n\n // Recomputes the group reduce value from scratch.\n function reset() {\n var i;\n\n reduceValue = reduceInitial();\n\n // Cycle through all the values.\n for (i = 0; i < n; ++i) {\n\n // Add all values all the time.\n reduceValue = reduceAdd(reduceValue, data[i], true);\n\n // Remove the value if it is filtered.\n if (!filters.zero(i)) {\n reduceValue = reduceRemove(reduceValue, data[i], false);\n }\n }\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce value, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, cr_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), cr_zero);\n }\n\n // Returns the computed reduce value.\n function value() {\n if (resetNeeded) reset(), resetNeeded = false;\n return reduceValue;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = dataListeners.indexOf(add);\n if (i >= 0) dataListeners.splice(i, 1);\n return group;\n }\n\n return reduceCount();\n }\n\n // Returns the number of records in this crossfilter, irrespective of any filters.\n function size() {\n return n;\n }\n\n // Returns the raw row data contained in this crossfilter\n function all(){\n return data;\n }\n\n // Returns row data with all dimension filters applied, except for filters in ignore_dimensions\n function allFiltered(ignore_dimensions) {\n var array = [],\n i = 0,\n mask = maskForDimensions(ignore_dimensions || []);\n\n for (i = 0; i < n; i++) {\n if (filters.zeroExceptMask(i, mask)) {\n array.push(data[i]);\n }\n }\n\n return array;\n }\n\n function onChange(cb){\n if(typeof cb !== 'function'){\n /* eslint no-console: 0 */\n console.warn('onChange callback parameter must be a function!');\n return;\n }\n callbacks.push(cb);\n return function(){\n callbacks.splice(callbacks.indexOf(cb), 1);\n };\n }\n\n function triggerOnChange(eventName){\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i](eventName);\n }\n }\n\n return arguments.length\n ? add(arguments[0])\n : crossfilter;\n}\n\n// Returns an array of size n, big enough to store ids up to m.\nfunction cr_index(n, m) {\n return (m < 0x101\n ? xfilterArray.array8 : m < 0x10001\n ? xfilterArray.array16\n : xfilterArray.array32)(n);\n}\n\n// Constructs a new array of size n, with sequential values from 0 to n - 1.\nfunction cr_range(n) {\n var range = cr_index(n, n);\n for (var i = -1; ++i < n;) range[i] = i;\n return range;\n}\n\nfunction capacity(w) {\n return w === 8\n ? 0x100 : w === 16\n ? 0x10000\n : 0x100000000;\n}\n","export default function(t,e,i,n,r){for(r in n=(i=i.split(\".\")).splice(-1,1),i)e=e[i[r]]=e[i[r]]||{};return t(e,n)};\n//# sourceMappingURL=deepobj.m.js.map\n","import {d3} from './lib';\nimport crossfilter from 'crossfilter2';\n\n/* Decompresses ideogram's annotations for crossfilter initialization\nBy default, annotations are clustered by chromosome, e.g.\n[\n {\"chr\": \"1\", \"annots\": [{\"from\": 100, \"to\", 101, \"chr\": \"1\", ...}, ...]},\n {\"chr\": \"2\", \"annots\": [{\"from\": 500, \"to\", 501, \"chr\": \"2\", ...}, ...]},\n ...\n]\nThis method flattens that structure to e.g.\n[\n {\"from\": 100, \"to\": 101, \"chr\": \"1\", ...},\n ...\n {\"from\": 500, \"to\": 501, \"chr\": \"2\", ...},\n]\nSee also: packAnnots\n*/\nfunction unpackAnnots() {\n var chr, annots, i,\n unpackedAnnots = [],\n ideo = this,\n chrs = ideo.annots;\n\n for (i = 0; i < chrs.length; i++) {\n chr = chrs[i];\n annots = chr.annots;\n unpackedAnnots = unpackedAnnots.concat(annots);\n }\n\n return unpackedAnnots;\n}\n\n/*\n Compresses annots back to default state. Inverse of unpackAnnots.\n*/\nfunction packAnnots(unpackedAnnots) {\n var chr, annot, i,\n annots = [],\n ideo = this,\n chrs = ideo.annots;\n\n for (chr in chrs) {\n annots.push({chr: chrs[chr].chr, annots: []});\n }\n\n for (i = 0; i < unpackedAnnots.length; i++) {\n annot = unpackedAnnots[i];\n annots[annot.chrIndex].annots.push(annot);\n }\n\n return annots;\n}\n\n/*\n Initializes crossfilter. Needed for client-side filtering.\n More: https://github.com/square/crossfilter/wiki/API-Reference\n*/\nfunction initCrossFilter() {\n var i, facet,\n ideo = this,\n keys = ideo.rawAnnots.keys;\n\n ideo.unpackedAnnots = ideo.unpackAnnots();\n ideo.crossfilter = crossfilter(ideo.unpackedAnnots);\n\n ideo.annotsByFacet = {};\n ideo.facets = keys.slice(3, keys.length);\n\n for (i = 0; i < ideo.facets.length; i++) {\n facet = ideo.facets[i];\n ideo.annotsByFacet[facet] =\n ideo.crossfilter.dimension(function(d) {\n return d[facet];\n });\n }\n\n if ('filterSelections' in ideo) {\n ideo.filterAnnots(ideo.filterSelections);\n }\n\n ideo.filteredAnnots = ideo.annots;\n}\n\nfunction getFilteredResults(selections, ideo) {\n var fn, i, facet, results, filter,\n counts = {};\n\n if (Object.keys(selections).length === 0) {\n results = ideo.unpackedAnnots;\n } else {\n for (i = 0; i < ideo.facets.length; i++) {\n facet = ideo.facets[i];\n if (facet in selections) {\n filter = selections[facet];\n if (Array.isArray(filter)) {\n fn = function(d) {\n // Filter is numeric range\n if (filter.length === 2) {\n // [min, max]\n return filter[0] <= d && d < filter[1];\n } else if (filter.length === 4) {\n // [min1, max1, min2, max2]\n return (\n filter[0] <= d && d < filter[1] ||\n filter[2] <= d && d < filter[3]\n );\n }\n };\n } else {\n fn = function(d) {\n // Filter is set of categories\n return (d in filter);\n };\n }\n } else {\n fn = null;\n }\n ideo.annotsByFacet[facet].filter(fn);\n counts[facet] = ideo.annotsByFacet[facet].group().top(Infinity);\n }\n results = ideo.annotsByFacet[facet].top(Infinity);\n }\n\n return [results, counts];\n}\n\n/*\n Filters annotations based on the given selections.\n \"selections\" is an object of objects, e.g.\n\n {\n \"tissue-type\": { <-- a facet\n \"cerebral-cortex\": 1, <-- a filter; \"1\" means it is selected\n \"liver\": 1\n },\n \"gene-type\": {\n mirna\": 1\n }\n }\n\n Translation:\n select where:\n (tissue-type is cerebral-cortex OR liver) and (gene-type is mirna)\n\n TODO:\n * Filter counts\n * Integrate server-side filtering for very large datasets\n*/\nfunction filterAnnots(selections) {\n var i, facet, results, counts,\n t0 = Date.now(),\n ideo = this;\n\n ideo.filterSelections = selections;\n [results, counts] = getFilteredResults(selections, ideo);\n\n for (i < 0; i < ideo.facets.length; i++) {\n ideo.annotsByFacet[facet].filterAll(); // clear filters\n }\n\n results = ideo.packAnnots(results);\n\n delete ideo.maxAnnotsPerBar;\n delete ideo.maxAnnotsPerBarAllChrs;\n\n ideo.filteredAnnots = results;\n\n d3.selectAll(ideo.selector + ' polygon.annot').remove();\n ideo.drawAnnots(results);\n\n console.log('Time in filterAnnots: ' + (Date.now() - t0) + ' ms');\n\n return counts;\n}\n\nexport {unpackAnnots, packAnnots, initCrossFilter, filterAnnots};\n","function getPixelAndOtherData(bands, chr, hasBands, ideo) {\n var i, band, csLength, width, maxLength,\n pxStop = 0,\n taxid = chr.id.split('-')[1],\n cs = ideo.coordinateSystem,\n chrHeight = ideo.config.chrHeight;\n\n for (i = 0; i < bands.length; i++) {\n band = bands[i];\n csLength = band[cs].stop - band[cs].start;\n\n // If ideogram is rotated (and thus showing only one chromosome),\n // then set its width independent of the longest chromosome in this\n // genome.\n if (ideo._layout._isRotated) {\n width = chrHeight * csLength / chr.length;\n } else {\n if (ideo.config.chromosomeScale === 'relative') {\n maxLength = ideo.maxLength[taxid][cs];\n } else {\n maxLength = ideo.maxLength[cs];\n }\n width = chrHeight * chr.length / maxLength * csLength / chr.length;\n }\n bands[i].px = {start: pxStop, stop: pxStop + width, width: width};\n\n pxStop = bands[i].px.stop;\n\n if (hasBands && band.stain === 'acen' && band.name[0] === 'p') {\n chr.pcenIndex = i;\n }\n }\n return [bands, chr, pxStop];\n}\n\n/**\n * TODO:\n * A chromosome-level scale property is likely\n * nonsensical for any chromosomes that have cytogenetic band data.\n * Different bands tend to have ratios between number of base pairs\n * and physical length.\n *\n * However, a chromosome-level scale property is likely\n * necessary for chromosomes that do not have band data.\n *\n * This needs further review.\n */\nfunction getChrScale(chr, hasBands, ideo) {\n var chrHeight = ideo.config.chrHeight,\n chrLength = chr.length,\n maxLength = ideo.maxLength,\n taxid = chr.id.split('-')[1],\n scale = {};\n\n scale.bp = chrHeight / maxLength.bp;\n\n if (ideo.config.multiorganism === true) {\n // chr.scale.bp = band.iscn.stop / band.bp.stop;\n if (ideo.config.chromosomeScale === 'relative') {\n scale.iscn = chrHeight * chrLength / maxLength[taxid].bp;\n scale.bp = chrHeight / maxLength[taxid].bp;\n } else {\n scale.iscn = chrHeight * chrLength / maxLength.bp;\n }\n } else if (hasBands) {\n scale.iscn = chrHeight / maxLength.iscn;\n }\n\n return scale;\n}\n\nfunction getChromosomePixels(chr) {\n var bands, chrHeight, pxStop, hasBands, maxLength,\n taxid = chr.id.split('-')[1],\n ideo = this;\n\n bands = chr.bands;\n chrHeight = ideo.config.chrHeight;\n pxStop = 0;\n hasBands = (typeof bands !== 'undefined');\n\n if (hasBands) {\n [bands, chr, pxStop] = getPixelAndOtherData(bands, chr, hasBands, ideo);\n } else {\n if (ideo.config.chromosomeScale === 'relative') {\n maxLength = ideo.maxLength[taxid][ideo.coordinateSystem];\n } else {\n maxLength = ideo.maxLength[ideo.coordinateSystem];\n }\n pxStop = chrHeight * chr.length / maxLength;\n }\n\n chr.width = pxStop;\n chr.scale = getChrScale(chr, hasBands, ideo);\n chr.bands = bands;\n\n return chr;\n}\n\nfunction getChrModelScaffold(chr, bands, chrName, ideo) {\n var hasBands = (typeof bands !== 'undefined');\n\n if (hasBands) {\n const lastBand = bands.slice(-1)[0];\n chr.name = chrName;\n chr.length = lastBand[ideo.coordinateSystem].stop;\n\n // Accounts for case where this chromosome\n chr.bpLength = lastBand.bp.stop;\n\n chr.type = 'nuclear';\n } else {\n chr = chrName;\n }\n\n return chr;\n}\n\n/**\n * Encountered when processing an assembly that has chromosomes with\n * centromere data, but this chromosome does not.\n * Example: chromosome F1 in Felis catus.\n */\nfunction deleteExtraneousBands(chr, hasBands) {\n if (hasBands && chr.bands.length === 1) {\n delete chr.bands;\n }\n return chr;\n}\n\nfunction getCentromerePosition(hasBands, bands) {\n\n if (hasBands === false) return '';\n\n // As with Macaca mulatta chromosome Y\n const firstBand = bands[0];\n const lastBand = bands.slice(-1)[0];\n const chrLength = lastBand.bp.stop - firstBand.bp.start;\n const smallLength = chrLength/20;\n\n if (\n // As with almost all mouse chromosome, chimpanzee chr22\n firstBand.name[0] === 'p' && bands[1].name[0] === 'q' &&\n firstBand.bp.stop - firstBand.bp.start < smallLength\n ) {\n return 'telocentric-p';\n }\n\n const penultimateBand = bands.slice(-2)[0];\n\n if (\n penultimateBand.name[0] === 'p' && lastBand.name[0] === 'q' &&\n lastBand.bp.stop - lastBand.bp.start < smallLength\n ) {\n // As with Macaca mulatta chromosome Y\n return 'telocentric-q';\n }\n\n return '';\n}\n\n/**\n * Generates a model object for each chromosome containing information on\n * its name, DOM ID, length in base pairs or ISCN coordinates, cytogenetic\n * bands, centromere position, etc.\n */\nfunction getChromosomeModel(bands, chrName, taxid, chrIndex) {\n var hasBands, org,\n chr = {},\n ideo = this;\n\n hasBands = (typeof bands !== 'undefined');\n\n chr = getChrModelScaffold(chr, bands, chrName, ideo);\n\n chr.chrIndex = chrIndex;\n chr.id = 'chr' + chr.name + '-' + taxid;\n\n if (ideo.config.fullChromosomeLabels === true) {\n org = this.organisms[taxid];\n chr.name = org.scientificName + ' chr' + chr.name;\n }\n\n chr.bands = bands;\n chr = ideo.getChromosomePixels(chr);\n chr.centromerePosition = getCentromerePosition(hasBands, bands);\n\n chr = deleteExtraneousBands(chr, hasBands);\n\n return chr;\n}\n\nexport {getChromosomeModel, getChromosomePixels};\n","// import {getSettings, handleSettingsHeaderClick} from './settings-ui';\nimport version from '../version';\nimport {downloadPng} from '../lib';\n\nconst style = `\n `;\n\n// eslint-disable-next-line max-len\nconst gearIcon = '';\n// Font Awesome Free 5.2.0 by @fontawesome - https://fontawesome.com\n// License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)\n\nfunction deactivate(items) {\n items.forEach(item => {item.classList.remove('active');});\n}\n\nfunction closeTools() {\n const toolHeaders = document.querySelectorAll('#tools > ul > li');\n deactivate(toolHeaders);\n const itemsToClose =\n document.querySelectorAll('.ideo-modal, .ideo-tool-panel');\n itemsToClose.forEach(item => {item.remove();});\n\n document.querySelector('#tools').style.display = 'none';\n}\n\n/**\n * As needed, hide tool panels that are triggered by hovering\n */\nfunction handleHideForHoverables(trigger, tool, toolHeader, toolHeaders) {\n if (trigger === 'mouseenter') {\n\n // Hide panel when hover leaves tool header, if new target element\n // is part of the tools UI (and not the panel itself)\n toolHeader.addEventListener('mouseleave', event => {\n const toElement = event.toElement;\n const toId = toElement.id;\n const panelElement = document.querySelector('.ideo-tool-panel');\n const toolsElement = document.querySelector('#tools');\n if (\n toolsElement.contains(toElement) &&\n panelElement && !panelElement.contains(toElement) &&\n toId !== tool\n ) {\n deactivate(toolHeaders);\n panelElement.remove();\n }\n });\n }\n}\n\n/** Determine action that should trigger a tool panel to display */\nfunction getTrigger(toolHeader) {\n const shouldHover =\n Array.from(toolHeader.classList).includes('ideo-tool-hover');\n const trigger = shouldHover ? 'mouseenter' : 'click';\n return trigger;\n}\n\n/** Shows clicked tool as active, displays resulting panel */\nfunction handleToolClick(ideo) {\n const toolHeaders = document.querySelectorAll('#tools > ul > li');\n\n toolHeaders.forEach(toolHeader => {\n const trigger = getTrigger(toolHeader);\n\n toolHeader.addEventListener(trigger, event => {\n\n // Show only clicked tool header as active\n deactivate(toolHeaders);\n toolHeader.classList += ' active';\n\n const tool = toolHeader.id.split('-')[0];\n const panel = getPanel(tool, ideo);\n\n if (trigger === 'mouseenter') {\n toolHeader.insertAdjacentHTML('beforeend', panel);\n handleHideForHoverables(trigger, tool, toolHeader, toolHeaders);\n\n if (tool === 'download') {\n document.querySelector('#download-image')\n .addEventListener('click', event => {\n closeTools();\n downloadPng(ideo);\n });\n\n document.querySelector('#download-annots')\n .addEventListener('click', event => {\n const element = document.querySelector('#download-annots');\n const classes = Array.from(element.classList);\n if (classes.includes('ideo-disabled') === false) {\n closeTools();\n ideo.downloadAnnotations();\n }\n });\n }\n } else {\n document.querySelector('#gear').insertAdjacentHTML('beforeend', panel);\n }\n });\n });\n\n // Upon clicking \"close\" (x), remove tools UI\n document.querySelectorAll('#close').forEach(closeButton => {\n closeButton.addEventListener('click', () => {closeTools();});\n });\n\n}\n\nfunction handleGearClick(ideo) {\n document.querySelector('#gear')\n .addEventListener('click', event => {\n var options = document.querySelector('#tools');\n if (options.style.display === 'none') {\n options.style.display = '';\n hideOnClickOutside();\n } else {\n options.style.display = 'none';\n closeTools();\n }\n });\n\n handleToolClick(ideo);\n\n // handleSettingsHeaderClick(ideo);\n}\n\nfunction showGearOnIdeogramHover(ideo) {\n const container = document.querySelector(ideo.selector);\n const gear = document.querySelector('#gear');\n const panel = document.querySelector('#tools');\n\n container.addEventListener('mouseover', () => gear.style.display = '');\n container.addEventListener('mouseout', () => {\n // Hide gear only if panel is not shown\n if (panel.style.display === 'none') {\n gear.style.display = 'none';\n }\n });\n\n gear.addEventListener('mouseover', () => gear.style.display = '');\n}\n\nfunction getPanel(tool, ideo) {\n var panel;\n // if (tool === 'settings') panel = getSettings();\n if (tool === 'download') panel = getDownload(ideo);\n if (tool === 'about') panel = getAbout();\n return panel.trim();\n}\n\nfunction getDownload(ideo) {\n\n const numAnnots = document.querySelectorAll('.annot').length;\n const annotsClass = (numAnnots > 0) ? '' : 'ideo-disabled';\n\n return `\n
    \n
  • Image
  • \n
  • Annotations
  • \n
    \n `;\n}\n\nfunction getAbout() {\n const ideogramLink = `\n \n Ideogram.js`;\n const closeButton = 'x';\n return `\n
    \n ${ideogramLink}, version ${version} ${closeButton}
    \n Chromosome visualization for the web\n
    `;\n}\n\nfunction hideOnClickOutside(selector) {\n const elements = document.querySelectorAll('#gear, #tools');\n const outsideClickListener = event => {\n let clickedOutsideCount = 0;\n elements.forEach((element) => {\n if (!element.contains(event.target)) {\n clickedOutsideCount += 1;\n }\n });\n if (clickedOutsideCount === elements.length) {\n closeTools();\n removeClickListener();\n }\n };\n\n const removeClickListener = () => {\n document.removeEventListener('click', outsideClickListener);\n };\n\n document.addEventListener('click', outsideClickListener);\n}\n\nfunction initTools(ideo) {\n\n const triangle = '';\n\n const toolsHtml = `\n ${style}\n
    ${gearIcon}
    \n
    \n
      \n
    • Download ${triangle}
    • \n
    • About
    • \n
    \n
    `;\n\n\n document.querySelector(ideo.selector)\n .insertAdjacentHTML('beforebegin', toolsHtml);\n\n handleGearClick(ideo);\n\n showGearOnIdeogramHover(ideo);\n}\n\nexport {initTools};\n\n","/* eslint-disable no-use-before-define */\n\nexport class ModelAdapter {\n\n constructor(model) {\n this._model = model;\n this._class = 'ModelAdapter';\n }\n\n static getInstance(model) {\n if (model.bands) {\n return new ModelAdapter(model);\n } else {\n return new ModelNoBandsAdapter(model);\n }\n }\n\n getModel() {\n return this._model;\n }\n\n getCssClass() {\n return '';\n }\n}\n\nexport class ModelNoBandsAdapter extends ModelAdapter {\n\n constructor(model) {\n super(model);\n this._class = 'ModelNoBandsAdapter';\n }\n\n getModel() {\n this._model.bands = [];\n\n const isMT = this._model.name === 'MT'; // Is mitochondrial chromosome\n const width = this._model.width;\n\n if (width > 1 || isMT) {\n // Add single band to bands array\n this._model.bands.push({\n name: 'q',\n px: {\n start: 0,\n stop: width,\n width: width\n },\n bp: {\n start: 1,\n stop: this._model.bpLength ?? this._model.length\n },\n iscn: {\n start: 1,\n stop: this._model.length\n }\n });\n }\n\n return this._model;\n }\n\n getCssClass() {\n return 'noBands';\n }\n\n}\n","import {Ploidy} from './ploidy';\n\nexport class Color {\n\n constructor(config) {\n // Ideogram config\n this._config = config;\n this._ploidy = new Ploidy(this._config);\n }\n\n getArmColor(chrSetIndex, chrIndex, armIndex) {\n if (this._config.armColors) {\n return this._config.armColors[armIndex];\n } else if (this._config.ancestors) {\n return this._getPolyploidArmColor(chrSetIndex, chrIndex, armIndex);\n } else {\n return null;\n }\n }\n\n getBorderColor(chrSetIndex, chrIndex, armIndex) {\n const config = this._config;\n const color = config.chrBorderColor ? config.chrBorderColor : '#000';\n if (chrIndex < config.ploidy) {\n return color;\n } else if (this._ploidy.exists(chrSetIndex, chrIndex, armIndex)) {\n return color;\n } else {\n return '#fff';\n }\n }\n\n getFillColor() {\n const config = this._config;\n if (!config.chrFillColor) return '#AAA';\n const color = config.chrFillColor;\n if (typeof color === 'string') {\n return {arm: color, centromere: ''};\n } else {\n return color;\n };\n }\n\n _getPolyploidArmColor(chrSetIndex, chrIndex, armIndex) {\n if (!this._ploidy.exists(chrSetIndex, chrIndex, armIndex)) {\n return 'transparent';\n } else {\n var ancestor =\n this._ploidy.getAncestor(chrSetIndex, chrIndex, armIndex);\n return this._config.ancestors[ancestor];\n }\n }\n\n}\n","export class Range {\n\n /**\n * Chromosome range.\n * @public\n * @class\n * @param {Object} data - range data.\n * @param {Integer} data.chr - chromosome index.\n * @param {Integer[]} [data.ploidy] - array which controls on which\n * chromosomes range should appear in case\n * of ploidy.\n * @param {Integer} data.start - range start.\n * @param {Integer} data.stop - range end.\n * @param {String} data.color - range color.\n */\n constructor(data) {\n this._data = data;\n this.start = data.start;\n this.stop = data.stop;\n this.length = this.stop - this.start;\n }\n\n getColor(chrIndex) {\n if (!('ploidy' in this._data)) {\n return this._getColor(chrIndex);\n } else if ('ploidy' in this._data && this._data.ploidy[chrIndex]) {\n return this._getColor(chrIndex);\n } else {\n return 'transparent';\n }\n }\n\n _getColor(chrIndex) {\n if (Array.isArray(this._data.color)) {\n return this._data.color[chrIndex];\n } else {\n return this._data.color;\n }\n }\n\n}\n","/* eslint-disable no-use-before-define */\nimport {Color} from './../color';\nimport {Range} from './../range';\n\nexport class Chromosome {\n\n constructor(adapter, config, ideo) {\n this._adapter = adapter;\n this._model = this._adapter.getModel();\n this._config = config;\n this._ideo = ideo;\n this._color = new Color(this._config);\n this._bumpCoefficient = 5;\n }\n\n /**\n * Factory method\n */\n static getInstance(adapter, config, ideo) {\n const centromerePosition = adapter.getModel().centromerePosition;\n if (centromerePosition === 'telocentric-p') {\n return new TelocentricPChromosome(adapter, config, ideo);\n } else if (centromerePosition === 'telocentric-q') {\n return new TelocentricQChromosome(adapter, config, ideo);\n } else {\n return new MetacentricChromosome(adapter, config, ideo);\n }\n }\n\n _addPArmShape(clipPath, isPArmRendered) {\n if (isPArmRendered) {\n return clipPath.concat(this._getPArmShape());\n } else {\n return clipPath;\n }\n }\n\n _addQArmShape(clipPath, isQArmRendered) {\n if (isQArmRendered) {\n return clipPath.concat(this._getQArmShape());\n } else {\n return clipPath;\n }\n }\n\n /**\n * Append bands container and apply clip-path to it\n */\n render(container, chrSetIndex, chrIndex) {\n\n var self, isPArmRendered, isQArmRendered, clipPath, opacity, fill,\n isFullyBanded;\n\n self = this;\n\n container = container.append('g')\n .attr('class', 'bands')\n .attr('clip-path',\n 'url(#' + this._model.id + '-chromosome-set-clippath)'\n );\n\n // Render chromosome arms\n isPArmRendered = this._renderArm(container, chrSetIndex, chrIndex, 'p');\n isQArmRendered = this._renderArm(container, chrSetIndex, chrIndex, 'q');\n\n // Render range set\n this._renderRangeSet(container, chrSetIndex, chrIndex);\n\n // Push arms shape string into clipPath array\n clipPath = [];\n clipPath = this._addPArmShape(clipPath, isPArmRendered);\n clipPath = this._addQArmShape(clipPath, isQArmRendered);\n\n opacity = '0';\n fill = '';\n isFullyBanded = this.isFullyBanded();\n if (\n 'ancestors' in this._ideo.config &&\n !('rangeSet' in this._ideo.config)\n ) {\n // E.g. diploid human genome (with translucent overlay)\n fill = self._color.getArmColor(chrSetIndex, chrIndex, 0);\n if (isFullyBanded) {\n opacity = '0.5';\n }\n } else if (isFullyBanded) {\n // E.g. mouse reference genome\n opacity = null;\n fill = 'transparent';\n } else if (!('ancestors' in this._ideo.config)) {\n // E.g. chimpanzee assembly Pan_tro 3.0\n opacity = '1';\n }\n\n let centromereFill;\n if (this._ideo.config.chrFillColor) {\n const fillColor = self._color.getFillColor();\n fill = fillColor.arm;\n centromereFill = fillColor.centromere;\n }\n\n // Render chromosome border\n container.append('g')\n .attr('class', 'chromosome-border')\n .selectAll('path')\n .data(clipPath)\n .enter()\n .append('path')\n .attr('fill', fill)\n .style('fill-opacity', opacity)\n .style('fill', function(d) {\n if (d.class === 'acen' && centromereFill) {\n return centromereFill;\n }\n })\n .attr('stroke', function(d, i) {\n return self._color.getBorderColor(chrSetIndex, chrIndex, i);\n })\n .attr('stroke-width', function(d) {\n return ('strokeWidth' in d ? d.strokeWidth : 1);\n })\n .attr('d', function(d) {\n return d.path;\n }).attr('class', function(d) {\n return d.class;\n });\n\n return clipPath;\n }\n\n _renderRangeSet(container, chrSetIndex, chrIndex) {\n\n var self, rangeSet, rangesContainer, ideo;\n\n if (!('rangeSet' in this._config)) {\n return;\n }\n\n rangeSet = this._config.rangeSet.filter(function(range) {\n return range.chr - 1 === chrSetIndex;\n }).map(function(range) {\n return new Range(range);\n });\n\n rangesContainer = container.append('g').attr('class', 'range-set');\n\n self = this;\n ideo = self._ideo;\n\n rangesContainer.selectAll('rect.range')\n .data(rangeSet)\n .enter()\n .append('rect')\n .attr('class', 'range')\n .attr('x', function(range) {\n return ideo.convertBpToPx(self._model, range.start);\n }).attr('y', 0)\n .attr('width', function(range) {\n return ideo.convertBpToPx(self._model, range.length);\n }).attr('height', this._config.chrWidth)\n .style('fill', function(range) {\n return range.getColor(chrIndex);\n });\n }\n\n /**\n * Get chromosome's shape main values\n */\n _getShapeData() {\n\n var firstQBand, i, lastBand, rightTerminalPosition;\n\n // First q band from bands sequence\n for (i = 0; i < this._model.bands.length; i++) {\n if (this._model.bands[i].name[0] === 'q') {\n firstQBand = this._model.bands[i];\n break;\n }\n }\n\n // Chromosome's right position\n lastBand = this._model.bands.length - 1;\n rightTerminalPosition = this._model.bands[lastBand].px.stop;\n\n // Properties description:\n // x1 - left terminal start position\n // x2 - centromere position\n // x3 - right terminal end position\n // w - chromosome width\n // b - bump size\n return {\n x1: 0,\n x2: firstQBand ? firstQBand.px.start : rightTerminalPosition,\n x3: rightTerminalPosition,\n w: this._config.chrWidth,\n b: this._config.chrWidth / this._bumpCoefficient\n };\n }\n\n _getPArmShape() {\n var d = this._getShapeData(),\n x = d.x2 - d.b;\n\n if (this.isFullyBanded() || 'ancestors' in this._ideo.config) {\n // Encountered when chromosome has any of:\n // - One placeholder \"band\", e.g. pig genome GCF_000003025.5\n // - Many (> 2) bands, e.g. human reference genome\n // - Ancestor colors in ploidy configuration, as in ploidy-basic.html\n return {\n class: '',\n path:\n 'M' + d.b + ',0 ' +\n 'L' + x + ',0 ' +\n 'Q' + (d.x2 + d.b) + ',' + (d.w / 2) + ',' + x + ',' + d.w + ' ' +\n 'L' + d.b + ',' + d.w + ' ' +\n 'Q-' + d.b + ',' + (d.w / 2) + ',' + d.b + ',0'\n };\n } else {\n // e.g. chimpanzee assembly Pan_tro 3.0\n return [{\n class: '',\n path:\n 'M' + d.b + ',0 ' +\n 'L' + (x - 2) + ',0 ' +\n 'L' + (x - 2) + ',' + d.w + ' ' +\n 'L' + d.b + ',' + d.w + ' ' +\n 'Q-' + d.b + ',' + (d.w / 2) + ',' + d.b + ',0'\n }, {\n class: 'acen',\n path:\n 'M' + x + ',0 ' +\n 'Q' + (d.x2 + d.b) + ',' + (d.w / 2) + ',' + x + ',' + d.w + ' ' +\n 'L' + x + ',' + d.w + ' ' +\n 'L' + (x - 2) + ',' + d.w + ' ' +\n 'L' + (x - 2) + ',0'\n }];\n }\n }\n\n _getQArmShape() {\n var d = this._getShapeData(),\n x = d.x3 - d.b,\n x2b = d.x2 + d.b;\n\n if (this.isFullyBanded() || 'ancestors' in this._ideo.config) {\n return {\n class: '',\n path:\n 'M' + x2b + ',0 ' +\n 'L' + x + ',0 ' +\n 'Q' + (d.x3 + d.b) + ',' + (d.w / 2) + ',' + x + ',' + d.w + ' ' +\n 'L' + x2b + ',' + d.w + ' ' +\n 'Q' + (d.x2 - d.b) + ',' + (d.w / 2) + ',' + x2b + ',0'\n };\n } else {\n // e.g. chimpanzee assembly Pan_tro 3.0\n return [{\n path:\n 'M' + x2b + ',0 ' +\n 'L' + x + ',0 ' +\n 'Q' + (d.x3 + d.b) + ',' + (d.w / 2) + ',' + x + ',' + d.w + ' ' +\n 'L' + x2b + ',' + d.w + ' ' +\n 'L' + x2b + ',0'\n }, {\n class: 'acen',\n path:\n 'M' + x2b + ',0' +\n 'Q' + (d.x2 - d.b) + ',' + (d.w / 2) + ',' + x2b + ',' + d.w + ' ' +\n 'L' + x2b + ',' + d.w +\n 'L' + (x2b + 2) + ',' + d.w +\n 'L' + (x2b + 2) + ',0'\n }];\n }\n }\n\n isFullyBanded() {\n return (\n this._model.bands &&\n (this._model.bands.length !== 2 || this._model.bands[0].name[0] === 'q')\n );\n }\n\n /**\n * Render arm bands\n */\n _renderBands(container, chrSetIndex, chrIndex, bands, arm) {\n\n var self, armIndex, fill;\n\n self = this;\n armIndex = arm === 'p' ? 0 : 1;\n fill = '';\n\n if ('ancestors' in self._ideo.config && !(self.isFullyBanded())) {\n fill = self._color.getArmColor(chrSetIndex, chrIndex, armIndex);\n }\n\n container.selectAll('path.band.' + arm)\n .data(bands)\n .enter()\n .append('path')\n .attr('id', function(d) {\n return self._model.id + '-' + d.name.replace('.', '-');\n })\n .attr('class', function(d) {\n return 'band ' + arm + '-band ' + d.stain;\n })\n .attr('d', function(d) {\n var start, length;\n\n start = self._ideo.round(d.px.start);\n length = self._ideo.round(d.px.width);\n\n return 'M ' + start + ', 0' +\n 'l ' + length + ' 0 ' +\n 'l 0 ' + self._config.chrWidth + ' ' +\n 'l -' + length + ' 0 z';\n })\n .style('fill', fill);\n }\n\n /**\n * Render a chromosome arm.\n * Returns boolean indicating if any bands were rendered.\n */\n _renderArm(container, chrSetIndex, chrIndex, arm) {\n var bands = this._model.bands.filter(function(band) {\n return band.name[0] === arm;\n });\n\n this._renderBands(container, chrSetIndex, chrIndex, bands, arm);\n\n return Boolean(bands.length);\n }\n}\n\nexport class MetacentricChromosome extends Chromosome {\n\n constructor(model, config, ideo) {\n super(model, config, ideo);\n this._class = 'MetacentricChromosome';\n }\n}\n\nexport class TelocentricPChromosome extends Chromosome {\n\n constructor(model, config, ideo) {\n // alert('p')\n super(model, config, ideo);\n this._class = 'TelocentricPChromosome';\n this._pArmOffset = 3;\n }\n\n _addPArmShape(clipPath) {\n return clipPath.concat(this._getPArmShape());\n }\n\n _getPArmShape() {\n // Properties description:\n // x1 - left terminal start position\n // x2 - centromere position\n // x3 - right terminal end position\n // w - chromosome width\n // b - bump size\n var d = this._getShapeData();\n d.o = this._pArmOffset;\n\n return [{\n class: 'acen',\n path: 'M' + (d.x2 + 2) + ',1' +\n 'L' + (d.x2 + d.o + 3.25) + ',1 ' +\n 'L' + (d.x2 + d.o + 3.25) + ',' + (d.w - 1) + ' ' +\n 'L' + (d.x2 + 2) + ',' + (d.w - 1)\n }, {\n class: 'gpos66',\n path: 'M' + (d.x2 - d.o + 5) + ',0' +\n 'L' + (d.x2 - d.o + 3) + ',0 ' +\n 'L' + (d.x2 - d.o + 3) + ',' + d.w + ' ' +\n 'L' + (d.x2 - d.o + 5) + ',' + d.w,\n strokeWidth: 0.5\n }];\n }\n\n _getQArmShape() {\n // Properties description:\n // x1 - left terminal start position\n // x2 - centromere position\n // x3 - right terminal end position\n // w - chromosome width\n // b - bump size\n var d = this._getShapeData(),\n x = d.x3 - d.b,\n o = this._pArmOffset + 3;\n\n return {\n class: '',\n path:\n 'M' + (d.x2 + o) + ',0 ' +\n 'L' + x + ',0 ' +\n 'Q' + (d.x3 + d.b) + ',' + (d.w / 2) + ',' + x + ',' + d.w + ' ' +\n 'L' + (d.x2 + o) + ',' + d.w\n };\n }\n}\n\nexport class TelocentricQChromosome extends Chromosome {\n\n constructor(model, config, ideo) {\n // alert('q')\n super(model, config, ideo);\n this._class = 'TelocentricQChromosome';\n this._qArmOffset = 3;\n }\n\n _getPArmShape() {\n // Properties description:\n // x1 - left terminal start position\n // x2 - centromere position\n // x3 - right terminal end position\n // w - chromosome width\n // b - bump size\n\n var d = this._getShapeData(),\n x = d.x3 - d.b,\n o = this._qArmOffset;\n\n return {\n class: '',\n path:\n // 'M1,0, ' +\n 'M' + (d.x2 + o) + ',0 ' +\n 'L' + (x + o) + ',0 ' +\n 'L' + (x + o) + ',' + d.w + ' ' +\n 'L' + d.b + ',' + d.w + ' ' +\n 'Q-' + d.b + ',' + (d.w / 2) + ',' + d.b + ',0'\n };\n }\n\n _addQArmShape(clipPath) {\n return clipPath.concat(this._getQArmShape());\n }\n\n _getQArmShape() {\n // Properties description:\n // x1 - left terminal start position\n // x2 - centromere position\n // x3 - right terminal end position\n // w - chromosome width\n // b - bump size\n var d = this._getShapeData();\n d.o = this._qArmOffset;\n\n return [{\n class: 'acen',\n path: 'M' + (d.x2 + 2) + ',1 ' +\n 'L' + (d.x2 + d.o + 3.25) + ',1 ' +\n 'L' + (d.x2 + d.o + 3.25) + ',' + (d.w - 1) + ' ' +\n 'L' + (d.x2 + 2) + ',' + (d.w - 1)\n }, {\n class: 'gpos66',\n path: 'M' + (d.x2 + d.o + 5) + ',0 ' +\n 'L' + (d.x2 + d.o + 3) + ',0 ' +\n 'L' + (d.x2 + d.o + 3) + ',' + d.w + ' ' +\n 'L' + (d.x2 + d.o + 5) + ',' + d.w,\n strokeWidth: 0.5\n }];\n }\n}\n","import {d3} from '../lib';\nimport {initTools} from '../tools/tools';\nimport {ModelAdapter} from '../model-adapter';\nimport {Chromosome} from './chromosome';\n\n/**\n * Adds a copy of a chromosome (i.e. a homologous chromosome, homolog) to DOM\n *\n * @param chrModel\n * @param chrIndex\n * @param homologIndex\n * @param container\n */\nfunction appendHomolog(chrModel, chrIndex, homologIndex, container) {\n\n var homologOffset, chromosome, shape, defs, adapter;\n\n defs = d3.select(this.selector + ' defs');\n // Get chromosome model adapter class\n adapter = ModelAdapter.getInstance(chrModel);\n\n // How far this copy of the chromosome is from another\n homologOffset = homologIndex * this.config.chrMargin;\n\n // Append chromosome's container\n chromosome = container\n .append('g')\n .attr('id', chrModel.id)\n .attr('class', 'chromosome ' + adapter.getCssClass())\n .attr('transform', 'translate(0, ' + homologOffset + ')');\n\n // Render chromosome\n shape = Chromosome.getInstance(adapter, this.config, this)\n .render(chromosome, chrIndex, homologIndex);\n\n d3.select('#' + chrModel.id + '-chromosome-set-clippath').remove();\n\n defs.append('clipPath')\n .attr('id', chrModel.id + '-chromosome-set-clippath')\n .selectAll('path')\n .data(shape)\n .enter()\n .append('path')\n .attr('d', function(d) {return d.path;})\n .attr('class', function(d) {return d.class;});\n\n\n if (chrModel.width < 1) {\n d3.select('#' + chrModel.id + ' .bands').style('opacity', 0);\n }\n}\n\n/**\n * Renders all the bands and outlining boundaries of a chromosome.\n */\nfunction drawChromosome(chrModel) {\n var chrIndex, container, numChrsInSet, transform, homologIndex,\n chrSetSelector;\n\n chrIndex = chrModel.chrIndex;\n\n transform = this._layout.getChromosomeSetTranslate(chrIndex);\n\n chrSetSelector = this.selector + ' #' + chrModel.id + '-chromosome-set';\n\n d3.selectAll(chrSetSelector + ' g').remove();\n\n container = d3.select(chrSetSelector);\n\n if (container.nodes().length === 0) {\n // Append chromosome set container\n container = d3.select(this.selector)\n .append('g')\n .attr('class', 'chromosome-set')\n .attr('transform', transform)\n .attr('id', chrModel.id + '-chromosome-set');\n }\n\n if (\n 'sex' in this.config &&\n this.config.ploidy === 2 &&\n this.sexChromosomes.index === chrIndex\n ) {\n this.drawSexChromosomes(container, chrIndex);\n return;\n }\n\n numChrsInSet = 1;\n if (this.config.ploidy > 1) {\n numChrsInSet = this._ploidy.getChromosomesNumber(chrIndex);\n }\n\n for (homologIndex = 0; homologIndex < numChrsInSet; homologIndex++) {\n this.appendHomolog(chrModel, chrIndex, homologIndex, container);\n }\n}\n\n/**\n * Rotates a chromosome 90 degrees and shows or hides all other chromosomes\n * Useful for focusing or defocusing a particular chromosome\n */\nfunction rotateAndToggleDisplay(chrElement) {\n var chrName, chrModel, chrIndex;\n\n this.unhighlight();\n\n // Do nothing if taxid not defined. But it should be defined.\n // To fix that bug we should have a way to find chromosome set number.\n if (!this.config.taxid) return;\n\n chrName = chrElement.id.split('-')[0].replace('chr', '');\n chrModel = this.chromosomes[this.config.taxid][chrName];\n chrIndex = chrModel.chrIndex;\n\n this._layout.rotate(chrIndex, chrIndex, chrElement);\n}\n\nfunction setOverflowScroll() {\n var ideo, config, ideoWidth, ideoInnerWrap, ideoMiddleWrap, ideoSvg,\n ploidy, ploidyPad;\n\n ideo = this;\n config = ideo.config;\n\n ideoSvg = d3.select(config.container + ' svg#_ideogram');\n ideoInnerWrap = d3.select(config.container + ' #_ideogramInnerWrap');\n ideoMiddleWrap = d3.select(config.container + ' #_ideogramMiddleWrap');\n\n ploidy = config.ploidy;\n if (ploidy === 1) {\n ploidyPad = ploidy;\n } else {\n ploidyPad = ploidy * 1.12;\n }\n\n let annotHeight = 0;\n if ('annotationsLayout' in config) {\n annotHeight = config.annotationHeight * config.numAnnotTracks;\n }\n\n if (\n config.orientation === 'vertical' &&\n config.perspective !== 'comparative' &&\n config.geometry !== 'collinear'\n ) {\n ideoWidth =\n (ideo.numChromosomes) *\n (config.chrWidth + config.chrMargin + annotHeight);\n } else {\n return;\n }\n\n if (config.annotationsLayout === 'heatmap-2d') {\n return;\n }\n\n ideoWidth = Math.ceil(ideoWidth * ploidyPad / config.rows);\n if (ideo._layout._class === 'SmallLayout') ideoWidth += 100;\n\n ideoWidth += 35; // Account for settings gear\n\n // Ensures absolutely-positioned elements, e.g. heatmap overlaps, display\n // properly if ideogram container also has position: absolute\n ideoMiddleWrap.style('height', ideo._layout.getHeight() + 'px');\n\n ideoInnerWrap\n .style('max-width', ideoWidth + 'px')\n .style('overflow-x', 'scroll')\n .style('position', 'absolute');\n\n ideoSvg.style('min-width', (ideoWidth - 5) + 'px');\n\n if (ideo.config.showTools) {\n initTools(ideo);\n }\n}\n\nexport {\n appendHomolog, drawChromosome, rotateAndToggleDisplay, setOverflowScroll\n};\n","import {d3} from '../lib';\n\nfunction getChrSetLabelLines(d, i, ideo) {\n var lines;\n if (d.name.indexOf(' ') === -1) {\n lines = [d.name];\n } else {\n lines = d.name.match(/^(.*)\\s+([^\\s]+)$/).slice(1).reverse();\n }\n\n if (\n 'sex' in ideo.config &&\n ideo.config.ploidy === 2 &&\n i === ideo.sexChromosomes.index\n ) {\n if (ideo.config.sex === 'male') {\n lines = ['XY'];\n } else {\n lines = ['XX'];\n }\n }\n\n return lines;\n}\n\nfunction renderChromosomeSetLabel(d, i, textElement, ideo) {\n // Get label lines\n var lines = getChrSetLabelLines(d, i, ideo);\n\n // Render label lines\n d3.select(textElement).selectAll('tspan')\n .data(lines)\n .enter()\n .append('tspan')\n .attr('dy', function(d, i) {\n return i * -1.2 + 'em';\n })\n .attr('x', ideo._layout.getChromosomeSetLabelXPosition())\n .attr('class', function(a, i) {\n var fullLabels = ideo.config.fullChromosomeLabels;\n return i === 1 && fullLabels ? 'italic' : null;\n })\n .text(String);\n}\n\nfunction appendChromosomeSetLabels(ideo) {\n var layout = ideo._layout;\n\n d3.selectAll(ideo.selector + ' .chromosome-set')\n .insert('text', ':first-child')\n .data(ideo.chromosomesArray)\n .attr('class', layout.getChromosomeLabelClass())\n .attr('transform', layout.getChromosomeSetLabelTranslate())\n .attr('x', layout.getChromosomeSetLabelXPosition())\n .attr('y', function(d, i) {\n return layout.getChromosomeSetLabelYPosition(i);\n })\n .attr('text-anchor', layout.getChromosomeSetLabelAnchor())\n .each(function(d, i) {\n renderChromosomeSetLabel(d, i, this, ideo);\n });\n}\n\nfunction appendChromosomeLabels(ideo) {\n var layout = ideo._layout;\n\n d3.selectAll(ideo.selector + ' .chromosome-set')\n .each(function(a, chrSetIndex) {\n d3.select(this).selectAll('.chromosome')\n .append('text')\n .attr('class', 'chrLabel')\n .attr('transform', layout.getChromosomeSetLabelTranslate())\n .attr('x', function(d, i) {\n return layout.getChromosomeLabelXPosition(i);\n })\n .attr('y', function(d, i) {\n return layout.getChromosomeLabelYPosition(i);\n })\n .text(function(d, chrIndex) {\n return ideo._ploidy.getAncestor(chrSetIndex, chrIndex);\n })\n .attr('text-anchor', 'middle');\n });\n}\n\n/**\n * Draws labels for each chromosome, e.g. \"1\", \"2\", \"X\".\n * If ideogram configuration has 'fullChromosomeLabels: True',\n * then labels includes name of taxon, which can help when\n * depicting orthologs.\n */\nfunction drawChromosomeLabels() {\n var ideo = this;\n appendChromosomeSetLabels(ideo);\n appendChromosomeLabels(ideo);\n}\n\nfunction getLabelPositionAttrs(scale) {\n var x, y, scaleSvg;\n\n if (\n typeof (scale) !== 'undefined' &&\n scale.hasOwnProperty('x') &&\n !(scale.x === 1 && scale.y === 1)\n ) {\n scaleSvg = 'scale(' + scale.x + ',' + scale.y + ')';\n x = -6;\n y = (scale === '' ? -16 : -14);\n } else {\n x = -8;\n y = -16;\n scale = {x: 1, y: 1};\n scaleSvg = '';\n }\n\n return {x: x, y: y, scaleSvg: scaleSvg, scale: scale};\n}\n\nfunction updateChrIndex(chrIndex, config) {\n if (config.numAnnotTracks > 1 || config.orientation === '') chrIndex -= 1;\n return chrIndex;\n}\n\nfunction rotateVerticalChromosomeLabels(chr, chrIndex, labelPosAttrs, ideo) {\n var chrMargin2, chrMargin, y,\n config = ideo.config;\n\n chrIndex = updateChrIndex(chrIndex, config);\n\n chrMargin2 = -4;\n if (config.showBandLabels === true) {\n chrMargin2 = config.chrMargin + config.chrWidth + 26;\n }\n\n chrMargin = config.chrMargin * chrIndex;\n if (config.numAnnotTracks > 1 === false) chrMargin += 1;\n\n y = chrMargin + chrMargin2;\n\n chr.selectAll('text.chrLabel')\n .attr('transform', labelPosAttrs.scaleSvg)\n .selectAll('tspan')\n .attr('x', labelPosAttrs.x)\n .attr('y', y);\n}\n\nfunction rotateHorizontalChromosomeLabels(chr, chrIndex, labelPosAttrs, ideo) {\n var chrMargin, chrMargin2, tracksHeight, x,\n config = ideo.config;\n\n chrMargin2 = -config.chrWidth - 2;\n if (config.showBandLabels === true) chrMargin2 = config.chrMargin + 8;\n\n tracksHeight = config.annotTracksHeight;\n if (config.annotationsLayout !== 'overlay') tracksHeight *= 2;\n\n chrMargin = config.chrMargin * chrIndex;\n x = -(chrMargin + chrMargin2) + 3 + tracksHeight;\n x /= labelPosAttrs.scale.x;\n\n chr.selectAll('text.chrLabel')\n .attr('transform', 'rotate(-90)' + labelPosAttrs.scaleSvg)\n .selectAll('tspan')\n .attr('x', x)\n .attr('y', labelPosAttrs.y);\n}\n\n/**\n * Rotates chromosome labels by 90 degrees, e.g. upon clicking a chromosome.\n */\nfunction rotateChromosomeLabels(chr, chrIndex, orientation, scale) {\n var labelPosAttrs,\n ideo = this;\n\n chrIndex -= 1;\n\n labelPosAttrs = getLabelPositionAttrs(scale);\n\n if (orientation === 'vertical' || orientation === '') {\n rotateVerticalChromosomeLabels(chr, chrIndex, labelPosAttrs, ideo);\n } else {\n rotateHorizontalChromosomeLabels(chr, chrIndex, labelPosAttrs, ideo);\n }\n}\n\nexport {drawChromosomeLabels, rotateChromosomeLabels};\n","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","/**!\n* tippy.js v6.3.7\n* (c) 2017-2021 atomiks\n* MIT License\n*/\nimport { createPopper, applyStyles } from '@popperjs/core';\n\nvar ROUND_ARROW = '';\nvar BOX_CLASS = \"tippy-box\";\nvar CONTENT_CLASS = \"tippy-content\";\nvar BACKDROP_CLASS = \"tippy-backdrop\";\nvar ARROW_CLASS = \"tippy-arrow\";\nvar SVG_ARROW_CLASS = \"tippy-svg-arrow\";\nvar TOUCH_OPTIONS = {\n passive: true,\n capture: true\n};\nvar TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {\n return document.body;\n};\n\nfunction hasOwnProperty(obj, key) {\n return {}.hasOwnProperty.call(obj, key);\n}\nfunction getValueAtIndexOrReturn(value, index, defaultValue) {\n if (Array.isArray(value)) {\n var v = value[index];\n return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;\n }\n\n return value;\n}\nfunction isType(value, type) {\n var str = {}.toString.call(value);\n return str.indexOf('[object') === 0 && str.indexOf(type + \"]\") > -1;\n}\nfunction invokeWithArgsOrReturn(value, args) {\n return typeof value === 'function' ? value.apply(void 0, args) : value;\n}\nfunction debounce(fn, ms) {\n // Avoid wrapping in `setTimeout` if ms is 0 anyway\n if (ms === 0) {\n return fn;\n }\n\n var timeout;\n return function (arg) {\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n fn(arg);\n }, ms);\n };\n}\nfunction removeProperties(obj, keys) {\n var clone = Object.assign({}, obj);\n keys.forEach(function (key) {\n delete clone[key];\n });\n return clone;\n}\nfunction splitBySpaces(value) {\n return value.split(/\\s+/).filter(Boolean);\n}\nfunction normalizeToArray(value) {\n return [].concat(value);\n}\nfunction pushIfUnique(arr, value) {\n if (arr.indexOf(value) === -1) {\n arr.push(value);\n }\n}\nfunction unique(arr) {\n return arr.filter(function (item, index) {\n return arr.indexOf(item) === index;\n });\n}\nfunction getBasePlacement(placement) {\n return placement.split('-')[0];\n}\nfunction arrayFrom(value) {\n return [].slice.call(value);\n}\nfunction removeUndefinedProps(obj) {\n return Object.keys(obj).reduce(function (acc, key) {\n if (obj[key] !== undefined) {\n acc[key] = obj[key];\n }\n\n return acc;\n }, {});\n}\n\nfunction div() {\n return document.createElement('div');\n}\nfunction isElement(value) {\n return ['Element', 'Fragment'].some(function (type) {\n return isType(value, type);\n });\n}\nfunction isNodeList(value) {\n return isType(value, 'NodeList');\n}\nfunction isMouseEvent(value) {\n return isType(value, 'MouseEvent');\n}\nfunction isReferenceElement(value) {\n return !!(value && value._tippy && value._tippy.reference === value);\n}\nfunction getArrayOfElements(value) {\n if (isElement(value)) {\n return [value];\n }\n\n if (isNodeList(value)) {\n return arrayFrom(value);\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return arrayFrom(document.querySelectorAll(value));\n}\nfunction setTransitionDuration(els, value) {\n els.forEach(function (el) {\n if (el) {\n el.style.transitionDuration = value + \"ms\";\n }\n });\n}\nfunction setVisibilityState(els, state) {\n els.forEach(function (el) {\n if (el) {\n el.setAttribute('data-state', state);\n }\n });\n}\nfunction getOwnerDocument(elementOrElements) {\n var _element$ownerDocumen;\n\n var _normalizeToArray = normalizeToArray(elementOrElements),\n element = _normalizeToArray[0]; // Elements created via a