UNPKG

auspice

Version:

Web app for visualizing pathogen evolution

2 lines 474 kB
/*! For license information please see auspice.chunk.mainComponent.bundle.3c75ad2eb9070ed69691.js.LICENSE.txt */ (self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[761],{79890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var r=n(8058),o=n.n(r),i=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function a(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(o()[n[1]]||"/"===e.charAt(e.length-2))&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var a=new RegExp(i),s=null;null!==(s=a.exec(e));)if(s[0].trim())if(s[1]){var l=s[1].trim(),c=[l,""];l.indexOf("=")>-1&&(c=l.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else s[2]&&(t.attrs[s[2]]=s[3].trim().substring(1,s[3].length-1));return t}var s=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,l=/^\s*$/,c=Object.create(null);function u(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(u,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var p={parse:function(e,t){t||(t={}),t.components||(t.components=c);var n,r=[],o=[],i=-1,u=!1;if(0!==e.indexOf("<")){var p=e.indexOf("<");r.push({type:"text",content:-1===p?e:e.substring(0,p)})}return e.replace(s,(function(s,c){if(u){if(s!=="</"+n.name+">")return;u=!1}var p,h="/"!==s.charAt(1),f=s.startsWith("\x3c!--"),d=c+s.length,m=e.charAt(d);if(f){var y=a(s);return i<0?(r.push(y),r):((p=o[i]).children.push(y),r)}if(h&&(i++,"tag"===(n=a(s)).type&&t.components[n.name]&&(n.type="component",u=!0),n.voidElement||u||!m||"<"===m||n.children.push({type:"text",content:e.slice(d,e.indexOf("<",d))}),0===i&&r.push(n),(p=o[i-1])&&p.children.push(n),o[i]=n),(!h||n.voidElement)&&(i>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(i--,n=-1===i?r:o[i]),!u&&"<"!==m&&m)){p=-1===i?r:o[i].children;var g=e.indexOf("<",d),v=e.slice(d,-1===g?void 0:g);l.test(v)&&(v=" "),(g>-1&&i+p.length>=0||" "!==v)&&p.push({type:"text",content:v})}})),r},stringify:function(e){return e.reduce((function(e,t){return e+u("",t)}),"")}};const h=p},28718:function(e,t){var n,r;function o(e){return o="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},o(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),i={},a=0,s={parse:function(n,r){var o=(r=r||{}).dynamicTyping||!1;if(x(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!x(r.transform)&&r.transform,r.worker&&s.WORKERS_SUPPORTED){var l=function(){if(!s.WORKERS_SUPPORTED)return!1;var n,r,o=(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(o);return l.onmessage=g,l.id=a++,i[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 h(r):!0===n.readable&&x(n.read)&&x(n.on)?c=new f(r):(t.File&&n instanceof File||n instanceof Object)&&(c=new p(r)),c.stream(n)},unparse:function(e,t){var n=!1,r=!0,i=",",a="\r\n",l='"',c=l+l,u=!1,p=null,h=!1;!function(){if("object"==o(t)){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(i=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");p=t.columns}void 0!==t.escapeChar&&(c=t.escapeChar+l),"boolean"==typeof t.escapeFormulae&&(h=t.escapeFormulae)}}();var f=new RegExp(m(l),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return d(null,e,u);if("object"==o(e[0]))return d(p||Object.keys(e[0]),e,u)}else if("object"==o(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"==o(e.data[0])?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==o(e.data[0])||(e.data=[e.data])),d(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function d(e,t,n){var o="";"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&&(o+=i),o+=y(e[c],c);0<t.length&&(o+=a)}for(var u=0;u<t.length;u++){var p=s?e.length:t[u].length,h=!1,f=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(h="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&s){for(var d=[],m=0;m<p;m++){var g=l?e[m]:m;d.push(t[u][g])}h=""===d.join("").trim()}if(!h){for(var v=0;v<p;v++){0<v&&!f&&(o+=i);var b=s&&l?e[v]:v;o+=y(t[u][b],v)}u<t.length-1&&(!n||0<p&&!f)&&(o+=a)}}return o}function y(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===h&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(f,c),o="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(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1);return o?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=d,s.NetworkStreamer=u,s.FileStreamer=p,s.StringStreamer=h,s.ReadableStreamStreamer=f,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 o=0;o<this.files.length;o++)r.push({file:this.files[o],inputElem:this,instanceConfig:l.extend({},n)})})),i(),this;function i(){if(0!==r.length){var t,n,i,c=r[0];if(x(e.before)){var u=e.before(c.file,c.inputElem);if("object"==o(u)){if("abort"===u.action)return"AbortError",t=c.file,n=c.inputElem,i=u.reason,void(x(e.error)&&e.error({name:"AbortError"},t,n,i));if("skip"===u.action)return void a();"object"==o(u.config)&&(c.instanceConfig=l.extend(c.instanceConfig,u.config))}else if("skip"===u)return void a()}var p=c.instanceConfig.complete;c.instanceConfig.complete=function(e){x(p)&&p(e,c.file,c.inputElem),a()},s.parse(c.file,c.instanceConfig)}else x(e.complete)&&e.complete()}function a(){r.splice(0,1),i()}}}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 d(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&x(this._config.beforeFirstChunk)){var o=this._config.beforeFirstChunk(e);void 0!==o&&(e=o)}this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e;this._partialLine="";var a=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=a.meta.cursor;this._finished||(this._partialLine=i.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=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 o=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+o)}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 p(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 o=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,o)}var i=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:i}})},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 h(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 f(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 d(e){var t,n,r,o=Math.pow(2,53),i=-o,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,p=0,h=!1,f=!1,d=[],g={data:[],errors:[],meta:{}};if(x(e.step)){var v=e.step;e.step=function(t){if(g=t,E())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&&(T("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 E()&&function(){if(g)if(Array.isArray(g.data[0])){for(var t=0;E()&&t<g.data.length;t++)g.data[t].forEach(n);g.data.splice(0,1)}else g.data.forEach(n);function n(t,n){x(e.transformHeader)&&(t=e.transformHeader(t,n)),d.push(t)}}(),function(){if(!g||!e.header&&!e.dynamicTyping&&!e.transform)return g;function t(t,n){var r,o=e.header?{}:[];for(r=0;r<t.length;r++){var i=r,a=t[r];e.header&&(i=r>=d.length?"__parsed_extra":d[r]),e.transform&&(a=e.transform(a,i)),a=k(i,a),"__parsed_extra"===i?(o[i]=o[i]||[],o[i].push(a)):o[i]=a}return e.header&&(r>d.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+r,p+n):r<d.length&&T("FieldMismatch","TooFewFields","Too few fields: expected "+d.length+" fields but parsed "+r,p+n)),o}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=d),p+=n,g}()}function E(){return e.header&&0===d.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(i<t&&t<o)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 o={type:e,code:t,message:n};void 0!==r&&(o.row=r),g.errors.push(o)}this.parse=function(o,i,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"),o=e.split("\n"),i=1<o.length&&o[0].length<r[0].length;if(1===r.length||i)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"}(o,l)),r=!1,e.delimiter)x(e.delimiter)&&(e.delimiter=e.delimiter(o),g.meta.delimiter=e.delimiter);else{var c=function(t,n,r,o,i){var a,l,c,u;i=i||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var p=0;p<i.length;p++){var h=i[p],f=0,d=0,m=0;c=void 0;for(var g=new y({comments:o,delimiter:h,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;d+=w,void 0!==c?0<w&&(f+=Math.abs(w-c),c=w):c=w}0<g.data.length&&(d/=g.data.length-m),(void 0===l||f<=l)&&(void 0===u||u<d)&&1.99<d&&(l=f,a=h,u=d)}return{successful:!!(e.delimiter=a),bestDelimiter:a}}(o,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=o,n=new y(u),g=n.parse(t,i,a),S(),h?{meta:{paused:!0}}:g||{meta:{paused:!1}}},this.paused=function(){return h},this.pause=function(){h=!0,n.abort(),t=x(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(h=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return f},this.abort=function(){f=!0,n.abort(),g.meta.aborted=!0,x(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,o=e.comments,i=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=","),o===n)throw new Error("Comment character same as delimiter");!0===o?o="#":("string"!=typeof o||-1<s.BAD_DELIMITERS.indexOf(o))&&(o=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var u=0,p=!1;this.parse=function(e,s,h){if("string"!=typeof e)throw new Error("Input must be a string");var f=e.length,d=n.length,y=r.length,g=o.length,v=x(i),b=[],w=[],S=[],E=u=0;if(!e)return D();if(l||!1!==l&&-1===e.indexOf(t)){for(var k=e.split(r),T=0;T<k.length;T++){if(S=k[T],u+=S.length,T!==k.length-1)u+=r.length;else if(h)return D();if(!o||S.substring(0,g)!==o){if(v){if(b=[],R(S.split(n)),B(),p)return D()}else R(S.split(n));if(a&&a<=T)return b=b.slice(0,a),D(!0)}}return D()}for(var _=e.indexOf(n,u),C=e.indexOf(r,u),O=new RegExp(m(c)+m(t),"g"),P=e.indexOf(t,u);;)if(e[u]!==t)if(o&&0===S.length&&e.substring(u,u+g)===o){if(-1===C)return D();u=C+y,C=e.indexOf(r,u),_=e.indexOf(n,u)}else if(-1!==_&&(_<C||-1===C))S.push(e.substring(u,_)),u=_+d,_=e.indexOf(n,u);else{if(-1===C)break;if(S.push(e.substring(u,C)),N(C+y),v&&(B(),p))return D();if(a&&b.length>=a)return D(!0)}else for(P=u,u++;;){if(-1===(P=e.indexOf(t,P+1)))return h||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:u}),M();if(P===f-1)return M(e.substring(u,P).replace(O,t));if(t!==c||e[P+1]!==c){if(t===c||0===P||e[P-1]!==c){-1!==_&&_<P+1&&(_=e.indexOf(n,P+1)),-1!==C&&C<P+1&&(C=e.indexOf(r,P+1));var j=A(-1===C?_:Math.min(_,C));if(e[P+1+j]===n){S.push(e.substring(u,P).replace(O,t)),e[u=P+1+j+d]!==t&&(P=e.indexOf(t,u)),_=e.indexOf(n,u),C=e.indexOf(r,u);break}var I=A(C);if(e.substring(P+1+I,P+1+I+y)===r){if(S.push(e.substring(u,P).replace(O,t)),N(P+1+I+y),_=e.indexOf(n,u),P=e.indexOf(t,u),v&&(B(),p))return D();if(a&&b.length>=a)return D(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:u}),P++}}else P++}return M();function R(e){b.push(e),E=u}function A(t){var n=0;if(-1!==t){var r=e.substring(P+1,t);r&&""===r.trim()&&(n=r.length)}return n}function M(t){return h||(void 0===t&&(t=e.substring(u)),S.push(t),u=f,R(S),v&&B()),D()}function N(t){u=t,R(S),S=[],C=e.indexOf(r,u)}function D(e){return{data:b,errors:w,meta:{delimiter:n,linebreak:r,aborted:p,truncated:!!e,cursor:E+(s||0)}}}function B(){i(D()),b=[],w=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=i[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var o={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},o),!r);a++);delete t.results}else x(n.userChunk)&&(n.userChunk(t.results,o,t.file),delete t.results)}t.finished&&!r&&v(t.workerId,t.results)}function v(e,t){var n=i[e];x(n.userComplete)&&n.userComplete(t),n.terminate(),delete i[e]}function b(){throw new Error("Not implemented.")}function w(e){if("object"!=o(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 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,(p.prototype=Object.create(c.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(f.prototype=Object.create(c.prototype)).constructor=f,s},void 0===(r=n.apply(t,[]))||(e.exports=r)},58548:function(e,t,n){var r,o,i,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 o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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 o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,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:i,resetWarningCache:o};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),o=n.n(r),i=n(0),a=n.n(i),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 p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(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&&p(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=f(e);if(t){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?h(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),d(h(t=n.call(this,e)),"continueOpenCollapsible",(function(){var e=h(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})})),d(h(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()))})),d(h(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()))})),d(h(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?o.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?o.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":"",i=!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,p=c.classParentString,h=c.contentOuterClassName,f=c.contentInnerClassName,d="".concat(p,"__trigger ").concat(n," ").concat(r," ").concat(this.state.isClosed?this.props.triggerClassName:this.props.triggerOpenedClassName),m="".concat(p," ").concat(this.state.isClosed?this.props.className:this.props.openedClassName),y="".concat(p,"__contentOuter ").concat(h),g="".concat(p,"__contentInner ").concat(f);return o.a.createElement(a,u({className:m.trim()},this.props.containerElementProps),o.a.createElement(s,u({id:this.triggerId,className:d.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),i),this.renderNonClickableTriggerElement(),o.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},o.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(82684)):(o=[n(82684)],void 0===(i="function"==typeof(r=a)?r.apply(t,o):r)||(e.exports=i))},8058:e=>{e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},80075:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Q,P:()=>Y});var r=n(82684),o=n(4667),i=n(26439),a=n(14179),s=n(1359),l=n(493),c=n(63001),u=n(19146),p=n(70570),h=n(28718),f=n(11234),d=n(95500),m=n(37275),y=n(58640),g=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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(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 S(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,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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,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,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function x(e,t){if(e){if("string"==typeof e)return E(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)?E(e,t):void 0}}function E(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},_=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""},o=t?function(e){return(0,m.rs)(e,"num_date")}:m.KT,i=e.nodes[e.idxOfFilteredRoot||e.idxOfInViewRootNode],a=function t(i,a){if(!i.shell.inView||e.visibility[i.arrayIdx]!==p.m7)return"";if(i.hasChildren){var s=i.children.map((function(e){return t(e,o(i))}));return"(".concat(s.filter((function(e){return!!e})).join(","),")")+"".concat(n?i.name:"").concat(r(i),":").concat(o(i)-a)}return"".concat(i.name).concat(r(i),":").concat(o(i)-a)}(i,o(i));if(!a)throw new v.i;return a+";"},C="text/tab-separated-values;charset=utf-8;",O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,h.unparse)(e,{quotes:!1,quoteChar:'"',escapeChar:'"',delimiter:"\t",header:!0,newline:"\n",skipEmptyLines:!0,columns:t})},P=function(e,t,n){var r=new Blob([n],{type:t}),o=document.createElement("a"),i=URL.createObjectURL(r);o.setAttribute("href",i),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)};function j(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 I(e){return"".concat(e,"__url")}var R,A=function(e){var t=e.dispatch,n=e.filePrefix,r=e.tree,o=e.isNewick,i=e.temporal,a=e.colorings,s=e.colorBy;try{var l="".concat(n,"_").concat(i?"timetree":"tree",".").concat(o?"nwk":"nexus"),c=o?_(r,i):function(e,t,n,r){var o,i;return["#nexus","begin trees;"," tree one = "+_(e,r,!0,(o=function(e){return String(e).replace(/[[\]{}=,]/g,"").replace(/[\u0250-\ue007]/g,"")},i=(0,g.O$)(n)?o(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(o(t),"=").concat(o(r)));var i=(0,m.rs)(e,t,{confidence:!0});Array.isArray(i)&&2===i.length&&n.push("".concat(o(t),"_CI={").concat(i.map((function(e){return o(e)})).join(","),"}"))}}})),i&&n.push("".concat(i,"=").concat(o(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,i);P(l,"text/plain;charset=utf-8;",c),t((0,f.a1)({message:"".concat(i?"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,f.p5)(u))}},M=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]}}}},N=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>")},D=function(e,t,n,r,o,i){var a=[],s={tree:void 0,map:void 0,entropy:void 0,frequencies:void 0};if(-1!==n.indexOf("tree")){try{s.tree=M((new XMLSerializer).serializeToString(document.getElementById("MainTree"))),s.treeLegend=M((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=M((new XMLSerializer).serializeToString(document.getElementById("SecondTree"))),document.getElementById("Tangle")&&(s.tangle=M((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=M((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsSVG"))),s.measurementsXAxis=M((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=M((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=M((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")&&i&&(s.map={x:0,y:0,viewbox:void 0,width:parseFloat(i.mapDimensions.x),height:parseFloat(i.mapDimensions.y),inner:i.mapSvg});var c=[],u=function(e,t,n){var r=50,o=0,i=0;for(var a in e.secondTree&&(e.secondTree.x=d.yY+e.tree.width,e.tree.width+=d.yY+e.secondTree.width),e.measurements?(e.tree?(o=Math.max(e.tree.width,e.measurements.width),i=e.tree.height+r+e.measurements.height,e.measurements.y=e.tree.height+r):(o=e.measurements.width,i=e.measurements.height),e.measurementsXAxis.y=i,i+=e.measurementsXAxis.height,e.map&&(o=Math.max(o,e.map.width),e.map.y=i+r,i+=r+e.map.height)):e.tree&&e.map?"grid"===t?(o=e.tree.width+r+e.map.width,i=Math.max(e.tree.height,e.map.height),e.map.x=e.tree.width+r):(o=Math.max(e.tree.width,e.map.width),i=e.tree.height+r+e.map.height,e.map.y=e.tree.height+r):e.tree?(o=e.tree.width,i=e.tree.height):e.map&&(o=e.map.width,i=e.map.height),e.entropy&&(o<e.entropy.width?o=e.entropy.width:e.entropy.x=(o-e.entropy.width)/2,i?(e.entropy.y=i+r,i+=r+e.entropy.height):i=e.entropy.height),e.frequencies&&(o<e.frequencies.width?o=e.frequencies.width:e.frequencies.x=(o-e.frequencies.width)/2,i?(e.frequencies.y=i+r,i+=r+e.frequencies.height):i=e.frequencies.height),e)e[a]&&(e[a].x+=r,e[a].y+=r);i+=100;var s=36*n+20;return{width:o+=100,height:i+=s,padding:r,textY:i-s,textHeight:s}}(s,r,o.length);for(var p 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[p]&&N(c,p,s[p]);c.push('<foreignObject x="'.concat(u.padding,'" y="').concat(u.height-u.textHeight,'" height="').concat(u.textHeight,'" width="').concat(u.width-2*u.padding,'">')),o.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>"),P(t+".svg","image/svg+xml;charset=utf-8",c.join("\n")),a.length?e((0,f.p5)({message:"Vector image saved",details:"Saved to ".concat(t,".svg, however there were errors with ").concat(a.join(", "))})):e((0,f.a1)({message:"Vector image saved",details:t+".svg"}))},B=n(57513),L=(0,c.Zz)(u.oO),z=(0,c.Zz)(u.bz),F=(0,c.Zz)(u.h_),Z=(0,c.Zz)(u.qz),W=25,H=function(e){var t,n,o,i=e.dispatch,a=e.t,s=e.tree,c=e.entropy,u=e.metadata,h=e.colorBy,d=e.distanceMeasure,g=e.panelsToDisplay,v=e.panelLayout,x=e.visibility,E=e.relevantPublications,_=u.mainTreeNumTips,R=(0,B.zk)(s.nodes,s.visibility),M=R!==_,N=V(),H="num_date"===d,U=(0,b.hA)(window.location.pathname),q=(null==c?void 0:c.selectedCds)===p.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),M?"Currently ".concat(R,"/").concat(_," tips are displayed and will be downloaded."):"Currently the entire dataset (".concat(_," tips) will be downloaded.")),u.sharing.dataset_json&&U.some(Boolean)&&r.createElement(G,{name:"Auspice (Nextstrain) JSON",description:"The main Auspice dataset JSON(s) for the current view",icon:r.createElement(Z,{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,f.A)({message:"Unable to download Auspice JSON (see console for more info)"}));var r,o=S(t);try{var i=function(){var t=r.value;if(!t)return"continue";var o=t.replace("/","_")+".json";n.push(o);var i=new b.qz(t);i.fetchMain(),i.main.then((function(e){P(o,"application/json",JSON.stringify(e))})).catch((function(n){console.error("Error fetching JSON for ".concat(t,": ").concat(n)),e((0,f.A)({message:"Error preparing ".concat(o," JSON for download (see console for more info)")}))}))};for(o.s();!(r=o.n()).done;)i()}catch(e){o.e(e)}finally{o.f()}e((0,f.a1)({message:"Preparing Auspice JSON(s) for download: ".concat(n.join(", "))}))}(i,U)}}),u.sharing.trees&&r.createElement(r.Fragment,null,r.createElement(G,{name:"".concat(H?"TimeTree":"Tree"," (Newick)"),description:"Phylogenetic tree in Newick format with branch lengths in units of ".concat(H?"years":"divergence","."),icon:r.createElement(L,{width:W,selected:!0}),onClick:function(){return A({isNewick:!0,dispatch:i,filePrefix:N,tree:s,temporal:H})}}),r.createElement(G,{name:"".concat(H?"TimeTree":"Tree"," (Nexus)"),description:"Phylogeny in Nexus format with branch lengths in units of ".concat(H?"years":"divergence",". Colorings are included as annotations."),icon:r.createElement(L,{width:W,selected:!0}),onClick:function(){return A({dispatch:i,filePrefix:N,tree:s,colorings:u.colorings,colorBy:h,temporal:H})}})),u.sharing.gisaid_acknowledgments&&r.createElement(G,{name:"Acknowledgments (TSV)",description:"Per-sample acknowledgments (n = ".concat(R,")."),icon:r.createElement(F,{width:W,selected:!0}),onClick:function(){return function(e,t,n,r){var o,i={},a=["strain"],s=S(n.entries());try{for(s.s();!(o=s.n()).done;){var l=w(o.value,2),c=l[0],u=l[1];if(!u.hasChildren&&r[c]===p.m7&&u.shell.inView&&(i[u.name]={strain:u.name},u.node_attrs)){for(var h=0,d=["gisaid_epi_isl","genbank_accession","originating_lab","submitting_lab"];h<d.length;h++){var y=d[h],g=(0,m.rs)(u,y);g&&(j(a,null,y),i[u.name][y]=g)}var v=(0,m.ZZ)(u);if(v){var b="author";j(a,null,b),i[u.name][b]=v.value,T(v)&&(j(a,b,I(b)),i[u.name][I(b)]=v.paper_url)}}}}catch(e){s.e(e)}finally{s.f()}var x="".concat(t,"_acknowledgements.tsv");P(x,C,O(Object.values(i),a)),e((0,f.a1)({message:"Acknowledgments exported to ".concat(x)}))}(i,N,s.nodes,s.visibility)}}),u.sharing.metadata_tsv&&r.createElement(G,{name:"Metadata (TSV)",description:"Per-sample metadata (n = ".concat(R,")."),icon:r.createElement(F,{width:W,selected:!0}),onClick:function(){return function(e,t,n,r){var o,i={},a=["strain"],s=S(n.entries());try{var l=function(){var e=w(o.value,2),t=e[0],n=e[1];if(n.hasChildren)return"continue";if(r[t]!==p.m7||!n.shell.inView)return"continue";if(i[n.name]={strain:n.name},!n.node_attrs)return"continue";var s=(0,m.rs)(n,"num_date");if(s){var l="date";j(a,null,l);var c=(0,m.rs)(n,"num_date",{confidence:!0});c&&c[0]!==c[1]?i[n.name][l]="".concat((0,y.hT)(s)," (").concat((0,y.hT)(c[0])," - ").concat((0,y.hT)(c[1]),")"):i[n.name][l]=(0,y.hT)(s)}var u,h=["author","div","num_date","vaccine","accession"],f=S(Object.keys(n.node_attrs).filter((function(e){return!h.includes(e)})));try{for(f.s();!(u=f.n()).done;){var d=u.value,g=(0,m.rs)(n,d);if(void 0!==g){j(a,null,d),"string"==typeof g?i[n.name][d]=g:"number"==typeof g&&(i[n.name][d]=parseFloat(g).toFixed(2));var v=(0,m.eD)(n,d);v&&(j(a,d,I(d)),i[n.name][I(d)]=v)}}}catch(e){f.e(e)}finally{f.f()}var b=(0,m.ZZ)(n);if(b){var x="author";j(a,null,x),i[n.name][x]=b.value,T(b)&&(j(a,x,I(x)),i[n.name][I(x)]=b.paper_url)}var E=(0,m.nt)(n);if(E&&E.selection_date){var k="vaccine_selection_date";j(a,null,k),i[n.name][k]=E.selection_date}var _=(0,m.Bu)(n);if(_.accession){var C="accession";j(a,null,C),i[n.name][C]=_.accession,_.url&&(j(a,C,I(C)),i[n.name][I(C)]=_.url)}};for(s.s();!(o=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}var c="".concat(t,"_metadata.tsv");P(c,C,O(Object.values(i),a)),e((0,f.a1)({message:"Metadata exported to ".concat(c)}))}(i,N,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(G,{name:"Author Metadata (TSV)",description:"Metadata for ".concat(R," samples grouped by their ").concat((t=s.nodes,n=s.visibility,o=new Set(t.filter((function(e,t){return n[t]===p.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}))),o.size)," authors."),icon:r.createElement(F,{width:W,selected:!0}),onClick:function(){return function(e,t,n){var r="n (strains)",o="unknown",i={};n.nodes.filter((function(e,t){return n.visibility[t]===p.m7&&e.shell.inView})).filter((function(e){return!e.hasChildren})).forEach((function(e){var t,n=(0,m.ZZ)(e);n&&(i[n.value]?(i[n.value][r]+=1,i[n.value].strains.push(e.name)):i[n.value]=(k(t={Author:n.value,"publication title":n.title||o,journal:n.journal||o,"publication URL":T(n)?n.paper_url:o},r,1),k(t,"strains",[e.name]),t))}));var a=["Author",r,"publication title","journal","publication URL","strains"],s=t+"_authors.tsv";P(s,C,O(Object.values(i),a)),e((0,f.a1)({message:"Author metadata exported",details:s}))}(i,N,s)}}),u.sharing.entropy&&c.loaded&&r.createElement(G,{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(q,"."),icon:r.createElement(F,{width:W,selected:!0}),onClick:function(){return function(e,t,n){var r={base:"x",gene:"prot",position:"codon",events:"y",entropy:"y"},o=n.selectedCds===p.BJ?["base"]:["gene","position"];o.push(n.showCounts?"events":"entropy");var i=n.bars.map((function(e){return Object.fromEntries(o.map((function(t){return[t,e[r[t]]]})))})),a="".concat(t,"_diversity.tsv");P(a,C,O(i,o)),e((0,f.a1)({message:"Diversity data exported to ".concat(a)}))}(i,N,c)}}),u.sharing.screenshot&&r.createElement(G,{name:"Screenshot (SVG)",description:"Screenshot of the current nextstrain display in SVG format; CC-BY licensed.",icon:r.createElement(z,{width:W,selected:!0}),onClick:function(){return function(e,t,n,r,o,i,a,s,c){var u=[];u.push(n.title),u.push("Last updated ".concat(n.updated));var p=window.location.href.replace(/&/g,"&amp;");u.push('Downloaded from <a href="'.concat(p,'">').concat(p,"</a> on ").concat((new Date).toLocaleString())),u.push((0,l.Cm)({mainTreeNumTips:n.mainTreeNumTips,nodes:r,visibility:o,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(D.bind(void 0,e,i,a,s,u)):D(e,i,a,s,u,void 0)}(i,a,u,s.nodes,x,V(),g,v,E)}}))};function G(e){var t=e.name,n=e.description,o=e.icon,i=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:i,style:{cursor:"pointer"}},o,r.createElement("button",{style:s,name:t},t),r.createElement("div",{style:{display:"inline-block",height:"30px",verticalAlign:"top",paddingTop:"6px"}},r.cre