auspice
Version:
Web app for visualizing pathogen evolution
2 lines • 225 kB
JavaScript
/*! For license information please see auspice.chunk.236.bundle.6eff28c13d4a82bea2be.js.LICENSE.txt */
(self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[236],{28718:function(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(x(i)&&(r.dynamicTypingFunction=i,i={}),r.dynamicTyping=i,r.transform=!!x(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=y,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=x(r.step),r.chunk=x(r.chunk),r.complete=x(r.complete),r.error=x(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 d(r):!0===n.readable&&x(n.read)&&x(n.on)?c=new p(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,d=!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&&(d=t.escapeFormulae)}}();var p=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+=g(e[c],c);0<t.length&&(i+=a)}for(var u=0;u<t.length;u++){var h=s?e.length:t[u].length,d=!1,p=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(d="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 y=l?e[m]:m;f.push(t[u][y])}d=""===f.join("").trim()}if(!d){for(var v=0;v<h;v++){0<v&&!p&&(i+=o);var b=s&&l?e[v]:v;i+=g(t[u][b],v)}u<t.length-1&&(!n||0<h&&!p)&&(i+=a)}}return i}function g(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===d&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(p,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=g,s.ParserHandle=f,s.NetworkStreamer=u,s.FileStreamer=h,s.StringStreamer=d,s.ReadableStreamStreamer=p,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(x(e.before)){var u=e.before(c.file,c.inputElem);if("object"==i(u)){if("abort"===u.action)return"AbortError",t=c.file,n=c.inputElem,o=u.reason,void(x(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){x(h)&&h(e,c.file,c.inputElem),a()},s.parse(c.file,c.instanceConfig)}else x(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&&x(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(x(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||!x(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){x(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=E(this._chunkLoaded,this),t.onerror=E(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=E(this._chunkLoaded,this),t.onerror=E(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 d(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 p(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=E((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=E((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=E((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=E((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,d=!1,p=!1,f=[],y={data:[],errors:[],meta:{}};if(x(e.step)){var v=e.step;e.step=function(t){if(y=t,S())E();else{if(E(),0===y.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(y.data=y.data[0],v(y,c))}}}function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function E(){if(y&&r&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<y.data.length;t++)b(y.data[t])&&y.data.splice(t--,1);return S()&&function(){if(y)if(Array.isArray(y.data[0])){for(var t=0;S()&&t<y.data.length;t++)y.data[t].forEach(n);y.data.splice(0,1)}else y.data.forEach(n);function n(t,n){x(e.transformHeader)&&(t=e.transformHeader(t,n)),f.push(t)}}(),function(){if(!y||!e.header&&!e.dynamicTyping&&!e.transform)return y;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?T("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+r,h+n):r<f.length&&T("FieldMismatch","TooFewFields","Too few fields: expected "+f.length+" fields but parsed "+r,h+n)),i}var n=1;return!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(t),n=y.data.length):y.data=t(y.data,0),e.header&&y.meta&&(y.meta.fields=f),h+=n,y}()}function S(){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 T(e,t,n,r){var i={type:e,code:t,message:n};void 0!==r&&(i.row=r),y.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)x(e.delimiter)&&(e.delimiter=e.delimiter(i),y.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 d=o[h],p=0,f=0,m=0;c=void 0;for(var y=new g({comments:i,delimiter:d,newline:n,preview:10}).parse(t),v=0;v<y.data.length;v++)if(r&&b(y.data[v]))m++;else{var w=y.data[v].length;f+=w,void 0!==c?0<w&&(p+=Math.abs(w-c),c=w):c=w}0<y.data.length&&(f/=y.data.length-m),(void 0===l||p<=l)&&(void 0===u||u<f)&&1.99<f&&(l=p,a=d,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),y.meta.delimiter=e.delimiter}var u=w(e);return e.preview&&e.header&&u.preview++,t=i,n=new g(u),y=n.parse(t,o,a),E(),d?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,n.abort(),t=x(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(d=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,n.abort(),y.meta.aborted=!0,x(e.complete)&&e.complete(y),t=""}}function m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(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,d){if("string"!=typeof e)throw new Error("Input must be a string");var p=e.length,f=n.length,g=r.length,y=i.length,v=x(o),b=[],w=[],E=[],S=u=0;if(!e)return B();if(l||!1!==l&&-1===e.indexOf(t)){for(var k=e.split(r),T=0;T<k.length;T++){if(E=k[T],u+=E.length,T!==k.length-1)u+=r.length;else if(d)return B();if(!i||E.substring(0,y)!==i){if(v){if(b=[],I(E.split(n)),M(),h)return B()}else I(E.split(n));if(a&&a<=T)return b=b.slice(0,a),B(!0)}}return B()}for(var C=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===E.length&&e.substring(u,u+y)===i){if(-1===O)return B();u=O+g,O=e.indexOf(r,u),C=e.indexOf(n,u)}else if(-1!==C&&(C<O||-1===O))E.push(e.substring(u,C)),u=C+f,C=e.indexOf(n,u);else{if(-1===O)break;if(E.push(e.substring(u,O)),A(O+g),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 d||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:u}),R();if(j===p-1)return R(e.substring(u,j).replace(_,t));if(t!==c||e[j+1]!==c){if(t===c||0===j||e[j-1]!==c){-1!==C&&C<j+1&&(C=e.indexOf(n,j+1)),-1!==O&&O<j+1&&(O=e.indexOf(r,j+1));var L=N(-1===O?C:Math.min(C,O));if(e[j+1+L]===n){E.push(e.substring(u,j).replace(_,t)),e[u=j+1+L+f]!==t&&(j=e.indexOf(t,u)),C=e.indexOf(n,u),O=e.indexOf(r,u);break}var P=N(O);if(e.substring(j+1+P,j+1+P+g)===r){if(E.push(e.substring(u,j).replace(_,t)),A(j+1+P+g),C=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 R();function I(e){b.push(e),S=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 R(t){return d||(void 0===t&&(t=e.substring(u)),E.push(t),u=p,I(E),v&&M()),B()}function A(t){u=t,I(E),E=[],O=e.indexOf(r,u)}function B(e){return{data:b,errors:w,meta:{delimiter:n,linebreak:r,aborted:h,truncated:!!e,cursor:S+(s||0)}}}function M(){o(B()),b=[],w=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return u}}function y(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(x(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 x(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];x(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 E(e,t){return function(){e.apply(t,arguments)}}function x(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,(d.prototype=Object.create(d.prototype)).constructor=d,(p.prototype=Object.create(c.prototype)).constructor=p,s},void 0===(r=n.apply(t,[]))||(e.exports=r)},58548:function(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 d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=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=p(e);if(t){var i=p(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?d(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(d(t=n.call(this,e)),"continueOpenCollapsible",(function(){var e=d(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(d(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(d(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(d(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,d=c.contentOuterClassName,p=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),g="".concat(h,"__contentOuter ").concat(d),y="".concat(h,"__contentInner ").concat(p);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:g.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:y.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(82684)):(i=[n(82684)],void 0===(o="function"==typeof(r=a)?r.apply(t,i):r)||(e.exports=o))},80075:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Q,P:()=>X});var r=n(82684),i=n(4667),o=n(26439),a=n(14179),s=n(1359),l=n(493),c=n(63001),u=n(19146),h=n(70570),d=n(28718),p=n(11234),f=n(95500),m=n(37275),g=n(58640),y=n(12225),v=n(1974),b=n(56410);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=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}}(e,t)||x(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 E(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=x(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 x(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.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=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var T=function(e){return Object.prototype.hasOwnProperty.call(e,"paper_url")&&!e.paper_url.endsWith("/")&&"?"!==e.paper_url},C=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,m.rs)(e,"num_date")}:m.KT,o=e.nodes[e.idxOfFilteredRoot||e.idxOfInViewRootNode],a=function t(o,a){if(!o.shell.inView||e.visibility[o.arrayIdx]!==h.m7)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(!a)throw new v.i;return a+";"},O="text/tab-separated-values;charset=utf-8;",_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,d.unparse)(e,{quotes:!1,quoteChar:'"',escapeChar:'"',delimiter:"\t",header:!0,newline:"\n",skipEmptyLines:!0,columns:t})},j=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 L(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 P(e){return"".concat(e,"__url")}var I,N=function(e){var t=e.dispatch,n=e.filePrefix,r=e.tree,i=e.isNewick,o=e.temporal,a=e.colorings,s=e.colorBy;try{var l="".concat(n,"_").concat(o?"timetree":"tree",".").concat(i?"nwk":"nexus"),c=i?C(r,o):function(e,t,n,r){var i,o;return["#nexus","begin trees;"," tree one = "+C(e,r,!0,(i=function(e){return String(e).replace(/[[\]{}=,]/g,"").replace(/[\u0250-\ue007]/g,"")},o=(0,y.O$)(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,m.rs)(e,t);if(r){n.push("".concat(i(t),"=").concat(i(r)));var o=(0,m.rs)(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 a=(0,m.KT)(e);void 0!==a&&n.push("div=".concat(a))}return n.length?"[&".concat(n.join(","),"]"):""})),"end;"].join("\n")}(r,a,s,o);j(l,"text/plain;charset=utf-8;",c),t((0,p.a1)({message:"".concat(o?"TimeTree":"Tree"," written to ").concat(l)}))}catch(e){console.error(e);var u={message:"Error saving tree!"};e instanceof v.i&&(u.details="An empty tree was created. If you have selected genomes, note that we do not support downloads of multiple subtrees."),t((0,p.p5)(u))}},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]}}}},A=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>")},B=function(e,t,n,r,i,o){var a=[],s={tree:void 0,map:void 0,entropy:void 0,frequencies:void 0};if(-1!==n.indexOf("tree")){try{s.tree=R((new XMLSerializer).serializeToString(document.getElementById("MainTree"))),s.treeLegend=R((new XMLSerializer).serializeToString(document.getElementById("TreeLegendContainer")))}catch(e){s.tree=void 0,a.push("tree"),console.error("Tree SVG save error:",e)}if(s.tree&&document.getElementById("SecondTree"))try{s.secondTree=R((new XMLSerializer).serializeToString(document.getElementById("SecondTree"))),document.getElementById("Tangle")&&(s.tangle=R((new XMLSerializer).serializeToString(document.getElementById("Tangle"))))}catch(e){a.push("second tree / tanglegram"),console.error("Second Tree / tanglegram SVG save error:",e)}}if(-1!==n.indexOf("measurements"))try{s.measurements=R((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsSVG"))),s.measurementsXAxis=R((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsXAxisSVG")));var l=document.getElementById("measurementsSVGContainer");s.measurements.width=l.clientWidth,s.measurementsXAxis.width=l.clientWidth}catch(e){s.measurements=void 0,a.push("measurements"),console.error("Measurements SVG save error:",e)}if(-1!==n.indexOf("entropy"))try{s.entropy=R((new XMLSerializer).serializeToString(document.getElementById("d3entropyParent")))}catch(e){s.entropy=void 0,a.push("entropy"),console.error("Entropy SVG save error:",e)}if(-1!==n.indexOf("frequencies"))try{s.frequencies=R((new XMLSerializer).serializeToString(document.getElementById("d3frequenciesSVG")))}catch(e){s.frequencies=void 0,a.push("frequencies"),console.error("Frequencies SVG save error:",e)}-1!==n.indexOf("map")&&o&&(s.map={x:0,y:0,viewbox:void 0,width:parseFloat(o.mapDimensions.x),height:parseFloat(o.mapDimensions.y),inner:o.mapSvg});var c=[],u=function(e,t,n){var r=50,i=0,o=0;for(var a in e.secondTree&&(e.secondTree.x=f.yY+e.tree.width,e.tree.width+=f.yY+e.secondTree.width),e.measurements?(e.tree?(i=Math.max(e.tree.width,e.measurements.width),o=e.tree.height+r+e.measurements.height,e.measurements.y=e.tree.height+r):(i=e.measurements.width,o=e.measurements.height),e.measurementsXAxis.y=o,o+=e.measurementsXAxis.height,e.map&&(i=Math.max(i,e.map.width),e.map.y=o+r,o+=r+e.map.height)):e.tree&&e.map?"grid"===t?(i=e.tree.width+r+e.map.width,o=Math.max(e.tree.height,e.map.height),e.map.x=e.tree.width+r):(i=Math.max(e.tree.width,e.map.width),o=e.tree.height+r+e.map.height,e.map.y=e.tree.height+r):e.tree?(i=e.tree.width,o=e.tree.height):e.map&&(i=e.map.width,o=e.map.height),e.entropy&&(i<e.entropy.width?i=e.entropy.width:e.entropy.x=(i-e.entropy.width)/2,o?(e.entropy.y=o+r,o+=r+e.entropy.height):o=e.entropy.height),e.frequencies&&(i<e.frequencies.width?i=e.frequencies.width:e.frequencies.x=(i-e.frequencies.width)/2,o?(e.frequencies.y=o+r,o+=r+e.frequencies.height):o=e.frequencies.height),e)e[a]&&(e[a].x+=r,e[a].y+=r);o+=100;var s=36*n+20;return{width:i+=100,height:o+=s,padding:r,textY:o-s,textHeight:s}}(s,r,i.length);for(var h in c.push('<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="'.concat(u.width,'" height="').concat(u.height,'">')),s)s[h]&&A(c,h,s[h]);c.push('<foreignObject x="'.concat(u.padding,'" y="').concat(u.height-u.textHeight,'" height="').concat(u.textHeight,'" width="').concat(u.width-2*u.padding,'">')),i.forEach((function(e){c.push('<p xmlns="http://www.w3.org/1999/xhtml" style="font-family:lato,sans-serif;">'),c.push(e),c.push("</p>")})),c.push("</foreignObject>"),c.push("</svg>"),j(t+".svg","image/svg+xml;charset=utf-8",c.join("\n")),a.length?e((0,p.p5)({message:"Vector image saved",details:"Saved to ".concat(t,".svg, however there were errors with ").concat(a.join(", "))})):e((0,p.a1)({message:"Vector image saved",details:t+".svg"}))},M=n(57513),D=(0,c.Zz)(u.oO),F=(0,c.Zz)(u.bz),z=(0,c.Zz)(u.h_),V=(0,c.Zz)(u.qz),W=25,G=function(e){var t,n,i,o=e.dispatch,a=e.t,s=e.tree,c=e.entropy,u=e.metadata,d=e.colorBy,f=e.distanceMeasure,y=e.panelsToDisplay,v=e.panelLayout,x=e.visibility,S=e.relevantPublications,C=u.mainTreeNumTips,I=(0,M.zk)(s.nodes,s.visibility),R=I!==C,A=q(),G="num_date"===f,U=(0,b.hA)(window.location.pathname),H=(null==c?void 0:c.selectedCds)===h.BJ?"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),R?"Currently ".concat(I,"/").concat(C," tips are displayed and will be downloaded."):"Currently the entire dataset (".concat(C," tips) will be downloaded.")),u.sharing.dataset_json&&U.some(Boolean)&&r.createElement(Z,{name:"Auspice (Nextstrain) JSON",description:"The main Auspice dataset JSON(s) for the current view",icon:r.createElement(V,{width:W,selected:!0}),onClick:function(){return function(e,t){var n=[];if(!t.some(Boolean))return console.error("Unable to fetch empty dataset names: ".concat(JSON.stringify(t))),e((0,p.A)({message:"Unable to download Auspice JSON (see console for more info)"}));var r,i=E(t);try{var o=function(){var t=r.value;if(!t)return"continue";var i=t.replace("/","_")+".json";n.push(i);var o=new b.qz(t);o.fetchMain(),o.main.then((function(e){j(i,"application/json",JSON.stringify(e))})).catch((function(n){console.error("Error fetching JSON for ".concat(t,": ").concat(n)),e((0,p.A)({message:"Error preparing ".concat(i," JSON for download (see console for more info)")}))}))};for(i.s();!(r=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}e((0,p.a1)({message:"Preparing Auspice JSON(s) for download: ".concat(n.join(", "))}))}(o,U)}}),u.sharing.trees&&r.createElement(r.Fragment,null,r.createElement(Z,{name:"".concat(G?"TimeTree":"Tree"," (Newick)"),description:"Phylogenetic tree in Newick format with branch lengths in units of ".concat(G?"years":"divergence","."),icon:r.createElement(D,{width:W,selected:!0}),onClick:function(){return N({isNewick:!0,dispatch:o,filePrefix:A,tree:s,temporal:G})}}),r.createElement(Z,{name:"".concat(G?"TimeTree":"Tree"," (Nexus)"),description:"Phylogeny in Nexus format with branch lengths in units of ".concat(G?"years":"divergence",". Colorings are included as annotations."),icon:r.createElement(D,{width:W,selected:!0}),onClick:function(){return N({dispatch:o,filePrefix:A,tree:s,colorings:u.colorings,colorBy:d,temporal:G})}})),u.sharing.gisaid_acknowledgments&&r.createElement(Z,{name:"Acknowledgments (TSV)",description:"Per-sample acknowledgments (n = ".concat(I,")."),icon:r.createElement(z,{width:W,selected:!0}),onClick:function(){return function(e,t,n,r){var i,o={},a=["strain"],s=E(n.entries());try{for(s.s();!(i=s.n()).done;){var l=w(i.value,2),c=l[0],u=l[1];if(!u.hasChildren&&r[c]===h.m7&&u.shell.inView&&(o[u.name]={strain:u.name},u.node_attrs)){for(var d=0,f=["gisaid_epi_isl","genbank_accession","originating_lab","submitting_lab"];d<f.length;d++){var g=f[d],y=(0,m.rs)(u,g);y&&(L(a,null,g),o[u.name][g]=y)}var v=(0,m.ZZ)(u);if(v){var b="author";L(a,null,b),o[u.name][b]=v.value,T(v)&&(L(a,b,P(b)),o[u.name][P(b)]=v.paper_url)}}}}catch(e){s.e(e)}finally{s.f()}var x="".concat(t,"_acknowledgements.tsv");j(x,O,_(Object.values(o),a)),e((0,p.a1)({message:"Acknowledgments exported to ".concat(x)}))}(o,A,s.nodes,s.visibility)}}),u.sharing.metadata_tsv&&r.createElement(Z,{name:"Metadata (TSV)",description:"Per-sample metadata (n = ".concat(I,")."),icon:r.createElement(z,{width:W,selected:!0}),onClick:function(){return function(e,t,n,r){var i,o={},a=["strain"],s=E(n.entries());try{var l=function(){var e=w(i.value,2),t=e[0],n=e[1];if(n.hasChildren)return"continue";if(r[t]!==h.m7||!n.shell.inView)return"continue";if(o[n.name]={strain:n.name},!n.node_attrs)return"continue";var s=(0,m.rs)(n,"num_date");if(s){var l="date";L(a,null,l);var c=(0,m.rs)(n,"num_date",{confidence:!0});c&&c[0]!==c[1]?o[n.name][l]="".concat((0,g.hT)(s)," (").concat((0,g.hT)(c[0])," - ").concat((0,g.hT)(c[1]),")"):o[n.name][l]=(0,g.hT)(s)}var u,d=["author","div","num_date","vaccine","accession"],p=E(Object.keys(n.node_attrs).filter((function(e){return!d.includes(e)})));try{for(p.s();!(u=p.n()).done;){var f=u.value,y=(0,m.rs)(n,f);if(void 0!==y){L(a,null,f),"string"==typeof y?o[n.name][f]=y:"number"==typeof y&&(o[n.name][f]=parseFloat(y).toFixed(2));var v=(0,m.eD)(n,f);v&&(L(a,f,P(f)),o[n.name][P(f)]=v)}}}catch(e){p.e(e)}finally{p.f()}var b=(0,m.ZZ)(n);if(b){var x="author";L(a,null,x),o[n.name][x]=b.value,T(b)&&(L(a,x,P(x)),o[n.name][P(x)]=b.paper_url)}var S=(0,m.nt)(n);if(S&&S.selection_date){var k="vaccine_selection_date";L(a,null,k),o[n.name][k]=S.selection_date}var C=(0,m.Bu)(n);if(C.accession){var O="accession";L(a,null,O),o[n.name][O]=C.accession,C.url&&(L(a,O,P(O)),o[n.name][P(O)]=C.url)}};for(s.s();!(i=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}var c="".concat(t,"_metadata.tsv");j(c,O,_(Object.values(o),a)),e((0,p.a1)({message:"Metadata exported to ".concat(c)}))}(o,A,s.nodes,s.visibility)}}),u.sharing.authors&&function(e){for(var t=0;t<e.nodes.length;t++)if((0,m.ZZ)(e.nodes[t]))return!0;return!1}(s)&&r.createElement(Z,{name:"Author Metadata (TSV)",description:"Metadata for ".concat(I," samples grouped by their ").concat((t=s.nodes,n=s.visibility,i=new Set(t.filter((function(e,t){return n[t]===h.m7&&e.shell.inView})).map((function(e){return(0,m.ZZ)(e)})).filter((function(e){return e&&e.value})).map((function(e){return e.value}))),i.size)," authors."),icon:r.createElement(z,{width:W,selected:!0}),onClick:function(){return function(e,t,n){var r="n (strains)",i="unknown",o={};n.nodes.filter((function(e,t){return n.visibility[t]===h.m7&&e.shell.inView})).filter((function(e){return!e.hasChildren})).forEach((function(e){var t,n=(0,m.ZZ)(e);n&&(o[n.value]?(o[n.value][r]+=1,o[n.value].strains.push(e.name)):o[n.value]=(k(t={Author:n.value,"publication title":n.title||i,journal:n.journal||i,"publication URL":T(n)?n.paper_url:i},r,1),k(t,"strains",[e.name]),t))}));var a=["Author",r,"publication title","journal","publication URL","strains"],s=t+"_authors.tsv";j(s,O,_(Object.values(o),a)),e((0,p.a1)({message:"Author metadata exported",details:s}))}(o,A,s)}}),u.sharing.entropy&&c.loaded&&r.createElement(Z,{name:"Genetic diversity data (TSV)",description:"The data behind the diversity panel showing ".concat(c.showCounts?"a count of changes across the tree":"normalised shannon entropy"," per ").concat(H,"."),icon:r.createElement(z,{width:W,selected:!0}),onClick:function(){return function(e,t,n){var r={base:"x",gene:"prot",position:"codon",events:"y",entropy:"y"},i=n.selectedCds===h.BJ?["base"]:["gene","position"];i.push(n.showCounts?"events":"entropy");var o=n.bars.map((function(e){return Object.fromEntries(i.map((function(t){return[t,e[r[t]]]})))})),a="".concat(t,"_diversity.tsv");j(a,O,_(o,i)),e((0,p.a1)({message:"Diversity data exported to ".concat(a)}))}(o,A,c)}}),u.sharing.screenshot&&r.createElement(Z,{name:"Screenshot (SVG)",description:"Screenshot of the current nextstrain display in SVG format; CC-BY licensed.",icon:r.createElement(F,{width:W,selected:!0}),onClick:function(){return function(e,t,n,r,i,o,a,s,c){var u=[];u.push(n.title),u.push("Last updated ".concat(n.updated));var h=window.location.href.replace(/&/g,"&");u.push('Downloaded from <a href="'.concat(h,'">').concat(h,"</a> on ").concat((new Date).toLocaleString())),u.push((0,l.Cm)({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:"),c.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(B.bind(void 0,e,o,a,s,u)):B(e,o,a,s,u,void 0)}(o,a,u,s.nodes,x,q(),y,v,S)}}))};function Z(e){var t=e.name,n=e.description,i=e.icon,o=e.onClick,s=Object.assign({},a.S5,{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:s,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 q(){return"nextstrain_"+window.location.pathname.replace(/^\//,"").replace(/:/g,"-").replace(/\//g,"_")}function U(e){return U="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},U(e)}function H(){return H=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},H.apply(this,arguments)}function K(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)}}function Y(e,t){return Y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Y(e,t)}function J(e){return J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},J(e)}var X={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"}},$=(0,i.$j)((function(e){return{browserDimensions:e.browserDimensions.browserDimensions,colorBy:e.controls.colorBy,distanceMeasure:e.controls.distanceMeasure,metadata:e.metadata,entropy:e.entropy,tree:e.tree,nodes:e.tree.nodes,visibility:e.tree.visibility,panelsToDisplay:e.controls.panelsToDisplay,panelLayout:e.controls.panelLayout}}))(I=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&&Y(e,t)}(u,e);var t,n,i,o,c=(i=u,o=functi