/*! dataviz 1.9.5 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.gel=t.gel||{},t.gel.dataviz={}))}(this,function(t){"use strict";var e,i,n,o;Array.prototype.find||(Array.prototype.find=function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),n)},function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,a=arguments.length>1?arguments[1]:void 0;if(void 0!==a){if(!i(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var r,l=o(e.length),s=i(this)?Object(new this(l)):new Array(l),d=0;d1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.emit("warn",{code:e,message:t,extras:i})}},{key:"error",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.emit("error",{code:e,message:t,extras:i})}}]),t}();h(g,{ERROR_GENERIC:0,ERROR_INVALID_DATA:1,ERROR_INCOMPLETE_DATA:2});var m={line_chart:"dv-line-chart",chart_zoomed:"dv-zoomed",chart_panning:"dv-panning",chart_viewport_hover:"dv-viewport-hover",header:"dv-header",title:"dv-title",subtitle:"dv-subtitle",legend:"dv-legend",legend_item:"dv-legend-item",plot_area:"dv-plot-area",plot_bg:"dv-plot-background",viewport:"dv-viewport",lines_group:"dv-lines-group",line:"dv-line",point:"dv-point",point_label:"dv-point-label",point_label_line:"dv-point-label-line",annotation:"dv-annotation",annotation_bg:"dv-annotation-bg",x_axis:"dv-x-axis",y_axis:"dv-y-axis",axis_line:"dv-axis-line",axis_at_zero:"dv-axis-at-zero",tick:"dv-tick",grid_line:"dv-grid-line",x_axis_grid_lines:"dv-grid-lines-v",y_axis_grid_lines:"dv-grid-lines-h",footer:"dv-footer",footnote:"dv-footnote",source:"dv-source",tooltip:"dv-tooltip",tooltip_left:"dv-tooltip-left",tooltip_right:"dv-tooltip-right",group_tooltip:"dv-group-tooltip",tooltip_label:"dv-tooltip-label",tooltip_value:"dv-tooltip-value",tooltip_line_label:"dv-tooltip-line-label",tooltip_hidden:"dv-hidden",tooltip_point:"dv-tooltip-point",label_editor:"dv-label-editor",label_editor_closing:"dv-editor-closing",selected_point:"dv-selected-point",label_handle:"dv-label-handle",placeholder:"dv-placeholder",no_select:"dv-no-select"},x=document.createElement("canvas").getContext("2d"),b={};function y(t,e){var i=t+"|"+e;if(b[i])return b[i];x.font=e;var n=Math.ceil(x.measureText(t).width);return b[i]=n,n}function w(t,e){for(var i=0,n=void 0,o=0;oi&&(i=n);return i}function k(t,e,i){var n=e-e*(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0),o=[];return t.split("\n").forEach(function(t){var e=void 0;t.trim().split(" ").forEach(function(t,a){0===a?e=t:y(e+" "+t,i)1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(t){return Math.max(Math.floor(Math.log(Math.abs(t))*Math.LOG10E),0)+1}(t),o=t,a=e,r="";i&&(n>12?(o/=Math.pow(10,12),r="T"):n>9?(o/=Math.pow(10,9),r="B"):n>6&&(o/=Math.pow(10,6),r="M"),a=L(o));var l=(null!==a?o.toFixed(a):o.toString()).split(".");return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),""+l.join(".")+r}function C(t,e,i,n,o,a){var r=i+o,l=n+a,s=void 0;s=i<=t&&t<=r?t:Math.abs(i-t)2&&void 0!==arguments[2]?arguments[2]:0;return!(t.right+ie.right+i||t.bottom+ie.bottom+i)}function O(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return void 0!==t&&null!==t?e>0?t.toString().slice(0,e):t.toString():i}function E(t,e,i){return i.indexOf(t)===e}function D(t,e){return t.x-e.x}var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],S=864e5,R=Date.UTC(1970,0,1);function Y(t){return Math.ceil((t+1)/3)}function X(t){return t.getFullYear()+" "+P[t.getMonth()]+" "+t.getDate()}function F(t){var e=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return Math.floor(Math.abs(R-e)/S)*(t1&&void 0!==arguments[1]&&arguments[1],i=t.getFullYear().toString();return e?"'"+i.substr(2):i}function V(t,e){return e.getFullYear()-t.getFullYear()>=4?"year":t.getFullYear()===e.getFullYear()&&e.getMonth()-t.getMonth()<4?"day":"month"}function B(t,e,i){var n=t.indexOf("_yy")>-1;switch(t.replace("_yy","")){case"auto":return B(V(e,i)+(n?"_yy":""),e,i);case"year":return function(t){return I(t,n)};case"quarter":return function(t){return"Q"+Y(t.getMonth())+" "+I(t,n)};case"month":return i.getFullYear()-e.getFullYear()>0?function(t){return P[t.getMonth()]+" "+I(t,n)}:function(t){return P[t.getMonth()]};case"day":default:return i.getFullYear()-e.getFullYear()>0?function(t){return I(t,n)+" "+P[t.getMonth()]+" "+t.getDate()}:function(t){return P[t.getMonth()]+" "+t.getDate()}}}function W(t){var e=t.toString().trim();return N.test(e)?new Date(e):j.test(e)?new Date(e+" 1"):H.test(e)?new Date(e.substr(e.indexOf("-")+1)):null}function q(t,e){var i=e.indexOf("_yy")>-1,n=W(t[0].text),o=W(t[t.length-1].text),a=void 0,r=void 0,l=void 0;switch(e.replace("_yy","")){case"auto":return q(t,V(n,o)+(i?"_yy":""));case"year":l=function(t){return t.setFullYear(t.getFullYear()+1)},r=new Date(o.getFullYear(),0,1),a=n.getFullYear()-1?e:(ct.push(t),dt&&(dt.innerHTML=ct.filter(function(t){return null!==t}).join("\n")),ct.length-1)}var ut='.dv-line-chart{display:block;font-family:aktiv-grotesk,aktiv-grotesk-std,Arial,Helvetica,sans-serif;background-color:#f0f8f0}.dv-line-chart ::-moz-selection{fill:#fff;background-color:#929292}.dv-line-chart ::selection{fill:#fff;background-color:#929292}.dv-line-chart .dv-title{font-size:18px;fill:#666}.dv-line-chart .dv-annotation,.dv-line-chart .dv-footnote,.dv-line-chart .dv-legend text,.dv-line-chart .dv-point-label,.dv-line-chart .dv-source,.dv-line-chart .dv-subtitle,.dv-line-chart .dv-tick text{font-size:11px;fill:#666}.dv-line-chart .dv-source,.dv-line-chart .dv-tick text{text-transform:uppercase}.dv-line-chart .dv-x-axis text{text-anchor:middle}.dv-line-chart .dv-source{letter-spacing:.1em}.dv-line-chart .dv-axis-line,.dv-line-chart .dv-grid-line,.dv-line-chart .dv-legend rect,.dv-line-chart .dv-tick line{shape-rendering:crispEdges}.dv-line-chart .dv-axis-line,.dv-line-chart .dv-grid-line,.dv-line-chart .dv-line,.dv-line-chart .dv-tick line{stroke-width:2px}.dv-line-chart .dv-axis-at-zero line,.dv-line-chart .dv-axis-line{stroke:#ddd}.dv-line-chart .dv-grid-line,.dv-line-chart .dv-tick line{stroke:#fff}.dv-line-chart .dv-line{fill:none}.dv-line-chart .dv-point{stroke:#f0f8f0;stroke-width:3px}.dv-line-chart .dv-tooltip-point{opacity:0}.dv-viewport-hover .dv-line-chart .dv-tooltip-point{opacity:1}.dv-line-chart .dv-point-label-line{stroke:#aaa;stroke-dasharray:3;stroke-width:1px}.dv-line-chart .dv-annotation-bg{fill:#fff}.dv-line-chart .dv-y-axis text{text-anchor:end}.dv-line-chart .dv-placeholder{fill:transparent}.dv-line-chart svg{overflow:visible}.dv-line-chart [id^=zoom-fade].fade-end stop:last-child,.dv-line-chart [id^=zoom-fade].fade-start stop:first-child{stop-opacity:1}.dv-line-chart.dv-zoomed .dv-viewport{cursor:move;cursor:-webkit-grab;cursor:grab}.dv-line-chart.dv-panning{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.dv-line-chart.dv-tile-mode .dv-title{font-size:11px;text-transform:uppercase;letter-spacing:.1em}.dv-line-chart.dv-tile-mode .dv-footnote,.dv-line-chart.dv-tile-mode .dv-subtitle{display:none}.dv-line-chart.dv-interactive-mode .dv-grid-line{stroke-width:1px}.dv-line-chart.dv-interactive-mode .dv-axis-line{stroke-width:2px}.dv-line-chart.dv-interactive-mode .dv-x-axis text{text-anchor:start}.dv-tooltip{position:absolute;top:0;left:0;z-index:1;padding:5px 10px;font:11px aktiv-grotesk,aktiv-grotesk-std,Arial,Helvetica,sans-serif;color:#666;pointer-events:none;background-color:#fff;opacity:0;will-change:transform}.dv-tooltip:after{position:absolute;top:100%;left:50%;content:"";border:5px solid transparent;border-top-color:#fff;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}.dv-tooltip.dv-tooltip-right:after{left:5px;-webkit-transform:none;-ms-transform:none;transform:none}.dv-tooltip.dv-tooltip-left:after{right:5px;left:auto;-webkit-transform:none;-ms-transform:none;transform:none}.dv-viewport-hover .dv-tooltip{opacity:1}.dv-tooltip .dv-tooltip-label{text-transform:uppercase}.dv-tooltip .dv-tooltip-value{margin-left:5px;font-weight:700}.dv-tooltip.dv-group-tooltip p{margin:0;font-size:11px;line-height:1.5}.dv-tooltip.dv-group-tooltip .dv-tooltip-value{margin-left:0}.dv-tooltip.dv-group-tooltip .dv-tooltip-line-label{margin-left:5px}',pt="http://www.w3.org/2000/svg";function ft(t){if(t.length){if("x"in t[0]&&"y"in t[0])return t.map(function(t){return[t.x,t.y]});if(!(t[0]instanceof Array))return t.map(function(t,e){return[e,t]})}return t}var vt=0,gt=0,mt=0,xt=function(){function t(e){d(this,t),this.node=document.createElementNS(pt,e)}return c(t,[{key:"attr",value:function(t,e){var i=this;if("object"===(void 0===t?"undefined":s(t)))Object.keys(t).forEach(function(e){i.node.setAttribute(e,t[e])});else{if(void 0===e){var n=this.node.getAttribute(t);return isNaN(n)||""===n?n:Number(n)}this.node.setAttribute(t,e)}return this}},{key:"addClass",value:function(t){var e=this;return this.node.classList?t.split(" ").filter(function(t){return""!==t}).forEach(function(t){return e.node.classList.add(t)}):this.hasClass(t)||this.attr("class",(null!==this.node.getAttribute("class")?this.node.getAttribute("class"):"")+" "+t),this}},{key:"removeClass",value:function(t){var e=this;return this.node.classList?t.split(" ").forEach(function(t){return e.node.classList.remove(t)}):this.attr("class",this.attr("class").replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")),this}},{key:"toggleClass",value:function(t,e){return!0===e?this.addClass(t):!1===e?this.removeClass(t):this.node.classList?this.node.classList.toggle(t):this.hasClass(t)?this.removeClass(t):this.addClass(t),this}},{key:"hasClass",value:function(t){return this.node.classList?this.node.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(this.attr("class"))}},{key:"appendTo",value:function(e){return e instanceof t?e.node.appendChild(this.node):e.appendChild(this.node),this}},{key:"appendChild",value:function(e){return this.node.appendChild(e instanceof t?e.node:e),this}},{key:"remove",value:function(){return this.node.parentNode&&this.node.parentNode.removeChild(this.node),this}},{key:"removeChild",value:function(e){return this.node.removeChild(e instanceof t?e.node:e),this}},{key:"show",value:function(){return this.node.style.display="",this}},{key:"hide",value:function(){return this.node.style.display="none",this}},{key:"bbox",value:function(){var t=this.node.getBBox(),e=t.x,i=t.y,n=t.width,o=t.height;return{x:e,y:i,width:n,height:o,left:e,top:i,right:e+n,bottom:i+o}}},{key:"clip",value:function(e){var i=void 0;return i=e instanceof t?e.attr("id"):e instanceof SVGElement?e.id:e,this.attr("clip-path","url(#"+i+")")}},{key:"mask",value:function(e){var i=void 0;return i=e instanceof t?e.attr("id"):e instanceof SVGElement?e.id:e,this.attr("mask","url(#"+i+")")}},{key:"parent",value:function(){return this.node.parentNode}},{key:"front",value:function(){return this.parent().appendChild(this.node),this}},{key:"back",value:function(){return this.parent().insertBefore(this.node,this.parent().firstChild),this}},{key:"appendRawSVG",value:function(t){var e=document.createElementNS(pt,"svg");if("innerHTML"in e)e.innerHTML=t;else{var i=document.createElement("div");i.innerHTML=""+t+"",e=i.children[0]}for(;e.firstChild;)this.appendChild(e.firstChild);return this}}]),t}(),bt=function(t){function e(){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,xt),c(e,[{key:"x",value:function(t){return this.attr("x",t)}},{key:"y",value:function(t){return this.attr("y",t)}},{key:"move",value:function(t,e){return this.x(t),this.y(e),this}},{key:"cx",value:function(t){var e=this.bbox().width/2;return void 0===t?this.x()+e:this.x(t-e)}},{key:"cy",value:function(t){var e=this.bbox().height/2;return void 0===t?this.y()+e:this.y(t-e)}}]),e}(),yt=function(t){function e(){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,bt),c(e,[{key:"width",value:function(t){return this.attr("width",t)}},{key:"height",value:function(t){return this.attr("height",t)}},{key:"size",value:function(){return arguments.length?(this.width(arguments.length<=0?void 0:arguments[0]).height(arguments.length<=1?void 0:arguments[1]),this):{width:this.width(),height:this.height()}}}]),e}(),wt=function(t){function e(){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,xt),c(e,[{key:"cx",value:function(t){return this.attr("cx",t)}},{key:"cy",value:function(t){return this.attr("cy",t)}}]),e}(),kt=function(t){function e(t,i){d(this,e);var n=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.points=[],void 0!==i&&n.setPoints(i),n}return u(e,xt),c(e,[{key:"setPoints",value:function(t){return this.points=ft(t),this.attr("points",this.points.map(function(t){return t.x+","+t.y}).join(" ")),this}}]),e}(),_t=function(t){function e(){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,bt),c(e,[{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}}]),e}(),Lt=function(t){function e(){d(this,e);var t=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"svg"));return t.attr("xmlns",pt),t.attr("id","dv-svg-"+vt++),t.createDefs(),t}return u(e,yt),c(e,[{key:"createDefs",value:function(){return this.defs=new xt("defs"),this.appendChild(this.defs),this}},{key:"addDef",value:function(t){return this.defs.appendChild(t),this}},{key:"removeDef",value:function(t){return this.defs.removeChild(t),this}},{key:"removeAllChildren",value:function(){for(;this.node.firstChild;)this.removeChild(this.node.firstChild);return this.createDefs(),this}}]),e}(),Tt=function(t){function e(){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"svg"))}return u(e,yt),e}(),Mt=function(t){function e(t,i){d(this,e);var n=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"rect"));return n.width(t).height(i),n}return u(e,yt),c(e,[{key:"rx",value:function(t){return this.attr("rx",t)}},{key:"ry",value:function(t){return this.attr("ry",t)}}]),e}(),Ct=function(t){function e(t){d(this,e);var i=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"circle"));return i.r(t),i}return u(e,wt),c(e,[{key:"r",value:function(t){return this.attr("r",t)}}]),e}(),At=(function(t){function e(){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"ellipse"))}u(e,wt),c(e,[{key:"rx",value:function(t){return this.attr("rx",t)}},{key:"ry",value:function(t){return this.attr("ry",t)}}])}(),function(t){function e(t){d(this,e);var i=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"tspan"));return i.text(t),i}return u(e,_t),c(e,[{key:"text",value:function(t){return void 0===t?this.node.textContent:(this.node.textContent=t,this)}}]),e}()),Ot=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;d(this,e);var n=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"text"));return n.leading(i),n.lines=[],n.text(t),n}return u(e,_t),c(e,[{key:"clear",value:function(){for(;this.node.firstChild;)this.removeChild(this.node.firstChild);return this.lines=[],this}},{key:"text",value:function(t){var e=this;return void 0===t?this.textContent:(this.clear(),t.split("\n").forEach(function(t,i){e.lines.push(new At(t.length?t:" ").x(e.x()).dy(e.getLineOffset(0===i)).appendTo(e))}),this)}},{key:"x",value:function(t){return void 0===t?this.attr("x"):(this.attr("x",t),this.lines.forEach(function(e){return e.x(t)}),this)}},{key:"getLines",value:function(){return this.lines}},{key:"leading",value:function(t){return void 0===t?this.textLeading:(this.textLeading=t,this)}},{key:"getLineOffset",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?.8+(this.textLeading-1)/2+"em":this.textLeading+"em"}}]),e}(),Et=function(t){function e(){d(this,e);var t=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"g"));return t.translateX=0,t.translateY=0,t}return u(e,xt),c(e,[{key:"x",value:function(t){return void 0===t?this.translateX:(this.translateX=t,this.attr("transform","translate("+this.translateX+", "+this.translateY+")"))}},{key:"y",value:function(t){return void 0===t?this.translateY:(this.translateY=t,this.attr("transform","translate("+this.translateX+", "+this.translateY+")"))}},{key:"bbox",value:function(){var t=this.x(),e=this.y(),i=this.node.getBBox(),n=i.width,o=i.height;return{x:t,y:e,width:n,height:o,left:t,top:e,right:t+n,bottom:e+o}}},{key:"children",value:function(){return this.node.children||[].concat(v(this.node.childNodes)).filter(function(t){return t instanceof SVGElement})}},{key:"child",value:function(t){return this.children()[t]}}]),e}(),Dt=function(t){function e(t,i,n,o){d(this,e);var a=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"line"));return 0!==t&&a.attr("x1",t),0!==i&&a.attr("y1",i),0!==n&&a.attr("x2",n),0!==o&&a.attr("y2",o),a}return u(e,xt),e}(),Pt=(function(t){function e(t){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"polyline",t))}u(e,kt)}(),function(t){function e(t){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"polygon",t))}u(e,kt)}(),function(t){function e(t){return d(this,e),p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"path",t))}return u(e,kt),c(e,[{key:"setPoints",value:function(t){return this.points=ft(t),this.attr("d",function(t){var e="";return t instanceof Array&&t.length&&t.forEach(function(t,i){e+=" "+t[0]+" "+t[1],0===i&&(e="M"+e+" L")}),e}(this.points)),this}}]),e}()),St=function(t){function e(){d(this,e);var t=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"clipPath"));return t.attr("id","svg-cp"+gt++),t}return u(e,bt),e}(),Rt=(function(t){function e(){d(this,e);var t=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"mask"));return t.attr("id","svg-mask"+mt++),t}u(e,yt)}(),"tile"),Yt={mode:"article",width:"100%",height:"100%",showHeader:!0,showFooter:!0,showLegend:!0,yAxisPosition:"right",showPointLabels:!0,pointLabels:{},dateFormat:"day",ticks:null,zoomLevel:1,x_axis_min:null,x_axis_max:null,y_axis_min:null,y_axis_max:null,y_precision:null,unitFormat:null,embedStylesheet:!0,displayTooltips:!0,strictModeTooltips:!1,wrapAxisLabels:!1,enableValidation:!1,strictValidation:!1,forceMultilineLegend:!1,tooltipLabel:null,tooltipLineLabel:null,groupTooltipLabel:null},Xt=10,Ft='"aktiv-grotesk", "aktiv-grotesk-std", Arial, Helvetica, sans-serif',zt="11px "+Ft,jt=l.mutate.bind(l),Nt=[],Ht=function(t){var e=document.createElement("div");if(t in e.style)return!0;for(var i=["Khtml","Ms","O","Moz","Webkit"],n=t.replace(/^[a-z]/,function(t){return t.toUpperCase()}),o=0;o1?e-1:0),n=1;n2&&void 0!==arguments[2]?arguments[2]:-1,n=t.metadata.axisX,o=n.valuesByLine[i]||n.values;if(!o||!o.length)return null;for(var a=o[0],r=Math.abs(qt(t,a)-e),l=1;l3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=.08*(e-t),r=null!==n,l=null!==o,s=r?n:t-a,d=Math.max(l?o:e+a,e+a);if(s===d){var c=Math.max(_(s),1);s=r?n:s-2*c,d=l?o:d+2*c}else if(d5?10*o:a>2?5*o:a>1?2*o:o,e&&t%r!=0){var l=t/(i-1);r=L(n)>L(l)?l:n}return r}(d-s,r&&l,i),p=r?s:function(t,e){return 0===e?0:Math.floor(t/e)*e}(s,u),f=l?d:function(t,e){return 0===e?0:Math.ceil(t/e)*e}(d,u),v=L(u),g=[],m=p;m<=f;m+=u)g.push({value:m,text:M(m,v,!0)});return g}function Jt(t){var e=t.data,i=t.state,n=t.metadata,o=n.axisX,a=n.axisY,r=[],l=o.labels||e.labels;if(Wt(t,Rt))return r.push(l[0]),r.push(l[l.length-1]),r;var s=(i.innerWidth-a.width-Xt-2*o.plotOffset)*i.zoomLevel/(o.maxLabelWidth+i.labelSpacing),d=void 0,c=void 0;o.labels?(c=o.labels.length-1,d=Math.ceil(o.labels.length/s)):(c=Math.min(e.labels.length-1,o.max),d=Math.max(Math.ceil(e.labels.length/s),1));for(var h=c%d;h<=c;h+=d)r.push(l[h]);return r}function Kt(t,e){var i=t.data.labelsLookup[e];return i?"date_range"===t.data.labelType?function(t){var e=t.split("-");if(e.length<2)return t;var i=e.map(function(t){return t.split(" ")}),n=void 0;return n=i[0][0]!==i[1][0]?i[1].join(" "):i[0][1]!==i[1][1]?i[1][1]+i[1][2]:i[1][2],e[0]+"–"+n}(i):i:e.toString()}var Qt=function(t){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};d(this,e);var o=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));if((o.container="string"==typeof t?document.querySelector(t):t,o.options=h({},Yt,n),o.dom={},o.metadata={},o.state={},o.zoomFadeId="zoom-fade-"+(document.querySelectorAll("[id*='zoom-fade']").length+1),o.dom.chart=(new Lt).appendTo(o.container),o.el=o.dom.chart.node,o.el.dvInstance=o,o.on("mouseenter",o.mouseEnter.bind(o)).on("mousedown",o.mouseDown.bind(o)).on("touchstart",o.touchStart.bind(o)).on("mousemove",o.mouseMove.bind(o)).on("touchmove",o.touchMove.bind(o)).on("mouseup",o.mouseUp.bind(o)).on("touchend",o.touchEnd.bind(o)).on("mouseleave",o.mouseLeave.bind(o)).on("dragstart",function(t){return t.preventDefault()}).on("focus",o.focusStart.bind(o)).on("blur",o.focusEnd.bind(o)).on("keydown",o.keyDown.bind(o)),n.enableValidation)&&(!Q(i).valid&&n.strictValidation))return p(o);var a="approvalFlexChart"===o.container.parentElement.dataset.codename;return o.data=tt(i,a),o.init(),o}return u(e,g),c(e,[{key:"init",value:function(){var t=this.options,e=this.dom,i=this.state;switch(this.el.parentNode||this.container.appendChild(this.el),e.chart.attr("class",m.line_chart+" dv-"+this.options.mode+"-mode"),i.chartPadding=Wt(this,"interactive")?Xt:2*Xt,i.chartTicks=Wt(this,"interactive")?3:5,i.maxLines=1/0,i.tooltipsEnabled=t.displayTooltips,i.headerShown=t.showHeader&&!Wt(this,"interactive"),i.zoomLevel=Wt(this,"interactive","custom")?t.zoomLevel:1,i.labelSpacing=Wt(this,"interactive")?30:10,t.mode){case"article":e.chart.size(720,350),i.maxLines=4;break;case Rt:e.chart.size(300,300);break;case"interactive":case"custom":default:e.chart.size(t.width,t.height)}return i.svgRect=this.el.getBoundingClientRect(),i.innerWidth=i.svgRect.width-2*i.chartPadding,i.innerHeight=i.svgRect.height-2*i.chartPadding,i.textWrap=Wt(this,"article")?530:i.innerWidth,i.zoomLevel>1&&e.chart.addClass(m.chart_zoomed),t.embedStylesheet?this.embedStyles():ht(ut),this.createMetadata().draw().emit("init"),Nt.push(this),this}},{key:"createMetadata",value:function(){var t=this.data,e=this.options,i=this.dom,n=this.state;if(this.metadata={axisX:{height:0,plotOffset:20},axisY:{width:0}},!t.lines.length&&!t.labels.length)return this;var o=this.metadata,a=o.axisX,r=o.axisY;if(t.lines=t.lines.slice(0,n.maxLines),"date"===t.labelType||"date_range"===t.labelType)a.labels=q(t.labels,e.dateFormat);else if("number"===t.labelType){a.labels=[];for(var l=t.labels[0].x;l<=t.labels[t.labels.length-1].x;l++)a.labels.push({x:l,text:l.toString()})}var s=t.lines.map(function(t){return t.points}),d=s.reduce(function(t,e){return t.concat(e)},[]);if(!d.length&&t.labels.length&&(d=t.labels.map(function(t){return{x:t.x,y:0}})),a.values=d.map(function(t){return t.x}).filter(E).sort(function(t,e){return t-e}),a.valuesByLine=s.map(function(t){return t.map(function(t){return t.x})}),a.min=a.values[0],a.max=a.values[a.values.length-1],a.range=a.max-a.min,!t.labels.length){if(!a.values.length)return this;t.labels=a.values.map(function(t){return{x:t,text:t.toString()}})}var c=a.labels||t.labels;if(a.axisMin=null!==e.x_axis_min?e.x_axis_min:Math.min(a.min,c[0].x),a.axisMax=null!==e.x_axis_max?e.x_axis_max:Math.max(a.max,c[c.length-1].x),a.axisRange=a.axisMax-a.axisMin,e.ticks&&e.ticks.length){if(isNaN(e.ticks[0]))if(!W(e.ticks[0])||"date"!==t.labelType&&"date_range"!==t.labelType)"string"==typeof e.ticks[0]?a.ticks=e.ticks.filter(function(t,e,i){return i.indexOf(t)===e}).map(function(e){return t.labels.find(function(t){return t.text===e})}).filter(function(t){return!!t}):a.ticks=e.ticks;else{var h=z(a.min),u=z(a.max);a.ticks=e.ticks.map(function(t){return function t(e,i,n,o){var a=i.indexOf("_yy")>-1,r=void 0;switch(i.replace("_yy","")){case"auto":return t(e,V(n,o)+(a?"_yy":""),n,o);case"year":r=new Date(e.getFullYear(),0,1);break;case"quarter":r=new Date(e.getFullYear(),3*(Y(e.getMonth())-1),1);break;case"month":r=new Date(e.getFullYear(),e.getMonth(),1);break;case"day":default:r=new Date(e)}return{x:F(r),text:B(i,n,o)(r)}}(W(t),e.dateFormat,h,u)}).filter(function(t,e,i){return i.indexOf(t)===e})}else a.ticks=e.ticks.filter(function(t,e,i){return i.indexOf(t)===e}).map(function(e){return{x:e,text:t.labels[e]?t.labels[e].text:e.toString()}});a.ticks.sort(D)}if(r.values=d.map(function(t){return t.y}).filter(E).sort(function(t,e){return t-e}),r.valuesByLine=s.map(function(t){return t.map(function(t){return t.y})}),r.min=r.values[0],r.max=r.values[r.values.length-1],r.decimalPlaces=Math.max.apply(Math,v(r.values.map(function(t){return L(t)}))),null!==e.y_axis_min&&null!==e.y_axis_max&&e.y_axis_min===e.y_axis_max)throw new Error("Y-axis range cannot be zero.");if(r.ticks=Zt(r.min,r.max,n.chartTicks,e.y_axis_min,e.y_axis_max).map(function(t){return{y:t.value,text:e.unitFormat?e.unitFormat.replace("{y}",t.text):t.text,hideLabel:null!==e.y_precision&&Number(t.value.toFixed(e.y_precision))!==t.value}}),r.axisMin=r.ticks[0].y,r.axisMax=r.ticks[r.ticks.length-1].y,r.axisRange=r.axisMax-r.axisMin,"hidden"!==e.yAxisPosition){var p=r.ticks.filter(function(t){return!t.hideLabel}).map(function(t){return t.text});r.width=w(p,zt)}var f=(a.ticks||c).map(function(t){return t.text.toUpperCase()});a.maxLabelWidth=w(f,zt),a.ticks=a.ticks||Jt(this),a.maxShownLabelWidth=w(a.ticks.map(function(t){return t.text.toUpperCase()}),zt),Wt(this,"interactive")?(a.plotOffset=5,this.options.wrapAxisLabels&&(a.plotOffset=Math.max(5,Math.ceil(a.maxShownLabelWidth/2)+2))):a.plotOffset=Math.max(Math.ceil(a.maxShownLabelWidth/2)+2,20);var g=(new Tt).appendTo(i.chart).addClass(m.x_axis);return Wt(this,"interactive")?g.appendRawSVG('\n \n \n Example\n \n '):g.appendRawSVG('\n \n \n Example\n \n '),a.height=g.bbox().height,g.remove(),this}},{key:"draw",value:function(){var t=this.options;return this.drawHeader().drawLegend().drawFooter().drawPlotArea().drawXAxis().drawYAxis().drawLines().layout(),t.displayTooltips&&this.drawTooltips(),this.emit("draw"),this}},{key:"layout",value:function(){var t=this.metadata,e=this.dom,i=this.state,n=this.options,o=i.chartPadding,a=o,r=o;return e.header&&(e.header.x(o).y(o),r=e.header.y()+e.header.height()+2*Xt),e.legend&&(e.legend.x(o).y(r),r=e.legend.y()+e.legend.height()+1.5*Xt),e.axisY.y(r),"hidden"===n.yAxisPosition?e.axisY.hide():"left"===n.yAxisPosition?(e.axisY.x(o),a=e.axisY.x(),Wt(this,"interactive")||(a+=t.axisY.width+Xt)):e.axisY.x(e.plotBackground.width()+o+(Wt(this,"interactive")?-t.axisY.width:Xt)),e.plotBackground.x(a).y(r),a=e.plotBackground.x(),r=e.plotBackground.y(),e.viewportClip.x(a).y(r),e.viewport.x(a).y(r),a=t.axisX.plotOffset,Wt(this,"interactive")&&"left"===n.yAxisPosition&&(a+=Xt+t.axisY.width),e.plotArea.x(a),e.axisX.x(a).y(e.plotArea.height()),r=Wt(this,"interactive")?e.plotBackground.y()+e.plotBackground.height()+o:e.viewport.y()+e.viewportClipRect.height()+o,e.footer&&e.footer.x(o).y(r),e.viewport.front(),Wt(this,"article")&&e.chart.height(e.chart.bbox().height+2*o),i.plotAreaOffset=e.plotArea.node.getBoundingClientRect(),this}},{key:"drawHeader",value:function(){var t=this.data,e=this.dom,i=this.state;if(!i.headerShown||!t.title&&!t.subtitle)return e.header=null,this;e.header=(new Tt).appendTo(e.chart).addClass(m.header);var n=void 0;if(t.title){var o=void 0;o=Wt(this,Rt)?k(t.title.toUpperCase(),i.textWrap,zt,.1):k(t.title,i.textWrap,'18px "aktiv-grotesk", "aktiv-grotesk-std", Arial, Helvetica, sans-serif'),n=new Ot(o,1.3).appendTo(e.header).addClass(m.title).y("-"+(1.3-1)/2+"em")}if(t.subtitle){var a=new Ot(k(t.subtitle,i.textWrap,zt),1.3).appendTo(e.header).addClass(m.subtitle);n&&a.y(n.bbox().y+n.bbox().height+Xt)}var r=e.header.bbox();return e.header.attr({width:r.width,height:r.height}),this}},{key:"drawLegend",value:function(){var t=this.data,e=this.dom,i=this.options,n=this.state;if(!i.showLegend)return e.legend=null,this;e.legend=(new Tt).appendTo(e.chart).addClass(m.legend);var o=0,a=0;t.lines.forEach(function(t,r){var l=(new Et).appendTo(e.legend).addClass(m.legend_item).x(o).y(a);new Pt([{x:0,y:5},{x:14,y:5}]).appendTo(l).addClass(m.line).attr({fill:"none",stroke:t.color,"data-line-id":t.id,"stroke-dasharray":t.strokeDashArray||""});var s=void 0;"title"in t&&(s=new Ot(t.title).appendTo(l).x(14+Xt/2));var d=l.bbox().width;(o>0&&o+d>n.textWrap||i.forceMultilineLegend&&r>0)&&(o=0,a=l.bbox().bottom+Xt/2,l.x(o).y(a)),0===o&&o+d>n.textWrap&&s&&s.text(k(t.title,n.textWrap-s.x(),zt)),o+=d+Xt});var r=e.legend.bbox();return e.legend.attr({width:r.width,height:r.height}),this}},{key:"drawFooter",value:function(){var t=this.data,e=this.options,i=this.dom,n=this.state;if(!1===e.showFooter||!t.footnote&&!t.source)return i.footer=null,this;i.footer=(new Tt).appendTo(i.chart).addClass(m.footer);var o=0,a=void 0;if(t.footnote&&(a=new Ot(k(t.footnote,n.textWrap,zt),1.3).appendTo(i.footer).addClass(m.footnote)),t.source){var r=k(t.source.toUpperCase(),n.textWrap,zt,.1);Wt(this,Rt)&&r.indexOf("\n")<0&&(o=11);var l=new Ot(r).appendTo(i.footer).addClass(m.source);a&&!Wt(this,Rt)&&l.y(a.bbox().y+a.bbox().height+Xt)}var s=i.footer.bbox();return i.footer.attr({width:s.width,height:s.height+o}),this}},{key:"drawPlotArea",value:function(){var t=this.metadata,e=this.state,i=this.dom,n="hidden"!==this.options.yAxisPosition?Math.max(e.innerWidth-Xt-t.axisY.width,0):e.innerWidth,o=Math.max(n*e.zoomLevel-2*t.axisX.plotOffset,0),a=void 0;a=Wt(this,"article")?175:Math.max(e.innerHeight-(i.header?i.header.height()+Xt:0)-(i.legend?i.legend.height()+Xt:0)-t.axisX.height-(i.footer?e.chartPadding+i.footer.height():0),0);var r=Wt(this,"interactive")?e.innerWidth:n,l=a+(Wt(this,"interactive")?t.axisX.height:0);i.plotBackground=(new Tt).appendTo(i.chart).addClass(m.plot_bg).size(r,l),new Mt(0,0).appendTo(i.plotBackground).addClass(m.placeholder).size(r,l),i.viewportClip=new St,i.chart.addDef(i.viewportClip),i.viewportClipRect=new Mt(0,0).appendTo(i.viewportClip).attr("fill","transparent").size(n,a+t.axisX.height),Wt(this,"interactive")&&1===e.zoomLevel&&(i.viewportClipRect2=new Mt(0,0).appendTo(i.viewportClip).attr("fill","transparent").size(r,t.axisX.height).y(a)),i.chart.defs.appendRawSVG('\n \n \n \n \n \n \n '),i.zoomFade=this.el.getElementById(this.zoomFadeId),i.viewport=(new Tt).appendTo(i.chart).addClass(m.viewport).clip(i.viewportClip),i.plotArea=(new Tt).appendTo(i.viewport).addClass(m.plot_area).size(o,a),this.metadata.axisX.internalPlotWidth=o,new Mt(o,a).appendTo(i.plotArea).addClass(m.placeholder);var s="url(#"+this.zoomFadeId+")";return i.zoomOverlay=new Mt(n,a+t.axisX.height).appendTo(i.viewport).attr("fill",s),this.updateZoomFade(),this}},{key:"drawLines",value:function(){var t=this,e=this.data,i=this.metadata,n=this.options,o=this.dom,a=(new Et).appendTo(o.plotArea).addClass(m.lines_group);if(e.lines.forEach(function(e){if(!(e.points.length<2)){for(var i,n=e.points,o=[],r=0;r10){var R=function(t,e,i,n,o,a){var r=i+o,l=n+a,s=void 0;s=i<=t&&t<=r?Math.round(i+o/2):Math.abs(i-t)d-10&&0===l&&Vt&&!s&&(c=15),r=d+y(n.text||""),l=c),Vt){var u=function(t){if(/\./.test(t))return[t];var e=t.match(/^(\S+)\s(.+)$/);return e?[e[1],e[2]]:[t]}(n.text);u.length>1?(s=!0,u.forEach(function(t,e){h+=''+t+""})):(s=!1,h=''+(n.text||"")+""),o+='\n \n '+h+"\n "}else o+='\n \n '+(n.text||"")+"\n ";new Dt(d,0,d,e.plotBackground.height()).appendTo(a).addClass(m.grid_line)})}else o=n.ticks.map(function(e){return'\n \n \n '+(e.text||"")+"\n \n "}).join("");e.axisX.appendRawSVG(o);var d=e.axisX.bbox();return e.axisX.attr({width:d.width,height:d.height}),this}},{key:"drawYAxis",value:function(){var t=this,e=this.metadata,i=this.dom;if(i.axisY=(new Tt).appendTo(i.chart).addClass(m.y_axis),!e.axisY.ticks)return this;var n=(new Et).appendTo(i.plotBackground).addClass(m.y_axis_grid_lines);return e.axisY.ticks.forEach(function(o,a){var r=Ut(t,o.y),l=(new Et).appendTo(i.axisY).addClass(m.tick).x(e.axisY.width).y(r);if(!o.hideLabel){var s=new Ot(o.text).appendTo(l);Wt(t,"interactive")?0===a?s.y(-1.5*Xt):s.y(Xt/2):s.y("-0.5em")}new Dt(0,r,i.plotBackground.x()+i.plotBackground.width(),r).appendTo(n).addClass(0===o.y?m.axis_line:m.grid_line),0===o.y&&0===a&&i.axisX.addClass(m.axis_at_zero)}),this}},{key:"drawTooltips",value:function(){var t=this,e=this.dom,i=this.data,n=this.metadata;e.groupTooltip=document.createElement("div");var o=e.groupTooltip;o.className=m.tooltip+" "+m.group_tooltip,rt(o,this.el.id),e.groupTooltipLabel=document.createElement("p");var a=e.groupTooltipLabel;return a.className=m.tooltip_label,a.innerHTML=" ",o.appendChild(a),e.groupTooltipLines=[],e.tooltips=[],n.tooltips=[],e.tooltipPoints=(new Et).appendTo(e.viewport).x(e.plotArea.x()),i.lines.forEach(function(i){var a=document.createElement("div");a.className=m.tooltip,a.innerHTML='\n  \n  \n ',rt(a,t.el.id),e.tooltips.push(a),n.tooltipHeight||(n.tooltipHeight=a.clientHeight),a.style.marginTop="-"+(n.tooltipHeight+10)+"px";var r=document.createElement("p");r.innerHTML='\n  \n  \n ',o.appendChild(r),e.groupTooltipLines.push(r),new Ct(5).appendTo(e.tooltipPoints).addClass(m.point+" "+m.tooltip_point).attr({fill:i.color,style:"visibility: hidden;"})}),o.style.marginTop="-"+(o.clientHeight+10)+"px",this}},{key:"getTooltipMetadata",value:function(t){var e=this.options,i=this.metadata,n=this.data,o=this.state,a=void 0;e.strictModeTooltips&&(a=Gt(this,t),i.lastTooltipXValue=a);for(var r=!1,l=1/0,s=-1/0,d=0,c=1/0,u=void 0,p=0;ps&&(s=v),!i.tooltips[p]||i.tooltips[p].x!==v){r=!0;var m=f.points[g].y;i.tooltips[p]={x:v,y:m};var x=e.unitFormat?e.unitFormat.replace("{y}",M(m,i.axisY.decimalPlaces)):M(m,i.axisY.decimalPlaces),b=Kt(this,v);e.tooltipLabel&&(b=e.tooltipLabel(f,v,b));var w=e.tooltipLineLabel?e.tooltipLineLabel(f,v,b):f.title,k=y(b.toUpperCase(),zt)+8+6.5*x.length+20,_=qt(this,v),L=Ut(this,m),T=Math.round(o.plotAreaOffset.left+_),C=Math.round(window.pageYOffset+o.plotAreaOffset.top+L),A=o.plotAreaOffset,O="top",E={left:A.left+window.pageXOffset,right:A.right+window.pageXOffset};T-k/2E.right&&(O="left");var D=this.dom.plotArea.x(),P=this.dom.viewportClipRect.width(),S=_+D,R=!0;if("top"===O)R=S-k/2>=0&&S+k/2<=P;else if("right"===O){R=S+k<=P&&S>=0}else if("left"===O){R=S-k>=0&&S<=P}if(R){var Y={top:C,left:T,bottom:C+i.tooltipHeight+15,right:T+k};h(i.tooltips[p],{label:b,lineLabel:w,value:x,plottedX:_,plottedY:L,rect:Y,position:O,color:f.color})}else i.tooltips[p]=!1}i.tooltips[p]&&i.tooltips[p].rect.top'+l.value+'\n '+l.lineLabel+"\n "),n.tooltips[t].style.visibility="hidden",l.plottedY&&(r.setAttribute("cx",l.plottedX),r.setAttribute("cy",l.plottedY),r.style.visibility="visible")}var s=c[i.tooltips[0].position],d=s.cls,h=s.translate;n.groupTooltipLabel.innerHTML=o.gtLabel,n.groupTooltip.className=m.tooltip+" "+m.group_tooltip+" "+d,n.groupTooltip.style.transform=Ht?"translate3d("+o.gtLeft+"px, "+o.gtTop+"px, 0) "+h:"translate("+o.gtLeft+"px, "+o.gtTop+"px) "+h,n.groupTooltip.style.visibility="visible"}else{for(var u=0;u'+v.label+'\n '+v.value+"\n ",p.style.transform=Ht?"translate3d("+v.rect.left+"px, "+v.rect.top+"px, 0) "+b:"translate("+v.rect.left+"px, "+v.rect.top+"px "+b,p.style.visibility="visible",f.setAttribute("cx",v.plottedX),f.setAttribute("cy",v.plottedY),f.style.visibility="visible"}else!1===v&&(p.style.visibility="hidden",f.style.visibility="hidden")}n.groupTooltip.style.visibility="hidden"}e.viewportHover&&document.documentElement.classList.add(m.chart_viewport_hover)}),this.emit("tooltipsupdated"),this)}},{key:"changeData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.options.enableValidation&&(!Q(t).valid&&this.options.strictValidation))return this;return this.data=tt(e?t:h({},this.data,t)),this.redraw(!0).emit("datachanged"),this}},{key:"addLine",value:function(t){return this.data.lines.length1&&void 0!==arguments[1]&&arguments[1];return this.options=h({},e?Yt:this.options,t),this.destroy().init().emit("optionschanged"),this}},{key:"redraw",value:function(){return!0===(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.createMetadata(),st(this.el.id),this.clearSvg().draw().emit("redraw"),this}},{key:"scrollTo",value:function(t){var e=this.dom,i=-t;return e.plotArea.x(i),e.tooltipPoints.x(i),e.axisX.x(i),this.state.viewportOffset=i,this.updateZoomFade(),this}},{key:"scrollToPoint",value:function(t){return this.scrollTo(qt(this,t)-this.metadata.axisX.plotOffset),this}},{key:"zoom",value:function(t){return Wt(this,"interactive","custom")&&this.changeOptions({zoomLevel:t}),this}},{key:"zoomToRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.data.labels.length,i=this.data.labels,n=this.metadata.axisX,o=t>=0?Math.min(t,i.length-1):Math.max(i.length+t,0),a=e>=0?Math.min(e,i.length-1):Math.max(i.length+e,0),r=Math.max(a-o,1),l=i[o].x,s=i[a].x;this.zoom(n.range/r);var d=qt(this,s)-qt(this,l)+2*n.plotOffset;return this.zoom(this.dom.viewport.bbox().width/d),this.scrollToPoint(l),this}},{key:"zoomTimePeriod",value:function(t){if("date"===this.data.labelType||"date_range"===this.data.labelType){var e=new Date;e.setDate(e.getDate()+t),this.zoom(this.metadata.axisX.range/(e-new Date))}return this}},{key:"updateZoomFade",value:function(){var t=this.dom,e=t.plotArea.x()<0,i=t.plotArea.x()>t.viewportClipRect.width()-t.plotArea.width();return t.zoomFade.setAttribute("class",(e?"fade-start ":"")+(i?"fade-end":"")),t.zoomOverlay.front(),this}},{key:"getPointPosition",value:function(t){return{left:qt(this,t.x),top:Ut(this,t.y)}}},{key:"embedStyles",value:function(){var t=this.dom;return t.stylesheet=document.createElement("style"),t.stylesheet.innerHTML=ut.replace(new RegExp("."+m.chart,"g"),"#"+this.el.id),t.chart.appendChild(t.stylesheet),this}},{key:"clearSvg",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.dom;return e.chart.removeAllChildren(),t&&e.stylesheet&&e.chart.appendChild(e.stylesheet),this}},{key:"destroy",value:function(){return this.emit("destroy"),this.clearSvg(!1),this.dom.chart.remove(),st(this.el.id),this.dom={chart:this.dom.chart},this.metadata={},this.state={},Nt.splice(Nt.indexOf(this),1),this}},{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.metadata,i=this.options,n=this.state,o=this.dom,a=this.el.getBoundingClientRect();a.width===n.svgRect.width&&!0!==t||(n.svgRect=a,n.innerWidth=a.width-2*n.chartPadding,n.innerHeight=a.height-2*n.chartPadding,n.tooltipCachedCursorX=null,i.ticks||(e.axisX.ticks=Jt(this)),this.redraw().emit("resize")),n.plotAreaOffset=o.plotArea.node.getBoundingClientRect()}},{key:"scroll",value:function(){var t=this.dom,e=this.state;e.svgRect=this.el.getBoundingClientRect(),e.plotAreaOffset=t.plotArea.node.getBoundingClientRect()}},{key:"scrollViewport",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state.dragLastEvent,i=this.state,n=this.dom;n.plotArea.x(t),n.tooltipPoints.x(t),n.axisX.x(t),this.updateZoomFade(),i.tooltipsEnabled&&e?(i.plotAreaOffset=n.plotArea.node.getBoundingClientRect(),this.updateTooltips(e.clientX)):i.tooltipsEnabled&&i.viewportFocused&&(i.plotAreaOffset=n.plotArea.node.getBoundingClientRect())}},{key:"autoScroll",value:function(){var t=this,e=this.state;if(e.autoScrolling=!0,e.lastAutoScrollID=e.autoScrollID,e.dragAmplitude){var i=Date.now()-e.dragLastTime,n=-e.dragAmplitude*Math.exp(-i/325);n>1||n<-1?(this.scrollViewport(e.dragAutoTarget+n),e.autoScrollID="autoScroll"+Math.random(),it(function(){nt(e.lastAutoScrollID),t.autoScroll()},this.state.autoScrollID)):(this.scrollViewport(e.dragAutoTarget),e.autoScrolling=!1)}else e.autoScrolling=!1}},{key:"resetVelocityTracker",value:function(){var t=this.dom,e=this.state;e.autoScrolling=!1,nt(e.autoScrollID),nt(e.lastAutoScrollID),this.stopVelocityTracker(),e.autoScrolling=!1,e.dragVelocity=0,e.dragAmplitude=0,e.dragLastX=t.plotArea.x(),e.dragLastTime=Date.now()}},{key:"startVelocityTracker",value:function(){var t=this;this.resetVelocityTracker(),It=setInterval(function(){return t.trackVelocity()},100)}},{key:"stopVelocityTracker",value:function(){this.state.dragVelocity=0,clearInterval(It)}},{key:"startAutoScroll",value:function(){var t=this.dom,e=this.state;Math.abs(e.dragVelocity)>10&&!e.autoScrolling&&(nt("panning_update"),e.dragAmplitude=.8*e.dragVelocity,this.stopVelocityTracker(),e.dragAutoTarget=this.clampViewportX(t.plotArea.x()+e.dragAmplitude),e.autoScrollID="autoScroll"+Math.random(),it(this.autoScroll.bind(this),e.autoScrollID))}},{key:"clampViewportX",value:function(t){var e=this.metadata,i=this.dom;return Math.max(Math.min(t,e.axisX.plotOffset),i.viewportClipRect.width()-i.plotArea.width()-e.axisX.plotOffset)}},{key:"trackVelocity",value:function(){var t=this.dom,e=this.state;if(e.panning){var i=t.plotArea.x(),n=Date.now()-(e.dragLastTime||Date.now()),o=1e3*(i-(e.dragLastX||0))/(1+n);e.dragVelocity=.8*o+.2*e.dragVelocity,e.dragLastTime=Date.now(),e.dragLastX=i}}},{key:"mouseEnter",value:function(){var t=this.state,e=this.dom;t.svgRect=this.el.getBoundingClientRect(),t.plotAreaOffset=e.plotArea.node.getBoundingClientRect()}},{key:"mouseMove",value:function(t){var e=this,i=this.state,n=this.dom;Bt=!1;var o,a,r,l,s,d,c={x:t.clientX-i.svgRect.left,y:t.clientY-i.svgRect.top},h=(o=c.x,a=c.y,r=n.viewport.x(),l=n.viewport.y(),s=n.viewport.x()+n.viewportClipRect.width(),d=n.viewport.y()+n.viewportClipRect.height(),o>=r&&o<=s&&a>=l&&a<=d);i.viewportHover=h,(h||Wt(this,"interactive","custom"))&&(i.tooltipsEnabled&&!i.leftMouseDown?(this.state.dragLastEvent=t,ot(function(){e.updateTooltips(t.clientX)},"tooltip_update")):1!==i.zoomLevel&&(i.panning=!0,n.chart.addClass(m.chart_panning),i.dragLastEvent=t,it(function(){var n=e.clampViewportX(c.x-i.viewportOffset);e.scrollViewport(n,t)},"panning_update"))),h||(nt("tooltip_update"),document.documentElement.classList.remove(m.chart_viewport_hover))}},{key:"touchMove",value:function(t){this.mouseMove({clientX:t.touches[0].clientX,clientY:t.touches[0].clientY})}},{key:"mouseLeave",value:function(t){Wt(this,"interactive","custom")&&1!==this.state.zoomLevel&&this.state.leftMouseDown&&(this.state.dragLastEvent=t,this.startAutoScroll())}},{key:"mouseDown",value:function(t){var e=this.state,i=this.dom;0===t.button&&(e.leftMouseDown=!0,Wt(this,"interactive","custom")&&1!==e.zoomLevel&&this.startVelocityTracker()),e.viewportOffset=function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.target).getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}}(t,this.el).x-i.plotArea.x()}},{key:"touchStart",value:function(t){this.state.leftMouseDown=!0,this.mouseDown({clientX:t.touches[0].clientX,clientY:t.touches[0].clientY})}},{key:"mouseUp",value:function(t){var e=this.state,i=this.dom;0===t.button&&(e.leftMouseDown=!1),e.panning=!1,Wt(this,"interactive","custom")&&1!==e.zoomLevel&&(e.dragLastEvent=t,this.startAutoScroll()),i.chart.removeClass(m.chart_panning)}},{key:"touchEnd",value:function(){this.mouseUp({button:0})}},{key:"focusStart",value:function(){var t=this,e=this.state;if(e.viewportFocused=!0,!e.viewportHover&&e.tooltipsEnabled){e.viewportHover=!0,e.focusIndex=0,Vt&&(Bt=!0),this.scrollViewport(this.metadata.axisX.plotOffset);var i=$t(this,0);ot(function(){t.updateTooltips(i)},"tooltip_update")}}},{key:"focusEnd",value:function(){var t=this.state;t.viewportFocused=!1,t.viewportHover=!1}},{key:"keyDown",value:function(t){var e=this,i=this.state,n=this.metadata.axisX;if(i.viewportFocused){var o=void 0;"ArrowLeft"===t.key?o=i.focusIndex-1:"ArrowRight"===t.key&&(o=i.focusIndex+1),i.focusIndex=(o%n.values.length+n.values.length)%n.values.length,Vt&&(Bt=!0);var a=qt(this,i.focusIndex);Vt&&(a=qt(this,this.metadata.axisX.values[i.focusIndex])),0===i.focusIndex?this.scrollViewport(this.metadata.axisX.plotOffset):-(a-this.metadata.axisX.plotOffset)>this.dom.plotArea.x()?this.scrollViewport(-(a-this.metadata.axisX.plotOffset)):a+this.dom.plotArea.x()>this.dom.viewportClipRect.width()-this.metadata.axisX.plotOffset&&this.scrollViewport(-a+this.dom.viewportClipRect.width()-this.metadata.axisX.plotOffset);var r=$t(this,i.focusIndex);ot(function(){e.updateTooltips(r)},"tooltip_update")}}}]),e}();h(Qt,{MODE_ARTICLE:"article",MODE_TILE:Rt,MODE_INTERACTIVE:"interactive",MODE_CUSTOM:"custom"}),window.addEventListener("resize",function(){it(function(){Nt.forEach(function(t){return t.resize()})},"resize_update")}),window.addEventListener("scroll",function(){it(function(){Nt.forEach(function(t){return t.scroll()})},"scroll_update")}),window.addEventListener("blur",function(){document.documentElement.classList.remove(m.chart_viewport_hover)}),document.addEventListener("mouseup",function(t){Nt.forEach(function(e){0===t.button&&(e.state.leftMouseDown=!1)})}),document.addEventListener("DOMContentLoaded",function(){document.body.addEventListener("typekitLoaded",function(){b={},Nt.forEach(function(t){return t.redraw(!0)})})});var te=["above","below","left","right"],ee=[];function ie(t){return t instanceof Array&&t.length}var ne=function(){function t(e){d(this,t),this.chart=e,this.selectedPoint={},this.init()}return c(t,[{key:"init",value:function(){var t=this,e=this.chart;this.build(),e.data.lines.forEach(function(e,i){var n=document.createElement("option");n.value=i,n.textContent=e.title,t.lineSelect.appendChild(n)});var i=function(){var i=e.data.lines[t.lineSelect.value];if(i){for(;t.pointSelect.firstChild;)t.pointSelect.removeChild(t.pointSelect.firstChild);i.points.forEach(function(i){var n=e.data.labels.find(function(t){return t.x===i.x});if(n){var o=document.createElement("option");o.value=i.x,o.textContent=n.text,t.pointSelect.appendChild(o),"x"in t.selectedPoint&&t.selectedPoint.x===i.x&&(o.selected=!0)}})}},n=function(){t.annotationChars.textContent=t.annotation.value.length};i(),this.lineSelect.addEventListener("change",i),this.lineSelect.addEventListener("change",this.updateControls.bind(this)),this.pointSelect.addEventListener("change",this.updateControls.bind(this)),this.showLabel.addEventListener("change",this.updateChart.bind(this)),this.labelPosition.addEventListener("change",function(){"manual"===t.labelPosition.value&&(t.labelTop=-20,t.labelLeft=0),t.updateChart()}),this.showOnTile.addEventListener("change",this.updateChart.bind(this)),this.annotation.addEventListener("keyup",n),this.annotation.addEventListener("change",function(){n(),t.updateChart()}),this.closeButton.addEventListener("click",this.close.bind(this)),this.labelHandle.addEventListener("mousedown",function(e){t.draggingLabel=!0;var i=t.labelHandle.getBoundingClientRect();t.labelHandleOffset={x:Math.round(e.clientX-i.left),y:Math.round(e.clientY-i.top),width:i.width},document.body.classList.add(m.no_select)}),e.on("dv.draw",this.reposition.bind(this)).on("dv.datachanged",this.close.bind(this)).on("dv.destroy",this.destroy.bind(this)),ee.push(this),this.updateControls()}},{key:"build",value:function(){ht('.dv-label-editor{position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;width:250px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:4px 8px;margin-left:-250px;font-family:aktiv-grotesk,aktiv-grotesk-std,Arial,Helvetica,sans-serif;font-size:13px;color:#e0e0e0;letter-spacing:0;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#404040;-webkit-transform-origin:right;-ms-transform-origin:right;transform-origin:right;-webkit-animation:a .3s;animation:a .3s}.dv-label-editor.dv-editor-closing{-webkit-animation:b .3s;animation:b .3s}.dv-label-editor p{margin:0;line-height:1.65}.dv-label-editor label,.dv-label-editor select{font-size:12px}.dv-label-editor select,.dv-label-editor textarea{color:#e0e0e0;background-color:#404040;border:0}.dv-label-editor select:focus,.dv-label-editor textarea:focus{outline:none}.dv-label-editor textarea{padding:4px 0;line-height:1.4;-webkit-box-shadow:0 2px 0 #bbb;box-shadow:0 2px 0 #bbb}.dv-label-editor textarea:focus{-webkit-box-shadow:0 2px 0 #009d4e;box-shadow:0 2px 0 #009d4e}.dv-label-editor select{max-width:210px;height:20px;margin:0 -4px;border-bottom:2px solid transparent;-webkit-box-shadow:0 6px 0 -4px #bbb;box-shadow:0 6px 0 -4px #bbb}.dv-label-editor select:focus{outline:none;-webkit-box-shadow:0 0 0 1px #009d4e;box-shadow:0 0 0 1px #009d4e}.dv-label-editor .dv-editor-label-position{height:17px;margin-top:1px;margin-left:1px}.dv-editor-row{-ms-flex-wrap:wrap;flex-wrap:wrap}.dv-editor-column,.dv-editor-row{display:-webkit-box;display:-ms-flexbox;display:flex}.dv-editor-column{margin:8px 12px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.dv-smallcaps{font-size:11px;color:#e0e0e0;text-transform:uppercase;letter-spacing:.1em}.dv-editor-line{width:100%}.dv-editor-point-value{color:#009d4e}.dv-editor-point-options label,.dv-editor-point-options select{float:left}.dv-editor-point-options label{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.dv-editor-point-options input[type=checkbox]{margin:0 6px 0 0}.dv-editor-annotation-row,.dv-editor-annotation-row .dv-editor-column,.dv-editor-annotation-row textarea{-webkit-box-flex:1;-ms-flex:1;flex:1}.dv-editor-annotation-row .dv-editor-column{display:-webkit-box;display:-ms-flexbox;display:flex}.dv-annotation-chars{margin-top:3px;font-size:11px}.dv-selected-point{width:7px;height:7px;border:3px solid #f0f8f0;border-radius:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.dv-label-handle,.dv-selected-point{position:absolute;-webkit-box-sizing:content-box;box-sizing:content-box}.dv-label-handle{display:none;padding:4px;margin:-4px;cursor:move;border-radius:3px}.dv-label-handle:hover{background-color:rgba(0,0,0,.1)}.dv-editor-close{position:absolute;top:8px;right:8px;width:18px;height:18px;padding:0;background-color:transparent;border:0}.dv-editor-close:after,.dv-editor-close:before{position:absolute;display:block;width:18px;height:2px;content:"";background-color:#009d4e}.dv-editor-close:before{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.dv-editor-close:after{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.dv-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@-webkit-keyframes a{0%{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}to{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}}@keyframes a{0%{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}to{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}}@-webkit-keyframes b{0%{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}to{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}}@keyframes b{0%{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}to{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}}'),this.container=document.createElement("div");var t=this.container;t.className=m.label_editor,t.innerHTML='\n
\n \n
\n\n
\n \n\n
\n

Value

\n

\n
\n
\n\n
\n
\n

Options

\n

\n \n\n \n

\n

\n \n

\n
\n
\n\n
\n \n
\n\n \n ',rt(t),this.lineSelect=t.querySelector(".dv-editor-line"),this.pointSelect=t.querySelector(".dv-editor-point"),this.pointValue=t.querySelector(".dv-editor-point-value"),this.showLabel=t.querySelector(".dv-editor-show-label"),this.labelPosition=t.querySelector(".dv-editor-label-position"),this.showOnTile=t.querySelector(".dv-editor-show-on-tile"),this.annotation=t.querySelector(".dv-editor-annotation"),this.annotationChars=t.querySelector(".dv-annotation-chars-current"),this.closeButton=t.querySelector(".dv-editor-close"),this.selectedPointIndicator=document.createElement("div"),this.selectedPointIndicator.className=m.selected_point,rt(this.selectedPointIndicator),this.labelHandle=document.createElement("div"),this.labelHandle.className=m.label_handle,rt(this.labelHandle)}},{key:"updateControls",value:function(){var t=this,e=this.chart,i=this.selectedPoint,n=e.options.pointLabels,o=Number(this.lineSelect.value),a=e.data.lines[o];if(a){var r=a.points.find(function(e){return e.x===Number(t.pointSelect.value)});if(r){this.pointValue.textContent=r.y,this.selectedPointIndicator.style.backgroundColor=a.color,i.x=r.x,i.y=r.y,i.key=o+","+r.x;var l=i.key;n&&ie(n[l])?(this.showLabel.checked=!0,this.labelPosition.value=te.indexOf(n[l][0])>-1?n[l][0]:"manual",this.showOnTile.checked=!!n[l][1],this.annotation.value=n[l][2]||""):(this.showLabel.checked=!1,this.showOnTile.checked=!1,this.labelPosition.value="above",this.annotation.value=""),this.annotationChars.textContent=this.annotation.value.length,this.reposition()}}}},{key:"reposition",value:function(){var t=this.chart,e=this.selectedPoint,i=t.el.getBoundingClientRect();this.container.style.top=window.pageYOffset+i.top+"px",this.container.style.left=i.left+"px",this.container.style.height=i.height+"px";var n=t.dom.plotArea.node.getBoundingClientRect(),o=t.getPointPosition({x:e.x,y:e.y});e.screenX=n.left+o.left,e.screenY=window.pageYOffset+n.top+o.top,this.selectedPointIndicator.style.top=e.screenY+"px",this.selectedPointIndicator.style.left=e.screenX+"px",this.updateLabelHandle()}},{key:"updateChart",value:function(){var t=this.chart,e=this.selectedPoint.key,i=t.options.pointLabels||{},n="manual"===this.labelPosition.value?this.labelTop+" "+this.labelLeft:this.labelPosition.value;this.showLabel.checked?(i[e]=i[e]||[],i[e][0]=n,i[e][1]=this.showOnTile.checked?1:0,i[e][2]=this.annotation.value):delete i[e],t.options.pointLabels=i,t.redraw(),this.updateLabelHandle(),t.emit("pointlabelschanged")}},{key:"updateLabelHandle",value:function(){var t=this.chart,e=t.options.pointLabels||{},i=this.selectedPoint.key,n=t.el.querySelector('[data-key="'+i+'"]');if(n){var o=n.getBoundingClientRect();if(this.labelHandle.style.top=window.pageYOffset+o.top+"px",this.labelHandle.style.left=o.left+"px",this.labelHandle.style.width=o.width+"px",this.labelHandle.style.height=o.height+"px",n.getAttribute("data-position")){var a=n.getAttribute("data-position").split(" "),r=f(a,2),l=r[0],s=r[1];this.labelLeft=s,this.labelTop=l}ie(e[i])&&-1===te.indexOf(e[i][0])?this.labelHandle.style.display="block":this.labelHandle.style.display="none"}}},{key:"close",value:function(){var t=this;this.container.classList.add(m.label_editor_closing),setTimeout(function(){return t.destroy()},300)}},{key:"destroy",value:function(){lt(this.container),lt(this.selectedPointIndicator),lt(this.labelHandle),this.chart.editor=null,this.chart.emit("editorclose"),ee.splice(ee.indexOf(this),1)}}]),t}();document.addEventListener("mouseup",function(){ee.forEach(function(t){t.draggingLabel=!1}),document.body.classList.remove(m.no_select)}),document.addEventListener("mousemove",function(t){it(function(){ee.forEach(function(e){if(e.draggingLabel){var i=t.clientX-e.labelHandleOffset.x,n=window.pageYOffset+t.clientY-e.labelHandleOffset.y;e.labelLeft=i-(e.selectedPoint.screenX+e.labelHandleOffset.width/2),e.labelTop=n-e.selectedPoint.screenY,e.labelHandle.style.left=i+"px",e.labelHandle.style.top=n+"px",clearTimeout(e.labelHandleUpdate),e.labelHandleUpdate=setTimeout(function(){return e.updateChart()},50)}})},"editor_drag_label")}),window.addEventListener("resize",function(){it(function(){ee.forEach(function(t){return t.reposition()})},"editor_reposition")}),t.LineChart=Qt,t.PointLabelEditor=ne,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=dataviz.js.map ; this.wwwV8=this.wwwV8||{},this.wwwV8.pjac=function(){"use strict";!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===a&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".c-pjac{font-size:14px;color:#666}.c-pjac--loading{position:relative}.c-pjac--loading:after,.c-pjac--loading:before{position:absolute;top:50%;left:50%;width:50px;height:50px;margin-top:-25px;margin-left:-25px;content:\"\";border:4px solid transparent;border-top-color:#009d4e;border-radius:50%;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite;animation:a 1.1s infinite}.c-pjac--loading:before{-webkit-animation-timing-function:cubic-bezier(.455,.065,.425,1);animation-timing-function:cubic-bezier(.455,.065,.425,1)}.c-pjac--loading:after{-webkit-animation-timing-function:linear;animation-timing-function:linear}.c-pjac__chart-footer{display:flex;padding:10px;justify-content:space-between;background-color:#f0f8f0}.c-pjac__chart-footer-logo{width:60px;height:20px;background-repeat:no-repeat;background-image:url(https://asset.gallup.com/p/WWWV7INTERACTIVES/7453f2fd-8d09-40bf-929b-96398253799a.svg)}.c-pjac__chart-units{text-transform:uppercase;letter-spacing:.1em;font-size:11px;font-weight:400;line-height:1.5;color:#666}.c-pjac__select-label{margin:0;font:inherit;color:inherit;text-transform:none;letter-spacing:0}.c-pjac__select{height:30px;margin:0 10px;color:#2b2b2b;background-color:transparent;border:0;border-radius:0;box-shadow:inset 0 -1px 0 #929292}.c-pjac__btn-container{margin:20px 0;color:#000;text-align:center}.c-pjac__btn{display:none}.c-pjac--mode-all .c-pjac__btn--compare,.c-pjac--mode-compare .c-pjac__btn--add,.c-pjac .dropdown{display:inline-block}.c-pjac .dropdown{padding-bottom:10px;margin-top:10px;border:1px solid transparent}.c-pjac .dropdown,.c-pjac .dropdown .dropdown-toggle{background-color:#fff;border-radius:4px 4px 0 0}.c-pjac .open{border-color:#bbb}.c-pjac .open .dropdown-toggle{z-index:2;background-color:#fff}.c-pjac .open .dropdown-toggle:after{position:absolute;right:0;bottom:-10px;left:0;z-index:2;height:1px;content:\"\";background-color:#fff}.c-pjac .dropdown-toggle{position:relative;display:block;padding:6px 10px;line-height:normal;color:#2b2b2b;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.c-pjac .dropdown-toggle:focus{outline:1px dotted #009d4e}.c-pjac .dropdown-toggle:before{position:absolute;top:100%;right:10px;left:10px;height:1px;content:\"\";background-color:#929292}.c-pjac .dropdown-toggle .caret{border-top-color:#929292}.c-pjac .dropdown-menu{z-index:1;padding:10px 20px 0 10px;margin-top:-1px;margin-left:-1px;font-size:inherit;border-color:#bbb;border-radius:0}.c-pjac .dropdown-menu ul{padding:0 0 0 20px}.c-pjac .dropdown-menu li{padding:4px 0;line-height:1.15;list-style-type:none}.c-pjac .dropdown-menu li ul{padding-bottom:8px}.c-pjac .dropdown-menu li a{display:inline-block;color:#2b2b2b;white-space:nowrap}.c-pjac .dropdown-menu li .selected{position:relative}.c-pjac .dropdown-menu li .selected:before{position:absolute;right:100%;width:16px;height:16px;margin-right:5px;content:\"\";background-image:url(/scriptbundle/fusion/pjac/"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http:/www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cpath d='M34.5 83.2c-1.7 0-3.3-.6-4.6-1.8L1.8 56c-1.6-1.5-1.8-4-.3-5.6 1.5-1.6 4-1.8 5.6-.3l27.3 24.7 57.5-55.7c1.6-1.5 4.1-1.5 5.7.1 1.5 1.6 1.5 4.1-.1 5.7L39.3 81.2c-1.3 1.3-3.1 2-4.8 2z' stroke='%23009D4E' stroke-width='5' fill='%23009D4E'/%3E%3C/svg%3E/");background-repeat:no-repeat;background-size:16px 16px}.c-pjac .dropdown-menu li.divider{padding:0;margin:4px 0;background-color:#bbb}.c-pjac .dropdown-menu li .disabled{color:#e0e0e0;pointer-events:none}.c-pjac .dropdown-menu .group-title{margin:0 0 5px 5px;color:#404040;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-transform:uppercase;letter-spacing:.1em;font-size:11px;font-weight:400;line-height:1.5}@media (max-width:959px){.c-pjac .dropdown{padding-bottom:0;margin-top:0}}@media (min-width:640px){.c-pjac .multi-column{position:static}.c-pjac .multi-column .dropdown-toggle:after{bottom:-6px}.c-pjac .multi-column .dropdown-menu{top:58px;left:50%;max-width:calc(100% - 20px);margin-left:0;-webkit-transform:translateX(-50%);transform:translateX(-50%);-webkit-column-count:3;-moz-column-count:3;column-count:3;-webkit-column-gap:30px;-moz-column-gap:30px;column-gap:30px}.c-pjac .multi-column .dropdown-menu>li{-webkit-column-break-inside:avoid;-moz-column-break-inside:avoid;break-inside:avoid;overflow:hidden}}@media (min-width:960px){.c-pjac .dropdown.multi-column .dropdown-menu{-webkit-column-count:4;-moz-column-count:4;column-count:4}}.c-pjac-timeframe{padding:15px 10px;margin:0;background-color:#fff}.c-pjac-timeframe__btn-container{display:flex;flex-wrap:wrap}.c-pjac-timeframe__btn{padding:0 5px;margin:0 5px}.c-pjac-timeframe__btn.is-active{font-weight:700;color:#000}.c-pjac-line:before{display:block;width:100%;height:10px;content:\"\"}.c-pjac-line__container{position:relative;display:flex;align-items:center;flex-wrap:wrap;padding:10px;background-color:#fff}.c-pjac-line__pres-image{width:48px;height:48px;margin-right:10px;background-color:#bbb;background-size:100%;border-radius:50%}.c-pjac-line__demographic,.c-pjac-line__metric,.c-pjac-line__values{width:100%;padding-left:58px;margin-top:10px}.c-pjac-line__demographic-text{margin-left:10px}.c-pjac-line__president .c-pjac__select,.c-pjac-line__president .dropdown-toggle{font-size:16px}.c-pjac-line--empty .c-pjac-line__values{display:none}.c-pjac-line__value-x,.c-pjac-line__value-y{vertical-align:middle}.c-pjac-line__value-y{margin:0 10px;font-size:31px;font-weight:300;line-height:1.5}.c-pjac-line__value-x{font-weight:700;color:#404040}.c-pjac-line__label-y{display:block;margin-left:10px}.c-pjac-line__remove-btn{position:absolute;top:10px;right:10px;width:32px;height:32px;padding:0;-webkit-appearance:none;background-color:transparent;border:0;border-radius:50%;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.c-pjac-line__remove-btn:hover{background-color:#e0e0e0}.c-pjac-line__remove-btn:focus{outline:0;box-shadow:0 0 0 2px #009d4e}.c-pjac-line__remove-btn:disabled{background-color:transparent}.c-pjac-line__remove-btn:disabled:after,.c-pjac-line__remove-btn:disabled:before{background-color:#bbb}.c-pjac-line__remove-btn:after,.c-pjac-line__remove-btn:before{position:absolute;top:50%;left:50%;display:block;content:\"\";background-color:#666;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.c-pjac-line__remove-btn:before{width:66.6667%;height:2px}.c-pjac-line__remove-btn:after{width:2px;height:66.6667%}@media (min-width:650px){.c-pjac-line__demographic,.c-pjac-line__metric,.c-pjac-line__values{padding-left:0;margin-top:0}.c-pjac-line__demographic,.c-pjac-line__metric{width:auto}.c-pjac-line__demographic-text{margin-left:5px}.c-pjac-line__values{text-align:center}.c-pjac-line:not(.c-pjac-line--empty) .c-pjac-line__values{display:block}.c-pjac-line__label-x{display:inline;margin-left:0}}@media (min-width:960px){.c-pjac-line__values{width:auto;margin-right:52px;margin-left:auto}.c-pjac-line__remove-btn{top:20px}}.c-pjac-keystats{overflow-y:hidden;background-color:#f0f8f0;transition:height .25s cubic-bezier(.22,.61,.36,1)}.c-pjac-keystats.is-collapsed{height:40px}.c-pjac-line--all-presidents .c-pjac-keystats,.c-pjac-line--empty .c-pjac-keystats{display:none}.c-pjac-keystats__toggle{width:100%;height:40px;padding:0 20px;text-align:left}.c-pjac-keystats__toggle .caret{border-top:0;border-bottom:4px dashed}.c-pjac-keystats.is-collapsed .c-pjac-keystats__toggle .caret{border-top:4px dashed;border-bottom:0}.c-pjac-keystats__container{padding:10px 20px 20px}.c-pjac-keystats__table{width:100%;border:0}.c-pjac-keystats__table.c-pjac-keystats__table{background-color:transparent}.c-pjac-keystats__table th{border:0}.c-pjac-keystats__table td{padding:5px 0;color:#2b2b2b;border-bottom:2px solid #fff}.c-pjac-keystats__table td:last-child{border-bottom:0}.c-pjac-keystats__table td[data-th]:before{width:120px;content:attr(data-th)}.c-pjac-keystats__table td[data-th]:before,.c-pjac-keystats__table th{color:#666;text-transform:uppercase;letter-spacing:.1em;font-size:11px;font-weight:400;line-height:1.5}@media (min-width:960px){.c-pjac-keystats__table td,.c-pjac-keystats__table th{padding:0 10px 0 0}.c-pjac-keystats__table td{border-bottom:0;font-size:31px;font-weight:300;line-height:1.5}}.c-pjac-keystats__toggle,.c-pjac-timeframe__btn{color:#666;background-color:transparent;border:0;text-transform:uppercase;letter-spacing:.1em;font-size:11px;font-weight:400;line-height:1.5}.c-pjac-keystats__toggle:hover,.c-pjac-timeframe__btn:hover{color:#1a1a1a}.c-pjac-keystats__toggle:disabled,.c-pjac-timeframe__btn:disabled{color:#bbb}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}");var e={expanded:{Overall:{A:"All Adults",D:"All Adults"},Gender:{M:"Male",F:"Female"},Age:{A:"18 to 29",B:"30 to 49",C:"50 to 64",D:"65+"},Region:{E:"East",M:"Midwest",S:"South",W:"West"},Race:{W:"White",N:"Nonwhite",B:"Black",H:"Hispanic"},Education:{HS:"High School or Less",SC:"Some College",CG:"College Graduate",PG:"Postgraduate",aCG:"All College Graduates",aCNG:"All College Non-Graduates"},Income:{A:"Under $2,000",B:"$2,000 to $4,999",C:"$5,000 to $7,499",D:"$7,500 or more"},Party:{D:"Democrat",I:"Independent",R:"Republican"},Ideology:{L:"Liberal",M:"Moderate",C:"Conservative"},PartyIdeology:{LD:"Liberal Democrat",MD:"Moderate Democrat",CD:"Conservative Democrat",PM:"Pure Independent",LR:"Lib./Mod. Republican",CR:"Conservative Republican"},Church:{W:"Weekly",M:"Nearly Weekly/Monthly",N:"Seldom/Never"},Married:{Y:"Married",N:"Not Married"}},historical:{Overall:{Approve:"All Adults",Disapprove:"All Adults"},Party:{Dem:"Democrat",Rep:"Republican",Ind:"Independent"}},demographicCategory:{Approve:"Overall",Disapprove:"Overall",Dem:"Party",Rep:"Party",Ind:"Party"}};function t(e){var t=e;if(t.method||(t.method="GET"),t.params||(t.params={}),t.method=t.method.toUpperCase(),"GET"===t.method){var a=Object.keys(t.params).map(function(e){return e+"="+t.params[e]}).join("&");t.url+="?"+a}var o=new XMLHttpRequest;o.open(t.method,t.url,!0),t.success&&"function"==typeof t.success&&o.addEventListener("load",function(){o.status>=200&&o.status<400?t.success(o.responseText):t.error&&"function"==typeof t.error&&t.error()}),t.error&&"function"==typeof t.error&&o.addEventListener("error",t.error),t.contentType&&o.setRequestHeader("Content-Type",t.contentType),"POST"===t.method?(t.contentType||o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8"),o.send(t.params)):o.send()}var a=["January","February","March","April","May","June","July","August","September","October","November","December"],o=a.map(function(e){return e.substr(0,3)}),n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=n.map(function(e){return e.substr(0,3)}),i=1e3,l=60*i,c=60*l,p=24*c;function s(e,t){return void 0===t&&(t=2),Array(t-e.toString().length+1).join("0")+e}function d(e){return Math.ceil((e.getMonth()+1)/3)}function u(e){return void 0===e&&(e=new Date),{yyyy:e.getUTCFullYear(),yy:e.getUTCFullYear().toString().substr(2),mmmm:a[e.getUTCMonth()],mmm:o[e.getUTCMonth()],mm:s(e.getUTCMonth()+1),m:e.getUTCMonth()+1,dddd:n[e.getUTCDay()],ddd:r[e.getUTCDay()],dd:s(e.getUTCDate()),d:e.getUTCDate(),qq:s(d(e)),q:d(e)}}var m=new RegExp(Object.keys(u()).join("|"),"g");function v(e,t){var a=u(e);return t.replace(m,function(e){return a[e]})}function h(e,t,a){if("years"===a)return Math.abs(e.getFullYear()-t.getFullYear());if("months"===a)return Math.abs(e.getMonth()-t.getMonth())+12*h(e,t,"years");if("days"===a){var o=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),n=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor(Math.abs(o-n)/p)}return"hours"===a?Math.floor(Math.abs(e-t)/c):"minutes"===a?Math.floor(Math.abs(e-t)/l):"seconds"===a?Math.floor(Math.abs(e-t)/i):h(e,t,"days")}function g(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild}function b(e,t){var a=document.createEvent("Event");a.initEvent(t,!0,!0),e.dispatchEvent(a)}var f,y,_,j,x,w,k,S,A='
',C='
on day in office
',E=' ',L=' ',D=' ',M=function(){var e=document.querySelectorAll(".dv-lines-group .dv-line"),t=document.querySelectorAll(".dv-legend .dv-line");e.forEach(function(e){var t=e.getAttribute("data-line-id");T(e,t)}),t.forEach(function(e){var t=e.getAttribute("data-line-id");T(e,t)})},T=function(e,t){1==t?e.setAttribute("stroke-dasharray","5 5"):2==t?e.setAttribute("stroke-dasharray","2 2"):0!=t&&3!=t||e.setAttribute("stroke-dasharray","")},q="//content.gallup.com/origin/gallupinc/GallupSpaces/Production/Cms/WWWV7INTERACTIVES/t_zbzetnw0k_jtj88ipxqw.png",N=640,P=960,R="cubic-bezier(0.22, 0.61, 0.36, 1)",O=window.innerWidth>=N,I="Term 1 High",H="Term 1 Low",z="Term 2 High",W="Term 2 Low",F="Approval High",U="Approval Low",G=window.gel.dataviz.LineChart,Y={},$=[],J={},V=[],X=[],B=[],Z=[],K=!1,Q=[],ee=0,te=0,ae="Days",oe=!1,ne=!1,re=document.createElement("style");function ie(t,a){void 0===a&&(a=!1);var o=$.find(function(e){return e.name===t.PresidentName});if(o)return o;var n=function(e){var t=e.PresidentName.split(" "),a=t.length?t[t.length-1]:e.PresidentName;return e.PreferredLastName?e.PreferredLastName:a}(t),r={expandedDemos:a,name:t.PresidentName,lastName:n,startDate:new Date(t.Start||t.StartDate),endDate:t.End||t.EndDate?new Date(t.End||t.EndDate):null,party:t.Party.toLowerCase().indexOf("dem")>-1?"democratic":"republican",datesInOffice:t.DatesinOffice||"-",daysInOffice:t.DaysInOffice||"-",overallAvg:t.OverallAverage||"-",firstTermAvg:t.FirstTermAverage||"-",secondTermAvg:t.SecondTermAverage||"-",approvalHigh:t.JobApprovalHigh||"-",approvalLow:t.JobApprovalLow||"-",lines:function(t){void 0===t&&(t=!1);var a=e[t?"expanded":"historical"],o=t?"D":"Disapprove",n=[];return Object.keys(a).forEach(function(e){Object.keys(a[e]).forEach(function(t){var r="Overall"===e&&t===o?"disapproval":"approval",i=a[e][t],l={cut:e,metric:r,demographic:i,key:e+"-"+t,titleTemplate:"##PRESIDENT## job "+r+" - "+i,points:[]};l.demographic.indexOf("Democrat")>-1?l.color="democratic":l.demographic.indexOf("Republican")>-1?l.color="republican":l.demographic.indexOf("Independent")>-1?l.color="independent":l.metric.indexOf("disapproval")>-1?l.color="disapproval":l.color="polcategorical",n.push(l)})}),n}(a)};return $.push(r),r}function le(){if(K)return Q;if(!j)return[];var e=j.metadata.axisX.axisMax,t=1;Math.floor(e/j.options.zoomLevel)>90?(t=7,ae="Weeks"):ae="Days",e/=t;var a,o=(j?j.dom.plotArea.width():w)/100,n=Math.max(e/o,1),r=Math.floor(Math.log(Math.abs(n))/Math.LN10),i=Math.pow(10,r),l=n/i,c=[];a=l>5?8*i:l>2.5?4*i:l>1.5?2*i:i;for(var p=0;p<=e;p+=a)c.push({x:p*t,text:p.toString()});return c}function ce(e,t){e.dropdown?e.dropdown.setValue(t):(e.value=t,b(e,"change"))}function pe(e){if(void 0===e&&(e=!1),X.length&&"all"===X[0].president.value){var t,a,o=!0===e?j.metadata.axisX.max:j.metadata.lastTooltipXValue;return j.data.lines.forEach(function(e){var n=e.points.find(function(e){return e.x===o});n&&(t=e,a=n)}),void(t&&a&&(X[0].currentX.textContent=S[a.x],X[0].currentY.textContent=a.y+"%",X[0].currentY.style.color="#009D4F"))}j.data.lines.forEach(function(t){var a=X[t.id];if(a&&a.president.value){var o=t.points[t.points.length-1],n=!0===e?o.x:j.metadata.tooltips[t.id].x,r=!0===e?o.y:j.metadata.tooltips[t.id].y;n&&r&&(a.currentX.textContent=n,a.currentY.textContent=r+"%",a.currentY.style.color=t.color)}}),M()}function se(){B=[],Z=[],X.forEach(function(e){var t=$.find(function(t){return t.name===e.president.value});if(t){var a=e.metric.value,o=e.demographic.value;"own_party"===o?o="democratic"===t.party?"Democrat":"Republican":"opp_party"===o&&(o="democratic"===t.party?"Republican":"Democrat");var n=t.lines.find(function(e){return e.metric===a&&e.demographic===o});n.title||(n.title=n.titleTemplate.replace("##PRESIDENT##",t.lastName)),B.push(n),Z.push(n.labelSet),e.currentY.style.color=n.color}else if("all"===e.president.value){var r=new Date(1900,0,1);Q=[],S={},$.forEach(function(e){var t=e.lines.find(function(e){return"Overall"===e.cut&&"approval"===e.metric});if(t){var a=Y[t.labelSet];Q.push({x:h(r,a[t.points[0].x].date,"days"),text:e.lastName});var o=[];t.points.forEach(function(e){var t=h(r,a[e.x].date,"days");S[t]=e.x,o.push({x:t,y:e.y})}),B.push({points:o,allPres:!0,title:e.lastName,color:"#009D4F"})}})}else B.push(null),Z.push(null)}),function(){V.forEach(function(e,t){B[t]&&(e.includes(B[t].title)||B.forEach(function(a,o){a&&e.includes(a.title)&&B.splice(t,0,B.splice(o,1)[0])}))});var e=document.querySelector("#srTableContainer");e&&e.remove();var t=document.createElement("div");t.id="srTableContainer",t.classList.add("sr-only"),document.querySelector(".c-pjac").appendChild(t);var a=document.createElement("table");a.id="srTable",t.appendChild(a);var o=document.createElement("caption"),n=document.createTextNode("Presidential Job Approval data table");o.appendChild(n),a.appendChild(o),B.forEach(function(e){if(e){var t=document.createElement("th");t.setAttribute("scope","row");var o=document.createTextNode(e.title);t.appendChild(o);var n=document.createElement("tr");a.appendChild(n),n.appendChild(t);var r=$[$.findIndex(function(t){return e.title.includes(t.lastName)})],i=document.createElement("td"),l=document.createTextNode("Overall average approval: "+r.overallAvg+"%");i.appendChild(l),n.appendChild(i),e.points.forEach(function(e){var t=S[e.x]?S[e.x]:e.x,a=document.createElement("td"),o=document.createTextNode(e.y+"% on day "+t+" in office");a.appendChild(o),n.appendChild(a)})}})}()}function de(){var e=f.querySelector(".c-pjac__chart-units");K||!B.filter(function(e){return!!e}).length?e.style.display="none":(e.style.display="",e.textContent=ae+" in office")}function ue(){se();var e=K;if((K=B.filter(function(e){return!!e&&!!e.allPres}).length>0)||1===j.options.zoomLevel||j.zoom(1),j.changeData({lines:B},!0).changeOptions({ticks:le()}),e!==K){var t=j.options.wrapAxisLabels;j.changeOptions({x_axis_min:K?null:0,showLegend:!K,strictModeTooltips:K,wrapAxisLabels:K}),t!==K&&j.redraw(!0)}if(!K&&"all"!==_.value){var a=parseFloat(_.value);j.zoom(j.metadata.axisX.range/a);var o=le();j.changeOptions({ticks:o})}K?(f.classList.add("c-pjac--mode-all"),f.classList.remove("c-pjac--mode-compare")):oe||(f.classList.add("c-pjac--mode-compare"),f.classList.remove("c-pjac--mode-all")),window.innerWidth=4}function ve(e){var t=$.find(function(t){return t.name===e.president.value});if(e.toggleStats.setAttribute("aria-label",e.president.value+" Approval Snapshot"),e.keyStatsTable.setAttribute("aria-label",e.president.value+" Approval Snapshot Table"),e.controls.querySelector(".c-pjac-line__remove-btn").setAttribute("aria-label","Remove "+e.president.value),t){e.image.style.backgroundImage="url("+J[e.president.value]+")",e.controls.classList.remove("c-pjac-line--all-presidents");var a=t.datesInOffice.replace("Present","").replace("-","–");e.keyStats.querySelector(".dates-in-office").innerHTML=a,e.keyStats.querySelector(".days-in-office").textContent=t.daysInOffice,e.keyStats.querySelector(".overall-avg").textContent="-"!==t.overallAvg?Math.round(t.overallAvg)+"%":"-",e.keyStats.querySelector(".first-term-avg").textContent="-"!==t.firstTermAvg?Math.round(t.firstTermAvg)+"%":"-",e.keyStats.querySelector(".second-term-avg").textContent="-"!==t.secondTermAvg?Math.round(t.secondTermAvg)+"%":"-",e.keyStats.querySelector(".approval-high").textContent="-"!==t.approvalHigh?Math.round(t.approvalHigh)+"%":"-",e.keyStats.querySelector(".approval-low").textContent="-"!==t.approvalLow?Math.round(t.approvalLow)+"%":"-";var o=e.demographic.value;if("approval"===e.metric.value?e.demographic.innerHTML=t.expandedDemos?L:E:e.demographic.innerHTML=D,"Donald J. Trump (Term 1)"===e.president.value?(e.keyStats.querySelector(".approval-high-label").textContent=I,e.keyStats.querySelector(".approval-high").setAttribute("data-th",I),e.keyStats.querySelector(".approval-low-label").textContent=H,e.keyStats.querySelector(".approval-low").setAttribute("data-th",H)):"Donald J. Trump (Term 2)"===e.president.value?(e.keyStats.querySelector(".approval-high-label").textContent=z,e.keyStats.querySelector(".approval-high").setAttribute("data-th",z),e.keyStats.querySelector(".approval-low-label").textContent=W,e.keyStats.querySelector(".approval-low").setAttribute("data-th",W)):(e.keyStats.querySelector(".approval-high-label").textContent=F,e.keyStats.querySelector(".approval-high").setAttribute("data-th",F),e.keyStats.querySelector(".approval-low-label").textContent=U,e.keyStats.querySelector(".approval-low").setAttribute("data-th",U)),"approval"===e.metric.value)e.demographic.dropdown&&(t.expandedDemos?e.demographic.dropdown.dropdown.classList.add("multi-column"):e.demographic.dropdown.dropdown.classList.remove("multi-column"),e.demographic.dropdown.update()),e.demographic.querySelectorAll("option").forEach(function(a){if("own_party"!==a.value&&"opp_party"!==a.value){var o=t.lines.find(function(t){return t.metric===e.metric.value&&t.demographic===a.value}),n=o&&o.points&&o.points.filter(function(e){return null!=e.y&&Number.isFinite(e.y)}).length>=2;a.disabled=!n}});if(e.demographic.dropdown)e.demographic.dropdown.update(),e.demographic.dropdown.menu.querySelectorAll("a").forEach(function(t){var a=t.getAttribute("data-value"),o=e.demographic.querySelector('option[value="'+a+'"]');o&&o.disabled?(t.classList.add("disabled"),t.setAttribute("disabled","")):(t.classList.remove("disabled"),t.removeAttribute("disabled"))});e.demographic.querySelector('[value="'+o+'"]')&&ce(e.demographic,o)}else"all"===e.president.value&&(e.controls.classList.add("c-pjac-line--all-presidents"),e.controls.id="c-pjac--demographic-groups",function(e){X.filter(function(t){return t!==e}).forEach(function(e){return me(e)}),e.image.style.backgroundImage="url("+q+")",f.classList.add("c-pjac--mode-all"),f.classList.remove("c-pjac--mode-compare"),"approval"!==e.metric.value&&ce(e.metric,"approval"),e.metric.querySelector('[value="disapproval"]').disabled=!0,e.metric.dropdown&&(e.metric.dropdown.update(),e.metric.dropdown.menu.querySelector('[data-value="disapproval"]').parentNode.style.display="none"),e.demographic.innerHTML=D,e.demographic.dropdown&&(e.demographic.dropdown.update(),e.demographic.dropdown.dropdown.classList.remove("multi-column"))}(e));"all"!==e.president.value&&e.metric.querySelector('[value="disapproval"]').disabled&&(e.metric.querySelector('[value="disapproval"]').disabled=!1,e.metric.dropdown&&(e.metric.dropdown.update(),e.metric.dropdown.menu.querySelector('[data-value="disapproval"]').parentNode.style.display=""))}document.head.appendChild(re);var he=function(){var e=document.querySelectorAll(".c-pjac-line--empty"),t=document.querySelector(".c-pjac__btn--add"),a=document.querySelector(".c-pjac__btn--compare");(void 0!==e||e.length>0)&&(e[0].scrollIntoView({behavior:"smooth",block:"nearest"}),e[0].focus(),t.blur(),a.blur())};function ge(){var e,t={};(t.controls=g(C),x.appendChild(t.controls),function(e,t){void 0===t&&(t=null),e.style.height="auto";var a=e.offsetHeight;e.style.height="",e.offsetHeight,re.innerHTML="\n @keyframes chart-line-enter {\n 0% {\n opacity: 0;\n height: 0;\n }\n 50% {\n opacity: 0;\n height: "+a+"px;\n }\n 100% {\n opacity: 1;\n }\n }\n ",e.style.animation="chart-line-enter 0.5s "+R+" forwards";var o=function(){e.style.animation="",t&&t(),e.removeEventListener("animationend",o),e.removeEventListener("webkitAnimationEnd",o)};e.addEventListener("animationend",o),e.addEventListener("webkitAnimationEnd",o)}(t.controls),t.image=t.controls.querySelector(".c-pjac-line__pres-image"),t.president=t.controls.querySelector(".c-pjac-line__president .c-pjac__select"),t.metric=t.controls.querySelector(".c-pjac-line__metric .c-pjac__select"),t.demographic=t.controls.querySelector(".c-pjac-line__demographic .c-pjac__select"),t.currentValues=t.controls.querySelector(".c-pjac-line__values"),t.currentY=t.controls.querySelector(".c-pjac-line__value-y"),t.currentX=t.controls.querySelector(".c-pjac-line__value-x"),t.toggleStats=t.controls.querySelector(".c-pjac-keystats__toggle"),t.keyStats=t.controls.querySelector(".c-pjac-keystats"),t.keyStatsTable=t.controls.querySelector(".c-pjac-keystats__table"),V.length&&((e=t.president).innerHTML="\n \n "+V.map(function(e){return'"}).join("")+'\n \n \n ',e.dropdown&&e.dropdown.update()),t.demographic.innerHTML=E,O)&&Array.prototype.slice.call(t.controls.querySelectorAll("[data-dropdown-select]")).forEach(function(e){e.dropdown=new DropdownSelect(e),e.dropdown.toggle.href="#"});return t.president.addEventListener("change",function(){var e=$.find(function(e){return e.name===t.president.value});if(e){var a=t.demographic.value;if("own_party"!==a&&"opp_party"!==a){var o=e.lines.find(function(e){return e.metric===t.metric.value&&e.demographic===a});o&&o.points&&o.points.filter(function(e){return null!=e.y&&Number.isFinite(e.y)}).length>=2||ce(t.demographic,"All Adults")}}else ce(t.demographic,"All Adults");ve(t),t.controls.classList.remove("c-pjac-line--empty"),ue()}),t.metric.addEventListener("change",function(){ve(t),ue()}),t.demographic.addEventListener("change",ue),t.toggleStats.addEventListener("click",function(){!function(e){var t=e.keyStats,a=e.toggleStats;if(t.classList.contains("is-collapsed")){a.ariaExpanded="true",t.style.height="auto";var o=getComputedStyle(t).height;t.style.height="",t.offsetHeight,t.style.height=o+"px"}else a.ariaExpanded="false",t.style.height="";t.classList.toggle("is-collapsed")}(t)}),t.controls.querySelector(".c-pjac-line__remove-btn").addEventListener("click",function(){me(t)}),X.push(t),k.disabled=X.length>=4,t}function be(e,t,a){return K?e?e.title:a:Y[Z[e.id]][t].text}function fe(e,t){return t?"Day "+e+"–"+t:"Day "+e}function ye(){ce(ge().president,"all"),f.classList.remove("c-pjac--loading")}function _e(e,t){return e.getUTCFullYear()!==t.getUTCFullYear()?v(e,"mmm d, yyyy")+"–"+v(t,"mmm d, yyyy"):e.getUTCMonth()!==t.getUTCMonth()?v(e,"mmm d")+"–"+v(t,"mmm d, yyyy"):e.getUTCDate()!==t.getUTCDate()?v(e,"mmm d")+"–"+v(t,"d, yyyy"):v(t,"mmm d, yyyy")}function je(e,a){void 0===a&&(a=null),ee+=1,t({url:"/wwwv7interactives/json/"+e+"/codename.aspx",success:function(t){var o=JSON.parse(t),n=o.ExpandedDemographics||o.CurrentPresident,r=ie(n.PresidentData,!0),i=n.data.date;Y[e]={};var l=Y[e];i.forEach(function(t){var a=new Date(t.startDate),o=new Date(t.endDate),n=h(o,r.startDate,"days");l[n]={date:o,text:_e(a,o)},Object.keys(t).forEach(function(a){"object"==typeof t[a]&&Object.keys(t[a]).forEach(function(o){var i=r.lines.find(function(e){return e.key===a+"-"+o});i&&"-"!==t[a][o]&&(i.labelSet=e,i.points.push({x:n,y:Number(t[a][o])}))})}),r.lines.forEach(function(e){return e.points.sort(function(e,t){return e.x-t.x})})}),te+=1,a&&a(n,r)}})}var xe=document.querySelector("[data-pjac]");return xe||(xe=document.querySelector("article")),function(a){if(a){(f=g(A)).classList.add("c-pjac--loading"),a.appendChild(f),w=f.clientWidth,y=f.querySelector(".c-pjac-timeframe"),(_=y.querySelector(".c-pjac-timeframe__select")).addEventListener("change",function(){if(B.filter(function(e){return!!e}).length){isNaN(_.value)?"all"===_.value&&j.zoom(1):j.zoom(j.metadata.axisX.range/_.value);var e=le();j.changeOptions({ticks:e}),de();var t=Array.from(y.querySelectorAll("button[data-value]"));t.forEach(function(e){return e.classList.remove("is-active")}),t.find(function(e){return e.getAttribute("data-value")===_.value}).classList.add("is-active")}}),y.addEventListener("click",function(e){null!==e.target.getAttribute("data-value")&&(_.value=e.target.getAttribute("data-value"),b(_,"change"))});var o=f.querySelector(".c-pjac__chart");j=new G(o,{},{mode:G.MODE_INTERACTIVE,width:"100%",height:350,dateFormat:"year",unitFormat:"{y}%",y_axis_min:0,y_axis_max:100,showLegend:!K,showFooter:!1,forceMultilineLegend:window.innerWidth=ee&&ye()}),[e.PresidentData].concat(e.data.presidents).forEach(function(e){V.push(e.Name||e.PresidentName),J[e.Name||e.PresidentName]=e.ImageURL,e.CodeName&&"ALLPRESIDENTS"!==e.CodeName&&je(e.CodeName,function(){te>=ee&&ye()})}),te>=ee&&ye()}),ee+=1,t({url:"/wwwv7interactives/json/ALLPRESIDENTS/codename.aspx",success:function(t){JSON.parse(t).AllPresidents.HistoricalPresident.forEach(function(t,a){var o=ie(t.PresidentData),n=t.data.Row,r="ALLPRESIDENTS"+a;Y[r]={};var i=Y[r];n.forEach(function(t){var a=new Date(t.StartDate),n=new Date(t.EndDate),l=h(n,o.startDate,"days");i[l]={date:n,text:_e(a,n)},Object.keys(t).forEach(function(a){var n=e.demographicCategory[a];if(n){var i=o.lines.find(function(e){return e.key===n+"-"+a});i&&"-"!==t[a]&&(i.labelSet=r,i.points.push({x:l,y:Number(t[a])}))}})}),o.lines.forEach(function(e){return e.points.sort(function(e,t){return e.x-t.x})})}),(te+=1)>=ee&&ye()}})}}(xe),window.addEventListener("resize",function(e,t,a){var o,n=this;return function(){var r=n,i=[e,t,a],l=a&&!o;clearTimeout(o),o=setTimeout(function(){o=null,a||e.apply(r,i)},t),l&&e.apply(r,i)}}(function(){f.clientWidth!==w&&(w=f.clientWidth,j.changeOptions({ticks:le(),forceMultilineLegend:window.innerWidth