misc_pterodactyl-panel/public/themes/default/js/vendor/metricsgraphics/metricsgraphics.min.js
2016-10-03 13:18:48 -04:00

5 lines
102 KiB
JavaScript
Executable file

// v2.10.1
!function(t,e){"function"==typeof define&&define.amd?define(["d3"],e):"object"==typeof exports?module.exports=e(require("d3")):t.MG=e(t.d3)}(this,function(t){function e(){return"undefined"!=typeof jQuery||"undefined"!=typeof $}function r(t){var e;switch(t.processed.x_time_frame){case"millis":e=MG.time_format(t.utc_time,"%b %e, %Y %H:%M:%S.%L");break;case"seconds":e=MG.time_format(t.utc_time,"%b %e, %Y %H:%M:%S");break;case"less-than-a-day":e=MG.time_format(t.utc_time,"%b %e, %Y %I:%M%p");break;case"four-days":e=MG.time_format(t.utc_time,"%b %e, %Y %I:%M%p");break;default:e=MG.time_format(t.utc_time,"%b %e, %Y")}return e}function a(t,e){return t[e.x_accessor]>=e.processed.min_x&&t[e.x_accessor]<=e.processed.max_x&&t[e.y_accessor]>=e.processed.min_y&&t[e.y_accessor]<=e.processed.max_y}function n(t){return"[object Array]"===Object.prototype.toString.call(t)}function o(t){return"[object Function]"===Object.prototype.toString.call(t)}function i(t){return n(t)&&0===t.length}function s(t){return"[object Object]"===Object.prototype.toString.call(t)}function c(e){var r=e.map(function(t){return n(t)===!0&&t.length>0});return t.sum(r)===e.length}function l(e){var r=e.map(function(t){return s(t)===!0});return t.sum(r)===e.length}function u(t){return i(t)||l(t)}function f(t,e){return t.map(function(t){return t[e]})}function d(t){return t.reduce(function(t,e){return t[e]=t[e]+1||1,t},{})}function p(t){return t.height-t.bottom}function _(t){return p(t)-t.buffer}function m(t){return t.top}function g(t){return m(t)+t.buffer}function h(t){return t.left}function x(t){return h(t)+t.buffer}function y(t){return t.width-t.right}function v(t){return y(t)-t.buffer}function b(t){t.exit().remove()}function w(t,e){t.selectAll(e).remove()}function k(t,e){return t.append("g").classed(e,!0)}function M(t,e){var r=R(t.target),a=Y(t.data),n=r.selectAll("line."+e).data(a);return n.enter().append("line").attr("class",e).attr("opacity",.3),b(n),b(n),n}function G(t,e,r){e.color_accessor?(t.attr("stroke",e.scalefns.colorf),t.classed(r,!1)):(t.attr("stroke",null),t.classed(r,!0))}function A(e,r){r&&e.attr({dy:0,transform:function(){var e=t.select(this);return"rotate("+r+" "+e.attr("x")+","+e.attr("y")+")"}})}function D(t){if(t=t.node(),!t)return!1;for(var e=0;e<t.length;e++)if(C(t[e],t))return!0;return!1}function O(e,r){if(e&&1!=e.length)for(var a=0;a<e.length;a++)if(C(e[a],e)){var n=t.select(e[a]),o=+n.attr("y");o+8>=r.top&&(o=r.top-16),n.attr("y",o)}}function F(e,r){if(e&&1!=e.length){e.sort(function(e,r){return t.select(r).attr("y")-t.select(e).attr("y")}),e.reverse();for(var a,n,o,i=0;i<e.length;i++){n=t.select(e[i]).text();for(var s=0;s<e.length;s++)if(o=t.select(e[s]).text(),a=z(e[i],e[s]),a!==!1&&n!==o){var c=t.select(e[i]),l=+c.attr("y");l+=a,c.attr("y",l)}}}}function z(t,e){var r=t.getBoundingClientRect(),a=e.getBoundingClientRect();return r.top<=a.bottom&&r.top>=a.top&&a.bottom-r.top}function C(t,e){for(var r=t.getBoundingClientRect(),a=0;a<e.length;a++)if(e[a]!=t){var n=e[a].getBoundingClientRect();if(r.top===n.top&&!(n.left>r.right||n.right<r.left))return!0}return!1}function T(t,e){var r=Y(t.data);return r=r[0][t[e+"_accessor"]],"string"==typeof r?"categorical":"numerical"}function R(e){return t.select(e).select("svg")}function Y(t){var e=[];return e.concat.apply(e,t)}function E(){return"undefined"==typeof MG._next_elem_id&&(MG._next_elem_id=0),"mg-"+MG._next_elem_id++}function P(t){return"string"==typeof t?L(t):t instanceof HTMLElement?(target_ref=t.getAttribute("data-mg-uid"),target_ref||(target_ref=E(),t.setAttribute("data-mg-uid",target_ref)),target_ref):(console.warn("The specified target should be a string or an HTMLElement.",t),L(t))}function L(t){return t.replace(/[^a-zA-Z0-9 _-]+/g,"").replace(/ +?/g,"")}function X(e,r){return Number(t.select(e).style(r).replace(/px/g,""))}function S(t){return X(t,"width")}function j(t){return X(t,"height")}function U(t){return Cr(Array.prototype.slice.call(arguments,1),function(e){if(e)for(var r in e)void 0===t[r]&&(t[r]=e[r])}),t}function B(t,e){var r,a=[],n=[];for(r=0;r<e.length;r++)a[e[r]]=!0;for(r=0;r<t.length;r++)a[t[r]]||n.push(t[r]);return n}function N(t,e){console.warn("Deprecation: "+t+(e?". This feature will be removed in "+e+".":" the near future.")),console.trace()}function I(t,e,r){var a,n=0;for(t.textContent=e,a=t.getBBox();a.width>r&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function H(e,r,a,n){e.each(function(){for(var e,o=t.select(this),i=o.text().split(a||/\s+/).reverse(),s=[],c=0,l=1.1,u=(o.attr("y"),0),f=o.text(null).append("tspan").attr("x",0).attr("y",u+"em").attr(n||{});e=i.pop();)s.push(e),f.text(s.join(" ")),(null===r||f.node().getComputedTextLength()>r)&&(s.pop(),f.text(s.join(" ")),s=[e],f=o.append("tspan").attr("x",0).attr("y",++c*l+u+"em").attr(n||{}).text(e))})}function q(t,e,r){MG.charts[t]={descriptor:e,defaults:r||{}}}function V(r){"use strict";var a=R(r.target);if(a.select(".mg-header").remove(),r.target&&r.title){var n=a.insert("text").attr("class","mg-header").attr("x",r.center_title_full_width?r.width/2:(r.width+r.left-r.right)/2).attr("y",r.title_y_position).attr("text-anchor","middle").attr("dy","0.55em");if(n.append("tspan").attr("class","mg-chart-title").text(r.title),r.show_tooltips&&r.description&&e()){n.append("tspan").attr("class","mg-chart-description").attr("dx","0.3em").text("");var o=$(n.node());o.popover({html:!0,animation:!1,placement:"top",content:r.description,container:r.target,trigger:"manual",template:'<div class="popover mg-popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'}).on("mouseenter",function(){t.selectAll(r.target).selectAll(".mg-popover").remove(),$(this).popover("show"),$(t.select(r.target).select(".popover").node()).on("mouseleave",function(){o.popover("hide")})}).on("mouseleave",function(){setTimeout(function(){$(".popover:hover").length||o.popover("hide")},120)})}else r.show_tooltips&&r.description&&"undefined"==typeof $&&(r.error="In order to enable tooltips, please make sure you include jQuery.")}r.error&&Fr(r)}function W(t,e,r,a,n){t.scalefns[e]=function(e){return void 0===n?t.scales[r](e[a]):t.scales[r](e[a])+n}}function Z(t,e){return"bottom"===t||"top"===t?[x(e),v(e)]:"left"===t||"right"===t?[_(e),e.top]:void 0}function Q(e){var r={};return r.use_inflator=!1,r.zero_bottom=!1,r.scaleType="numerical",this.namespace=function(t){return r.namespace=t,r.namespace_accessor_name=r.namespace+"_accessor",r.scale_name=r.namespace.toUpperCase(),r.scalefn_name=r.namespace+"f",this},this.scaleName=function(t){return r.scale_name=t.toUpperCase(),r.scalefn_name=t+"f",this},this.inflateDomain=function(t){return r.use_inflator=t,this},this.zeroBottom=function(t){return r.zero_bottom=t,this},this.numericalDomainFromData=function(){var a=[];arguments.length>0&&(a=arguments);for(var n,o=0;o<e.data.length;o++)e.data[o].length>0&&(n=e.data[o]);r.is_time_series=n[0][e[r.namespace_accessor_name]]instanceof Date,W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),K(e,r,a,r.use_inflator);var i=e.utc_time?t.scaleUtc():t.scaleTime();return e.scales[r.scale_name]=r.is_time_series?i:"log"===e[r.namespace+"_scale_type"]?t.scaleLog():t.scaleLinear(),e.scales[r.scale_name].domain([e.processed["min_"+r.namespace],e.processed["max_"+r.namespace]]),r.scaleType="numerical",this},this.categoricalDomain=function(a){return e.scales[r.scale_name]=t.scaleOrdinal().domain(a),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),this},this.categoricalDomainFromData=function(){var a=Y(e.data);return r.categoricalVariables=t.set(a.map(function(t){return t[e[r.namespace_accessor_name]]})).values(),e.scales[r.scale_name]=t.scaleBand().domain(r.categoricalVariables),r.scaleType="categorical",this},this.numericalRange=function(t){return"string"==typeof t?e.scales[r.scale_name].range(Z(t,e)):e.scales[r.scale_name].range(t),this},this.categoricalRangeBands=function(t,a){void 0===a&&(a=!1);var n=r.namespace,o=e[n+"_padding_percentage"],i=e[n+"_outer_padding_percentage"];return"string"==typeof t?e.scales[r.scale_name].range(Z(t,e)).paddingInner(o).paddingOuter(i):e.scales[r.scale_name].range(t).paddingInner(o).paddingOuter(i),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name],a?e.scales[r.scale_name].bandwidth()/2:0),this},this.categoricalRange=function(t){return e.scales[r.scale_name].range(t),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),this},this.categoricalColorRange=function(){return e.scales[r.scale_name]=e.scales[r.scale_name].domain().length>10?t.scaleOrdinal(t.schemeCategory20):t.scaleOrdinal(t.schemeCategory10),e.scales[r.scale_name].domain(r.categoricalVariables),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),this},this.clamp=function(t){return e.scales[r.scale_name].clamp(t),this},this}function K(e,r,a){var n=r.namespace,o=r.namespace_accessor_name,i=r.use_inflator,s=r.zero_bottom,c=e[o],l=Y(e.data).map(function(t){return t[c]}).concat(Y(a));"log"===e[n+"_scale_type"]&&(l=l.filter(function(t){return t>0}));var u=t.extent(l),f=u[0],d=u[1];s&&!e["min_"+n+"_from_data"]&&f>0&&!r.is_time_series&&(f="log"===e[n+"_scale_type"]?1:0),"log"!==e[n+"_scale_type"]&&f<0&&!r.is_time_series&&(f-=(f-f*e.inflator)*i),r.is_time_series||(d=d<0?d+(d-d*e.inflator)*i:d*(i?e.inflator:1)),f=e["min_"+n]||f,d=e["max_"+n]||d,f!==d||e["min_"+n]&&e["max_"+n]||(f instanceof Date?(d=new Date(MG.clone(f).setDate(f.getDate()+1)),f=new Date(MG.clone(f).setDate(f.getDate()-1))):"number"==typeof f&&(f-=1,d=f+1,ue(e))),e.processed["min_"+n]=f,e.processed["max_"+n]=d,MG.call_hook("x_axis.process_min_max",e,e.processed.min_x,e.processed.max_x),MG.call_hook("y_axis.process_min_max",e,e.processed.min_y,e.processed.max_y)}function J(e,r){return t.set(e.map(function(t){return t[r]})).values()}function tt(e){var r;return null===e.color_domain?"number"===e.color_type?r=t.extent(e.data[0],function(t){return t[e.color_accessor]}):"category"===e.color_type&&(r=J(e.data[0],e.color_accessor)):r=e.color_domain,r}function et(t){var e;return e=null===t.color_range?"number"===t.color_type?["blue","red"]:null:t.color_range}function rt(t,e){function r(t){return 1e3===t?3:1e6===t?7:Math.log(t)/Math.LN10}var a=t[e+"_accessor"],n=t.scales[e.toUpperCase()].ticks(t[e+"ax_count"]),o=t.processed["max_"+e];"log"===t[e+"_scale_type"]&&(n=n.filter(function(t){return Math.abs(r(t))%1<1e-6||Math.abs(r(t))%1>1-1e-6}));var i=n.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[a]%1!==0)return s=!1,!1})}),s&&i>o&&"count"===t.format&&(n=n.filter(function(t){return t%1===0})),t.processed[e+"_ticks"]=n}function at(t,e){var r=e.position,a=e.namespace,n={};return"left"===r&&(n.x1=h(t)+1,n.x2=h(t)+t.rug_buffer_size,n.y1=t.scalefns[a+"f"],n.y2=t.scalefns[a+"f"]),"right"===r&&(n.x1=y(t)-1,n.x2=y(t)-t.rug_buffer_size,n.y1=t.scalefns[a+"f"],n.y2=t.scalefns[a+"f"]),"top"===r&&(n.x1=t.scalefns[a+"f"],n.x2=t.scalefns[a+"f"],n.y1=m(t)+1,n.y2=m(t)+t.rug_buffer_size),"bottom"===r&&(n.x1=t.scalefns[a+"f"],n.x2=t.scalefns[a+"f"],n.y1=p(t)-1,n.y2=p(t)-t.rug_buffer_size),n}function nt(t,e){var r=e.namespace,a=e.position,n=t.processed[r+"_ticks"].length,o=t.processed[r+"_ticks"],i=t.scales[r.toUpperCase()],s={};return"left"===a&&(s.x1=h(t),s.x2=h(t),s.y1=i(o[0]).toFixed(2),s.y2=i(o[n-1]).toFixed(2)),"right"===a&&(s.x1=y(t),s.x2=y(t),s.y1=i(o[0]).toFixed(2),s.y2=i(o[n-1]).toFixed(2)),"top"===a&&(s.x1=h(t),s.x2=y(t),s.y1=m(t),s.y2=m(t)),"bottom"===a&&(s.x1=h(t),s.x2=y(t),s.y1=p(t),s.y2=p(t)),"left"!==a&&"right"!==a||(t.axes_not_compact?(s.y1=p(t),s.y2=m(t)):n&&(s.y1=i(o[0]).toFixed(2),s.y2=i(o[n-1]).toFixed(2))),s}function ot(t,e){var r=e.position,a=e.namespace,n=t[a+"ax_tick_length"],o=t.scales[a.toUpperCase()],i={};return"left"===r&&(i.x=h(t)-3*n/2,i.y=function(t){return o(t).toFixed(2)},i.dx=-3,i.dy=".35em",i.textAnchor="end",i.text=function(e){return wt(t)(e)}),"right"===r&&(i.x=y(t)+3*n/2,i.y=function(t){return o(t).toFixed(2)},i.dx=3,i.dy=".35em",i.textAnchor="start",i.text=function(e){return wt(t)(e)}),"top"===r&&(i.x=function(t){return o(t).toFixed(2)},i.y=(m(t)-7*n/3).toFixed(2),i.dx=0,i.dy="0em",i.textAnchor="middle",i.text=function(e){return Jt(t)(e)}),"bottom"===r&&(i.x=function(t){return o(t).toFixed(2)},i.y=(p(t)+7*n/3).toFixed(2),i.dx=0,i.dy=".50em",i.textAnchor="middle",i.text=function(e){return Jt(t)(e)}),i}function it(t){var e=t.chart_type;t.processed.xax_format||(t.xax_format?t.processed.xax_format=t.xax_format:"line"===e||"point"===e||"histogram"===e?t.processed.xax_format=Jt(t):"bar"===e&&(t.processed.xax_format=Ut(t)))}function st(t,e,r){if(e.time_series&&(e.show_years||e.show_secondary_x_label)){var a=ie(e);ct(e,r,t,a.timeframe,a.yformat,a.secondary)}}function ct(t,e,r,a,n,o){var i=o(t.processed.min_x,t.processed.max_x);if(0===i.length){var s=t.scales.X.ticks(t.xax_count)[0];i=[s]}var c=k(r,"mg-year-marker");"default"===a&&t.show_year_markers&&lt(t,e,c,i,n),"years"!=a&&ut(t,e,c,i,n)}function lt(t,e,r,a,n){r.selectAll(".mg-year-marker").data(a).enter().append("line").attr("x1",function(e){return t.scales.X(e).toFixed(2)}).attr("x2",function(e){return t.scales.X(e).toFixed(2)}).attr("y1",m(t)).attr("y2",p(t))}function ut(e,r,a,n,o){var i,s,c,l,u,f=r.position,d=r.namespace,_=e.scales[d.toUpperCase()],g=t.select(e.target).select(".mg-x-axis text").node().getBoundingClientRect();"top"===f&&(i=function(t,e){return _(t).toFixed(2)},s=m(e)-7*e.xax_tick_length/3-g.height,c=".50em",l="middle",u=function(t){return o(new Date(t))}),"bottom"===f&&(i=function(t,e){return _(t).toFixed(2)},s=p(e)+7*e.xax_tick_length/3+.8*g.height,c=".50em",l="middle",u=function(t){return o(new Date(t))}),a.selectAll(".mg-year-marker").data(n).enter().append("text").attr("x",i).attr("y",s).attr("dy",c).attr("text-anchor",l).text(u)}function ft(e,r,a){var n=a.namespace,o=ot(r,a),i=r.processed[n+"_ticks"],s=e.selectAll(".mg-yax-labels").data(i).enter().append("text").attr("x",o.x).attr("dx",o.dx).attr("y",o.y).attr("dy",o.dy).attr("text-anchor",o.textAnchor).text(o.text);if("x"==n&&(it(r),r.time_series&&r.european_clock?(s.append("tspan").classed("mg-european-hours",!0).text(function(e,r){var a=new Date(e);return 0===r?t.timeFormat("%H")(a):""}),s.append("tspan").classed("mg-european-minutes-seconds",!0).text(function(t,e){var a=new Date(t);return":"+r.processed.xax_format(a)})):s.text(function(t){return r.xax_units+r.processed.xax_format(t)}),st(e,r,a)),D(s)){s.filter(function(t,e){return(e+1)%2===0}).remove();var c=R(r.target);c.selectAll(".mg-"+n+"ax-ticks").filter(function(t,e){return(e+1)%2===0}).remove()}}function dt(t,e,r){var a,n,o,i,s=r.namespace,c=r.position,l=e.scales[s.toUpperCase()],u=e.processed[s+"_ticks"],f="mg-"+s+"ax-ticks",d="mg-extended-"+s+"ax-ticks",_=e[s+"_extended_ticks"],g=e[s+"ax_tick_length"];"left"===c&&(a=h(e),n=_?y(e):h(e)-g,o=function(t){return l(t).toFixed(2)},i=function(t){return l(t).toFixed(2)}),"right"===c&&(a=y(e),n=_?h(e):y(e)+g,o=function(t){return l(t).toFixed(2)},i=function(t){return l(t).toFixed(2)}),"top"===c&&(a=function(t){return l(t).toFixed(2)},n=function(t){return l(t).toFixed(2)},o=m(e),i=_?p(e):m(e)-g),"bottom"===c&&(a=function(t){return l(t).toFixed(2)},n=function(t){return l(t).toFixed(2)},o=p(e),i=_?m(e):p(e)+g),t.selectAll("."+f).data(u).enter().append("line").classed(d,_).attr("x1",a).attr("x2",n).attr("y1",o).attr("y2",i)}function pt(t,e,r){var a=r.namespace,n=e.processed[a+"_ticks"].length,o=nt(e,r);e[a+"_extended_ticks"]||e[a+"_extended_ticks"]||!n||t.append("line").attr("x1",o.x1).attr("x2",o.x2).attr("y1",o.y1).attr("y2",o.y2)}function _t(t,e){var r=R(t.target),a=Y(t.data),n=r.selectAll("line."+e).data(a);return n.enter().append("svg:line").attr("class",e).attr("opacity",.3),b(n),b(n),n}function mt(t,e){"use strict";t.rug_buffer_size="point"===t.chart_type?t.buffer/2:2*t.buffer/3;var r=_t(t,"mg-"+e.namespace+"-rug"),a=at(t,e);r.attr("x1",a.x1).attr("x2",a.x2).attr("y1",a.y1).attr("y2",a.y2),G(r,t,"mg-"+e.namespace+"-rug-mono")}function gt(t,e,r){var a=e.namespace,n=e.position,o=t.scales[a.toUpperCase()],i=t.scales[(a+"group").toUpperCase()],s={};return s.cat={},s.group={},"left"===n&&(s.cat.x=x(t)-t.buffer,s.cat.y=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.dy=".35em",s.cat.textAnchor="end",s.group.x=x(t)-t.buffer,s.group.y=i(r)+(i.bandwidth?i.bandwidth()/2:0),s.group.dy=".35em",s.group.textAnchor=(t["rotate_"+a+"_labels"],"end")),"right"===n&&(s.cat.x=v(t)-t.buffer,s.cat.y=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.dy=".35em",s.cat.textAnchor="start",s.group.x=v(t)-t.buffer,s.group.y=i(r)+(i.bandwidth?i.bandwidth()/2:0),s.group.dy=".35em",s.group.textAnchor="start"),"top"===n&&(s.cat.x=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.y=g(t)+t.buffer,s.cat.dy=".35em",s.cat.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle",s.group.x=i(r)+(i.bandwidth?i.bandwidth()/2:0),s.group.y=g(t)+t.buffer,s.group.dy=".35em",s.group.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle"),"bottom"===n&&(s.cat.x=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.y=_(t)+t.buffer,s.cat.dy=".35em",s.cat.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle",s.group.x=i(r)+(i.bandwidth?i.bandwidth()/2-o.bandwidth()/2:0),s.group.y=_(t)+t.buffer,s.group.dy=".35em",s.group.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle"),s}function ht(t,e){var r=e.namespace,a="mg-"+r+"-axis",n=t.scales[r.toUpperCase()],o=t.scales[(r+"group").toUpperCase()],i=r+"group_accessor",s=R(t.target);w(s,"."+a);var c,l=k(s,a),u=o.domain&&o.domain()?o.domain():["1"];u.forEach(function(a){var o=gt(t,e,a);if(c=k(l,"mg-group-"+L(a)),null!==t[i])var s=c.append("text").classed("mg-barplot-group-label",!0).attr("x",o.group.x).attr("y",o.group.y).attr("dy",o.group.dy).attr("text-anchor",o.group.textAnchor).text(a);else var s=c.selectAll("text").data(n.domain()).enter().append("text").attr("x",o.cat.x).attr("y",o.cat.y).attr("dy",o.cat.dy).attr("text-anchor",o.cat.textAnchor).text(String);t["rotate_"+r+"_labels"]&&yt(s,t["rotate_"+r+"_labels"])})}function xt(t,e){var r,a,n,o,i=e.namespace,s=(t.scalefns[i+"f"],t.scalefns[i+"groupf"],t.scales[(i+"group").toUpperCase()]),c=t.scales[i.toUpperCase()],l=e.position,u=R(t.target),f=s.domain&&s.domain()?s.domain():[null];w(u,".mg-category-guides");var d=k(u,"mg-category-guides");f.forEach(function(e){c.domain().forEach(function(i){"left"!==l&&"right"!==l||(r=x(t),a=v(t),n=c(i)+s(e)+c.bandwidth()/2,o=c(i)+s(e)+c.bandwidth()/2),"top"!==l&&"bottom"!==l||(r=c(i)+s(e)+c.bandwidth()/2*(null===e),a=c(i)+s(e)+c.bandwidth()/2*(null===e),n=_(t),o=g(t)),d.append("line").attr("x1",r).attr("x2",a).attr("y1",n).attr("y2",o).attr("stroke-dasharray","2,1")});var i=s(e)+c(c.domain()[0])+c.bandwidth()/2*(null===e||"top"!==l&&"bottom"!=l),u=s(e)+c(c.domain()[c.domain().length-1])+c.bandwidth()/2*(null===e||"top"!==l&&"bottom"!=l);"left"!==l&&"right"!==l||(x11=x(t),x21=x(t),y11=i,y21=u,x12=v(t),x22=v(t),y12=i,y22=u),"bottom"!==l&&"top"!==l||(x11=i,x21=u,y11=_(t),y21=_(t),x12=i,x22=u,y12=g(t),y22=g(t)),d.append("line").attr("x1",x11).attr("x2",x21).attr("y1",y11).attr("y2",y21).attr("stroke-dasharray","2,1"),d.append("line").attr("x1",x12).attr("x2",x22).attr("y1",y12).attr("y2",y22).attr("stroke-dasharray","2,1")})}function yt(e,r){r&&e.attr("transform",function(){var e=t.select(this);return"rotate("+r+" "+e.attr("x")+","+e.attr("y")+")"})}function vt(t){var e={};return e.type="numerical",this.namespace=function(t){return e.namespace=t,this},this.rug=function(t){return e.rug=t,this},this.label=function(t){return e.label=t,this},this.type=function(t){return e.type=t,this},this.position=function(t){return e.position=t,this},this.zeroLine=function(t){return e.zeroLine=t,this},this.draw=function(){return Tr[e.type](t,e),this},this}function bt(t){"use strict";if(t.y_rug){t.rug_buffer_size="point"===t.chart_type?t.buffer/2:2*t.buffer/3;var e=M(t,"mg-y-rug");e.attr("x1",t.left+1).attr("x2",t.left+t.rug_buffer_size).attr("y1",t.scalefns.yf).attr("y2",t.scalefns.yf),G(e,t,"mg-y-rug-mono")}}function wt(e){var r=e.yax_format;return r||("count"===e.format?(e.processed.max_y<1e-4?e.decimals=6:e.processed.max_y<.1&&(e.decimals=4),r=function(r){var a;return a=r<1&&r>-1&&0!==r?t.format(",."+e.decimals+"f"):r<1e3?t.format(",.0f"):t.format(",.0s"),e.yax_units_append?a(r)+e.yax_units:e.yax_units+a(r)}):r=function(e){var r=t.format(".0%");return r(e)}),r}function kt(t){var e=R(t.target),r=t.scales.X.domain();if(0>=r[0]&&r[1]>=0){var a=t.scales.Y.range(),n=t.categorical_groups.length?t.scales.YGROUP(t.categorical_groups[t.categorical_groups.length-1]):t.scales.YGROUP();e.append("svg:line").attr("x1",t.scales.X(0)).attr("x2",t.scales.X(0)).attr("y1",a[0]+g(t)).attr("y2",a[a.length-1]+n).attr("stroke","black").attr("opacity",.2)}}function Mt(t,e){e.y_label&&t.append("text").attr("class","label").attr("x",function(){return-1*(g(e)+(_(e)-g(e))/2)}).attr("y",function(){return e.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(t){return e.y_label}).attr("transform",function(t){return"rotate(-90)"})}function Gt(t,e){var r=e.processed.y_ticks.length;if(!e.x_extended_ticks&&!e.y_extended_ticks&&r){var a,n;e.axes_not_compact&&"bar"!==e.chart_type?(a=e.height-e.bottom,n=e.top):r?(a=e.scales.Y(e.processed.y_ticks[0]).toFixed(2),n=e.scales.Y(e.processed.y_ticks[r-1]).toFixed(2)):(a=0,n=0),t.append("line").attr("x1",e.left).attr("x2",e.left).attr("y1",a).attr("y2",n)}}function At(t,e){t.selectAll(".mg-yax-ticks").data(e.processed.y_ticks).enter().append("line").classed("mg-extended-yax-ticks",e.y_extended_ticks).attr("x1",e.left).attr("x2",function(){return e.y_extended_ticks?e.width-e.right:e.left-e.yax_tick_length}).attr("y1",function(t){return e.scales.Y(t).toFixed(2)}).attr("y2",function(t){return e.scales.Y(t).toFixed(2)})}function Dt(t,e){var r=wt(e);t.selectAll(".mg-yax-labels").data(e.processed.y_ticks).enter().append("text").attr("x",e.left-3*e.yax_tick_length/2).attr("dx",-3).attr("y",function(t){return e.scales.Y(t).toFixed(2)}).attr("dy",".35em").attr("text-anchor","end").text(function(t){var e=r(t);return e})}function Ot(t){t.processed||(t.processed={});var e=R(t.target);if(MG.call_hook("y_axis.process_min_max",t,t.processed.min_y,t.processed.max_y),w(e,".mg-y-axis"),!t.y_axis)return this;var r=k(e,"mg-y-axis");return Mt(r,t),rr(t,"y"),Gt(r,t),At(r,t),Dt(r,t),t.y_rug&&bt(t),this}function Ft(t){var e=R(t.target);w(e,".mg-y-axis");var r,a=k(e,"mg-y-axis");(t.categorical_groups.length?t.categorical_groups:["1"]).forEach(function(e){if(r=k(a,"mg-group-"+L(e)),null!==t.ygroup_accessor)Ct(r,e,t);else{var n=zt(r,e,t);A(n,t.rotate_y_labels)}})}function zt(t,e,r){return t.selectAll("text").data(r.scales.Y.domain()).enter().append("svg:text").attr("x",r.left-r.buffer).attr("y",function(t){return r.scales.YGROUP(e)+r.scales.Y(t)+r.scales.Y.bandwidth()/2}).attr("dy",".35em").attr("text-anchor","end").text(String)}function Ct(t,e,r){t.append("svg:text").classed("mg-barplot-group-label",!0).attr("x",r.left-r.buffer).attr("y",r.scales.YGROUP(e)+r.scales.YGROUP.bandwidth()/2).attr("dy",".35em").attr("text-anchor","end").text(e)}function Tt(t){var e=R(t.target),r=t.scales.YGROUP.domain();r[0],r[r.length-1];e.select(".mg-category-guides").selectAll("mg-group-lines").data(r).enter().append("line").attr("x1",x(t)).attr("x2",x(t)).attr("y1",function(e){return t.scales.YGROUP(e)}).attr("y2",function(e){return t.scales.YGROUP(e)+t.ygroup_height}).attr("stroke-width",1)}function Rt(t){var e=R(t.target),r=[];t.data[0].forEach(function(a){r.indexOf(a[t.y_accessor])===-1&&e.select(".mg-category-guides").append("line").attr("x1",x(t)).attr("x2",v(t)).attr("y1",t.scalefns.yf(a)+t.scalefns.ygroupf(a)).attr("y2",t.scalefns.yf(a)+t.scalefns.ygroupf(a)).attr("stroke-dasharray","2,1")})}function Yt(t){return t.y_axis?(Ft(t),t.show_bar_zero&&kt(t),t.ygroup_accessor&&Tt(t),t.y_categorical_show_guides&&Rt(t),this):this}function $t(t){"use strict";if(t.x_rug){t.rug_buffer_size="point"===t.chart_type?t.buffer/2:t.buffer;var e=M(t,"mg-x-rug");e.attr("x1",t.scalefns.xf).attr("x2",t.scalefns.xf).attr("y1",t.height-t.bottom-t.rug_buffer_size).attr("y2",t.height-t.bottom),G(e,t,"mg-x-rug-mono")}}function Et(t){t.processed||(t.processed={})}function Pt(t){"use strict";var e=R(t.target);if(Et(t),fe(t),w(e,".mg-x-axis"),!t.x_axis)return this;var r=k(e,"mg-x-axis");return te(r,t),ae(r,t),t.x_label&&jt(r,t),t.x_rug&&$t(t),this}function Lt(t){var e=R(t.target),r=0;"bar"===t.chart_type&&(r=t.buffer+5),mg_add_categorical_scale(t,"X",t.categorical_variables.reverse(),t.left,v(t)-r),W(t,"xf","X","value"),w(e,".mg-x-axis");var a=k(e,"mg-x-axis");return t.x_axis?(Xt(a,t,r),this):this}function Xt(t,e,r){var a=t.selectAll("text").data(e.categorical_variables).enter().append("text");a.attr("x",function(t){return e.scales.X(t)+e.scales.X.bandwidth()/2+e.buffer*e.bar_outer_padding_percentage+r/2}).attr("y",_(e)).attr("dy",".35em").attr("text-anchor","middle").text(String),e.truncate_x_labels&&a.each(function(t,r){var a=this,n=e.scales.X.bandwidth();I(a,t,n)}),A(a,e.rotate_x_labels)}function tt(e){var r;return null===e.color_domain?"number"===e.color_type?r=t.extent(e.data[0],function(t){return t[e.color_accessor]}):"category"===e.color_type&&(r=t.set(e.data[0].map(function(t){return t[e.color_accessor]})).values(),r.sort()):r=e.color_domain,r}function et(t){var e;return e=null===t.color_range?"number"===t.color_type?["blue","red"]:null:t.color_range}function St(t){var e;return e=null===t.size_range?[1,5]:t.size_range}function jt(e,r){r.x_label&&e.append("text").attr("class","label").attr("x",function(){return x(r)+(v(r)-x(r))/2}).attr("dx",null!=r.x_label_nudge_x?r.x_label_nudge_x:0).attr("y",function(){var e=t.select(r.target).select(".mg-x-axis text").node().getBoundingClientRect();return p(r)+r.xax_tick_length*(7/3)+.8*e.height+10}).attr("dy",".5em").attr("text-anchor","middle").text(function(t){return r.x_label})}function Ut(e){return function(r){if(r<1&&r>-1&&0!==r)return e.xax_units+r.toFixed(e.decimals);var a=t.format(",.0f");return e.xax_units+a(r)}}function Bt(t){var e;return e=Nt(t)?"millis":It(t)?"seconds":Ht(t)?"less-than-a-day":qt(t)?"four-days":Vt(t)?"many-days":Wt(t)?"many-months":Zt(t)?"years":"default"}function Nt(t){return t<10}function It(t){return t<60}function Ht(t){return t/3600<=24}function qt(t){return t/3600<=96}function Vt(t){return t/86400<=93}function Wt(t){return t/86400<730}function Zt(t){return t/86400>=730}function Qt(t,e){var r;return r=Nt(e)?MG.time_format(t,"%M:%S.%L"):It(e)?MG.time_format(t,"%M:%S"):Ht(e)?MG.time_format(t,"%H:%M"):qt(e)?MG.time_format(t,"%H:%M"):Vt(e)?MG.time_format(t,"%b %d"):Wt(e)?MG.time_format(t,"%b"):MG.time_format(t,"%Y")}function Kt(t){var e,r,a;t.time_series&&(e=(t.processed.max_x-t.processed.min_x)/1e3,a=Bt(e),r=Qt(t.utc_time,e)),t.processed.main_x_time_format=r,t.processed.x_time_frame=a}function Jt(e){if(e.xax_format)return e.xax_format;var r=e.processed.original_data||e.data,a=Y(r)[0],n=a[e.processed.original_x_accessor||e.x_accessor];return void 0===n&&(n=a),function(r){if(Kt(e),n instanceof Date)return e.processed.main_x_time_format(new Date(r));if("number"==typeof n){var a,o=r%1!==0;return a=o?t.format(",."+e.decimals+"f"):r<1e3?t.format(",.0f"):t.format(",.0s"),e.xax_units+a(r)}return e.xax_units+r}}function te(t,e){rr(e,"x"),ee(e,t),re(e,t)}function ee(t,e){var r=(t.processed.x_ticks.length,t.scales.X.ticks(t.xax_count).length-1);t.x_extended_ticks||e.append("line").attr("x1",function(){return 0===t.xax_count?x(t):t.axes_not_compact&&"bar"!==t.chart_type?t.left:t.scales.X(t.scales.X.ticks(t.xax_count)[0]).toFixed(2)}).attr("x2",function(){return 0===t.xax_count||t.axes_not_compact&&"bar"!==t.chart_type?y(t):t.scales.X(t.scales.X.ticks(t.xax_count)[r]).toFixed(2)}).attr("y1",t.height-t.bottom).attr("y2",t.height-t.bottom)}function re(t,e){e.selectAll(".mg-xax-ticks").data(t.processed.x_ticks).enter().append("line").attr("x1",function(e){return t.scales.X(e).toFixed(2)}).attr("x2",function(e){return t.scales.X(e).toFixed(2)}).attr("y1",t.height-t.bottom).attr("y2",function(){return t.x_extended_ticks?t.top:t.height-t.bottom+t.xax_tick_length}).attr("class",function(){if(t.x_extended_ticks)return"mg-extended-xax-ticks"}).classed("mg-xax-ticks",!0)}function ae(t,e){ne(e,t),oe(e,t)}function ne(e,r){var a=r.selectAll(".mg-xax-labels").data(e.processed.x_ticks).enter().append("text").attr("x",function(t){return e.scales.X(t).toFixed(2)}).attr("y",(e.height-e.bottom+7*e.xax_tick_length/3).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle");if(e.time_series&&e.european_clock?(a.append("tspan").classed("mg-european-hours",!0).text(function(e,r){var a=new Date(e);return 0===r?t.timeFormat("%H")(a):""}),a.append("tspan").classed("mg-european-minutes-seconds",!0).text(function(t,r){var a=new Date(t);return":"+e.processed.xax_format(a)})):a.text(function(t){return e.xax_units+e.processed.xax_format(t)}),D(a)){a.filter(function(t,e){return(e+1)%2===0}).remove();var n=R(e.target);n.selectAll(".mg-xax-ticks").filter(function(t,e){return(e+1)%2===0}).remove()}}function oe(t,e){if(t.time_series&&(t.show_years||t.show_secondary_x_label)){var r=ie(t);se(t,e,r.timeframe,r.yformat,r.secondary)}}function ie(e){var r={};switch(r.timeframe=e.processed.x_time_frame,r.timeframe){case"millis":case"seconds":r.secondary=t.timeDays,e.european_clock?r.yformat=MG.time_format(e.utc_time,"%b %d"):r.yformat=MG.time_format(e.utc_time,"%I %p");break;case"less-than-a-day":r.secondary=t.timeDays,r.yformat=MG.time_format(e.utc_time,"%b %d");break;case"four-days":r.secondary=t.timeDays,r.yformat=MG.time_format(e.utc_time,"%b %d");break;case"many-days":r.secondary=t.timeYears,r.yformat=MG.time_format(e.utc_time,"%Y");break;case"many-months":r.secondary=t.timeYears,r.yformat=MG.time_format(e.utc_time,"%Y");break;default:r.secondary=t.timeYears,r.yformat=MG.time_format(e.utc_time,"%Y")}return r}function se(t,e,r,a,n){var o=n(t.processed.min_x,t.processed.max_x);if(0===o.length){var i=t.scales.X.ticks(t.xax_count)[0];o=[i]}var s=k(e,"mg-year-marker");"default"===r&&t.show_year_markers&&ce(t,s,o,a),"years"!=r&&le(t,s,o,a)}function ce(t,e,r,a){e.selectAll(".mg-year-marker").data(r).enter().append("line").attr("x1",function(e){return t.scales.X(e).toFixed(2)}).attr("x2",function(e){return t.scales.X(e).toFixed(2)}).attr("y1",m(t)).attr("y2",p(t))}function le(e,r,a,n){r.selectAll(".mg-year-marker").data(a).enter().append("text").attr("x",function(t,r){return e.scales.X(t).toFixed(2)}).attr("y",function(){var r=t.select(e.target).select(".mg-x-axis text").node().getBoundingClientRect();return p(e)+7*e.xax_tick_length/3+.8*r.height}).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return n(new Date(t))})}function ue(t){t.xax_count=2}function fe(t){var e=t.chart_type;t.processed.xax_format||(t.xax_format?t.processed.xax_format=t.xax_format:"line"===e||"point"===e||"histogram"===e?t.processed.xax_format=Jt(t):"bar"===e&&(t.processed.xax_format=Ut(t)))}function de(t){var e={target:null,title:null,description:null};return t||(t={}),t.processed||(t.processed={}),t=U(t,e)}function pe(t){var e=Y(t.processed.original_data||t.data)[0];t.time_series=e[t.processed.original_x_accessor||t.x_accessor]instanceof Date}function _e(t){var e=t.width;t.full_width&&(e=S(t.target)),"categorical"===t.x_axis_type&&null===e&&(e=Fe(t,"x")),t.width=e}function me(t){var e=t.height;t.full_height&&(e=j(t.target)),"categorical"===t.y_axis_type&&null===e&&(e=Fe(t,"y")),t.height=e}function ge(t,e){(!t.selectAll(".mg-main-line").empty()&&"line"!==e.chart_type||!t.selectAll(".mg-points").empty()&&"point"!==e.chart_type||!t.selectAll(".mg-histogram").empty()&&"histogram"!==e.chart_type||!t.selectAll(".mg-barplot").empty()&&"bar"!==e.chart_type)&&t.remove()}function he(e,r){return R(r.target).empty()&&(e=t.select(r.target).append("svg").classed("linked",r.linked).attr("width",r.width).attr("height",r.height)),e}function xe(t,e){t.selectAll(".mg-clip-path").remove(),
t.append("defs").attr("class","mg-clip-path").append("clipPath").attr("id","mg-plot-window-"+P(e.target)).append("svg:rect").attr("x",h(e)).attr("y",m(e)).attr("width",e.width-e.left-e.right-e.buffer).attr("height",e.height-e.top-e.bottom-e.buffer+1)}function ye(t,e){e.width!==Number(t.attr("width"))&&t.attr("width",e.width),e.height!==Number(t.attr("height"))&&t.attr("height",e.height)}function ve(t,e){t.attr("viewBox","0 0 "+e.width+" "+e.height),(e.full_width||e.full_height)&&t.attr("preserveAspectRatio","xMinYMin meet")}function be(t){t.classed("mg-missing",!1),t.selectAll(".mg-missing-text").remove(),t.selectAll(".mg-missing-pane").remove()}function we(t,e){var r=0;if(t.selectAll(".mg-main-line").nodes().length>=e.data.length)if(e.custom_line_color_map.length>0){var a=function(t){for(var e=new Array(t),r=0;r<e.length;r++)e[r]=r+1;return e},n=B(a(e.max_data_size),e.custom_line_color_map);for(r=0;r<n.length;r++)t.selectAll(".mg-main-line.mg-line"+n[r]+"-color").remove()}else{var o=e.data.length,i=t.selectAll(".mg-main-line").nodes()?t.selectAll(".mg-main-line").nodes().length:0;for(r=i;r>o;r--)t.selectAll(".mg-main-line.mg-line"+r+"-color").remove()}}function ke(t,e){if(t.empty())return void console.warn('The specified target element "'+e.target+'" could not be found in the page. The chart will not be rendered.')}function Me(t,e){var r="x"===e?t.width:t.height;Ge(t,e),Ae(t,e),De(t,e,r),r&&Oe(t,e)}function Ge(e,r){var a=r+"group_accessor",n=e[a];if(e.categorical_groups=[],n){var o=e.data[0];e.categorical_groups=t.set(o.map(function(t){return t[n]})).values()}}function Ae(e,r){var a=r+"group_accessor",n=e[a];if(e.total_bars=e.data[0].length,n){var o=d(f(e.data[0],n));o=t.max(Object.keys(o).map(function(t){return o[t]})),e.bars_per_group=o}else e.bars_per_group=e.data[0].length}function De(t,e,r){var a=e+"group_height";if(r){var n="y"===e?(t.height-t.top-t.bottom-2*t.buffer)/(t.categorical_groups.length||1):(t.width-t.left-t.right-2*t.buffer)/(t.categorical_groups.length||1);t[a]=n}else{var o=(1+t[e+"_padding_percentage"])*t.bar_thickness;t[a]=t.bars_per_group*o+2*t[e+"_outer_padding_percentage"]*o}}function Oe(t,e){var r=t[e+"group_height"]/(t.bars_per_group+t[e+"_outer_padding_percentage"]);t.bar_thickness=r-r*t[e+"_padding_percentage"]}function Fe(t,e){var r=t[e+"group_height"]*(t.categorical_groups.length||1),a="y"===e?t.top+t.bottom+2*t.buffer:t.left+t.right+2*t.buffer;return r+a+t.categorical_groups.length*t[e+"group_height"]*(t[e+"group_padding_percentage"]+t[e+"group_outer_padding_percentage"])}function ze(e){"use strict";e=arguments[0],e=de(e);var r=t.select(e.target);ke(r,e);var a=r.selectAll("svg");return"categorical"===e.y_axis_type&&Me(e,"y"),"categorical"===e.x_axis_type&&Me(e,"x"),pe(e),_e(e),me(e),ge(a,e),a=he(a,e),xe(a,e),ye(a,e),ve(a,e),be(a),V(e),we(a,e),this}function Ce(t){return t.label}function Te(t){t.selectAll(".mg-markers").remove(),t.selectAll(".mg-baselines").remove()}function Re(t){return function(e){return t.scales.X(e[t.x_accessor])>x(t)&&t.scales.X(e[t.x_accessor])<v(t)}}function Ye(t){return function(e){return t.scales.X(e[t.x_accessor])}}function $e(t){var e=Ye(t);return function(t){return e(t).toFixed(2)}}function Ee(t){var e=t.scales.Y;return function(t){return e(t.value).toFixed(2)}}function Pe(t,e,r,a,n,o){var i;t&&(i=a.append("g").attr("class",e),n(i,r),o(i,r))}function Le(t,e){Pe(t.markers,"mg-markers",t,e,Se,je)}function Xe(t,e){Pe(t.baselines,"mg-baselines",t,e,Ue,Be)}function Se(t,e){var r=$e(e);t.selectAll(".mg-markers").data(e.markers.filter(Re(e))).enter().append("line").attr("x1",r).attr("x2",r).attr("y1",e.top).attr("y2",_(e)).attr("class",function(t){return t.lineclass}).attr("stroke-dasharray","3,1")}function je(e,r){e.selectAll(".mg-markers").data(r.markers.filter(Re(r))).enter().append("text").attr("class",function(t){return t.textclass||""}).classed("mg-marker-text",!0).attr("x",Ye(r)).attr("y","bottom"===r.x_axis_position?.95*m(r):p(r)+r.buffer).attr("text-anchor","middle").text(Ce).each(function(e){e.click&&t.select(this).style("cursor","pointer").on("click",e.click)}),O(e.selectAll(".mg-marker-text").nodes(),r)}function Ue(t,e){var r=Ee(e);t.selectAll(".mg-baselines").data(e.baselines).enter().append("line").attr("x1",x(e)).attr("x2",v(e)).attr("y1",r).attr("y2",r)}function Be(t,e){var r=Ee(e);t.selectAll(".mg-baselines").data(e.baselines).enter().append("text").attr("x",v(e)).attr("y",r).attr("dy",-3).attr("text-anchor","end").text(Ce)}function Ne(t){"use strict";var e=R(t.target);return Te(e),Le(t,e),Xe(t,e),this}function Ie(t){t.selectAll(".mg-active-datapoint-container").selectAll("*").remove()}function He(e,r){e.select(".mg-active-datapoint").remove();var a="right"===r.mouseover_align?"end":"left"===r.mouseover_align?"start":"middle",n="right"===r.mouseover_align?v(r):"left"===r.mouseover_align?x(r):(r.width-r.left-r.right)/2+r.left,o=e.select(".mg-active-datapoint-container").append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("text-anchor",a),i=.75,s="bottom"===r.x_axis_position?m(r)*i:p(r)+3*r.buffer;if(r.markers){var c;e.selectAll(".mg-marker-text").each(function(){c?c!==t.select(this).attr("y")&&(i=.56):c=t.select(this).attr("y")})}o.attr("transform","translate("+n+","+s+")")}function qe(t,e){var r="",a=null;return 3===arguments.length&&(a=arguments[2]),r=t.append("tspan").text(e),null!==a&&r.classed(a,!0),this.tspan=r,this.bold=function(){return this.tspan.attr("font-weight","bold"),this},this.font_size=function(t){return this.tspan.attr("font-size",t),this},this.x=function(t){return this.tspan.attr("x",t),this},this.y=function(t){return this.tspan.attr("y",t),this},this.elem=function(){return this.tspan},this}function Ve(t){var e=t.select(".mg-active-datapoint");return e.selectAll("*").remove(),e}function We(t,e,r){var a=1.1;this.rargs=r;var n=e.append("tspan").attr("x",0).attr("y",t*a+"em");return this.text=function(t){return qe(n,t)},this}function Ze(t,e){return this.row_number=0,this.rargs=e,He(e.svg,t),this.text_container=Ve(e.svg),this.mouseover_row=function(t){var e=this,r=We(e.row_number,e.text_container,t);return e.row_number+=1,r},this}function Qe(){function e(){n.forEach(function(e){var r=t.select(e).select("svg");if(!r.empty()){var a=0!==r.attr("width")?r.attr("height")/r.attr("width"):0,n=S(e);r.attr("width",n),r.attr("height",a*n)}})}function r(t){var r=n.indexOf(t);r!==-1&&n.splice(r,1),0===n.length&&window.removeEventListener("resize",e,!0)}var a,n=[];return"undefined"!=typeof MutationObserver?a=MutationObserver:"undefined"!=typeof WebKitMutationObserver&&(a=WebKitMutationObserver),{add_target:function(o){if(0===n.length&&window.addEventListener("resize",e,!0),n.indexOf(o)===-1&&(n.push(o),a)){var i=new a(function(e){var a=t.select(o).node();a&&!e.some(function(t){for(var e=0;e<t.removedNodes.length;e++)if(t.removedNodes[e]===a)return!0})||(i.disconnect(),r(o))});i.observe(t.select(o).node().parentNode,{childList:!0})}}}}function Ke(t){Je(t)}function Je(t){(t.full_width||t.full_height)&&Rr.add_target(t.target)}function tr(t,e,r){var a=Ze(t,{svg:e}),n=a.mouseover_row();if(null!==t.color_accessor&&"category"===t.color_type){var o=r[t.color_accessor];n.text(o+" ").bold().elem().attr("fill",t.scalefns.colorf(r))}er(t,n.text("● ").elem(),r),n.text(Gr(t,r)),n.text(Ar(t,r,t.time_series===!1))}function er(t,e,r){null!==t.color_accessor?(e.attr("fill",t.scalefns.colorf(r)),e.attr("stroke",t.scalefns.colorf(r))):e.classed("mg-points-mono",!0)}function rr(t,e){function r(t){return 1e3===t?3:1e6===t?7:Math.log(t)/Math.LN10}var a,n,o;"x"===e?(a=t.x_accessor,n=t.scales.X.ticks(t.xax_count),o=t.processed.max_x):"y"===e&&(a=t.y_accessor,n=t.scales.Y.ticks(t.yax_count),o=t.processed.max_y),("x"===e&&"log"===t.x_scale_type||"y"===e&&"log"===t.y_scale_type)&&(n=n.filter(function(t){return Math.abs(r(t))%1<1e-6||Math.abs(r(t))%1>1-1e-6}));var i=n.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[a]%1!==0)return s=!1,!1})}),s&&i>o&&"count"===t.format&&(n=n.filter(function(t){return t%1===0})),"x"===e?t.processed.x_ticks=n:"y"===e&&(t.processed.y_ticks=n)}function ar(t){"use strict";if(t.data=MG.clone(t.data),t.single_object=!1,t.array_of_objects=!1,t.array_of_arrays=!1,t.nested_array_of_arrays=!1,t.nested_array_of_objects=!1,c(t.data)?(t.nested_array_of_objects=t.data.map(function(t){return u(t)}),t.nested_array_of_arrays=t.data.map(function(t){return c(t)})):(t.array_of_objects=l(t.data),t.array_of_arrays=c(t.data)),"line"===t.chart_type?(t.array_of_objects||t.array_of_arrays)&&(t.data=[t.data]):t.data[0]instanceof Array||(t.data=[t.data]),or(t),ir(t),void 0!==t.color&&(t.colors=t.color),null!==t.colors&&"string"==typeof t.colors&&(t.colors=[t.colors]),"line"===t.chart_type&&t.x_sort===!0)for(var e=0;e<t.data.length;e++)t.data[e].sort(function(e,r){return e[t.x_accessor]-r[t.x_accessor]});return this}function nr(t,e){t[e]instanceof Array&&(t.data=t.data.map(function(r){return t[e].map(function(t){return r.map(function(r){if(r=MG.clone(r),void 0!==r[t])return r["multiline_"+e]=r[t],r}).filter(function(t){return void 0!==t})})})[0],t[e]="multiline_"+e)}function or(t){nr(t,"x_accessor")}function ir(t){nr(t,"y_accessor")}function sr(e){"use strict";var r,a=t.sum(e.data.map(function(t){return t.length>0&&t[0][e.x_accessor]instanceof Date}))>0;if((e.missing_is_zero||e.missing_is_hidden)&&"line"===e.chart_type&&a)for(var n=0;n<e.data.length;n++)if(!(e.data[n].length<=1)){var o=e.data[n][0],i=e.data[n][e.data[n].length-1],s=[],c=MG.clone(o[e.x_accessor]).setDate(o[e.x_accessor].getDate()+1),l=e.min_x?e.min_x:c,u=e.max_x?e.max_x:i[e.x_accessor];if(r=Bt((u-l)/1e3),["four-days","many-days","many-months","years","default"].indexOf(r)!==-1&&null===e.missing_is_hidden_accessor)for(var f=new Date(l);f<=u;f.setDate(f.getDate()+1)){var d={};f.setHours(0,0,0,0),Date.parse(f)===Date.parse(new Date(c))&&s.push(MG.clone(e.data[n][0]));var p=null;e.data[n].forEach(function(t,r){if(Date.parse(t[e.x_accessor])===Date.parse(new Date(f)))return p=t,!1}),p?p[e.missing_is_hidden_accessor]||null===p[e.y_accessor]?(p._missing=!0,s.push(p)):s.push(p):(d[e.x_accessor]=new Date(f),d[e.y_accessor]=0,d._missing=!0,s.push(d))}else for(var _=0;_<e.data[n].length;_+=1){var m=MG.clone(e.data[n][_]);m._missing=e.data[n][_][e.missing_is_hidden_accessor],s.push(m)}e.data[n]=s}return this}function cr(e){"use strict";var r,a=e.data[0];if(e.binned===!1){if("object"==typeof a[0])r=a.map(function(t){return t[e.x_accessor]});else{if("number"!=typeof a[0])return void console.log("TypeError: expected an array of numbers, found "+typeof a[0]);r=a}var n=t.histogram();e.bins&&n.thresholds(e.bins);var o=n(r);e.processed_data=o.map(function(t){return{x:t.x0,y:t.length}})}else{e.processed_data=a.map(function(t){return{x:t[e.x_accessor],y:t[e.y_accessor]}});for(var i,s,c=0;c<e.processed_data.length;c++)i=e.processed_data[c],c===e.processed_data.length-1?i.dx=e.processed_data[c-1].dx:(s=e.processed_data[c+1],i.dx=s.x-i.x)}return e.processed||(e.processed={}),e.processed.original_data=e.data,e.processed.original_x_accessor=e.x_accessor,e.processed.original_y_accessor=e.y_accessor,e.data=[e.processed_data],e.x_accessor=e.processed_x_accessor,e.y_accessor=e.processed_y_accessor,this}function lr(t){"use strict";"vertical"===t.bar_orientation?t.x_accessor:t.y_accessor,"vertical"===t.bar_orientation?t.y_accessor:t.x_accessor;return this}function ur(t){"use strict";var e=t.data[0],r=e.map(function(e){return e[t.x_accessor]}),a=e.map(function(e){return e[t.y_accessor]});return t.least_squares&&(t.ls_line=mr(r,a)),this}function fr(e){var r=R(e.target),a=e.data[0],n=t.min(a,function(t){return t[e.x_accessor]}),o=t.max(a,function(t){return t[e.x_accessor]});t.select(e.target).selectAll(".mg-least-squares-line").remove(),r.append("svg:line").attr("x1",e.scales.X(n)).attr("x2",e.scales.X(o)).attr("y1",e.scales.Y(e.ls_line.fit(n))).attr("y2",e.scales.Y(e.ls_line.fit(o))).attr("class","mg-least-squares-line")}function dr(e){var r=R(e.target),a=e.lowess_line,n=t.svg.line().x(function(t){return e.scales.X(t.x)}).y(function(t){return e.scales.Y(t.y)}).interpolate(e.interpolate);r.append("path").attr("d",n(a)).attr("class","mg-lowess-line")}function pr(e,r,a,n){var o,i,s=[];t.mean(r);for(i=0;i<e.length;i+=1)s.push(1);o=wr(e,r,a,n,s);var c=o.x,l=o.y;for(i=0;i<100;i+=1){s=t.zip(l,r).map(function(t){return Math.abs(t[1]-t[0])});var u=t.quantile(s.sort(),.5);s=s.map(function(t){return hr(t/(6*u))}),o=wr(e,r,a,n,s),c=o.x,l=o.y}return t.zip(c,l).map(function(t){var e={};return e.x=t[0],e.y=t[1],e})}function _r(t,e,r,a){for(var n=[],o=0;o<t.length;o+=1)n.push(1);wr(t,e,r,a,n)}function mr(e,r){var a,n,o,i;e.length;a=e[0]instanceof Date?e.map(function(t){return t.getTime()}):e,n=r[0]instanceof Date?r.map(function(t){return t.getTime()}):r;for(var s=t.mean(a),c=t.mean(n),l=0,u=0,f=0;f<a.length;f++)o=a[f],i=n[f],l+=(o-s)*(i-c),u+=(o-s)*(o-s);var d=l/u,p=c-d*s;return{x0:p,beta:d,fit:function(t){return p+t*d}}}function gr(t,e){return t>=0&&t<=1?Math.pow(1-Math.pow(t,e),e):0}function hr(t){return gr(t,2)}function xr(t){return gr(t,3)}function yr(e){var r=t.sum(e.map(function(t){return t.w}));return{xbar:t.sum(e.map(function(t){return t.w*t.x}))/r,ybar:t.sum(e.map(function(t){return t.w*t.y}))/r}}function vr(e,r,a){var n=t.sum(e.map(function(t){return Math.pow(t.w,2)*(t.x-r)*(t.y-a)})),o=t.sum(e.map(function(t){return Math.pow(t.w,2)*Math.pow(t.x-r,2)}));return n/o}function br(t){var e,r,a=yr(t);r=a.xbar,e=a.ybar;var n=vr(t,r,e);return{beta:n,xbar:r,ybar:e,x0:e-n*r}}function wr(e,r,a,n,o){var i=Math.floor(e.length*a),s=e.slice();s.sort(function(t,e){return t<e?-1:t>e?1:0});for(var c,l,u,f,d,p=t.quantile(s,.98),_=t.quantile(s,.02),m=t.zip(e,r,o).sort(),g=Math.abs(p-_)/n,h=_,x=p,y=t.range(h,x,g),v=[],b=0;b<y.length;b+=1){l=y[b],c=m.map(function(t){return[Math.abs(t[0]-l),t[0],t[1],t[2]]}).sort().slice(0,i),d=t.max(c)[0],c=c.map(function(t){return{w:xr(t[0]/d)*t[3],x:t[1],y:t[2]}});var w=br(c);f=w.x0,u=w.beta,v.push(f+u*l)}return{x:y,y:v}}function kr(e){var r;return r="count"===e.format?function(r){var a,n=r%1!==0;return a=n?t.format(",."+e.decimals+"f"):t.format(",.0f"),e.yax_units_append?a(r)+e.yax_units:e.yax_units+a(r)}:function(r){var a=(e.decimals?"."+e.decimals:"")+"%",n=t.format(a);return n(r)}}function Mr(t,e,a,n,o){var i,s,c=r(t);return s="string"==typeof e[n]?function(t){return t}:kr(t),i=null!==a?o?Yr(a,e,n,t.utc):$r(a,e,n):o?c(new Date((+e[n])))+" ":(t.time_series?"":n+": ")+s(e[n])+" "}function Gr(t,e){return Mr(t,e,t.x_mouseover,t.x_accessor,t.time_series)}function Ar(t,e){return Mr(t,e,t.y_mouseover,t.y_accessor,!1)}function Dr(t,e){return Mr(t,e,t.x_mouseover,"key",t.time_series)}function Or(e,r){return function(){for(var a=this,n=a.cloneNode(),o=a.getTotalLength()||0,i=(n.setAttribute("d",e),n).getTotalLength()||0,s=[0],c=0,l=r/Math.max(o,i);(c+=l)<1;)s.push(c);s.push(1);var u=s.map(function(e){var r=a.getPointAtLength(e*o),s=n.getPointAtLength(e*i);return t.interpolate([r.x,r.y],[s.x,s.y])});return function(t){return t<1?"M"+u.map(function(e){return e(t)}).join("L"):e}}}function Fr(e){console.error("ERROR : ",e.target," : ",e.error),t.select(e.target).select(".mg-chart-title").append("tspan").attr("class","fa fa-x fa-exclamation-circle mg-warning").attr("dx","0.3em").text("")}function zr(t){console.error("INTERNAL ERROR : ",t.target," : ",t.internal_error)}window.MG={version:"2.10.1"},MG.convert={},MG.convert.date=function(e,r,a){a="undefined"==typeof a?"%Y-%m-%d":a;var n=t.timeParse(a);return e=e.map(function(t){return t[r]=n(t[r].trim()),t})},MG.convert.number=function(t,e){return t=t.map(function(t){return t[e]=Number(t[e]),t})},MG.time_format=function(e,r){return e?t.utcFormat(r):t.timeFormat(r)};var Cr=function(t,e,r){var a={};if(null===t)return t;if(Array.prototype.forEach&&t.forEach===Array.prototype.forEach)t.forEach(e,r);else if(t.length===+t.length){for(var n=0,o=t.length;n<o;n++)if(e.call(r,t[n],n,t)===a)return}else for(var i in t)if(e.call(r,t[i],i,t)===a)return;return t};MG.merge_with_defaults=U,MG.clone=function(t){var e;if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(t instanceof Array){e=[];for(var r=0,a=t.length;r<a;r++)e[r]=MG.clone(t[r]);return e}if(t instanceof Object){e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=MG.clone(t[n]));return e}throw new Error("Unable to copy obj! Its type isn't supported.")},MG.arr_diff=B,MG.warn_deprecation=N,MG.truncate_text=I,MG.wrap_text=H,MG.register=q,MG._hooks={},MG.add_hook=function(t,e,r){var a;MG._hooks[t]||(MG._hooks[t]=[]),a=MG._hooks[t];var n=a.filter(function(t){return t.func===e}).length>0;if(n)throw"That function is already registered.";a.push({func:e,context:r})},MG.call_hook=function(t){var e,r=MG._hooks[t],a=[].slice.apply(arguments,[1]);return r&&r.forEach(function(t){if(t.func){var r=e||a;r&&r.constructor!==Array&&(r=[r]),r=[].concat.apply([],r),e=t.func.apply(t.context,r)}}),e||a},MG.globals={},MG.deprecations={rollover_callback:{replacement:"mouseover",version:"2.0"},rollout_callback:{replacement:"mouseout",version:"2.0"},x_rollover_format:{replacement:"x_mouseover",version:"2.10"},y_rollover_format:{replacement:"y_mouseover",version:"2.10"},show_years:{replacement:"show_secondary_x_label",version:"2.1"},xax_start_at_min:{replacement:"axes_not_compact",version:"2.7"},interpolate_tension:{replacement:"interpolate",version:"2.10"}},MG.globals.link=!1,MG.globals.version="1.1",MG.charts={},MG.data_graphic=function(e){"use strict";var r={missing_is_zero:!1,missing_is_hidden:!1,missing_is_hidden_accessor:null,legend:"",legend_target:"",error:"",animate_on_load:!1,top:65,title_y_position:10,center_title_full_width:!1,bottom:45,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,xax_count:6,xax_tick_length:5,axes_not_compact:!0,yax_count:3,yax_tick_length:5,x_extended_ticks:!1,y_extended_ticks:!1,y_scale_type:"linear",max_x:null,max_y:null,min_x:null,min_y:null,min_y_from_data:!1,point_size:2.5,x_accessor:"date",xax_units:"",x_label:"",x_sort:!0,x_axis:!0,y_axis:!0,x_axis_position:"bottom",y_axis_position:"left",x_axis_type:null,y_axis_type:null,ygroup_accessor:null,xgroup_accessor:null,y_padding_percentage:.05,y_outer_padding_percentage:.1,ygroup_padding_percentage:.25,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.1,xgroup_padding_percentage:.25,xgroup_outer_padding_percentage:0,y_categorical_show_guides:!1,x_categorical_show_guide:!1,rotate_x_labels:0,rotate_y_labels:0,y_accessor:"value",y_label:"",yax_units:"",yax_units_append:!1,x_rug:!1,y_rug:!1,mouseover_align:"right",x_mouseover:null,y_mouseover:null,transition_on_update:!0,mouseover:null,click:null,show_rollover_text:!0,show_confidence_band:null,xax_format:null,area:!0,chart_type:"line",data:[],decimals:2,format:"count",inflator:10/9,linked:!1,linked_format:"%Y-%m-%d",list:!1,baselines:null,markers:null,scalefns:{},scales:{},utc_time:!1,european_clock:!1,show_year_markers:!1,show_secondary_x_label:!0,target:"#viz",interpolate:t.curveCatmullRom.alpha(0),custom_line_color_map:[],colors:null,max_data_size:null,aggregate_rollover:!1,show_tooltips:!0};MG.call_hook("global.defaults",r),e||(e={});var a=MG.charts[e.chart_type||r.chart_type];U(e,a.defaults,r),e.list&&(e.x_accessor=0,e.y_accessor=1);for(var n in MG.deprecations)if(e.hasOwnProperty(n)){var o=MG.deprecations[n],i="Use of `args."+n+"` has been deprecated",s=o.replacement;if(s&&(e[s]?i+=". The replacement - `args."+s+"` - has already been defined. This definition will be discarded.":e[s]=e[n]),o.warned)continue;o.warned=!0,s&&(i+=" in favor of `args."+s+"`"),N(i,o.version)}return MG.call_hook("global.before_init",e),new a.descriptor(e),e.data},e()&&(+function(t){"use strict";function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),o="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||a.data("bs.tooltip",n=new r(this,o)),"string"==typeof e&&n[e]())})}var r=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};r.VERSION="3.3.5",r.TRANSITION_DURATION=150,r.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},r.prototype.init=function(e,r,a){if(this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(a),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var n=this.options.trigger.split(" "),o=n.length;o--;){var i=n[o];if("click"==i)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=i){var s="hover"==i?"mouseenter":"focusin",c="hover"==i?"mouseleave":"focusout";this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(c+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},r.prototype.getDelegateOptions=function(){var e={},r=this.getDefaults();return this._options&&t.each(this._options,function(t,a){r[t]!=a&&(e[t]=a)}),e},r.prototype.enter=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),e instanceof t.Event&&(r.inState["focusin"==e.type?"focus":"hover"]=!0),r.tip().hasClass("in")||"in"==r.hoverState?void(r.hoverState="in"):(clearTimeout(r.timeout),r.hoverState="in",r.options.delay&&r.options.delay.show?void(r.timeout=setTimeout(function(){"in"==r.hoverState&&r.show()},r.options.delay.show)):r.show())},r.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},r.prototype.leave=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),e instanceof t.Event&&(r.inState["focusout"==e.type?"focus":"hover"]=!1),!r.isInStateTrue())return clearTimeout(r.timeout),r.hoverState="out",r.options.delay&&r.options.delay.hide?void(r.timeout=setTimeout(function(){"out"==r.hoverState&&r.hide()},r.options.delay.hide)):r.hide()},r.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var a=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!a)return;var n=this,o=this.tip(),i=this.getUID(this.type);this.setContent(),o.attr("id",i),this.$element.attr("aria-describedby",i),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,c=/\s?auto?\s?/i,l=c.test(s);l&&(s=s.replace(c,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(this.options.container):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),f=o[0].offsetWidth,d=o[0].offsetHeight;if(l){var p=s,_=this.getPosition(this.$viewport);s="bottom"==s&&u.bottom+d>_.bottom?"top":"top"==s&&u.top-d<_.top?"bottom":"right"==s&&u.right+f>_.width?"left":"left"==s&&u.left-f<_.left?"right":s,o.removeClass(p).addClass(s)}var m=this.getCalculatedOffset(s,u,f,d);this.applyPlacement(m,s);var g=function(){var t=n.hoverState;n.$element.trigger("shown.bs."+n.type),n.hoverState=null,"out"==t&&n.leave(n)};t.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",g).emulateTransitionEnd(r.TRANSITION_DURATION):g()}},r.prototype.applyPlacement=function(e,r){var a=this.tip(),n=a[0].offsetWidth,o=a[0].offsetHeight,i=parseInt(a.css("margin-top"),10),s=parseInt(a.css("margin-left"),10);isNaN(i)&&(i=0),isNaN(s)&&(s=0),e.top+=i,e.left+=s,t.offset.setOffset(a[0],t.extend({using:function(t){a.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),a.addClass("in");var c=a[0].offsetWidth,l=a[0].offsetHeight;"top"==r&&l!=o&&(e.top=e.top+o-l);var u=this.getViewportAdjustedDelta(r,e,c,l);u.left?e.left+=u.left:e.top+=u.top;var f=/top|bottom/.test(r),d=f?2*u.left-n+c:2*u.top-o+l,p=f?"offsetWidth":"offsetHeight";a.offset(e),this.replaceArrow(d,a[0][p],f)},r.prototype.replaceArrow=function(t,e,r){this.arrow().css(r?"left":"top",50*(1-t/e)+"%").css(r?"top":"left","")},r.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},r.prototype.hide=function(e){function a(){"in"!=n.hoverState&&o.detach(),n.$element.removeAttr("aria-describedby").trigger("hidden.bs."+n.type),e&&e()}var n=this,o=t(this.$tip),i=t.Event("hide.bs."+this.type);if(this.$element.trigger(i),!i.isDefaultPrevented())return o.removeClass("in"),t.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",a).emulateTransitionEnd(r.TRANSITION_DURATION):a(),this.hoverState=null,this},r.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},r.prototype.hasContent=function(){return this.getTitle()},r.prototype.getPosition=function(e){e=e||this.$element;var r=e[0],a="BODY"==r.tagName,n=r.getBoundingClientRect();null==n.width&&(n=t.extend({},n,{width:n.right-n.left,height:n.bottom-n.top}));var o=a?{top:0,left:0}:e.offset(),i={scroll:a?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},s=a?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},n,i,s,o)},r.prototype.getCalculatedOffset=function(t,e,r,a){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-r/2}:"top"==t?{top:e.top-a,left:e.left+e.width/2-r/2}:"left"==t?{top:e.top+e.height/2-a/2,left:e.left-r}:{top:e.top+e.height/2-a/2,left:e.left+e.width}},r.prototype.getViewportAdjustedDelta=function(t,e,r,a){var n={top:0,left:0};if(!this.$viewport)return n;var o=this.options.viewport&&this.options.viewport.padding||0,i=this.getPosition(this.$viewport);if(/right|left/.test(t)){var s=e.top-o-i.scroll,c=e.top+o-i.scroll+a;s<i.top?n.top=i.top-s:c>i.top+i.height&&(n.top=i.top+i.height-c)}else{var l=e.left-o,u=e.left+o+r;l<i.left?n.left=i.left-l:u>i.right&&(n.left=i.left+i.width-u)}return n},r.prototype.getTitle=function(){var t,e=this.$element,r=this.options;return t=e.attr("data-original-title")||("function"==typeof r.title?r.title.call(e[0]):r.title)},r.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},r.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},r.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},r.prototype.enable=function(){this.enabled=!0},r.prototype.disable=function(){this.enabled=!1},r.prototype.toggleEnabled=function(){this.enabled=!this.enabled},r.prototype.toggle=function(e){var r=this;e&&(r=t(e.currentTarget).data("bs."+this.type),r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r))),e?(r.inState.click=!r.inState.click,r.isInStateTrue()?r.enter(r):r.leave(r)):r.tip().hasClass("in")?r.leave(r):r.enter(r)},r.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null})};var a=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=r,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=a,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var a=t(this),n=a.data("bs.popover"),o="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||a.data("bs.popover",n=new r(this,o)),"string"==typeof e&&n[e]())})}var r=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");r.VERSION="3.3.5",r.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),r.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),r.prototype.constructor=r,r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),r=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof r?"html":"append":"text"](r),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},r.prototype.hasContent=function(){return this.getTitle()||this.getContent()},r.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},r.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var a=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=r,t.fn.popover.noConflict=function(){return t.fn.popover=a,this}}(jQuery)),MG.chart_title=V,MG.scale_factory=Q;var Tr={};Tr.categorical=function(t,e){e.namespace;ht(t,e),xt(t,e)},Tr.numerical=function(t,e){var r=e.namespace,a=r+"_axis",n="mg-"+r+"-axis",o=R(t.target);if(w(o,"."+n),!t[a])return this;var i=k(o,n);return rt(t,r),pt(i,t,e),dt(i,t,e),ft(i,t,e),t[r+"_label"]&&e.label(o.select(".mg-"+r+"-axis"),t),t[r+"_rug"]&&mt(t,e),t.show_bar_zero&&kt(t),this},MG.axis_factory=vt,MG.y_rug=bt,MG.y_axis=Ot,MG.y_axis_categorical=Yt,MG.x_rug=$t,MG.x_axis=Pt,MG.x_axis_categorical=Lt,MG.init=ze,MG.markers=Ne;var Rr=new Qe;e()&&+function(t){"use strict";function e(e){e&&3===e.which||(t(n).remove(),t(o).each(function(){var a=t(this),n=r(a),o={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",o)),e.isDefaultPrevented()||(a.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",o)))}))}function r(e){var r=e.attr("data-target");r||(r=e.attr("href"),r=r&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var a=r&&t(r);return a&&a.length?a:e.parent()}function a(e){return this.each(function(){var r=t(this),a=r.data("bs.dropdown");a||r.data("bs.dropdown",a=new i(this)),"string"==typeof e&&a[e].call(r)})}if("function"==typeof t().dropdown)return!0;var n=".dropdown-backdrop",o='[data-toggle="dropdown"]',i=function(e){t(e).on("click.bs.dropdown",this.toggle)};i.VERSION="3.3.1",i.prototype.toggle=function(a){var n=t(this);if(!n.is(".disabled, :disabled")){var o=r(n),i=o.hasClass("open");if(e(),!i){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t('<div class="dropdown-backdrop"/>').insertAfter(t(this)).on("click",e);var s={relatedTarget:this};if(o.trigger(a=t.Event("show.bs.dropdown",s)),a.isDefaultPrevented())return;
n.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger("shown.bs.dropdown",s)}return!1}},i.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var a=t(this);if(e.preventDefault(),e.stopPropagation(),!a.is(".disabled, :disabled")){var n=r(a),i=n.hasClass("open");if(!i&&27!=e.which||i&&27==e.which)return 27==e.which&&n.find(o).trigger("focus"),a.trigger("click");var s=" li:not(.divider):visible a",c=n.find('[role="menu"]'+s+', [role="listbox"]'+s);if(c.length){var l=c.index(e.target);38==e.which&&l>0&&l--,40==e.which&&l<c.length-1&&l++,~l||(l=0),c.eq(l).trigger("focus")}}}};var s=t.fn.dropdown;t.fn.dropdown=a,t.fn.dropdown.Constructor=i,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=s,this},t(document).on("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",o,i.prototype.toggle).on("keydown.bs.dropdown.data-api",o,i.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',i.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',i.prototype.keydown)}(jQuery),MG.button_layout=function(t){"use strict";return this.target=t,this.feature_set={},this.public_name={},this.sorters={},this.manual=[],this.manual_map={},this.manual_callback={},this._strip_punctuation=function(t){var e=t.replace(/[^a-zA-Z0-9 _]+/g,""),r=e.replace(/ +?/g,"");return r},this.data=function(t){return this._data=t,this},this.manual_button=function(t,e,r){return this.feature_set[t]=e,this.manual_map[this._strip_punctuation(t)]=t,this.manual_callback[t]=r,this},this.button=function(t){return arguments.length>1&&(this.public_name[t]=arguments[1]),arguments.length>2&&(this.sorters[t]=arguments[2]),this.feature_set[t]=[],this},this.callback=function(t){return this._callback=t,this},this.display=function(){var t,e,r,a,n=this._callback,o=this.manual_callback,i=this.manual_map;r=Object.keys(this.feature_set);var s,c=function(e){return t[e]};for(s=0;s<this._data.length;s++){t=this._data[s],e=r.map(c);for(var l=0;l<r.length;l++)a=r[l],this.feature_set[a].indexOf(e[l])===-1&&this.feature_set[a].push(e[l])}for(a in this.feature_set)this.sorters.hasOwnProperty(a)&&this.feature_set[a].sort(this.sorters[a]);$(this.target).empty(),$(this.target).append("<div class='col-lg-12 segments text-center'></div>");var u=function(){var t,e=$(this).data("key"),r=$(this).data("feature");return $("."+r+"-btns button.btn span.title").html(e),i.hasOwnProperty(r)?(t=i[r],o[t](e)):n(r,e),!1};for(var f in this.feature_set){for(r=this.feature_set[f],$(this.target+" div.segments").append('<div class="btn-group '+this._strip_punctuation(f)+'-btns text-left"><button type="button" class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown"><span class=\'which-button\'>'+(this.public_name.hasOwnProperty(f)?this.public_name[f]:f)+"</span><span class='title'>"+(this.manual_callback.hasOwnProperty(f)?this.feature_set[f][0]:"all")+'</span><span class="caret"></span></button><ul class="dropdown-menu" role="menu">'+(this.manual_callback.hasOwnProperty(f)?"":'<li><a href="#" data-feature="'+f+'" data-key="all">All</a></li>')+(this.manual_callback.hasOwnProperty(f)?"":'<li class="divider"></li>')+"</ul></div>"),s=0;s<r.length;s++)"all"!==r[s]&&void 0!==r[s]&&$(this.target+" div."+this._strip_punctuation(f)+"-btns ul.dropdown-menu").append('<li><a href="#" data-feature="'+this._strip_punctuation(f)+'" data-key="'+r[s]+'">'+r[s]+"</a></li>");$("."+this._strip_punctuation(f)+"-btns .dropdown-menu li a").on("click",u)}return this},this},function(){"use strict";function e(t,e,r){t.classed("mg-hover-line"+e.line_id+"-color",null===r.colors).attr("fill",null===r.colors?"":r.colors[e.line_id-1])}function i(t,e,r){u(t,e),c(t,e),l(t,e),s(t,e,r)}function s(e,r,a){r.existing_band=a.selectAll(".mg-confidence-band").nodes(),e.show_confidence_band&&(r.confidence_area=t.area().defined(r.line.defined()).x(e.scalefns.xf).y0(function(t){var r=e.show_confidence_band[0];return void 0!=t[r]?e.scales.Y(t[r]):e.scales.Y(t[e.y_accessor])}).y1(function(t){var r=e.show_confidence_band[1];return void 0!=t[r]?e.scales.Y(t[r]):e.scales.Y(t[e.y_accessor])}).curve(e.interpolate))}function c(e,r){r.area=t.area().defined(r.line.defined()).x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).curve(e.interpolate)}function l(e,r){r.flat_line=t.line().defined(function(t){return(void 0===t._missing||t._missing!==!0)&&null!==t[e.y_accessor]}).x(e.scalefns.xf).y(function(){return e.scales.Y(r.data_median)}).curve(e.interpolate)}function u(e,r){r.line=t.line().x(e.scalefns.xf).y(e.scalefns.yf).curve(e.interpolate),e.missing_is_zero||(r.line=r.line.defined(function(t){return(void 0===t._missing||t._missing!==!0)&&null!==t[e.y_accessor]}))}function f(t,e,r,a){if(t.show_confidence_band){var n;r.select(".mg-confidence-band-"+a).empty()&&r.append("path").attr("class","mg-confidence-band mg-confidence-band-"+a),n=r.select(".mg-confidence-band-"+a),n.transition().duration(function(){return t.transition_on_update?1e3:0}).attr("d",e.confidence_area(t.data[a-1])).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")")}}function d(t,e,r,a,n){var o=r.selectAll(".mg-main-area.mg-area"+n);e.display_area?o.empty()?r.append("path").classed("mg-main-area",!0).classed("mg-area"+n,!0).classed("mg-area"+n+"-color",null===t.colors).attr("d",e.area(t.data[a])).attr("fill",null===t.colors?"":t.colors[n-1]).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")"):(r.node().appendChild(o.node()),o.transition().duration(e.update_transition_duration).attr("d",e.area(t.data[a])).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")")):o.empty()||o.remove()}function p(t,e){t.classed("mg-line"+e+"-color",!0)}function _(t,e,r,a){t.colors&&t.colors.constructor===Array?(e.attr("stroke",t.colors[r]),t.colors.length<r+1&&p(e,a)):p(e,a)}function m(e,r,a,n){e.animate_on_load?(r.data_median=t.median(e.data[n],function(t){return t[e.y_accessor]}),a.attr("d",r.flat_line(e.data[n])).transition().duration(1e3).attr("d",r.line(e.data[n])).attr("clip-path","url(#mg-plot-window-"+P(e.target)+")")):a.attr("d",r.line(e.data[n])).attr("clip-path","url(#mg-plot-window-"+P(e.target)+")")}function g(t,e,r,a,n,o){if(a.empty()){var i=r.append("path").attr("class","mg-main-line mg-line"+o);_(t,i,n,o),m(t,e,i,n)}else{r.node().appendChild(a.node());var s=a.transition().duration(e.update_transition_duration);e.display_area||!t.transition_on_update||t.missing_is_hidden?s.attr("d",e.line(t.data[n])):s.attrTween("d",Or(e.line(t.data[n]),4))}}function h(t,e,r,a){var i;if(t.legend)if(n(t.legend)?i=t.legend[r]:o(t.legend)&&(i=t.legend(t.data[r])),t.legend_target)t.colors&&t.colors.constructor===Array?e.legend_text="<span style='color:"+t.colors[r]+"'>&mdash; "+i+"&nbsp; </span>"+e.legend_text:e.legend_text="<span class='mg-line"+a+"-legend-color'>&mdash; "+i+"&nbsp; </span>"+e.legend_text;else{var s,c,l;"left"===t.y_axis_position?(s=t.data[r][t.data[r].length-1],c="start",l=t.buffer):(s=t.data[r][0],c="end",l=-t.buffer);var u=e.legend_group.append("svg:text").attr("x",t.scalefns.xf(s)).attr("dx",l).attr("y",t.scalefns.yf(s)).attr("dy",".35em").attr("font-size",10).attr("text-anchor",c).attr("font-weight","300").text(i);t.colors&&t.colors.constructor===Array?t.colors.length<r+1?u.classed("mg-line"+a+"-legend-color",!0):u.attr("fill",t.colors[r]):u.classed("mg-line"+a+"-legend-color",!0),F(e.legend_group.selectAll(".mg-line-legend text").nodes(),t)}}function y(e,r){e&&t.select(e).html(r)}function b(t,e,r){t.legend&&(e.legend_group=k(r,"mg-line-legend"))}function M(t){w(t,".mg-rollover-rect"),w(t,".mg-voronoi"),w(t,".mg-active-datapoint"),w(t,".mg-line-rollover-circle")}function G(t,e){var r=e.selectAll(".mg-line-rollover-circle").data(t.data).enter().append("circle").attr("cx",0).attr("cy",0).attr("r",0);t.colors&&t.colors.constructor===Array?r.attr("class",function(t){return"mg-line"+t.line_id}).attr("fill",function(e,r){return t.colors[r]}).attr("stroke",function(e,r){return t.colors[r]}):r.attr("class",function(t,e){return["mg-line"+t.line_id,"mg-line"+t.line_id+"-color","mg-area"+t.line_id+"-color"].join(" ")}),r.classed("mg-line-rollover-circle",!0)}function A(t){for(var e=1,r=0;r<t.data.length;r++){for(var a=0;a<t.data[r].length;a++)t.custom_line_color_map.length>0?t.data[r][a].line_id=t.custom_line_color_map[r]:t.data[r][a].line_id=e;e++}}function D(e){return t.merge(e.data)}function O(t){return function(e){var r;if(t.linked){var a=e[t.x_accessor],n=MG.time_format(t.utc_time,t.linked_format),o="number"==typeof a?e.line_id-1:n(a);return r="roll_"+o+" mg-line"+e.line_id,null===t.color&&(r+=" mg-line"+e.line_id+"-color"),r}return r="mg-line"+e.line_id,null===t.color&&(r+=" mg-line"+e.line_id+"-color"),r}}function z(e,r,a,n,o){var i=t.voronoi().x(function(t){return e.scales.X(t[e.x_accessor]).toFixed(2)}).y(function(t){return e.scales.Y(t[e.y_accessor]).toFixed(2)}).extent([[e.buffer,e.buffer+e.title_y_position],[e.width-e.buffer,e.height-e.buffer]]),s=k(r,"mg-voronoi");s.selectAll("path").data(i.polygons(D(e))).enter().append("path").filter(function(t){return void 0!==t&&t.length>0}).attr("d",function(t){return null==t?null:"M"+t.join("L")+"Z"}).datum(function(t){return null==t?null:t.data}).attr("class",O(e)).on("mouseover",a).on("mouseout",n).on("mousemove",o),$(e,r)}function C(e){var r=t.nest().key(function(t){return t[e.x_accessor]}).entries(t.merge(e.data));return r.forEach(function(t){var r=t.values[0];t.key=r[e.x_accessor]}),e.x_sort?r.sort(function(t,e){return new Date(t.key)-new Date(e.key)}):r}function T(t,e,r,a,n){var o=C(t),i=o.map(function(e){return t.scales.X(e.key)}),s=e.append("g").attr("class","mg-rollover-rect");s.selectAll(".mg-rollover-rects").data(o).enter().append("rect").attr("x",function(e,r){return 1===i.length?x(t):0===r?i[r].toFixed(2):((i[r-1]+i[r])/2).toFixed(2)}).attr("y",t.top).attr("width",function(e,r){return 1===i.length?v(t):0===r?((i[r+1]-i[r])/2).toFixed(2):r===i.length-1?((i[r]-i[r-1])/2).toFixed(2):((i[r+1]-i[r-1])/2).toFixed(2)}).attr("class",function(e){var r=e.values.map(function(e){var r=E(e.line_id);return null===t.colors&&(r+=" "+L(e.line_id)),r}).join(" ");return t.linked&&e.values.length>0&&(r+=" "+X(S(e.values[0],0,t))),r}).attr("height",t.height-t.bottom-t.top-t.buffer).attr("opacity",0).on("mouseover",r).on("mouseout",a).on("mousemove",n),U(t,e)}function Y(t,e){e.select(".mg-rollover-rect rect").on("mouseover")(t.data[0][0],0)}function $(t,e){for(var r=0;r<t.data.length;r++){var a=r+1;t.custom_line_color_map.length>0&&void 0!==t.custom_line_color_map[r]&&(a=t.custom_line_color_map[r]),1!==t.data[r].length||e.selectAll(".mg-voronoi .mg-line"+a).empty()||(e.selectAll(".mg-voronoi .mg-line"+a).on("mouseover")(t.data[r][0],0),e.selectAll(".mg-voronoi .mg-line"+a).on("mouseout")(t.data[r][0],0))}}function E(t){return"mg-line"+t}function L(t){return"mg-line"+t+"-color"}function X(t){return"roll_"+t}function S(t,e,r){var a=t[r.x_accessor],n=MG.time_format(r.utc_time,r.linked_format),o="number"==typeof a?e:n(a);return o}function j(t,e,r,a,n){var o=1;t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[0]);var i=e.append("g").attr("class","mg-rollover-rect"),s=t.data[0].map(t.scalefns.xf);i.selectAll(".mg-rollover-rects").data(t.data[0]).enter().append("rect").attr("class",function(e,r){var a=L(o)+" "+E(e.line_id);return t.linked&&(a+=a+" "+X(S(e,r,t))),a}).attr("x",function(e,r){return 1===s.length?x(t):0===r?s[r].toFixed(2):((s[r-1]+s[r])/2).toFixed(2)}).attr("y",function(e,r){return t.data.length>1?t.scalefns.yf(e)-6:t.top}).attr("width",function(e,r){return 1===s.length?v(t):0===r?((s[r+1]-s[r])/2).toFixed(2):r===s.length-1?((s[r]-s[r-1])/2).toFixed(2):((s[r+1]-s[r-1])/2).toFixed(2)}).attr("height",function(e,r){return t.data.length>1?12:t.height-t.bottom-t.top-t.buffer}).attr("opacity",0).on("mouseover",r).on("mouseout",a).on("mousemove",n),I(t)&&Y(t,e)}function U(t,e){var r=e.selectAll(".mg-rollover-rect rect");t.data.filter(function(t){return 1===t.length}).length>0&&r.on("mouseover")(r[0][0].__data__,0)}function B(t){return t.data.length>1&&!t.aggregate_rollover}function N(t){return t.data.length>1&&t.aggregate_rollover}function I(t){return 1===t.data.length&&1===t.data[0].length}function H(t,e,r){q(e,r);for(var a=t.data.length-1;a>=0;a--){var n=t.data[a];MG.call_hook("line.before_each_series",[n,t]);var o=a+1;if(t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[a]),t.data[a].line_id=o,0!==n.length){var i=r.select("path.mg-main-line.mg-line"+o);f(t,e,r,o),d(t,e,r,a,o),g(t,e,r,i,a,o),h(t,e,a,o),MG.call_hook("line.after_each_series",[n,i,t])}}}function q(t,e){t.existing_band[0]&&t.existing_band[0].length>e.selectAll(".mg-main-line").node().length&&e.selectAll(".mg-confidence-band").remove()}function V(t){var e={},r=R(t.target);w(r,".mg-line-legend"),b(t,e,r),e.data_median=0,e.update_transition_duration=t.transition_on_update?1e3:0,e.display_area=t.area&&!t.use_data_y_min&&t.data.length<=1&&t.aggregate_rollover===!1,e.legend_text="",i(t,e,r),e.existing_band=r.selectAll(".mg-confidence-band").nodes();var a=MG.call_hook("line.before_all_series",[t]);a!==!1&&H(t,e,r),y(t.legend_target,e.legend_text)}function W(t,e){var r=R(t.target);0===r.selectAll(".mg-active-datapoint-container").nodes().length&&k(r,"mg-active-datapoint-container"),M(r),G(t,r),A(t),B(t)?z(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):N(t)?T(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):j(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t))}function Z(t,e,r){if(t.aggregate_rollover&&t.data.length>1)e.selectAll("circle.mg-line-rollover-circle").style("opacity",0),r.values.forEach(function(r){a(r,t)&&Q(t,e,r)});else{if(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])return;a(r,t)&&K(t,e,r)}}function Q(t,e,r){e.select("circle.mg-line-rollover-circle.mg-line"+r.line_id).attr("cx",t.scales.X(r[t.x_accessor]).toFixed(2)).attr("cy",t.scales.Y(r[t.y_accessor]).toFixed(2)).attr("r",t.point_size).style("opacity",1)}function K(t,e,r){e.selectAll("circle.mg-line-rollover-circle.mg-line"+r.line_id).classed("mg-line-rollover-circle",!0).attr("cx",function(){return t.scales.X(r[t.x_accessor]).toFixed(2)}).attr("cy",function(){return t.scales.Y(r[t.y_accessor]).toFixed(2)}).attr("r",t.point_size).style("opacity",1)}function J(e,r,a){if(e.linked&&!MG.globals.link&&(MG.globals.link=!0,!e.aggregate_rollover||void 0!==r.value||r.values.length>0)){var n=r.values?r.values[0]:r,o=S(n,a,e);t.selectAll("."+E(n.line_id)+"."+X(o)).each(function(e){t.select(this).on("mouseover")(e,a)})}}function tt(e,r,a){if(e.linked&&MG.globals.link){MG.globals.link=!1;var n=MG.time_format(e.utc_time,e.linked_format),o=r.values?r.values:[r];o.forEach(function(r){var o=r[e.x_accessor],i="number"==typeof o?a:n(o);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})})}}function et(t,e){e.selectAll("circle.mg-line-rollover-circle").filter(function(t){return t.length>1}).style("opacity",0)}function rt(t,e,r){e.selectAll("circle.mg-line-rollover-circle.mg-line"+r.line_id).style("opacity",function(){var e=r.line_id-1;return t.custom_line_color_map.length>0&&void 0!==t.custom_line_color_map.indexOf(r.line_id)&&(e=t.custom_line_color_map.indexOf(r.line_id)),1===t.data[e].length?1:0})}function at(t){this.init=function(t){if(this.args=t,!t.data||0===t.data.length)return t.internal_error="No data was supplied",zr(t),this;t.internal_error=void 0,ar(t),sr(t),MG.call_hook("line.before_destroy",this),ze(t),new MG.scale_factory(t).namespace("x").numericalDomainFromData().numericalRange("bottom");var e=(t.baselines||[]).map(function(e){return e[t.y_accessor]});new MG.scale_factory(t).namespace("y").zeroBottom(!0).inflateDomain(!0).numericalDomainFromData(e).numericalRange("left");R(t.target);return t.x_axis&&new MG.axis_factory(t).namespace("x").type("numerical").position(t.x_axis_position).rug($t(t)).label(jt).draw(),t.y_axis&&new MG.axis_factory(t).namespace("y").type("numerical").position(t.y_axis_position).rug(bt(t)).label(Mt).draw(),this.markers(),this.mainPlot(),this.rollover(),this.windowListeners(),MG.call_hook("line.after_init",this),this},this.mainPlot=function(){return V(t),this},this.markers=function(){return Ne(t),this},this.rollover=function(){var e=this;return W(t,e),MG.call_hook("line.after_rollover",t),this},this.rolloverOn=function(t){var a=R(t.target);r(t);return function(r,n){if(Z(t,a,r),J(t,r,n),a.selectAll("text").filter(function(t,e){return r===t}).attr("opacity",.3),t.show_rollover_text&&!(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])){var o=Ze(t,{svg:a}),i=o.mouseover_row();t.aggregate_rollover&&i.text((t.aggregate_rollover&&t.data.length>1?Dr:Gr)(t,r));var s=t.aggregate_rollover&&t.data.length>1?r.values:[r];s.forEach(function(r){t.aggregate_rollover&&(i=o.mouseover_row()),t.legend&&e(i.text(t.legend[r.line_id-1]+" ").bold().elem(),r,t),e(i.text("— ").elem(),r,t),t.aggregate_rollover||i.text(Gr(t,r)),i.text(Ar(t,r,t.time_series===!1))})}t.mouseover&&t.mouseover(r,n)}},this.rolloverOff=function(t){var e=R(t.target);return function(r,a){tt(t,r,a),t.aggregate_rollover?et(t,e):rt(t,e,r),t.data[0].length>1&&Ie(e),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(t)}MG.register("line",at)}.call(this),function(){"use strict";function e(e){this.init=function(t){this.args=t,ar(t),cr(t),ze(t),new MG.scale_factory(t).namespace("x").numericalDomainFromData().numericalRange("bottom");var e=(t.baselines||[]).map(function(e){return e[t.y_accessor]});return new MG.scale_factory(t).namespace("y").zeroBottom(!0).inflateDomain(!0).numericalDomainFromData(e).numericalRange("left"),Pt(t),Ot(t),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t=R(e.target);t.selectAll(".mg-histogram").remove();var r=t.append("g").attr("class","mg-histogram"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor]).toFixed(2)+","+e.scales.Y(t[e.y_accessor]).toFixed(2)+")"});return a.append("rect").attr("x",1).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(0):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(0):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(0)}).attr("height",function(t){return 0===t[e.y_accessor]?0:(e.height-e.bottom-e.buffer-e.scales.Y(t[e.y_accessor])).toFixed(2)}),this},this.markers=function(){return Ne(e),this},this.rollover=function(){var t=R(e.target);0===t.selectAll(".mg-active-datapoint-container").nodes().length&&k(t,"mg-active-datapoint-container"),t.selectAll(".mg-rollover-rect").remove(),t.selectAll(".mg-active-datapoint").remove();var r=t.append("g").attr("class","mg-rollover-rect"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class",function(t,r){return e.linked?"mg-rollover-rects roll_"+r:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor])+",0)"});return a.append("rect").attr("x",1).attr("y",e.buffer+e.title_y_position).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(0):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(0):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(0)}).attr("height",function(t){return e.height}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){var r=R(e.target);return function(a,n){r.selectAll("text").filter(function(t,e){return a===t}).attr("opacity",.3);e.processed.xax_format||MG.time_format(e.utc_time,"%b %e, %Y"),kr(e);if(r.selectAll(".mg-bar rect").filter(function(t,e){return e===n}).classed("active",!0),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseover")(e,n)})),e.show_rollover_text){var o=Ze(e,{svg:r}),i=o.mouseover_row();i.text("▟ ").elem().classed("hist-symbol",!0),i.text(Gr(e,a)),i.text(Ar(e,a,e.time_series===!1))}e.mouseover&&(He(r,e),e.mouseover(a,n))}},this.rolloverOff=function(e){var r=R(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseout")(e,n)})),r.selectAll(".mg-bar rect").classed("active",!1),Ie(r),e.mouseout&&e.mouseout(a,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(e)}var r={binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1};MG.register("histogram",e,r)}.call(this),function(){"use strict";function e(t,e){var r=e.x_accessor,a=e.y_accessor,n=t.filter(function(t){return(null===e.min_x||t[r]>=e.min_x)&&(null===e.max_x||t[r]<=e.max_x)&&(null===e.min_y||t[a]>=e.min_y)&&(null===e.max_y||t[a]<=e.max_y)});return n}function r(r){this.init=function(t){this.args=t,t.x_axis_type=T(t,"x"),t.y_axis_type=T(t,"y"),ar(t),ur(t),ze(t);var e,r;if("categorical"===t.x_axis_type?(e=MG.scale_factory(t).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,t.xgroup_height],null===t.xgroup_accessor),t.xgroup_accessor?new MG.scale_factory(t).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(t.scales.XGROUP=function(e){return x(t)},t.scalefns.xgroupf=function(e){return x(t)}),t.scalefns.xoutf=function(e){return t.scalefns.xf(e)+t.scalefns.xgroupf(e)}):(e=MG.scale_factory(t).namespace("x").inflateDomain(!0).zeroBottom("categorical"===t.y_axis_type).numericalDomainFromData((t.baselines||[]).map(function(e){return e[t.x_accessor]})).numericalRange("bottom"),t.scalefns.xoutf=t.scalefns.xf),"categorical"===t.y_axis_type)r=MG.scale_factory(t).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,t.ygroup_height],!0),t.ygroup_accessor?new MG.scale_factory(t).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(t.scales.YGROUP=function(){return g(t)},t.scalefns.ygroupf=function(e){return g(t)}),t.scalefns.youtf=function(e){return t.scalefns.yf(e)+t.scalefns.ygroupf(e)};else{var a=(t.baselines||[]).map(function(e){return e[t.y_accessor]});r=MG.scale_factory(t).namespace("y").inflateDomain(!0).zeroBottom("categorical"===t.x_axis_type).numericalDomainFromData(a).numericalRange("left"),t.scalefns.youtf=function(e){return t.scalefns.yf(e)}}if(null!==t.color_accessor){var n=MG.scale_factory(t).namespace("color");"number"===t.color_type?n.numericalDomainFromData(tt(t)).numericalRange(et(t)).clamp(!0):t.color_domain?n.categoricalDomain(t.color_domain).categoricalRange(t.color_range):n.categoricalDomainFromData().categoricalColorRange()}return t.size_accessor&&new MG.scale_factory(t).namespace("size").numericalDomainFromData().numericalRange(St(t)).clamp(!0),new MG.axis_factory(t).namespace("x").type(t.x_axis_type).zeroLine("categorical"===t.y_axis_type).position(t.x_axis_position).rug($t(t)).draw(),new MG.axis_factory(t).namespace("y").type(t.y_axis_type).zeroLine("categorical"===t.x_axis_type).position(t.y_axis_position).rug(bt(t)).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.markers=function(){return Ne(r),r.least_squares&&fr(r),this},this.mainPlot=function(){var t,a=R(r.target),n=e(r.data[0],r);a.selectAll(".mg-points").remove(),t=a.append("g").classed("mg-points",!0);var o=t.selectAll("circle").data(n).enter().append("circle").attr("class",function(t,e){return"path-"+e}).attr("cx",r.scalefns.xoutf).attr("cy",function(t){return r.scalefns.youtf(t)});return null!==r.color_accessor?(o.attr("fill",r.scalefns.colorf),o.attr("stroke",r.scalefns.colorf)):o.classed("mg-points-mono",!0),null!==r.size_accessor?o.attr("r",r.scalefns.sizef):o.attr("r",r.point_size),this},this.rollover=function(){var a=R(r.target);0===a.selectAll(".mg-active-datapoint-container").nodes().length&&k(a,"mg-active-datapoint-container"),a.selectAll(".mg-voronoi").remove();var n=t.voronoi().x(r.scalefns.xoutf).y(r.scalefns.youtf).extent([[r.buffer,r.buffer+r.title_y_position],[r.width-r.buffer,r.height-r.buffer]]),o=a.append("g").attr("class","mg-voronoi");return o.selectAll("path").data(n.polygons(e(r.data[0],r))).enter().append("path").attr("d",function(t){return null==t?null:"M"+t.join(",")+"Z"}).attr("class",function(t,e){return"path-"+e}).style("fill-opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)),1===r.data[0].length&&tr(r,a,r.data[0][0]),this},this.rolloverOn=function(e){var r=R(e.target);return function(a,n){r.selectAll(".mg-points circle").classed("selected",!1);var o=r.selectAll(".mg-points circle.path-"+n).classed("selected",!0);e.size_accessor?o.attr("r",function(t){return e.scalefns.sizef(t)+e.active_point_size_increase}):o.attr("r",e.point_size+e.active_point_size_increase),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseover")(a,n)})),e.show_rollover_text&&tr(e,r,a.data),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=R(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseout")(a,n)}));var o=r.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);e.size_accessor?o.attr("r",e.scalefns.sizef):o.attr("r",e.point_size),e.data[0].length>1&&Ie(r),e.mouseout&&e.mouseout(a,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.update=function(t){return this},this.windowListeners=function(){return Ke(this.args),this},this.init(r)}var a={y_padding_percentage:.05,y_outer_padding_percentage:.2,ygroup_padding_percentage:0,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.2,xgroup_padding_percentage:0,xgroup_outer_padding_percentage:0,y_categorical_show_guides:!0,x_categorical_show_guides:!0,buffer:16,ls:!1,lowess:!1,point_size:2.5,label_accessor:null,size_accessor:null,color_accessor:null,size_range:null,color_range:null,size_domain:null,color_domain:null,active_point_size_increase:1,color_type:"number"};MG.register("point",r,a)}.call(this),function(){"use strict";function e(e){if(e.legend_target){var r=t.select(e.legend_target).append("div").classed("mg-bar-target-legend",!0),a=e.categorical_variables;a.forEach(function(t){var a=r.append("span").classed("mg-bar-target-element",!0);a.append("span").classed("mg-bar-target-legend-shape",!0).style("color",e.scales.colorf(t)).text("◼ "),a.append("span").classed("mg-bar-target-legend-text",!0).text(t)})}}function r(t,e){var r=e.scales.Y.domain(),a=0,n=1.1,o=t.append("g").classed("mg-bar-legend",!0),i=o.append("text");i.selectAll("*").remove(),i.attr("width",e.right).attr("height",100).attr("text-anchor","start"),r.forEach(function(t){var r=i.append("tspan").attr("x",v(e)).attr("y",e.height/2).attr("dy",a*n+"em");r.append("tspan").text("■ ").attr("fill",e.scales.COLOR(t)).attr("font-size",20),r.append("tspan").text(t).attr("font-weight",300).attr("font-size",10),a++})}function a(a){this.args=a,this.init=function(t){this.args=t,t.x_axis_type=T(t,"x"),t.y_axis_type=T(t,"y"),"categorical"==t.x_axis_type?t.orientation="vertical":"categorical"==t.y_axis_type?t.orientation="horizontal":"categorical"!=t.x_axis_type&&"categorical"!=t.y_axis_type&&(t.orientation="vertical"),ar(t),ur(t),ze(t);var e,r;if("categorical"===t.x_axis_type?(e=MG.scale_factory(t).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,t.xgroup_height],null===t.xgroup_accessor),t.xgroup_accessor?new MG.scale_factory(t).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(t.scales.XGROUP=function(e){return x(t)},t.scalefns.xgroupf=function(e){return x(t)}),t.scalefns.xoutf=function(e){return t.scalefns.xf(e)+t.scalefns.xgroupf(e)}):(e=MG.scale_factory(t).namespace("x").inflateDomain(!0).zeroBottom("categorical"===t.y_axis_type).numericalDomainFromData((t.baselines||[]).map(function(e){return e[t.x_accessor]})).numericalRange("bottom"),t.scalefns.xoutf=t.scalefns.xf),"categorical"===t.y_axis_type)r=MG.scale_factory(t).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,t.ygroup_height],!0),t.ygroup_accessor?new MG.scale_factory(t).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(t.scales.YGROUP=function(){return g(t)},t.scalefns.ygroupf=function(e){return g(t)}),t.scalefns.youtf=function(e){return t.scalefns.yf(e)+t.scalefns.ygroupf(e)};else{var a=(t.baselines||[]).map(function(e){return e[t.y_accessor]});r=MG.scale_factory(t).namespace("y").inflateDomain(!0).zeroBottom("categorical"===t.x_axis_type).numericalDomainFromData(a).numericalRange("left"),t.scalefns.youtf=function(e){return t.scalefns.yf(e)}}return null!==t.ygroup_accessor&&(t.ycolor_accessor=t.y_accessor,MG.scale_factory(t).namespace("ycolor").scaleName("color").categoricalDomainFromData().categoricalColorRange()),null!==t.xgroup_accessor&&(t.xcolor_accessor=t.x_accessor,MG.scale_factory(t).namespace("xcolor").scaleName("color").categoricalDomainFromData().categoricalColorRange()),new MG.axis_factory(t).namespace("x").type(t.x_axis_type).zeroLine("categorical"===t.y_axis_type).position(t.x_axis_position).draw(),new MG.axis_factory(t).namespace("y").type(t.y_axis_type).zeroLine("categorical"===t.x_axis_type).position(t.y_axis_position).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t,n=R(a.target),o=a.data[0],i=n.select("g.mg-barplot"),s=i.empty(),c=s&&a.animate_on_load;c||a.transition_on_update,a.transition_duration||1e3;s&&(i=n.append("g").classed("mg-barplot",!0)),t=i.selectAll(".mg-bar").data(o).enter().append("rect").classed("mg-bar",!0).classed("default-bar",!a.scales.hasOwnProperty("COLOR"));var l,u,f,d,p,_,m,g,h,x,y,v,b,w;return"vertical"==a.orientation&&(l="height",u="width",f=a.y_axis_type,d=a.x_axis_type,p="y",_="x",m="categorical"==f?a.scalefns.youtf:a.scalefns.yf,g="categorical"==d?a.scalefns.xoutf:a.scalefns.xf,h=a.scales.Y,x=a.scales.X,y=a.y_accessor,v=a.x_accessor,b=function(t){var e;return e=m(t),t[y]<0&&(e=h(0)),e},w=function(t){return Math.abs(m(t)-h(0))}),"horizontal"==a.orientation&&(l="width",u="height",f=a.x_axis_type,d=a.y_axis_type,p="x",_="y",m="categorical"==f?a.scalefns.xoutf:a.scalefns.xf,g="categorical"==d?a.scalefns.youtf:a.scalefns.yf,h=a.scales.X,x=a.scales.Y,y=a.x_accessor,v=a.y_accessor,b=function(t){var e;return e=h(0)},w=function(t){return Math.abs(m(t)-h(0))}),t.attr(p,b),t.attr(_,function(t){var e;return"categorical"==d?e=g(t):(e=x(0),t[v]<0&&(e=g(t))),e-=a.bar_thickness/2}),a.scales.COLOR&&t.attr("fill",a.scalefns.colorf),t.attr(l,w).attr(u,function(t){return a.bar_thickness}),a.legend&&a.ygroup_accessor&&a.color_accessor!==!1&&a.ygroup_accessor!==a.color_accessor&&(a.legend_target?e(a):r(n,a)),this},this.markers=function(){return Ne(a),this},this.rollover=function(){var t,e=R(a.target);0===e.selectAll(".mg-active-datapoint-container").nodes().length&&k(e,"mg-active-datapoint-container"),e.selectAll(".mg-rollover-rect").remove(),e.selectAll(".mg-active-datapoint").remove();var r,n,o,i,s,c,l,u,f,d,p,_,m,h;"vertical"==a.orientation&&(r="height",n="width",o=a.y_axis_type,i=a.x_axis_type,s="y",c="x",l="categorical"==o?a.scalefns.youtf:a.scalefns.yf,u="categorical"==i?a.scalefns.xoutf:a.scalefns.xf,f=a.scales.Y,d=a.scales.X,p=a.y_accessor,_=a.x_accessor,m=function(t){return g(a)},h=function(t){return a.height-a.top-a.bottom-2*a.buffer;
}),"horizontal"==a.orientation&&(r="width",n="height",o=a.x_axis_type,i=a.y_axis_type,s="x",c="y",l="categorical"==o?a.scalefns.xoutf:a.scalefns.xf,u="categorical"==i?a.scalefns.youtf:a.scalefns.yf,f=a.scales.X,d=a.scales.Y,p=a.x_accessor,_=a.y_accessor,m=function(t){var e;return e=f(0)},h=function(t){return a.width-a.left-a.right-2*a.buffer});var x,y;"right"===a.rollover_align?(x=a.width-a.right,y="end"):"left"===a.rollover_align?(x=a.left,y="start"):(x=(a.width-a.left-a.right)/2+a.left,y="middle"),e.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",x).attr("y",.75*a.top).attr("dy",".35em").attr("text-anchor",y),t=e.append("g").attr("class","mg-rollover-rect");var v=t.selectAll(".mg-bar-rollover").data(a.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return v.attr("opacity",0).attr(s,m).attr(c,function(t){var e;return"categorical"==i?e=u(t):(e=d(0),t[_]<0&&(e=u(t))),e-=a.bar_thickness/2}),v.attr(r,h),v.attr(n,function(t){return a.bar_thickness}),v.on("mouseover",this.rolloverOn(a)).on("mouseout",this.rolloverOff(a)).on("mousemove",this.rolloverMove(a)),this},this.rolloverOn=function(e){var r=R(e.target);this.is_vertical?e.x_accessor:e.y_accessor,this.is_vertical?e.y_accessor:e.x_accessor,this.is_vertical?e.yax_units:e.xax_units;return function(a,n){var o=(MG.time_format(e.utc_time,"%b %e, %Y"),kr(e),r.selectAll("g.mg-barplot .mg-bar").filter(function(t,e){return e===n}).classed("active",!0));if(e.scales.hasOwnProperty("COLOR")?o.attr("fill",t.rgb(e.scalefns.colorf(a)).darker()):o.classed("default-active",!0),e.show_rollover_text){var i=Ze(e,{svg:r}),s=i.mouseover_row();e.ygroup_accessor&&s.text(a[e.ygroup_accessor]+" ").bold(),s.text(Gr(e,a)),s.text(e.y_accessor+": "+a[e.y_accessor]),(e.predictor_accessor||e.baseline_accessor)&&(s=i.mouseover_row(),e.predictor_accessor&&s.text(Mr(e,a,null,e.predictor_accessor,!1)),e.baseline_accessor&&s.text(Mr(e,a,null,e.baseline_accessor,!1)))}e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(t){var e=R(t.target);return function(r,a){var n=e.selectAll("g.mg-barplot .mg-bar.active").classed("active",!1);t.scales.hasOwnProperty("COLOR")?n.attr("fill",t.scalefns.colorf(r)):n.classed("default-active",!1),e.select(".mg-active-datapoint").text(""),Ie(e),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(a)}var n={y_padding_percentage:.05,y_outer_padding_percentage:.2,ygroup_padding_percentage:0,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.2,xgroup_padding_percentage:0,xgroup_outer_padding_percentage:0,buffer:16,y_accessor:"factor",x_accessor:"value",secondary_label_accessor:null,color_accessor:null,color_type:"category",color_domain:null,legend:!0,legend_target:null,mouseover_align:"right",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,show_bar_zero:!0,binned:!0,truncate_x_labels:!0,truncate_y_labels:!0};MG.register("bar",a,n)}.call(this),MG.data_table=function(r){"use strict";return this.args=r,this.args.standard_col={width:150,font_size:12,font_weight:"normal"},this.args.columns=[],this.formatting_options=[["color","color"],["font-weight","font_weight"],["font-style","font_style"],["font-size","font_size"]],this._strip_punctuation=function(t){var e=t.replace(/[^a-zA-Z0-9 _]+/g,""),r=e.replace(/ +?/g,"");return r},this._format_element=function(t,e,r){this.formatting_options.forEach(function(a){var n=a[0],o=a[1];r[o]&&t.style(n,"string"==typeof r[o]||"number"==typeof r[o]?r[o]:r[o](e))})},this._add_column=function(t,e){var r=this.args.standard_col,a=U(MG.clone(t),MG.clone(r));a.type=e,this.args.columns.push(a)},this.target=function(){var t=arguments[0];return this.args.target=t,this},this.title=function(){return this._add_column(arguments[0],"title"),this},this.text=function(){return this._add_column(arguments[0],"text"),this},this.bullet=function(){return this},this.sparkline=function(){return this},this.number=function(){return this._add_column(arguments[0],"number"),this},this.display=function(){var r=this.args;V(r);var a,n,o,i,s,c,l,u,f,d,p,_,m=r.target,g=t.select(m).append("table").classed("mg-data-table",!0),h=g.append("colgroup"),x=g.append("thead"),y=g.append("tbody");for(o=x.append("tr"),_=0;_<r.columns.length;_++){var v=r.columns[_];c=v.type,u=v.label,u=void 0===u?"":u,i=o.append("th").style("width",v.width).style("text-align","title"===c?"left":"right").text(u),r.show_tooltips&&v.description&&e()&&(i.append("i").classed("fa",!0).classed("fa-question-circle",!0).classed("fa-inverse",!0),$(i.node()).popover({html:!0,animation:!1,content:v.description,trigger:"hover",placement:"top",container:$(i.node())}))}for(_=0;_<r.columns.length;_++)p=h.append("col"),"number"===r.columns[_].type&&p.attr("align","char").attr("char",".");for(var b=0;b<r.data.length;b++){o=y.append("tr");for(var w=0;w<r.columns.length;w++){if(a=r.columns[w],s=a.accessor,l=f=r.data[b][s],c=a.type,"number"===c){if(a.hasOwnProperty("round")&&!a.hasOwnProperty("format")&&(f=t.format("0,."+a.round+"f")(f)),a.hasOwnProperty("value_formatter")&&(f=a.value_formatter(f)),a.hasOwnProperty("format")){a.round&&(f=Math.round(f,a.round));var k,M=a.format;"percentage"===M&&(k=t.format(".0%")),"count"===M&&(k=t.format(",.0f")),"temperature"===M&&(k=function(t){return t+"°"}),f=k(f)}a.hasOwnProperty("currency")&&(f=a.currency+f)}d=o.append("td").classed("table-"+c,!0).classed("table-"+c+"-"+this._strip_punctuation(s),!0).attr("data-value",l).style("width",a.width).style("text-align","title"===c||"text"===c?"left":"right"),this._format_element(d,l,a),"title"===c?(n=d.append("div").text(f),this._format_element(n,f,a),r.columns[w].hasOwnProperty("secondary_accessor")&&d.append("div").text(r.data[b][r.columns[w].secondary_accessor]).classed("secondary-title",!0)):d.text(f)}}return this},this},function(){"use strict";function e(t,e){t.selectAll(".mg-missing-text").data([e.missing_text]).enter().append("text").attr("class","mg-missing-text").attr("x",e.width/2).attr("y",e.height/2).attr("dy",".50em").attr("text-anchor","middle").text(e.missing_text)}function r(e){e.scales.X=t.scaleLinear().domain([0,e.data.length]).range([x(e),v(e)]),e.scalefns.yf=function(t){return e.scales.Y(t.y)}}function a(e){e.scales.Y=t.scaleLinear().domain([-2,2]).range([e.height-e.bottom-2*e.buffer,e.top]),e.scalefns.xf=function(t){return e.scales.X(t.x)}}function n(t){for(var e=[],r=1;r<=50;r++)e.push({x:r,y:Math.random()-.03*r});t.data=e}function o(t,e){t.append("svg:rect").classed("mg-missing-background",!0).attr("x",e.buffer).attr("y",e.buffer).attr("width",e.width-2*e.buffer).attr("height",e.height-2*e.buffer).attr("rx",15).attr("ry",15)}function i(e,r){var a=t.line().x(r.scalefns.xf).y(r.scalefns.yf).curve(r.interpolate);e.append("path").attr("class","mg-main-line mg-line1-color").attr("d",a(r.data))}function s(e,r){var a=t.area().x(r.scalefns.xf).y0(r.scales.Y.range()[0]).y1(r.scalefns.yf).curve(r.interpolate);e.append("path").attr("class","mg-main-area mg-area1-color").attr("d",a(r.data))}function c(e){t.select(e.target).selectAll("svg *").remove()}function l(e){e.legend_target&&t.select(e.legend_target).html("")}function u(u){this.init=function(u){this.args=u,_e(u),me(u),V(u);var f=t.select(u.target);ke(f,u);var d=f.selectAll("svg");if(ge(d,u),d=he(d,u),ye(d,u),ve(d,u),c(u),d.classed("mg-missing",!0),l(u),u.show_missing_background){n(u),r(u),a(u);var p=k(d,"mg-missing-pane");o(p,u),i(p,u),s(p,u)}return e(d,u),this.windowListeners(),this},this.windowListeners=function(){return Ke(this.args),this},this.init(u)}var f={top:40,bottom:30,right:10,left:0,buffer:8,legend_target:"",width:350,height:220,missing_text:"Data currently missing or unavailable",scalefns:{},scales:{},show_tooltips:!0,show_missing_background:!0};MG.register("missing-data",u,f)}.call(this),MG.raw_data_transformation=ar,MG.process_line=sr,MG.process_histogram=cr,MG.process_categorical_variables=lr,MG.process_point=ur,MG.add_ls=fr,MG.add_lowess=dr,MG.lowess_robust=pr,MG.lowess=_r,MG.least_squares=mr;var Yr=function(t,e,r,a){var n;return n="string"==typeof t?MG.time_format(a,t)(e[r]):"function"==typeof t?t(e):e[r]},$r=function(e,r,a){var n;return n="string"==typeof e?t.format("s")(r[a]):"function"==typeof e?e(r):r[a]};return MG.format_rollover_number=kr,MG.path_tween=Or,MG.error=Fr,MG});