UNPKG

auspice

Version:

Web app for visualizing pathogen evolution

1 lines 228 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{441:function(e,t,n){"use strict";n.d(t,"p",function(){return o}),n.d(t,"d",function(){return i}),n.d(t,"b",function(){return a}),n.d(t,"a",function(){return s}),n.d(t,"h",function(){return l}),n.d(t,"f",function(){return c}),n.d(t,"j",function(){return u}),n.d(t,"c",function(){return p}),n.d(t,"i",function(){return h}),n.d(t,"k",function(){return d}),n.d(t,"g",function(){return f}),n.d(t,"o",function(){return m}),n.d(t,"l",function(){return y}),n.d(t,"m",function(){return b}),n.d(t,"n",function(){return g}),n.d(t,"e",function(){return v});var r=n(2),o="Lato, Helvetica Neue, Helvetica, sans-serif",i="Lato, Helvetica Neue, Helvetica, sans-serif",a="Lato, Helvetica Neue, Helvetica, sans-serif",s="#333",l="#888",c="#BBB",u="#F2F2F2",p="#89B77F",h="#E39B39",d={backgroundColor:"#FFF",fontFamily:a,width:r.controlsWidth-13,borderSpacing:0,fontSize:14,paddingLeft:"10px",border:"1px solid #ccc",height:36,appearance:"none",borderRadius:"4px",color:s,fontWeight:400,marginBottom:"3px"},f={border:"0px",backgroundColor:"inherit",marginLeft:0,marginTop:5,marginRight:10,marginBottom:5,borderRadius:2,cursor:"pointer",padding:2,fontFamily:a,color:s,fontWeight:400,textTransform:"uppercase",fontSize:14,verticalAlign:"top",outline:0},m={borderTop:"1px solid #BBB",borderLeft:"1px solid #CCC",borderRight:"1px solid #CCC",borderBottom:"1px solid #CCC",borderRadius:"0px 0px 3px 3px",paddingTop:3,paddingBottom:3,paddingLeft:6,paddingRight:6,backgroundColor:"#fff",fontWeight:400,color:s,fontFamily:a,fontSize:12,textTransform:"uppercase"},y={borderTop:"1px solid #BBB",borderLeft:"1px solid #CCC",borderRight:"1px solid #CCC",borderBottom:"1px solid #CCC",borderRadius:"0px 0px 3px 3px",paddingTop:3,paddingBottom:3,paddingLeft:6,paddingRight:6,backgroundColor:"#fff"},b={border:"none",backgroundColor:"inherit",padding:0,margin:0,cursor:"pointer",fontFamily:a,color:s,fontWeight:400,textTransform:"uppercase",fontSize:12},g={border:"none",backgroundColor:"inherit",padding:0,margin:0,cursor:"pointer",fontFamily:a,color:"#5097BA",fontWeight:400,textTransform:"uppercase",fontSize:12},v={branchInfoHeading:{fontSize:15,fontWeight:400,verticalAlign:"middle",padding:"5px"},buttonLink:{float:"right",fontFamily:a,fontSize:14,fontWeight:400,textDecoration:"none",pointerEvents:"auto",background:"none",color:"white",cursor:"pointer",textTransform:"uppercase",borderRadius:2,border:"1px solid #CCC",verticalAlign:"middle"},tooltip:{position:"relative",padding:5,color:"white",fontFamily:a,fontSize:14,lineHeight:1,fontWeight:300},modalContainer:{position:"absolute",width:"100%",height:"100%",pointerEvents:"all",top:0,left:0,zIndex:2e3,backgroundColor:"rgba(80, 80, 80, .20)",display:"flex",justifyContent:"center",alignItems:"center",wordWrap:"break-word",wordBreak:"break-word"},panel:{position:"relative",paddingLeft:30,padding:"5% 5%",borderRadius:5,backgroundColor:"rgba(55,55,55,0.9)",color:"white",fontFamily:a,fontSize:18,lineHeight:1,fontWeight:300,maxWidth:500,overflow:"scroll"},modalHeading:{fontSize:24,fontWeight:400},modalSubheading:{fontSize:20,fontWeight:400,marginTop:"20px",marginBottom:"20px"},tooltipHeading:{fontSize:18,fontWeight:400,marginBottom:"10px"},comment:{fontStyle:"italic",fontWeight:200,fontSize:14,marginTop:"10px"},topRightMessage:{fontStyle:"italic",fontWeight:200,fontSize:14,textAlign:"right",marginTop:"-20px"},list:{paddingLeft:15,listStyleType:"disc"},item:{paddingTop:4,paddingBottom:4,minWidth:120},break:{marginBottom:"10px"}}},447:function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(441);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(n,!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(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 p(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,h(t).apply(this,arguments))}var n,r,a;return 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&&d(e,t)}(t,o.a.Component),n=t,(r=[{key:"getStyles",value:function(){return{base:{backgroundColor:"#FFFFFF",display:"inline-block",marginLeft:14,marginRight:0,marginTop:0,marginBottom:10,paddingLeft:6,paddingRight:6,paddingBottom:6,overflow:"hidden",position:"relative"},title:{fontFamily:i.d,color:i.a,fontSize:16,marginLeft:0,marginTop:0,marginBottom:8,fontWeight:500,backgroundColor:"#FFFFFF",borderTop:"thin solid #BBB",minHeight:"15px"}}}},{key:"getStylesInfoCard",value:function(){return{base:{backgroundColor:"#FFFFFF",display:"inline-block",marginLeft:14,marginRight:0,marginTop:0,marginBottom:10,paddingLeft:6,paddingRight:6,paddingBottom:6,overflow:"hidden",position:"relative"},title:{fontFamily:i.d,color:"#fff",fontSize:16,marginLeft:0,marginTop:0,marginBottom:8,fontWeight:500,backgroundColor:"#FFFFFF"}}}},{key:"render",value:function(){var e=this.props.infocard?this.getStylesInfoCard():this.getStyles();return o.a.createElement("div",{id:"".concat(this.props.title,"Card"),style:l({},e.base,{},this.props.style)},o.a.createElement("div",{id:"CardTitle",style:l({},e.title,{},this.props.titleStyles)},this.props.title),o.a.createElement("div",{id:"CardContentContainer",style:{display:"flex",justifyContent:this.props.center?"center":"flex-start"}},this.props.children))}}])&&u(n.prototype,r),a&&u(n,a),t}();t.a=f},450:function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(16),a=n.n(i);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})(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(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 p(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}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 t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,h(t).apply(this,arguments))}var n,r,i;return 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&&d(e,t)}(t,o.a.Component),n=t,(r=[{key:"getStyles",value:function(){return{base:{display:"flex",flexDirection:this.props.direction,flexWrap:this.props.wrap,justifyContent:this.props.justifyContent,alignItems:this.props.alignItems,alignContent:this.props.alignContent,order:this.props.order,flexGrow:this.props.grow,flexShrink:this.props.shrink,flexBasis:this.props.basis,alignSelf:this.props.alignSelf},style:this.props.style}}},{key:"render",value:function(){var e=this.getStyles();return o.a.createElement("div",{id:this.props.id,onClick:this.props.clickHandler,style:c({},e.base,{},e.style)},this.props.children)}}])&&u(n.prototype,r),i&&u(n,i),t}();f(m,"propTypes",{direction:a.a.oneOf(["row","rowReverse","column","columnReverse"]),wrap:a.a.oneOf(["nowrap","wrap","wrap-reverse"]),justifyContent:a.a.oneOf(["flex-start","flex-end","center","space-between","space-around"]),alignItems:a.a.oneOf(["flex-start","flex-end","center","baseline","stretch"]),alignContent:a.a.oneOf(["flex-start","flex-end","center","space-between","space-around","stretch"]),grow:a.a.number,shrink:a.a.number,basis:a.a.string,order:a.a.number,alignSelf:a.a.oneOf(["auto","flex-start","flex-end","center","baseline","stretch"]),styleOverrides:a.a.object,children:a.a.node,clickHandler:a.a.func}),f(m,"defaultProps",{direction:"row",wrap:"nowrap",justifyContent:"center",alignItems:"center",alignContent:"stretch",grow:0,shrink:1,basis:"auto",alignSelf:"auto",order:0,style:{}}),t.a=m},459:function(e,t,n){e.exports=n.p+"1ffc23cfee00e9e13194f13f3a7ce418.svg"},462:function(e,t,n){"use strict";n.d(t,"a",function(){return l});var r=n(32),o=n(86),i=(n(108),n(111)),a=n(88),s=n(0),l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return function(t,n){var l=n(),c=l.controls,u=l.tree,p=l.treeToo,h=l.metadata,d=l.frequencies;if(null===u.nodes||!h.loaded)return null;var f=e||c.colorBy,m=Object(o.calcColorScale)(f,c,u,p,h),y=Object(r.calcNodeColor)(u,m),b=p.loaded?Object(r.calcNodeColor)(p,m):void 0,g=Object(r.determineColorByGenotypeMutType)(f),v=g!==c.mutType&&g;return v&&t(Object(i.a)(v)),t({type:s.D,colorBy:f,colorScale:m,nodeColors:y,nodeColorsToo:b,version:m.version}),d.loaded&&Object(a.b)(t,n),null}}},473:function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(442),a=n(2),s=function(e){var t=e.navHeight,n=e.navWidth,r=e.display,i=e.onClick;n||(n=0);var a={position:"fixed",left:n-12,visibility:r?"visible":"hidden",width:r?12:0,top:t/2-8,backgroundColor:"inherit",boxShadow:"none",cursor:"pointer",borderRadius:"0px",fontSize:12,color:"#444",textAlign:"center",verticalAlign:"middle"};return o.a.createElement("div",{style:a,onClick:i},o.a.createElement("i",{className:"fa fa-chevron-left","aria-hidden":"true"}))},l=n(459),c=i.b.div.withConfig({displayName:"content__AuspiceNavBarContainer",componentId:"jg0fvy-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%;"]),u=i.b.a.withConfig({displayName:"content__Title",componentId:"jg0fvy-1"})(["padding:0px;text-decoration:none;color:",";font-size:20px;font-weight:400;cursor:pointer;letter-spacing:1rem;"],function(e){return e.theme.color}),p=i.b.a.withConfig({displayName:"content__LogoLink",componentId:"jg0fvy-2"})(["padding:5px 5px;width:50px;cursor:pointer;"]),h=i.b.div.withConfig({displayName:"content__NarrativeTitle",componentId:"jg0fvy-3"})(["white-space:nowrap;font-size:1.7rem;margin-left:auto;padding:0px 12px;float:right;color:",";max-width:","px;overflow:hidden;text-overflow:ellipsis;"],function(e){return e.theme.color},function(e){return e.width-90}),d=n(43),f=i.b.div.withConfig({displayName:"navBar__NavBarContainer",componentId:"ygpsg-0"})(["left:0;max-width:960px;margin-top:auto;margin-right:auto;margin-bottom:auto;margin-left:auto;height:","px;justify-content:space-between;align-items:center;overflow:hidden;z-index:100;transition:left .3s ease-out;"],function(e){return e.narrative?a.narrativeNavBarHeight:a.normalNavBarHeight}),m=Object(d.hasExtension)("navbarComponent")?Object(d.getExtension)("navbarComponent"):function(e){var t=e.narrativeTitle,n=e.sidebar,r=e.width;return n?o.a.createElement(c,null,o.a.createElement("div",{style:{flex:1}}),o.a.createElement(p,{href:"/"},o.a.createElement("img",{alt:"splashPage",width:"40px",src:l})),o.a.createElement("div",{style:{flex:1}}),function(e,t){return e?o.a.createElement(h,{width:t,href:"/"},e):o.a.createElement(u,{href:"/"},"auspice")}(t,r),o.a.createElement("div",{style:{flex:1}})):null};t.a=function(e){var t=e.sidebar,n=(e.mobileDisplay,e.toggleHandler),r=e.narrativeTitle,i=e.width,l=t&&!r;return o.a.createElement(f,null,o.a.createElement(m,{narrativeTitle:r,sidebar:t}),o.a.createElement(s,{navHeight:a.normalNavBarHeight,navWidth:i,display:l,onClick:n}))}},504:function(e,t){e.exports={version:"1.39.1"}},624:function(e,t,n){var r=n(625);"string"==typeof r&&(r=[[e.i,r,""]]);n(56)(r,{});r.locals&&(e.exports=r.locals)},625:function(e,t,n){(e.exports=n(55)(!1)).push([e.i,'.awesomplete [hidden] {\n display: none;\n}\n\n.awesomplete .visually-hidden {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n}\n\n.awesomplete {\n display: inline-block;\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.awesomplete > input {\n display: block;\n}\n\n.awesomplete > ul {\n position: absolute;\n left: 0;\n z-index: 1;\n min-width: 100%;\n box-sizing: border-box;\n list-style: none;\n padding: 0;\n margin: 0;\n background: #fff;\n}\n\n.awesomplete > ul:empty {\n display: none;\n}\n\n.awesomplete > ul {\n width: 80%;\n border-radius: .3em;\n margin: .2em 0 0;\n background: hsla(0,0%,100%,.9);\n background: linear-gradient(to bottom right, white, hsla(0,0%,100%,.8));\n border: 1px solid rgba(0,0,0,.3);\n box-shadow: .05em .2em .6em rgba(0,0,0,.2);\n text-shadow: none;\n}\n\n@supports (transform: scale(0)) {\n .awesomplete > ul {\n transition: .3s cubic-bezier(.4,.2,.5,1.4);\n transform-origin: 1.43em -.43em;\n }\n\n .awesomplete > ul[hidden],\n .awesomplete > ul:empty {\n opacity: 0;\n transform: scale(0);\n display: block;\n transition-timing-function: ease;\n }\n}\n\n /* Pointer */\n .awesomplete > ul:before {\n content: "";\n position: absolute;\n top: -.43em;\n left: 1em;\n width: 0; height: 0;\n padding: .4em;\n background: white;\n border: inherit;\n border-right: 0;\n border-bottom: 0;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n\n .awesomplete > ul > li {\n position: relative;\n padding: .2em .5em;\n cursor: pointer;\n }\n\n .awesomplete > ul > li:hover {\n background: hsl(200, 40%, 80%);\n color: black;\n }\n\n .awesomplete > ul > li[aria-selected="true"] {\n background: hsl(205, 40%, 40%);\n color: white;\n }\n\n .awesomplete mark {\n color: rgb(80, 151, 186);\n background: white;\n }\n\n .awesomplete li:hover mark {\n background: hsl(200, 40%, 80%);\n }\n',""])},649:function(e,t,n){"use strict";n.r(t);var r,o=n(3),i=n.n(o),a=n(16),s=n.n(a),l=n(48),c=n(442),u=n(441),p=function(e){var t=e.sidebarOpen,n=e.mobileDisplay,r=e.handler,o={visibility:n?"visible":t?"hidden":"visible",width:n?60:14,height:n?60:44,position:"absolute",top:n?15:4,left:n?"auto":0,right:n?20:"auto",zIndex:9e3,backgroundColor:n?u.c:u.j,boxShadow:n?"2px 4px 10px 1px rgba(0, 0, 0, 0.15)":"0px 0px 5px 1px rgba(0, 0, 0, 0.2)",cursor:"pointer",padding:0,transition:"top 0.3s ease-out, left 0.3s ease-out, width 0.3s ease-out, height 0.3s ease-out",borderRadius:n?"45px":"0px 6px 6px 0px"},a={visibility:n?"visible":t?"hidden":"visible",position:"absolute",width:30,height:30,top:"50%",left:"50%",lineHeight:"30px",textAlign:"center",transform:"translate(-50%,-50%)",marginLeft:"auto",marginRight:"auto",verticalAlign:"middle",color:n?"#FFFFFF":"#444",fontSize:n?26:12},s="fa fa-close";return t&&!n?s="fa fa-chevron-left":t||n?t&&n?s="fa fa-close":!t&&n&&(s="fa fa-sliders"):s="fa fa-chevron-right",i.a.createElement("div",{style:o,onClick:r},i.a.createElement("div",{style:a},i.a.createElement("i",{className:s,"aria-hidden":"true"})))},h=n(447),d=n(143),f=n(145),m=n(19),y=n(6),b=n(2),g=n(0),v=n(450),w=n(462),S=n(504),O=n(474),E=n.n(O),x=function(e){e||(e=window.event),e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()},k=function(e,t){return i.a.createElement("tr",{key:e},i.a.createElement("th",{style:u.e.item},e),i.a.createElement("td",{style:u.e.item},t))},T=function(e){return"?"!==e&&void 0!==e&&"undefined"!==e},C=function(e,t){return t in e&&T(e[t])},j=function(e){var t=e.tip,n=e.goAwayCallback,r=e.metadata;if(!t)return null;var o,a,s=!!C(t.n.attr,"url")&&function(e){return void 0!==e&&e.startsWith("https_")?e.replace("https_","https:"):void 0!==e&&e.startsWith("http_")?e.replace("http_","http:"):e}(t.n.attr.url),l="num_date_confidence"in t.n.attr&&t.n.attr.num_date_confidence[0]!==t.n.attr.num_date_confidence[1],c=t.n.attr.authors||void 0,p={author:{n:null,title:null,journal:null,paper_url:null}};return r.author_info&&(p=r.author_info),i.a.createElement("div",{style:u.e.modalContainer,onClick:function(){return n(t)}},i.a.createElement("div",{className:"panel",style:u.e.panel,onClick:function(e){return x(e)}},i.a.createElement("p",{style:u.e.modalHeading},"".concat(t.n.strain)),i.a.createElement("table",null,i.a.createElement("tbody",null,(a=t).n.vaccineDate?i.a.createElement("tr",null,i.a.createElement("th",null,"Vaccine strain"),i.a.createElement("td",null,a.n.vaccineDate)):null,["country","region","division"].map(function(e){return C(t.n.attr,e)?k(Object(f.prettyString)(e),Object(f.prettyString)(t.n.attr[e])):null}),k(l?"Inferred collection date":"Collection date",Object(f.prettyString)(t.n.attr.date)),l?(o=t.n.attr.num_date_confidence,k("Collection date confidence","(".concat(Object(y.numericToCalendar)(o[0]),", ").concat(Object(y.numericToCalendar)(o[1]),")"))):null,p[c]&&p[c].title&&T(p[c].title)?k("Publication",Object(f.prettyString)(p[c].title,{trim:80,camelCase:!1})):null,C(t.n.attr,"authors")?k("Authors",Object(f.authorString)(t.n.attr.authors)):null,s&&C(t.n.attr,"accession")?function(e,t){return i.a.createElement("tr",null,i.a.createElement("th",null,"Accession"),i.a.createElement("td",null,i.a.createElement("a",{href:e,target:"_blank"},t)))}(s,t.n.attr.accession):s?function(e){return i.a.createElement("tr",null,i.a.createElement("th",null,"URL"),i.a.createElement("td",null,i.a.createElement("a",{href:e,target:"_blank"},i.a.createElement("em",null,"click here"))))}(s):C(t.n.attr,"accession")?k("Accession",t.n.attr.accession):null)),i.a.createElement("p",{style:u.e.comment},"Click outside this box to go back to the tree")))},_=n(150),P=n(7),D=function(e){var t=e.dispatch,n=e.transform,r=e.legendRectSize,o=e.legendSpacing,a=e.rectStroke,s=e.rectFill,l=e.label,c=e.value;return i.a.createElement("g",{transform:n,onMouseEnter:function(){t(Object(d.e)({selectedLegendItem:c}))},onMouseLeave:function(){t(Object(d.e)())}},i.a.createElement("rect",{style:{strokeWidth:2},width:r,height:r,fill:s,stroke:a}),i.a.createElement("text",{x:r+o+5,y:r-o,style:{fontSize:12,fill:u.a,fontFamily:u.b}},l))},M=n(32),N=n(21);function B(e){return(B="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})(e)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function R(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 A(e,t){return!t||"object"!==B(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var V=Object(l.b)(function(e){return{colorBy:e.controls.colorBy,colorOptions:e.metadata.colorOptions,colorScale:e.controls.colorScale}})(r=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=A(this,z(t).call(this,e))).state={legendVisible:!0},n}var n,r,o;return 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&&F(e,t)}(t,i.a.Component),n=t,(r=[{key:"componentWillMount",value:function(){this.updateLegendVisibility(this.props.width,this.props.colorScale)}},{key:"componentWillReceiveProps",value:function(e){this.props.width===e.width&&this.props.colorScale.version===e.colorScale.version||this.updateLegendVisibility(e.width,e.colorScale)}},{key:"updateLegendVisibility",value:function(e,t){e<600||t.legendValues.length>32?this.setState({legendVisible:!1}):this.setState({legendVisible:!0})}},{key:"getSVGHeight",value:function(){if(!this.state.legendVisible)return 18;var e=this.props.colorScale.legendValues.length;return Math.ceil(e/2)*(b.legendRectSize+b.legendSpacing)+b.legendSpacing+20||100}},{key:"getSVGWidth",value:function(){return this.state.legendVisible?290:this.getTitleWidth()+20}},{key:"getTransformationForLegendItem",value:function(e){var t=this.props.colorScale.legendValues.length,n=Math.ceil(t/2);return"translate("+(145*Math.floor(e/n)+10)+","+e%n*(b.legendRectSize+b.legendSpacing)+")"}},{key:"getTitleString",value:function(){if(Object(N.isColorByGenotype)(this.props.colorBy)){var e=Object(N.decodeColorByGenotype)(this.props.colorBy);return e.aa?"Genotype at ".concat(e.gene," site ").concat(e.positions.join(", ")):"Nucleotide at position ".concat(e.positions.join(", "))}return void 0===this.props.colorOptions[this.props.colorBy]?"":this.props.colorOptions[this.props.colorBy].legendTitle}},{key:"getTitleWidth",value:function(){return 15+5.3*this.getTitleString().length}},{key:"toggleLegend",value:function(){var e=!this.state.legendVisible;this.setState({legendVisible:e})}},{key:"legendTitle",value:function(){return i.a.createElement("g",{id:"Title"},i.a.createElement("rect",{width:this.getTitleWidth(),height:"12",fill:"rgba(255,255,255,.85)"}),i.a.createElement("text",{x:5,y:10,style:{fontSize:12,fill:u.a,fontFamily:u.d,backgroundColor:"#fff"}},this.getTitleString()))}},{key:"legendChevron",value:function(){var e=this.state.legendVisible?-180:0,t=this.getTitleWidth();return i.a.createElement("g",{id:"Chevron",transform:"translate(".concat(t,",0)")},i.a.createElement("svg",{width:"12",height:"12",viewBox:"0 0 1792 1792"},i.a.createElement("rect",{width:"1792",height:"1792",fill:"rgba(255,255,255,.85)"}),i.a.createElement("path",{fill:u.a,style:{transform:"rotate(".concat(e,"deg)"),transformOrigin:"50% 50%",transition:"".concat(b.fastTransitionDuration,"ms ease-in-out")},d:"M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"})))}},{key:"styleLabelText",value:function(e){if("num_date"===this.props.colorBy){var t=this.props.colorScale.legendValues;if(t[t.length-1]-t[0]>10&&t[t.length-1]-parseInt(e,10)>=10)return parseInt(e,10);var n=I(Object(y.numericToCalendar)(e).split("-"),3),r=n[0],o=n[1];n[2];return"".concat(b.months[o]," ").concat(r)}return this.props.colorScale.continuous?e:Object(f.prettyString)(e)}},{key:"legendItems",value:function(){var e=this,t=this.props.colorScale.legendValues.filter(function(e){return void 0!==e}).map(function(t,n){return i.a.createElement(D,{dispatch:e.props.dispatch,legendRectSize:b.legendRectSize,legendSpacing:b.legendSpacing,rectFill:Object(P.f)(e.props.colorScale.scale(t)).brighter([.35]).toString(),rectStroke:Object(P.f)(e.props.colorScale.scale(t)).toString(),transform:e.getTransformationForLegendItem(n),key:t,value:t,label:e.styleLabelText(t),index:n})});return i.a.createElement("g",{id:"ItemsContainer"},i.a.createElement("rect",{width:"290",height:this.getSVGHeight(),fill:"rgba(255,255,255,.85)"}),i.a.createElement("g",{id:"Items",transform:"translate(0,20)"},t))}},{key:"getStyles",value:function(){return{svg:{position:"absolute",left:5,top:26,borderRadius:4,zIndex:1e3}}}},{key:"render",value:function(){var e=this;if(!this.props.colorScale)return null;var t=this.getStyles();return i.a.createElement("svg",{id:"TreeLegendContainer",width:this.getSVGWidth(),height:this.getSVGHeight(),style:t.svg},this.legendItems(),i.a.createElement("g",{id:"TitleAndChevron",onClick:function(){return e.toggleLegend()},style:{cursor:"pointer"}},this.legendTitle(),this.legendChevron()))}}])&&R(n.prototype,r),o&&R(n,o),t}())||r,W=n(22),G=n(85),H=n(460),q=function(e){return 1===e["stroke-width"]?0:e["stroke-width"]>6?e["stroke-width"]+6:2*e["stroke-width"]},U=(n(108),function(e){var t=e.n.hidden;return t&&("always"===t||"timetree"===t&&"num_date"===e.that.distance||"divtree"===t&&"div"===e.that.distance)?"hidden":"visible"});function X(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var K={attrs:{".tip":{r:function(e){return e.r},cx:function(e){return e.xTip},cy:function(e){return e.yTip}},".branch":{},".vaccineCross":{d:function(e){return e.vaccineCross}},".conf":{d:function(e){return e.confLine}}},styles:{".tip":{fill:function(e){return e.fill},stroke:function(e){return e.tipStroke},visibility:function(e){return e.visibility===b.NODE_VISIBLE?"visible":"hidden"}},".conf":{stroke:function(e){return e.branchStroke},"stroke-width":q},".branch":{stroke:function(e){return e.branchStroke},"stroke-width":function(e){return e["stroke-width"]+"px"},cursor:function(e){return e.visibility===b.NODE_VISIBLE?"pointer":"default"},visibility:U}}},Y=function(e,t){return function(n){K.attrs[e]&&X(t).filter(function(t){return K.attrs[e][t]}).forEach(function(t){n.attr(t,K.attrs[e][t])}),K.styles[e]&&X(t).filter(function(t){return K.styles[e][t]}).forEach(function(t){n.style(t,K.styles[e][t])})}},J=function(e,t,n,r){e.selectAll(t).filter(function(e){return e.update}).transition().duration(r).call(n),r||Object(H.d)()},Z=n(9),Q=function e(t,n){t.x=t.px+t.branchLength*Math.cos(t.tau+.5*t.w),t.y=t.py+t.branchLength*Math.sin(t.tau+.5*t.w);var r=t.tau;if(!t.terminal)for(var o=0;o<t.children.length;o++){var i=t.children[o];i.w=2*Math.PI*i.leafCount/n,i.tau=r,r+=i.w,i.px=t.x,i.py=t.y,e(i,n)}},$=function(e){var t=Math.floor(Math.log10(e)),n=Math.pow(10,t);return e/n<2?n/=5:e/n<5&&(n/=2),n},ee=function(e){return"aa"===e?"10px":"14px"},te=function(e){return"aa"===e?"500":"700"},ne=function(e,t,n){if("clade"===e)return"visible";return function(e){return e.n.tipCount>.05*n&&"rect"===t?"visible":"hidden"}},re=function(e,t){var n=this;this.grid=!1,this.attributes=["r","cx","cy","id","class","d"],this.params={regressionStroke:u.a,regressionWidth:6,majorGridStroke:"#CCC",majorGridWidth:2,minorGridStroke:"#DDD",minorGridWidth:1,tickLabelSize:12,tickLabelFill:u.a,minorTicksTimeTree:3,minorTicks:4,orientation:[1,1],margins:{left:25,right:15,top:10,bottom:30},showGrid:!0,fillSelected:"#A73",radiusSelected:5,branchStroke:"#AAA",branchStrokeWidth:2,tipStroke:"#AAA",tipFill:"#CCC",tipStrokeWidth:1,tipRadius:4,fontFamily:u.b,branchLabelKey:!1,branchLabelFont:u.b,branchLabelFill:"#777",branchLabelFontWeight:500,branchLabelPadX:8,branchLabelPadY:5,tipLabels:!0,tipLabelFont:u.b,tipLabelFill:"#555",tipLabelPadX:8,tipLabelPadY:2,mapToScreenDebounceTime:500,tipLabelFontSizeL1:8,tipLabelFontSizeL2:10,tipLabelFontSizeL3:12,tipLabelBreakL1:75,tipLabelBreakL2:50,tipLabelBreakL3:25},this.groups={},this.debugId=t,this.nodes=e.map(function(e){var t={that:n,n:e,x:0,y:0,terminal:void 0===e.children,inView:void 0===e.inView||e.inView};return e.shell=t,t}),this.numberOfTips=Object(G.c)(this.nodes),Object(G.d)(this.nodes),this.xScale=Object(W.a)(),this.yScale=Object(W.a)(),this.zoomNode=this.nodes[0],this.strainToNode={},this.nodes.forEach(function(e){n.strainToNode[e.n.strain]=e})};re.prototype.change=function(e){var t,n,r=e.changeColorBy,o=void 0!==r&&r,i=e.changeVisibility,a=void 0!==i&&i,s=e.changeTipRadii,l=void 0!==s&&s,c=e.changeBranchThickness,u=void 0!==c&&c,p=e.showConfidences,h=void 0!==p&&p,d=e.removeConfidences,f=void 0!==d&&d,m=e.zoomIntoClade,y=void 0!==m&&m,b=e.svgHasChangedDimensions,g=void 0!==b&&b,v=e.newDistance,w=void 0===v?void 0:v,S=e.newLayout,O=void 0===S?void 0:S,E=e.updateLayout,x=void 0===E?void 0:E,k=e.newBranchLabellingKey,T=void 0===k?void 0:k,C=e.branchStroke,j=void 0===C?void 0:C,_=e.tipStroke,P=void 0===_?void 0:_,L=e.fill,D=void 0===L?void 0:L,M=e.visibility,N=void 0===M?void 0:M,B=e.tipRadii,I=void 0===B?void 0:B,R=e.branchThickness,A=void 0===R?void 0:R,z=new Set,F={},V=new Set,W=O,H=500;Date.now()-this.timeLastRenderRequested<1e3&&(H=0),o&&(z.add(".branch").add(".tip").add(".conf"),V.add("stroke").add("fill"),F.branchStroke=j,F.tipStroke=P,F.fill=D),a&&(z.add(".tip").add(".tipLabel"),V.add("visibility").add("cursor"),F.visibility=N),l&&(z.add(".tip"),V.add("r"),F.r=I),u&&(z.add(".branch").add(".conf"),V.add("stroke-width"),F["stroke-width"]=A),(w||O||x||y||g)&&(z.add(".tip").add(".branch.S").add(".branch.T").add(".branch"),z.add(".vaccineCross").add(".vaccineDottedLine").add(".conf"),z.add(".branchLabel").add(".tipLabel"),z.add(".grid").add(".regression"),V.add("cx").add("cy").add("d").add("opacity").add("visibility")),t=this.nodes,n=F,t.forEach(function(e,t){for(var r in e.update=!1,n){var o=n[r][t];o!==e[r]&&(e[r]=o,e.update=!0)}}),y&&(this.nodes.forEach(function(e){e.inView=!1,e.update=!0}),this.zoomNode=y.terminal?y.parent:y,Object(G.b)(this.zoomNode,function(e){e.inView=!0})),g&&this.nodes.forEach(function(e){e.update=!0}),w&&this.setDistance(w),(w||O||x)&&this.setLayout(O||this.layout),(V.has(["stroke-width"])||w||O||x||y||g)&&this.mapToScreen();var q={removeConfidences:f,showConfidences:h,newBranchLabellingKey:T};q.timeSliceHasPotentiallyChanged=a||w,W?this.modifySVGInStages(z,V,H,1e3):this.modifySVG(z,V,H,q),this.timeLastRenderRequested=Date.now()},re.prototype.modifySVG=function(e,t,n,r){var o,i=this,a=[".tip",".vaccineDottedLine",".vaccineCross",".branch"];if(e.has(".branch.S")||e.has(".branch.T")){var s=e.has(".branch");s&&a.splice(a.indexOf(".branch"),1),[".S",".T"].forEach(function(r,a){e.has(".branch".concat(r))&&(o=s?function(e){Y(".branch",t)(e),e.attr("d",function(e){return e.branch[a]})}:function(e){e.attr("d",function(e){return e.branch[a]})},J(i.svg,".branch".concat(r),o,n))})}a.forEach(function(r){e.has(r)&&(o=Y(r,t),J(i.svg,r,o,n))}),e.has(".branchLabel")&&this.updateBranchLabels(n),e.has(".tipLabel")&&this.updateTipLabels(),e.has(".grid")&&(this.grid&&"unrooted"!==this.layout?this.addGrid():this.hideGrid()),e.has(".regression")&&(this.removeRegression(),"clock"===this.layout&&"num_date"===this.distance&&this.drawRegression()),r.removeConfidences&&this.confidencesInSVG?this.removeConfidence():r.showConfidences&&!this.confidencesInSVG?this.drawConfidence():e.has(".conf")&&this.confidencesInSVG&&("rect"===this.layout&&"num_date"===this.distance?(o=Y(".conf",t),J(this.svg,".conf",o,n)):this.removeConfidence()),r.timeSliceHasPotentiallyChanged&&this.addTemporalSlice(),r.newBranchLabellingKey&&(this.removeBranchLabels(),"none"!==r.newBranchLabellingKey&&this.drawBranchLabels(r.newBranchLabellingKey))},re.prototype.modifySVGInStages=function(e,t,n,r){var o=this;e.delete(".tip"),this.hideGrid();var i=0,a=function(){o.drawBranches(),o.params.showGrid&&o.addGrid(),o.svg.selectAll(".tip").remove(),o.drawTips(),o.updateTipLabels(),o.vaccines&&o.drawVaccines(),o.addTemporalSlice(),"clock"===o.layout&&"num_date"===o.distance&&o.drawRegression(),e.has(".branchLabel")&&o.drawBranchLabels(o.params.branchLabelKey)};this.confidencesInSVG=!1,this.svg.selectAll(X(e).join(", ")).transition().duration(n).style("opacity",0).remove().on("start",function(){return i++}).on("end",function(){if(!--i){var e=Y(".tip",t);J(o.svg,".tip",e,r),setTimeout(a,r)}}),this.removeTemporalSlice(),n||Object(H.d)()},re.prototype.render=function(e,t,n,r,o,i,a,s,l,c,u,p,h,d){var f=this;this.svg=e,this.params=Object.assign(this.params,r),this.callbacks=o,this.vaccines=l?l.map(function(e){return e.shell}):void 0,this.dateRange=d,this.setDistance(n),this.setLayout(t),this.mapToScreen(),this.nodes.forEach(function(e,t){e.branchStroke=c[t],e.tipStroke=u[t],e.fill=p[t],e.visibility=a[t],e["stroke-width"]=i[t],e.r=h?h[t]:f.params.tipRadius}),this.params.showGrid&&(this.addGrid(),this.addTemporalSlice()),this.drawBranches(),this.drawTips(),this.params.branchLabelKey&&this.drawBranchLabels(this.params.branchLabelKey),this.vaccines&&this.drawVaccines(),"clock"===this.layout&&"num_date"===this.distance&&this.drawRegression(),this.confidencesInSVG=!1,s&&this.drawConfidence(),this.updateTipLabels(),this.timeLastRenderRequested=Date.now()},re.prototype.clearSVG=function(){this.svg.selectAll("*").remove()},re.prototype.drawTips=function(){var e=this.params;"tips"in this.groups||(this.groups.tips=this.svg.append("g").attr("id","tips")),this.groups.tips.selectAll(".tip").data(this.nodes.filter(function(e){return e.terminal})).enter().append("circle").attr("class","tip").attr("id",function(e){return"tip_"+e.n.clade}).attr("cx",function(e){return e.xTip}).attr("cy",function(e){return e.yTip}).attr("r",function(e){return e.r}).on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick).style("pointer-events","auto").style("visibility",function(e){return e.visibility===b.NODE_VISIBLE?"visible":"hidden"}).style("fill",function(t){return t.fill||e.tipFill}).style("stroke",function(t){return t.tipStroke||e.tipStroke}).style("stroke-width",function(){return e.tipStrokeWidth}).style("cursor","pointer")},re.prototype.drawBranches=function(){var e=this.params;"branchTee"in this.groups||(this.groups.branchTee=this.svg.append("g").attr("id","branchTee")),"clock"===this.layout||"unrooted"===this.layout?this.groups.branchTee.selectAll("*").remove():this.groups.branchTee.selectAll(".branch").data(this.nodes.filter(function(e){return!e.terminal})).enter().append("path").attr("class","branch T").attr("id",function(e){return"branch_T_"+e.n.clade}).attr("d",function(e){return e.branch[1]}).style("stroke",function(t){return t.branchStroke||e.branchStroke}).style("stroke-width",function(t){return t["stroke-width"]||e.branchStrokeWidth}).style("fill","none").style("pointer-events","auto"),"branchStem"in this.groups||(this.groups.branchStem=this.svg.append("g").attr("id","branchStem")),this.groups.branchStem.selectAll(".branch").data(this.nodes).enter().append("path").attr("class","branch S").attr("id",function(e){return"branch_S_"+e.n.clade}).attr("d",function(e){return e.branch[0]}).style("stroke",function(t){return t.branchStroke||e.branchStroke}).style("stroke-linecap","round").style("stroke-width",function(e){return e["stroke-width"]+"px"||!1}).style("fill","none").style("visibility",U).style("cursor",function(e){return e.visibility===b.NODE_VISIBLE?"pointer":"default"}).style("pointer-events","auto").on("mouseover",this.callbacks.onBranchHover).on("mouseout",this.callbacks.onBranchLeave).on("click",this.callbacks.onBranchClick)},re.prototype.drawVaccines=function(){this.vaccines&&this.vaccines.length&&("vaccines"in this.groups||(this.groups.vaccines=this.svg.append("g").attr("id","vaccines")),this.groups.vaccines.selectAll(".vaccineCross").data(this.vaccines).enter().append("path").attr("class","vaccineCross").attr("d",function(e){return e.vaccineCross}).style("stroke","#333").style("stroke-width",2*this.params.branchStrokeWidth).style("fill","none").style("cursor","pointer").style("pointer-events","auto").on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick))},re.prototype.drawRegression=function(){var e=this.yScale(this.regression.intercept+this.xScale.domain()[0]*this.regression.slope),t=this.yScale(this.regression.intercept+this.xScale.domain()[1]*this.regression.slope),n="M "+this.xScale.range()[0].toString()+" "+e.toString()+" L "+this.xScale.range()[1].toString()+" "+t.toString();"clockRegression"in this.groups||(this.groups.clockRegression=this.svg.append("g").attr("id","clockRegression")),this.groups.clockRegression.append("path").attr("d",n).attr("class","regression").style("fill","none").style("visibility","visible").style("stroke",this.params.regressionStroke).style("stroke-width",this.params.regressionWidth),this.groups.clockRegression.append("text").text("rate estimate: ".concat(this.regression.slope.toExponential(2)," subs per site per year")).attr("class","regression").attr("x",this.xScale.range()[1]/2-75).attr("y",this.yScale.range()[0]+50).style("fill",this.params.regressionStroke).style("font-size",this.params.tickLabelSize+8).style("font-weight",400).style("font-family",this.params.fontFamily)},re.prototype.removeRegression=function(){"clockRegression"in this.groups&&this.groups.clockRegression.selectAll("*").remove()},re.prototype.setDistance=function(e){this.nodes.forEach(function(e){e.update=!0}),this.distance=void 0===e?"div":e;var t=this.distance;this.nodes.forEach(function(e){e.depth=e.n.attr[t],e.pDepth=e.n.parent.attr[t],e.n.attr[t+"_confidence"]?e.conf=e.n.attr[t+"_confidence"]:e.conf=[e.depth,e.depth]}),this.vaccines&&this.vaccines.forEach(function(e){e.crossDepth=e.depth})},re.prototype.setLayout=function(e){void 0!==e&&e===this.layout||this.nodes.forEach(function(e){e.update=!0}),this.layout=void 0===e?"rect":e,"rect"===this.layout?this.rectangularLayout():"clock"===this.layout?this.timeVsRootToTip():"radial"===this.layout?this.radialLayout():"unrooted"===this.layout&&this.unrootedLayout()},re.prototype.rectangularLayout=function(){this.nodes.forEach(function(e){e.y=e.n.yvalue,e.x=e.depth,e.px=e.pDepth,e.py=e.y}),this.vaccines&&this.vaccines.forEach(function(e){e.xCross=e.crossDepth,e.yCross=e.y})},re.prototype.timeVsRootToTip=function(){this.nodes.forEach(function(e){e.y=e.n.attr.div,e.x=e.n.attr.num_date,e.px=e.n.parent.attr.num_date,e.py=e.n.parent.attr.div}),this.vaccines&&this.vaccines.forEach(function(e){e.xCross=e.x,e.yCross=e.y});var e=this.numberOfTips,t=this.nodes[0].depth,n=Object(Z.i)(this.nodes.filter(function(e){return e.terminal}).map(function(e){return e.y*(e.depth-t)}))/e/(Object(Z.i)(this.nodes.filter(function(e){return e.terminal}).map(function(e){return(e.depth-t)*(e.depth-t)}))/e),r=-t*n;this.regression={slope:n,intercept:r}},re.prototype.unrootedLayout=function(){Object(G.a)(this.nodes[0]);var e=this.nodes[0].leafCount;this.nodes.forEach(function(e){e.branchLength=e.depth-e.pDepth}),this.nodes[0].x=0,this.nodes[0].y=0,this.nodes[0].px=0,this.nodes[0].py=0,this.nodes[0].w=2*Math.PI,this.nodes[0].tau=0;for(var t=1.5*Math.PI,n=0;n<this.nodes[0].children.length;n++)this.nodes[0].children[n].px=0,this.nodes[0].children[n].py=0,this.nodes[0].children[n].w=2*Math.PI*this.nodes[0].children[n].leafCount/e,this.nodes[0].children[n].tau=t,t+=this.nodes[0].children[n].w,Q(this.nodes[0].children[n],e);this.vaccines&&this.vaccines.forEach(function(e){var t=e.crossDepth-e.depth;e.xCross=e.px+t*Math.cos(e.tau+.5*e.w),e.yCross=e.py+t*Math.sin(e.tau+.5*e.w)})},re.prototype.radialLayout=function(){var e=this,t=this.numberOfTips,n=this.nodes[0].depth;this.nodes.forEach(function(e){var r=1.9*Math.PI*e.yRange[0]/t,o=1.9*Math.PI*e.yRange[1]/t;e.angle=1.9*Math.PI*e.n.yvalue/t,e.y=(e.depth-n)*Math.cos(e.angle),e.x=(e.depth-n)*Math.sin(e.angle),e.py=e.y*(e.pDepth-n)/(e.depth-n+1e-15),e.px=e.x*(e.pDepth-n)/(e.depth-n+1e-15),e.yCBarStart=(e.depth-n)*Math.cos(r),e.xCBarStart=(e.depth-n)*Math.sin(r),e.yCBarEnd=(e.depth-n)*Math.cos(o),e.xCBarEnd=(e.depth-n)*Math.sin(o),e.smallBigArc=Math.abs(o-r)>1*Math.PI}),this.vaccines&&this.vaccines.forEach(function(t){"div"===e.distance?(t.xCross=t.x,t.yCross=t.y):(t.xCross=(t.crossDepth-n)*Math.sin(t.angle),t.yCross=(t.crossDepth-n)*Math.cos(t.angle))})},re.prototype.setScales=function(e){var t=parseInt(this.svg.attr("width"),10),n=parseInt(this.svg.attr("height"),10);if("radial"===this.layout||"unrooted"===this.layout){var r=t-(e.left||0)-(e.right||0),o=n-(e.top||0)-(e.top||0),i=Object(Z.f)([r,o]),a=r-i,s=o-i;this.xScale.range([.5*a+e.left||0,t-.5*a-(e.right||0)]),this.yScale.range([.5*s+e.top||0,n-.5*s-(e.bottom||0)])}else this.params.orientation[0]>0?this.xScale.range([e.left||0,t-(e.right||0)]):this.xScale.range([t-(e.right||0),e.left||0]),this.params.orientation[1]>0?this.yScale.range([e.top||0,n-(e.bottom||0)]):this.yScale.range([n-(e.bottom||0),e.top||0])},re.prototype.mapToScreen=function(){var e=this,t={left:this.params.margins.left,right:this.params.margins.right,top:this.params.margins.top,bottom:this.params.margins.bottom},n=this.nodes.filter(function(e){return e.terminal}).filter(function(e){return e.inView});if(n.length<this.params.tipLabelBreakL1){var r=this.params.tipLabelFontSizeL1;n.length<this.params.tipLabelBreakL2&&(r=this.params.tipLabelFontSizeL2),n.length<this.params.tipLabelBreakL3&&(r=this.params.tipLabelFontSizeL3);var o=0;n.forEach(function(e){o<e.n.strain.length&&(o=.65*e.n.strain.length*r)}),t.right+=o}this.setScales(t);var i=1e6,a=0,s=1e6,l=0;if(this.nodes.filter(function(e){return e.inView}).forEach(function(e){e.x>l&&(l=e.x),e.y>a&&(a=e.y),e.x<s&&(s=e.x),e.y<i&&(i=e.y)}),s===l&&(s-=.005,l+=.005),n.length<30){var c=.05*(a-i);i-=c,a+=c}if("radial"===this.layout||"unrooted"===this.layout){var u=l-s,p=a-i,h=Object(Z.d)([p,u]),d=u>p?.5*(u-p):0,f=u<p?.5*(p-u):0;this.xScale.domain([s-f,s+h-f]),this.yScale.domain([i-d,i+h-d])}else"clock"===this.layout?(this.xScale.domain([s,l]),this.yScale.domain([a,i])):(this.xScale.domain([s,l]),this.yScale.domain([i,a]));if(this.nodes.forEach(function(t){t.xTip=e.xScale(t.x),t.yTip=e.yScale(t.y),t.xBase=e.xScale(t.px),t.yBase=e.yScale(t.py)}),this.vaccines&&this.vaccines.forEach(function(t){var n=e.xScale(t.xCross),r=e.yScale(t.yCross);t.vaccineCross=" M ".concat(n-6,",").concat(r-6," L ").concat(n+6,",").concat(r+6," M ").concat(n-6,",").concat(r+6," L ").concat(n+6,",").concat(r-6)}),"clock"===this.layout||"unrooted"===this.layout)this.nodes.forEach(function(e){e.branch=[" M "+e.xBase.toString()+","+e.yBase.toString()+" L "+e.xTip.toString()+","+e.yTip.toString(),""]});else if("rect"===this.layout)this.nodes.forEach(function(t){var n=.5*(t.parent["stroke-width"]-t["stroke-width"])||0,r=[e.yScale(t.yRange[0]),e.yScale(t.yRange[1])];t.branch=[" M ".concat(t.xBase-n,",").concat(t.yBase," L ").concat(t.xTip,",").concat(t.yTip," M ").concat(t.xTip,",").concat(r[0]," L ").concat(t.xTip,",").concat(r[1])],e.params.confidence&&(t.confLine=" M ".concat(e.xScale(t.conf[0]),",").concat(t.yBase," L ").concat(e.xScale(t.conf[1]),",").concat(t.yTip))});else if("radial"===this.layout){var m=this.nodes[0].depth,y=this.nodes.map(function(e){return.5*(e.parent["stroke-width"]-e["stroke-width"])||0});this.nodes.forEach(function(t){t.cBarStart=e.yScale(t.yRange[0])}),this.nodes.forEach(function(t){t.cBarEnd=e.yScale(t.yRange[1])}),this.nodes.forEach(function(t,n){t.branch=[" M "+(t.xBase-y[n]*Math.sin(t.angle)).toString()+" "+(t.yBase-y[n]*Math.cos(t.angle)).toString()+" L "+t.xTip.toString()+" "+t.yTip.toString(),""],t.terminal||(t.branch[1]=[" M "+e.xScale(t.xCBarStart).toString()+" "+e.yScale(t.yCBarStart).toString()+" A "+(e.xScale(t.depth)-e.xScale(m)).toString()+" "+(e.yScale(t.depth)-e.yScale(m)).toString()+" 0 "+(t.smallBigArc?"1 ":"0 ")+" 1 "+e.xScale(t.xCBarEnd).toString()+","+e.yScale(t.yCBarEnd).toString()])})}},re.prototype.removeConfidence=function(e){this.confidencesInSVG=!1,"confidenceIntervals"in this.groups&&(e?this.groups.confidenceIntervals.selectAll("*").transition().duration(e).style("opacity",0).remove():this.groups.confidenceIntervals.selectAll("*").remove())},re.prototype.drawConfidence=function(e){var t=this;this.confidencesInSVG=!0,"confidenceIntervals"in this.groups||(this.groups.confidenceIntervals=this.svg.append("g").attr("id","confidenceIntervals")),e?(this.groups.confidenceIntervals.selectAll(".conf").data(this.nodes).enter().call(function(e){return t.drawSingleCI(e,0)}),this.groups.confidenceIntervals.transition().duration(e).style("opacity",.5)):this.groups.confidenceIntervals.selectAll(".conf").data(this.nodes).enter().call(function(e){return t.drawSingleCI(e,.5)})},re.prototype.drawSingleCI=function(e,t){e.append("path").attr("class","conf").attr("id",function(e){return"conf_"+e.n.clade}).attr("d",function(e){return e.confLine}).style("stroke",function(e){return e.branchStroke||"#888"}).style("opacity",t).style("fill","none").style("stroke-width",q).style("pointer-events","none")},re.prototype.drawBranchLabels=function(e){var t=this;this.params.branchLabelKey=e;var n=ee(e),r=te(e),o=ne(e,this.layout,this.zoomNode.n.tipCount);"branchLabels"in this.groups||(this.groups.branchLabels=this.svg.append("g").attr("id","branchLabels")),this.groups.branchLabels.selectAll(".branchLabel").data(this.nodes.filter(function(t){return t.n.attr.labels&&t.n.attr.labels[e]})).enter().append("text").attr("class","branchLabel").attr("x",function(e){return e.xTip+(t.params.orientation[0]>0?-5:5)}).attr("y",function(e){return e.yTip-t.params.branchLabelPadY}).style("text-anchor",this.params.orientation[0]>0?"end":"start").style("visibility",o).style("fill",this.params.branchLabelFill).style("font-family",this.params.branchLabelFont).style("font-weight",r).style("font-size",n).text(function(t){return t.n.attr.labels[e]})},re.prototype.removeBranchLabels=function(){"branchLabels"in this.groups&&this.groups.branchLabels.selectAll("*").remove()},re.prototype.updateBranchLabels=function(e){var t=this,n=ne(this.params.branchLabelKey,this.layout,this.zoomNode.n.tipCount),r=ee(this.params.branchLabelKey),o=te(this.params.branchLabelKey);this.groups.branchLabels.selectAll(".branchLabel").transition().duration(e).attr("x",function(e){return e.xTip-5}).attr("y",function(e){return e.yTip-t.params.branchLabelPadY}).style("visibility",n).style("font-weight",o).style("font-size",r),e||Object(H.d)()},re.prototype.updateTipLabels=function(e){var t=this;"tipLabels"in this.groups?this.groups.tipLabels.selectAll("*").remove():this.groups.tipLabels=this.svg.append("g").attr("id","tipLabels");var n=this.callbacks.tipLabel,r=this.params.tipLabelPadX,o=this.params.tipLabelPadY,i=this.nodes.filter(function(e){return e.terminal}).filter(function(e){return e.inView});if(i.length<this.params.tipLabelBreakL1){var a=this.params.tipLabelFontSizeL1;i.length<this.params.tipLabelBreakL2&&(a=this.params.tipLabelFontSizeL2),i.length<this.params.tipLabelBreakL3&&(a=this.params.tipLabelFontSizeL3),window.setTimeout(function(){t.groups.tipLabels.selectAll(".tipLabel").data(i).enter().append("text").attr("x",function(e){return e.xTip+r}).attr("y",function(e){return e.yTip+o}).text(function(e){return n(e)}).attr("class","tipLabel").style("font-size",a.toString()+"px").style("visibility",function(e){return e.visibility===b.NODE_VISIBLE?"visible":"hidden"})},e)}},re.prototype.hideGrid=function(){"majorGrid"in this.groups&&this.groups.majorGrid.selectAll("*").style("visibility","hidden"),"minorGrid"in this.groups&&this.groups.minorGrid.selectAll("*").style("visibility","hidden"),"gridText"in this.groups&&this.groups.gridText.selectAll("*").style("visibility","hidden")},re.prototype.addGrid=function(){var e,t,n=this.layout;if(e=this.groups,t=this.svg,"temporalWindow"in e||(e.temporalWindow=t.append("g").attr("id","temporalWindow")),"majorGrid"in e||(e.majorGrid=t.append("g").attr("id","majorGrid")),"minorGrid"in e||(e.minorGrid=t.append("g").attr("id","minorGrid")),"gridText"in e||(e.gridText=t.append("g").attr("id","gridText")),"unrooted"!==n){for(var r=Object(Z.f)(this.yScale.domain()),o=Object(Z.d)(this.yScale.domain()),i="radial"===n?this.nodes[0].depth:this.xScale.domain()[0],a="radial"===n?i+Object(Z.d)([this.xScale.domain()[1],this.yScale.domain()[1],-this.xScale.domain()[0],-this.yScale.domain()[0]]):this.xScale.domain()[1],s=$(a-i),l=[],c=[],u=Math.floor(i/s)*s,p="radial"===n?i:u,h=a,d=0;d<=(a-u)/s+3;d++){var f=u+s*d;l.push([f,f<p||f>h?"hidden":"visible","x"])}var m="num_date"===this.distanceMeasure?this.params.minorTicksTimeTree:this.params.minorTicks;5!==s&&10!==s||(m=5);for(var y=s/m,b=0;b<=(a-u)/y+30;b++){var g=u+y*b;c.push([g,g<p||g>h+y?"hidden":"visible","x"])}var v=function(e,t,n){return function(r){var o="";if("x"===r[2]){if("rect"===n||"clock"===n){var s=e(r[0]);o="M"+s.toString()+" "+t.range(