UNPKG

auspice

Version:

Web app for visualizing pathogen evolution

2 lines 230 kB
/*! For license information please see auspice.chunk.805.bundle.3a36ef8022f2723d6798.js.LICENSE.txt */
(self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[805],{67016(e,t){var n,r;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),o={},a=0,s={parse:function(n,r){var i=(r=r||{}).dynamicTyping||!1;if(E(i)&&(r.dynamicTypingFunction=i,i={}),r.dynamicTyping=i,r.transform=!!E(r.transform)&&r.transform,r.worker&&s.WORKERS_SUPPORTED){var l=function(){if(!s.WORKERS_SUPPORTED)return!1;var n,r,i=(n=t.URL||t.webkitURL||null,r=e.toString(),s.BLOB_URL||(s.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(i);return l.onmessage=g,l.id=a++,o[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var c=null;return s.NODE_STREAM_INPUT,"string"==typeof n?c=r.download?new u(r):new p(r):!0===n.readable&&E(n.read)&&E(n.on)?c=new d(r):(t.File&&n instanceof File||n instanceof Object)&&(c=new h(r)),c.stream(n)},unparse:function(e,t){var n=!1,r=!0,o=",",a="\r\n",l='"',c=l+l,u=!1,h=null,p=!1;!function(){if("object"==i(t)){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(o=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(a=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");h=t.columns}void 0!==t.escapeChar&&(c=t.escapeChar+l),"boolean"==typeof t.escapeFormulae&&(p=t.escapeFormulae)}}();var d=new RegExp(m(l),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,u);if("object"==i(e[0]))return f(h||Object.keys(e[0]),e,u)}else if("object"==i(e))return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==i(e.data[0])?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==i(e.data[0])||(e.data=[e.data])),f(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function f(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var s=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(s&&r){for(var c=0;c<e.length;c++)0<c&&(i+=o),i+=y(e[c],c);0<t.length&&(i+=a)}for(var u=0;u<t.length;u++){var h=s?e.length:t[u].length,p=!1,d=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(p="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&s){for(var f=[],m=0;m<h;m++){var g=l?e[m]:m;f.push(t[u][g])}p=""===f.join("").trim()}if(!p){for(var v=0;v<h;v++){0<v&&!d&&(i+=o);var b=s&&l?e[v]:v;i+=y(t[u][b],v)}u<t.length-1&&(!n||0<h&&!d)&&(i+=a)}}return i}function y(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===p&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(d,c),i="boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(r,s.BAD_DELIMITERS)||-1<r.indexOf(o)||" "===r.charAt(0)||" "===r.charAt(r.length-1);return i?l+r+l:r}}};if(s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!n&&!!t.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=y,s.ParserHandle=f,s.NetworkStreamer=u,s.FileStreamer=h,s.StringStreamer=p,s.ReadableStreamStreamer=d,t.jQuery){var l=t.jQuery;l.fn.parse=function(e){var n=e.config||{},r=[];return this.each(function(e){if("INPUT"!==l(this).prop("tagName").toUpperCase()||"file"!==l(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var i=0;i<this.files.length;i++)r.push({file:this.files[i],inputElem:this,instanceConfig:l.extend({},n)})}),o(),this;function o(){if(0!==r.length){var t,n,o,c=r[0];if(E(e.before)){var u=e.before(c.file,c.inputElem);if("object"==i(u)){if("abort"===u.action)return t=c.file,n=c.inputElem,o=u.reason,void(E(e.error)&&e.error({name:"AbortError"},t,n,o));if("skip"===u.action)return void a();"object"==i(u.config)&&(c.instanceConfig=l.extend(c.instanceConfig,u.config))}else if("skip"===u)return void a()}var h=c.instanceConfig.complete;c.instanceConfig.complete=function(e){E(h)&&h(e,c.file,c.inputElem),a()},s.parse(c.file,c.instanceConfig)}else E(e.complete)&&e.complete()}function a(){r.splice(0,1),o()}}}function c(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=w(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&E(this._config.beforeFirstChunk)){var i=this._config.beforeFirstChunk(e);void 0!==i&&(e=i)}this.isFirstChunk=!1,this._halted=!1;var o=this._partialLine+e;this._partialLine="";var a=this._handle.parse(o,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=a.meta.cursor;this._finished||(this._partialLine=o.substring(l-this._baseIndex),this._baseIndex=l),a&&a.data&&(this._rowCount+=a.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:a,workerId:s.WORKER_ID,finished:c});else if(E(this._config.chunk)&&!n){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);a=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),this._completed||!c||!E(this._config.complete)||a&&a.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||a&&a.meta.paused||this._nextChunk(),a}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),c.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=S(this._chunkLoaded,this),t.onerror=S(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+i)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function h(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),c.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=S(this._chunkLoaded,this),t.onerror=S(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var i=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,i)}var o=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:o}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function p(e){var t;c.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function d(e){c.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){c.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){c.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=S(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=S(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=S(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=S(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,n,r,i=Math.pow(2,53),o=-i,a=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,u=0,h=0,p=!1,d=!1,f=[],g={data:[],errors:[],meta:{}};if(E(e.step)){var v=e.step;e.step=function(t){if(g=t,x())S();else{if(S(),0===g.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(g.data=g.data[0],v(g,c))}}}function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function S(){if(g&&r&&(C("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<g.data.length;t++)b(g.data[t])&&g.data.splice(t--,1);return x()&&function(){if(g)if(Array.isArray(g.data[0])){for(var t=0;x()&&t<g.data.length;t++)g.data[t].forEach(n);g.data.splice(0,1)}else g.data.forEach(n);function n(t,n){E(e.transformHeader)&&(t=e.transformHeader(t,n)),f.push(t)}}(),function(){if(!g||!e.header&&!e.dynamicTyping&&!e.transform)return g;function t(t,n){var r,i=e.header?{}:[];for(r=0;r<t.length;r++){var o=r,a=t[r];e.header&&(o=r>=f.length?"__parsed_extra":f[r]),e.transform&&(a=e.transform(a,o)),a=k(o,a),"__parsed_extra"===o?(i[o]=i[o]||[],i[o].push(a)):i[o]=a}return e.header&&(r>f.length?C("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+r,h+n):r<f.length&&C("FieldMismatch","TooFewFields","Too few fields: expected "+f.length+" fields but parsed "+r,h+n)),i}var n=1;return!g.data.length||Array.isArray(g.data[0])?(g.data=g.data.map(t),n=g.data.length):g.data=t(g.data,0),e.header&&g.meta&&(g.meta.fields=f),h+=n,g}()}function x(){return e.header&&0===f.length}function k(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(a.test(e)){var t=parseFloat(e);if(o<t&&t<i)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function C(e,t,n,r){var i={type:e,code:t,message:n};void 0!==r&&(i.row=r),g.errors.push(i)}this.parse=function(i,o,a){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(m(t)+"([^]*?)"+m(t),"gm"),r=(e=e.replace(n,"")).split("\r"),i=e.split("\n"),o=1<i.length&&i[0].length<r[0].length;if(1===r.length||o)return"\n";for(var a=0,s=0;s<r.length;s++)"\n"===r[s][0]&&a++;return a>=r.length/2?"\r\n":"\r"}(i,l)),r=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter);else{var c=function(t,n,r,i,o){var a,l,c,u;o=o||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var h=0;h<o.length;h++){var p=o[h],d=0,f=0,m=0;c=void 0;for(var g=new y({comments:i,delimiter:p,newline:n,preview:10}).parse(t),v=0;v<g.data.length;v++)if(r&&b(g.data[v]))m++;else{var w=g.data[v].length;f+=w,void 0!==c?0<w&&(d+=Math.abs(w-c),c=w):c=w}0<g.data.length&&(f/=g.data.length-m),(void 0===l||d<=l)&&(void 0===u||u<f)&&1.99<f&&(l=d,a=p,u=f)}return{successful:!!(e.delimiter=a),bestDelimiter:a}}(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=s.DefaultDelimiter),g.meta.delimiter=e.delimiter}var u=w(e);return e.preview&&e.header&&u.preview++,t=i,n=new y(u),g=n.parse(t,o,a),S(),p?{meta:{paused:!0}}:g||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=E(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,n.abort(),g.meta.aborted=!0,E(e.complete)&&e.complete(g),t=""}}function m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(e){var t,n=(e=e||{}).delimiter,r=e.newline,i=e.comments,o=e.step,a=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<s.BAD_DELIMITERS.indexOf(n))&&(n=","),i===n)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||-1<s.BAD_DELIMITERS.indexOf(i))&&(i=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var u=0,h=!1;this.parse=function(e,s,p){if("string"!=typeof e)throw new Error("Input must be a string");var d=e.length,f=n.length,y=r.length,g=i.length,v=E(o),b=[],w=[],S=[],x=u=0;if(!e)return B();if(l||!1!==l&&-1===e.indexOf(t)){for(var k=e.split(r),C=0;C<k.length;C++){if(S=k[C],u+=S.length,C!==k.length-1)u+=r.length;else if(p)return B();if(!i||S.substring(0,g)!==i){if(v){if(b=[],P(S.split(n)),M(),h)return B()}else P(S.split(n));if(a&&a<=C)return b=b.slice(0,a),B(!0)}}return B()}for(var T=e.indexOf(n,u),O=e.indexOf(r,u),_=new RegExp(m(c)+m(t),"g"),j=e.indexOf(t,u);;)if(e[u]!==t)if(i&&0===S.length&&e.substring(u,u+g)===i){if(-1===O)return B();u=O+y,O=e.indexOf(r,u),T=e.indexOf(n,u)}else if(-1!==T&&(T<O||-1===O))S.push(e.substring(u,T)),u=T+f,T=e.indexOf(n,u);else{if(-1===O)break;if(S.push(e.substring(u,O)),R(O+y),v&&(M(),h))return B();if(a&&b.length>=a)return B(!0)}else for(j=u,u++;;){if(-1===(j=e.indexOf(t,j+1)))return p||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:u}),I();if(j===d-1)return I(e.substring(u,j).replace(_,t));if(t!==c||e[j+1]!==c){if(t===c||0===j||e[j-1]!==c){-1!==T&&T<j+1&&(T=e.indexOf(n,j+1)),-1!==O&&O<j+1&&(O=e.indexOf(r,j+1));var A=N(-1===O?T:Math.min(T,O));if(e[j+1+A]===n){S.push(e.substring(u,j).replace(_,t)),e[u=j+1+A+f]!==t&&(j=e.indexOf(t,u)),T=e.indexOf(n,u),O=e.indexOf(r,u);break}var L=N(O);if(e.substring(j+1+L,j+1+L+y)===r){if(S.push(e.substring(u,j).replace(_,t)),R(j+1+L+y),T=e.indexOf(n,u),j=e.indexOf(t,u),v&&(M(),h))return B();if(a&&b.length>=a)return B(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:u}),j++}}else j++}return I();function P(e){b.push(e),x=u}function N(t){var n=0;if(-1!==t){var r=e.substring(j+1,t);r&&""===r.trim()&&(n=r.length)}return n}function I(t){return p||(void 0===t&&(t=e.substring(u)),S.push(t),u=d,P(S),v&&M()),B()}function R(t){u=t,P(S),S=[],O=e.indexOf(r,u)}function B(e){return{data:b,errors:w,meta:{delimiter:n,linebreak:r,aborted:h,truncated:!!e,cursor:x+(s||0)}}}function M(){o(B()),b=[],w=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=o[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(E(n.userStep)){for(var a=0;a<t.results.data.length&&(n.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},i),!r);a++);delete t.results}else E(n.userChunk)&&(n.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&v(t.workerId,t.results)}function v(e,t){var n=o[e];E(n.userComplete)&&n.userComplete(t),n.terminate(),delete o[e]}function b(){throw new Error("Not implemented.")}function w(e){if("object"!=i(e)||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=w(e[n]);return t}function S(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===s.WORKER_ID&&n&&(s.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:s.WORKER_ID,results:s.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=s.parse(n.input,n.config);r&&t.postMessage({workerId:s.WORKER_ID,results:r,finished:!0})}}),(u.prototype=Object.create(c.prototype)).constructor=u,(h.prototype=Object.create(c.prototype)).constructor=h,(p.prototype=Object.create(p.prototype)).constructor=p,(d.prototype=Object.create(c.prototype)).constructor=d,s},void 0===(r=n.apply(t,[]))||(e.exports=r)},75805(e,t,n){var r,i,o,a;function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}e=n.nmd(e),a=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==s(e)&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){e.exports=n(2)()},function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(3);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=n(0),a=n.n(o),l=function(e){return 0!==e};function c(e){return(c="function"==typeof Symbol&&"symbol"==s(Symbol.iterator)?function(e){return s(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":s(e)})(e)}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(r,e);var t,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?p(e):t}(this,n)}}(r);function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),f(p(t=n.call(this,e)),"continueOpenCollapsible",function(){var e=p(t).innerRef;t.setState({height:e.scrollHeight,transition:"height ".concat(t.props.transitionTime,"ms ").concat(t.props.easing),isClosed:!1,hasBeenOpened:!0,inTransition:l(e.scrollHeight),shouldOpenOnNextCycle:!1})}),f(p(t),"handleTriggerClick",function(e){t.props.triggerDisabled||t.state.inTransition||(e.preventDefault(),t.props.handleTriggerClick?t.props.handleTriggerClick(t.props.accordionPosition):!0===t.state.isClosed?(t.openCollapsible(),t.props.onOpening(),t.props.onTriggerOpening()):(t.closeCollapsible(),t.props.onClosing(),t.props.onTriggerClosing()))}),f(p(t),"handleTransitionEnd",function(e){e.target===t.innerRef&&(t.state.isClosed?(t.setState({inTransition:!1}),t.props.onClose()):(t.setState({height:"auto",overflow:t.props.overflowWhenOpen,inTransition:!1}),t.props.onOpen()))}),f(p(t),"setInnerRef",function(e){return t.innerRef=e}),t.timeout=void 0,t.contentId="collapsible-content-".concat(Date.now()),t.triggerId=e.triggerElementProps.id||"collapsible-trigger-".concat(Date.now()),e.open?t.state={isClosed:!1,shouldSwitchAutoOnNextCycle:!1,height:"auto",transition:"none",hasBeenOpened:!0,overflow:e.overflowWhenOpen,inTransition:!1}:t.state={isClosed:!0,shouldSwitchAutoOnNextCycle:!1,height:0,transition:"height ".concat(e.transitionTime,"ms ").concat(e.easing),hasBeenOpened:!1,overflow:"hidden",inTransition:!1},t}return(t=[{key:"componentDidUpdate",value:function(e,t){var n=this;this.state.shouldOpenOnNextCycle&&this.continueOpenCollapsible(),"auto"!==t.height&&0!==t.height||!0!==this.state.shouldSwitchAutoOnNextCycle||(window.clearTimeout(this.timeout),this.timeout=window.setTimeout(function(){n.setState({height:0,overflow:"hidden",isClosed:!0,shouldSwitchAutoOnNextCycle:!1})},50)),e.open!==this.props.open&&(!0===this.props.open?(this.openCollapsible(),this.props.onOpening()):(this.closeCollapsible(),this.props.onClosing()))}},{key:"componentWillUnmount",value:function(){window.clearTimeout(this.timeout)}},{key:"closeCollapsible",value:function(){var e=this.innerRef;this.setState({shouldSwitchAutoOnNextCycle:!0,height:e.scrollHeight,transition:"height ".concat(this.props.transitionCloseTime?this.props.transitionCloseTime:this.props.transitionTime,"ms ").concat(this.props.easing),inTransition:l(e.scrollHeight)})}},{key:"openCollapsible",value:function(){this.setState({inTransition:l(this.innerRef.scrollHeight),shouldOpenOnNextCycle:!0})}},{key:"renderNonClickableTriggerElement",value:function(){return this.props.triggerSibling&&"string"==typeof this.props.triggerSibling?i.a.createElement("span",{className:"".concat(this.props.classParentString,"__trigger-sibling")},this.props.triggerSibling):this.props.triggerSibling&&"function"==typeof this.props.triggerSibling?this.props.triggerSibling():this.props.triggerSibling?i.a.createElement(this.props.triggerSibling,null):null}},{key:"render",value:function(){var e=this,t={height:this.state.height,WebkitTransition:this.state.transition,msTransition:this.state.transition,transition:this.state.transition,overflow:this.state.overflow},n=this.state.isClosed?"is-closed":"is-open",r=this.props.triggerDisabled?"is-disabled":"",o=!1===this.state.isClosed&&void 0!==this.props.triggerWhenOpen?this.props.triggerWhenOpen:this.props.trigger,a=this.props.contentContainerTagName,s=this.props.triggerTagName,l=this.props.lazyRender&&!this.state.hasBeenOpened&&this.state.isClosed&&!this.state.inTransition?null:this.props.children,c=this.props,h=c.classParentString,p=c.contentOuterClassName,d=c.contentInnerClassName,f="".concat(h,"__trigger ").concat(n," ").concat(r," ").concat(this.state.isClosed?this.props.triggerClassName:this.props.triggerOpenedClassName),m="".concat(h," ").concat(this.state.isClosed?this.props.className:this.props.openedClassName),y="".concat(h,"__contentOuter ").concat(p),g="".concat(h,"__contentInner ").concat(d);return i.a.createElement(a,u({className:m.trim()},this.props.containerElementProps),i.a.createElement(s,u({id:this.triggerId,className:f.trim(),onClick:this.handleTriggerClick,style:this.props.triggerStyle&&this.props.triggerStyle,onKeyPress:function(t){var n=t.key;(" "===n&&"button"!==e.props.triggerTagName.toLowerCase()||"Enter"===n)&&e.handleTriggerClick(t)},tabIndex:this.props.tabIndex&&this.props.tabIndex,"aria-expanded":!this.state.isClosed,"aria-disabled":this.props.triggerDisabled,"aria-controls":this.contentId,role:"button"},this.props.triggerElementProps),o),this.renderNonClickableTriggerElement(),i.a.createElement("div",{id:this.contentId,className:y.trim(),style:t,onTransitionEnd:this.handleTransitionEnd,ref:this.setInnerRef,hidden:this.props.contentHiddenWhenClosed&&this.state.isClosed&&!this.state.inTransition,role:"region","aria-labelledby":this.triggerId},i.a.createElement("div",{className:g.trim()},l)))}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(r.Component);m.propTypes={transitionTime:a.a.number,transitionCloseTime:a.a.number,triggerTagName:a.a.string,easing:a.a.string,open:a.a.bool,containerElementProps:a.a.object,triggerElementProps:a.a.object,classParentString:a.a.string,className:a.a.string,openedClassName:a.a.string,triggerStyle:a.a.object,triggerClassName:a.a.string,triggerOpenedClassName:a.a.string,contentOuterClassName:a.a.string,contentInnerClassName:a.a.string,accordionPosition:a.a.oneOfType([a.a.string,a.a.number]),handleTriggerClick:a.a.func,onOpen:a.a.func,onClose:a.a.func,onOpening:a.a.func,onClosing:a.a.func,onTriggerOpening:a.a.func,onTriggerClosing:a.a.func,trigger:a.a.oneOfType([a.a.string,a.a.element]),triggerWhenOpen:a.a.oneOfType([a.a.string,a.a.element]),triggerDisabled:a.a.bool,lazyRender:a.a.bool,overflowWhenOpen:a.a.oneOf(["hidden","visible","auto","scroll","inherit","initial","unset"]),contentHiddenWhenClosed:a.a.bool,triggerSibling:a.a.oneOfType([a.a.element,a.a.func]),tabIndex:a.a.number,contentContainerTagName:a.a.string,children:a.a.oneOfType([a.a.string,a.a.element])},m.defaultProps={transitionTime:400,transitionCloseTime:null,triggerTagName:"span",easing:"linear",open:!1,classParentString:"Collapsible",triggerDisabled:!1,lazyRender:!1,overflowWhenOpen:"hidden",contentHiddenWhenClosed:!1,openedClassName:"",triggerStyle:null,triggerClassName:"",triggerOpenedClassName:"",contentOuterClassName:"",contentInnerClassName:"",className:"",triggerSibling:null,onOpen:function(){},onClose:function(){},onOpening:function(){},onClosing:function(){},onTriggerOpening:function(){},onTriggerClosing:function(){},tabIndex:null,contentContainerTagName:"div",triggerElementProps:{}},t.default=m}])},"object"==s(t)&&"object"==s(e)?e.exports=a(n(78281)):(i=[n(78281)],void 0===(o="function"==typeof(r=a)?r.apply(t,i):r)||(e.exports=o))},8791(e,t,n){"use strict";n.d(t,{Ay:()=>x,DC:()=>O,gd:()=>k});var r=n(78281),i=n(49633),o=n(98807),a=n(28355),s=n(51914),l=n.n(s),c=n(41930),u=n(51924),h=n(60516),p=n(5300);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return g(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w(e,t,n){return(t=function(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){return e.map(function(e,t){return b(b({},e),{},{id:t})})}function E(e){return e.map(function(e){return delete e.id,e})}function x(e){var t=e.dismissModal,n=(0,o.B)().t,a=(0,i.wA)(),s=(0,i.d4)(function(e){return e.metadata});if(!s.loaded)throw new Error("[INTERNAL ERROR] metadata state not loaded");var c=s.legendPlacements,d=m((0,r.useState)(S(s.maintainers||[])),2),f=d[0],y=d[1],g=m((0,r.useState)(S(s.dataProvenance||[])),2),v=g[0],b=g[1],w=(0,r.useRef)(null);return(0,r.useEffect)(function(){return l().bind("enter",function(){var e;null===(e=w.current)||void 0===e||e.requestSubmit()}),l().bind("escape",function(){t()}),function(){l().unbind("enter"),l().unbind("escape")}},[t]),r.createElement(p.EJ,{ref:w,onSubmit:function(e){e.preventDefault();var n=Object.fromEntries(Object.keys(c).map(function(t){return[t,(n=e.target["".concat(t,"Legend")].value,r=m(n.split(" "),2),i=r[0],o=r[1],function(e){switch(e){case"top":case"bottom":return;default:throw new Error("Invalid vertical string ".concat(e))}}(i),function(e){switch(e){case"left":case"right":return;default:throw new Error("Invalid horizontal string ".concat(e))}}(o),{vertical:i,horizontal:o})];var n,r,i,o}));a((0,u.D)({edited:!0,title:e.currentTarget.datasetTitle.value,updated:e.currentTarget.updated.value,buildUrl:e.currentTarget.buildUrl.value,buildAvatar:e.currentTarget.avatarUrl.value.trim()||void 0,warning:e.currentTarget.warning.value.trim()||void 0,description:e.currentTarget.description.value,maintainers:E(f),dataProvenance:E(v),legendPlacements:n},!0,!1)),t()}},r.createElement("div",{className:"row"},r.createElement("div",{className:"col-sm-6"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Dataset title"),":",r.createElement("br",null),r.createElement("input",{name:"datasetTitle",type:"text",defaultValue:s.title||""}))),r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Date updated"),":",r.createElement("br",null),r.createElement("input",{name:"updated",type:"date",defaultValue:s.updated||""})))),r.createElement("div",{className:"row"},r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Build URL"),":",r.createElement("br",null),r.createElement("input",{name:"buildUrl",type:"url",defaultValue:s.buildUrl||""}))),r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Avatar URL"),":",r.createElement("br",null),r.createElement("input",{name:"avatarUrl",type:"url",defaultValue:s.buildAvatar||""})))),r.createElement(C,{name:"maintainers",data:f,setData:y}),r.createElement(C,{name:"data provenances",data:v,setData:b})),r.createElement("div",{className:"col-sm-6"},r.createElement("label",null,n("Warning"),":",r.createElement("br",null),r.createElement("textarea",{name:"warning",defaultValue:s.warning||""})),r.createElement("label",null,n("Description"),":",r.createElement("br",null),r.createElement("textarea",{rows:10,name:"description",defaultValue:s.description||""})),r.createElement(T,{defaultPlacements:s.legendPlacements}))),r.createElement(h.A,{justifyContent:"center"},r.createElement("button",{type:"submit",style:{margin:10}},n("Apply changes")),r.createElement("button",{type:"button",style:{margin:10},onClick:t},n("Discard changes"))))}var k={container:function(e){return e.backgroundColor="rgba(0, 0, 0, .30)",e},panel:function(e,t){return e.width=t.width-100,e.maxWidth=e.width,e.height=t.height-200,e.maxHeight=e.height,e.padding="2em",e.color="#1f2328",e.backgroundColor="#ffffff",e}};function C(e){var t=e.name,n=e.data,i=e.setData,s=(0,o.B)().t,l=(0,r.useRef)(n.length);function c(e){i(f(n).map(function(t){return t.id===e.id?e:t}))}return r.createElement(r.Fragment,null,r.createElement("div",{className:"row"},r.createElement("div",{className:"col-xs-12 underlined"},s(t),":")),n.map(function(e){return r.createElement(h.A,{key:e.id},r.createElement("div",{className:"col-xs-6"},r.createElement("label",null,s("Name"),":",r.createElement("br",null),r.createElement("input",{required:!0,type:"text",value:e.name,onChange:function(t){return c(b(b({},e),{},{name:t.currentTarget.value}))}}))),r.createElement("div",{className:"col-xs-5"},r.createElement("label",null,s("URL"),":",r.createElement("br",null),r.createElement("input",{type:"url",value:e.url,onChange:function(t){return c(b(b({},e),{},{url:t.currentTarget.value}))}}))),r.createElement("div",{className:"col-xs-1"},r.createElement("button",{type:"button",onClick:function(){return t=e.id,void i(f(n).filter(function(e){return e.id!==t}));var t}},r.createElement(a.RCe,null))))}),r.createElement(h.A,null,r.createElement("button",{type:"button",onClick:function(){var e={id:l.current,name:"",url:""};l.current++,i([].concat(f(n),[e]))}},s("Add ".concat(t)))))}function T(e){var t=e.defaultPlacements,n=(0,o.B)().t,i=["top left","top right","bottom left","bottom right"],a=Object.fromEntries(Object.entries(t).map(function(e){var t,n=m(e,2);return[n[0],(t=n[1],"".concat(t.vertical," ").concat(t.horizontal))]}));return r.createElement(r.Fragment,null,r.createElement("div",{className:"underlined"},n("Legend placement")),r.createElement(h.A,{justifyContent:"space-around"},Object.keys(a).map(function(e){return r.createElement("div",{key:e},n("".concat(e," panel")),i.map(function(t){return r.createElement(h.A,{key:t,justifyContent:"flex-start",alignContent:"center",style:{margin:"0.25em 1em"}},r.createElement("input",{id:"".concat(e,"-").concat(t),name:"".concat(e,"Legend"),type:"radio",value:t,defaultChecked:a[e]===t}),r.createElement("label",{htmlFor:"".concat(e,"-").concat(t)},n(t)))}))})))}function O(){return!(!(0,c.Q)("enableDatasetEditor")||!(0,c.u)("enableDatasetEditor"))}},5300(e,t,n){"use strict";n.d(t,{EJ:()=>o,qF:()=>a});var r=n(77313),i=r.Ay.form.withConfig({displayName:"styles__Form",componentId:"sc-10gz0g0-0"})(["height:100%;width:100%;display:flex;flex-direction:column;justify-content:space-evenly;align-items:stretch;*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}button{display:inline-flex;justify-content:center;align-items:center;padding:0.3em;}"]),o=(0,r.Ay)(i).withConfig({displayName:"styles__DatasetEditorForm",componentId:"sc-10gz0g0-1"})(["input:not([type=radio]){margin-bottom:1em;width:100%;}input[type=radio]{margin-right:0.2em;}textarea{margin-bottom:1em;width:100%;resize:vertical;min-height:1.5em;max-height:50em;}.underlined{margin-bottom:1em;text-decoration:underline;}.radio{width:100%;display:inline-flex;align-items:center;margin:0.25em 1em;}"]),a=(0,r.Ay)(i).withConfig({displayName:"styles__ColorByEditorForm",componentId:"sc-10gz0g0-2"})(['input[type="color"]{width:25px;height:25px;margin-right:1em;padding:0;border:3px solid;}input[type="color"]::-moz-color-swatch{border:none;}input[type="color"]::-webkit-color-swatch-wrapper{padding:0;border-radius:0;}input[type="color"]::-webkit-color-swatch{border:none;}'])},22796(e,t,n){"use strict";n.d(t,{P:()=>w,u:()=>v});var r=n(78281),i=n(49633),o=n(98807),a=n(77313),s=n(98598),l=n(40952),c=n(4124),u=n(69138),h=n(85053),p=n(93681),d=(0,a.SL)(s.bg),f=(0,a.SL)(s.wC),m=(0,a.SL)(s.W8),y=(0,a.SL)(s.jG),g=25,v=function(e){var t,n,a,s,c=e.relevantPublications,v=(0,i.d4)(function(e){return e}),S=(0,i.wA)(),E=(0,o.B)().t,x=v.metadata.mainTreeNumTips,k=(0,p.gY)(v.tree.nodes,v.tree.visibility),C=k!==x,T=w(),O="num_date"===v.controls.distanceMeasure,_=(null===(t=v.entropy)||void 0===t?void 0:t.selectedCds)===l.Sc?"nucleotide":"codon";return r.createElement(r.Fragment,null,r.createElement("div",{style:{fontWeight:500,marginTop:"0px",marginBottom:"20px"}},"Downloaded data represents the currently displayed view. By zooming the tree, changing the branch-length metric, applying filters etc, the downloaded data will change accordingly.",r.createElement("p",null),"NOTE: We do not support downloads of multiple subtrees, which are usually created with the date range filter or genotype filters. Downloading multiple subtrees will result in an empty Newick tree!",r.createElement("p",null),C?"Currently ".concat(k,"/").concat(x," tips are displayed and will be downloaded."):"Currently the entire dataset (".concat(x," tips) will be downloaded.")),v.metadata.sharing.dataset_json&&r.createElement(b,{name:"Auspice (Nextstrain) JSON",description:"The main Auspice dataset JSON with the current view as the display default.",icon:r.createElement(y,{width:g,selected:!0}),onClick:function(){return u.hO(S,v,T)}}),v.metadata.sharing.trees&&r.createElement(r.Fragment,null,r.createElement(b,{name:"".concat(O?"TimeTree":"Tree"," (Newick)"),description:"Phylogenetic tree in Newick format with branch lengths in units of ".concat(O?"years":"divergence","."),icon:r.createElement(d,{width:g,selected:!0}),onClick:function(){return u.D4({isNewick:!0,dispatch:S,filePrefix:T,tree:v.tree,temporal:O})}}),r.createElement(b,{name:"".concat(O?"TimeTree":"Tree"," (Nexus)"),description:"Phylogeny in Nexus format with branch lengths in units of ".concat(O?"years":"divergence",". Colorings are included as annotations."),icon:r.createElement(d,{width:g,selected:!0}),onClick:function(){return u.D4({dispatch:S,filePrefix:T,tree:v.tree,colorings:v.metadata.colorings,colorBy:v.controls.colorBy,temporal:O})}})),v.metadata.sharing.gisaid_acknowledgments&&r.createElement(b,{name:"Acknowledgments (TSV)",description:"Per-sample acknowledgments (n = ".concat(k,")."),icon:r.createElement(m,{width:g,selected:!0}),onClick:function(){return u.AS(S,T,v.tree.nodes,v.tree.visibility)}}),v.metadata.sharing.metadata_tsv&&r.createElement(b,{name:"Metadata (TSV)",description:"Per-sample metadata (n = ".concat(k,")."),icon:r.createElement(m,{width:g,selected:!0}),onClick:function(){return u.tO(S,T,v.tree.nodes,v.tree.visibility)}}),v.metadata.sharing.authors&&u.Gh(v.tree)&&r.createElement(b,{name:"Author Metadata (TSV)",description:"Metadata for ".concat(k," samples grouped by their ").concat((n=v.tree.nodes,a=v.tree.visibility,s=new Set(n.filter(function(e,t){return a[t]===l.uU&&e.shell.inView}).map(function(e){return(0,h.tg)(e)}).filter(function(e){return e&&e.value}).map(function(e){return e.value})),s.size)," authors."),icon:r.createElement(m,{width:g,selected:!0}),onClick:function(){return u.Rj(S,T,v.tree)}}),v.metadata.sharing.entropy&&v.entropy.loaded&&r.createElement(b,{name:"Genetic diversity data (TSV)",description:"The data behind the diversity panel showing ".concat(v.entropy.showCounts?"a count of changes across the tree":"normalised shannon entropy"," per ").concat(_,"."),icon:r.createElement(m,{width:g,selected:!0}),onClick:function(){return u.xz(S,T,v.entropy)}}),v.metadata.sharing.screenshot&&r.createElement(b,{name:"Screenshot (SVG)",description:"Screenshot of the current nextstrain display in SVG format; CC-BY licensed.",icon:r.createElement(f,{width:g,selected:!0}),onClick:function(){return u.t4(S,E,v.metadata,v.tree.nodes,v.tree.visibility,w(),v.controls.panelsToDisplay,v.controls.panelLayout.panelLayout,c)}}))};function b(e){var t=e.name,n=e.description,i=e.icon,o=e.onClick,a=Object.assign({},c.u0,{backgroundColor:"rgba(0,0,0,0)",paddingLeft:"10px",color:"white",minWidth:"300px",textAlign:"left"});return r.createElement("div",{key:t,onClick:o,style:{cursor:"pointer"}},i,r.createElement("button",{style:a,name:t},t),r.createElement("div",{style:{display:"inline-block",height:"30px",verticalAlign:"top",paddingTop:"6px"}},r.createElement("label",{style:{fontStyle:"italic",fontSize:"14px",color:"lightgray"},htmlFor:t},n)))}function w(){return"nextstrain_"+window.location.pathname.replace(/^\//,"").replace(/:/g,"-").replace(/\//g,"_")}},57900(e,t,n){"use strict";n.d(t,{A:()=>w,M:()=>v});var r,i=n(78281),o=n(49633),a=n(69646),s=n(4124),l=n(17904),c=n(43153),u=n(22796);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function d(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function m(e){var t=y();return function(){var n,r=g(e);if(t){var i=g(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}var v={nextstrain:{author:"Hadfield et al",title:"Nextstrain: real-time tracking of pathogen evolution",year:"2018",journal:"Bioinformatics",href:"https://doi.org/10.1093/bioinformatics/bty407"},treetime:{author:"Sagulenko et al",title:"TreeTime: Maximum-likelihood phylodynamic analysis",journal:"Virus Evolution",year:"2017",href:"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5758920/"},titers:{author:"Neher et al",titleJournalYear:"Prediction, dynamics, and visualization of antigenic phenotypes of seasonal influenza viruses",journal:"PNAS",year:"2016",href:"http://www.pnas.org/content/113/12/E1701.abstract"}},b=(0,o.Ng)(function(e){return{colorBy:e.controls.colorBy,metadata:e.metadata,nodes:e.tree.nodes,visibility:e.tree.visibility}})(r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(o,e);var t,n,r=m(o);function o(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),r.apply(this,arguments)}return t=o,n=[{key:"getRelevantPublications",value:function(){var e=[v.nextstrain,v.treetime];return-1!==["cTiter","rb","ep","ne"].indexOf(this.props.colorBy)&&e.push(v.titers),e}},{key:"formatPublications",value:function(e){return i.createElement("span",null,i.createElement("ul",null,e.map(function(e){return i.createElement("li",{key:e.href},i.createElement("a",{href:e.href,target:"_blank",rel:"noreferrer noopener"},e.author,", ",e.title,", ",i.createElement("i",null,e.journal)," (",e.year,")"))})))}},{key:"render",value:function(){var e=this.props,t=e.t,n=e.metadata,r=this.getRelevantPublications();return i.createElement(i.Fragment,null,i.createElement("div",{style:s.vS.modalSubheading},n.title," (",t("last updated")," ",n.updated,")"),i.createElement("div",null,(0,c.jL)({mainTreeNumTips:this.props.metadata.mainTreeNumTips,nodes:this.props.nodes,visibility:this.props.visibility,t:this.props.t})),i.createElement("div",{style:s.vS.break})," "+t("A full list of sequence authors is available via the TSV files below"),i.createElement("div",{style:s.vS.break}),i.createElement("div",{style:s.vS.modalSubheading},t("Data usage policy")),t("Data usage part 1")+" "+t("Data usage part 2"),i.createElement("div",{style:s.vS.modalSubheading},t("Please cite the authors who contributed genomic data (where relevant), as well as")+":"),this.formatPublications(r),i.createElement("div",{style:s.vS.modalSubheading},t("Download data"),":"),i.createElement("div",{style:{display:"block",justifyContent:"space-around",marginLeft:"25px",width:"100%"}},i.createElement("div",{style:{width:"100%"}},i.createElement(u.u,{relevantPublications:r}))),n.description&&i.createElement(i.Fragment,null,i.createElement("div",{style:s.vS.modalSubheading},t("Dataset description"),":"),i.createElement(l.w,{md:n.description})))}}],n&&p(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(i.Component))||r;const w=(0,a.C)()(b)},69138(e,t,n){"use strict";n.d(t,{t4:()=>D,AS:()=>L,Gh:()=>_,hO:()=>z,Rj:()=>j,xz:()=>F,D4:()=>I,tO:()=>A});var r=n(67016),i=n(479),o=n(89270),a=n(85053),s=n(61373),l=n(40952),c=n(43153),u=n(21143),h=n(18544),p=n(4941);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e,t,n){return(t=function(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){var t=(e.nodes[0].children||[]).map(function e(t){var n,r={};return t.name&&(r.name=t.name),t.node_attrs&&(r.node_attrs=t.node_attrs),t.branch_attrs&&(r.branch_attrs=t.branch_attrs),null!==(n=t.children)&&void 0!==n&&n.length&&(r.children=t.children.map(e)),r});return 1===t.length?t[0]:t}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||w(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=w(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function w(e,t){if(e){if("string"==typeof e)return S(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function E(e,t,n){return(t=function(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){return Object.prototype.hasOwnProperty.call(e,"paper_url")&&!e.paper_url.endsWith("/")&&"?"!==e.paper_url},k=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return""},i=t?function(e){return(0,a.hu)(e,"num_date")}:a.Ue,o=e.nodes[e.idxOfFilteredRoot||e.idxOfInViewRootNode],s=function t(o,a){if(!o.shell.inView||e.visibility[o.arrayIdx]!==l.uU)return"";if(o.hasChildren){var s=o.children.map(function(e){return t(e,i(o))});return"(".concat(s.filter(function(e){return!!e}).join(","),")")+"".concat(n?o.name:"").concat(r(o),":").concat(i(o)-a)}return"".concat(o.name).concat(r(o),":").concat(i(o)-a)}(o,i(o));if(!s)throw new h.Vz;return s+";"},C="text/tab-separated-values;charset=utf-8;",T=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,r.unparse)(e,{quotes:!1,quoteChar:'"',escapeChar:'"',delimiter:"\t",header:!0,newline:"\n",skipEmptyLines:!0,columns:t})},O=function(e,t,n){var r=new Blob([n],{type:t}),i=document.createElement("a"),o=URL.createObjectURL(r);i.setAttribute("href",o),i.setAttribute("download",e),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i)},_=function(e){for(var t=0;t<e.nodes.length;t++)if((0,a.tg)(e.nodes[t]))return!0;return!1},j=function(e,t,n){var r="n (strains)",o="unknown",s={};n.nodes.filter(function(e,t){return n.visibility[t]===l.uU&&e.shell.inView}).filter(function(e){return!e.hasChildren}).forEach(function(e){var t,n=(0,a.tg)(e);n&&(s[n.value]?(s[n.value][r]+=1,s[n.value].strains.push(e.name)):s[n.value]=(E(t={Author:n.value,"publication title":n.title||o,journal:n.journal||o,"publication URL":x(n)?n.paper_url:o},r,1),E(t,"strains",[e.name]),t))});var c=["Author",r,"publication title","journal","publication URL","strains"],u=t+"_authors.tsv";O(u,C,T(Object.values(s),c)),e((0,i.W7)({message:"Author metadata exported",details:u}))},A=function(e,t,n,r){var o,c={},u=["strain"],h=b(n.entries());try{var p=function(){var e=v(o.value,2),t=e[0],n=e[1];if(n.hasChildren)return"continue";if(r[t]!==l.uU||!n.shell.inView)return"continue";if(c[n.name]={strain:n.name},!n.node_attrs)return"continue";var i=(0,a.hu)(n,"num_date");if(i){var h="date";P(u,null,h);var p=(0,a.hu)(n,"num_date",{confidence:!0});p&&p[0]!==p[1]?c[n.name][h]="".concat((0,s.bq)(i)," (").concat((0,s.bq)(p[0])," - ").concat((0,s.bq)(p[1]),")"):c[n.name][h]=(0,s.bq)(i)}var d,f=["author","div","num_date","vaccine","accession"],m=b(Object.keys(n.node_attrs).filter(function(e){return!f.includes(e)}));try{for(m.s();!(d=m.n()).done;){var y=d.value,g=(0,a.hu)(n,y);if(void 0!==g){P(u,null,y),"string"==typeof g?c[n.name][y]=g:"number"==typeof g&&(c[n.name][y]=parseFloat(g).toFixed(2));var w=(0,a.cl)(n,y);w&&(P(u,y,N(y)),c[n.name][N(y)]=w)}}}catch(e){m.e(e)}finally{m.f()}var S=(0,a.tg)(n);if(S){var E="author";P(u,null,E),c[n.name][E]=S.value,x(S)&&(P(u,E,N(E)),c[n.name][N(E)]=S.paper_url)}var k=(0,a.Qw)(n);if(k&&k.selection_date){var C="vaccine_selection_date";P(u,null,C),c[n.name][C]=k.selection_date}var T=(0,a.L$)(n);if(T.accession){var O="accession";P(u,null,O),c[n.name][O]=T.accession,T.url&&(P(u,O,N(O)),c[n.name][N(O)]=T.url)}};for(h.s();!(o=h.n()).done;)p()}catch(e){h.e(e)}finally{h.f()}var d="".concat(t,"_metadata.tsv");O(d,C,T(Object.values(c),u)),e((0,i.W7)({message:"Metadata exported to ".concat(d)}))},L=function(e,t,n,r){var o,s={},c=["strain"],u=b(n.entries());try{for(u.s();!(o=u.n()).done;){var h=v(o.value,2),p=h[0],d=h[1];if(!d.hasChildren&&r[p]===l.uU&&d.shell.inView&&(s[d.name]={strain:d.name},d.node_attrs)){for(var f=0,m=["gisaid_epi_isl","genbank_accession","originating_lab","submitting_lab"];f<m.length;f++){var y=m[f],g=(0,a.hu)(d,y);g&&(P(c,null,y),s[d.name][y]=g)}var w=(0,a.tg)(d);if(w){var S="author";P(c,null,S),s[d.name][S]=w.value,x(w)&&(P(c,S,N(S)),s[d.name][N(S)]=w.paper_url)}}}}catch(e){u.e(e)}finally{u.f()}var E="".concat(t,"_acknowledgements.tsv");O(E,C,T(Object.values(s),c)),e((0,i.W7)({message:"Acknowledgments exported to ".concat(E)}))};function P(e,t,n){if(!e.includes(n))if(null!==t){var r=e.indexOf(t);-1!==r?e.splice(r+1,0,n):console.warn("Element ".concat(t," not present in provided array"))}else e.push(n)}function N(e){return"".concat(e,"__url")}var I=function(e){var t=e.dispatch,n=e.filePrefix,r=e.tree,o=e.isNewick,s=e.temporal,l=e.colorings,c=e.colorBy;try{var p="".concat(n,"_").concat(s?"timetree":"tree",".").concat(o?"nwk":"nexus"),d=o?k(r,s):function(e,t,n,r){var i,o;return["#nexus","begin trees;","  tree one = "+k(e,r,!0,(i=function(e){return String(e).replace(/[[\]{}=,]/g,"").replace(/[\u0250-\ue007]/g,"")},o=(0,u.Sv)(n)?i(n.replace(/,/g,"/")):void 0,function(e){var n=[];if(Object.keys(t).forEach(function(t){if(!t.includes("_lab")&&!t.includes("author")){var r=(0,a.hu)(e,t);if(r){n.push("".concat(i(t),"=").concat(i(r)));var o=(0,a.hu)(e,t,{confidence:!0});Array.isArray(o)&&2===o.length&&n.push("".concat(i(t),"_CI={").concat(o.map(function(e){return i(e)}).join(","),"}"))}}}),o&&n.push("".concat(o,"=").concat(i(e.currentGt.replace(/\s/g,"")))),r){var s=(0,a.Ue)(e);void 0!==s&&n.push("div=".concat(s))}return n.length?"[&".concat(n.join(","),"]"):""})),"end;"].join("\n")}(r,l,c,s);O(p,"text/plain;charset=utf-8;",d),t((0,i.W7)({message:"".concat(s?"TimeTree":"Tree"," written to ").concat(p)}))}catch(e){console.error(e);var f={message:"Error saving tree!"};e instanceof h.Vz&&(f.details="An empty tree was created. If you have selected genomes, note that we do not support downloads of multiple subtrees."),t((0,i.Ul)(f))}},R=function(e){var t=e.match(/^(<.+?>)(.+)<\/.+?>$/);if(t){var n=t[1].match(/width.+?([0-9.]+).+height.+?([0-9.]+)/);if(n){var r=t[1].match(/viewBox="([0-9-]+)\s([0-9-]+)\s([0-9-]+)\s([0-9-]+)"/);return{x:0,y:0,viewbox:r?r.slice(1):void 0,width:parseFloat(n[1]),height:parseFloat(n[2]),inner:t[2]}}}},B=function(e,t,n){var r='<svg id="'.concat(t,'" width="').concat(n.width,'" height="').concat(n.height,'" x="').concat(n.x,'" y="').concat(n.y,'">');e.push(r),e.push(n.inner),e.push("</svg>")},M=function(e,t,n,r,a,s){var l=[],c={tree:void 0,map:void 0,entropy:void 0,frequencies:void 0};if(-1!==n.indexOf("tree")){try{c.tree=R((new XMLSerializer).serializeToString(document.getElementById("MainTree"))),c.treeLegend=R((new XMLSerializer).serializeToString(document.getElementById("TreeLegendContainer")))}catch(e){c.tree=void 0,l.push("tree"),console.error("Tree SVG save error:",e)}if(c.tree&&document.getElementById("SecondTree"))try{c.secondTree=R((new XMLSerializer).serializeToString(document.getElementById("SecondTree"))),document.getElementById("Tangle")&&(c.tangle=R((new XMLSerializer).serializeToString(document.getElementById("Tangle"))))}catch(e){l.push("second tree / tanglegram"),console.error("Second Tree / tanglegram SVG save error:",e)}}if(-1!==n.indexOf("measurements"))try{c.measurements=R((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsSVG"))),c.measurementsXAxis=R((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsXAxisSVG")));var u=document.getElementById("measurementsSVGContainer");c.measurements.width=u.clientWidth,c.measurementsXAxis.width=u.clientWidth}catch(e){c.measurements=void 0,l.push("measurements"),console.error("Measurements SVG save error:",e)}if(-1!==n.indexOf("entropy"))try{c.entropy=R((new XMLSerializer).serializeToString(document.getElementById("d3entropyParent")))}catch(e){c.entropy=void 0,l.push("entropy"),console.error("Entropy SVG save error:",e)}if(-1!==n.indexOf("frequencies"))try{c.frequencies=R((new XMLSerializer).serializeToString(document.getElementById("d3frequenciesSVG")))}catch(e){c.frequencies=void 0,l.push("frequencies"),console.error("Frequencies SVG save error:",e)}-1!==n.indexOf("map")&&s&&(c.map={x:0,y:0,viewbox:void 0,width:parseFloat(s.mapDimensions.x),height:parseFloat(s.mapDimensions.y),inner:s.mapSvg});var h=[],p=function(e,t,n){var r=50,i=0,a=0;for(var s in e.secondTree&&(e.secondTree.x=o.qG+e.tree.width,e.tree.width+=o.qG+e.secondTree.width),e.measurements?(e.tree?(i=Math.max(e.tree.width,e.measurements.width),a=e.tree.height+r+e.measurements.height,e.measurements.y=e.tree.height+r):(i=e.measurements.width,a=e.measurements.height),e.measurementsXAxis.y=a,a+=e.measurementsXAxis.height,e.map&&(i=Math.max(i,e.map.width),e.map.y=a+r,a+=r+e.map.height)):e.tree&&e.map?"grid"===t?(i=e.tree.width+r+e.map.width,a=Math.max(e.tree.height,e.map.height),e.map.x=e.tree.width+r):(i=Math.max(e.tree.width,e.map.width),a=e.tree.height+r+e.map.height,e.map.y=e.tree.height+r):e.tree?(i=e.tree.width,a=e.tree.height):e.map&&(i=e.map.width,a=e.map.height),e.entropy&&(i<e.entropy.width?i=e.entropy.width:e.entropy.x=(i-e.entropy.width)/2,a?(e.entropy.y=a+r,a+=r+e.entropy.height):a=e.entropy.height),e.frequencies&&(i<e.frequencies.width?i=e.frequencies.width:e.frequencies.x=(i-e.frequencies.width)/2,a?(e.frequencies.y=a+r,a+=r+e.frequencies.height):a=e.frequencies.height),e)e[s]&&(e[s].x+=r,e[s].y+=r);a+=100;var l=36*n+20;return{width:i+=100,height:a+=l,padding:r,textY:a-l,textHeight:l}}(c,r,a.length);for(var d in h.push('<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="'.concat(p.width,'" height="').concat(p.height,'">')),c)c[d]&&B(h,d,c[d]);h.push('<foreignObject x="'.concat(p.padding,'" y="').concat(p.height-p.textHeight,'" height="').concat(p.textHeight,'" width="').concat(p.width-2*p.padding,'">')),a.forEach(function(e){h.push('<p xmlns="http://www.w3.org/1999/xhtml" style="font-family:lato,sans-serif;">'),h.push(e),h.push("</p>")}),h.push("</foreignObject>"),h.push("</svg>"),O(t+".svg","image/svg+xml;charset=utf-8",h.join("\n")),l.length?e((0,i.Ul)({message:"Vector image saved",details:"Saved to ".concat(t,".svg, however there were errors with ").concat(l.join(", "))})):e((0,i.W7)({message:"Vector image saved",details:t+".svg"}))},D=function(e,t,n,r,i,o,a,s,l){var u=[];u.push(n.title),u.push("Last updated ".concat(n.updated));var h=window.location.href.replace(/&/g,"&amp;");u.push('Downloaded from <a href="'.concat(h,'">').concat(h,"</a> on ").concat((new Date).toLocaleString())),u.push((0,c.jL)({mainTreeNumTips:n.mainTreeNumTips,nodes:r,visibility:i,t})),u.push(""),u.push("".concat(t("Data usage part 1"),' A full list of sequence authors is available via <a href="https://nextstrain.org">nextstrain.org</a>.')),u.push("Visualizations are licensed under CC-BY."),u.push("Relevant publications:"),l.forEach(function(e){u.push('<a href="'.concat(e.href,'">').concat(e.author,", ").concat(e.title,", ").concat(e.journal," (").concat(e.year,")</a>"))}),-1!==a.indexOf("map")?window.L.getMapSvg(M.bind(void 0,e,o,a,s,u)):M(e,o,a,s,u,void 0)},F=function(e,t,n){var r={base:"x",gene:"prot",position:"codon",events:"y",entropy:"y"},o=n.selectedCds===l.Sc?["base"]:["gene","position"];o.push(n.showCounts?"events":"entropy");var a=n.bars.map(function(e){return Object.fromEntries(o.map(function(t){return[t,e[r[t]]]}))}),s="".concat(t,"_diversity.tsv");O(s,C,T(a,o)),e((0,i.W7)({message:"Diversity data exported to ".concat(s)}))};function z(e,t,n){var r=n+".json";"nextstrain_.json"===r&&(r=t.metadata.title?"nextstrain_"+t.metadata.title.trim().slice(0,25).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")+".json":"nextstrain.json");var o=function(e){var t=e();if(!t.metadata.loaded)throw new Error("[INTERNAL ERROR] metadata state not loaded");var n=function(e){if(e.rootSequence)return e.rootSequence}(t.metadata),r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({version:"v2",meta:(0,p.KD)(t),tree:y(t.tree)},n&&{root_sequence:n});return r}(function(){return t});O(r,"application/json",JSON.stringify(o)),e((0,i.W7)({message:"Saving main dataset JSON as '".concat(r,"'")})),t.treeToo.loaded&&e((0,i.Ul)({message:"Download functionality only supports the main (LHS) tree at the moment"}))}},40769(e,t,n){"use strict";n.d(t,{Ay:()=>_,VF:()=>A,YM:()=>T,cc:()=>j});var r,i=n(78281),o=n(49633),a=n(77313),s=n(69646),l=n(28355),c=n(4124),u=n(99438),h=n(60516),p=n(60251),d=n(57900),f=n(41930),m=n(62617);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function v(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function w(e){var t=S();return function(){var n,r=E(e);if(t){var i=E(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!e})()}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var x=n(40436),k=(0,i.lazy)(function(){return n.e(418).then(n.bind(n,95418))}),C=i.createElement("span",{style:{marginLeft:10,marginRight:10}},"•"),T=a.Ay.div.withConfig({displayName:"fine-print__FinePrintStyles",componentId:"sc-129vvgi-0"})(["margin-left:30px;padding-bottom:30px;font-family:",";font-size:15px;font-weight:300;color:rgb(136,136,136);line-height:1.4;.line{margin-top:20px;margin-bottom:20px;border-bottom:1px solid #CCC;}.finePrint{font-size:14px;}.logoContainer{padding:1px 1px;margin-right:5px;width:24px;cursor:pointer;}.logo{margin-left:1px;margin-right:1px;margin-top:1px;margin-bottom:3px;}"],c.sf),O=(0,o.Ng)(function(e){return{tree:e.tree,metadata:e.metadata,browserDimensions:e.browserDimensions.browserDimensions}})(r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(o,e);var t,n,r=w(o);function o(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),r.apply(this,arguments)}return t=o,n=[{key:"shouldComponentUpdate",value:function(e){return this.props.browserDimensions!==e.browserDimensions}},{key:"getUpdated",value:function(){var e=this.props.t;return this.props.metadata.updated?i.createElement("span",null,e("Data updated")," ",this.props.metadata.updated):null}},{key:"downloadDataButton",value:function(){var e=this,t=this.props.t;return i.createElement("button",{style:Object.assign({},c.u0,{backgroundColor:"rgba(0,0,0,0)",color:c.ib,margin:0,padding:0}),onClick:function(){e.props.dispatch({type:u.vN,modal:"download"})}},i.createElement(l.WCW,null),i.createElement("span",{style:{position:"relative",paddingLeft:"3px"}}," "+t("Download data")))}},{key:"linkOutButton",value:function(){var e=this,t=this.props.t;return i.createElement("button",{style:Object.assign({},c.u0,{backgroundColor:"rgba(0,0,0,0)",color:c.ib,margin:0,padding:0}),onClick:function(){e.props.dispatch({type:u.vN,modal:"linkOut"})}},i.createElement(l.P_O,null),i.createElement("span",{style:{position:"relative",paddingLeft:"3px"}}," "+t("View in other platforms")))}},{key:"render",value:function(){if(!this.props.metadata||!this.props.tree.nodes)return null;var e=this.props.width-30;return i.createElement(T,null,i.createElement("div",{style:{width:e}},i.createElement(h.A,{className:"finePrint",wrap:"wrap"},this.getUpdated(),C,this.downloadDataButton(),(0,m.f)()&&i.createElement(i.Fragment,null,C,this.linkOutButton()),C,i.createElement("a",{href:"https://docs.nextstrain.org/projects/auspice/page/releases/changelog.html",target:"_blank",rel:"noreferrer noopener"},"Auspice v"+p.version)),i.createElement("div",{style:{height:"5px"}}),A(),j()))}}],n&&g(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(i.Component))||r;const _=(0,s.C)()(O);function j(){return i.createElement(h.A,{className:"finePrint"},i.createElement("a",{className:"logoContainer",href:"https://nextstrain.org"},i.createElement("img",{alt:"nextstrain.org",className:"logo",width:"24px",src:x})),"Powered by Nextstrain (",i.createElement("a",{href:d.M.nextstrain.href,target:"_blank",rel:"noopener noreferrer"},d.M.nextstrain.author," ",i.createElement("i",null,d.M.nextstrain.journal)),")")}function A(){var e=(0,f.Q)("finePrint")?(0,f.u)("finePrint"):null;return e?i.createElement(i.Suspense,{fallback:i.createElement(i.Fragment,null)},i.createElement(h.A,{className:"finePrint"},i.createElement(k,{mdstring:e,placeholder:"This dataset contained a fine print message to be displayed here, however it wasn't correctly formatted."}))):null}},60516(e,t,n){"use strict";n.d(t,{A:()=>g});var r=n(78281),i=n(43979),o=n.n(i);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,m(r.key),r)}}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function h(e){var t=p();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(o,e);var t,n,i=h(o);function o(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),i.apply(this,arguments)}return t=o,(n=[{key:"getStyles",value:function(){return{base:{display:"flex",flexDirection:this.props.direction,flexWrap:this.props.wrap,justifyContent:this.props.justifyContent,alignItems:this.props.alignItems,alignContent:this.props.alignContent,order:this.props.order,flexGrow:this.props.grow,flexShrink:this.props.shrink,flexBasis:this.props.basis,alignSelf:this.props.alignSelf},style:this.props.style}}},{key:"render",value:function(){var e=this.getStyles();return r.createElement("div",{id:this.props.id,onClick:this.props.clickHandler,style:l(l({},e.base),e.style)},this.props.children)}}])&&c(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component);f(y,"propTypes",{direction:o().oneOf(["row","rowReverse","column","columnReverse"]),wrap:o().oneOf(["nowrap","wrap","wrap-reverse"]),justifyContent:o().oneOf(["flex-start","flex-end","center","space-between","space-around"]),alignItems:o().oneOf(["flex-start","flex-end","center","baseline","stretch"]),alignContent:o().oneOf(["flex-start","flex-end","center","space-between","space-around","stretch"]),grow:o().number,shrink:o().number,basis:o().string,order:o().number,alignSelf:o().oneOf(["auto","flex-start","flex-end","center","baseline","stretch"]),children:o().node.isRequired,clickHandler:o().func}),f(y,"defaultProps",{direction:"row",wrap:"nowrap",justifyContent:"center",alignItems:"center",alignContent:"stretch",grow:0,shrink:1,basis:"auto",alignSelf:"auto",order:0,style:{},clickHandler:function(){}});const g=y},17904(e,t,n){"use strict";n.d(t,{A:()=>L,w:()=>T});var r,i=n(78281),o=n(49633),a=n(77313),s=n(75805),l=n.n(s),c=n(69646),u=n(28355),h=n(4124),p=n(60516),d=n(87473),f=n(40952),m=n(73924);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function b(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function S(e){var t=E();return function(){var n,r=x(e);if(t){var i=x(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}var k=(0,i.lazy)(function(){return n.e(418).then(n.bind(n,95418))}),C=a.Ay.div.withConfig({displayName:"footer__FooterStyles",componentId:"sc-n42vt4-0"})(["margin-left:30px;padding-bottom:0px;font-family:",";font-size:15px;font-weight:300;color:rgb(136,136,136);line-height:1.4;p{font-weight:300;}ol{font-weight:300;}ul{font-weight:300;}h1{font-weight:700;font-size:2.50em;margin:0.2em 0;}h2{font-weight:600;font-size:2.15em;margin:0.2em 0;}h3{font-weight:500;font-size:1.70em;margin:0.2em 0;}h4{font-weight:500;font-size:1.25em;margin:0.1em 0;}h5{font-weight:500;font-size:1.0em;margin:0.1em 0;}h6{font-weight:500;font-size:0.85em;margin:0.1em 0;}pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px;}pre code{padding:0;margin:0;overflow:visible;font-size:100%;line-height:inherit;word-wrap:normal;background-color:initial;border:0;}p code{padding:.2em .4em;margin:0;font-size:85%;background-color:rgba(27,31,35,.05);border-radius:3px;}.line{margin-top:15px;margin-bottom:15px;border-bottom:1px solid #CCC;}.acknowledgments{margin-top:10px;}.filterList{margin-top:10px;line-height:1.0;}.imageContainer{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;}img{margin-left:30px;margin-right:30px;margin-top:2px;margin-bottom:2px;}table{font-weight:300;margin-bottom:1rem;th,td{text-align:left;padding:0.45rem;vertical-align:top;border-top:1px solid #dee2e6;}thead th{vertical-align:bottom;border-bottom:2px solid #dee2e6;}tbody + tbody{border-top:2px solid #dee2e6;}}"],h.sf);function T(e){var t=e.md;return t?i.createElement(i.Suspense,{fallback:i.createElement("div",null)},i.createElement(k,{className:"acknowledgments",mdstring:t,placeholder:"Error: The dataset's description wasn't correctly formatted as a markdown string"})):i.createElement("div",null,f.dW)}var O=a.Ay.div.withConfig({displayName:"footer__TitleContainer",componentId:"sc-n42vt4-1"})(["display:flex;justify-content:space-between;margin:0px;padding:0px;"]),_=a.Ay.span.withConfig({displayName:"footer__IconContainer",componentId:"sc-n42vt4-2"})(["font-size:22px;font-weight:500;"]),j=function(e){var t=e.name,n=e.isExpanded,r=void 0!==n&&n;return i.createElement(O,null,t,i.createElement(_,null,r?i.createElement(u.Odn,null):i.createElement(u.BNo,null)))},A=(0,o.Ng)(function(e){return{tree:e.tree,totalStateCounts:e.tree.totalStateCounts,metadata:e.metadata,browserDimensions:e.browserDimensions.browserDimensions,activeFilters:e.controls.filters,filtersInFooter:e.controls.filtersInFooter}})(r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(o,e);var t,n,r=S(o);function o(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),r.apply(this,arguments)}return t=o,n=[{key:"shouldComponentUpdate",value:function(e){if(this.props.tree.version!==e.tree.version||this.props.browserDimensions!==e.browserDimensions)return!0;if(Object.keys(this.props.activeFilters)!==Object.keys(e.activeFilters))return!0;if(Object.keys(this.props.activeFilters).length>0){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.props.activeFilters);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(this.props.activeFilters[r]!==e.activeFilters[r])return!0}}catch(e){n.e(e)}finally{n.f()}}return!1}},{key:"displayFilter",value:function(e){var t,n,r=this,o=this.props.t,a=this.props.totalStateCounts[e];if(!a)return null;var s,c,u,h=this.props.metadata.colorings[e]?this.props.metadata.colorings[e].title:e,y=(this.props.activeFilters[e]||[]).filter(function(e){return e.active}).map(function(e){return e.value}),g=i.createElement("div",null,o("Filter by {{filterTitle}}",{filterTitle:h})+" (n=".concat(a.size,")"),null!==(t=this.props.activeFilters)&&void 0!==t&&null!==(n=t[e])&&void 0!==n&&n.length?(s=this.props.dispatch,c=[e],u=o("Clear {{filterName}} filter",{filterName:e}),i.createElement(m.PJ,{active:!0,extraStyles:{float:"right",margin:"0px 4px"},onClick:function(){c.forEach(function(e){return s((0,d.$h)("set",e,[]))})}},u)):null);return i.createElement("div",null,i.createElement(l(),{triggerWhenOpen:i.createElement(j,{name:g,isExpanded:!0}),trigger:i.createElement(j,{name:g}),triggerStyle:{cursor:"pointer",textDecoration:"none"},transitionTime:100},i.createElement("div",{className:"filterList"},i.createElement(p.A,{wrap:"wrap",justifyContent:"flex-start",alignItems:"center"},Array.from(a.keys()).filter(function(e){return(0,f.QF)(e)}).sort().map(function(t){return i.createElement(m.PJ,{key:t,active:-1!==y.indexOf(t),onClick:function(){return function(e,t,n,r){var i=-1===(t[n]||[]).map(function(e){return e.value}).indexOf(r)?"add":"remove";e((0,d.$h)(i,n,[r]))}(r.props.dispatch,r.props.activeFilters,e,t)}},i.createElement("span",null,"".concat(t," (").concat(a.get(t),")")))})))))}},{key:"render",value:function(){var e=this;if(!this.props.metadata||!this.props.tree.nodes)return null;var t=this.props.width-30;return i.createElement(C,null,i.createElement("div",{style:{width:t}},i.createElement("div",{className:"line"}),i.createElement(T,{md:this.props.metadata.description}),i.createElement("div",{className:"line"}),this.props.filtersInFooter.map(function(t){return i.createElement("div",{key:t},e.displayFilter(t),i.createElement("div",{className:"line"}))})))}}],n&&v(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(i.Component))||r;const L=(0,c.C)()(A)},98598(e,t,n){"use strict";n.d(t,{W8:()=>c,Xl:()=>a,bg:()=>i,bu:()=>l,jG:()=>p,vA:()=>h,wC:()=>u,yf:()=>s,zD:()=>o});var r=n(78281),i=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,2)"},r.createElement("svg",{width:i,height:i,viewBox:"16 19 27 22"},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(17.000000, 20.000000)"},r.createElement("polyline",{id:"Path-3",stroke:o,points:"2.94117647 12.8571429 2.94117647 18.6083984 17.8459616 18.6083984 17.8459616 16.0260882 24.870031 16.0260882"}),r.createElement("polyline",{id:"Path-4",stroke:o,points:"17.8500004 18.5714286 17.8500004 20 25.0119374 20"}),r.createElement("polyline",{id:"Path-5",stroke:o,points:"2.94117647 12.8571429 3.00303284 7.21191058 10.2360102 7.11220045 10.4159559 2.99881623 17.1561911 2.93803403 17.1561911 0 24.313534 0"}),r.createElement("polyline",{id:"Path-6",stroke:o,points:"17.1599998 2.85714286 17.1599998 4.28571429 24.512941 4.28571429"}),r.createElement("path",{d:"M0,12.8571429 L2.94117647,12.8571429",id:"Path-6",stroke:o}),r.createElement("polyline",{id:"Path-7",stroke:o,points:"10.2941176 7.14285714 10.2941176 11.4285714 24.5454676 11.4285714"})))))},o=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,4)"},r.createElement("svg",{width:i,height:i,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(17.000000, 20.000000)"},r.createElement("polyline",{id:"Path-3",stroke:o,points:"-15 5 -15 -25 "}),r.createElement("polyline",{id:"Path-4",stroke:o,points:"-15 5 25 5"}),r.createElement("polyline",{id:"Path-5",stroke:o,points:"-12 3 20 -25 "}),r.createElement("circle",{id:"c-1",stroke:o,cx:"-8",cy:"0",r:"2"}),r.createElement("circle",{id:"c-2",stroke:o,cx:"4",cy:"-10",r:"2"}),r.createElement("circle",{id:"c-3",stroke:o,cx:"4",cy:"-15",r:"2"}),r.createElement("circle",{id:"c-4",stroke:o,cx:"-4",cy:"-5",r:"2"}),r.createElement("circle",{id:"c-5",stroke:o,cx:"-2",cy:"-11",r:"2"})))))},a=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,4)"},r.createElement("svg",{width:i,height:i,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(17.000000, 20.000000)"},r.createElement("polyline",{id:"Path-3",stroke:o,points:"-15 5 -15 -25 "}),r.createElement("polyline",{id:"Path-4",stroke:o,points:"-15 5 25 5"}),r.createElement("circle",{id:"c-1",stroke:o,cx:"-8",cy:"0",r:"2"}),r.createElement("circle",{id:"c-2",stroke:o,cx:"3",cy:"0",r:"2"}),r.createElement("circle",{id:"c-3",stroke:o,cx:"8",cy:"-5",r:"2"}),r.createElement("circle",{id:"c-4",stroke:o,cx:"-4",cy:"-15",r:"2"}),r.createElement("circle",{id:"c-5",stroke:o,cx:"1",cy:"-11",r:"2"})))))},s=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,0)"},r.createElement("svg",{width:i,height:i,viewBox:"14 14 25 26"},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(15.000000, 15.000000)"},r.createElement("path",{d:"M15,15 L17.6450195,15",id:"Path-12",stroke:o}),r.createElement("path",{d:"M15.229248,22.5795898 L15.229248,18.2854004 C15.229248,18.2854004 17.8465223,17.6291504 17.8508301,15.0574951 C17.8551378,12.4858398 15.2944336,11.9138184 15.2944336,11.9138184 L15.229248,7.53540039",id:"Path-13",stroke:o}),r.createElement("path",{d:"M7.63037109,6.10498047 L10.230957,9.08325195 C10.230957,9.08325195 12.25,7.08233714 15.126709,7.04162598 C18.003418,7.00091481 20.5390625,8.91748047 20.5390625,8.91748047 L22.9765625,5.60839844",id:"Path-14",stroke:o}),r.createElement("path",{d:"M0.15942005,4.99135298 L2.76065146,7.96962446 C2.76065146,7.96962446 4.78019556,5.96870965 7.65761856,5.92799848 C10.5350415,5.88728732 13.0713154,7.80385298 13.0713154,7.80385298 L15.5094204,4.49477094",id:"Path-14",stroke:o,transform:"translate(7.834420, 6.232198) rotate(-34.000000) translate(-7.834420, -6.232198) "}),r.createElement("path",{d:"M7.5,21.496582 L10.1005859,24.4748535 C10.1005859,24.4748535 12.1196289,22.4739387 14.9963379,22.4332275 C17.8730469,22.3925164 20.4086914,24.309082 20.4086914,24.309082 L22.8461914,21",id:"Path-14",stroke:o,transform:"translate(15.173096, 22.737427) scale(1, -1) translate(-15.173096, -22.737427) "})))))},l=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,2)"},r.createElement("svg",{width:i,height:i,viewBox:"106 49 150 118"},r.createElement("polyline",{id:"Path-2",stroke:o,strokeWidth:"4",fill:"none",points:"108 77 125.182237 87.8599894 133.381156 119.402591 111.867082 144.368016"}),r.createElement("path",{d:"M125.2,87.5 L137.624777,70",id:"Path-3",stroke:o,strokeWidth:"4",fill:"none"}),r.createElement("polyline",{id:"Path-4",stroke:o,strokeWidth:"4",fill:"none",points:"133 119.331781 192.127357 119.400002 215.445998 80.3916603 203.946476 51.4000015"}),r.createElement("path",{d:"M215.5,80.5 L253.378522,73",id:"Path-5",stroke:o,strokeWidth:"4",fill:"none"}),r.createElement("path",{d:"M192,119.2 L229.854937,164.55391",id:"Path-6",stroke:o,strokeWidth:"4",fill:"none"}))))},c=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,7)"},r.createElement("svg",{width:i,height:i,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},r.createElement("line",{stroke:o,x1:"3.3",y1:"3.8",x2:"27.7",y2:"3.8"}),r.createElement("line",{stroke:o,x1:"3.3",y1:"9.2",x2:"27.7",y2:"9.2"}),r.createElement("line",{stroke:o,x1:"3.3",y1:"14.5",x2:"27.7",y2:"14.5"}),r.createElement("line",{stroke:o,x1:"3.3",y1:"19.9",x2:"27.7",y2:"19.9"}),r.createElement("line",{stroke:o,x1:"3.3",y1:"25.2",x2:"27.7",y2:"25.2"})))))},u=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,6)"},r.createElement("svg",{width:i,height:i,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fillRule:"evenodd"},r.createElement("rect",{fill:"none",stroke:o,x:"1",y:"1",width:"14",height:"17"}),r.createElement("rect",{fill:"none",stroke:o,x:"15",y:"1",width:"14",height:"17"}),r.createElement("rect",{fill:"none",stroke:o,x:"1",y:"18",width:"28",height:"8"})))))},h=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,6)"},r.createElement("svg",{width:i,height:i,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fillRule:"evenodd"},r.createElement("rect",{fill:"none",stroke:o,x:"1",y:"1",width:"7",height:"25"}),r.createElement("rect",{fill:"none",stroke:o,x:"8",y:"1",width:"20",height:"25"})))))},p=function(e){var t=e.theme,n=e.selected,i=e.width,o=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:i,height:i+5},r.createElement("g",{transform:"translate(0,7)"},r.createElement("svg",{width:i,height:i,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"3",fill:"none",fillRule:"evenodd"},r.createElement("path",{stroke:o,d:"M 11 3 L 1 15 L 11 27"}),r.createElement("path",{stroke:o,d:"M 19 3 L 29 15 L 19 27"})))))}},43153(e,t,n){"use strict";n.d(t,{aX:()=>s,jL:()=>c,l5:()=>l});var r=n(61373),i=n(40952),o=n(93681),a={country:"countries",authors:"authors"},s=function(e,t){return 1===t?"authors"===e&&(e="author"):(e in a&&(e=a[e]),"s"!==e.slice(-1).toLowerCase()&&(e+="s")),e.replace(/_/g," ")},l=function(e){var t="number"==typeof e?(0,r.bq)(e):e,n=t.split("-");return 3===n.length?"".concat(i.US[n[1]]," ").concat(n[0]):t},c=function(e){var t=e.nodes,n=e.visibility,r=e.mainTreeNumTips,i=e.branchLengthsToDisplay,a=e.t,s=(0,o.gY)(t,n),c=(0,o.iE)(t,n),u="";return(u+="divOnly"!==i&&s>0?a("Showing {{x}} of {{y}} genomes sampled between {{from}} and {{to}}",{x:s,y:r,from:l(c[0]),to:l(c[1])}):a("Showing {{x}} of {{y}} genomes",{x:s,y:r}))+"."}},73924(e,t,n){"use strict";n.d(t,{PJ:()=>w,k8:()=>b,m_:()=>v});var r=n(78281),i=n(77313),o=n(28355),a=n(532);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=i.Ay.div.withConfig({displayName:"filterBadge__BaseContainer",componentId:"sc-f9gznr-0"})(["color:#5097BA;cursor:pointer;font-weight:300;padding:0px 2px 0px 2px;"]),p=(0,i.Ay)(h).withConfig({displayName:"filterBadge__TextContainer",componentId:"sc-f9gznr-1"})(["display:inline-block;cursor:help;margin:0px 0px 0px 2px;"]),d=i.Ay.div.withConfig({displayName:"filterBadge__IconContainer",componentId:"sc-f9gznr-2"})(["cursor:pointer;color:#5097BA;border-width:0px 0px 0px 1px;border-style:solid;border-color:#BDD8E5;*/ min-width:20px;padding:0px 1px 0px 5px;display:inline-block;text-align:center;&:hover,&:focus{& > svg{color:#0071e6;}}& > svg{transform:translate(-2px,2px);}"]),f=(0,i.Ay)(h).withConfig({displayName:"filterBadge__UnselectedFilterTextContainer",componentId:"sc-f9gznr-3"})(["margin:1px 2px 1px 2px;padding:0px 2px 0px 2px;&:hover{text-decoration:underline;}"]),m=(0,i.Ay)(h).withConfig({displayName:"filterBadge__SelectedFilterTextContainer",componentId:"sc-f9gznr-4"})(["background-color:#E9F2F6;border-radius:2px;border:1px solid #BDD8E5;border-width:1;border-radius:2px;margin:0px 2px 0px 0px;&:hover{text-decoration:none;}"]),y=i.Ay.div.withConfig({displayName:"filterBadge__BadgeContainer",componentId:"sc-f9gznr-5"})(["background-color:#E9F2F6;",";display:inline-block;font-size:14px;border-radius:2px;border-width:1px;border-style:solid;border-color:#BDD8E5;"],function(e){return e.striped?"background: repeating-linear-gradient(135deg, #E9F2F6, #E9F2F6 5px, #FFFFFF 5px, #FFFFFF 10px);":""}),g=(0,i.Ay)(a.A).withConfig({displayName:"filterBadge__StyledTooltip",componentId:"sc-f9gznr-6"})(["max-width:30vh;font-weight:400;white-space:normal;line-height:1.2;padding:4px !important;& > br{margin-bottom:10px;}"]),v=function(e){var t=e.id,n=e.children;return r.createElement(g,{place:"bottom",type:"dark",effect:"solid",delayShow:300,id:t},n)},b=function(e){var t=e.remove,n=e.canMakeInactive,i=e.active,a=e.activate,s=e.inactivate,l=e.children,c=e.id,u=e.onHoverMessage,h=void 0===u?"The visible data is being filtered by this":u;return r.createElement(y,{striped:n&&!i},r.createElement(p,{active:!n||i,"data-tip":!0,"data-for":c},l),r.createElement(v,{id:c},n&&!i?"This filter is currently inactive":h),n&&r.createElement(d,{onClick:i?s:a,role:"button",tabIndex:0,"data-tip":!0,"data-for":c+"active"},i?r.createElement(o.$_Y,null):r.createElement(o.QJN,null),r.createElement(v,{id:c+"active"},i?"Inactivate this filter":"Re-activate this filter")),r.createElement(d,{onClick:t,role:"button",tabIndex:0},r.createElement(o.qbC,{"data-tip":!0,"data-for":c+"remove"}),r.createElement(v,{id:c+"remove"},"Remove this filter")))},w=function(e){var t=e.onClick,n=e.extraStyles,i=void 0===n?{}:n,o=e.active,a=e.children,s=o?m:f;return r.createElement("div",{style:c({display:"inline-block"},i)},r.createElement(s,{onClick:t},a))}},62617(e,t,n){"use strict";n.d(t,{Y:()=>v,f:()=>b});var r=n(78281),i=n(77313),o=n(49633),a=n(4124),s=n(41930),l=n(21143);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=i.Ay.a.withConfig({displayName:"LinkOutModalContents__ButtonText",componentId:"sc-9zdqjf-0"})(["border:1px solid ",";border-radius:4px;cursor:pointer;padding:4px 7px;margin-right:10px;font-family:",";background-color:rgba(0,0,0,0);color:white !important;font-weight:400;text-decoration:none !important;font-size:16px;flex-shrink:0;&:hover{background-color:",";}"],a.Ty,a.sf,function(e){return e.theme.selectedColor}),h=i.Ay.span.withConfig({displayName:"LinkOutModalContents__InactiveButton",componentId:"sc-9zdqjf-1"})(["border:1px solid ",";border-radius:4px;cursor:auto;padding:4px 7px;margin-right:10px;font-family:",";background-color:rgba(0,0,0,0);color:white;font-weight:400;text-decoration:line-through !important;font-size:16px;flex-shrink:0;"],a.Ty,a.sf),p=i.Ay.span.withConfig({displayName:"LinkOutModalContents__ButtonDescription",componentId:"sc-9zdqjf-2"})(["display:inline-block;font-style:italic;font-size:14px;color:white;"]),d=i.Ay.div.withConfig({displayName:"LinkOutModalContents__ButtonContainer",componentId:"sc-9zdqjf-3"})(["margin-top:10px;margin-bottom:10px;display:flex;flex-wrap:nowrap;align-items:center;"]);function f(){return{pathname:window.location.pathname,origin:window.location.origin}}function m(){var e,t,n,i="taxonium.org",a=f(),s=a.pathname,m=a.origin,y=(0,o.d4)(function(e){return e.controls}),g=y.distanceMeasure,v=y.colorBy,b=y.showTreeToo,w=(0,o.d4)(function(e){return e.metadata}).originalVersion;return b?e="tanglegrams aren't supported":"v1"===w&&(e="v1 datasets aren't supported"),e?r.createElement(d,{key:i},r.createElement(h,null,i),r.createElement(p,null,"The current dataset isn't viewable in Taxonium as ".concat(e,"."))):r.createElement(d,{key:i},r.createElement(u,{href:(t={treeUrl:"".concat(m).concat(s),treeType:"nextstrain",ladderizeTree:"false",xType:"num_date"===g?"x_time":"x_dist"},n=function(){if((0,l.Sv)(v)){var e=['"genotype"'],t=(0,l.kh)(v);return!t||t.positions.length>1?null:(e.push('"pos":'.concat(t.positions[0])),t.aa&&e.push('"gene":"'.concat(t.gene,'"')),'{"field":'.concat(e.join(","),"}"))}return'{"field":"meta_'.concat(v,'"}')}(),n&&(t.color=n),"".concat("https://taxonium.org","?").concat(Object.entries(t).map(function(e){var t,n,r=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=r[0],o=r[1];return"".concat(i,"=").concat(encodeURIComponent(o))}).join("&"))),target:"_blank",rel:"noreferrer noopener"},i),r.createElement(p,null,"Visualise this dataset in Taxonium (",r.createElement("a",{href:"https://docs.taxonium.org/en/latest/",target:"_blank",rel:"noreferrer noopener"},"learn more"),")."))}function y(){var e,t="microbetrace.cdc.gov",n=f(),i=n.pathname,a=n.origin,s=(0,o.d4)(function(e){return e.controls}).showTreeToo,l=(0,o.d4)(function(e){return e.metadata}).originalVersion;return s?e="tanglegrams aren't supported":"v1"===l&&(e="v1 datasets aren't supported"),e?r.createElement(d,{key:t},r.createElement(h,null,t),r.createElement(p,null,"The current dataset isn't viewable in MicrobeTrace as ".concat(e,"."))):r.createElement(d,{key:t},r.createElement(u,{href:"".concat("https://microbetrace.cdc.gov/MicrobeTrace","?url=").concat(encodeURIComponent("".concat(a).concat(i))),target:"_blank",rel:"noreferrer noopener"},t),r.createElement(p,null,"View this data in MicrobeTrace (",r.createElement("a",{href:"https://github.com/CDCgov/MicrobeTrace/wiki",target:"_blank",rel:"noreferrer noopener"},"learn more"),")."))}function g(){var e,t="nextclade",n=f(),i=n.pathname,a=n.origin,s=(0,o.d4)(function(e){return e.controls}).showTreeToo,l=(0,o.d4)(function(e){return e.metadata}),c=l.mainTreeNumTips,m=l.originalVersion,y=l.rootSequence,g=c>4e3;if(s?e="tanglegrams aren't supported":"v1"===m?e="v1 datasets aren't supported":y||(e="this dataset doesn't have a root-sequence (either within the main JSON or as a sidecar JSON)"),e)return r.createElement(d,{key:t},r.createElement(h,null,t),r.createElement(p,null,"The current tree isn't usable as a Nextclade dataset as ".concat(e,".")));var v="https://clades.nextstrain.org?dataset-json-url=".concat(encodeURIComponent("".concat(a).concat(i)));return r.createElement(d,{key:t},r.createElement(u,{href:v,target:"_blank",rel:"noreferrer noopener"},t),r.createElement(p,null,"Use this tree as a nextclade reference dataset which allows you to add new sequences (via drag-and-drop) and see them placed on the tree.\n        Note that manually curated datasets may be better suited to your use case, see ",r.createElement("a",{href:"https://clades.nextstrain.org",target:"_blank",rel:"noreferrer noopener"},"clades.nextstrain.org")," for all reference datasets or read the ",r.createElement("a",{href:"https://docs.nextstrain.org/projects/nextclade/en/stable/user/nextclade-web/index.html",target:"_blank",rel:"noreferrer noopener"},"Nextclade Web documentation")," for more details.",g&&r.createElement("span",null," Note that large trees such as this may not work in Nextclade!")))}var v=function(){return r.createElement(r.Fragment,null,r.createElement("div",{style:a.vS.modalSubheading},"View this dataset on other platforms:"),r.createElement("div",{style:a.vS.break}),r.createElement("p",null,"Clicking on the following links will take you to an external site which will attempt to load the underlying data JSON which you are currently viewing. These sites are not part of Nextstrain and as such are not under our control, but we highly encourage interoperability across platforms like these."),r.createElement("div",{style:{paddingTop:"10px"}}),r.createElement(g,null),r.createElement(m,null),r.createElement(y,null))},b=function(){return!(!(0,s.Q)("linkOutModal")||!(0,s.u)("linkOutModal")||("localhost"===window.location.hostname&&console.warn("Link-out modal requested but you are running on localhost so the links will not work"),0))}},2122(e,t,n){"use strict";n.d(t,{A:()=>y});var r=n(78281),i=n(77313),o=n(40952),a=n(28355);const s=function(e){var t=e.navHeight,n=e.navWidth,i=e.display,o=e.onClick,s={position:"fixed",left:n?n-12:-12,visibility:i?"visible":"hidden",width:i?12:0,top:t/2-8,backgroundColor:"inherit",boxShadow:"none",cursor:"pointer",borderRadius:"0px",fontSize:12,color:"#444",textAlign:"center",verticalAlign:"middle"};return r.createElement("div",{style:s,onClick:o},r.createElement(a._Jj,null))};var l=n(68299),c=i.Ay.div.withConfig({displayName:"content__AuspiceNavBarContainer",componentId:"sc-jg0fvy-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%;"]),u=i.Ay.a.withConfig({displayName:"content__Title",componentId:"sc-jg0fvy-1"})(["padding:0px;text-decoration:none;color:",";font-size:20px;font-weight:400;cursor:pointer;letter-spacing:1rem;"],function(e){return e.theme.color}),h=i.Ay.a.withConfig({displayName:"content__LogoLink",componentId:"sc-jg0fvy-2"})(["padding:5px 5px;width:50px;cursor:pointer;"]),p=i.Ay.div.withConfig({displayName:"content__NarrativeTitle",componentId:"sc-jg0fvy-3"})(["white-space:nowrap;font-size:1.7rem;margin-left:auto;padding:0px 12px;float:right;color:",";max-width:","px;overflow:hidden;text-overflow:ellipsis;"],function(e){return e.theme.color},function(e){return e.width-90}),d=n(41930),f=i.Ay.div.withConfig({displayName:"navBar__NavBarContainer",componentId:"sc-ygpsg-0"})(["left:0;max-width:960px;margin-top:auto;margin-right:auto;margin-bottom:auto;margin-left:auto;height:","px;justify-content:space-between;align-items:center;overflow:hidden;z-index:100;transition:left .3s ease-out;"],function(e){return e.narrative?o.iY:o.NL}),m=(0,d.Q)("navbarComponent")?(0,d.u)("navbarComponent"):function(e){var t=e.narrativeTitle,n=e.sidebar,i=e.width;return n?r.createElement(c,null,r.createElement("div",{style:{flex:1}}),r.createElement(h,{href:"/"},r.createElement("img",{alt:"splashPage",width:"40px",src:l})),r.createElement("div",{style:{flex:1}}),function(e,t){return e?r.createElement(p,{width:t,href:"/"},e):r.createElement(u,{href:"/"},"auspice")}(t,i),r.createElement("div",{style:{flex:1}})):null};const y=function(e){var t=e.sidebar,n=e.toggleHandler,i=e.narrativeTitle,a=e.width,l=t&&!i;return r.createElement(f,null,r.createElement(m,{narrativeTitle:i,sidebar:t,width:a}),r.createElement(s,{navHeight:o.NL,navWidth:a,display:l,onClick:n}))}},47805(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>T});var r=n(78281),i=n(49633),o=n(77313),a=n(2122),s=n(60516),l=function(e){return r.createElement("div",{className:"row"},r.createElement("div",{className:"col-md-1"}),r.createElement("div",{className:"col-md-10"},r.createElement("div",{className:"line"}),r.createElement(s.A,{wrap:"wrap",style:{marginTop:20,justifyContent:"space-around"}},e.children)),r.createElement("div",{className:"col-md-1"}))},c=n(40769),u=function(e){return e>1e3?3:e>750?2:1},h=o.Ay.ul.withConfig({displayName:"splash__ColumnList",componentId:"sc-11xzu4i-0"})(["-moz-column-count:",";-moz-column-gap:20px;-webkit-column-count:",";-webkit-column-gap:20px;column-count:",";column-gap:20px;"],function(e){return u(e.width)},function(e){return u(e.width)},function(e){return u(e.width)});var p,d=n(41930),f=n(41916),m=n(58057),y=n(40952),g=n(95401);function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function w(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}function S(e,t){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},S(e,t)}function E(e){var t=x();return function(){var n,r=k(e);if(t){var i=k(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}var C=(0,d.Q)("splashComponent")?(0,d.u)("splashComponent"):function(e){var t=e.available,i=e.browserDimensions,o=e.errorMessage,u=function(){return r.createElement(r.Fragment,null,r.createElement(s.A,{justifyContent:"center"},r.createElement("div",{style:{paddingRight:"40px"}},r.createElement("h1",{style:{textAlign:"center",marginTop:"20px",marginLeft:"20px",fontSize:"72px",letterSpacing:"4rem"}},"auspice"),r.createElement("h1",{style:{textAlign:"center",marginTop:"0px",fontSize:"29px"}},"Interactive Visualisation of Phylogenomic data")),r.createElement("img",{alt:"logo",width:"102",src:n(68299)})))},p=function(){return r.createElement("p",{style:{maxWidth:600,marginTop:0,marginRight:"auto",marginBottom:20,marginLeft:"auto",textAlign:"center",fontSize:16,fontWeight:300,lineHeight:1.42857143}},"\n        Auspice is a locally run interactive viewer for phylogeographic and other datasets.\n        Auspice can be easily turned into an online web-app, such as nextstrain.org & auspice.us\n      ")},d=function(){return r.createElement(l,null,r.createElement("div",null,r.createElement("p",{style:{color:"rgb(222, 60, 38)",fontWeight:600,fontSize:"24px"}},"😱 404, or an error has occured 😱"),r.createElement("p",{style:{color:"rgb(222, 60, 38)",fontWeight:400,fontSize:"18px"}},"Details: ".concat(o)),r.createElement("p",{style:{fontSize:"16px"}},"If this keeps happening, or you believe this is a bug, please ",r.createElement("a",{href:"https://nextstrain.org/contact"},"get in contact with us."))))},f=function(e){var t=e.type,n=e.data;return r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"26px"}},"Available ".concat(t,":")),n?r.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},r.createElement("div",{style:{flex:"1 50%",minWidth:"0"}},r.createElement(h,{width:i.width},n.map(function(e){return r.createElement("li",{key:e.request},r.createElement("a",{href:e.request},e.request))})))):r.createElement("p",null,"none found"))};return r.createElement(r.Fragment,null,r.createElement(a.A,{sidebar:!1}),r.createElement("div",{className:"static container"},r.createElement(u,null),o?r.createElement(d,null):r.createElement(p,null),r.createElement(f,{type:"datasets",data:t.datasets}),r.createElement(f,{type:"narratives",data:t.narratives}),r.createElement(c.YM,null,(0,c.VF)(),(0,c.cc)())))};const T=(0,i.Ng)(function(e){return{errorMessage:e.general.errorMessage,browserDimensions:e.browserDimensions.browserDimensions,reduxPathname:e.general.pathname}})(p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&S(e,t)}(o,e);var t,n,i=E(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,e)).state={available:{},errorMessage:void 0},t}return t=o,(n=[{key:"componentDidMount",value:function(){var e=this;(0,m.h)("".concat((0,y.KG)(),"/getAvailable?prefix=").concat(this.props.reduxPathname)).then(function(t){e.setState({available:t})}).catch(function(t){e.setState({errorMessage:"Error in getting available datasets"}),console.warn(t.message)})}},{key:"render",value:function(){return r.createElement(f.A,null,r.createElement(C,{isMobile:this.props.browserDimensions.width<y.By,available:this.state.available,browserDimensions:this.props.browserDimensions,dispatch:this.props.dispatch,errorMessage:this.props.errorMessage||this.state.errorMessage,changePage:g.yd}))}}])&&b(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component))||p},20088(e,t,n){"use strict";n.d(t,{W:()=>g,q:()=>L});var r=n(78281),i=n(49633),o=n(77313),a=n(28355),s=n(85053),l=n(21143),c=n(40952),u=n(48617),h=n(68087),p=n(87473),d=n(22137);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=o.Ay.button.withConfig({displayName:"MutationTable__Button",componentId:"sc-1qenp7x-0"})(["border:0px;background-color:inherit;cursor:pointer;outline:0;text-decoration:underline;font-size:16px;padding:0px 0px;"]),y=function(e,t){var n=[parseInt(e.slice(1,-1),10),parseInt(t.slice(1,-1),10)];return n[0]<n[1]?-1:1},g=function(e){var t=[];return e.sort(y).forEach(function(e,n){var r=parseInt(e.slice(1,-1),10);0===n||r!==t[t.length-1].end+1?t.push({start:r,end:r,count:1,char:e.slice(-1)}):(t[t.length-1].end=r,t[t.length-1].count+=1)}),t},v=o.Ay.p.withConfig({displayName:"MutationTable__Heading",componentId:"sc-1qenp7x-1"})(["margin-top:12px;margin-bottom:4px;"]),b=o.Ay.span.withConfig({displayName:"MutationTable__SubHeading",componentId:"sc-1qenp7x-2"})(["padding-right:8px;"]),w=o.Ay.span.withConfig({displayName:"MutationTable__MutationList",componentId:"sc-1qenp7x-3"})([""]),S=o.Ay.p.withConfig({displayName:"MutationTable__MutationLine",componentId:"sc-1qenp7x-4"})(["margin:0px 0px 4px 0px;font-weight:300;font-size:16px;"]),E=o.Ay.td.withConfig({displayName:"MutationTable__TableFirstColumn",componentId:"sc-1qenp7x-5"})(["font-weight:500;white-space:nowrap;vertical-align:baseline;"]),x=(0,i.Ng)(function(e){return{genomeMap:e.entropy.genomeMap,currentColorBy:e.controls.colorBy,gtFilters:e.controls.filters[c.IW]||[]}})(function(e){var t=e.gene,n=e.mutation,i=e.currentColorBy,o=e.gtFilters,a=e.genomeMap,s=e.dispatch;return r.createElement(m,{onClick:function(e){var r=(0,u.dz)(n),d=r.pos,f=r.to;if(e.metaKey){var m="".concat(t," ").concat(d).concat(f);if(e.shiftKey){var y=new Set(o.filter(function(e){return e.active}).map(function(e){return e.value})).has(m);s((0,p.$h)(y?"inactivate":"add",c.IW,[m]))}else s((0,p.$h)("focus",c.IW,[m]))}else if(e.shiftKey){var g=(0,l.dN)({gene:t,position:d,currentColorBy:i,genomeMap:a});s((0,h.p)(g))}else{var v=(0,l.KC)({gene:t,positions:[d]});s((0,h.p)(v))}}},n)}),k=function(e){var t,n=e.gene,i=e.name,o=e.muts,a=e.displayAsIntervals,s=e.isNuc,l=[];if(a){var c=g(o);t="".concat(i," (").concat(c.length," regions, ").concat(o.length).concat(s?"bp":" codons","):"),l=c.map(function(e){return 1===e.count?"".concat(e.start):"".concat(e.start,"..").concat(e.end," (").concat(e.count," ").concat(s?"bp":"codons",")")})}else t="".concat(i," (").concat(o.length,"):"),l=o.sort(y).map(function(e){return r.createElement(x,{key:e,gene:n,mutation:e})});return r.createElement(S,null,r.createElement(b,{key:i},t),r.createElement(w,null,l.reduce(function(e,t,n){return e.push(t),n<l.length-1&&e.push(", "),e},[])))},C={unique:"Unique",changes:"Changes",homoplasies:"Homoplasies",reversionsToRoot:"Reversions to root",undeletions:"Undeletions",gaps:"Gaps",ns:"Ns "},T=o.Ay.span.withConfig({displayName:"MutationTable__InfoContainer",componentId:"sc-1qenp7x-6"})(["padding-left:10px;cursor:help;color:#888;"]),O=o.Ay.span.withConfig({displayName:"MutationTable__Bold",componentId:"sc-1qenp7x-7"})(["font-weight:900;"]);function _(){return r.createElement(r.Fragment,null,r.createElement(O,null,"Click")," on the mutation to change the color-by to that position."," ",r.createElement(O,null,"Shift+click")," to add/remove mutations from the existing color-by selection, where possible."," ",r.createElement(O,null,"Command+click / Windows+click")," to filter to nodes with that mutated state (holding shift will amend the existing filters).")}var j=r.createElement("div",null,"A summary of mutations inferred to have occurred on this branch."," ",r.createElement(_,null),r.createElement("p",null),"Mutations are grouped into one of the following (mutually exclusive) categories, with the first matching category used:",r.createElement("ol",null,r.createElement("li",null,"Undeletions: a change from a '-' character to a base; beware that these are often bioinformatics artifacts"),r.createElement("li",null,"Gaps: A change to a '-' character, indicating a missing base; these can indicate deletions but sometimes areas of no coverage are filled with gaps"),r.createElement("li",null,"Ns: Typically due to lack of sequence coverage or ambiguity at this position (Nucleotides only)"),r.createElement("li",null,"Homoplasies: a mutation that has also been observed elsewhere on the tree"),r.createElement("li",null,"Unique: Mutations which are only observed on this branch")),"Reversions to Root is an additional category which highlights those mutations which return the state to that of the root. Mutations in this category will also appear one of the five categories listed above.",r.createElement("p",null),"Gaps and Ns are grouped into intervals, as they frequently occur in succession. Click below to copy all changes to clipboard to see the full list."),A=r.createElement("div",null,"A summary of sequence changes between the root and the selected tip."," ",r.createElement(_,null),r.createElement("p",null),"Changes are grouped into one of the following (mutually exclusive) categories, with the first matching category used:",r.createElement("ol",null,r.createElement("li",null,"Gaps: A change to a '-' character, indicating a missing base; these can indicate deletions but sometimes areas of no coverage are filled with gaps"),r.createElement("li",null,"Ns: Typically due to lack of sequence coverage or ambiguity at this position (Nucleotides only)"),r.createElement("li",null,"Reversions to root: The tip state is the same as the root state, however this has changed and been reverted along the way"),r.createElement("li",null,"Changes: The tip state differs from the root state")),"Gaps and Ns are grouped into intervals, as they frequently occur in succession. Click below to copy all changes to clipboard to see the full list."),L=function(e){var t=e.node,n=e.geneSortFn,i=e.isTip,o=e.observedMutations,l=i?(0,s.hc)(t):(0,s.l_)(t,o);return 0===Object.keys(l).length?r.createElement(v,null,i?"No sequence changes observed":"No mutations observed on branch"):r.createElement(r.Fragment,null,r.createElement(v,null,i?"Sequence changes observed (from root)":"Mutations observed on branch",r.createElement(T,{"data-tip":!0,"data-for":"seqChangesInfo"},r.createElement(a.__w,null))),r.createElement(d.FS,{place:"bottom",type:"light",effect:"solid",id:"seqChangesInfo",maxWidth:"50vh"},i?A:j),r.createElement("table",null,r.createElement("tbody",null,Object.keys(l).sort(n).map(function(e){return function(e,t){return 0===Object.values(t).filter(function(e){return e.length}).length?null:r.createElement("tr",{key:e},r.createElement(E,null,"nuc"===e?"Nt":e),r.createElement("td",null,Object.entries(C).map(function(n){var i,o,a=(o=2,function(e){if(Array.isArray(e))return e}(i=n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(i,o)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(i,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=a[0],l=a[1];return s in t&&t[s].length?r.createElement(k,{gene:e,key:l,name:l,muts:t[s],displayAsIntervals:"gaps"===s||"ns"===s||"undeletions"===s,isNuc:"nuc"===e}):null})))}(e,l[e])}),r.createElement("tr",null,r.createElement("td",null),r.createElement("td",null,r.createElement(m,{onClick:function(){navigator.clipboard.writeText(function(e,t){return Object.keys(e).sort(t).map(function(t){return Object.keys(C).filter(function(n){return n in e[t]&&e[t][n].length}).map(function(n){return"".concat(t,"\t").concat(n,"\t").concat(e[t][n].sort(y).join(", "))})}).flat().join("\n")}(l,n))}},"Click to copy all ".concat(i?"changes":"mutations"," to clipboard as TSV")))))))}},97805(e,t,n){"use strict";n.d(t,{Ay:()=>x,C6:()=>f});var r=n(78281),i=n(40952),o=n(4124),a=n(61373),s=n(85053),l=n(20088),c=n(89270),u=n(38596);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e,t,n){return(t=function(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f=function(e){e||(e=window.event),e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()},m=function(e,t,n){return r.createElement("tr",{key:e},r.createElement("th",{style:o.vS.item},e),r.createElement("td",{style:o.vS.item},n?r.createElement("a",{href:n,target:"_blank",rel:"noopener noreferrer"},t):t))},y=function(e){var t=e.url,n=e.title,i=e.value;return r.createElement("tr",null,r.createElement("th",{style:o.vS.item},n),r.createElement("td",{style:o.vS.item},r.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer"},i)))},g=function(e){var t=e.node,n=(0,s.hu)(t,"gisaid_epi_isl"),o=(0,s.hu)(t,"genbank_accession"),a=null,l=null;if((0,i.QF)(n))if(new RegExp("EPI_ISL_[0-9]{5,}").test(n)){var c=n.split("_")[2];a="https://www.epicov.org/acknowledgement/"+c.slice(-4,-2)+"/"+c.slice(-2)+"/"+n+".json"}else a="https://gisaid.org";if((0,i.QF)(o)&&(l="https://www.ncbi.nlm.nih.gov/nuccore/"+o),(0,i.QF)(n)&&(0,i.QF)(o))return r.createElement(r.Fragment,null,r.createElement(y,{title:"GISAID EPI ISL",value:n,url:a}),r.createElement(y,{title:"Genbank accession",value:o,url:l}));if((0,i.QF)(n))return r.createElement(y,{title:"GISAID EPI ISL",value:n,url:a});if((0,i.QF)(o))return r.createElement(y,{title:"Genbank accession",value:o,url:l});var u=(0,s.L$)(t),h=u.accession,p=u.url;return h&&p?r.createElement(y,{url:p,value:h,title:"Accession"}):h?m("Accession",h):p?r.createElement(y,{title:"Strain URL",url:p,value:"click here"}):null},v=function(e){var t=e.node,n=e.t,i=(0,s.Qw)(t);if(!i)return null;var o=[];return i.selection_date&&o.push(r.createElement("tr",{key:"seldate"},r.createElement("th",null,n("Vaccine selected")),r.createElement("td",null,i.selection_date))),i.start_date&&o.push(r.createElement("tr",{key:"startdate"},r.createElement("th",null,n("Vaccine start date")),r.createElement("td",null,i.start_date))),i.end_date&&o.push(r.createElement("tr",{key:"enddate"},r.createElement("th",null,n("Vaccine end date")),r.createElement("td",null,i.end_date))),i.serum&&o.push(r.createElement("tr",{key:"serum"},r.createElement("th",null,n("Serum strain")),r.createElement("td",null))),o},b=function(e){var t=e.node,n=e.t,r=(0,s.tg)(t);if(!r)return null;var i=[];return i.push(m(n("Authors"),r.value)),r.title&&"?"!==r.title&&(r.paper_url&&"?"!==r.paper_url?i.push(m(n("Title"),r.title,r.paper_url)):i.push(m(n("Title"),r.title))),r.journal&&"?"!==r.journal&&i.push(m(n("Journal"),r.journal)),1===i.length?i[0]:i},w=function(e){var t=e.children;return r.createElement("p",{style:o.vS.modalHeading},t)},S=function(e){var t=e.isTerminal,n=e.node,i=e.t,o=(0,u.h)(n,t),a=o.date,s=o.dateRange,l=o.inferred,c=o.ambiguousDate;if(!a)return null;var h=t?l?"Inferred collection date":"Collection date":"Inferred date";return r.createElement(r.Fragment,null,m(i(h),a),l&&s&&m(i("Date Confidence Interval"),"(".concat(s.join(", "),")")),c&&m(i("Provided date"),c))},E=function(e){var t,n=e.node,o=e.trait,l=e.colorings,c=e.isTerminal,u=(0,s.hu)(n,o),h=(0,s.hu)(n,o,{confidence:!0}),p="temporal"===(null===(t=l[o])||void 0===t?void 0:t.type);if("number"!=typeof u||p||Number.isInteger(u)||(u=Number.parseFloat(u).toPrecision(3)),!(0,i.QF)(u))return null;h&&u in h&&(!c||h[u]<.99)&&(u="".concat(u," (").concat((100*h[u]).toFixed(0),"%)"));var d=l&&l[o]&&l[o].title?l[o].title:o;p&&"number"==typeof u&&(u=(0,a.bq)(u));var f=(0,s.cl)(n,o);return f?r.createElement(y,{title:d,url:f,value:u}):m(d,u)};const x=function(e){var t,n=e.selectedNode,a=e.nodesLhsTree,s=e.nodesRhsTree,h=e.clearSelectedNode,y=e.colorings,x=e.observedMutations,k=e.geneSortFn,C=e.tipLabelKey,T=e.t;if((0,r.useEffect)(function(){if(n)return document.addEventListener("keyup",e),function(){document.removeEventListener("keyup",e)};function e(e){"Escape"===e.key&&h(n)}},[n,h]),!n)return null;var O=null===(t=n.treeId===c.V9?a:s)||void 0===t?void 0:t[n.idx];if(!O)return console.error("Internal error retrieving selected node"),null;var _=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},o.vS.panel);_.maxHeight="70%";var j=!O.hasChildren,A=!n.isBranch,L=C!==i.Uf||!j;return r.createElement("div",{style:o.vS.modalContainer,onClick:function(){return h(n)}},r.createElement("div",{className:"panel",style:_,onClick:function(e){return f(e)}},r.createElement(w,null,(0,u.E)(T,O,C,!A)),r.createElement("table",null,r.createElement("tbody",null,!j&&m(T("Number of terminal tips"),O.fullTipCount),L&&m(T("Node name"),O.name),A&&r.createElement(v,{node:O,t:T}),r.createElement(S,{isTerminal:j,node:O,t:T}),A&&r.createElement(b,{node:O,t:T}),function(e){if(!e.node_attrs)return[];var t=["author","div","num_date","gisaid_epi_isl","genbank_accession","accession","url"];return Object.keys(e.node_attrs).filter(function(e){return!t.includes(e)})}(O).map(function(e){return r.createElement(E,{node:O,trait:e,colorings:y,key:e,isTerminal:j})}),A&&r.createElement(g,{node:O}),m("",""))),r.createElement(l.q,{node:O,geneSortFn:k,isTip:A,observedMutations:x}),r.createElement("p",{style:o.vS.comment},T("Click outside this box to go back to the tree"))))}},38596(e,t,n){"use strict";n.d(t,{E:()=>o,h:()=>a});var r=n(85053),i=n(61373);function o(e,t,n,o){var a=(0,r.hu)(t,n);"num_date"===n&&a&&(a=(0,i.bq)(a));var s=!t.hasChildren;return o?s?a?e("Branch leading to {{tipLabel}}",{tipLabel:a}):e("Terminal branch"):e("Internal branch"):a}function a(e,t){var n,o,a=(0,r.hu)(e,"num_date");if(!a)return{};var s=(0,r.hu)(e,"num_date",{confidence:!0});t?Object.hasOwn(e.node_attrs.num_date,"inferred")?(n=e.node_attrs.num_date.inferred,o=(0,r.hu)(e,"num_date",{raw:!0})):n=s&&s[0]!==s[1]:n=!0;var l=s?[(0,i.bq)(s[0]),(0,i.bq)(s[1])]:void 0;return{date:(0,i.bq)(a),dateRange:l,inferred:n,ambiguousDate:o}}},5699(e,t,n){"use strict";n.d(t,{A:()=>A,d:()=>v});var r=n(78281),i=n(4124),o=n(61373),a=n(57758),s=n(21143),l=n(85053),c=n(40952),u=n(77887),h=n(20088),p=n(38596),d=n(82833);function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return g(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=function(e){var t=e.name,n=e.value,i=e.padBelow,o=void 0!==i&&i;return r.createElement("div",{style:{paddingBottom:o?"15px":"10px"},key:t},r.createElement("span",{style:{fontWeight:"500"}},t+" "),n||0===n?Array.isArray(n)?n.map(function(e){return r.createElement("div",{key:e,style:{fontWeight:"300",marginLeft:"0em"}},e)}):r.createElement("span",{style:{fontWeight:"300"}},n):null)},b=function(e){var t=e.node,n=e.t,i=e.isTerminal,o=[],a=(0,l.Ue)(t);a&&o.push(r.createElement(v,{name:n("Divergence")+":",value:(0,u.C2)(a),key:"div"}));var s=(0,p.h)(t,i),c=s.date,h=s.dateRange,d=s.inferred,f=s.ambiguousDate;if(c){var m=d?"Inferred Date":"Date";o.push(r.createElement(v,{name:n(m)+":",value:c,key:"date"})),d&&h&&o.push(r.createElement(v,{name:n("Date Confidence Interval")+":",value:"(".concat(h.join(", "),")"),key:"dateConf"})),f&&o.push(r.createElement(v,{name:n("Provided Date")+":",value:f,key:"date"}))}return o},w=function(e){var t=e.node,n=e.colorBy,i=e.colorByConfidence,u=e.colorScale,h=e.colorings;if("num_date"===n)return null;if((0,s.Sv)(n)){var p=(0,s.kh)(n),d=p.aa?"Amino Acid at ".concat(p.gene," site ").concat(p.positions.join(", "),":"):"Nucleotide at pos ".concat(p.positions.join(", "),":");return r.createElement(v,{name:d,value:(0,a.RQ)(t,u)})}if("author"===n){var f=(0,l.tg)(t);return f?r.createElement(r.Fragment,null,f.title?r.createElement(v,{name:"Title:",value:f.title}):null,f.journal?r.createElement(v,{name:"Journal:",value:f.journal}):null):null}var m=h&&h[n]&&h[n].title?h[n].title:n,y=(0,l.hu)(t,n);if("temporal"===u.scaleType&&"number"==typeof y)return r.createElement(v,{name:"".concat(m,":"),value:(0,o.bq)(y)});var g=function(){return(0,c.QF)(y)?r.createElement(v,{name:"".concat(m,":"),value:y}):null};if(!0===i){var b=(0,l.hu)(t,n,{confidence:!0});if(!b)return console.error("couldn't find confidence vals for ",n),null;if(!t.hasChildren&&1===Object.keys(b).length&&Object.values(b)[0]>.99)return g();var w=Object.keys(b).filter(function(e){return(0,c.QF)(e)}).sort(function(e,t){return b[e]>b[t]?-1:1}).slice(0,4).map(function(e){return"".concat(e," (").concat((100*b[e]).toFixed(0),"%)")});return w.length?r.createElement(v,{name:"".concat(m," (confidence):"),value:w}):null}return g()},S=function(e){var t=e.node,n=e.t,i=(0,l.hc)(t);if(!i.nuc)return null;var o={changes:0,gaps:0,reversionsToRoot:0,ns:0},a={changes:0,gaps:0,reversionsToRoot:0};Object.keys(i).forEach(function(e){Object.entries(i[e]).forEach(function(t){var n=m(t,2),r=n[0],i=n[1];"nuc"===e?o[r]+=i.length:a[r]+=i.length})});var s="".concat(o.changes).concat(o.reversionsToRoot?" + ".concat(o.reversionsToRoot," reversions to root"):"");s+="".concat(o.gaps?" + ".concat(o.gaps," gaps"):"").concat(o.nt?" + ".concat(o.nt," Ns"):"");var c="".concat(a.changes).concat(a.reversionsToRoot?" + ".concat(a.reversionsToRoot," reversions to root"):"");return c+="".concat(a.gaps?" + ".concat(a.gaps," gaps"):""),[r.createElement(v,{name:n("Nucleotide changes")+":",value:s,key:"nuc"}),r.createElement(v,{name:n("Amino Acid changes")+":",value:c,key:"aa"})]},E=function(e){var t=e.node,n=e.geneSortFn,i=e.observedMutations,o=e.proteinOnly,a=e.t;if(!t.branch_attrs||!t.branch_attrs.mutations)return null;var s=[],c=t.branch_attrs.mutations,u=(0,l.l_)(t,i),p=function(e,t){return e.slice(0,Math.min(t,e.length)).join(", ")+(e.length>t?" + ".concat(e.length-t," more"):"")};if(o);else if(u.nuc){if(u.nuc.unique.length&&s.push(r.createElement(v,{name:"Unique Nucleotide mutations:",value:p(u.nuc.unique,5),key:"nuc_unique"})),u.nuc.homoplasies.length&&s.push(r.createElement(v,{name:"Homoplasic mutations:",value:p(u.nuc.homoplasies,5),key:"nuc_homoplasies"})),u.nuc.reversionsToRoot.length&&s.push(r.createElement(v,{name:"Reversions to Root:",value:u.nuc.reversionsToRoot.length,key:"nuc_rtr"})),u.nuc.gaps.length){var d="".concat((0,h.W)(u.nuc.gaps).length," regions, ").concat(u.nuc.gaps.length,"bp.");s.push(r.createElement(v,{name:"Gaps:",value:d,key:"nuc_gaps"}))}if(u.nuc.undeletions.length){var m="".concat((0,h.W)(u.nuc.undeletions).length," regions, ").concat(u.nuc.undeletions.length,"bp.");s.push(r.createElement(v,{name:"Undeletions:",value:m,key:"nuc_undeletions"}))}if(u.nuc.ns.length){var y="".concat((0,h.W)(u.nuc.ns).length," regions, ").concat(u.nuc.ns.length,"bp.");s.push(r.createElement(v,{name:"Ns:",value:y,key:"nuc_ns"}))}}else s.push(r.createElement(v,{name:a("No nucleotide mutations"),value:"",key:"nuc"}));var g,b=Object.keys(c).sort(n).filter(function(e){return"nuc"!==e}),w={},S=!1,E=f(b);try{for(E.s();!(g=E.n()).done;){var x=g.value,k=c[x].filter(function(e){return!e.endsWith("X")});k.length&&(w[x]=k,S=!0)}}catch(e){E.e(e)}finally{E.f()}if(S){var C=[];Object.keys(w).forEach(function(e,t){if(t<7){var n=e+":  "+w[e].slice(0,Math.min(3,w[e].length)).join(", ");w[e].length>3&&(n+=" + "+a("{{x}} more",{x:w[e].length-3})),C.push(n)}else 7===t&&C.push("(".concat(a("protein mutations truncated"),")"))}),s.push(r.createElement(v,{name:a("AA mutations")+":",value:C,key:"aa"}))}else c.nuc&&c.nuc.length&&s.push(r.createElement(v,{name:a("No amino acid mutations"),key:"aa"}));return s},x=function(e){var t=e.node,n=e.t,i=e.tipLabelKey,o=m(1===t.fullTipCount?[(0,p.E)(n,t,i,!0),""]:[n("Number of descendants")+":",t.fullTipCount],2),a=o[0],s=o[1];return r.createElement(v,{name:a,value:s,padBelow:!0})},k=function(e){var t=e.node,n=e.t,i=(0,l.Qw)(t);if(!i)return null;var o=[];return i.selection_date&&o.push(r.createElement(v,{name:n("Vaccine selected")+":",value:i.selection_date,key:"seldate"})),i.start_date&&o.push(r.createElement(v,{name:n("Vaccine start date")+":",value:i.start_date,key:"startdate"})),i.end_date&&o.push(r.createElement(v,{name:n("Vaccine end date")+":",value:i.end_date,key:"enddate"})),i.serum&&o.push(r.createElement(v,{name:n("Serum strain"),key:"serum"})),o},C=function(e){var t=e.node,n=[],i=(0,l.tg)(t);i&&n.push(r.createElement(v,{name:"Author:",value:i.value,key:"author"}));var o=(0,l.hu)(t,"gisaid_epi_isl");if((0,c.QF)(o)){var a=o.split("_")[2];n.push(r.createElement(v,{name:"GISAID EPI ISL:",value:a,key:"gisaid_epi_isl"}))}return n},T=function(e){var t,n,o,a=e.node,s=e.panelDims,l=e.children,c=e.xy,u=void 0===c?void 0:c;if(o=s.width<420?200:s.width<460?220:s.width<500?240:s.width<540?260:280,u){var h=m(u,2);t=h[0],n=h[1]}else t=-1===a.shell.that.params.orientation[0]?s.width/2+s.spaceBetweenTrees+a.shell.xTip:a.shell.xTip,n=a.shell.yTip;var p={container:{position:"absolute",width:o,padding:"10px",borderRadius:10,zIndex:1e3,pointerEvents:"none",fontFamily:i.vS.panel.fontFamily,fontSize:14,lineHeight:1,fontWeight:i.vS.panel.fontWeight,color:i.vS.panel.color,backgroundColor:i.vS.panel.backgroundColor,wordWrap:"break-word",wordBreak:"break-word"}};return t<.5*s.width?p.container.left=t+10:p.container.right=s.width-t+10,n<.55*s.height?p.container.top=n+40:p.container.bottom=s.height-n+10,r.createElement("div",{style:p.container},r.createElement("div",{className:"tooltip",style:i.vS.tooltip},l))},O=function(e){var t=e.children;return r.createElement("div",{style:i.vS.comment},t)};function _(e){var t=e.node,n=e.streamDetails,o=e.colorBy,a=(0,u.bP)(t),s=t.shell.that.streams[d.d0],l=t.streamNodeCounts,h=l.total===l.visible?"".concat(l.total," (all visible)"):"".concat(l.visible,"/").concat(l.total),p=t.streamCategories[n.categoryIndex].name,f=t.streamCategories.filter(function(e){return e.name===p}).at(0).nodes,m=f.filter(function(e){return t.shell.that.nodes[e].visibility===c.uU}).length,y=m===f.length?"".concat(m," (all visible)"):"".concat(m,"/").concat(f.length);return r.createElement(r.Fragment,null,r.createElement("div",{style:i.vS.tooltipHeading},"Streamtree for ".concat(s," ").concat(t.streamName)),r.createElement(v,{name:"Visible tips (entire streamtree):",value:h}),r.createElement("div",{style:i.vS.tooltipHeading},"Ripple (".concat(o,"): ").concat(null!=p?p:"(missing data)")),r.createElement(v,{name:"Visible tips (this category):",value:y}),r.createElement("div",{style:{paddingTop:"5px"}},a===t.arrayIdx?"Click to zoom out":"Click to zoom into stream"))}function j(e){for(var t=e.node,n=e.lineType,o=t.shell.that.streams,a=0,s=function(e){if(Array.isArray(e))return g(e)}(h=o[t.streamName].streamChildren)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(h)||y(h)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();s.length;){a++;var l,c=f(o[s.pop()].streamChildren);try{for(c.s();!(l=c.n()).done;){var u=l.value;s.push(u)}}catch(e){c.e(e)}finally{c.f()}}var h,p=t.fullTipCount===t.tipCount?"".concat(t.tipCount," tips (all visible)"):"".concat(t.tipCount," visible tips (out of ").concat(t.fullTipCount,")"),d=t.streamNodeCounts,m=d.total===d.visible?"".concat(d.total," tips (all visible)"):"".concat(d.visible," visible tips (out of ").concat(d.total,")"),b="joiner"===n?"Connection to stream: ".concat(t.streamName):"Stream: ".concat(t.streamName);return r.createElement(r.Fragment,null,r.createElement("div",{style:i.vS.tooltipHeading},b),r.createElement(v,{name:"Stream ".concat(t.streamName," comprises"),value:m}),a>0?r.createElement(r.Fragment,null,r.createElement(v,{name:"Further streams originate from this one",value:"(n=".concat(a,")")}),r.createElement(v,{name:"All streams (together) summarise",value:p})):r.createElement(v,{name:"No further streams originate from this one",value:""}))}const A=function(e){var t=e.selectedNode,n=e.colorBy,o=e.colorByConfidence,a=e.colorScale,s=e.panelDims,l=e.colorings,h=e.geneSortFn,d=e.observedMutations,f=e.tipLabelKey,m=e.proteinOnly,y=e.t;if(!t)return null;var g=t.node.n,A=(0,u.bP)(g);return t.streamDetails?r.createElement(T,{node:g,panelDims:s,xy:[t.streamDetails.x,t.streamDetails.y]},t.isBranch?r.createElement(j,{node:g,lineType:["joiner","backbone"][t.streamDetails.categoryIndex]}):r.createElement(_,{node:g,streamDetails:t.streamDetails,colorBy:n})):r.createElement(T,{node:g,panelDims:s},!1===t.isBranch?r.createElement(r.Fragment,null,r.createElement("div",{style:i.vS.tooltipHeading},(0,p.E)(y,g,f,!1)),f!==c.Uf&&r.createElement(v,{name:"Node name:",value:g.name}),r.createElement(k,{node:g,t:y}),r.createElement(S,{node:g,t:y}),r.createElement(b,{node:g,t:y,isTerminal:!0}),r.createElement(w,{node:g,colorBy:n,colorByConfidence:o,colorScale:a,colorings:l}),r.createElement(C,{node:g}),r.createElement(O,null,y("Click on tip to display more info"))):r.createElement(r.Fragment,null,r.createElement(x,{node:g,t:y,tipLabelKey:f}),r.createElement(E,{node:g,geneSortFn:h,observedMutations:d,proteinOnly:m,t:y}),r.createElement(b,{node:g,t:y,isTerminal:!1}),r.createElement(w,{node:g,colorBy:n,colorByConfidence:o,colorScale:a,colorings:l}),r.createElement(O,null,A===g.arrayIdx?y("Click to zoom out to parent clade"):y("Click to zoom into clade")),r.createElement(O,null,y("Shift + Click to display more info"))))}},80755(e,t,n){"use strict";n.d(t,{A:()=>_});var r=n(78281),i=n(49633),o=n(58143),a=n(87473),s=n(4124);const l=function(e){var t=e.dispatch,n=e.transform,i=e.clipId,o=e.legendRectSize,l=e.legendSpacing,c=e.rectStroke,u=e.rectFill,h=e.label,p=e.tooltip,d=e.value,f=e.handleOnClick;return r.createElement("g",{transform:n,onMouseEnter:function(){t((0,a.UW)({selectedLegendItem:d}))},onMouseLeave:function(){t((0,a.UW)())},onClick:function(e){return f(e)}},r.createElement("rect",{style:{strokeWidth:2},width:o,height:o,fill:u,stroke:c},r.createElement("title",null,p)),r.createElement("text",{x:o+l+5,y:o-l,style:{fontSize:12,fill:s.KD,fontFamily:s.sf},clipPath:i?"url(#".concat(i,")"):void 0},r.createElement("title",null,p),h))};var c,u=n(40952),h=n(57758),p=n(92827),d=n(61373),f=n(99438),m=n(479),y=n(21143),g=n(8791);function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S(r.key),r)}}function S(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},E(e,t)}function x(e){var t=C();return function(){var n,r=T(e);if(t){var i=T(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}(this,n)}}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function O(e,t){if(!e.continuous)return t;var n=e.legendBounds[t],r="num_date"===e.colorBy;return"Bounds: ".concat((0,p.n6)(n,r))}const _=(0,i.Ng)(function(e){return{colorBy:e.controls.colorBy,colorings:e.metadata.colorings,colorScale:e.controls.colorScale,legendOpen:e.controls.legendOpen}})(c=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E(e,t)}(a,e);var t,n,i=x(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this,e)).handleLegendItemOnClick=t.handleLegendItemOnClick.bind(k(t)),t}return t=a,n=[{key:"showLegend",value:function(){return void 0!==this.props.legendOpen?this.props.legendOpen:!(this.props.width<600||this.props.colorScale.visibleLegendValues.length>32)}},{key:"getSVGHeight",value:function(){if(!this.showLegend())return 18;var e=this.props.colorScale.visibleLegendValues.length;return 19*Math.ceil(e/2)+4+20||100}},{key:"getSVGWidth",value:function(){return this.showLegend()?290:this.getTitleWidth()+20}},{key:"getTransformationForLegendItem",value:function(e,t){var n=Math.floor(t/e),r=t%e*19;return"translate(".concat(145*n+10,",").concat(r,")")}},{key:"getTitleWidth",value:function(){return 15+5.3*(0,h.De)(this.props.colorings,this.props.colorBy).length}},{key:"toggleLegend",value:function(){this.props.dispatch({type:f.v,value:!this.props.legendOpen})}},{key:"legendTitle",value:function(){return r.createElement("g",{id:"Title"},r.createElement("rect",{width:this.getTitleWidth(),height:"12",fill:"rgba(255,255,255,.85)"}),r.createElement("text",{x:this.getTitleOffset(),y:10,style:{fontSize:12,fill:s.KD,fontFamily:s.PT,backgroundColor:"#fff"}},(0,h.De)(this.props.colorings,this.props.colorBy)))}},{key:"legendChevron",value:function(){var e=this.showLegend()?-180:0,t=this.getArrowOffset();return r.createElement("g",{id:"Chevron",transform:"translate(".concat(t,",0)")},r.createElement("svg",{width:"12",height:"12",viewBox:"0 0 1792 1792"},r.createElement("rect",{width:"1792",height:"1792",fill:"rgba(255,255,255,.85)"}),r.createElement("path",{fill:s.KD,style:{transform:"rotate(".concat(e,"deg)"),transformOrigin:"50% 50%",transition:"".concat(u.WW,"ms ease-in-out")},d:"M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"})))}},{key:"styleLabelText",value:function(e){if(this.props.colorScale.legendLabels&&this.props.colorScale.legendLabels.has(e))return this.props.colorScale.legendLabels.get(e);if("num_date"===this.props.colorBy||"temporal"===this.props.colorScale.scaleType){var t=this.props.colorScale.visibleLegendValues;if(t[t.length-1]-t[0]>10&&t[t.length-1]-parseInt(e,10)>=10)return parseInt(e,10);var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,d.bq)(e).split("-"),3),r=n[0],i=n[1];return n[2],"".concat(u.US[i]," ").concat(r)}return e}},{key:"handleLegendItemOnClick",value:function(e){(0,g.DC)()&&e.shiftKey&&((0,y.Sv)(this.props.colorBy)?this.props.dispatch((0,m.Ul)({message:"Genotype color editing is not currently supported",autoClose:!0})):this.props.dispatch({type:f.vN,modal:"colorByEditor"}))}},{key:"legendItems",value:function(){var e=this,t=this.props.colorScale.visibleLegendValues,n=Math.ceil(t.length/2),i=t.filter(function(e){return void 0!==e}).map(function(t,i){return r.createElement(l,{dispatch:e.props.dispatch,legendRectSize:15,legendSpacing:4,rectFill:(0,h.rQ)(e.props.colorScale.scale(t)),rectStroke:(0,o.Qh)(e.props.colorScale.scale(t)).toString(),transform:e.getTransformationForLegendItem(n,i),key:e.props.colorScale.colorBy+t+i,value:t,label:e.styleLabelText(t),index:i,tooltip:O(e.props.colorScale,t),clipId:i<n?"legendFirstColumnClip":void 0,handleOnClick:e.handleLegendItemOnClick})});return r.createElement("g",{id:"ItemsContainer"},r.createElement("rect",{width:this.getSVGWidth(),height:this.getSVGHeight(),fill:"rgba(255,255,255,.85)"}),r.createElement("clipPath",{id:"legendFirstColumnClip"},r.createElement("rect",{x:"0",y:"0",width:140,height:this.getSVGHeight(),fill:"rgb(150, 154, 223)"})),r.createElement("g",{id:"Items",transform:"translate(0,20)"},i))}},{key:"getContainerStyles",value:function(){var e={position:"absolute",borderRadius:4,zIndex:1e3,userSelect:"none"},t=this.props.legendPlacement,n=t.vertical,r=t.horizontal;return e[n]=26,e[r]=5,e}},{key:"getArrowOffset",value:function(){return"right"===this.props.legendPlacement.horizontal?this.getSVGWidth()-20:this.getTitleWidth()}},{key:"getTitleOffset",value:function(){return"right"===this.props.legendPlacement.horizontal?this.getSVGWidth()-this.getTitleWidth()-15:5}},{key:"render",value:function(){var e=this;return this.props.colorScale?r.createElement("svg",{id:"TreeLegendContainer",width:this.getSVGWidth(),height:this.getSVGHeight(),style:this.getContainerStyles()},this.legendItems(),r.createElement("g",{id:"TitleAndChevron",onClick:function(){return e.toggleLegend()},style:{cursor:"pointer",textAlign:"right"}},this.legendTitle(),this.legendChevron())):null}}],n&&w(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(r.Component))||c},58026(e,t,n){"use strict";n.d(t,{Hg:()=>f,Jz:()=>y,ho:()=>p,s1:()=>g,yU:()=>m});var r=n(48800),i=n(28158),o=n(71595),a=n(32172),s=(n(66565),n(40952)),l=n(77887),c=n(61373);function u(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var p=function(){"majorGrid"in this.groups&&this.groups.majorGrid.selectAll("*").style("visibility","hidden"),"minorGrid"in this.groups&&this.groups.minorGrid.selectAll("*").style("visibility","hidden"),"gridText"in this.groups&&this.groups.gridText.selectAll("*").style("visibility","hidden"),"axisText"in this.groups&&this.groups.axisText.selectAll("*").style("visibility","hidden")},d=function(e,t,n,r,i){for(var o=[],a=[],s=function(e,t){var n=Math.floor(Math.log10(e)),r=Math.pow(10,n);e/r<2?r/=5:e/r<5&&(r/=2);var i=t;return 5!==r&&10!==r||(i=5),{majorStep:r,minorStep:r/i}}(t-e,r),l=s.majorStep,c=s.minorStep,u=Math.floor(e/l)*l,h="radial"===n?e:u,p=t,d=0;d<=(t-u)/l+3;d++){var f=u+l*d;o.push({position:f,name:f.toFixed(Math.max(0,-Math.floor(Math.log10(l)))),visibility:f<h||f>p?"hidden":"visible",axis:i});for(var m=f+c;m<f+l&&m<t;m+=c)a.push({position:m,visibility:m<h||m>p+c?"hidden":"visible",axis:i})}return{majorGridPoints:o,minorGridPoints:a}},f=function(e,t,n,r){for(var i=[],o=[],a=function(e,t){var n={unit:"DAY",n:1},r={unit:"DAY",n:0},i=t<1e3?130:180,o=e/Math.floor(t/i),a={CENTURY:{t:100,max:void 0},DECADE:{t:10,max:5},FIVEYEAR:{t:5,max:1},YEAR:{t:1,max:3},MONTH:{t:1/12,max:6},WEEK:{t:1/52,max:1},DAY:{t:1/365,max:3}},s=Object.keys(a);n.unit="DAY";for(var l=0;l<s.length-1;l++)if(o>a[s[l]].t){n.unit=s[l];break}n.n=Math.floor(o/a[n.unit].t)||1,a[n.unit].max&&n.n>a[n.unit].max&&(n.unit=s[s.indexOf(n.unit)-1],n.n=Math.floor(o/a[n.unit].t)||1),n.n>1||"DAY"===n.unit?r.unit=n.unit:r.unit=s[s.indexOf(n.unit)+1];var c=n.n*a[n.unit].t;return r.n=Math.ceil(a[r.unit].t/c),{majorStep:n,minorStep:r}}(t-e,Math.abs(n)),s=a.majorStep,l=a.minorStep,u=(0,c.My)(s.unit,(0,c.As)(t)),h=(0,c.IS)(s.unit,(0,c.As)(e));h<u;){i.push({date:h,position:(0,c.rT)((0,c.$T)(h)),name:(0,c.CC)(s.unit,h),visibility:"visible",axis:r});for(var p=0;p<s.n;p++)h=(0,c.My)(s.unit,h)}return l.n&&i.forEach(function(e,t){h=(0,c.My)(l.unit,e.date);for(var n=0;n<l.n-1;n++)h=(0,c.My)(l.unit,h);for(var a=t===i.length-1?u:i[t+1].date;h<a;){o.push({position:(0,c.rT)((0,c.$T)(h)),visibility:"visible",axis:r});for(var s=0;s<l.n;s++)h=(0,c.My)(l.unit,h)}}),{majorGridPoints:i,minorGridPoints:o}},m=function(){var e,t,n=this.layout;if(e=this.groups,t=this.svg,"temporalWindow"in e||(e.temporalWindow=t.append("g").attr("id","temporalWindow"),e.temporalWindowStart=e.temporalWindow.append("rect").attr("class","temporalWindowStart"),e.temporalWindowEnd=e.temporalWindow.append("rect").attr("class","temporalWindowEnd")),"majorGrid"in e||(e.majorGrid=t.append("g").attr("id","majorGrid").attr("clip-path","url(#treeClip)")),"minorGrid"in e||(e.minorGrid=t.append("g").attr("id","minorGrid").attr("clip-path","url(#treeClip)")),"gridText"in e||(e.gridText=t.append("g").attr("id","gridText")),"axisText"in e||(e.axisText=t.append("g").attr("id","axisText")),"unrooted"!==n){var o,a,s,c=(0,i.A)(this.yScale.domain()),h=(0,r.A)(this.yScale.domain()),p="radial"===n?this.nodes[0].depth:this.xScale.domain()[0],m="radial"===n?p+(0,r.A)([this.xScale.domain()[1],this.yScale.domain()[1],-this.xScale.domain()[0],-this.yScale.domain()[0]]):this.xScale.domain()[1],y=this.xScale.range()[1]-this.xScale.range()[0],g="scatter"===this.layout&&"num_date"===this.scatterVariables.x||"clock"===this.layout||"scatter"!==this.layout&&"num_date"===this.distance?f(p,m,y,"x"):"scatter"!==this.layout||this.scatterVariables.xContinuous?d(p,m,n,this.params.minorTicks,"x"):{majorGridPoints:this.xScale.domain().map(function(e){return{name:e,visibility:"visible",axis:"x",position:e}}),minorGridPoints:[]},v=g.majorGridPoints,b=g.minorGridPoints,w=function(e,t,n){return function(r){var i="";if("x"===r.axis){if("rect"===n||"clock"===n||"scatter"===n){var o=e(r.position);i="M"+o.toString()+" "+t.range()[1].toString()+" L "+o.toString()+" "+t.range()[0].toString()}else if("radial"===n){var a=r.position-p,s=e(Math.max(a,0));i="M "+s.toString()+"  "+t(0).toString()+" A "+(s-e(0)).toString()+" "+(t(r.position)-t(p)).toString()+" 0 1 0 "+s.toString()+" "+(t(0)+.001).toString()}}else if("y"===r.axis){var l=t(r.position);i="M".concat(e(p)+20," ").concat(l," L ").concat(e(m)," ").concat(l)}return i}};if("clock"===this.layout||"scatter"===this.layout)if("scatter"===this.layout&&"num_date"===this.scatterVariables.y){var S=this.yScale.range()[1]-this.yScale.range()[0],E=f(c,h,S,"y");v.push.apply(v,u(E.majorGridPoints))}else if("scatter"!==this.layout||this.scatterVariables.yContinuous){var x=d(c,h,n,1,"y");v.push.apply(v,u(x.majorGridPoints))}else v.push.apply(v,u(this.yScale.domain().map(function(e){return{name:e,visibility:"visible",axis:"y",position:e}})));this.groups.majorGrid.selectAll("*").remove(),this.groups.majorGrid.selectAll(".majorGrid").data(v).enter().append("path").attr("d",w(this.xScale,this.yScale,n)).attr("class","majorGrid").style("fill","none").style("visibility",function(e){return e.visibility}).style("stroke",this.params.majorGridStroke).style("stroke-width",this.params.majorGridWidth),this.groups.minorGrid.selectAll("*").remove(),this.svg.selectAll(".minorGrid").remove(),this.groups.minorGrid.selectAll(".minorGrid").data(b).enter().append("path").attr("d",w(this.xScale,this.yScale,n)).attr("class","minorGrid").style("fill","none").style("visibility",function(e){return e.visibility}).style("stroke",this.params.minorGridStroke).style("stroke-width",this.params.minorGridWidth),this.groups.gridText.selectAll("*").remove(),this.svg.selectAll(".gridText").remove(),this.groups.gridText.selectAll(".gridText").data(v).enter().append("text").text(function(e){return e.name}).attr("class","gridText").style("font-size",this.params.tickLabelSize).style("font-family",this.params.fontFamily).style("fill",this.params.tickLabelFill).style("text-anchor",(o=n,function(e){return"x"===e.axis?"radial"===o?"end":"middle":"start"})).style("visibility",function(e){return e.visibility}).attr("x",function(e,t){return function(n){return"x"===n.axis?e("radial"===t?0:n.position):e.range()[0]-15}}(this.xScale,n)).attr("y",function(e,t){return function(n){if("x"===n.axis){var r=n.position-p;return"radial"===t?e(Math.max(r,0))-5:e.range()[1]+18}return e(n.position)}}(this.yScale,n)),this.groups.axisText.selectAll("*").remove(),this.svg.selectAll(".axisText").remove(),"clock"===n?(s="Date",a=(0,l.Qh)(this.yScale)?"Divergence":"Mutations"):"scatter"===n?("div"===(s=this.scatterVariables.xLabel)&&(s=(0,l.Qh)(this.xScale)?"Divergence":"Mutations"),"div"===(a=this.scatterVariables.yLabel)&&(a=(0,l.Qh)(this.yScale)?"Divergence":"Mutations")):"rect"===n&&(s="num_date"===this.distance?"Date":(0,l.Qh)(this.xScale)?"Divergence":"Mutations"),s&&this.groups.axisText.append("text").text(s).attr("class","gridText").style("font-size",this.params.tickLabelSize).style("font-family",this.params.fontFamily).style("fill",this.params.tickLabelFill).style("text-anchor","middle").attr("x",Math.abs(this.xScale.range()[1]-this.xScale.range()[0])/2).attr("y",parseInt(this.svg.attr("height"),10)-1),a&&this.groups.axisText.append("text").text(a).attr("class","gridText").style("font-size",this.params.tickLabelSize).style("font-family",this.params.fontFamily).style("fill",this.params.tickLabelFill).style("text-anchor","middle").attr("transform","translate(10,"+this.yScale.range()[1]/2+") rotate(-90)"),this.grid=!0}},y=function(){this.groups.temporalWindowStart.attr("opacity",0),this.groups.temporalWindowEnd.attr("opacity",0)},g=((0,o.kY)("temporalWindowTransition").duration(s.$J).ease(a.s),function(){if("rect"!==this.layout||"num_date"!==this.distance||this.focus)this.hideTemporalSlice();else{var e=[this.xScale(this.dateRange[0]),this.xScale(this.dateRange[1])],t=this.yScale.range()[1],n="#EEE",r=-1===this.params.orientation[0],i=this.xScale(this.nodes[0].x),o=r?this.xScale.range()[0]:this.xScale.range()[1];if(o+=this.margins.left+this.margins.right,Math.abs(e[0]-i)>30){var a=e[0],s=0;r&&(a=o-e[0],s=e[0]);var l="1"===this.groups.temporalWindowStart.attr("opacity");this.groups.temporalWindowStart.attr("opacity",1).attr("height",t).attr("transform","translate(".concat(s,",0)")).attr("fill",n),l?this.groups.temporalWindowStart.transition("temporalWindowTransition").attr("width",a):this.groups.temporalWindowStart.attr("width",a)}else this.groups.temporalWindowStart.attr("opacity",0);var c=e[1],u=o-this.margins.right-e[1],h="translate(".concat(o-this.margins.right,",0) scale(-1,1)");if(r&&(c=this.margins.right,u=e[1]-this.margins.right,h="translate(".concat(c,",0)")),u>30){var p="1"===this.groups.temporalWindowEnd.attr("opacity");this.groups.temporalWindowEnd.attr("opacity",1).attr("height",t).attr("fill",n).attr("transform",h),p?this.groups.temporalWindowEnd.transition("temporalWindowTransition").attr("width",u):this.groups.temporalWindowEnd.attr("width",u)}else this.groups.temporalWindowEnd.attr("opacity",0)}})},89270(e,t,n){"use strict";n.d(t,{Ay:()=>Xe,V9:()=>$e,qG:()=>Qe});var r=n(78281),i=n(69646),o=n(87473),a=n(26225),s=n(80755),l=n(4124),c=n(46039),u=n(77887),h=function(e){return 1===e["stroke-width"]?0:e["stroke-width"]>6?e["stroke-width"]+6:2*e["stroke-width"]},p=(n(66565),n(40952)),d=n(53657),f=n(57758),m=n(59773),y=n(54229);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=function(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var k=function(e){var t=e.n.node_attrs&&e.n.node_attrs.hidden;return t&&("always"===t||"timetree"===t&&"num_date"===e.that.distance||"divtree"===t&&"div"===e.that.distance)?"hidden":"visible"},C=function(e,t){return e.branchStroke},T=function(e,t,n){if(e){var r=e.that.svg.select("#"+(0,u.ug)("branchT",e.n.name));r.empty()||r.style("stroke",n);var i=e.that.svg.select("#"+(0,u.ug)("branchS",e.n.name));i.empty()||i.style("stroke",n)}},O=n(13957),_=n(61373),j=n(85053),A=function(e){return"aa"===e?"10px":"14px"},L=function(e){return"aa"===e?"500":"700"},P=function(e,t,n,r){return function(n){return n.visibility!==p.uU?"hidden":t||n.n.tipCount>.03*r?"visible":"aa"===e||n.n.name!==n.n.parent.name&&"__ROOT"!==n.n.parent.name?"hidden":"visible"}},N=function(e){return"num_date"===e?function(e){return(0,_.CC)("DAY",(0,_.As)((0,j.hu)(e.n,"num_date")))}:function(t){return(0,j.hu)(t.n,e)}};function I(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var B={attrs:{".tip":{r:function(e){return e.r},cx:function(e){return e.xTip},cy:function(e){return e.yTip}},".branch":{},".vaccineCross":{d:function(e){return e.vaccineCross}},".conf":{d:function(e){return e.confLine}}},styles:{".tip":{fill:function(e){return e.fill},stroke:function(e){return e.tipStroke},visibility:function(e){return e.visibility===p.uU?"visible":"hidden"}},".conf":{stroke:function(e){return e.branchStroke},"stroke-width":h},".branch":{"stroke-width":function(e){return e["stroke-width"]+"px"},stroke:function(e){return C(e)},cursor:function(e){return e.visibility===p.uU?"pointer":"default"},visibility:k}}};function M(e,t){return function(n){B.attrs[e]&&I(t).filter(function(t){return B.attrs[e][t]}).forEach(function(t){n.attr(t,B.attrs[e][t])}),B.styles[e]&&I(t).filter(function(t){return B.styles[e][t]}).forEach(function(t){n.style(t,B.styles[e][t])})}}var D=function(e,t,n,r){e.selectAll(t).filter(function(e){return e.update}).transition().duration(r).call(n),r||(0,c.O2)()},F=n(51682),z=n(82833);function V(e){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V(e)}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||U(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=U(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function U(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function K(e,t,n){return(t=function(e){var t=function(e){if("object"!=V(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==V(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=function e(t,n){var r=t.depth-t.pDepth;t.x=t.px+r*Math.cos(t.tau+.5*t.w),t.y=t.py+r*Math.sin(t.tau+.5*t.w);var i=t.tau;if(t.n.hasChildren)for(var o=0;o<t.n.children.length;o++){var a=t.n.children[o].shell;a.w=2*Math.PI*J(a.n)/n,a.tau=i,i+=a.w,a.px=t.x,a.py=t.y,e(a,n)}};function $(e,t){return t.step()>50?t.padding(.5):e.length<=4?t.padding(.4):e.length<=6?t.padding(.3):e.length<=10?t.padding(.2):t.padding(.1)}function Y(e,t,n){var r=t.step();if(!(t.step()<=50)){for(var i=[],o=100;o--;)i.push((Math.random()-.5)*r*.5);var a=["".concat(e,"Base"),"".concat(e,"Tip"),i.length],s=a[0],l=a[1],c=a[2],h=0;!function e(t){if(t[s]=(0,u.k9)(t.n).shell[l],t[l]+=i[h++],h>=c&&(h=0),t.n.hasChildren){var n,r=G(t.n.children);try{for(r.s();!(n=r.n()).done;)e(n.value.shell)}catch(e){r.e(e)}finally{r.f()}}}(n[0])}}function X(e,t){var n=0;if(t.length<e.tipLabelBreakL1){var r=e.tipLabelFontSizeL1;t.length<e.tipLabelBreakL2&&(r=e.tipLabelFontSizeL2),t.length<e.tipLabelBreakL3&&(r=e.tipLabelFontSizeL3),t.forEach(function(e){n<e.n.name.length&&(n=.65*e.n.name.length*r)})}return n}function J(e){return e.tipCount+.15*(e.fullTipCount-e.tipCount)}var Z=n(58026),ee=function(e,t,n){var r=this;this.grid=!1,this.attributes=["r","cx","cy","id","class","d"],this.params={regressionStroke:l.KD,regressionWidth:6,majorGridStroke:"#DDD",majorGridWidth:2,minorGridStroke:"#EEE",minorGridWidth:1,tickLabelSize:12,tickLabelFill:l.KD,minorTicks:4,orientation:[1,1],showGrid:!0,showStreamTrees:!1,fillSelected:"#A73",radiusSelected:5,branchStroke:"#AAA",branchStrokeWidth:2,tipStroke:"#AAA",tipFill:"#CCC",tipStrokeWidth:1,tipRadius:4,fontFamily:l.sf,branchLabelKey:!1,branchLabelFont:l.sf,branchLabelFill:"#777",branchLabelFontWeight:500,branchLabelPadX:8,branchLabelPadY:5,tipLabels:!0,tipLabelFont:l.sf,tipLabelFill:"#555",tipLabelPadX:8,tipLabelPadY:2,mapToScreenDebounceTime:500,tipLabelFontSizeL1:8,tipLabelFontSizeL2:10,tipLabelFontSizeL3:12,tipLabelBreakL1:75,tipLabelBreakL2:50,tipLabelBreakL3:25},this.groups={},this.id=t,this.nodes=e.map(function(e){var t={that:r,n:e,x:0,y:0,inView:void 0===e.inView||e.inView};return e.shell=t,t}),this.zoomNode=this.nodes[n],this.strainToNode={},this.nodes.forEach(function(e){r.strainToNode[e.n.name]=e})};ee.prototype.change=function(e){var t,n,r=e.changeColorBy,i=void 0!==r&&r,o=e.changeVisibility,a=void 0!==o&&o,s=e.changeTipRadii,l=void 0!==s&&s,c=e.changeBranchThickness,h=void 0!==c&&c,p=e.showConfidences,d=void 0!==p&&p,f=e.removeConfidences,m=void 0!==f&&f,y=e.zoomIntoClade,g=void 0!==y&&y,v=e.svgHasChangedDimensions,b=void 0!==v&&v,w=e.animationInProgress,S=void 0!==w&&w,E=e.changeNodeOrder,x=void 0!==E&&E,k=e.focusChange,C=void 0!==k&&k,T=e.newDistance,O=void 0===T?void 0:T,_=e.newLayout,j=void 0===_?void 0:_,A=e.updateLayout,L=void 0===A?void 0:A,P=e.newBranchLabellingKey,I=void 0===P?void 0:P,R=e.showAllBranchLabels,B=void 0===R?void 0:R,M=e.newTipLabelKey,D=void 0===M?void 0:M,F=e.streamDefinitionChange,z=void 0===F?void 0:F,V=e.branchStroke,W=void 0===V?void 0:V,G=e.tipStroke,U=void 0===G?void 0:G,q=e.fill,H=void 0===q?void 0:q,K=e.visibility,Q=void 0===K?void 0:K,$=e.tipRadii,Y=void 0===$?void 0:$,X=e.hoveredLegendSwatch,J=void 0===X?void 0:X,Z=e.branchThickness,ee=void 0===Z?void 0:Z,te=e.scatterVariables,ne=void 0===te?void 0:te,re=e.performanceFlags,ie=void 0===re?void 0:re,oe=e.newMeasurementsColorGrouping,ae=void 0===oe?void 0:oe,se=new Set,le={},ce=new Set,ue=j,he=500;if((Date.now()-this.timeLastRenderRequested<1e3||!0===ie.get("skipTreeAnimation"))&&(he=0),i&&(se.add(".branch").add(".tip").add(".conf"),ce.add("stroke").add("fill"),le.branchStroke=W,le.tipStroke=U,le.fill=H),a&&(se.add(".tip").add(".tipLabel").add(".branchLabel"),ce.add("visibility").add("cursor"),le.visibility=Q),l&&(se.add(".tip"),ce.add("r"),le.r=Y,this.params.showStreamTrees&&this.highlightStreamtreeRipples(J)),h&&(se.add(".branch").add(".conf"),ce.add("stroke-width"),le["stroke-width"]=ee),(O||j||L||g||b||x||a)&&(se.add(".tip").add(".branch.S").add(".branch.T").add(".branch"),se.add(".vaccineCross").add(".vaccineDottedLine").add(".conf"),se.add(".branchLabel").add(".tipLabel"),se.add(".grid").add(".regression"),ce.add("cx").add("cy").add("d").add("opacity").add("visibility")),d&&(this.params.confidence=!0),void 0!==B&&(this.params.showAllBranchLabels=B,se.add(".branchLabel")),D&&(this.callbacks.tipLabel=N(D),se.add(".tipLabel")),t=this.nodes,n=le,t.forEach(function(e,t){for(var r in e.update=!1,n){var i=n[r][t];i!==e[r]&&(e[r]=i,e.update=!0)}}),i&&(this.updateColorBy(),this.measurementsColorGrouping=ae),a&&this.regression&&(se.add(".regression"),this.calculateRegression()),g&&(this.nodes.forEach(function(e){e.inView=!1,e.update=!0}),this.zoomNode=g.n.hasChildren?g:g.n.parent.shell,(0,u.zF)(this.zoomNode,function(e){e.inView=!0})),(b||x||a)&&this.nodes.forEach(function(e){e.update=!0}),O||L||x||z?(0,u.PX)({nodes:this.nodes,focus:this.focus,streams:this.params.showStreamTrees&&this.streams}):this.params.showStreamTrees&&(i||a)&&(0,u.qO)(this.nodes,this.streams),(O||L)&&this.setDistance(O),(O||j||L||x||z)&&this.setLayout(j||this.layout,ne),ce.has("stroke-width")||O||j||x||L||g||b||z||a||d?this.mapToScreen():this.params.showStreamTrees&&(i||a)&&this.mapStreamsToScreen(),C&&("selected"===this.focus?this.hideTemporalSlice():this.showTemporalSlice()),z){for(var pe=0,de=["branchLabels","branchTee","branchStem","tips","tipLabels","vaccines"];pe<de.length;pe++){var fe,me,ye,ge=de[pe];null===(fe=this.groups)||void 0===fe||null===(me=fe[ge])||void 0===me||null===(ye=me.selectAll("*"))||void 0===ye||ye.remove()}this.addGrid(),this.drawBranches(),this.updateTipLabels(),this.drawTips(),this.drawBranchLabels(this.params.branchLabelKey),this.vaccines&&this.drawVaccines(),this.regression&&this.drawRegression(),this.confidencesInSVG&&this.removeConfidence(),this.drawStreams()}else{var ve={removeConfidences:m,showConfidences:d,newBranchLabellingKey:I};ve.timeSliceHasPotentiallyChanged=a||void 0!==O,ve.hideTipLabels=S||"none"===D,ue?this.modifySVGInStages(se,ce,he,1e3,ve):this.modifySVG(se,ce,he,ve),(this.params.showStreamTrees||i)&&this.drawStreams()}this.timeLastRenderRequested=Date.now()},ee.prototype.modifySVG=function(e,t,n,r){var i,o=this,a=[".tip",".vaccineDottedLine",".vaccineCross",".branch"];if(e.has(".branch.S")||e.has(".branch.T")){var s=e.has(".branch");s&&a.splice(a.indexOf(".branch"),1),[".S",".T"].forEach(function(r,a){e.has(".branch".concat(r))&&(i=s?function(e){M(".branch",t)(e),e.attr("d",function(e){return e.branch[a]})}:function(e){e.attr("d",function(e){return e.branch[a]})},D(o.svg,".branch".concat(r),i,n))})}a.forEach(function(r){e.has(r)&&(i=M(r,t),D(o.svg,r,i,n))}),r.hideTipLabels?this.removeTipLabels():e.has(".tipLabel")&&this.updateTipLabels(),e.has(".grid")&&(this.grid&&"unrooted"!==this.layout?this.addGrid():this.hideGrid()),e.has(".regression")&&(this.removeRegression(),this.regression&&this.drawRegression()),r.removeConfidences&&this.confidencesInSVG?this.removeConfidence():r.showConfidences&&!this.confidencesInSVG?this.drawConfidence():e.has(".conf")&&this.confidencesInSVG&&((0,O.ef)(!0,this.distance,this.layout)?(i=M(".conf",t),D(this.svg,".conf",i,n)):this.removeConfidence()),r.timeSliceHasPotentiallyChanged&&this.showTemporalSlice(),r.newBranchLabellingKey?(this.removeBranchLabels(),"none"!==r.newBranchLabellingKey&&this.drawBranchLabels(r.newBranchLabellingKey)):e.has(".branchLabel")&&this.updateBranchLabels(n),this.measurementsColorGrouping?this.drawMeasurementsColoringCrosshair():this.removeMeasurementsColoringCrosshair()},ee.prototype.modifySVGInStages=function(e,t,n,r,i){var o=this;e.delete(".tip"),this.hideGrid();var a=0,s=function(){o.drawBranches(),o.params.showGrid&&o.addGrid(),o.svg.selectAll(".tip").remove(),o.updateTipLabels(),o.drawTips(),o.vaccines&&o.drawVaccines(),o.measurementsColorGrouping&&o.drawMeasurementsColoringCrosshair(),o.showTemporalSlice(),o.regression&&o.drawRegression(),e.has(".branchLabel")&&o.drawBranchLabels(i.newBranchLabellingKey||o.params.branchLabelKey)};this.confidencesInSVG=!1,this.svg.selectAll(I(e).join(", ")).transition().duration(n).style("opacity",0).remove().on("start",function(){return a++}).on("end",function(){if(! --a){o.setClipMask();var e=M(".tip",t);D(o.svg,".tip",e,r),setTimeout(s,r)}}),this.hideTemporalSlice(),this.removeMeasurementsColoringCrosshair(),n||(0,c.O2)()},ee.prototype.render=function(e){var t=this,n=e.svg,r=e.layout,i=e.distance,o=e.focus,a=e.parameters,s=e.callbacks,l=e.branchThickness,c=e.visibility,h=e.drawConfidence,p=e.vaccines,d=e.branchStroke,f=e.tipStroke,m=e.tipFill,y=e.tipRadii,g=e.dateRange,v=e.scatterVariables,b=e.measurementsColorGrouping,w=e.streams,S=e.focusNodes;this.svg=n,this.params=E(E({},this.params),a),this.callbacks=s,this.vaccines=p?p.map(function(e){return e.shell}):void 0,this.measurementsColorGrouping=b,this.dateRange=g,this.streams=w,this.focus=o,this.focusNodes=S,this.nodes.forEach(function(e,n){e.branchStroke=d[n],e.tipStroke=f[n],e.fill=m[n],e.visibility=c[n],e["stroke-width"]=l[n],e.r=y?y[n]:t.params.tipRadius}),(0,u.PX)({nodes:this.nodes,focus:this.focus,streams:this.params.showStreamTrees&&w}),this.setDistance(i),this.setLayout(r,v),this.mapToScreen(),this.setClipMask(),this.params.showGrid&&(this.addGrid(),this.focus||this.showTemporalSlice()),this.drawBranches(),this.updateTipLabels(),this.drawTips(),this.drawStreams(),this.params.branchLabelKey&&this.drawBranchLabels(this.params.branchLabelKey),this.vaccines&&this.drawVaccines(),this.measurementsColorGrouping&&this.drawMeasurementsColoringCrosshair(),this.regression&&this.drawRegression(),this.confidencesInSVG=!1,h&&this.drawConfidence(),this.timeLastRenderRequested=Date.now()},ee.prototype.clearSVG=function(){this.svg.selectAll("*").remove()},ee.prototype.setClipMask=function(){var e=v(this.yScale.range(),2),t=e[0],n=e[1],r=v(this.xScale.range(),2),i=r[0],o=r[1];if(parseInt(i,10)>parseInt(o,10)){var a=[o,i];i=a[0],o=a[1]}var s=i-5,l=o-i+20,c=t-15,u=n-t+20;this.groups.clipPath?this.groups.clipPath.select("rect").attr("x",s).attr("y",c).attr("width",l).attr("height",u):(this.groups.clipPath=this.svg.append("g").attr("id","clipGroup"),this.groups.clipPath.append("clipPath").attr("id","treeClip").append("rect").attr("x",s).attr("y",c).attr("width",l).attr("height",u))},ee.prototype.drawTips=function(){var e=this.params;"tips"in this.groups||(this.groups.tips=this.svg.append("g").attr("id","tips").attr("clip-path","url(#treeClip)"));var t=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(e){return!e.n.hasChildren});this.groups.tips.selectAll(".tip").data(t).enter().append("circle").attr("class","tip").attr("id",function(e){return(0,u.ug)("tip",e.n.name)}).attr("cx",function(e){return e.xTip}).attr("cy",function(e){return e.yTip}).attr("r",function(e){return e.r}).on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick).style("pointer-events","auto").style("visibility",function(e){return e.visibility===p.uU?"visible":"hidden"}).style("fill",function(t){return t.fill||e.tipFill}).style("stroke",function(t){return t.tipStroke||e.tipStroke}).style("stroke-width",function(){return e.tipStrokeWidth}).style("cursor","pointer")},ee.prototype.drawBranches=function(){var e=this.params,t=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(e){return void 0!==e.displayOrder});"branchTee"in this.groups||(this.groups.branchTee=this.svg.append("g").attr("id","branchTee").attr("clip-path","url(#treeClip)")),"clock"===this.layout||"scatter"===this.layout||"unrooted"===this.layout?this.groups.branchTee.selectAll("*").remove():this.groups.branchTee.selectAll(".branch").data(t.filter(function(e){return e.n.hasChildren})).enter().append("path").attr("class","branch T").attr("id",function(e){return(0,u.ug)("branchT",e.n.name)}).attr("d",function(e){return e.branch[1]}).style("stroke",function(t){return t.branchStroke||e.branchStroke}).style("stroke-width",function(t){return t["stroke-width"]||e.branchStrokeWidth}).style("visibility",k).style("fill","none").style("pointer-events","auto").on("mouseover",this.callbacks.onBranchHover).on("mouseout",this.callbacks.onBranchLeave).on("click",this.callbacks.onBranchClick),this.groups.branchGradientDefs||(this.groups.branchGradientDefs=this.svg.append("defs")),this.groups.branchGradientDefs.selectAll("*").remove(),this.updateColorBy(),"branchStem"in this.groups||(this.groups.branchStem=this.svg.append("g").attr("id","branchStem").attr("clip-path","url(#treeClip)")),this.groups.branchStem.selectAll(".branch").data(t).enter().append("path").attr("class","branch S").attr("id",function(e){return(0,u.ug)("branchS",e.n.name)}).attr("d",function(e){return e.branch[0]}).style("stroke",function(t){return t.branchStroke?C(t):e.branchStroke}).style("stroke-linecap","round").style("stroke-width",function(t){return t["stroke-width"]||e.branchStrokeWidth}).style("visibility",k).style("cursor",function(e){return e.visibility===p.uU?"pointer":"default"}).style("pointer-events","auto").on("mouseover",this.callbacks.onBranchHover).on("mouseout",this.callbacks.onBranchLeave).on("click",this.callbacks.onBranchClick)},ee.prototype.drawVaccines=function(){var e=this.vaccines||[];this.params.showStreamTrees&&(e=e.filter(function(e){return!e.n.inStream})),e.length&&("vaccines"in this.groups||(this.groups.vaccines=this.svg.append("g").attr("id","vaccines")),this.groups.vaccines.selectAll(".vaccineCross").data(e).enter().append("path").attr("class","vaccineCross").attr("d",function(e){return e.vaccineCross}).style("stroke","#333").style("stroke-width",2*this.params.branchStrokeWidth).style("fill","none").style("cursor","pointer").style("pointer-events","auto").on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick))},ee.prototype.drawMeasurementsColoringCrosshair=function(){var e=this;"measurementsColoringCrosshair"in this.groups?this.removeMeasurementsColoringCrosshair():this.groups.measurementsColoringCrosshair=this.svg.append("g").attr("id","measurementsColoringCrosshairId");var t=this.nodes.filter(function(t){return!t.n.hasChildren&&t.n.name===e.measurementsColorGrouping});1===t.length?this.groups.measurementsColoringCrosshair.selectAll(".crosshair").data(t).enter().append("svg").attr("stroke","currentColor").attr("fill","currentColor").attr("strokeWidth","0").attr("viewBox","0 0 256 256").attr("height",function(e){return 5*e.r}).attr("width",function(e){return 5*e.r}).attr("x",function(e){return e.xTip-5*e.r/2}).attr("y",function(e){return e.yTip-5*e.r/2}).style("cursor","pointer").style("pointer-events","auto").on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick).append("path").attr("d","M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm12,191.13V184a12,12,0,0,0-24,0v27.13A84.18,84.18,0,0,1,44.87,140H72a12,12,0,0,0,0-24H44.87A84.18,84.18,0,0,1,116,44.87V72a12,12,0,0,0,24,0V44.87A84.18,84.18,0,0,1,211.13,116H184a12,12,0,0,0,0,24h27.13A84.18,84.18,0,0,1,140,211.13Z"):0===t.length?console.warn("Measurements coloring group ".concat(this.measurementsColorGrouping," doesn't match any tip names")):console.warn("Measurements coloring group ".concat(this.measurementsColorGrouping," matches multiple tips"))},ee.prototype.removeMeasurementsColoringCrosshair=function(){"measurementsColoringCrosshair"in this.groups&&this.groups.measurementsColoringCrosshair.selectAll("*").remove()},ee.prototype.drawRegression=function(){if(void 0!==this.regression.slope){var e,t,n,r=this.yScale(this.regression.intercept+this.xScale.domain()[0]*this.regression.slope),i=this.yScale(this.regression.intercept+this.xScale.domain()[1]*this.regression.slope),o="M "+this.xScale.range()[0].toString()+" "+r.toString()+" L "+this.xScale.range()[1].toString()+" "+i.toString();"regression"in this.groups||(this.groups.regression=this.svg.append("g").attr("id","regression").attr("clip-path","url(#treeClip)")),this.groups.regression.append("path").attr("d",o).attr("class","regression").style("fill","none").style("visibility","visible").style("stroke",this.params.regressionStroke).style("stroke-width",this.params.regressionWidth),this.groups.regression.append("text").text((e=this.regression,t=this.layout,n=this.yScale,"clock"===t?(0,u.Qh)(n)?"rate estimate: ".concat(e.slope.toExponential(2)," subs per site per year"):"rate estimate: ".concat((0,u.C2)(e.slope)," subs per year"):"intercept = ".concat(e.intercept.toPrecision(3),", slope = ").concat(e.slope.toPrecision(3),", R^2 = ").concat(e.r2.toPrecision(3)))).attr("class","regression").attr("x",this.xScale.range()[1]/2-75).attr("y",this.yScale.range()[0]+50).style("fill",this.params.regressionStroke).style("font-size",this.params.tickLabelSize+8).style("font-weight",400).style("font-family",this.params.fontFamily)}},ee.prototype.removeRegression=function(){"regression"in this.groups&&this.groups.regression.selectAll("*").remove()},ee.prototype.updateColorBy=function(){},ee.prototype.drawStreams=function(){var e=this,t=this.params.showStreamTrees?Object.keys(this.streams).reverse():[];if(t.length&&!("streams"in this.groups)?(this.groups.streams=this.svg.append("g").attr("id","streams"),this.groups.streamsLabels=this.svg.append("g").attr("id","stream-labels")):!t.length&&"streams"in this.groups&&(this.groups.streams.selectAll("*").remove(),this.groups.streamsLabels.selectAll("*").remove(),delete this.groups.streams,delete this.groups.streamsLabels),t.length){this.groups.streams.selectAll(".streamGroup").data(t,function(e){return String(e)}).join(function(e){var t=e.append("g").attr("id",function(e){return"stream".concat(e)}).attr("class","streamGroup");return t.append("g").attr("class","connector"),t.append("g").attr("class","ripples"),t},void 0,function(e){return e.call(function(e){return e.transition("500").style("opacity",0).remove()})});var n,r=(0,y.A)().x(function(e){return e.x}).y0(function(e){return e.y0}).y1(function(e){return e.y1}),i=function(t,n){if(0===t.n.streamNodeCounts.visible)return"";var r=e.yScale(t.displayOrder);if("backbone"===n){var i=t.streamRipples.at(0).at(0).x,o=t.streamRipples.at(0).at(-1).x;return"M".concat(i,",").concat(r,"H").concat(o)}if("hidden"===k(t))return"";var a=t.streamRipples[0][0].x,s=e.streams[t.n.streamName].parentStreamName;if(s){var l=t.xBase,c=e.yScale(e.nodes[e.streams[s].startNode].displayOrder);return"M".concat(l,",").concat(c,"L").concat(l,",").concat(r,"L").concat(a,",").concat(r)}return"M".concat(t.xBase,",").concat(r,"H").concat(a)},o=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=b(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(a)throw i}}}}(t);try{var a=function(){var t=n.value,o=e.nodes[e.streams[t].startNode],a=e.callbacks;e.groups.streams.select("#".concat(CSS.escape("stream".concat(t)))).select(".connector").selectAll(".connectorPath").data([o,o],function(e,t){return 0===t?"joiner":"backbone"}).join(function(t){return t.append("path").attr("class","connectorPath").attr("d",function(e,t){return i(e,0===t?"joiner":"backbone")}).attr("stroke-width",e.params.branchStrokeWidth).style("stroke",function(t,n){return 0===n?t.branchStroke:e.params.branchStroke}).attr("fill","None").style("cursor","pointer").style("pointer-events","auto").on("mouseover",function(e,t,n){a.onStreamHover(o,t,Array.from(n),!0)}).on("mouseout",function(e,t,n){a.onStreamLeave(o,t,Array.from(n),!0)}).on("click",a.onBranchClick)},function(t){return t.call(function(t){return t.transition("500").attr("d",function(e,t){return i(e,0===t?"joiner":"backbone")}).style("stroke",function(t,n){return 0===n?t.branchStroke:e.params.branchStroke}).attr("stroke-width",e.params.branchStrokeWidth)})},function(e){return e.remove()}),e.groups.streams.select("#".concat(CSS.escape("stream".concat(t)))).select(".ripples").selectAll(".ripple").data(o.streamRipples,function(e){return String(e.key)}).join(function(t){return t.append("path").attr("class","ripple").attr("d",function(e){return r(e)}).attr("fill",function(e,t){return o.n.streamCategories[t].color}).on("mouseover",function(t,n,r){e.callbacks.onStreamHover(o,n,Array.from(r),!1)}).on("mouseout",function(t,n,r){e.callbacks.onStreamLeave(o,n,Array.from(r),!1)}).style("cursor","pointer").style("pointer-events","auto").on("click",function(){return e.callbacks.onBranchClick(o)})},function(e){return e.call(function(e){return e.transition("500").attr("d",function(e){return r(e)})})},function(e){return e.remove()})};for(o.s();!(n=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}var s=t.map(function(t){var n=e.nodes[e.streams[t].startNode];if(0===n.n.streamNodeCounts.visible)return null;var r,i=e.zoomNode.n.name===n.n.name?"start":"middle",o=(r=n,r.streamRipples[0].reduce(function(e,t,n){var i=v(e,2),o=i[0],a=i[1],s=r.streamRipples.at(-1)[n].y1-t.y0;return 0===n?[0,s]:s>a?[n,s]:[o,a]},[void 0,void 0]))[1],a=Math.floor(Math.max(10,Math.min(o/2,24))),s=10===a?"hidden":"visible";return{phyloNode:n,streamName:t,x:n.streamRipples.at(0).at(0).x,y:e.yScale(n.displayOrder),textAnchor:i,fontSize:a,visibility:s}}).filter(function(e){return!!e});this.groups.streamsLabels.selectAll(".labelText").data(s,function(e){return String(e.streamName)}).join(function(e){return e.append("text").attr("class","labelText").attr("id",function(e){return"label".concat(e.streamName)}).attr("x",function(e){return e.x}).attr("y",function(e){return e.y}).attr("text-anchor",function(e){return e.textAnchor}).attr("dominant-baseline","ideographic").attr("font-size",function(e){return e.fontSize}).attr("visibility",function(e){return e.visibility}).text(function(e){return e.phyloNode.n.streamName}).style("pointer-events","none")},function(e){return e.call(function(e){return e.attr("x",function(e){return e.x}).attr("y",function(e){return e.y}).attr("text-anchor",function(e){return e.textAnchor}).attr("visibility",function(e){return e.visibility}).attr("font-size",function(e){return e.fontSize})})},function(e){return e.remove()})}},ee.prototype.highlightStreamtreeRipples=function(e){var t,n=null===(t=this.groups)||void 0===t?void 0:t.streams;if(!n)return null;if(!1!==e){var r=e+"_";n.selectAll(".ripple").each(function(e){e.key.startsWith(r)||(0,m.A)(this).style("opacity",.3)})}else n.selectAll(".ripple").style("opacity",1)},ee.prototype.setDistance=function(e){this.nodes.forEach(function(e){e.update=!0}),e&&(this.distance=e),["div","num_date"].includes(this.distance)||(console.error("Tree distance measure not set or invalid. Using `div`."),this.distance="div"),"div"===this.distance?this.nodes.forEach(function(e){e.depth=(0,j.Ue)(e.n),e.pDepth=(0,j.Ue)((0,u.k9)(e.n)),e.conf=[e.depth,e.depth]}):this.nodes.forEach(function(e){e.depth=(0,j.hu)(e.n,"num_date"),e.pDepth=(0,j.hu)((0,u.k9)(e.n),"num_date"),e.conf=(0,j.hu)(e.n,"num_date",{confidence:!0})||[e.depth,e.depth]}),this.vaccines&&this.vaccines.forEach(function(e){e.crossDepth=e.depth})},ee.prototype.setLayout=function(e,t){void 0!==e&&e===this.layout||this.nodes.forEach(function(e){e.update=!0}),this.layout=void 0===e?"rect":e,this.regression=void 0,t&&(this.scatterVariables=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach(function(t){K(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},t)),"clock"===this.layout&&(this.scatterVariables.x="num_date",this.scatterVariables.y="div"),"rect"===this.layout?this.rectangularLayout():"clock"===this.layout||"scatter"===this.layout?this.scatterplotLayout():"radial"===this.layout?this.radialLayout():"unrooted"===this.layout&&this.unrootedLayout()},ee.prototype.rectangularLayout=function(){this.nodes.forEach(function(e){e.y=e.displayOrder,e.x=e.depth,e.px=e.pDepth,e.py=e.y}),this.vaccines&&this.vaccines.forEach(function(e){e.xCross=e.crossDepth,e.yCross=e.y})},ee.prototype.scatterplotLayout=function(){if(this.scatterVariables){var e,t="displayOrder"===this.scatterVariables.x||"displayOrder"===this.scatterVariables.y?(0,u.tK)(this.nodes):void 0,n=G(this.nodes);try{for(n.s();!(e=n.n()).done;){var r=e.value;if("div"===this.scatterVariables.x)r.x=(0,j.Ue)(r.n),r.px=(0,j.Ue)((0,u.k9)(r.n));else if("gt"===this.scatterVariables.x)r.x=r.n.currentGt,r.px=(0,u.k9)(r.n).currentGt;else if("displayOrder"===this.scatterVariables.x){var i=W(t(r),2);r.x=i[0],r.px=i[1]}else if(r.x=(0,j.hu)(r.n,this.scatterVariables.x),r.px=(0,j.hu)((0,u.k9)(r.n),this.scatterVariables.x),this.scatterVariables.xTemporal){var o=[(0,f.DK)(r.x),(0,f.DK)(r.px)];r.x=o[0],r.px=o[1]}if("div"===this.scatterVariables.y)r.y=(0,j.Ue)(r.n),r.py=(0,j.Ue)((0,u.k9)(r.n));else if("gt"===this.scatterVariables.y)r.y=r.n.currentGt,r.py=(0,u.k9)(r.n).currentGt;else if("displayOrder"===this.scatterVariables.y){var a=W(t(r),2);r.y=a[0],r.py=a[1]}else if(r.y=(0,j.hu)(r.n,this.scatterVariables.y),r.py=(0,j.hu)((0,u.k9)(r.n),this.scatterVariables.y),this.scatterVariables.yTemporal){var s=[(0,f.DK)(r.y),(0,f.DK)(r.py)];r.y=s[0],r.py=s[1]}}}catch(e){n.e(e)}finally{n.f()}this.vaccines&&this.vaccines.forEach(function(e){e.xCross=e.x,e.yCross=e.y}),this.scatterVariables.showRegression&&this.calculateRegression()}else console.error("Scatterplot called without variables")},ee.prototype.unrootedLayout=function(){var e=J(this.nodes[0].n),t=1.5*Math.PI,n=this.nodes[0].n.children;this.nodes.forEach(function(e){e.x=void 0,e.y=void 0,e.px=void 0,e.py=void 0});for(var r=0;r<n.length;r++){var i=n[r].shell;if(i.w=2*Math.PI*J(i.n)/e,i.w>0){var o=i.depth-this.nodes[0].depth;i.px=o*Math.cos(t+.5*i.w),i.py=o*Math.sin(t+.5*i.w),i.tau=t,Q(i,e),t+=i.w}}this.vaccines&&this.vaccines.forEach(function(e){var t=e.crossDepth-e.depth;e.xCross=e.px+t*Math.cos(e.tau+.5*e.w),e.yCross=e.py+t*Math.sin(e.tau+.5*e.w)}),this.nodes.forEach(function(e){delete e.tau,delete e.w})},ee.prototype.radialLayout=function(){var e,t=this,n=Math.max.apply(Math,function(e){if(Array.isArray(e))return q(e)}(e=this.nodes.map(function(e){return e.displayOrder}).filter(function(e){return e}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=this.nodes[0].depth;this.nodes.forEach(function(e){var t=1.9*Math.PI*e.displayOrderRange[0]/n,i=1.9*Math.PI*e.displayOrderRange[1]/n;e.angle=1.9*Math.PI*e.displayOrder/n,e.y=(e.depth-r)*Math.cos(e.angle),e.x=(e.depth-r)*Math.sin(e.angle),e.py=e.y*(e.pDepth-r)/(e.depth-r+1e-15),e.px=e.x*(e.pDepth-r)/(e.depth-r+1e-15),e.yCBarStart=(e.depth-r)*Math.cos(t),e.xCBarStart=(e.depth-r)*Math.sin(t),e.yCBarEnd=(e.depth-r)*Math.cos(i),e.xCBarEnd=(e.depth-r)*Math.sin(i),e.smallBigArc=Math.abs(i-t)>1*Math.PI}),this.vaccines&&this.vaccines.forEach(function(e){"div"===t.distance?(e.xCross=e.x,e.yCross=e.y):(e.xCross=(e.crossDepth-r)*Math.sin(e.angle),e.yCross=(e.crossDepth-r)*Math.cos(e.angle))})},ee.prototype.setScales=function(){"scatter"!==this.layout||this.scatterVariables.xContinuous?this.xScale=(0,F.m4)():this.xScale=(0,F.hq)().round(!1).align(.5).padding(.5),"scatter"!==this.layout||this.scatterVariables.yContinuous?this.yScale=(0,F.m4)():this.yScale=(0,F.hq)().round(!1).align(.5).padding(.5);var e=parseInt(this.svg.attr("width"),10),t=parseInt(this.svg.attr("height"),10);if("radial"===this.layout||"unrooted"===this.layout){var n=e-this.margins.left-this.margins.right,r=t-this.margins.bottom-this.margins.top,i=Math.min(n,r),o=n-i,a=r-i;this.xScale.range([.5*o+this.margins.left,e-.5*o-this.margins.right]),this.yScale.range([.5*a+this.margins.top,t-.5*a-this.margins.bottom])}else this.params.orientation[0]>0?this.xScale.range([this.margins.left,e-this.margins.right]):this.xScale.range([e-this.margins.right,this.margins.left]),this.params.orientation[1]>0?this.yScale.range([this.margins.top,t-this.margins.bottom]):this.yScale.range([t-this.margins.bottom,this.margins.top])},ee.prototype.mapToScreen=function(){var e,t=this,n=this.nodes.filter(function(e){return!e.n.hasChildren}).filter(function(e){return e.inView});this.margins={left:"scatter"===this.layout||"clock"===this.layout?40:5,right:5+X(this.params,n),top:"radial"===this.layout?10:15,bottom:35},this.setScales(),this.setClipMask();var r,i,o,a,s="selected"===this.focus&&("rect"===this.layout||"radial"===this.layout),l=this.focusNodes;if(e=s&&l?l.nodes.map(function(e){return t.nodes[e]}).filter(function(e){return void 0!==e.y&&void 0!==e.x}):this.nodes.filter(function(e){return e.inView&&void 0!==e.y&&void 0!==e.x}),"scatter"===this.layout&&!1===this.scatterVariables.showBranches&&(e=e.filter(function(e){return!e.n.hasChildren})),"scatter"!==this.layout||this.scatterVariables.xContinuous){var c=1e6,h=-1e5;e.forEach(function(e){e.x<c&&(c=e.x),e.x>h&&(h=e.x)}),c!==h||this.params.showStreamTrees&&e[0].n.streamName||(c-=.005,h+=.005);var p=1e-8;(o=h-c)<p&&(h=p-c,o=p),"rect"===this.layout&&0!==this.zoomNode.n.arrayIdx&&(c-=(h-c)/20),r=[c,h]}else{var d=new Set(e.map(function(e){return e.x}));$(r=this.scatterVariables.xDomain.filter(function(e){return d.has(e)}),this.xScale)}if("scatter"!==this.layout||this.scatterVariables.yContinuous){var f=1e6,m=-1e5;if(e.forEach(function(e){e.y<f&&(f=e.y),e.y>m&&(m=e.y)}),n.length<30){var y=.05*(m-f);f-=y,m+=y}a=m-f,i=[f,m]}else{var g=new Set(e.map(function(e){return e.y}));$(i=this.scatterVariables.yDomain.filter(function(e){return g.has(e)}),this.yScale)}if("radial"===this.layout||"unrooted"===this.layout){var v=Math.max(a,o),b=o>a?.5*(o-a):0,w=o<a?.5*(a-o):0;r=[r[0]-w,r[0]+v-w],i=[i[0]-b,i[0]+v-b]}if("clock"!==this.layout&&"scatter"!==this.layout||i.reverse(),this.params.showStreamTrees)for(var S=0,E=Object.values(this.streams);S<E.length;S++){var x=E[S],k=this.nodes[x.startNode];if(k.inView){var C=k.n.streamPivots;C.at(0)<r[0]&&(r[0]=C.at(0)),C.at(-1)>r[1]&&(r[1]=C.at(-1)),k.displayOrderRange[0]<i[0]&&(i[0]=k.displayOrderRange[0]),k.displayOrderRange[1]>i[1]&&(i[1]=k.displayOrderRange[1])}}this.xScale.domain(r),this.yScale.domain(i);var T=this.yScale.range()[1]+100,O=this.xScale.range()[0]-100;if(this.nodes.forEach(function(e){e.xTip=t.xScale(e.x),e.yTip=t.yScale(e.y),e.xBase=t.xScale(e.px),e.yBase=t.yScale(e.py),e.rot=180*Math.atan2(e.yTip-e.yBase,e.xTip-e.xBase)/Math.PI}),"scatter"===this.layout&&(this.scatterVariables.yContinuous||Y("y",this.yScale,this.nodes),this.scatterVariables.xContinuous||Y("x",this.xScale,this.nodes),this.nodes.forEach(function(e){isNaN(e.xTip)&&(e.xTip=O),isNaN(e.yTip)&&(e.yTip=T),isNaN(e.xBase)&&(e.xBase=O),isNaN(e.yBase)&&(e.yBase=T)})),this.vaccines&&this.vaccines.forEach(function(e){var n=t.xScale(e.xCross),r=t.yScale(e.yCross);e.vaccineCross=" M ".concat(n-6,",").concat(r-6," L ").concat(n+6,",").concat(r+6," M ").concat(n-6,",").concat(r+6," L ").concat(n+6,",").concat(r-6)}),"unrooted"===this.layout)this.nodes.forEach(function(e){e.branch=[" M "+e.xBase.toString()+","+e.yBase.toString()+" L "+e.xTip.toString()+","+e.yTip.toString(),""]});else if("clock"===this.layout||"scatter"===this.layout)this.scatterVariables.showBranches?this.nodes.forEach(function(e){e.branch=e.xBase===O||e.xTip===O||e.yBase===T||e.yTip===T?["",""]:[" M "+e.xBase.toString()+","+e.yBase.toString()+" L "+e.xTip.toString()+","+e.yTip.toString(),""]}):this.nodes.forEach(function(e){e.branch=["",""]});else if("rect"===this.layout)this.nodes.forEach(function(e){var n=.5*((0,u.k9)(e.n).shell["stroke-width"]-e["stroke-width"])||0,r=[t.yScale(e.displayOrderRange[0]),t.yScale(e.displayOrderRange[1])];e.branch=[" M ".concat(e.xBase-n,",").concat(e.yBase," L ").concat(e.xTip,",").concat(e.yTip+.01)," M ".concat(e.xTip,",").concat(r[0]," L ").concat(e.xTip,",").concat(r[1])],t.params.confidence&&(e.confLine=" M ".concat(t.xScale(e.conf[0]),",").concat(e.yBase," L ").concat(t.xScale(e.conf[1]),",").concat(e.yTip))});else if("radial"===this.layout){var _=this.nodes[0].depth,j=this.nodes.map(function(e){return.5*((0,u.k9)(e.n).shell["stroke-width"]-e["stroke-width"])||0});this.nodes.forEach(function(e,n){e.branch=[" M "+(e.xBase-j[n]*Math.sin(e.angle)).toString()+" "+(e.yBase-j[n]*Math.cos(e.angle)).toString()+" L "+e.xTip.toString()+" "+e.yTip.toString(),""],e.n.hasChildren&&(e.branch[1]=" M "+t.xScale(e.xCBarStart).toString()+" "+t.yScale(e.yCBarStart).toString()+" A "+(t.xScale(e.depth)-t.xScale(_)).toString()+" "+(t.yScale(e.depth)-t.yScale(_)).toString()+" 0 "+(e.smallBigArc?"1 ":"0 ")+" 1  "+t.xScale(e.xCBarEnd).toString()+","+t.yScale(e.yCBarEnd).toString())})}this.params.showStreamTrees&&this.mapStreamsToScreen()},ee.prototype.mapStreamsToScreen=function(){for(var e=this,t=function(){var t=r[n],i=e.nodes[t.startNode];i.streamRipples=i.rippleDisplayOrders.map(function(t,n){return Object.assign([],t.map(function(t,n){var r=W(t,2),o=r[0],a=r[1];return{x:e.xScale(i.n.streamPivots[n]),y0:e.yScale(o),y1:e.yScale(a)}}),{key:i.n.streamCategories[n].name+"_"+e.streams[z.vv]})})},n=0,r=Object.values(this.streams);n<r.length;n++)t()},ee.prototype.calculateRegression=function(){"clock"===this.layout?this.regression=function(e){var t=e.filter(function(e){return!e.n.hasChildren&&e.visibility===p.uU}),n=t.length;if(0===n)return{slope:void 0,intercept:void 0,r2:void 0};var r=e[0].x,i=(0,d.A)(t.map(function(e){return e.y*(e.x-r)}))/n/((0,d.A)(t.map(function(e){return(e.x-r)*(e.x-r)}))/n);return{slope:i,intercept:-r*i,r2:void 0}}(this.nodes):this.regression=function(e){var t=e.filter(function(e){return!e.n.hasChildren&&void 0!==e.x&&void 0!==e.y&&e.visibility===p.uU}),n=t.length;if(0===n)return{slope:void 0,intercept:void 0,r2:void 0};var r=(0,d.A)(t.map(function(e){return e.x}))/n,i=(0,d.A)(t.map(function(e){return e.y}))/n,o=(0,d.A)(t.map(function(e){return(e.x-r)*(e.y-i)}))/(0,d.A)(t.map(function(e){return Math.pow(e.x-r,2)})),a=i-o*r,s=1-(0,d.A)(t.map(function(e){return Math.pow(e.y-(a+o*e.x),2)}))/(0,d.A)(t.map(function(e){return Math.pow(e.y-i,2)}));return{slope:o,intercept:a,r2:s}}(this.nodes)},ee.prototype.removeConfidence=function(e){this.confidencesInSVG=!1,"confidenceIntervals"in this.groups&&(e?this.groups.confidenceIntervals.selectAll("*").transition().duration(e).style("opacity",0).remove():this.groups.confidenceIntervals.selectAll("*").remove())},ee.prototype.drawConfidence=function(e){var t=this;this.confidencesInSVG=!0,"confidenceIntervals"in this.groups||(this.groups.confidenceIntervals=this.svg.append("g").attr("id","confidenceIntervals")),e?(this.groups.confidenceIntervals.selectAll(".conf").data(this.nodes).enter().call(function(e){return t.drawSingleCI(e,0)}),this.groups.confidenceIntervals.transition().duration(e).style("opacity",.5)):this.groups.confidenceIntervals.selectAll(".conf").data(this.nodes).enter().call(function(e){return t.drawSingleCI(e,.5)})},ee.prototype.drawSingleCI=function(e,t){e.append("path").attr("class","conf").attr("id",function(e){return(0,u.ug)("conf",e.n.name)}).attr("d",function(e){return e.confLine}).style("stroke",function(e){return e.branchStroke||"#888"}).style("opacity",t).style("fill","none").style("stroke-width",h).style("pointer-events","none")},ee.prototype.drawBranchLabels=function(e){var t=this;this.params.branchLabelKey=e;var n=A(e),r=L(e),i=P(e,this.params.showAllBranchLabels,this.layout,this.zoomNode.n.tipCount);"branchLabels"in this.groups||(this.groups.branchLabels=this.svg.append("g").attr("id","branchLabels").attr("clip-path","url(#treeClip)"));var o=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(t){return t.n.branch_attrs&&t.n.branch_attrs.labels&&t.n.branch_attrs.labels[e]});this.groups.branchLabels.selectAll(".branchLabel").data(o).enter().append("text").attr("class","branchLabel").attr("x",function(e){return e.xTip+(t.params.orientation[0]>0?-5:5)}).attr("y",function(e){return e.yTip-t.params.branchLabelPadY}).style("text-anchor",this.params.orientation[0]>0?"end":"start").style("visibility",i).style("fill",this.params.branchLabelFill).style("font-family",this.params.branchLabelFont).style("font-weight",r).style("font-size",n).style("pointer-events","none").text(function(t){return t.n.branch_attrs.labels[e]})},ee.prototype.removeBranchLabels=function(){this.params.branchLabelKey=void 0,"branchLabels"in this.groups&&this.groups.branchLabels.selectAll("*").remove()},ee.prototype.updateBranchLabels=function(e){var t=this;if(this.groups.branchLabels){var n=P(this.params.branchLabelKey,this.params.showAllBranchLabels,this.layout,this.zoomNode.n.tipCount),r=A(this.params.branchLabelKey),i=L(this.params.branchLabelKey);this.groups.branchLabels.selectAll(".branchLabel").transition().duration(e).attr("x",function(e){return e.xTip-5}).attr("y",function(e){return e.yTip-t.params.branchLabelPadY}).style("visibility",n).style("font-weight",i).style("font-size",r),e||(0,c.O2)()}},ee.prototype.updateTipLabels=function(e){var t=this;"tipLabels"in this.groups?this.groups.tipLabels.selectAll("*").remove():this.groups.tipLabels=this.svg.append("g").attr("id","tipLabels");var n=this.callbacks.tipLabel,r=this.params.tipLabelPadX,i=this.params.tipLabelPadY,o=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(e){return!e.n.hasChildren}).filter(function(e){return e.inView}),a=o.filter(function(e){return e.visibility===p.uU});if(a.length<this.params.tipLabelBreakL1){var s=this.params.tipLabelFontSizeL1;o.length<this.params.tipLabelBreakL3?s=this.params.tipLabelFontSizeL3:o.length<this.params.tipLabelBreakL2&&(s=this.params.tipLabelFontSizeL2),window.setTimeout(function(){t.groups.tipLabels.selectAll(".tipLabel").data(a).enter().append("text").attr("x",function(e){return e.xTip+r}).attr("y",function(e){return e.yTip+i}).text(function(e){return n(e)}).attr("class","tipLabel").style("font-size",s.toString()+"px").style("pointer-events","none").style("visibility",function(e){return e.visibility===p.uU?"visible":"hidden"})},e)}},ee.prototype.removeTipLabels=function(){"tipLabels"in this.groups&&this.groups.tipLabels.selectAll("*").remove()},ee.prototype.hideGrid=Z.ho,ee.prototype.addGrid=Z.yU,ee.prototype.showTemporalSlice=Z.s1,ee.prototype.hideTemporalSlice=Z.Jz;const te=ee;var ne=n(5699),re=n(97805),ie=n(86068),oe=function(e,t,n,r){var i={},o={},a=e?n.tree:n.treeToo,s=e?r.tree:r.treeToo,l=a.idxOfInViewRootNode!==s.idxOfInViewRootNode,c=n.dateMinNumeric!==r.dateMinNumeric||n.dateMaxNumeric!==r.dateMaxNumeric,u=n.filters!==r.filters;if(t.dateRange=[r.dateMinNumeric,r.dateMaxNumeric],n.focus!==r.focus&&(t.focus=r.focus,i.focusChange=!0),t.focusNodes=s.focusNodes,!s.nodeColorsVersion||a.nodeColorsVersion===s.nodeColorsVersion&&r.colorByConfidence===n.colorByConfidence||(i.changeColorBy=!0,i.branchStroke=(0,f.zY)(s,!0,r.colorByConfidence,r.colorBy),i.tipStroke=(0,f.zY)(s,!1,r.colorByConfidence,r.colorBy),i.fill=i.tipStroke.map(f.rQ),i.newMeasurementsColorGrouping=(0,ie.DM)(r.colorBy)?(0,ie.fN)(r.colorBy):void 0),s.visibilityVersion&&a.visibilityVersion!==s.visibilityVersion&&(i.changeVisibility=!0,i.visibility=s.visibility),s.tipRadiiVersion&&a.tipRadiiVersion!==s.tipRadiiVersion&&(i.changeTipRadii=!0,i.tipRadii=s.tipRadii,i.hoveredLegendSwatch=s.hoveredLegendSwatch),a.branchThicknessVersion!==s.branchThicknessVersion&&(i.changeBranchThickness=!0,i.branchThickness=s.branchThickness),n.distanceMeasure!==r.distanceMeasure&&(i.newDistance=r.distanceMeasure),n.explodeAttr!==r.explodeAttr&&(i.changeNodeOrder=!0),t.streams=r.tree.streams,t.params.showStreamTrees=r.showStreamTrees,n.showStreamTrees===r.showStreamTrees&&n.tree.streams===r.tree.streams||(i.streamDefinitionChange=!0),(n.focus!==r.focus||"selected"===n.focus&&"selected"===r.focus&&(l||c||u))&&(i.updateLayout=!0),!0===n.canRenderBranchLabels&&!1===r.canRenderBranchLabels?i.newBranchLabellingKey="none":(!1===n.canRenderBranchLabels&&!0===r.canRenderBranchLabels||n.selectedBranchLabel!==r.selectedBranchLabel||!1===n.scatterVariables.showBranches&&!0===r.scatterVariables.showBranches)&&(i.newBranchLabellingKey=r.selectedBranchLabel),n.showAllBranchLabels!==r.showAllBranchLabels&&(i.showAllBranchLabels=r.showAllBranchLabels),n.tipLabelKey!==r.tipLabelKey&&(i.newTipLabelKey=r.tipLabelKey),!0===n.temporalConfidence.display&&!1===r.temporalConfidence.display||!0===n.temporalConfidence.on&&!1===r.temporalConfidence.on?i.removeConfidences=!0:!0===r.temporalConfidence.display&&!1===n.temporalConfidence.on&&!0===r.temporalConfidence.on&&(i.showConfidences=!0),"scatter"!==r.layout&&"clock"!==r.layout||n.scatterVariables===r.scatterVariables||(i.updateLayout=!0,i.scatterVariables=r.scatterVariables),n.layout!==r.layout&&(i.newLayout=r.layout),l){var h=t.nodes[s.idxOfInViewRootNode];i.zoomIntoClade=h,"unrooted"===r.layout&&(i.updateLayout=!0)}n.width===r.width&&n.height===r.height||(i.svgHasChangedDimensions=!0),e&&n.showTreeToo!==r.showTreeToo&&(i.svgHasChangedDimensions=!0);var p=Object.keys(i).length>0;return p&&(i.animationInProgress="Pause"===r.animationPlayPauseButton,i.performanceFlags=r.performanceFlags,t.change(i)),{newState:!!Object.keys(o).length&&o,change:p}},ae=n(97195),se=n(99438),le=function(e){e.visibility===p.uU&&((1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo).svg.select("#"+(0,u.ug)("tip",e.n.name)).attr("r",function(e){return e.r+4}),this.setState({hoveredNode:{node:e,isBranch:!1}}))},ce=function(e){e.visibility===p.uU&&(this.props.narrativeMode||(this.props.dispatch({type:se.S$,name:e.n.name,idx:e.n.arrayIdx,isBranch:!1,treeId:e.that.id}),this.props.dispatch((0,o.$h)("add",p.Uf,[e.n.name]))))},ue=function(e){if(e.visibility===p.uU){if(function(e){e&&T(e,(0,f._5)(e.n.parent.shell.branchStroke),(0,f._5)(e.branchStroke))}(e),this.props.temporalConfidence.exists&&this.props.temporalConfidence.display&&!this.props.temporalConfidence.on){var t=1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo;"confidenceIntervals"in t.groups||(t.groups.confidenceIntervals=t.svg.append("g").attr("id","confidenceIntervals")),t.groups.confidenceIntervals.selectAll(".conf").data([e]).enter().call(function(e){return t.drawSingleCI(e,.5)})}this.setState({hoveredNode:{node:e,isBranch:!0}})}},he=function(e){if(e.visibility===p.uU&&!this.props.narrativeMode)if(window.event instanceof PointerEvent&&window.event.shiftKey)this.props.dispatch({type:se.S$,name:e.n.name,idx:e.n.arrayIdx,isBranch:!0,treeId:e.that.id});else{var t=1===e.that.params.orientation[0],n=(0,u.bP)(e.n)===e.n.arrayIdx;if(n&&this.props.showStreamTrees){var r=this.props.tree.streams[e.n.streamName].parentStreamName;if(r){var i=this.props.tree.streams[r].startNode;return this.props.dispatch((0,o.nj)({root:[i,void 0]}))}}var a=n?(0,u.T$)(e.n,this.props.distanceMeasure,t?this.props.tree.observedMutations:this.props.treeToo.observedMutations).arrayIdx:e.n.arrayIdx,s=t?[a,void 0]:[void 0,a];this.props.dispatch((0,o.nj)({root:s}))}},pe=function(e){(function(e){e&&T(e,e.n.parent.shell.branchStroke,e.branchStroke)})(e),this.props.temporalConfidence.exists&&this.props.temporalConfidence.display&&!this.props.temporalConfidence.on&&(1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo).removeConfidence(),this.setState({hoveredNode:null})},de=function(e){var t=1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo;this.state.hoveredNode&&t.svg.select("#"+(0,u.ug)("tip",e.n.name)).attr("r",function(e){return e.r}),this.setState({hoveredNode:null})},fe=function(e){e.isBranch||(e.existingFilterState?"inactive"===e.existingFilterState&&this.props.dispatch((0,o.$h)("inactivate",p.Uf,[e.name])):this.props.dispatch((0,o.$h)("remove",p.Uf,[e.name]))),this.props.dispatch({type:se.j_})};function me(e,t,n,r){var i,o;r?(0,m.A)(n[0]).style("stroke",(0,f._5)(e.branchStroke)):n.forEach(function(n,r){r===t?(0,m.A)(n).attr("fill",(0,f._5)(e.n.streamCategories[t].color)):(0,m.A)(n).style("opacity",.3)});var a=ge(e);"hidden"===(null===(i=a.data())||void 0===i||null===(o=i.at(0))||void 0===o?void 0:o.visibility)&&(a.attr("visibility","visible"),a.attr("font-size",16)),this.setState({hoveredNode:{node:e,isBranch:r,streamDetails:{x:ae.f0.layerX,y:ae.f0.layerY,categoryIndex:t}}})}function ye(e,t,n,r){var i,o;r?(0,m.A)(n[0]).style("stroke",e.branchStroke):n.forEach(function(n,r){r===t?(0,m.A)(n).attr("fill",e.n.streamCategories[t].color):(0,m.A)(n).style("opacity",1)});var a=ge(e);"hidden"===(null===(i=a.data())||void 0===i||null===(o=i.at(0))||void 0===o?void 0:o.visibility)&&a.attr("visibility","hidden"),this.setState({hoveredNode:null})}function ge(e){return e.that.groups.streamsLabels.select("#".concat(CSS.escape("label".concat(e.n.streamName))))}n(71595);var ve=function(e,t,n,r){var i=t?e.domRefs.mainTree:e.domRefs.secondTree,o=t?r.tree:r.treeToo;if(o.loaded){var a=r.canRenderBranchLabels;Object.prototype.hasOwnProperty.call(r.scatterVariables,"showBranches")&&!1===r.scatterVariables.showBranches&&(a=!1);var s=(0,f.zY)(o,!1,r.colorByConfidence,r.colorBy);n.render({svg:(0,m.A)(i),layout:r.layout,distance:r.distanceMeasure,focus:r.focus,parameters:{grid:!0,confidence:r.temporalConfidence.display,branchLabelKey:a&&r.selectedBranchLabel,showAllBranchLabels:r.showAllBranchLabels,orientation:t?[1,1]:[-1,1],tipLabels:!0,showTipLabels:!0,showStreamTrees:r.showStreamTrees},callbacks:{onTipHover:le.bind(e),onTipClick:ce.bind(e),onBranchHover:ue.bind(e),onBranchClick:he.bind(e),onBranchLeave:pe.bind(e),onTipLeave:de.bind(e),onStreamHover:me.bind(e),onStreamLeave:ye.bind(e),tipLabel:N(r.tipLabelKey)},branchThickness:o.branchThickness,visibility:o.visibility,drawConfidence:r.temporalConfidence.on,vaccines:o.vaccines,branchStroke:(0,f.zY)(o,!0,r.colorByConfidence,r.colorBy),tipStroke:s,tipFill:s.map(f.rQ),tipRadii:o.tipRadii,dateRange:[r.dateMinNumeric,r.dateMaxNumeric],scatterVariables:r.scatterVariables,measurementsColorGrouping:(0,ie.DM)(r.colorBy)?(0,ie.fN)(r.colorBy):void 0,streams:r.tree.streams,focusNodes:o.focusNodes})}else console.warn("can't run renderTree (not loaded)")};function be(e){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},be(e)}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach(function(t){Ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ee(e,t,n){return(t=ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ke(r.key),r)}}function ke(e){var t=function(e){if("object"!=be(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==be(t)?t:t+""}function Ce(e,t){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ce(e,t)}function Te(e){var t=Oe();return function(){var n,r=_e(e);if(t){var i=_e(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Oe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Oe=function(){return!!e})()}function _e(e){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_e(e)}const je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ce(e,t)}(o,e);var t,n,i=Te(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,e)).state={left:0,top:31,lookup:void 0,drawn:!1},t.timeout=!1,t}return t=o,(n=[{key:"shouldComponentUpdate",value:function(e){return this.props.width!==e.width||this.props.height!==e.height||this.props.leftTreeName!==e.leftTreeName||this.props.rightTreeName!==e.rightTreeName}},{key:"drawLines",value:function(e){e||(e=this.props);var t=e.lookup.length>750?.25:e.lookup.length>100?.5:1;(0,m.A)(this.d3ref).selectAll("*").remove();var n=function(e){return function(t){var n=e.leftNodes[t[0]].shell,r=e.rightNodes[t[1]].shell;return"M ".concat(n.xTip,",").concat(n.yTip," H ").concat(e.width/2-e.spaceBetweenTrees/2," L ").concat(e.width/2+e.spaceBetweenTrees/2,",").concat(r.yTip," H ").concat(e.width/2+e.spaceBetweenTrees/2+r.xTip)}}(e);(0,m.A)(this.d3ref).selectAll(".tangleLine").data(e.lookup).enter().append("path").attr("class","tangleLine").attr("d",n).attr("stroke-width",t).attr("stroke",function(t){return e.colors[t[0]]}).attr("fill","none")}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){!this.state.drawn&&e.rightNodes[0].shell&&(this.drawLines(e),this.setState({drawn:!0}))}},{key:"componentDidMount",value:function(){!this.state.drawn&&this.props.rightNodes[0].shell&&(this.drawLines(this.props),this.setState({drawn:!0}))}},{key:"componentDidUpdate",value:function(e){this.props.width===e.width&&this.props.height===e.height||(this.timeout?window.clearTimeout(this.timeout):(0,m.A)(this.d3ref).selectAll(".tangleLine").remove(),this.timeout=window.setTimeout(this.drawLines.bind(this),1e3))}},{key:"render",value:function(){var e=this,t={position:"absolute",top:25,zIndex:100,fontSize:16,color:"#000",fontWeight:500},n=[this.props.width/2-this.props.spaceBetweenTrees/2,this.props.width/2+this.props.spaceBetweenTrees/2];return r.createElement("div",{id:"TangleContainer"},r.createElement("div",{id:"MainTreeTitle",style:Se(Se({},t),{},{left:n[0],transform:"translateX(-100%)"})},this.props.leftTreeName),r.createElement("div",{id:"SecondTreeTitle",style:Se(Se({},t),{},{left:n[1]})},this.props.rightTreeName),r.createElement("div",{id:"TangleSvgContainer",style:{position:"absolute",left:this.state.left,top:this.state.top,zIndex:100,pointerEvents:"none"}},r.createElement("svg",{id:"Tangle",style:{cursor:"default",width:this.props.width,height:this.props.height},ref:function(t){e.d3ref=t}})))}}])&&xe(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component);var Ae=n(41916),Le=function(e,t){for(var n=0,r=0,i=0,o=0,a=0,s=0,l=0;l<t.nodes.length;l++){var c=t.nodes[l];if(!c.n.children&&e.strainToNode[c.n.name]){var u=e.strainToNode[c.n.name].displayOrder,h=c.displayOrder;n++,r+=u,i+=h,o+=Math.pow(u,2),a+=Math.pow(h,2),s+=u*h}}return o/=n,a/=n,((s/=n)-(r/=n)*(i/=n))/Math.sqrt((o-Math.pow(r,2))*(a-Math.pow(i,2)))},Pe=n(28355);function Ne(e){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ne(e)}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(n),!0).forEach(function(t){Be(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Be(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ne(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ne(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e){if(e.narrativeMode)return null;var t="selected"===e.focus,n=e.mainTree?e.tree:e.treeToo,i=!t,a=!!n.idxOfFilteredRoot&&n.idxOfInViewRootNode!==n.idxOfFilteredRoot,s=0!==n.idxOfInViewRootNode,c={zIndex:100,position:"absolute",right:e.offsetPx,top:0},h=Re(Re({},l.cH),{},{zIndex:100,display:"inline-block",marginLeft:"4px"}),p=Re(Re({},h),{},{cursor:"pointer",color:l.KD,pointerEvents:"auto"}),d=Re(Re({},h),{},{cursor:"auto",color:l.i,pointerEvents:"none"});return r.createElement("div",{style:c},r.createElement("button",{style:s?p:d,onClick:function(){var t;if(0!==n.idxOfInViewRootNode){var r=n.nodes[n.idxOfInViewRootNode];t=e.mainTree&&e.showStreamTrees&&r.inStream&&n.streams[r.streamName].parentStreamName?(0,u.lF)(r).arrayIdx:(0,u.T$)(r,e.distanceMeasure,n.observedMutations).arrayIdx}e.dispatch((0,o.nj)({root:e.mainTree?[t,void 0]:[void 0,t]}))}},r.createElement(Pe.oHA,null)),i&&r.createElement("button",{style:a?p:d,onClick:function(){e.dispatch((0,o.nj)({root:e.mainTree?[n.idxOfFilteredRoot,void 0]:[void 0,n.idxOfFilteredRoot]}))}},e.t("Zoom to Selected")),r.createElement("button",{style:s?p:d,onClick:function(){var t=e.mainTree?[0,void 0]:[void 0,0];e.dispatch((0,o.nj)({root:t}))}},t?e.t("Show All Selected"):e.t("Zoom to Root")))}function De(e){return De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},De(e)}function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fe.apply(null,arguments)}function ze(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ke(r.key),r)}}function Ve(e,t){return Ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ve(e,t)}function We(e){var t=Ue();return function(){var n,r=qe(e);if(t){var i=qe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==De(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ge(e)}(this,n)}}function Ge(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ue=function(){return!!e})()}function qe(e){return qe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qe(e)}function He(e,t,n){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e){var t=function(e){if("object"!=De(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=De(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==De(t)?t:t+""}var Qe=100,$e="LEFT",Ye=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ve(e,t)}(l,e);var t,n,i=We(l);function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),He(Ge(t=i.call(this,e)),"domRefs",void 0),He(Ge(t),"tangleRef",void 0),He(Ge(t),"clearSelectedNode",void 0),He(Ge(t),"redrawTree",function(){t.props.dispatch((0,o.nj)({root:[0,0]}))}),t.domRefs={mainTree:null,secondTree:null},t.tangleRef=void 0,t.state={hoveredNode:null,tree:null,treeToo:null},t.clearSelectedNode=fe.bind(Ge(t)),t}return t=l,n=[{key:"setUpAndRenderTreeToo",value:function(e,t){var n,r;t.treeToo=new te(e.treeToo.nodes,"RIGHT",e.treeToo.idxOfInViewRootNode),p.eh&&(n=t.tree,r=t.treeToo,function(e,t){for(var n=Le(e,t),r=0;r<t.nodes.length;r++){var i=t.nodes[r],o=i.n;if(o.children){for(var a=o,s=function(){var e=a.children[0];a.children.forEach(function(t){t.shell.displayOrder<e.shell.displayOrder&&(e=t)}),a=e};a.hasChildren;)s();var l=a.shell.displayOrder-1;o.children.reverse(),(0,u.cr)(i,l);var c=Le(e,t);n>c?(o.children.reverse(),(0,u.cr)(i,l)):n=c}}}(n,r),(0,u.PX)({nodes:r.nodes,focus:null,streams:!1})),ve(this,!1,t.treeToo,e)}},{key:"componentDidMount",value:function(){if(this.props.tree.loaded){var e={};e.tree=new te(this.props.tree.nodes,$e,this.props.tree.idxOfInViewRootNode),ve(this,!0,e.tree,this.props),this.props.showTreeToo&&this.setUpAndRenderTreeToo(this.props,e),e.geneSortFn=(0,j.Xs)(this.props.genomeMap),this.setState(e)}}},{key:"componentDidUpdate",value:function(e){var t={},n=!1,r=oe(!0,this.state.tree,e,this.props),i=r.newState,o=r.change;i&&(t=i),e.showTreeToo!==this.props.showTreeToo?this.props.showTreeToo?(this.state.treeToo&&this.state.treeToo.clearSVG(),t.tree=this.state.tree,this.setUpAndRenderTreeToo(this.props,t),this.tangleRef&&this.tangleRef.drawLines()):t.treeToo=null:this.state.treeToo&&(n=oe(!1,this.state.treeToo,e,this.props).change),this.tangleRef&&(o||n)&&this.tangleRef.drawLines(),Object.keys(t).length&&this.setState(t)}},{key:"renderTreeDiv",value:function(e){var t=this,n=e.width,i=e.height,o=e.mainTree;return r.createElement("svg",{id:"d3treeParent",style:{pointerEvents:"auto",cursor:"default",userSelect:"none"},width:n,height:i},r.createElement("g",null,r.createElement("g",null,r.createElement("g",null,r.createElement("g",null,r.createElement("g",{id:o?"MainTree":"SecondTree",width:n,height:i,ref:function(e){o?t.domRefs.mainTree=e:t.domRefs.secondTree=e}}))))))}},{key:"render",value:function(){var e,t,n=this,i=this.props.t,o=this.props.showTreeToo?(this.props.width-Qe)/2:this.props.width;return r.createElement(a.A,{center:!0,infocard:this.props.showOnlyPanels,title:i("Phylogeny"),tallTitle:!!this.props.showTreeToo},r.createElement(Ae.A,null,r.createElement(s.A,{legendPlacement:this.props.legendPlacement,width:this.props.width})),r.createElement(ne.A,{selectedNode:this.state.hoveredNode,colorBy:this.props.colorBy,colorByConfidence:this.props.colorByConfidence,colorScale:this.props.colorScale,colorings:this.props.colorings,geneSortFn:this.state.geneSortFn,observedMutations:this.props.tree.observedMutations,panelDims:{width:this.props.width,height:this.props.height,spaceBetweenTrees:Qe},tipLabelKey:this.props.tipLabelKey,proteinOnly:!0===(null===(e=this.props.genomeMap)||void 0===e?void 0:e[0].proteinOnly),t:i}),r.createElement(re.Ay,{clearSelectedNode:this.clearSelectedNode,selectedNode:this.props.selectedNode,nodesLhsTree:this.props.tree.nodes,nodesRhsTree:null===(t=this.props.treeToo)||void 0===t?void 0:t.nodes,observedMutations:this.props.tree.observedMutations,colorings:this.props.colorings,geneSortFn:this.state.geneSortFn,tipLabelKey:this.props.tipLabelKey,t:i}),this.props.showTangle&&this.state.tree&&this.state.treeToo?r.createElement(je,{ref:function(e){n.tangleRef=e},width:this.props.width,height:this.props.height,lookup:this.props.treeToo.tangleTipLookup,leftNodes:this.props.tree.nodes,rightNodes:this.props.treeToo.nodes,colors:this.props.tree.nodeColors,cVersion:this.props.tree.nodeColorsVersion,vVersion:this.props.tree.visibilityVersion,metric:this.props.distanceMeasure,spaceBetweenTrees:Qe,leftTreeName:this.props.tree.name,rightTreeName:this.props.showTreeToo}):null,this.renderTreeDiv({width:o,height:this.props.height,mainTree:!0}),this.props.showTreeToo?r.createElement("div",{id:"treeSpacer",style:{width:Qe}}):null,this.props.showTreeToo?this.renderTreeDiv({width:o,height:this.props.height,mainTree:!1}):null,r.createElement(Me,Fe({},this.props,{mainTree:!0,offsetPx:this.props.showTreeToo?o+Qe+5:5})),this.props.showTreeToo&&r.createElement(Me,Fe({},this.props,{mainTree:!1,offsetPx:5})))}}],n&&ze(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.Component);const Xe=(0,i.C)()(Ye)},41916(e,t,n){"use strict";n.d(t,{A:()=>h});var r=n(78281);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function l(e){var t=c();return function(){var n,r=u(e);if(t){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}const h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(c,e);var t,n,i,a=l(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=a.call(this,e)).state={hasError:!1},t}return t=c,i=[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}],(n=[{key:"componentDidCatch",value:function(e,t){console.error(e),console.error(t)}},{key:"render",value:function(){return this.state.hasError?this.props.showNothing?null:r.createElement("h1",null,"Something went wrong."):this.props.children}}])&&o(t.prototype,n),i&&o(t,i),Object.defineProperty(t,"prototype",{writable:!1}),c}(r.Component)},40436(e,t,n){"use strict";e.exports=n.p+"c9984902e51d6ba5445b.png"},68299(e,t,n){"use strict";e.exports=n.p+"1730310c32752e095ee7.svg"}}]);