!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(E){"use strict";var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function k(){return"undefined"!=typeof jQuery||"undefined"!=typeof $}function i(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 u(t){return"[object Array]"===Object.prototype.toString.call(t)}function a(t){var e=t.map(function(t){return!0===u(t)&&0r.right||n.rightr&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function j(t){var e=O(t.target);if(e.select(".mg-header").remove(),t.target&&t.title){var r=e.insert("text").attr("class","mg-header").attr("x",t.center_title_full_width?t.width/2:(t.width+t.left-t.right)/2).attr("y",t.title_y_position).attr("text-anchor","middle").attr("dy","0.55em");if(r.append("tspan").attr("class","mg-chart-title").text(t.title),t.show_tooltips&&t.description&&k()){r.append("tspan").attr("class","mg-chart-description").attr("dx","0.3em").text("");var a=$(r.node());a.popover({html:!0,animation:!1,placement:"top",content:t.description,container:t.target,trigger:"manual",template:'

'}).on("mouseenter",function(){E.selectAll(t.target).selectAll(".mg-popover").remove(),$(this).popover("show"),$(E.select(t.target).select(".popover").node()).on("mouseleave",function(){a.popover("hide")})}).on("mouseleave",function(){setTimeout(function(){$(".popover:hover").length||a.popover("hide")},120)})}else t.show_tooltips&&t.description&&"undefined"==typeof $&&(t.error="In order to enable tooltips, please make sure you include jQuery.")}t.error&&Xe(t)}function X(e,t,r,a,n){e.scalefns[t]=function(t){return void 0===n?e.scales[r](t[a]):e.scales[r](t[a])+n}}function U(t,e){return"bottom"===t||"top"===t?[Y(e),P(e)]:"left"===t||"right"===t?[v(e),e.top]:void 0}function N(t,e){return E.set(t.map(function(t){return t[e]})).values()}function B(e){var t;return null===e.color_domain?"number"===e.color_type?t=E.extent(e.data[0],function(t){return t[e.color_accessor]}):"category"===e.color_type&&(t=N(e.data[0],e.color_accessor)):t=e.color_domain,t}function I(t){return null===t.color_range?"number"===t.color_type?["blue","red"]:null:t.color_range}function H(t,e,r){var a=xt(t),n=a.secondary(t.processed.min_x,t.processed.max_x);0===n.length&&(n=[t.scales.X.ticks(t.xax_count)[0]]);var o,i,s,c=S(r,"mg-year-marker");"default"===a.timeframe&&t.show_year_markers&&(o=t,i=c,s=n,a.yformat,i.selectAll(".mg-year-marker").data(s).enter().append("line").attr("x1",function(t){return o.scales.X(t).toFixed(2)}).attr("x2",function(t){return o.scales.X(t).toFixed(2)}).attr("y1",M(o)).attr("y2",w(o))),"years"!=a.tick_diff_timeframe&&function(t,e,r,a,n){var o,i,s,c,l,u=e.position,d=e.namespace,f=t.scales[d.toUpperCase()],p=E.select(t.target).select(".mg-x-axis text").node().getBoundingClientRect();"top"===u&&(o=function(t,e){return f(t).toFixed(2)},i=M(t)-7*t.xax_tick_length/3-p.height,s=".50em",c="middle",l=function(t){return n(new Date(t))});"bottom"===u&&(o=function(t,e){return f(t).toFixed(2)},i=w(t)+7*t.xax_tick_length/3+.8*p.height,s=".50em",c="middle",l=function(t){return n(new Date(t))});r.selectAll(".mg-year-marker").data(a).enter().append("text").attr("x",o).attr("y",i).attr("dy",s).attr("text-anchor",c).text(l)}(t,e,c,n,a.yformat)}function q(t,a,e){var r,n,o,i,s,c,l,u=e.namespace,d=(r=a,o=(n=e).position,i=n.namespace,s=r[i+"ax_tick_length"],c=r.scales[i.toUpperCase()],l={},"left"===o&&(l.x=G(r)-3*s/2,l.y=function(t){return c(t).toFixed(2)},l.dx=-3,l.dy=".35em",l.textAnchor="end",l.text=function(t){return J(r)(t)}),"right"===o&&(l.x=A(r)+3*s/2,l.y=function(t){return c(t).toFixed(2)},l.dx=3,l.dy=".35em",l.textAnchor="start",l.text=function(t){return J(r)(t)}),"top"===o&&(l.x=function(t){return c(t).toFixed(2)},l.y=(M(r)-7*s/3).toFixed(2),l.dx=0,l.dy="0em",l.textAnchor="middle",l.text=function(t){return ht(r)(t)}),"bottom"===o&&(l.x=function(t){return c(t).toFixed(2)},l.y=(w(r)+7*s/3).toFixed(2),l.dx=0,l.dy=".50em",l.textAnchor="middle",l.text=function(t){return ht(r)(t)}),l),f=a.processed[u+"_ticks"],p=t.selectAll(".mg-yax-labels").data(f).enter().append("text").attr("x",d.x).attr("dx",d.dx).attr("y",d.y).attr("dy",d.dy).attr("text-anchor",d.textAnchor).text(d.text);("x"==u&&(a.time_series&&a.european_clock?(p.append("tspan").classed("mg-european-hours",!0).text(function(t,e){var r=new Date(t);return 0===e?E.timeFormat("%H")(r):""}),p.append("tspan").classed("mg-european-minutes-seconds",!0).text(function(t,e){var r=new Date(t);return":"+a.processed.xax_format(r)})):p.text(function(t){return a.xax_units+a.processed.xax_format(t)}),a.time_series&&(a.show_years||a.show_secondary_x_label)&&H(a,e,t)),g(p))&&(p.filter(function(t,e){return(e+1)%2==0}).remove(),O(a.target).selectAll(".mg-"+u+"ax-ticks").filter(function(t,e){return(e+1)%2==0}).remove())}function V(t,e,r){var a,n,o,i,s,c,l,u,d=r.namespace,f=e.processed[d+"_ticks"].length,p=(a=e,o=(n=r).namespace,i=n.position,s=a.processed[o+"_ticks"].length,c=a.processed[o+"_ticks"],l=a.scales[o.toUpperCase()],u={},"left"===i&&(u.x1=G(a),u.x2=G(a),u.y1=l(c[0]).toFixed(2),u.y2=l(c[s-1]).toFixed(2)),"right"===i&&(u.x1=A(a),u.x2=A(a),u.y1=l(c[0]).toFixed(2),u.y2=l(c[s-1]).toFixed(2)),"top"===i&&(u.x1=G(a),u.x2=A(a),u.y1=M(a),u.y2=M(a)),"bottom"===i&&(u.x1=G(a),u.x2=A(a),u.y1=w(a),u.y2=w(a)),"left"!==i&&"right"!==i||(a.axes_not_compact?(u.y1=w(a),u.y2=M(a)):s&&(u.y1=l(c[0]).toFixed(2),u.y2=l(c[s-1]).toFixed(2))),u);e[d+"_extended_ticks"]||e[d+"_extended_ticks"]||!f||t.append("line").attr("x1",p.x1).attr("x2",p.x2).attr("y1",p.y1).attr("y2",p.y2)}function W(t,e){t.rug_buffer_size="point"===t.chart_type?t.buffer/2:2*t.buffer/3;var r,a,n,o,i,s,c,l,u,d,f=(r=t,a="mg-"+e.namespace+"-rug",n=O(r.target),o=h(r.data),(i=n.selectAll("line."+a).data(o)).enter().append("svg:line").attr("class",a).attr("opacity",.3),_(i),_(i),i),p=(s=t,l=(c=e).position,u=c.namespace,d={},"left"===l&&(d.x1=G(s)+1,d.x2=G(s)+s.rug_buffer_size,d.y1=s.scalefns[u+"f"],d.y2=s.scalefns[u+"f"]),"right"===l&&(d.x1=A(s)-1,d.x2=A(s)-s.rug_buffer_size,d.y1=s.scalefns[u+"f"],d.y2=s.scalefns[u+"f"]),"top"===l&&(d.x1=s.scalefns[u+"f"],d.x2=s.scalefns[u+"f"],d.y1=M(s)+1,d.y2=M(s)+s.rug_buffer_size),"bottom"===l&&(d.x1=s.scalefns[u+"f"],d.x2=s.scalefns[u+"f"],d.y1=w(s)-1,d.y2=w(s)-s.rug_buffer_size),d);f.attr("x1",p.x1).attr("x2",p.x2).attr("y1",p.y1).attr("y2",p.y2),m(f,t,"mg-"+e.namespace+"-rug-mono")}function Q(p,_){var m=_.namespace,t="mg-"+m+"-axis",g=p.scales[m.toUpperCase()],e=p.scales[(m+"group").toUpperCase()],h=m+"group_accessor",r=O(p.target);D(r,"."+t);var x,y=S(r,t);(e.domain&&e.domain()?e.domain():["1"]).forEach(function(t){var e,r,a,n,o,i,s,c,l,u,d=(e=p,a=t,n=(r=_).namespace,o=r.position,i=e.scales[n.toUpperCase()],s=e.scales[(n+"group").toUpperCase()],c={cat:{},group:{}},"left"===o&&(c.cat.x=Y(e)-e.buffer,c.cat.y=function(t){return s(a)+i(t)+i.bandwidth()/2},c.cat.dy=".35em",c.cat.textAnchor="end",c.group.x=Y(e)-e.buffer,c.group.y=s(a)+(s.bandwidth?s.bandwidth()/2:0),c.group.dy=".35em",c.group.textAnchor=(e["rotate_"+n+"_labels"],"end")),"right"===o&&(c.cat.x=P(e)-e.buffer,c.cat.y=function(t){return s(a)+i(t)+i.bandwidth()/2},c.cat.dy=".35em",c.cat.textAnchor="start",c.group.x=P(e)-e.buffer,c.group.y=s(a)+(s.bandwidth?s.bandwidth()/2:0),c.group.dy=".35em",c.group.textAnchor="start"),"top"===o&&(c.cat.x=function(t){return s(a)+i(t)+i.bandwidth()/2},c.cat.y=b(e)+e.buffer,c.cat.dy=".35em",c.cat.textAnchor=e["rotate_"+n+"_labels"]?"start":"middle",c.group.x=s(a)+(s.bandwidth?s.bandwidth()/2:0),c.group.y=b(e)+e.buffer,c.group.dy=".35em",c.group.textAnchor=e["rotate_"+n+"_labels"]?"start":"middle"),"bottom"===o&&(c.cat.x=function(t){return s(a)+i(t)+i.bandwidth()/2},c.cat.y=v(e)+e.buffer,c.cat.dy=".35em",c.cat.textAnchor=e["rotate_"+n+"_labels"]?"start":"middle",c.group.x=s(a)+(s.bandwidth?s.bandwidth()/2-i.bandwidth()/2:0),c.group.y=v(e)+e.buffer,c.group.dy=".35em",c.group.textAnchor=e["rotate_"+n+"_labels"]?"start":"middle"),c);if(x=S(y,"mg-group-"+F(t)),null!==p[h])var f=x.append("text").classed("mg-barplot-group-label",!0).attr("x",d.group.x).attr("y",d.group.y).attr("dy",d.group.dy).attr("text-anchor",d.group.textAnchor).text(t);else f=x.selectAll("text").data(g.domain()).enter().append("text").attr("x",d.cat.x).attr("y",d.cat.y).attr("dy",d.cat.dy).attr("text-anchor",d.cat.textAnchor).text(String);p["rotate_"+m+"_labels"]&&(l=f,(u=p["rotate_"+m+"_labels"])&&l.attr("transform",function(){var t=E.select(this);return"rotate("+u+" "+t.attr("x")+","+t.attr("y")+")"}))})}MG.merge_with_defaults=p,MG.clone=function(t){var e,r;if(null===t||"object"!==(void 0===t?"undefined":c(t)))return t;if(x(t))return(e=new Date).setTime(t.getTime()),e;if(y(t)){e=[];for(var a=0,n=t.length;ai)&&(a.pop(),o.text(a.join(" ")),a=[t],o=e.append("tspan").attr("x",0).attr("y",1.1*++n+0+"em").attr(c||{}).text(t))})},MG.register=function(t,e,r){MG.charts[t]={descriptor:e,defaults:r||{}}},MG._hooks={},MG.add_hook=function(t,e,r){var a;if(MG._hooks[t]||(MG._hooks[t]=[]),0<(a=MG._hooks[t]).filter(function(t){return t.func===e}).length)throw"That function is already registered.";a.push({func:e,context:r})},MG.call_hook=function(t){var r,e=MG._hooks[t],a=[].slice.apply(arguments,[1]);return e&&e.forEach(function(t){if(t.func){var e=r||a;e&&e.constructor!==Array&&(e=[e]),e=[].concat.apply([],e),r=t.func.apply(t.context,e)}}),r||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(t){var e={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,active_point_on_lines:!1,active_point_accessor:"active",active_point_size:2,points_always_visible:!1,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,flip_area_under_y_value:null,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:E.curveCatmullRom.alpha(0),custom_line_color_map:[],colors:null,max_data_size:null,aggregate_rollover:!1,show_tooltips:!0,showActivePoint:!0,brush:null,zoom_target:null,brushing_selection_changed:null};MG.call_hook("global.defaults",e),t||(t={});var r=MG.charts[t.chart_type||e.chart_type];for(var a in p(t,r.defaults,e),t.list&&(t.x_accessor=0,t.y_accessor=1),MG.deprecations)if(t.hasOwnProperty(a)){var n=MG.deprecations[a],o="Use of `args."+a+"` has been deprecated",i=n.replacement;if(i&&(t[i]?o+=". The replacement - `args."+i+"` - has already been defined. This definition will be discarded.":t[i]=t[a]),n.warned)continue;n.warned=!0,i&&(o+=" in favor of `args."+i+"`"),R(o,n.version)}return MG.call_hook("global.before_init",t),new r.descriptor(t),t.data},k()&&(function(m){var g=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)};g.VERSION="3.3.5",g.TRANSITION_DURATION=150,g.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},g.prototype.init=function(t,e,r){if(this.enabled=!0,this.type=t,this.$element=m(e),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&m(m.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 a=this.options.trigger.split(" "),n=a.length;n--;){var o=a[n];if("click"==o)this.$element.on("click."+this.type,this.options.selector,m.proxy(this.toggle,this));else if("manual"!=o){var i="hover"==o?"mouseenter":"focusin",s="hover"==o?"mouseleave":"focusout";this.$element.on(i+"."+this.type,this.options.selector,m.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,m.proxy(this.leave,this))}}this.options.selector?this._options=m.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},g.prototype.getDefaults=function(){return g.DEFAULTS},g.prototype.getOptions=function(t){return(t=m.extend({},this.getDefaults(),this.$element.data(),t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},g.prototype.getDelegateOptions=function(){var r={},a=this.getDefaults();return this._options&&m.each(this._options,function(t,e){a[t]!=e&&(r[t]=e)}),r},g.prototype.enter=function(t){var e=t instanceof this.constructor?t:m(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),m(t.currentTarget).data("bs."+this.type,e)),t instanceof m.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},g.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},g.prototype.leave=function(t){var e=t instanceof this.constructor?t:m(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),m(t.currentTarget).data("bs."+this.type,e)),t instanceof m.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},g.prototype.show=function(){var t=m.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=m.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var r=this,a=this.tip(),n=this.getUID(this.type);this.setContent(),a.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&a.addClass("fade");var o="function"==typeof this.options.placement?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,s=i.test(o);s&&(o=o.replace(i,"")||"top"),a.detach().css({top:0,left:0,display:"block"}).addClass(o).data("bs."+this.type,this),this.options.container?a.appendTo(this.options.container):a.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var c=this.getPosition(),l=a[0].offsetWidth,u=a[0].offsetHeight;if(s){var d=o,f=this.getPosition(this.$viewport);o="bottom"==o&&c.bottom+u>f.bottom?"top":"top"==o&&c.top-uf.width?"left":"left"==o&&c.left-li.top+i.height&&(n.top=i.top+i.height-c)}else{var l=e.left-o,u=e.left+o+r;li.right&&(n.left=i.left+i.width-u)}return n},g.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},g.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},g.prototype.tip=function(){if(!this.$tip&&(this.$tip=m(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},g.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},g.prototype.enable=function(){this.enabled=!0},g.prototype.disable=function(){this.enabled=!1},g.prototype.toggleEnabled=function(){this.enabled=!this.enabled},g.prototype.toggle=function(t){var e=this;t&&((e=m(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),m(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},g.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 t=m.fn.tooltip;m.fn.tooltip=function(a){return this.each(function(){var t=m(this),e=t.data("bs.tooltip"),r="object"==(void 0===a?"undefined":c(a))&&a;!e&&/destroy|hide/.test(a)||(e||t.data("bs.tooltip",e=new g(this,r)),"string"==typeof a&&e[a]())})},m.fn.tooltip.Constructor=g,m.fn.tooltip.noConflict=function(){return m.fn.tooltip=t,this}}(jQuery),function(n){var o=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");o.VERSION="3.3.5",o.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),((o.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=o).prototype.getDefaults=function(){return o.DEFAULTS},o.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()},o.prototype.hasContent=function(){return this.getTitle()||this.getContent()},o.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)},o.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function(a){return this.each(function(){var t=n(this),e=t.data("bs.popover"),r="object"==(void 0===a?"undefined":c(a))&&a;!e&&/destroy|hide/.test(a)||(e||t.data("bs.popover",e=new o(this,r)),"string"==typeof a&&e[a]())})},n.fn.popover.Constructor=o,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery)),MG.chart_title=j,MG.scale_factory=function(o){var i={use_inflator:!1,zero_bottom:!1,scaleType:"numerical"};return this.namespace=function(t){return i.namespace=t,i.namespace_accessor_name=i.namespace+"_accessor",i.scale_name=i.namespace.toUpperCase(),i.scalefn_name=i.namespace+"f",this},this.scaleName=function(t){return i.scale_name=t.toUpperCase(),i.scalefn_name=t+"f",this},this.inflateDomain=function(t){return i.use_inflator=t,this},this.zeroBottom=function(t){return i.zero_bottom=t,this},this.numericalDomainFromData=function(){var t,e=[];0=e.data.length)if(0=Y(e)&&e.scales.X(t[e.x_accessor])<=P(e)}}function Ct(e){return function(t){return e.scales.X(t[e.x_accessor])}}function Tt(t){var e=t.scales.Y;return function(t){return e(t.value).toFixed(2)}}function Rt(t,e,r,a,n,o){var i;t&&(n(i=a.append("g").attr("class",e),r),o(i,r))}function Et(t,e){var r,a=(r=Ct(e),function(t){return r(t).toFixed(2)});t.selectAll(".mg-markers").data(e.markers.filter(Ft(e))).enter().append("line").attr("x1",a).attr("x2",a).attr("y1",e.top).attr("y2",v(e)).attr("class",function(t){return t.lineclass}).attr("stroke-dasharray","3,1")}function Yt(t,e){t.selectAll(".mg-markers").data(e.markers.filter(Ft(e))).enter().append("text").attr("class",function(t){return t.textclass||""}).classed("mg-marker-text",!0).attr("x",Ct(e)).attr("y","bottom"===e.x_axis_position?.95*M(e):w(e)+e.buffer).attr("text-anchor","middle").text(zt).each(function(t){t.click&&E.select(this).style("cursor","pointer").on("click",t.click),t.mouseover&&E.select(this).style("cursor","pointer").on("mouseover",t.mouseover),t.mouseout&&E.select(this).style("cursor","pointer").on("mouseout",t.mouseout)}),function(t,e){if(t&&1!=t.length)for(var r=0;r=e.top&&(n=e.top-16),a.attr("y",n)}}(t.selectAll(".mg-marker-text").nodes(),e)}function $t(t,e){var r=Tt(e);t.selectAll(".mg-baselines").data(e.baselines).enter().append("line").attr("x1",Y(e)).attr("x2",P(e)).attr("y1",r).attr("y2",r)}function Pt(t,e){var r=Tt(e);t.selectAll(".mg-baselines").data(e.baselines).enter().append("text").attr("x",P(e)).attr("y",r).attr("dy",-3).attr("text-anchor","end").text(zt)}function St(t){var e,r,a,n,o,i=O(t.target);return(e=i).selectAll(".mg-markers").remove(),e.selectAll(".mg-baselines").remove(),a=i,Rt((r=t).markers,"mg-markers",r,a,Et,Yt),o=i,Rt((n=t).baselines,"mg-baselines",n,o,$t,Pt),this}function Lt(t){t.selectAll(".mg-active-datapoint-container").selectAll("*").remove()}function jt(t,e){t.select(".mg-active-datapoint").remove();var r,a="right"===e.mouseover_align?"end":"left"===e.mouseover_align?"start":"middle",n="right"===e.mouseover_align?P(e):"left"===e.mouseover_align?Y(e):(e.width-e.left-e.right)/2+e.left,o=t.select(".mg-active-datapoint-container").append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("text-anchor",a),i=.75,s="bottom"===e.x_axis_position?M(e)*i:w(e)+3*e.buffer;e.markers&&t.selectAll(".mg-marker-text").each(function(){r?r!==E.select(this).attr("y")&&(i=.56):r=E.select(this).attr("y")});o.attr("transform","translate("+n+","+s+")")}function Xt(t,e){jt(e.svg,t);var r,a,o={row_number:0,rargs:e,mouseover_row:function(t){return o.row_number+=1,e=o.row_number,r=o.text_container,a=t,n=r.append("tspan").attr("x",0).attr("y",1.1*e+"em"),{rargs:a,text:function(t){return e=t,{bold:function(){return r.attr("font-weight","bold")},font_size:function(t){return r.attr("font-size",t)},x:function(t){return r.attr("x",t)},y:function(t){return r.attr("y",t)},elem:r=n.append("tspan").text(e)};var e,r}};var e,r,a,n},text_container:(r=e.svg,a=r.select(".mg-active-datapoint"),a.selectAll("*").remove(),a)};return o}Z.categorical=function(t,e){e.namespace;Q(t,e),function(d,t){var f,p,_,m,e=t.namespace,g=(d.scalefns[e+"f"],d.scalefns[e+"groupf"],d.scales[(e+"group").toUpperCase()]),h=d.scales[e.toUpperCase()],x=t.position,r=O(d.target),a=g.domain&&g.domain()?g.domain():[null];D(r,".mg-category-guides");var y=S(r,"mg-category-guides");a.forEach(function(e){h.domain().forEach(function(t){"left"!==x&&"right"!==x||(f=Y(d),p=P(d),_=h(t)+g(e)+h.bandwidth()/2,m=h(t)+g(e)+h.bandwidth()/2),"top"!==x&&"bottom"!==x||(f=h(t)+g(e)+h.bandwidth()/2*(null===e),p=h(t)+g(e)+h.bandwidth()/2*(null===e),_=v(d),m=b(d)),y.append("line").attr("x1",f).attr("x2",p).attr("y1",_).attr("y2",m).attr("stroke-dasharray","2,1")});var t,r,a,n,o,i,s,c,l=g(e)+h(h.domain()[0])+h.bandwidth()/2*(null===e||"top"!==x&&"bottom"!=x),u=g(e)+h(h.domain()[h.domain().length-1])+h.bandwidth()/2*(null===e||"top"!==x&&"bottom"!=x);"left"!==x&&"right"!==x||(t=Y(d),r=Y(d),a=l,n=u,o=P(d),i=P(d),s=l,c=u),"bottom"!==x&&"top"!==x||(t=l,r=u,a=v(d),n=v(d),o=l,i=u,s=b(d),c=b(d)),y.append("line").attr("x1",t).attr("x2",r).attr("y1",a).attr("y2",n).attr("stroke-dasharray","2,1"),y.append("line").attr("x1",o).attr("x2",i).attr("y1",s).attr("y2",c).attr("stroke-dasharray","2,1")})}(t,e)},Z.numerical=function(t,e){var r=e.namespace,a=r+"_axis",n="mg-"+r+"-axis",o=O(t.target);if(D(o,"."+n),!t[a])return this;var i,s,c,l,u,d,f,p,_,m,g,h,x,y,v,b=S(o,n);return function(t,e){var r=t[e+"_accessor"],a=t.scales[e.toUpperCase()].ticks(t[e+"ax_count"]),n=t.processed["max_"+e];function o(t){return 1e3===t?3:1e6===t?7:Math.log(t)/Math.LN10}"log"===t[e+"_scale_type"]&&(a=a.filter(function(t){return Math.abs(o(t))%1<1e-6||Math.abs(o(t))%1>1-1e-6}));var i=a.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[r]%1!=0)return s=!1})}),s&&nMath.min(r[0],r[1])&&e').insertAfter(s(this)).on("click",o);var n={relatedTarget:this};if(r.trigger(t=s.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),r.toggleClass("open").trigger("shown.bs.dropdown",n)}return!1}},a.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=s(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var r=l(e),a=r.hasClass("open");if(!a&&27!=t.which||a&&27==t.which)return 27==t.which&&r.find(c).trigger("focus"),e.trigger("click");var n=" li:not(.divider):visible a",o=r.find('[role="menu"]'+n+', [role="listbox"]'+n);if(o.length){var i=o.index(t.target);38==t.which&&0");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 d in this.feature_set){for(r=this.feature_set[d],$(this.target+" div.segments").append('
"),s=0;s'+r[s]+"");$("."+this._strip_punctuation(d)+"-btns .dropdown-menu li a").on("click",u)}return this},this};var Zt=function(t,e,r){var a=e.line_id,n=r.color,o=r.colors;t.classed("mg-hover-line-color",null===n).classed("mg-hover-line"+a+"-color",null===o).attr("fill",null===o?"":o[a-1])},Kt=function(r,t,e){t.existing_band=e.selectAll(".mg-confidence-band").nodes(),r.show_confidence_band&&(t.confidence_area=E.area().defined(t.line.defined()).x(r.scalefns.xf).y0(function(t){var e=r.show_confidence_band[0];return null!=t[e]?r.scales.Y(t[e]):r.scales.Y(t[r.y_accessor])}).y1(function(t){var e=r.show_confidence_band[1];return null!=t[e]?r.scales.Y(t[e]):r.scales.Y(t[r.y_accessor])}).curve(r.interpolate))},Jt=function(t,e){var r=t.scalefns,a=t.scales,n=t.interpolate,o=t.flip_area_under_y_value,i=Number.isFinite(o)?a.Y(o):a.Y.range()[0];e.area=E.area().defined(e.line.defined()).x(r.xf).y0(function(){return i}).y1(r.yf).curve(n)},te=function(t,e){var r=t.y_accessor,a=t.scalefns,n=t.scales,o=t.interpolate;e.flat_line=E.line().defined(function(t){return(void 0===t._missing||!0!==t._missing)&&null!==t[r]}).x(a.xf).y(function(){return n.Y(e.data_median)}).curve(o)},ee=function(t,e){var r=t.scalefns,a=t.interpolate,n=t.missing_is_zero,o=t.y_accessor;e.line=E.line().x(r.xf).y(r.yf).curve(a),n||(e.line=e.line.defined(function(t){return(void 0===t._missing||!0!==t._missing)&&null!==t[o]}))},re=function(t,e,r,a){var n=t.show_confidence_band,o=t.transition_on_update,i=t.data,s=t.target;if(n){r.select(".mg-confidence-band-"+a).empty()&&r.append("path").attr("class","mg-confidence-band mg-confidence-band-"+a),r.select(".mg-confidence-band-"+a).transition().duration(function(){return o?1e3:0}).attr("d",e.confidence_area(i[a-1])).attr("clip-path","url(#mg-plot-window-"+z(s)+")")}},ae=function(t,e,r,a,n){var o=t.data,i=t.target,s=t.colors,c=r.selectAll(".mg-main-area.mg-area"+n);e.display_area?c.empty()?r.append("path").classed("mg-main-area",!0).classed("mg-area"+n,!0).classed("mg-area-color",null===s).classed("mg-area"+n+"-color",null===s).attr("d",e.area(o[a])).attr("fill",null===s?"":s[n-1]).attr("clip-path","url(#mg-plot-window-"+z(i)+")"):(r.node().appendChild(c.node()),c.transition().duration(e.update_transition_duration).attr("d",e.area(o[a])).attr("clip-path","url(#mg-plot-window-"+z(i)+")")):c.empty()||c.remove()},ne=function(t,e){t.classed("mg-line-color",!0).classed("mg-line"+e+"-color",!0)},oe=function(t,e,r,a,n,o){if(a.empty()){var i=r.append("path").attr("class","mg-main-line mg-line"+o);g=i,h=n,x=o,(y=t.colors)&&y.constructor===Array?(g.attr("stroke",y[h]),y.length— "+o+"  "+e.legend_text:e.legend_text="— "+o+"  "+e.legend_text;else{var i=void 0,s=void 0,c=void 0;"left"===t.y_axis_position?(i=t.data[r][t.data[r].length-1],s="start",c=t.buffer):(i=t.data[r][0],s="end",c=-t.buffer);var l=e.legend_group.append("svg:text").attr("x",t.scalefns.xf(i)).attr("dx",c).attr("y",t.scalefns.yf(i)).attr("dy",".35em").attr("font-size",10).attr("text-anchor",s).attr("font-weight","300").text(o);t.colors&&t.colors.constructor===Array?t.colors.length=f.top&&f.bottom-d.top)&&a!==n){var s=E.select(t[o]),c=+s.attr("y");c+=r,s.attr("y",c)}}}var l,u,d,f}(e.legend_group.selectAll(".mg-line-legend text").nodes())}},se=function(e,t,r,a,n,o){var i,s,c,l=E.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?e.title_y_position:0)],[e.width-e.buffer,e.height-e.buffer]]);S(t,"mg-voronoi").selectAll("path").data(l.polygons((s=e,c=s.data,E.merge(c)))).enter().append("path").filter(function(t){return void 0!==t&&0e.selectAll(".mg-main-line").node().length&&e.selectAll(".mg-confidence-band").remove()},he=function(t){var e,r,a,n,o,i,s,c={},l=O(t.target);D(l,".mg-line-legend"),e=c,r=l,t.legend&&(e.legend_group=S(r,"mg-line-legend")),c.data_median=0,c.update_transition_duration=t.transition_on_update?1e3:0,c.display_area=t.area&&!t.use_data_y_min&&t.data.length<=1&&!1===t.aggregate_rollover||Array.isArray(t.area)&&0=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)})};MG.register("point",function(a){var o=this;this.init=function(e){if((this.args=e).x_axis_type=s(e,"x"),e.y_axis_type=s(e,"y"),Me(e),Oe(e),Ot(e),"categorical"===e.x_axis_type?(MG.scale_factory(e).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,e.xgroup_height],null===e.xgroup_accessor),e.xgroup_accessor?new MG.scale_factory(e).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(e.scales.XGROUP=function(){return Y(e)},e.scalefns.xgroupf=function(){return Y(e)}),e.scalefns.xoutf=function(t){return e.scalefns.xf(t)+e.scalefns.xgroupf(t)}):(MG.scale_factory(e).namespace("x").inflateDomain(!0).zeroBottom("categorical"===e.y_axis_type).numericalDomainFromData((e.baselines||[]).map(function(t){return t[e.x_accessor]})).numericalRange("bottom"),e.scalefns.xoutf=e.scalefns.xf),"categorical"===e.y_axis_type)MG.scale_factory(e).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,e.ygroup_height],!0),e.ygroup_accessor?new MG.scale_factory(e).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(e.scales.YGROUP=function(){return b(e)},e.scalefns.ygroupf=function(){return b(e)}),e.scalefns.youtf=function(t){return e.scalefns.yf(t)+e.scalefns.ygroupf(t)};else{var t=(e.baselines||[]).map(function(t){return t[e.y_accessor]});MG.scale_factory(e).namespace("y").inflateDomain(!0).zeroBottom("categorical"===e.x_axis_type).numericalDomainFromData(t).numericalRange("left"),e.scalefns.youtf=function(t){return e.scalefns.yf(t)}}if(null!==e.color_accessor){var r=MG.scale_factory(e).namespace("color");"number"===e.color_type?r.numericalDomainFromData(B(e)).numericalRange(I(e)).clamp(!0):e.color_domain?r.categoricalDomain(e.color_domain).categoricalRange(e.color_range):r.categoricalDomainFromData().categoricalColorRange()}return e.size_accessor&&new MG.scale_factory(e).namespace("size").numericalDomainFromData().numericalRange(it(e)).clamp(!0),new MG.axis_factory(e).namespace("x").type(e.x_axis_type).zeroLine("categorical"===e.y_axis_type).position(e.x_axis_position).rug(nt(e)).label(st).draw(),new MG.axis_factory(e).namespace("y").type(e.y_axis_type).zeroLine("categorical"===e.x_axis_type).position(e.y_axis_position).rug(K(e)).label(et).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),e.brush&&MG.add_brush_function(e),this},this.markers=function(){return St(a),a.least_squares&&ze(a),this},this.mainPlot=function(){var t=O(a.target),e=we(a.data[0],a);t.selectAll(".mg-points").remove();var r=t.append("g").classed("mg-points",!0).selectAll("circle").data(e).enter().append("circle").attr("class",function(t,e){return"path-"+e}).attr("cx",a.scalefns.xoutf).attr("cy",function(t){return a.scalefns.youtf(t)});return null!==a.color_accessor?(r.attr("fill",a.scalefns.colorf),r.attr("stroke",a.scalefns.colorf)):r.classed("mg-points-mono",!0),null!==a.size_accessor?r.attr("r",a.scalefns.sizef):r.attr("r",a.point_size),this},this.rollover=function(){var t=O(a.target);0===t.selectAll(".mg-active-datapoint-container").nodes().length&&S(t,"mg-active-datapoint-container"),t.selectAll(".mg-voronoi").remove();var e=E.voronoi().x(a.scalefns.xoutf).y(a.scalefns.youtf).extent([[a.buffer,a.buffer+(a.title?a.title_y_position:0)],[a.width-a.buffer,a.height-a.buffer]]);return t.append("g").attr("class","mg-voronoi").selectAll("path").data(e.polygons(we(a.data[0],a))).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(a)).on("mouseout",this.rolloverOff(a)).on("mousemove",this.rolloverMove(a)),1===a.data[0].length&&be(a,t,a.data[0][0]),this},this.rolloverOn=function(a){var n=O(a.target);return function(t,e){n.selectAll(".mg-points circle").classed("selected",!1);var r=n.selectAll(".mg-points circle.path-"+e).classed("selected",!0);a.size_accessor?r.attr("r",function(t){return a.scalefns.sizef(t)+a.active_point_size_increase}):r.attr("r",a.point_size+a.active_point_size_increase),a.linked&&!MG.globals.link&&(MG.globals.link=!0,E.selectAll(".mg-voronoi .path-"+e).each(function(){E.select(o).on("mouseover")(t,e)})),a.show_rollover_text&&be(a,n,t.data),a.mouseover&&a.mouseover(t,e)}},this.rolloverOff=function(a){var n=O(a.target);return function(t,e){a.linked&&MG.globals.link&&(MG.globals.link=!1,E.selectAll(".mg-voronoi .path-"+e).each(function(){E.select(o).on("mouseout")(t,e)}));var r=n.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);a.size_accessor?r.attr("r",a.scalefns.sizef):r.attr("r",a.point_size),11-1e-6}));var i=a.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[r]%1!=0)return s=!1})}),s&&n