"use strict";(self.webpackChunkmontana_messenger=self.webpackChunkmontana_messenger||[]).push([[4810],{24810(t,e,n){n.r(e),n.d(e,{create:()=>lt});const a=window.devicePixelRatio||1,o={begin:.8,end:1},i=300,l=10,s=.5,r="300 10px Helvetica, Arial, sans-serif",c=i,d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],h=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],f=["begin 200 fast","end 200 fast","labelFromIndex 200 fast floor","labelToIndex 200 fast ceil","xAxisScale 400","yMinViewport","yMaxViewport","yMinViewportSecond","yMaxViewportSecond","yMinMinimap","yMaxMinimap","yMinMinimapSecond","yMaxMinimapSecond","yAxisScale","yAxisScaleSecond"];function p(t){const e=t.length;let n=t[0],a=t[0];for(let o=0;on?n=e:evoid 0!==n[a]?n[a]:void 0!==e[a]?e[a]:t[a]})}function v(t,e,n=!0){let a,o,i=null;return(...l)=>{a=!0,o=l,i||(n&&(a=!1,t(...o)),i=window.setInterval(()=>{if(!a)return window.clearInterval(i),void(i=null);a=!1,t(...o)},e))}}function x(t){let e,n=!1;return function(...a){e=a,n||(n=!0,requestAnimationFrame(()=>{n=!1,t(...e)}))}}const M=[1,2,8,18,50,100,250,500,1e3,2500,5e3,1e4,25e3,5e4,1e5,25e4,5e5,1e6,25e5,5e6,1e7,25e6,5e7,1e8];function b(t){return M[t]||M[M.length-1]}function w(t,e,n){const a=Math.min(e+l,n-e);return a<=40&&(t=Math.min(1,t,a/40)),t}function k(t,e){return e-l<=20?Math.min(1,t,(e-l)/20):t}function S(t){return.45*Math.min(...t.getSize())}function L(t){return t>=1e3?Math.min(t/1e3,1):0}function F(t,e,n){const a={begin:0,end:1},o=function(){const e={};return t.datasets.forEach(({key:t})=>{e[t]=!0}),e}(),l=function(){const e=[],n=t.datasets.map(({key:t})=>`opacity#${t} 300`);return m([f,n]).forEach(t=>{const[n,a,...o]=t.split(" ");e.push({prop:n,duration:a,options:o})}),e}(),s=function(t){const e={};let n=null,a=null,o=null,l=null,s=null,r=null;function c(t){delete e[t],d()||(cancelAnimationFrame(n),n=null)}function d(){return Boolean(Object.keys(e).length)}function u(t){return!(!t&&(r||s))&&(null===o||o>=4)}function h(){const r=!u();!a||Date.now()-a>=200?(l&&(o=l,s||u(!0)||(s=Date.now())),a=Date.now(),l=0):l++;const f={};Object.keys(e).forEach(t=>{const{startedAt:n,from:a,to:o,duration:l=i,options:s}=e[t],r=Math.min(1,(Date.now()-n)/l);let d=a+(o-a)*(u=r,1-Math.pow(1-u,1.675));var u;s.includes("ceil")?d=Math.ceil(d):s.includes("floor")&&(d=Math.floor(d)),e[t].current=d,e[t].progress=r,f[t]=d,1===r&&c(t)}),r||t(f),d()&&(n=requestAnimationFrame(h))}return{add:function(t,o,i,c,d){e[t]={from:o,to:i,duration:c,options:d,current:o,startedAt:Date.now(),progress:0},n||(a=null,l=null,s&&Date.now()-s>5e3&&(s=null),r=Boolean(s)||!u(!0),n=requestAnimationFrame(h))},remove:c,get:function(t){return e[t]},getState:function(){const t={};return Object.keys(e).forEach(n=>{const{current:a,from:o,to:i,progress:l}=e[n];t[n]=a,t[`${n}From`]=o,t[`${n}To`]=i,t[`${n}Progress`]=l}),t},isRunning:d,isFast:u}}(d),r=x(d);let c={};function d(){const t=s.isFast()?g(c,s.getState()):c;t.static=c,n(t)}return{update:function({range:n={},filter:i={},focusOn:d,minimapDelta:u}={},h){Object.assign(a,n),Object.assign(o,i);const f=c;c=function(t,e,n,a,o,i,l){const{begin:s,end:r}=n,c=t.xLabels.length-1,d=Math.max(0,Math.ceil(c*s)),u=Math.min(Math.floor(c*r),c),h=function(t,e,n){return a=(n-e)/Math.floor(t/45),Math.ceil(Math.log2(a||1));var a}(e.width,d,u),f=t.isStacked?function(t,e,n,a,o){const i=t.datasets.filter(t=>e[t.key]).map(({values:t})=>t),l=i.length?y(i):[],{max:s=o.yMaxMinimap}=p(l),{max:r=o.yMaxViewport}=p(l.slice(n,a+1));return{yMinViewport:0,yMaxViewport:r,yMinMinimap:0,yMaxMinimap:s}}(t,a,d,u,l):function(t,e,n,a,o){const i=t.hasSecondYAxis&&t.datasets.slice(-1)[0],l=t.datasets.filter(t=>e[t.key]&&t!==i),s=A(t,n,a,o,l);if(i){const{yMinViewport:e,yMaxViewport:l,yMinMinimap:r,yMaxMinimap:c}=A(t,n,a,o,[i]);Object.assign(s,{yMinViewportSecond:e,yMaxViewportSecond:l,yMinMinimapSecond:r,yMaxMinimapSecond:c})}return s}(t,a,d,u,l),m=T(e.height,f.yMinViewport,f.yMaxViewport),g=t.hasSecondYAxis&&T(e.height,f.yMinViewportSecond,f.yMaxViewportSecond),v=b(m);if(f.yMinViewport-=f.yMinViewport%v,g){const t=b(g);f.yMinViewportSecond-=f.yMinViewportSecond%t}const x={};return t.datasets.forEach(({key:t})=>{x[`opacity#${t}`]=a[t]?1:0}),Object.assign({totalXWidth:c,xAxisScale:h,yAxisScale:m,yAxisScaleSecond:g,labelFromIndex:Math.max(0,d-1),labelToIndex:Math.min(u+1,c),filter:Object.assign({},a),focusOn:void 0!==o?o:l.focusOn,minimapDelta:void 0!==i?i:l.minimapDelta},f,x,n)}(t,e,a,o,d,u,f),h||l.forEach(({prop:t,duration:e,options:n})=>{const a=s.get(t),o=a?a.to:f[t];if(void 0!==o&&o!==c[t]){const o=a?n.includes("fast")?f[t]:a.current:f[t];a&&s.remove(t),s.add(t,o,c[t],e,n)}}),s.isRunning()&&s.isFast()||r()},hasAnimations:function(){return s.isFast()}}}function A(t,e,n,a,o){const{min:i=a.yMinMinimap,max:l=a.yMaxMinimap}=p(m(o.map(({yMax:t,yMin:e})=>[t,e]))),s=i/l>.1?i:0;let r,c;if(0===e&&n===t.xLabels.length-1)r=s,c=l;else{const t=p(m(o.map(({values:t})=>t).map(t=>t.slice(e,n+1)))),i=void 0!==t.min?t.min:a.yMinViewport;c=void 0!==t.max?t.max:a.yMaxViewport,r=i/c>.1?i:0}return{yMinViewport:r,yMaxViewport:c,yMinMinimap:s,yMaxMinimap:l}}function T(t,e,n){const a=t-30,o=n-e,i=Math.floor(a/50);return l=o/i,M.findIndex(t=>t>=l)||M.length-1;var l}const $=(t="div")=>document.createElement(t);function P(t,e,n){t.addEventListener(e,n)}function I(t,e,n){t.removeEventListener(e,n)}function C(t,e,n="",a=!1){const o=t.parentNode;o.classList.add("lovely-chart--transition-container");const i=$(t.tagName);i.className=`${n} lovely-chart--transition lovely-chart--position-${a?"top":"bottom"} lovely-chart--state-hidden`,i.innerHTML=e;const l=n.length?`.${n.split(" ").join(".")}`:"";return o.querySelectorAll(`${l}.lovely-chart--state-hidden`).forEach(t=>t.remove()),t.classList.add("lovely-chart--transition"),t.classList.remove("lovely-chart--position-bottom","lovely-chart--position-top"),t.classList.add(a?"lovely-chart--position-bottom":"lovely-chart--position-top"),o.insertBefore(i,t.nextSibling),function(t){t.classList.remove("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-animated"),t.classList.remove("lovely-chart--state-hidden")}(i),function(t){t.classList.remove("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-hidden")}(t),i}function V(t,e=1){return t>=1e6?O(t/1e6,e)+"M":t>=1e3?O(t/1e3,e)+"K":t}function O(t,e){return t.toFixed(e).replace(/(\d{3,})\.\d+/,"$1").replace(/\.0+$/,"")}function E(t){return t.replace(/\d(?=(\d{3})+$)/g,"$& ")}function W(t,{isShort:e=!1}={}){return D(t,{isShort:e,displayWeekDay:!0})}function D(t,{isShort:e=!1,displayWeekDay:n=!1,displayYear:a=!0,displayHours:o=!1}={}){const{value:i}=t,l=new Date(i),s=e?h:u;let r=`${l.getUTCDate()} ${d[l.getUTCMonth()]}`;return n&&(r=`${s[l.getUTCDay()]}, `+r),a&&(r+=` ${l.getUTCFullYear()}`),o&&(r+=`, ${("0"+l.getUTCHours()).slice(-2)}:${("0"+l.getUTCMinutes()).slice(-2)}`),r}function H(){return document.documentElement.classList.contains("theme-dark")?"skin-night":"skin-day"}let Z=H();const Y={"skin-day":{background:"#FFFFFF","text-color":"#222222","minimap-mask":"#E2EEF9/0.6","minimap-slider":"#C0D1E1","grid-lines":"#182D3B/0.1","zoom-out-text":"#108BE3","tooltip-background":"#FFFFFF","tooltip-arrow":"#D2D5D7",mask:"#FFFFFF/0.5","x-axis-text":"#252529/0.6","y-axis-text":"#252529/0.6"},"skin-night":{background:"#242F3E","text-color":"#FFFFFF","minimap-mask":"#304259/0.6","minimap-slider":"#56626D","grid-lines":"#FFFFFF/0.1","zoom-out-text":"#48AAF0","tooltip-background":"#1c2533","tooltip-arrow":"#D2D5D7",mask:"#242F3E/0.5","x-axis-text":"#A3B1C2/0.6","y-axis-text":"#A3B1C2/0.6"}},X=document.createElement("style");X.type="text/css",X.appendChild(document.createTextNode("")),document.head.appendChild(X);const N=X.sheet;function q(t){const e={},n=".lovely-chart--color";return["skin-day","skin-night"].forEach(a=>{e[a]={},Object.keys(Y[a]).forEach(t=>{e[a][t]=R(Y[a][t])}),Object.keys(t).forEach(o=>{e[a][`dataset#${o}`]=R(t[o]),j(N,`.lovely-chart--tooltip-dataset-value${n}-${t[o].slice(1)}`,`color: ${t[o]}`),j(N,`.lovely-chart--button${n}-${t[o].slice(1)}`,`border-color: ${t[o]}; color: ${t[o]}`);const i=`.lovely-chart--button.lovely-chart--state-checked${n}-${t[o].slice(1)}`;j(N,i,`background-color: ${t[o]}`)})}),e}function z(t,e,n){return function([t,e,n,a=1],o=1){return`rgba(${t}, ${e}, ${n}, ${a*o})`}(t[Z][e],n)}function R(t){const[e,n]=t.replace("#","").split("/");return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),n?parseFloat(n):1]}function B([t,e,n],[a,o,i]){return Math.sqrt((t-a)**2+(e-o)**2+(n-i)**2)}function j(t,e,n){t.insertRule(`${e} { ${n} }`,t.cssRules.length)}function U(t){const{begin:e,end:n,totalXWidth:a,yMin:o,yMax:i,availableWidth:l,availableHeight:s,xPadding:r=0,yPadding:c=0}=t;let d=l;0===e&&(d-=r),1===n&&(d-=r);const u=d/((n!==e?n-e:1)*a);let h=e*a*u;0===e&&(h-=r);const f=s-c,p=f/(i-o),m=o*p;return{findClosestLabelIndex:function(t){return Math.round((t+h)/u)},copy:function(e,n){return U(g(t,e))},getCenter:function(){return[l/2,s-f/2]},getSize:function(){return[l,f]},getParams:function(){return t},getState:function(){return{xFactor:u,xOffsetPx:h,availableHeight:s,yFactor:p,yOffsetPx:m}}}}function J(t,e,n){const{xFactor:a,xOffsetPx:o,availableHeight:i,yFactor:l,yOffsetPx:s}=t.getState();return[e*a-o,i-(n*l-s)]}function _(t,{width:e,height:n}){const o=$("canvas");o.width=e*a,o.height=n*a,o.style.width="100%",o.style.height=`${n}px`;const i=o.getContext("2d");return i.scale(a,a),t.appendChild(o),{canvas:o,context:i}}function K(t,e){e.clearRect(0,0,t.width,t.height)}function G(t,e,n,a,o,i){let l=e.map(({values:t})=>t.slice(n.from,n.to+1));t.isPie&&!i&&(l=function(t){return t.map(t=>[t.reduce((t,e)=>t+e,0)])}(l));const s=l.map((e,o)=>e.map((e,i)=>{let l=e;return t.isStacked&&(l*=a[o]),{labelIndex:n.from+i,value:e,visibleValue:l,stackOffset:0,stackValue:l}}));return t.isPercentage&&function(t,e){const n=function(t){return y(t.map(t=>t.map(({visibleValue:t})=>t)))}(t);t.forEach(t=>{t.forEach((t,a)=>{t.percent=t.visibleValue/n[a],t.visibleValue=t.percent*e.yMax})})}(s,o),t.isStacked&&function(t){const e=[];t.forEach(t=>{t.forEach((t,n)=>{void 0===e[n]&&(e[n]=0),t.stackOffset=e[n],e[n]+=t.visibleValue,t.stackValue=e[n]})})}(s),s}document.documentElement.addEventListener("darkmode",()=>{Z=H()});const Q=(()=>{let t=1/Math.pow(2,22),e=1e5;function n(t,e,n,a,o){let i,l=+e[0],s=+e[1];i=+((t[0]-l)*a[0]+(t[1]-s)*a[1])*o,i>1?(l=+n[0],s=+n[1]):i>0&&(l+=+a[0]*i,s+=+a[1]*i);let r=+t[0]-l,c=+t[1]-s;return+r*r+c*c}return function(a,o,i){if(a.length<6)return function(){return{points:a,indexes:o,removed:[]}};let l=function(a,o){let i,l=a.length,s=[],r=[];for(let t=0,e=a.length;tc){if(nt||Math.abs(l[1])>t){let t=1/(l[0]*l[0]+l[1]*l[1]);for(let e=c+1;ef&&(i=e,f=o)}}else i=Math.round(.5*(c+d)),f=h;s[i]=f}u={start:c,end:d,index:i,distance:f}}return u.index&&u.distance>i&&(u.index-c>=2&&r.push({start:c,end:u.index,record:u.left,currentLimit:u.distance,parent:u,parentProperty:"left"}),d-u.index>=2&&r.push({start:u.index,end:d,record:u.right,currentLimit:u.distance,parent:u,parentProperty:"right"})),u}(l);return l.parent&&l.parentProperty&&(l.parent[l.parentProperty]=c),c}return function(t){for(i=t,r.push({start:0,end:l-1,record:c,currentLimit:e}),c=d();r.length;)d();return s}}(a,i);return function(t){let e=[],n=[],i=[],s=t*t,r=l(s);for(let t=0,l=a.length;t=s||0==t||t==l-1?(e.push(a[t]),n.push(o?o[t]:t)):i.push(t);return{points:e,indexes:n,removed:i}}}})();function tt(t,e,n,a,o,i,l,r,c,d,u,h,f){if(n.datasets.forEach(({key:p,type:y,hasOwnYAxis:g},v)=>{if(!d[v])return;const x={color:z(u,`dataset#${p}`),lineWidth:c,opacity:n.isStacked?1:d[v],simplification:f},M="pie"===y&&h?"bar":y;let b=g?l:o[v],w=g?r:i;if("area"===M){const t=[{labelIndex:a.from,stackValue:0},{labelIndex:a.to,stackValue:0}];b=m([o[v-1]||t,o[v].slice().reverse()])}if("pie"===M&&(x.center=i.getCenter(),x.radius=S(i),x.pointerVector=e.focusOn),"bar"===M){const[t]=J(i,0,0),[n]=J(i,1,0);x.lineWidth=n-t,x.focusOn=e.focusOn}!function(t,...e){switch(t){case"line":return function(t,e,n,a){t.beginPath();let o=[];for(let t=0,a=e.length;t{t.lineTo(e,n)}),t.save(),t.strokeStyle=a.color,t.lineWidth=a.lineWidth,t.globalAlpha=a.opacity,t.lineJoin="bevel",t.lineCap="butt",t.stroke(),t.restore()}(...e);case"bar":return function(t,e,n,a){const{yMin:o}=n.getParams();t.save(),t.globalAlpha=a.opacity,t.fillStyle=a.color;for(let i=0,l=e.length;i{t.lineTo(e,n)}),t.save(),t.strokeStyle=a.color,t.lineWidth=a.lineWidth,t.globalAlpha=a.opacity,t.stroke(),t.restore()}(...e);case"area":return function(t,e,n,a){t.beginPath();let o=[];for(let t=0,a=e.length;t{t.lineTo(e,n)}),t.save(),t.fillStyle=a.color,t.lineWidth=a.lineWidth,t.globalAlpha=a.opacity,t.lineJoin="bevel",t.lineCap="butt",t.fill(),t.restore()}(...e);case"pie":!function(t,e,n,a){const{visibleValue:o,stackValue:i,stackOffset:l=0}=e[0];if(!o)return;const{yMin:s,yMax:r}=n.getParams(),c=1/(r-s),d=o*c,u=l*c*Math.PI*2-Math.PI/2,h=i*c*Math.PI*2-Math.PI/2,{radius:f=120,center:[p,m],pointerVector:y}=a,g=y&&u<=y.angle&&y.angle=.02){t.font=`700 ${function(t,e){return(e+200*t)/10}(d,f)}px Helvetica, Arial, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle="white";const e=function(t,e){return t>=.99?0:Math.min(1-Math.log(30*t)/5,.8)*e}(d,f);t.fillText(`${Math.round(100*d)}%`,p+x*e+b,m+M*e+w)}t.restore()}(...e)}}(M,t,b,w,x)}),e.focusOn&&(n.isBars||n.isSteps)){const[a]=J(i,0,0),[o]=J(i,1,0);!function(t,e,n){const[a,o]=e.getCenter(),[i,l]=e.getSize(),[r]=J(e,n.focusOn,0);t.fillStyle=n.color,t.fillRect(a-i/2,o-l/2,r-n.lineWidth/2+s,l),t.fillRect(r+n.lineWidth/2,o-l/2,i-(r+n.lineWidth/2),l)}(t,i,{focusOn:e.focusOn,color:z(u,"mask"),lineWidth:n.isSteps?o-a+c:o-a})}}function et(t,e){let n=null,a=null;function o(t){n=t,"mousedown"===t.type?(P(document,"mousemove",l),P(document,"mouseup",i)):"touchstart"===t.type&&(P(document,"touchmove",l),P(document,"touchend",i),P(document,"touchcancel",i),void 0===t.pageX&&(t.pageX=t.touches[0].pageX)),e.draggingCursor&&document.body.classList.add(`cursor-${e.draggingCursor}`),e.onCapture&&e.onCapture(t),e.onLongPress&&(a=setTimeout(()=>e.onLongPress(),500))}function i(t){n&&(a&&(clearTimeout(a),a=null),e.draggingCursor&&document.body.classList.remove(`cursor-${e.draggingCursor}`),I(document,"mouseup",i),I(document,"mousemove",l),I(document,"touchcancel",i),I(document,"touchend",i),I(document,"touchmove",l),n=null,e.onRelease&&e.onRelease(t))}function l(t){n&&(a&&(clearTimeout(a),a=null),"touchmove"===t.type&&void 0===t.pageX&&(t.pageX=t.touches[0].pageX),e.onDrag&&e.onDrag(t,n,{dragOffsetX:t.pageX-n.pageX}))}P(t,"mousedown",o),P(t,"touchstart",o)}function nt(t,e,n,a,o,i){let l,s,r,c,d,u,h,f,p,m,y,g=null,M=!1,b=!1;const w=x(V),k=v(Y,100,!0);function L(t){if(t.target===p||p.contains(t.target)||g)return;b=!1;const e=u.getBoundingClientRect();m=(t.touches?t.touches[0].clientX:t.clientX)-e.left,y=(t.touches?t.touches[0].clientY:t.clientY)-e.top,w()}function F(t){null===m||t.target===u||u.contains(t.target)||I()}function A(t){if(!b&&e.isZoomable){const e=g;g=null,L(t);const n=C();n!==e&&(g=n),o(n)}}function T(){if(p.classList.contains("lovely-chart--state-inactive"))return;const t=r.findClosestLabelIndex(m);o(t)}function I(t){m=null,g=null,K(h,f),X(),!t&&i&&i(null)}function C(){const t=r.findClosestLabelIndex(m);return tl.labelToIndex?null:t}function V(o){if(!m||!l||b)return;const u=C();if(null===u)return void I(o);const g=N(),v=!e.isPie||g.distance<=S(r);function x(t,n){return e.isPie?t.slice(l.labelFromIndex,l.labelToIndex+1).reduce((t,e)=>t+e,0):t[n]}!o&&i&&(e.isPie?i(g):i(u));const[M]=J(r,u,0),w=e.datasets.map(({key:t,name:e,values:n,hasOwnYAxis:a},o)=>({key:t,name:e,value:x(n,u),hasOwnYAxis:a,originalIndex:o})).filter(({key:t})=>l.filter[t]);w.length&&v?function(n,a){p.style.transform=`translate3D(${function(n){const a=(l.labelFromIndex+l.labelToIndex)/2,{angle:o}=N(),i=(e.isPie?o>Math.PI/2:n{const u=e-l.labelFromIndex,h=o?c[u]:s[i][u];if(!h)return;const[p,m]=J(o?d:r,e,h.stackValue);!function([t,e],n,a){f.strokeStyle=n,f.fillStyle=a,f.lineWidth=2,f.beginPath(),f.arc(t,e,4,0,2*Math.PI),f.fill(),f.stroke()}([p,m],z(a,`dataset#${n}`),z(a,"background"))})}(w,u),function(t,e,n){f.strokeStyle=n,f.lineWidth=1,f.beginPath(),f.moveTo(t,0),f.lineTo(t,e),f.stroke()}(M,n.height-30,z(a,"grid-lines")))}function O(t){return`${e.valuePrefix||""}${function(t){if(!Number.isInteger(t)){const e=Math.abs(t),n=e>0&&e<1?Math.max(2,1-Math.floor(Math.log10(e))):2,[a,o]=t.toFixed(n).split("."),i=o.replace(/0+$/,"");return i?E(a)+"."+i:E(a)}return E(String(t))}(t)}${e.valueSuffix||""}`}function W(t,n,a){if(!e.isPercentage)return;if(e.isPie)return void Array.from(t.querySelectorAll(".lovely-chart--percentage-title")).forEach(t=>t.remove());const o=a?Math.round(n/a*100):0,i=t.querySelector(".lovely-chart--percentage-title:not(.lovely-chart--state-hidden)");if(i)i.innerHTML=`${o}%`;else{const e=$("span");e.className="lovely-chart--percentage-title lovely-chart--position-left",e.innerHTML=`${o}%`,t.prepend(e)}}function H(t){const n=p.children[1];e.isPie&&n.classList.add("lovely-chart--tooltip-legend-pie"),Array.from(n.children).forEach(t=>{!e.isPie&&n.classList.contains("lovely-chart--tooltip-legend-pie")?t.remove():t.setAttribute("data-present","false")});const o=t.reduce((t,e)=>t+e.value,0),i=N(),l=t.filter(({value:t})=>0!==t).sort((t,e)=>e.value-t.value).slice(0,12),s=e.isPie?l.filter(({value:e},n)=>function(t,e,n,a,o){const i=a>0?t.slice(0,a).reduce((t,e)=>t+e.value,0):0,l=i/n*Math.PI*2-Math.PI/2,s=(i+e)/n*Math.PI*2-Math.PI/2;return o&&l<=o.angle&&o.angle{const i=n.querySelector(`[data-name="${t.name}"]`);i?(function(t,{key:e,value:n}={},a){t.setAttribute("data-present","true");const o=t.querySelector(".lovely-chart--tooltip-dataset-value");o&&(o.innerHTML=O(n)),W(t,n,a)}(i,t,o),n.appendChild(i)):function(t,{name:n,key:o,value:i},l){const s=e.colors[o],r=function(t,e){return B(t[Z]["tooltip-background"],R(e))<70}(a,s)?"":` lovely-chart--color-${s.slice(1)}`,c=`lovely-chart--tooltip-dataset-value lovely-chart--position-right${r}`,d=$();d.className="lovely-chart--tooltip-dataset",d.setAttribute("data-present","true"),d.setAttribute("data-name",n),d.innerHTML=`${n}${O(i)}`,W(d,i,l);const u=t.querySelector('[data-total="true"]');u?t.insertBefore(d,u):t.appendChild(d)}(n,t,o)}),(e.isBars||e.isSteps||e.isAreas)&&e.isStacked&&function(t,e){const n=t.querySelector('[data-total="true"]');if(n)n.setAttribute("data-present","true"),n.querySelector(".lovely-chart--tooltip-dataset-value:not(.lovely-chart--state-hidden)").innerHTML=e;else{const n=$();n.className="lovely-chart--tooltip-dataset lovely-chart--tooltip-dataset-total",n.setAttribute("data-present","true"),n.setAttribute("data-total","true"),n.innerHTML=`Total${e}`,t.appendChild(n)}}(n,O(o)),e.secondaryYAxis&&function(t,n){const{label:a,multiplier:o,prefix:i="",suffix:l=""}=e.secondaryYAxis,s=t.querySelector('[data-total="true"]'),r=(n*o).toFixed(2);if(s)s.setAttribute("data-present","true"),s.querySelector(".lovely-chart--tooltip-dataset-value:not(.lovely-chart--state-hidden)").innerHTML=`${i}${r}${l}`;else{const e=$();e.className="lovely-chart--tooltip-dataset lovely-chart--tooltip-dataset-total",e.setAttribute("data-present","true"),e.setAttribute("data-total","true"),e.innerHTML=`${a}${i}${r}${l}`,t.appendChild(e)}}(n,o),Array.from(n.querySelectorAll('[data-total="true"]')).forEach(t=>n.appendChild(t)),Array.from(n.querySelectorAll('[data-present="false"]')).forEach(t=>{t.remove()})}function Y(t,n){!function(t){const n=p.children[0];if(e.isPie)n&&(n.style.display="none");else{"none"===n.style.display&&(n.style.display="");const e=n.querySelector(":not(.lovely-chart--state-hidden)");n.innerHTML&&e?e.innerHTML=t:n.innerHTML=`${t}`}}(t),H(n)}function X(){p.classList.remove("lovely-chart--state-shown")}function N(){const{width:t,height:e}=u.getBoundingClientRect(),n=[t/2,e/2],a=Math.atan2(y-n[1],m-n[0]),o=Math.sqrt((m-n[0])**2+(y-n[1])**2);return{angle:a>=-Math.PI/2?a:2*Math.PI+a,distance:o}}return u=$(),u.className="lovely-chart--tooltip",function(){const{canvas:t,context:e}=_(u,n);h=t,f=e}(),p=$(),p.className="lovely-chart--tooltip-balloon"+(e.isZoomable?"":" lovely-chart--state-inactive"),p.innerHTML='
',"ontouchstart"in window&&e.isZoomable&&P(p,"click",T),u.appendChild(p),"ontouchstart"in window?(P(u,"touchmove",L),P(u,"touchstart",L),P(document,"touchstart",F)):(P(u,"mousemove",L),P(u,"click",A),P(document,"mousemove",F)),t.appendChild(u),{update:function(t,e,n,a,o){l=t,s=e,r=n,c=a,d=o,V(!0)},toggleLoading:function(t){p.classList.toggle("lovely-chart--state-loading",t),t||I()},toggleIsZoomed:function(t){t!==M&&(b=!0),M=t,p.classList.toggle("lovely-chart--state-inactive",t)}}}const at={day:"statsFormat('day')",hour:"statsFormat('hour')","5min":"statsFormat('5min')",dayHour:"statsFormatDayHour",text:void 0};function ot(t){const{title:e,labelFormatter:n,labelType:a,tooltipFormatter:o,isStacked:i,isPercentage:l,secondaryYAxis:s,hasSecondYAxis:r,onZoom:c,minimapRange:u,hideCaption:h,zoomOutLabel:f,valuePrefix:m,valueSuffix:y}=t,g=n||a&&at[a],{datasets:v,labels:x}=function(t){const{type:e,labels:n,datasets:a,hasSecondYAxis:o}=t;return{labels:it(n),datasets:a.map(({name:t,color:n,values:i},l)=>{const{min:s,max:r}=p(i);return{type:e,key:`y${l}`,name:t,color:n,values:it(i),hasOwnYAxis:o&&l===a.length-1,yMin:s,yMax:r}})}}(t),M={};let b,w=1/0,k=-1/0;switch(v.forEach(({key:t,color:e,yMin:n,yMax:a})=>{M[t]=e,nk&&(k=a)}),g){case"statsFormatDayHour":b=function(t){return t.map(t=>({value:t,text:`${t}:00`}))}(x);break;case"statsFormat('day')":b=function(t){return t.map(t=>{const e=new Date(t);return{value:t,text:`${e.getDate()} ${d[e.getMonth()]}`}})}(x);break;case"statsFormat('hour')":case"statsFormat('5min')":b=function(t){return t.map(t=>({value:t,text:new Date(t).toString().match(/(\d+:\d+):/)[1]}))}(x);break;default:b=function(t){return t.map((t,e)=>({value:e,text:t}))}(x)}const S={title:e,labelFormatter:g,tooltipFormatter:o,xLabels:b,datasets:v,isStacked:i,isPercentage:l,secondaryYAxis:s,hasSecondYAxis:r,valuePrefix:m,valueSuffix:y,onZoom:c,isLines:"line"===t.type,isBars:"bar"===t.type,isSteps:"step"===t.type,isAreas:"area"===t.type,isPie:"pie"===t.type,yMin:w,yMax:k,colors:M,minimapRange:u,hideCaption:h,zoomOutLabel:f};return S.shouldZoomToPie=!S.onZoom&&S.isPercentage,S.isZoomable=S.onZoom||S.shouldZoomToPie,S}function it(t){return t.slice(0)}function lt(t,e){let n,a,i,s,d,u,h,f,p,m,y,M,S=window.innerWidth;const A=ot(e),T=q(A.colors),I=function(t,e,n=!0,a=!0){let o=null;return function(){o?(clearTimeout(o),o=null):n&&t(),o=setTimeout(()=>{a&&t(),o=null},e)}}(function(){Object.assign(A,ot(e)),a.remove(),O()},500,!1,!0);function O(){a=$(),a.className="lovely-chart--container"+(A.shouldZoomToPie?" lovely-chart--container-type-pie":""),t.appendChild(a),u=function(t,e,n="Zoom out",a){let o,i,l,s,r;const c=v(d,100,!1);function d(t){r||(s.innerHTML=t)}function u(){i=C(l,e,"lovely-chart--header-title",!0),i.classList.remove("lovely-chart--transition"),a()}return o=$(),o.className="lovely-chart--header",i=$(),i.className="lovely-chart--header-title",i.innerHTML=e,o.appendChild(i),s=$(),s.className="lovely-chart--header-caption lovely-chart--position-right",o.appendChild(s),t.appendChild(o),{setCaption:c,zoom:function(t){l=C(i,n,"lovely-chart--header-title lovely-chart--header-zoom-out-control"),setTimeout(()=>{P(l,"click",u)},500),d(t)},toggleIsZooming:function(t){r=t}}}(a,A.title,A.zoomOutLabel,N),function(){const{canvas:t,context:e}=_(a,{width:a.clientWidth,height:320});i=t,s=e,d={width:i.offsetWidth,height:i.offsetHeight}}(),n=F(A,d,E),h=function(t,e,n,a){function o(o,i,s,c,d,u=1,h=null,f=!1){const p=b(s),m=Math.ceil(c/p)*p,y=Math.floor(d/p)*p;t.font=r,t.textAlign=f?"right":"left",t.textBaseline="bottom",t.lineWidth=1,t.beginPath();for(let o=m;o<=y;o+=p){const[,s]=J(i,0,o),r=k(u,s);t.fillStyle=z(a,h||"y-axis-text",r);const c=f?V(o):`${e.valuePrefix||""}${V(o)}${e.valueSuffix||""}`;f?t.fillText(c,n.width-l,s-5):t.fillText(c,l,s-5),f?(t.strokeStyle=z(a,h,u),t.moveTo(n.width-l,s),t.lineTo(n.width-20,s)):(t.moveTo(l,s),t.strokeStyle=z(a,"grid-lines",u),t.lineTo(n.width-l,s))}t.stroke()}return{drawXAxis:function(o,i){t.clearRect(0,n.height-30+1,n.width,31);const l=n.height-15,s=Math.floor(o.xAxisScale),c=function(t){return Math.pow(2,t)}(s),d=1-(o.xAxisScale-s);t.font=r,t.textAlign="center",t.textBaseline="middle";for(let s=o.labelFromIndex;s<=o.labelToIndex;s++){const o=s-1;if(o%c!==0)continue;const r=e.xLabels[s],[u]=J(i,s,0);let h=o%(2*c)==0?1:d;h=w(h,u,n.width),t.fillStyle=z(a,"x-axis-text",h),t.fillText(r.text,u,l)}},drawYAxis:function(i,s,c){const{yAxisScale:d,yAxisScaleFrom:u,yAxisScaleTo:h,yAxisScaleProgress:f=0,yMinViewport:p,yMinViewportFrom:m,yMinViewportTo:y,yMaxViewport:g,yMaxViewportFrom:v,yMaxViewportTo:x,yMinViewportSecond:M,yMinViewportSecondFrom:w,yMinViewportSecondTo:S,yMaxViewportSecond:L,yMaxViewportSecondFrom:F,yMaxViewportSecondTo:A}=i,T=c&&`dataset#${e.datasets[0].key}`,$=void 0!==m||void 0!==v;if(e.isPercentage?function(e){const[,o]=e.getSize();t.font=r,t.textAlign="left",t.textBaseline="bottom",t.lineWidth=1,t.beginPath(),[0,.25,.5,.75,1].forEach(e=>{const i=o-o*e+15;t.fillStyle=z(a,"y-axis-text",1),t.fillText(100*e+"%",l,i-2.5),t.moveTo(l,i),t.strokeStyle=z(a,"grid-lines",1),t.lineTo(n.width-l,i)}),t.stroke()}(s):e.secondaryYAxis?(o(0,s,Math.round(h||d),void 0!==y?y:p,void 0!==x?x:g,u?f:1),function(e,o,i,s,c,d=1,u){const{multiplier:h,prefix:f="",suffix:p=""}=u,m=b(i),y=Math.ceil(s/m)*m,g=Math.floor(c/m)*m;t.font=r,t.textAlign="right",t.textBaseline="bottom";for(let e=y;e<=g;e+=m){const[,i]=J(o,0,e),s=k(d,i),r=e*h;t.fillStyle=z(a,"y-axis-text",s),t.fillText(`${f}${V(r)}${p}`,n.width-l,i-5)}}(0,s,Math.round(h||d),void 0!==y?y:p,void 0!==x?x:g,u?f:1,e.secondaryYAxis)):o(0,s,Math.round(h||d),void 0!==y?y:p,void 0!==x?x:g,u?f:1,T),f>0&&$&&o(0,s,Math.round(u),void 0!==m?m:p,void 0!==v?v:g,1-f,T),c){const{yAxisScaleSecond:t,yAxisScaleSecondFrom:n,yAxisScaleSecondTo:a,yAxisScaleSecondProgress:l=0}=i,s=`dataset#${e.datasets[e.datasets.length-1].key}`,r=void 0!==w||void 0!==F;o(0,c,Math.round(a||t),void 0!==S?S:M,void 0!==A?A:L,n?l:1,s,!0),l>0&&r&&o(0,c,Math.round(n),void 0!==w?w:M,void 0!==F?F:L,1-l,s,!0)}}}}(s,A,d,T),f=function(t,e,n,a){let i,l,s,r,c,d,u,h,f={};const p=x(function(){const{begin:t,end:e}=f;c.children[0].style.width=100*t+"%",c.children[1].style.width=100*(e-t)+"%",c.children[2].style.width=100*(1-e)+"%"});function m(t){t.preventDefault(),u=t.target.offsetLeft}function y(){u=null}function v(t,e){let n=Object.assign({},f,t);h&&h.minimapDelta&&!e&&(n=function(t){return{begin:Math.round(t.begin/h.minimapDelta)*h.minimapDelta,end:Math.round(t.end/h.minimapDelta)*h.minimapDelta}}(n)),n.begin===f.begin&&n.end===f.end||(f=n,p(),e||a(f))}return i=$(),i.className="lovely-chart--minimap",i.style.height="40px",function(){const{canvas:e,context:n}=_(i,{width:t.offsetWidth-20,height:40});l=e,s=n}(),c=$(),c.className="lovely-chart--minimap-ruler",c.innerHTML='
',d=c.children[1],et(d.children[1],{onCapture:m,onDrag:function(t,e,{dragOffsetX:n}){const a=r.width-d.offsetWidth,o=Math.max(0,Math.min(u+n-8,a)),i=o+d.offsetWidth;v({begin:o/r.width,end:i/r.width})},onRelease:y,draggingCursor:"grabbing"}),et(d.children[0],{onCapture:m,onDrag:function(t,e,{dragOffsetX:n}){const a=d.offsetLeft+d.offsetWidth-16;v({begin:Math.min(a,Math.max(0,u+n))/r.width})},onRelease:y,draggingCursor:"ew-resize"}),et(d.children[2],{onCapture:m,onDrag:function(t,e,{dragOffsetX:n}){const a=d.offsetLeft+16,o=r.width;v({end:Math.max(a,Math.min(u+8+n,o))/r.width})},onRelease:y,draggingCursor:"ew-resize"}),i.appendChild(c),t.appendChild(i),r={width:l.offsetWidth,height:l.offsetHeight},v(e.minimapRange||o),{update:function(t){const{begin:a,end:o}=t;u||v({begin:a,end:o},!0),e.datasets.length>=4&&(t=t.static),function(t){if(!h)return!0;const{datasets:n}=e;return!!n.some(({key:e})=>h[`opacity#${e}`]!==t[`opacity#${e}`])||h.yMaxMinimap!==t.yMaxMinimap}(t)&&(h=g(t,{focusOn:null}),K(l,s),function(t={}){const{datasets:a}=e,o={from:0,to:t.totalXWidth},i={begin:0,end:1,totalXWidth:t.totalXWidth,yMin:t.yMinMinimap,yMax:t.yMaxMinimap,availableWidth:r.width,availableHeight:r.height,yPadding:1},l=a.map(({key:t})=>h[`opacity#${t}`]),c=G(e,a,o,l,i,!0),d=U(i);let u=null,f=null;if(e.hasSecondYAxis){const n=a.find(t=>t.hasOwnYAxis),i={yMin:t.yMinMinimapSecond,yMax:t.yMaxMinimapSecond};u=G(e,[n],o,l,i)[0],f=d.copy(i)}const p=.5*L(c.reduce((t,e)=>t+e.length,0));tt(s,t,e,o,c,d,u,f,1,l,n,!0,p)}(h))},toggle:function(t){i.classList.toggle("lovely-chart--state-hidden",!t),requestAnimationFrame(()=>{i.classList.toggle("lovely-chart--state-transparent",!t)})}}}(a,A,T,H),p=nt(a,A,d,T,X,Y),m=function(t,e,n){let a;function o(){a=$(),a.className="lovely-chart--tools",e.datasets.length<2&&(a.className+=" lovely-chart--state-hidden"),e.datasets.forEach(({key:t,name:n})=>{const o=$("a");o.href="#",o.dataset.key=t;const l=B(R(e.colors[t]),[255,255,255])<70?" lovely-chart--dark-content":"";o.className=`lovely-chart--button lovely-chart--color-${e.colors[t].slice(1)} lovely-chart--state-checked${l}`,o.innerHTML=`${n}`,o.addEventListener("click",t=>{t.preventDefault(),o.dataset.clickPrevented||i(o),delete o.dataset.clickPrevented}),et(o,{onLongPress:()=>{o.dataset.clickPrevented="true",i(o,!0)}}),a.appendChild(o)}),t.appendChild(a)}function i(t,e=!1){const o=Array.from(a.getElementsByTagName("a")),i=1===a.querySelectorAll(".lovely-chart--state-checked").length;t&&(t.classList.contains("lovely-chart--state-checked")&&i?e?(o.forEach(t=>t.classList.add("lovely-chart--state-checked")),t.classList.remove("lovely-chart--state-checked")):(t.classList.remove("lovely-chart--state-shake"),requestAnimationFrame(()=>{t.classList.add("lovely-chart--state-shake")})):e?(o.forEach(t=>t.classList.remove("lovely-chart--state-checked")),t.classList.add("lovely-chart--state-checked")):t.classList.toggle("lovely-chart--state-checked"));const l={};o.forEach(t=>{l[t.dataset.key]=t.classList.contains("lovely-chart--state-checked")}),n(l)}return o(),i(),{redraw:function(){if(a){const t=a;t.classList.add("lovely-chart--state-hidden"),setTimeout(()=>{t.parentNode.removeChild(t)},500)}o(),a.classList.add("lovely-chart--state-transparent"),requestAnimationFrame(()=>{a.classList.remove("lovely-chart--state-transparent")})}}}(a,A,Z),y=A.isZoomable&&function(t,e,n,a,o,i,l,s,r){let d,u,h=!1;function f(e,f,p){if(!e)return s.toggleLoading(!1),s.toggleIsZoomed(!1),void i.toggleIsZooming(!1);s.toggleLoading(!1);const m=1/t.xLabels.length,y=f/(t.xLabels.length-1),g={};t.datasets.forEach(({key:t})=>g[t]=!1);const v=ot(e,h||t.shouldZoomToPie),x=Object.keys(t.datasets).length!==Object.keys(v.datasets).length;a.update({range:{begin:y-m/2,end:y+m/2},filter:g}),setTimeout(()=>{Object.assign(t,v),x&&e.colors&&Object.assign(n,q(e.colors)),x&&(l.toggle(h),r.redraw(),o.style.width=`${o.scrollWidth}px`,o.style.height=`${o.scrollHeight}px`),a.update({range:{begin:.4,end:.6},focusOn:null},!0);const s=1/(h||t.shouldZoomToPie?t.xLabels.length:t.xLabels.length/24)/2;let c,f;h?(c={begin:d.begin,end:d.end},f=x?d.filter:u.filter):x?(c={begin:0,end:1},f={},t.datasets.forEach(({key:t})=>f[t]=!0)):(c=t.shouldZoomToPie?{begin:.5-s,end:.5+s}:v.minimapRange,f=d.filter),a.update({range:c,filter:f,minimapDelta:h?null:c.end-c.begin}),p&&i.zoom(W(p)),h=!h,i.toggleIsZooming(!1)},a.hasAnimations()?c:0),setTimeout(()=>{t.shouldZoomToPie&&o.classList.remove("lovely-chart--state-animating")},a.hasAnimations()?1e3:0)}return{zoomIn:function(n,a){if(h)return;const l=t.xLabels[a];d=n,i.toggleIsZooming(!0),s.toggleLoading(!0),s.toggleIsZoomed(!0),t.shouldZoomToPie&&(o.classList.add("lovely-chart--state-zoomed-in"),o.classList.add("lovely-chart--state-animating"));const{value:r}=l;(t.shouldZoomToPie?Promise.resolve(function(t){return Object.assign({},e,{type:"pie",labels:e.labels.slice(t-3,t+4),datasets:e.datasets.map(e=>({...e,values:e.values.slice(t-3,t+4)}))})}(a)):t.onZoom(r)).then(t=>f(t,a,l))},zoomOut:function(n){if(!h)return;u=n,i.toggleIsZooming(!0),s.toggleLoading(!0),s.toggleIsZoomed(!1),t.shouldZoomToPie&&(o.classList.remove("lovely-chart--state-zoomed-in"),o.classList.add("lovely-chart--state-animating"));const a=Math.round((n.labelFromIndex+n.labelToIndex)/2);f(e,a)},isZoomed:function(){return h}}}(A,e,T,n,a,u,f,p,m)}function E(t){M=t;const{datasets:e}=A,n={from:t.labelFromIndex,to:t.labelToIndex},a={begin:t.begin,end:t.end,totalXWidth:t.totalXWidth,yMin:t.yMinViewport,yMax:t.yMaxViewport,availableWidth:d.width,availableHeight:d.height-30,xPadding:l,yPadding:15},o=e.map(({key:e})=>t[`opacity#${e}`]),r=G(A,e,n,o,a),c=U(a);let m=null,g=null;if(A.hasSecondYAxis){const a=e.find(t=>t.hasOwnYAxis),i={yMin:t.yMinViewportSecond,yMax:t.yMaxViewportSecond};m=G(A,[a],n,o,i)[0],g=c.copy(i)}A.hideCaption||u.setCaption(function(t){let e,n;return y&&y.isZoomed()?(e=0===t.labelFromIndex?0:t.labelFromIndex+1,n=t.labelToIndex===t.totalXWidth-1?t.labelToIndex:t.labelToIndex-1):(e=t.labelFromIndex,n=t.labelToIndex),a=A.xLabels[e],o=A.xLabels[n],Math.abs(o.value-a.value)>864e5?`${D(A.xLabels[e])} — ${D(A.xLabels[n])}`:W(A.xLabels[e]);var a,o}(t)),K(i,s);const v=1*L(r.reduce((t,e)=>t+e.length,0));tt(s,t,A,n,r,c,m,g,2,o,T,!1,v),A.isPie||(h.drawYAxis(t,c,g),h.drawXAxis(t,c)),f.update(t),p.update(t,r,c,m,g)}function H(t){n.update({range:t})}function Z(t){n.update({filter:t})}function Y(t){(A.isBars||A.isPie||A.isSteps)&&n.update({focusOn:t})}function X(t){y.zoomIn(M,t)}function N(){y.zoomOut(M)}O(),document.documentElement.addEventListener("darkmode",()=>{n.update()}),window.addEventListener("resize",()=>{window.innerWidth!==S&&(S=window.innerWidth,I())}),window.addEventListener("orientationchange",()=>{I()})}}}]); //# sourceMappingURL=4810.1e0aaa2102436ee6cd4c.js.map