diff --git a/CHANGELOG.md b/CHANGELOG.md index 6912441..69e7910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +- 0.5.3-1 (2025-02-13): + + Fixed step calculation when scraper is disabled (i.e., no scraping period available). + - 0.5.2-1 (2025-02-12): + Improved logrotate configuration. + Fixed DuckDB query when normalizing input `from` and `to` timestamps. diff --git a/Makefile b/Makefile index f73c8dc..4147e4c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SHELL := /bin/bash ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) UMASK := 022 -VERSION := 0.5.2 +VERSION := 0.5.3 ITERATION := 1 REVISION := $(shell cd '$(ROOT)' && git rev-parse --short HEAD) ENVIRONMENT ?= production diff --git a/README.md b/README.md index f9e3e66..a814341 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,16 @@ While `varnishmon` **doesn't replace a comprehensive monitoring solutions like P `varnishmon` is a self-contained executable that allows you to start collecting data with minimal effort and explore it through a simple yet effective web interface. In addition to occasional troubleshooting, `varnishmon` can also be used as a lightweight, permanent service to collect, store, visualize, and rotate Varnish metrics. Similar to running `atop` in logging mode as a complement to regular monitoring, `varnishmon` provides valuable context during incident analysis. +## 📑 Table of Contents + +- [Quick Start](#-quick-start) +- [Q & A](#-q-a) + - [Usage](#usage) + - [Configuration & Customization](#configuration-customization) + - [Running as a Service](#running-as-a-service) + - [Miscellaneous](#miscellaneous) +- [License](#-license) + ## 🚀 Quick Start 1. **Download & install** diff --git a/assets/static/app.js b/assets/static/app.js index 4200a82..4cbbde6 100644 --- a/assets/static/app.js +++ b/assets/static/app.js @@ -157,4 +157,4 @@ maplibre-gl/dist/maplibre-gl.js: * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt *) -*/return window.Plotly=t,t},t.exports?t.exports=s():o.moduleName=s()},785:t=>{"use strict";t.exports=function(t){for(var e=t.length,r=new Array(e),n=new Array(e),i=new Array(e),a=new Array(e),o=new Array(e),s=new Array(e),l=0;l0;){e=c[c.length-1];var p=t[e];if(a[e]=0&&s[e].push(o[m])}a[e]=d}else{if(n[e]===r[e]){var g=[],y=[],v=0;for(d=l.length-1;d>=0;--d){var x=l[d];if(i[x]=!1,g.push(x),y.push(s[x]),v+=s[x].length,o[x]=h.length,x===e){l.length=d;break}}h.push(g);var _=new Array(v);for(d=0;d{"use strict";function n(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}r.d(e,{A:()=>n})},37:(t,e,r)=>{"use strict";r.d(e,{A:()=>a});var n=r(902),i=r(180);function a(t){let e,r,a;function s(t,n,i=0,a=t.length){if(i>>1;r(t[e],n)<0?i=e+1:a=e}while(i(0,n.A)(t(e),r),a=(e,r)=>t(e)-r):(e=t===n.A||t===i.A?t:o,r=t,a=t),{left:s,center:function(t,e,r=0,n=t.length){const i=s(t,e,r,n-1);return i>r&&a(t[i-1],e)>-a(t[i],e)?i-1:i},right:function(t,n,i=0,a=t.length){if(i>>1;r(t[e],n)<=0?i=e+1:a=e}while(i{"use strict";function n(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}r.d(e,{A:()=>n})},47:(t,e,r)=>{"use strict";r.d(e,{KS:()=>i,Nn:()=>a,ph:()=>n});class n{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n0){for(a=t[--i];i>0&&(e=a,r=t[--i],a=e+r,n=r-(a-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=a+r,r==e-a&&(a=e))}return a}}function i(t,e){const r=new n;if(void 0===e)for(let e of t)(e=+e)&&r.add(e);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&r.add(i)}return+r}function a(t,e){const r=new n;let i=-1;return Float64Array.from(t,void 0===e?t=>r.add(+t||0):n=>r.add(+e(n,++i,t)||0))}},882:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Adder:()=>E.ph,InternMap:()=>C,InternSet:()=>I,ascending:()=>n.A,bin:()=>it,bisect:()=>u,bisectCenter:()=>c,bisectLeft:()=>l,bisectRight:()=>s,bisector:()=>i.A,blur:()=>h,blur2:()=>f,blurImage:()=>p,count:()=>v,cross:()=>w,cumsum:()=>T,descending:()=>k.A,deviation:()=>M,difference:()=>Vt,disjoint:()=>qt,every:()=>Rt,extent:()=>S,fcumsum:()=>E.Nn,filter:()=>jt,flatGroup:()=>B,flatRollup:()=>N,fsum:()=>E.KS,greatest:()=>ht,greatestIndex:()=>Et,group:()=>R,groupSort:()=>K,groups:()=>F,histogram:()=>it,index:()=>q,indexes:()=>H,intersection:()=>Ht,least:()=>Mt,leastIndex:()=>St,map:()=>Bt,max:()=>at,maxIndex:()=>ot,mean:()=>yt,median:()=>vt,medianIndex:()=>xt,merge:()=>_t.A,min:()=>st,minIndex:()=>lt,mode:()=>bt,nice:()=>rt,pairs:()=>wt,permute:()=>W,quantile:()=>ft,quantileIndex:()=>dt,quantileSorted:()=>pt,quickselect:()=>ct,range:()=>kt.A,rank:()=>At,reduce:()=>Nt,reverse:()=>Ut,rollup:()=>U,rollups:()=>V,scan:()=>Ct,shuffle:()=>It,shuffler:()=>Lt,some:()=>Ft,sort:()=>Y,subset:()=>Yt,sum:()=>Pt,superset:()=>Zt,thresholdFreedmanDiaconis:()=>mt,thresholdScott:()=>gt,thresholdSturges:()=>nt,tickIncrement:()=>et.lq,tickStep:()=>et.sG,ticks:()=>et.Ay,transpose:()=>zt,union:()=>Xt,variance:()=>A,zip:()=>Ot});var n=r(902),i=r(37);function a(t){return null===t?NaN:+t}const o=(0,i.A)(n.A),s=o.right,l=o.left,c=(0,i.A)(a).center,u=s;function h(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let r=t.length;if(!((r=Math.floor(r))>=0))throw new RangeError("invalid length");if(!r||!e)return t;const n=y(e),i=t.slice();return n(t,i,0,r,1),n(i,t,0,r,1),n(t,i,0,r,1),t}const f=d(y),p=d((function(t){const e=y(t);return(t,r,n,i,a)=>{e(t,r,(n<<=2)+0,(i<<=2)+0,a<<=2),e(t,r,n+1,i+1,a),e(t,r,n+2,i+2,a),e(t,r,n+3,i+3,a)}}));function d(t){return function(e,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:a,height:o}=e;if(!((a=Math.floor(a))>=0))throw new RangeError("invalid width");if(!((o=Math.floor(void 0!==o?o:i.length/a))>=0))throw new RangeError("invalid height");if(!a||!o||!r&&!n)return e;const s=r&&t(r),l=n&&t(n),c=i.slice();return s&&l?(m(s,c,i,a,o),m(s,i,c,a,o),m(s,c,i,a,o),g(l,i,c,a,o),g(l,c,i,a,o),g(l,i,c,a,o)):s?(m(s,i,c,a,o),m(s,c,i,a,o),m(s,i,c,a,o)):l&&(g(l,i,c,a,o),g(l,c,i,a,o),g(l,i,c,a,o)),e}}function m(t,e,r,n,i){for(let a=0,o=n*i;a{if(!((a-=o)>=i))return;let s=t*n[i];const l=o*t;for(let t=i,e=i+l;t{if(!((o-=s)>=a))return;let l=e*i[a];const c=s*e,u=c+s;for(let t=a,e=a+c;t=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}function x(t){return 0|t.length}function _(t){return!(t>0)}function b(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function w(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),r=(t=t.map(b)).map(x),n=t.length-1,i=new Array(n+1).fill(0),a=[];if(n<0||r.some(_))return a;for(;;){a.push(i.map(((e,r)=>t[r][e])));let o=n;for(;++i[o]===r[o];){if(0===o)return e?a.map(e):a;i[o--]=0}}}function T(t,e){var r=0,n=0;return Float64Array.from(t,void 0===e?t=>r+=+t||0:i=>r+=+e(i,n++,t)||0)}var k=r(180);function A(t,e){let r,n=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(r=e-i,i+=r/++n,a+=r*(e-i));else{let o=-1;for(let s of t)null!=(s=e(s,++o,t))&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i))}if(n>1)return a/(n-1)}function M(t,e){const r=A(t,e);return r?Math.sqrt(r):r}function S(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n=a&&(r=n=a):(r>a&&(r=a),nt.pop().map((([e,r])=>[...t,e,r]))));return t}function B(t,...e){return j(F(t,...e),e)}function N(t,e,...r){return j(V(t,e,...r),r)}function U(t,e,...r){return Z(t,O,e,r)}function V(t,e,...r){return Z(t,Array.from,e,r)}function q(t,...e){return Z(t,O,G,e)}function H(t,...e){return Z(t,Array.from,G,e)}function G(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function Z(t,e,r,n){return function t(i,a){if(a>=n.length)return r(i);const o=new C,s=n[a++];let l=-1;for(const t of i){const e=s(t,++l,i),r=o.get(e);r?r.push(t):o.set(e,[t])}for(const[e,r]of o)o.set(e,t(r,a));return e(o)}(t,0)}function W(t,e){return Array.from(e,(e=>t[e]))}function Y(t,...e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[r]=e;if(r&&2!==r.length||e.length>1){const n=Uint32Array.from(t,((t,e)=>e));return e.length>1?(e=e.map((e=>t.map(e))),n.sort(((t,r)=>{for(const n of e){const e=$(n[t],n[r]);if(e)return e}}))):(r=t.map(r),n.sort(((t,e)=>$(r[t],r[e])))),W(t,n)}return t.sort(X(r))}function X(t=n.A){if(t===n.A)return $;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}function $(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}function K(t,e,r){return(2!==e.length?Y(U(t,e,r),(([t,e],[r,i])=>(0,n.A)(e,i)||(0,n.A)(t,r))):Y(R(t,r),(([t,r],[i,a])=>e(r,a)||(0,n.A)(t,i)))).map((([t])=>t))}var J=Array.prototype,Q=J.slice;J.map;function tt(t){return()=>t}var et=r(946);function rt(t,e,r){let n;for(;;){const i=(0,et.lq)(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}function nt(t){return Math.max(1,Math.ceil(Math.log(v(t))/Math.LN2)+1)}function it(){var t=O,e=S,r=nt;function n(n){Array.isArray(n)||(n=Array.from(n));var i,a,o,s=n.length,l=new Array(s);for(i=0;i=f)if(t>=f&&e===S){const t=(0,et.lq)(h,f,r);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*-t)+1)/-t))}else p.pop()}for(var d=p.length,m=0,g=d;p[m]<=h;)++m;for(;p[g-1]>f;)--g;(m||g0?p[i-1]:h,y.x1=i0)for(i=0;i=e)&&(r=e);else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(r=i)&&(r=i)}return r}function ot(t,e){let r,n=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(r=e)&&(r=e,n=i);else for(let a of t)null!=(a=e(a,++i,t))&&(r=a)&&(r=a,n=i);return n}function st(t,e){let r;if(void 0===e)for(const e of t)null!=e&&(r>e||void 0===r&&e>=e)&&(r=e);else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(r>i||void 0===r&&i>=i)&&(r=i)}return r}function lt(t,e){let r,n=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(r>e||void 0===r&&e>=e)&&(r=e,n=i);else for(let a of t)null!=(a=e(a,++i,t))&&(r>a||void 0===r&&a>=a)&&(r=a,n=i);return n}function ct(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=void 0===i?$:X(i);n>r;){if(n-r>600){const a=n-r+1,o=e-r+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);ct(t,e,Math.max(r,Math.floor(e-o*l/a+c)),Math.min(n,Math.floor(e+(a-o)*l/a+c)),i)}const a=t[e];let o=r,s=n;for(ut(t,r,e),i(t[n],a)>0&&ut(t,r,n);o0;)--s}0===i(t[r],a)?ut(t,r,s):(++s,ut(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}return t}function ut(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function ht(t,e=n.A){let r,i=!1;if(1===e.length){let a;for(const o of t){const t=e(o);(i?(0,n.A)(t,a)>0:0===(0,n.A)(t,t))&&(r=o,a=t,i=!0)}}else for(const n of t)(i?e(n,r)>0:0===e(n,n))&&(r=n,i=!0);return r}function ft(t,e,r){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,r)),(n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return st(t);if(e>=1)return at(t);var n,i=(n-1)*e,a=Math.floor(i),o=at(ct(t,a).subarray(0,a+1));return o+(st(t.subarray(a+1))-o)*(i-a)}}function pt(t,e,r=a){if((n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,o=Math.floor(i),s=+r(t[o],o,t);return s+(+r(t[o+1],o+1,t)-s)*(i-o)}}function dt(t,e,r=a){if(!isNaN(e=+e)){if(n=Float64Array.from(t,((e,n)=>a(r(t[n],n,t)))),e<=0)return lt(n);if(e>=1)return ot(n);var n,i=Uint32Array.from(t,((t,e)=>e)),o=n.length-1,s=Math.floor(o*e);return ct(i,s,0,o,((t,e)=>$(n[t],n[e]))),(s=ht(i.subarray(0,s+1),(t=>n[t])))>=0?s:-1}}function mt(t,e,r){const n=v(t),i=ft(t,.75)-ft(t,.25);return n&&i?Math.ceil((r-e)/(2*i*Math.pow(n,-1/3))):1}function gt(t,e,r){const n=v(t),i=M(t);return n&&i?Math.ceil((r-e)*Math.cbrt(n)/(3.49*i)):1}function yt(t,e){let r=0,n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++r,n+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++r,n+=a)}if(r)return n/r}function vt(t,e){return ft(t,.5,e)}function xt(t,e){return dt(t,.5,e)}var _t=r(128);function bt(t,e){const r=new C;if(void 0===e)for(let e of t)null!=e&&e>=e&&r.set(e,(r.get(e)||0)+1);else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&i>=i&&r.set(i,(r.get(i)||0)+1)}let n,i=0;for(const[t,e]of r)e>i&&(i=e,n=t);return n}function wt(t,e=Tt){const r=[];let n,i=!1;for(const a of t)i&&r.push(e(n,a)),n=a,i=!0;return r}function Tt(t,e){return[t,e]}var kt=r(561);function At(t,e=n.A){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(t);const i=new Float64Array(r.length);2!==e.length&&(r=r.map(e),e=n.A);const a=(t,n)=>e(r[t],r[n]);let o,s;return(t=Uint32Array.from(r,((t,e)=>e))).sort(e===n.A?(t,e)=>$(r[t],r[e]):X(a)),t.forEach(((t,e)=>{const r=a(t,void 0===o?t:o);r>=0?((void 0===o||r>0)&&(o=t,s=e),i[t]=s):i[t]=NaN})),i}function Mt(t,e=n.A){let r,i=!1;if(1===e.length){let a;for(const o of t){const t=e(o);(i?(0,n.A)(t,a)<0:0===(0,n.A)(t,t))&&(r=o,a=t,i=!0)}}else for(const n of t)(i?e(n,r)<0:0===e(n,n))&&(r=n,i=!0);return r}function St(t,e=n.A){if(1===e.length)return lt(t,e);let r,i=-1,a=-1;for(const n of t)++a,(i<0?0===e(n,n):e(n,r)<0)&&(r=n,i=a);return i}function Et(t,e=n.A){if(1===e.length)return ot(t,e);let r,i=-1,a=-1;for(const n of t)++a,(i<0?0===e(n,n):e(n,r)>0)&&(r=n,i=a);return i}function Ct(t,e){const r=St(t,e);return r<0?void 0:r}const It=Lt(Math.random);function Lt(t){return function(e,r=0,n=e.length){let i=n-(r=+r);for(;i;){const n=t()*i--|0,a=e[i+r];e[i+r]=e[n+r],e[n+r]=a}return e}}function Pt(t,e){let r=0;if(void 0===e)for(let e of t)(e=+e)&&(r+=e);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&(r+=i)}return r}function zt(t){if(!(i=t.length))return[];for(var e=-1,r=st(t,Dt),n=new Array(r);++ee(r,n,t)))}function Nt(t,e,r){if("function"!=typeof e)throw new TypeError("reducer is not a function");const n=t[Symbol.iterator]();let i,a,o=-1;if(arguments.length<3){if(({done:i,value:r}=n.next()),i)return;++o}for(;({done:i,value:a}=n.next()),!i;)r=e(r,a,++o,t);return r}function Ut(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()}function Vt(t,...e){t=new I(t);for(const r of e)for(const e of r)t.delete(e);return t}function qt(t,e){const r=e[Symbol.iterator](),n=new I;for(const e of t){if(n.has(e))return!1;let t,i;for(;({value:t,done:i}=r.next())&&!i;){if(Object.is(e,t))return!1;n.add(t)}}return!0}function Ht(t,...e){t=new I(t),e=e.map(Gt);t:for(const r of t)for(const n of e)if(!n.has(r)){t.delete(r);continue t}return t}function Gt(t){return t instanceof I?t:new I(t)}function Zt(t,e){const r=t[Symbol.iterator](),n=new Set;for(const t of e){const e=Wt(t);if(n.has(e))continue;let i,a;for(;({value:i,done:a}=r.next());){if(a)return!1;const t=Wt(i);if(n.add(t),Object.is(e,t))break}}return!0}function Wt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Yt(t,e){return Zt(e,t)}function Xt(...t){const e=new I;for(const r of t)for(const t of r)e.add(t);return e}},128:(t,e,r)=>{"use strict";function n(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}r.d(e,{A:()=>n})},561:(t,e,r)=>{"use strict";function n(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),a=new Array(i);++nn})},946:(t,e,r)=>{"use strict";r.d(e,{Ay:()=>s,lq:()=>l,sG:()=>c});const n=Math.sqrt(50),i=Math.sqrt(10),a=Math.sqrt(2);function o(t,e,r){const s=(e-t)/Math.max(0,r),l=Math.floor(Math.log10(s)),c=s/Math.pow(10,l),u=c>=n?10:c>=i?5:c>=a?2:1;let h,f,p;return l<0?(p=Math.pow(10,-l)/u,h=Math.round(t*p),f=Math.round(e*p),h/pe&&--f,p=-p):(p=Math.pow(10,l)*u,h=Math.round(t/p),f=Math.round(e/p),h*pe&&--f),f0))return[];if((t=+t)===(e=+e))return[t];const n=e=i))return[];const l=a-i+1,c=new Array(l);if(n)if(s<0)for(let t=0;t{"use strict";r.r(e),r.d(e,{dispatch:()=>l});var n={value:()=>{}};function i(){for(var t,e=0,r=arguments.length,n={};e=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),l=-1,c=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l0)for(var r,n,i=new Array(r),a=0;a{"use strict";r.r(e),r.d(e,{geoAlbers:()=>An,geoAlbersUsa:()=>Mn,geoArea:()=>it,geoAzimuthalEqualArea:()=>In,geoAzimuthalEqualAreaRaw:()=>Cn,geoAzimuthalEquidistant:()=>Pn,geoAzimuthalEquidistantRaw:()=>Ln,geoBounds:()=>Bt,geoCentroid:()=>Kt,geoCircle:()=>le,geoClipAntimeridian:()=>_e,geoClipCircle:()=>be,geoClipExtent:()=>Ce,geoClipRectangle:()=>Ee,geoConicConformal:()=>jn,geoConicConformalRaw:()=>Fn,geoConicEqualArea:()=>kn,geoConicEqualAreaRaw:()=>Tn,geoConicEquidistant:()=>Vn,geoConicEquidistantRaw:()=>Un,geoContains:()=>Ze,geoDistance:()=>Fe,geoEqualEarth:()=>Xn,geoEqualEarthRaw:()=>Yn,geoEquirectangular:()=>Nn,geoEquirectangularRaw:()=>Bn,geoGnomonic:()=>Kn,geoGnomonicRaw:()=>$n,geoGraticule:()=>$e,geoGraticule10:()=>Ke,geoIdentity:()=>Jn,geoInterpolate:()=>Je,geoLength:()=>De,geoMercator:()=>Dn,geoMercatorRaw:()=>zn,geoNaturalEarth1:()=>ti,geoNaturalEarth1Raw:()=>Qn,geoOrthographic:()=>ri,geoOrthographicRaw:()=>ei,geoPath:()=>on,geoProjection:()=>_n,geoProjectionMutator:()=>bn,geoRotation:()=>ae,geoStereographic:()=>ii,geoStereographicRaw:()=>ni,geoStream:()=>D,geoTransform:()=>sn,geoTransverseMercator:()=>oi,geoTransverseMercatorRaw:()=>ai});var n=r(47),i=1e-6,a=1e-12,o=Math.PI,s=o/2,l=o/4,c=2*o,u=180/o,h=o/180,f=Math.abs,p=Math.atan,d=Math.atan2,m=Math.cos,g=Math.ceil,y=Math.exp,v=(Math.floor,Math.hypot),x=Math.log,_=Math.pow,b=Math.sin,w=Math.sign||function(t){return t>0?1:t<0?-1:0},T=Math.sqrt,k=Math.tan;function A(t){return t>1?0:t<-1?o:Math.acos(t)}function M(t){return t>1?s:t<-1?-s:Math.asin(t)}function S(t){return(t=b(t/2))*t}function E(){}function C(t,e){t&&L.hasOwnProperty(t.type)&&L[t.type](t,e)}var I={Feature:function(t,e){C(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,i=n*r,a=m(e=(e*=h)/2+l),o=b(e),s=B*o,c=j*a+s*m(i),u=s*n*b(i);K.add(d(u,c)),F=t,j=a,B=o}function it(t){return J=new n.ph,D(t,Q),2*J}function at(t){return[d(t[1],t[0]),M(t[2])]}function ot(t){var e=t[0],r=t[1],n=m(r);return[n*m(e),n*b(e),b(r)]}function st(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function lt(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function ct(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ut(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ht(t){var e=T(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var ft,pt,dt,mt,gt,yt,vt,xt,_t,bt,wt,Tt,kt,At,Mt,St,Et={point:Ct,lineStart:Lt,lineEnd:Pt,polygonStart:function(){Et.point=zt,Et.lineStart=Dt,Et.lineEnd=Ot,Y=new n.ph,Q.polygonStart()},polygonEnd:function(){Q.polygonEnd(),Et.point=Ct,Et.lineStart=Lt,Et.lineEnd=Pt,K<0?(N=-(V=180),U=-(q=90)):Y>i?q=90:Y<-i&&(U=-90),$[0]=N,$[1]=V},sphere:function(){N=-(V=180),U=-(q=90)}};function Ct(t,e){X.push($=[N=t,V=t]),eq&&(q=e)}function It(t,e){var r=ot([t*h,e*h]);if(W){var n=lt(W,r),i=lt([n[1],-n[0],0],n);ht(i),i=at(i);var a,o=t-H,s=o>0?1:-1,l=i[0]*u*s,c=f(o)>180;c^(s*Hq&&(q=a):c^(s*H<(l=(l+360)%360-180)&&lq&&(q=e)),c?tRt(N,V)&&(V=t):Rt(t,V)>Rt(N,V)&&(N=t):V>=N?(tV&&(V=t)):t>H?Rt(N,t)>Rt(N,V)&&(V=t):Rt(t,V)>Rt(N,V)&&(N=t)}else X.push($=[N=t,V=t]);eq&&(q=e),W=r,H=t}function Lt(){Et.point=It}function Pt(){$[0]=N,$[1]=V,Et.point=Ct,W=null}function zt(t,e){if(W){var r=t-H;Y.add(f(r)>180?r+(r>0?360:-360):r)}else G=t,Z=e;Q.point(t,e),It(t,e)}function Dt(){Q.lineStart()}function Ot(){zt(G,Z),Q.lineEnd(),f(Y)>i&&(N=-(V=180)),$[0]=N,$[1]=V,W=null}function Rt(t,e){return(e-=t)<0?e+360:e}function Ft(t,e){return t[0]-e[0]}function jt(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:eRt(n[0],n[1])&&(n[1]=i[1]),Rt(i[0],n[1])>Rt(n[0],n[1])&&(n[0]=i[0])):a.push(n=i);for(o=-1/0,e=0,n=a[r=a.length-1];e<=r;n=i,++e)i=a[e],(s=Rt(n[1],i[0]))>o&&(o=s,N=i[0],V=n[1])}return X=$=null,N===1/0||U===1/0?[[NaN,NaN],[NaN,NaN]]:[[N,U],[V,q]]}var Nt={sphere:E,point:Ut,lineStart:qt,lineEnd:Zt,polygonStart:function(){Nt.lineStart=Wt,Nt.lineEnd=Yt},polygonEnd:function(){Nt.lineStart=qt,Nt.lineEnd=Zt}};function Ut(t,e){t*=h;var r=m(e*=h);Vt(r*m(t),r*b(t),b(e))}function Vt(t,e,r){++ft,dt+=(t-dt)/ft,mt+=(e-mt)/ft,gt+=(r-gt)/ft}function qt(){Nt.point=Ht}function Ht(t,e){t*=h;var r=m(e*=h);At=r*m(t),Mt=r*b(t),St=b(e),Nt.point=Gt,Vt(At,Mt,St)}function Gt(t,e){t*=h;var r=m(e*=h),n=r*m(t),i=r*b(t),a=b(e),o=d(T((o=Mt*a-St*i)*o+(o=St*n-At*a)*o+(o=At*i-Mt*n)*o),At*n+Mt*i+St*a);pt+=o,yt+=o*(At+(At=n)),vt+=o*(Mt+(Mt=i)),xt+=o*(St+(St=a)),Vt(At,Mt,St)}function Zt(){Nt.point=Ut}function Wt(){Nt.point=Xt}function Yt(){$t(Tt,kt),Nt.point=Ut}function Xt(t,e){Tt=t,kt=e,t*=h,e*=h,Nt.point=$t;var r=m(e);At=r*m(t),Mt=r*b(t),St=b(e),Vt(At,Mt,St)}function $t(t,e){t*=h;var r=m(e*=h),n=r*m(t),i=r*b(t),a=b(e),o=Mt*a-St*i,s=St*n-At*a,l=At*i-Mt*n,c=v(o,s,l),u=M(c),f=c&&-u/c;_t.add(f*o),bt.add(f*s),wt.add(f*l),pt+=u,yt+=u*(At+(At=n)),vt+=u*(Mt+(Mt=i)),xt+=u*(St+(St=a)),Vt(At,Mt,St)}function Kt(t){ft=pt=dt=mt=gt=yt=vt=xt=0,_t=new n.ph,bt=new n.ph,wt=new n.ph,D(t,Nt);var e=+_t,r=+bt,o=+wt,s=v(e,r,o);return so&&(t-=Math.round(t/c)*c),[t,e]}function ee(t,e,r){return(t%=c)?e||r?Qt(ne(t),ie(e,r)):ne(t):e||r?ie(e,r):te}function re(t){return function(e,r){return f(e+=t)>o&&(e-=Math.round(e/c)*c),[e,r]}}function ne(t){var e=re(t);return e.invert=re(-t),e}function ie(t,e){var r=m(t),n=b(t),i=m(e),a=b(e);function o(t,e){var o=m(e),s=m(t)*o,l=b(t)*o,c=b(e),u=c*r+s*n;return[d(l*i-u*a,s*r-c*n),M(u*i+l*a)]}return o.invert=function(t,e){var o=m(e),s=m(t)*o,l=b(t)*o,c=b(e),u=c*i-l*a;return[d(l*i+c*a,s*r+u*n),M(u*r-s*n)]},o}function ae(t){function e(e){return(e=t(e[0]*h,e[1]*h))[0]*=u,e[1]*=u,e}return t=ee(t[0]*h,t[1]*h,t.length>2?t[2]*h:0),e.invert=function(e){return(e=t.invert(e[0]*h,e[1]*h))[0]*=u,e[1]*=u,e},e}function oe(t,e,r,n,i,a){if(r){var o=m(e),s=b(e),l=n*r;null==i?(i=e+n*c,a=e-l/2):(i=se(o,i),a=se(o,a),(n>0?ia)&&(i+=n*c));for(var u,h=i;n>0?h>a:h1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function ue(t,e){return f(t[0]-e[0])=0;--o)a.point((h=u[o])[0],h[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,d=!d}while(!p.v);a.lineEnd()}}}function pe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,F=R*O,j=F>o,B=S*z;if(y.add(d(B*R*b(F),E*D+B*m(F))),p+=j?O+R*c:O,j^k>=r^L>=r){var N=lt(ot(T),ot(I));ht(N);var U=lt(f,N);ht(U);var V=(j^O>=0?-1:1)*M(U[2]);(u>V||u===V&&(N[0]||N[1]))&&(g+=j^O>=0?1:-1)}}return(p<-i||p0){for(h||(i.polygonStart(),h=!0),i.lineStart(),t=0;t1&&2&l&&f.push(f.pop().concat(f.shift())),o.push(f.filter(ve))}return f}}function ve(t){return t.length>1}function xe(t,e){return((t=t.x)[0]<0?t[1]-s-i:s-t[1])-((e=e.x)[0]<0?e[1]-s-i:s-e[1])}const _e=ye((function(){return!0}),(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(l,c){var u=l>0?o:-o,h=f(l-r);f(h-o)0?s:-s),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(l,n),e=0):a!==u&&h>=o&&(f(r-a)i?p((b(e)*(o=m(n))*b(r)-b(n)*(a=m(e))*b(t))/(a*o*s)):(e+n)/2}(r,n,l,c),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(u,n),e=0),t.point(r=l,n=c),a=u},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*s,n.point(-o,a),n.point(0,a),n.point(o,a),n.point(o,0),n.point(o,-a),n.point(0,-a),n.point(-o,-a),n.point(-o,0),n.point(-o,a);else if(f(t[0]-e[0])>i){var l=t[0]0,a=f(e)>i;function s(t,r){return m(t)*m(r)>e}function l(t,r,n){var a=[1,0,0],s=lt(ot(t),ot(r)),l=st(s,s),c=s[0],u=l-c*c;if(!u)return!n&&t;var h=e*l/u,p=-e*c/u,d=lt(a,s),m=ut(a,h);ct(m,ut(s,p));var g=d,y=st(m,g),v=st(g,g),x=y*y-v*(st(m,m)-1);if(!(x<0)){var _=T(x),b=ut(g,(-y-_)/v);if(ct(b,m),b=at(b),!n)return b;var w,k=t[0],A=r[0],M=t[1],S=r[1];A0^b[1]<(f(b[0]-k)o^(k<=b[0]&&b[0]<=A)){var I=ut(g,(-y+_)/v);return ct(I,m),[b,at(I)]}}}function c(e,r){var i=n?t:o-t,a=0;return e<-i?a|=1:e>i&&(a|=2),r<-i?a|=4:r>i&&(a|=8),a}return ye(s,(function(t){var e,r,i,u,h;return{lineStart:function(){u=i=!1,h=1},point:function(f,p){var d,m=[f,p],g=s(f,p),y=n?g?0:c(f,p):g?c(f+(f<0?o:-o),p):0;if(!e&&(u=i=g)&&t.lineStart(),g!==i&&(!(d=l(e,m))||ue(e,d)||ue(m,d))&&(m[2]=1),g!==i)h=0,g?(t.lineStart(),d=l(m,e),t.point(d[0],d[1])):(d=l(e,m),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(a&&e&&n^g){var v;y&r||!(v=l(m,e,!0))||(h=0,n?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!g||e&&ue(e,m)||t.point(m[0],m[1]),e=m,i=g,r=y},lineEnd:function(){i&&t.lineEnd(),e=null},clean:function(){return h|(u&&i)<<1}}}),(function(e,n,i,a){oe(a,t,r,i,e,n)}),n?[0,-t]:[-o,t-o])}var we,Te,ke,Ae,Me=1e9,Se=-Me;function Ee(t,e,r,n){function a(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function o(i,a,o,l){var u=0,h=0;if(null==i||(u=s(i,o))!==(h=s(a,o))||c(i,a)<0^o>0)do{l.point(0===u||3===u?t:r,u>1?n:e)}while((u=(u+o+4)%4)!==h);else l.point(a[0],a[1])}function s(n,a){return f(n[0]-t)0?0:3:f(n[0]-r)0?2:1:f(n[1]-e)0?1:0:a>0?3:2}function l(t,e){return c(t.x,e.x)}function c(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(i){var s,c,u,h,f,p,d,m,g,y,v,x=i,_=ce(),b={point:w,lineStart:function(){b.point=T,c&&c.push(u=[]);y=!0,g=!1,d=m=NaN},lineEnd:function(){s&&(T(h,f),p&&g&&_.rejoin(),s.push(_.result()));b.point=w,g&&x.lineEnd()},polygonStart:function(){x=_,s=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=c.length;rn&&(f-a)*(n-o)>(p-o)*(t-a)&&++e:p<=n&&(f-a)*(n-o)<(p-o)*(t-a)&&--e;return e}(),r=v&&e,a=(s=(0,ge.A)(s)).length;(r||a)&&(i.polygonStart(),r&&(i.lineStart(),o(null,null,1,i),i.lineEnd()),a&&fe(s,l,e,o,i),i.polygonEnd());x=i,s=c=u=null}};function w(t,e){a(t,e)&&x.point(t,e)}function T(i,o){var s=a(i,o);if(c&&u.push([i,o]),y)h=i,f=o,p=s,y=!1,s&&(x.lineStart(),x.point(i,o));else if(s&&g)x.point(i,o);else{var l=[d=Math.max(Se,Math.min(Me,d)),m=Math.max(Se,Math.min(Me,m))],_=[i=Math.max(Se,Math.min(Me,i)),o=Math.max(Se,Math.min(Me,o))];!function(t,e,r,n,i,a){var o,s=t[0],l=t[1],c=0,u=1,h=e[0]-s,f=e[1]-l;if(o=r-s,h||!(o>0)){if(o/=h,h<0){if(o0){if(o>u)return;o>c&&(c=o)}if(o=i-s,h||!(o<0)){if(o/=h,h<0){if(o>u)return;o>c&&(c=o)}else if(h>0){if(o0)){if(o/=f,f<0){if(o0){if(o>u)return;o>c&&(c=o)}if(o=a-l,f||!(o<0)){if(o/=f,f<0){if(o>u)return;o>c&&(c=o)}else if(f>0){if(o0&&(t[0]=s+c*h,t[1]=l+c*f),u<1&&(e[0]=s+u*h,e[1]=l+u*f),!0}}}}}(l,_,t,e,r,n)?s&&(x.lineStart(),x.point(i,o),v=!1):(g||(x.lineStart(),x.point(l[0],l[1])),x.point(_[0],_[1]),s||x.lineEnd(),v=!1)}d=i,m=o,g=s}return b}}function Ce(){var t,e,r,n=0,i=0,a=960,o=500;return r={stream:function(r){return t&&e===r?t:t=Ee(n,i,a,o)(e=r)},extent:function(s){return arguments.length?(n=+s[0][0],i=+s[0][1],a=+s[1][0],o=+s[1][1],t=e=null,r):[[n,i],[a,o]]}}}var Ie={sphere:E,point:E,lineStart:function(){Ie.point=Pe,Ie.lineEnd=Le},lineEnd:E,polygonStart:E,polygonEnd:E};function Le(){Ie.point=Ie.lineEnd=E}function Pe(t,e){Te=t*=h,ke=b(e*=h),Ae=m(e),Ie.point=ze}function ze(t,e){t*=h;var r=b(e*=h),n=m(e),i=f(t-Te),a=m(i),o=n*b(i),s=Ae*r-ke*n*a,l=ke*r+Ae*n*a;we.add(d(T(o*o+s*s),l)),Te=t,ke=r,Ae=n}function De(t){return we=new n.ph,D(t,Ie),+we}var Oe=[null,null],Re={type:"LineString",coordinates:Oe};function Fe(t,e){return Oe[0]=t,Oe[1]=e,De(Re)}var je={Feature:function(t,e){return Ne(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n0&&(i=Fe(t[o],t[o-1]))>0&&r<=i&&n<=i&&(r+n-i)*(1-Math.pow((r-n)/i,2))i})).map(c)).concat((0,We.A)(g(o/m)*m,a,m).filter((function(t){return f(t%v)>i})).map(u))}return _.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},_.outline=function(){return{type:"Polygon",coordinates:[h(n).concat(p(s).slice(1),h(r).reverse().slice(1),p(l).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.extentMajor(t).extentMinor(t):_.extentMinor()},_.extentMajor=function(t){return arguments.length?(n=+t[0][0],r=+t[1][0],l=+t[0][1],s=+t[1][1],n>r&&(t=n,n=r,r=t),l>s&&(t=l,l=s,s=t),_.precision(x)):[[n,l],[r,s]]},_.extentMinor=function(r){return arguments.length?(e=+r[0][0],t=+r[1][0],o=+r[0][1],a=+r[1][1],e>t&&(r=e,e=t,t=r),o>a&&(r=o,o=a,a=r),_.precision(x)):[[e,o],[t,a]]},_.step=function(t){return arguments.length?_.stepMajor(t).stepMinor(t):_.stepMinor()},_.stepMajor=function(t){return arguments.length?(y=+t[0],v=+t[1],_):[y,v]},_.stepMinor=function(t){return arguments.length?(d=+t[0],m=+t[1],_):[d,m]},_.precision=function(i){return arguments.length?(x=+i,c=Ye(o,a,90),u=Xe(e,t,x),h=Ye(l,s,90),p=Xe(n,r,x),_):x},_.extentMajor([[-180,-90+i],[180,90-i]]).extentMinor([[-180,-80-i],[180,80+i]])}function Ke(){return $e()()}function Je(t,e){var r=t[0]*h,n=t[1]*h,i=e[0]*h,a=e[1]*h,o=m(n),s=b(n),l=m(a),c=b(a),f=o*m(r),p=o*b(r),g=l*m(i),y=l*b(i),v=2*M(T(S(a-n)+o*l*S(i-r))),x=b(v),_=v?function(t){var e=b(t*=v)/x,r=b(v-t)/x,n=r*f+e*g,i=r*p+e*y,a=r*s+e*c;return[d(i,n)*u,d(a,T(n*n+i*i))*u]}:function(){return[r*u,n*u]};return _.distance=v,_}const Qe=t=>t;var tr,er,rr,nr,ir=new n.ph,ar=new n.ph,or={point:E,lineStart:E,lineEnd:E,polygonStart:function(){or.lineStart=sr,or.lineEnd=ur},polygonEnd:function(){or.lineStart=or.lineEnd=or.point=E,ir.add(f(ar)),ar=new n.ph},result:function(){var t=ir/2;return ir=new n.ph,t}};function sr(){or.point=lr}function lr(t,e){or.point=cr,tr=rr=t,er=nr=e}function cr(t,e){ar.add(nr*t-rr*e),rr=t,nr=e}function ur(){cr(tr,er)}const hr=or;var fr=1/0,pr=fr,dr=-fr,mr=dr,gr={point:function(t,e){tdr&&(dr=t);emr&&(mr=e)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E,result:function(){var t=[[fr,pr],[dr,mr]];return dr=mr=-(pr=fr=1/0),t}};const yr=gr;var vr,xr,_r,br,wr=0,Tr=0,kr=0,Ar=0,Mr=0,Sr=0,Er=0,Cr=0,Ir=0,Lr={point:Pr,lineStart:zr,lineEnd:Rr,polygonStart:function(){Lr.lineStart=Fr,Lr.lineEnd=jr},polygonEnd:function(){Lr.point=Pr,Lr.lineStart=zr,Lr.lineEnd=Rr},result:function(){var t=Ir?[Er/Ir,Cr/Ir]:Sr?[Ar/Sr,Mr/Sr]:kr?[wr/kr,Tr/kr]:[NaN,NaN];return wr=Tr=kr=Ar=Mr=Sr=Er=Cr=Ir=0,t}};function Pr(t,e){wr+=t,Tr+=e,++kr}function zr(){Lr.point=Dr}function Dr(t,e){Lr.point=Or,Pr(_r=t,br=e)}function Or(t,e){var r=t-_r,n=e-br,i=T(r*r+n*n);Ar+=i*(_r+t)/2,Mr+=i*(br+e)/2,Sr+=i,Pr(_r=t,br=e)}function Rr(){Lr.point=Pr}function Fr(){Lr.point=Br}function jr(){Nr(vr,xr)}function Br(t,e){Lr.point=Nr,Pr(vr=_r=t,xr=br=e)}function Nr(t,e){var r=t-_r,n=e-br,i=T(r*r+n*n);Ar+=i*(_r+t)/2,Mr+=i*(br+e)/2,Sr+=i,Er+=(i=br*t-_r*e)*(_r+t),Cr+=i*(br+e),Ir+=3*i,Pr(_r=t,br=e)}const Ur=Lr;function Vr(t){this._context=t}Vr.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,c)}},result:E};var qr,Hr,Gr,Zr,Wr,Yr=new n.ph,Xr={point:E,lineStart:function(){Xr.point=$r},lineEnd:function(){qr&&Kr(Hr,Gr),Xr.point=E},polygonStart:function(){qr=!0},polygonEnd:function(){qr=null},result:function(){var t=+Yr;return Yr=new n.ph,t}};function $r(t,e){Xr.point=Kr,Hr=Zr=t,Gr=Wr=e}function Kr(t,e){Zr-=t,Wr-=e,Yr.add(T(Zr*Zr+Wr*Wr)),Zr=t,Wr=e}const Jr=Xr;let Qr,tn,en,rn;class nn{constructor(t){this._append=null==t?an:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return an;if(e!==Qr){const t=10**e;Qr=e,tn=function(e){let r=1;this._+=e[0];for(const n=e.length;r=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(n=new nn(i)),o},o.projection(t).digits(i).context(e)}function sn(t){return{stream:ln(t)}}function ln(t){return function(e){var r=new cn;for(var n in t)r[n]=t[n];return r.stream=e,r}}function cn(){}function un(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),D(r,t.stream(yr)),e(yr.result()),null!=n&&t.clipExtent(n),t}function hn(t,e,r){return un(t,(function(r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(n/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),o=+e[0][0]+(n-a*(r[1][0]+r[0][0]))/2,s=+e[0][1]+(i-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([o,s])}),r)}function fn(t,e,r){return hn(t,[[0,0],e],r)}function pn(t,e,r){return un(t,(function(r){var n=+e,i=n/(r[1][0]-r[0][0]),a=(n-i*(r[1][0]+r[0][0]))/2,o=-i*r[0][1];t.scale(150*i).translate([a,o])}),r)}function dn(t,e,r){return un(t,(function(r){var n=+e,i=n/(r[1][1]-r[0][1]),a=-i*r[0][0],o=(n-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([a,o])}),r)}cn.prototype={constructor:cn,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var mn=16,gn=m(30*h);function yn(t,e){return+e?function(t,e){function r(n,a,o,s,l,c,u,h,p,m,g,y,v,x){var _=u-n,b=h-a,w=_*_+b*b;if(w>4*e&&v--){var k=s+m,A=l+g,S=c+y,E=T(k*k+A*A+S*S),C=M(S/=E),I=f(f(S)-1)e||f((_*D+b*O)/w-.5)>.3||s*m+l*g+c*y2?t[2]%360*h:0,P()):[v*u,x*u,_*u]},I.angle=function(t){return arguments.length?(b=t%360*h,P()):b*u},I.reflectX=function(t){return arguments.length?(w=t?-1:1,P()):w<0},I.reflectY=function(t){return arguments.length?(k=t?-1:1,P()):k<0},I.precision=function(t){return arguments.length?(o=yn(s,C=t*t),z()):T(C)},I.fitExtent=function(t,e){return hn(I,t,e)},I.fitSize=function(t,e){return fn(I,t,e)},I.fitWidth=function(t,e){return pn(I,t,e)},I.fitHeight=function(t,e){return dn(I,t,e)},function(){return e=t.apply(this,arguments),I.invert=e.invert&&L,P()}}function wn(t){var e=0,r=o/3,n=bn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*h,r=t[1]*h):[e*u,r*u]},i}function Tn(t,e){var r=b(t),n=(r+b(e))/2;if(f(n)=.12&&i<.234&&n>=-.425&&n<-.214?l:i>=.166&&i<.234&&n>=-.214&&n<-.115?c:s).invert(t)},h.stream=function(r){return t&&e===r?t:(n=[s.stream(e=r),l.stream(r),c.stream(r)],i=n.length,t={point:function(t,e){for(var r=-1;++r0?e<-s+i&&(e=-s+i):e>s-i&&(e=s-i);var r=a/_(Rn(e),n);return[r*b(n*t),a-r*m(n*t)]}return l.invert=function(t,e){var r=a-e,i=w(n)*T(t*t+r*r),l=d(t,f(r))*w(r);return r*n<0&&(l-=o*w(t)*w(r)),[l/n,2*p(_(a/i,1/n))-s]},l}function jn(){return wn(Fn).scale(109.5).parallels([30,30])}function Bn(t,e){return[t,e]}function Nn(){return _n(Bn).scale(152.63)}function Un(t,e){var r=m(t),n=t===e?b(t):(r-m(e))/(e-t),a=r/n+t;if(f(n)2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90]).scale(159.155)}Yn.invert=function(t,e){for(var r,n=e,i=n*n,o=i*i*i,s=0;s<12&&(o=(i=(n-=r=(n*(qn+Hn*i+o*(Gn+Zn*i))-e)/(qn+3*Hn*i+o*(7*Gn+9*Zn*i)))*n)*i*i,!(f(r)i&&--a>0);return[t/(.8707+(o=n*n)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),n]},ei.invert=En(M),ni.invert=En((function(t){return 2*p(t)})),ai.invert=function(t,e){return[-e,2*p(y(t))-s]}},66:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Path:()=>n.wA,path:()=>n.Ae,pathRound:()=>n.uj});var n=r(83)},83:(t,e,r)=>{"use strict";r.d(e,{Ae:()=>c,uj:()=>u,wA:()=>l});const n=Math.PI,i=2*n,a=1e-6,o=i-a;function s(t){this._+=t[0];for(let e=1,r=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return s;const r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;ea)if(Math.abs(f*c-u*h)>a&&o){let d=r-s,m=i-l,g=c*c+u*u,y=d*d+m*m,v=Math.sqrt(g),x=Math.sqrt(p),_=o*Math.tan((n-Math.acos((g+p-y)/(2*v*x)))/2),b=_/x,w=_/v;Math.abs(b-1)>a&&this._append`L${t+b*h},${e+b*f}`,this._append`A${o},${o},0,0,${+(f*d>h*m)},${this._x1=t+w*c},${this._y1=e+w*u}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,r,s,l,c){if(t=+t,e=+e,c=!!c,(r=+r)<0)throw new Error(`negative radius: ${r}`);let u=r*Math.cos(s),h=r*Math.sin(s),f=t+u,p=e+h,d=1^c,m=c?s-l:l-s;null===this._x1?this._append`M${f},${p}`:(Math.abs(this._x1-f)>a||Math.abs(this._y1-p)>a)&&this._append`L${f},${p}`,r&&(m<0&&(m=m%i+i),m>o?this._append`A${r},${r},0,1,${d},${t-u},${e-h}A${r},${r},0,1,${d},${this._x1=f},${this._y1=p}`:m>a&&this._append`A${r},${r},0,${+(m>=n)},${d},${this._x1=t+r*Math.cos(l)},${this._y1=e+r*Math.sin(l)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function c(){return new l}function u(t=3){return new l(+t)}c.prototype=l.prototype},395:(t,e,r)=>{"use strict";function n(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var i,a,o,s,l,c,u,h,f,p=t._root,d={data:n},m=t._x0,g=t._y0,y=t._x1,v=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((c=e>=(a=(m+y)/2))?m=a:y=a,(u=r>=(o=(g+v)/2))?g=o:v=o,i=p,!(p=p[h=u<<1|c]))return i[h]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,i?i[h]=d:t._root=d,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(a=(m+y)/2))?m=a:y=a,(u=r>=(o=(g+v)/2))?g=o:v=o}while((h=u<<1|c)==(f=(l>=o)<<1|s>=a));return i[f]=p,i[h]=d,t}function i(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i}function a(t){return t[0]}function o(t){return t[1]}function s(t,e,r){var n=new l(null==e?a:e,null==r?o:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function l(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function c(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}r.r(e),r.d(e,{quadtree:()=>s});var u=s.prototype=l.prototype;u.copy=function(){var t,e,r=new l(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=c(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=c(e));return r},u.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return n(this.cover(e,r),e,r,t)},u.addAll=function(t){var e,r,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,h=-1/0,f=-1/0;for(r=0;rh&&(h=i),af&&(f=a));if(c>h||u>f)return this;for(this.cover(c,u).cover(h,f),r=0;rt||t>=i||n>e||e>=a;)switch(s=(ep||(o=c.y0)>d||(s=c.x1)=v)<<1|t>=y)&&(c=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=c)}else{var x=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),b=x*x+_*_;if(b=(s=(d+g)/2))?d=s:g=s,(u=o>=(l=(m+y)/2))?m=l:y=l,e=p,!(p=p[h=u<<1|c]))return this;if(!p.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[f]=p:this._root=p),this):(this._root=i,this)},u.removeAll=function(t){for(var e=0,r=t.length;e{"use strict";function n(t){return function(){return t}}r.r(e),r.d(e,{arc:()=>k,area:()=>P,areaRadial:()=>U,curveBasis:()=>Lt,curveBasisClosed:()=>zt,curveBasisOpen:()=>Ot,curveBumpX:()=>G,curveBumpY:()=>Z,curveBundle:()=>Ft,curveCardinal:()=>Nt,curveCardinalClosed:()=>Vt,curveCardinalOpen:()=>Ht,curveCatmullRom:()=>Wt,curveCatmullRomClosed:()=>Xt,curveCatmullRomOpen:()=>Kt,curveLinear:()=>E,curveLinearClosed:()=>Qt,curveMonotoneX:()=>se,curveMonotoneY:()=>le,curveNatural:()=>he,curveStep:()=>pe,curveStepAfter:()=>me,curveStepBefore:()=>de,line:()=>L,lineRadial:()=>N,link:()=>$,linkHorizontal:()=>K,linkRadial:()=>Q,linkVertical:()=>J,pie:()=>O,pointRadial:()=>V,radialArea:()=>U,radialLine:()=>N,stack:()=>_e,stackOffsetDiverging:()=>we,stackOffsetExpand:()=>be,stackOffsetNone:()=>ge,stackOffsetSilhouette:()=>Te,stackOffsetWiggle:()=>ke,stackOrderAppearance:()=>Ae,stackOrderAscending:()=>Se,stackOrderDescending:()=>Ce,stackOrderInsideOut:()=>Ie,stackOrderNone:()=>ye,stackOrderReverse:()=>Le,symbol:()=>St,symbolAsterisk:()=>et,symbolCircle:()=>rt,symbolCross:()=>nt,symbolDiamond:()=>ot,symbolDiamond2:()=>st,symbolPlus:()=>lt,symbolSquare:()=>ct,symbolSquare2:()=>ut,symbolStar:()=>dt,symbolTimes:()=>kt,symbolTriangle:()=>gt,symbolTriangle2:()=>vt,symbolWye:()=>Tt,symbolX:()=>kt,symbols:()=>At,symbolsFill:()=>At,symbolsStroke:()=>Mt});const i=Math.abs,a=Math.atan2,o=Math.cos,s=Math.max,l=Math.min,c=Math.sin,u=Math.sqrt,h=1e-12,f=Math.PI,p=f/2,d=2*f;function m(t){return t>=1?p:t<=-1?-p:Math.asin(t)}var g=r(83);function y(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{const t=Math.floor(r);if(!(t>=0))throw new RangeError(`invalid digits: ${r}`);e=t}return t},()=>new g.wA(e)}function v(t){return t.innerRadius}function x(t){return t.outerRadius}function _(t){return t.startAngle}function b(t){return t.endAngle}function w(t){return t&&t.padAngle}function T(t,e,r,n,i,a,o){var l=t-r,c=e-n,h=(o?a:-a)/u(l*l+c*c),f=h*c,p=-h*l,d=t+f,m=e+p,g=r+f,y=n+p,v=(d+g)/2,x=(m+y)/2,_=g-d,b=y-m,w=_*_+b*b,T=i-a,k=d*y-g*m,A=(b<0?-1:1)*u(s(0,T*T*w-k*k)),M=(k*b-_*A)/w,S=(-k*_-b*A)/w,E=(k*b+_*A)/w,C=(-k*_+b*A)/w,I=M-v,L=S-x,P=E-v,z=C-x;return I*I+L*L>P*P+z*z&&(M=E,S=C),{cx:M,cy:S,x01:-f,y01:-p,x11:M*(i/T-1),y11:S*(i/T-1)}}function k(){var t=v,e=x,r=n(0),s=null,g=_,k=b,A=w,M=null,S=y(E);function E(){var n,y,v,x=+t.apply(this,arguments),_=+e.apply(this,arguments),b=g.apply(this,arguments)-p,w=k.apply(this,arguments)-p,E=i(w-b),C=w>b;if(M||(M=n=S()),_h)if(E>d-h)M.moveTo(_*o(b),_*c(b)),M.arc(0,0,_,b,w,!C),x>h&&(M.moveTo(x*o(w),x*c(w)),M.arc(0,0,x,w,b,C));else{var I,L,P=b,z=w,D=b,O=w,R=E,F=E,j=A.apply(this,arguments)/2,B=j>h&&(s?+s.apply(this,arguments):u(x*x+_*_)),N=l(i(_-x)/2,+r.apply(this,arguments)),U=N,V=N;if(B>h){var q=m(B/x*c(j)),H=m(B/_*c(j));(R-=2*q)>h?(D+=q*=C?1:-1,O-=q):(R=0,D=O=(b+w)/2),(F-=2*H)>h?(P+=H*=C?1:-1,z-=H):(F=0,P=z=(b+w)/2)}var G=_*o(P),Z=_*c(P),W=x*o(O),Y=x*c(O);if(N>h){var X,$=_*o(z),K=_*c(z),J=x*o(D),Q=x*c(D);if(E1?0:v<-1?f:Math.acos(v))/2),at=u(X[0]*X[0]+X[1]*X[1]);U=l(N,(x-at)/(it-1)),V=l(N,(_-at)/(it+1))}else U=V=0}F>h?V>h?(I=T(J,Q,G,Z,_,V,C),L=T($,K,W,Y,_,V,C),M.moveTo(I.cx+I.x01,I.cy+I.y01),Vh&&R>h?U>h?(I=T(W,Y,$,K,x,-U,C),L=T(G,Z,J,Q,x,-U,C),M.lineTo(I.cx+I.x01,I.cy+I.y01),U=h;--f)l.point(y[f],v[f]);l.lineEnd(),l.areaEnd()}g&&(y[u]=+t(p,u,n),v[u]=+e(p,u,n),l.point(i?+i(p,u,n):y[u],r?+r(p,u,n):v[u]))}if(d)return l=null,d+""||null}function h(){return L().defined(a).curve(s).context(o)}return t="function"==typeof t?t:void 0===t?C:n(+t),e="function"==typeof e?e:n(void 0===e?0:+e),r="function"==typeof r?r:void 0===r?I:n(+r),u.x=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),i=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),u):t},u.x1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:n(+t),u):i},u.y=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),r=null,u):e},u.y0=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),u):e},u.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:n(+t),u):r},u.lineX0=u.lineY0=function(){return h().x(t).y(e)},u.lineY1=function(){return h().x(t).y(r)},u.lineX1=function(){return h().x(i).y(e)},u.defined=function(t){return arguments.length?(a="function"==typeof t?t:n(!!t),u):a},u.curve=function(t){return arguments.length?(s=t,null!=o&&(l=s(o)),u):s},u.context=function(t){return arguments.length?(null==t?o=l=null:l=s(o=t),u):o},u}function z(t,e){return et?1:e>=t?0:NaN}function D(t){return t}function O(){var t=D,e=z,r=null,i=n(0),a=n(d),o=n(0);function s(n){var s,l,c,u,h,f=(n=M(n)).length,p=0,m=new Array(f),g=new Array(f),y=+i.apply(this,arguments),v=Math.min(d,Math.max(-d,a.apply(this,arguments)-y)),x=Math.min(Math.abs(v)/f,o.apply(this,arguments)),_=x*(v<0?-1:1);for(s=0;s0&&(p+=h);for(null!=e?m.sort((function(t,r){return e(g[t],g[r])})):null!=r&&m.sort((function(t,e){return r(n[t],n[e])})),s=0,c=p?(v-f*_)/p:0;s0?h*c:0)+_,g[l]={data:n[l],index:s,value:h,startAngle:y,endAngle:u,padAngle:x};return g}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,r=null,s):e},s.sort=function(t){return arguments.length?(r=t,e=null,s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),s):a},s.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:n(+t),s):o},s}S.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var R=j(E);function F(t){this._curve=t}function j(t){function e(e){return new F(t(e))}return e._curve=t,e}function B(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(j(t)):e()._curve},t}function N(){return B(L().curve(R))}function U(){var t=P().curve(R),e=t.curve,r=t.lineX0,n=t.lineX1,i=t.lineY0,a=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return B(r())},delete t.lineX0,t.lineEndAngle=function(){return B(n())},delete t.lineX1,t.lineInnerRadius=function(){return B(i())},delete t.lineY0,t.lineOuterRadius=function(){return B(a())},delete t.lineY1,t.curve=function(t){return arguments.length?e(j(t)):e()._curve},t}function V(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}F.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};class q{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}class H{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,e){if(t=+t,e=+e,0===this._point)this._point=1;else{const r=V(this._x0,this._y0),n=V(this._x0,this._y0=(this._y0+e)/2),i=V(t,this._y0),a=V(t,e);this._context.moveTo(...r),this._context.bezierCurveTo(...n,...i,...a)}this._x0=t,this._y0=e}}function G(t){return new q(t,!0)}function Z(t){return new q(t,!1)}function W(t){return new H(t)}function Y(t){return t.source}function X(t){return t.target}function $(t){let e=Y,r=X,i=C,a=I,o=null,s=null,l=y(c);function c(){let n;const c=A.call(arguments),u=e.apply(this,c),h=r.apply(this,c);if(null==o&&(s=t(n=l())),s.lineStart(),c[0]=u,s.point(+i.apply(this,c),+a.apply(this,c)),c[0]=h,s.point(+i.apply(this,c),+a.apply(this,c)),s.lineEnd(),n)return s=null,n+""||null}return c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(r=t,c):r},c.x=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),c):i},c.y=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),c):a},c.context=function(e){return arguments.length?(null==e?o=s=null:s=t(o=e),c):o},c}function K(){return $(G)}function J(){return $(Z)}function Q(){const t=$(W);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const tt=u(3),et={draw(t,e){const r=.59436*u(e+l(e/28,.75)),n=r/2,i=n*tt;t.moveTo(0,r),t.lineTo(0,-r),t.moveTo(-i,-n),t.lineTo(i,n),t.moveTo(-i,n),t.lineTo(i,-n)}},rt={draw(t,e){const r=u(e/f);t.moveTo(r,0),t.arc(0,0,r,0,d)}},nt={draw(t,e){const r=u(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},it=u(1/3),at=2*it,ot={draw(t,e){const r=u(e/at),n=r*it;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},st={draw(t,e){const r=.62625*u(e);t.moveTo(0,-r),t.lineTo(r,0),t.lineTo(0,r),t.lineTo(-r,0),t.closePath()}},lt={draw(t,e){const r=.87559*u(e-l(e/7,2));t.moveTo(-r,0),t.lineTo(r,0),t.moveTo(0,r),t.lineTo(0,-r)}},ct={draw(t,e){const r=u(e),n=-r/2;t.rect(n,n,r,r)}},ut={draw(t,e){const r=.4431*u(e);t.moveTo(r,r),t.lineTo(r,-r),t.lineTo(-r,-r),t.lineTo(-r,r),t.closePath()}},ht=c(f/10)/c(7*f/10),ft=c(d/10)*ht,pt=-o(d/10)*ht,dt={draw(t,e){const r=u(.8908130915292852*e),n=ft*r,i=pt*r;t.moveTo(0,-r),t.lineTo(n,i);for(let e=1;e<5;++e){const a=d*e/5,s=o(a),l=c(a);t.lineTo(l*r,-s*r),t.lineTo(s*n-l*i,l*n+s*i)}t.closePath()}},mt=u(3),gt={draw(t,e){const r=-u(e/(3*mt));t.moveTo(0,2*r),t.lineTo(-mt*r,-r),t.lineTo(mt*r,-r),t.closePath()}},yt=u(3),vt={draw(t,e){const r=.6824*u(e),n=r/2,i=r*yt/2;t.moveTo(0,-r),t.lineTo(i,n),t.lineTo(-i,n),t.closePath()}},xt=-.5,_t=u(3)/2,bt=1/u(12),wt=3*(bt/2+1),Tt={draw(t,e){const r=u(e/wt),n=r/2,i=r*bt,a=n,o=r*bt+r,s=-a,l=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(s,l),t.lineTo(xt*n-_t*i,_t*n+xt*i),t.lineTo(xt*a-_t*o,_t*a+xt*o),t.lineTo(xt*s-_t*l,_t*s+xt*l),t.lineTo(xt*n+_t*i,xt*i-_t*n),t.lineTo(xt*a+_t*o,xt*o-_t*a),t.lineTo(xt*s+_t*l,xt*l-_t*s),t.closePath()}},kt={draw(t,e){const r=.6189*u(e-l(e/6,1.7));t.moveTo(-r,-r),t.lineTo(r,r),t.moveTo(-r,r),t.lineTo(r,-r)}},At=[rt,nt,ot,ct,dt,gt,Tt],Mt=[rt,lt,kt,vt,et,ut,st];function St(t,e){let r=null,i=y(a);function a(){let n;if(r||(r=n=i()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),n)return r=null,n+""||null}return t="function"==typeof t?t:n(t||rt),e="function"==typeof e?e:n(void 0===e?64:+e),a.type=function(e){return arguments.length?(t="function"==typeof e?e:n(e),a):t},a.size=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),a):e},a.context=function(t){return arguments.length?(r=null==t?null:t,a):r},a}function Et(){}function Ct(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function It(t){this._context=t}function Lt(t){return new It(t)}function Pt(t){this._context=t}function zt(t){return new Pt(t)}function Dt(t){this._context=t}function Ot(t){return new Dt(t)}function Rt(t,e){this._basis=new It(t),this._beta=e}It.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Pt.prototype={areaStart:Et,areaEnd:Et,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Rt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n,i=t[0],a=e[0],o=t[r]-i,s=e[r]-a,l=-1;++l<=r;)n=l/r,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+n*o),this._beta*e[l]+(1-this._beta)*(a+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const Ft=function t(e){function r(t){return 1===e?new It(t):new Rt(t,e)}return r.beta=function(e){return t(+e)},r}(.85);function jt(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function Bt(t,e){this._context=t,this._k=(1-e)/6}Bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:jt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:jt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Nt=function t(e){function r(t){return new Bt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function Ut(t,e){this._context=t,this._k=(1-e)/6}Ut.prototype={areaStart:Et,areaEnd:Et,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:jt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Vt=function t(e){function r(t){return new Ut(t,e)}return r.tension=function(e){return t(+e)},r}(0);function qt(t,e){this._context=t,this._k=(1-e)/6}qt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:jt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ht=function t(e){function r(t){return new qt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function Gt(t,e,r){var n=t._x1,i=t._y1,a=t._x2,o=t._y2;if(t._l01_a>h){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>h){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,a,o,t._x2,t._y2)}function Zt(t,e){this._context=t,this._alpha=e}Zt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Gt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Wt=function t(e){function r(t){return e?new Zt(t,e):new Bt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Yt(t,e){this._context=t,this._alpha=e}Yt.prototype={areaStart:Et,areaEnd:Et,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Gt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Xt=function t(e){function r(t){return e?new Yt(t,e):new Ut(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function $t(t,e){this._context=t,this._alpha=e}$t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Gt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Kt=function t(e){function r(t){return e?new $t(t,e):new qt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Jt(t){this._context=t}function Qt(t){return new Jt(t)}function te(t){return t<0?-1:1}function ee(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(te(a)+te(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function re(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function ne(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,i+s*e,a-s,o-s*r,a,o)}function ie(t){this._context=t}function ae(t){this._context=new oe(t)}function oe(t){this._context=t}function se(t){return new ie(t)}function le(t){return new ae(t)}function ce(t){this._context=t}function ue(t){var e,r,n=t.length-1,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[n-1]=(t[n]+i[n-1])/2,e=0;e1)for(var r,n,i,a=1,o=t[e[0]],s=o.length;a=0;)r[e]=e;return r}function ve(t,e){return t[e]}function xe(t){const e=[];return e.key=t,e}function _e(){var t=n([]),e=ye,r=ge,i=ve;function a(n){var a,o,s=Array.from(t.apply(this,arguments),xe),l=s.length,c=-1;for(const t of n)for(a=0,++c;a0){for(var r,n,i,a=0,o=t[0].length;a0)for(var r,n,i,a,o,s,l=0,c=t[e[0]].length;l0?(n[0]=a,n[1]=a+=i):i<0?(n[1]=o,n[0]=o+=i):(n[0]=0,n[1]=i)}function Te(t,e){if((r=t.length)>0){for(var r,n=0,i=t[e[0]],a=i.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,i,a=0,o=1;oa&&(a=e,n=r);return n}function Se(t){var e=t.map(Ee);return ye(t).sort((function(t,r){return e[t]-e[r]}))}function Ee(t){for(var e,r=0,n=-1,i=t.length;++n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}}},552:(t,e,r)=>{"use strict";r.r(e),r.d(e,{timeDay:()=>A,timeDays:()=>M,timeFriday:()=>F,timeFridays:()=>H,timeHour:()=>b,timeHours:()=>w,timeInterval:()=>a,timeMillisecond:()=>o,timeMilliseconds:()=>s,timeMinute:()=>y,timeMinutes:()=>v,timeMonday:()=>z,timeMondays:()=>N,timeMonth:()=>st,timeMonths:()=>lt,timeSaturday:()=>j,timeSaturdays:()=>G,timeSecond:()=>m,timeSeconds:()=>g,timeSunday:()=>P,timeSundays:()=>B,timeThursday:()=>R,timeThursdays:()=>q,timeTickInterval:()=>bt,timeTicks:()=>_t,timeTuesday:()=>D,timeTuesdays:()=>U,timeWednesday:()=>O,timeWednesdays:()=>V,timeWeek:()=>P,timeWeeks:()=>B,timeYear:()=>ht,timeYears:()=>ft,unixDay:()=>C,unixDays:()=>I,utcDay:()=>S,utcDays:()=>E,utcFriday:()=>J,utcFridays:()=>at,utcHour:()=>T,utcHours:()=>k,utcMillisecond:()=>o,utcMilliseconds:()=>s,utcMinute:()=>x,utcMinutes:()=>_,utcMonday:()=>Y,utcMondays:()=>et,utcMonth:()=>ct,utcMonths:()=>ut,utcSaturday:()=>Q,utcSaturdays:()=>ot,utcSecond:()=>m,utcSeconds:()=>g,utcSunday:()=>W,utcSundays:()=>tt,utcThursday:()=>K,utcThursdays:()=>it,utcTickInterval:()=>xt,utcTicks:()=>vt,utcTuesday:()=>X,utcTuesdays:()=>rt,utcWednesday:()=>$,utcWednesdays:()=>nt,utcWeek:()=>W,utcWeeks:()=>tt,utcYear:()=>pt,utcYears:()=>dt});const n=new Date,i=new Date;function a(t,e,r,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=e=>(t(e=new Date(+e)),e),s.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),s.round=t=>{const e=s(t),r=s.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),s.range=(r,n,i)=>{const a=[];if(r=s.ceil(r),i=null==i?1:Math.floor(i),!(r0))return a;let o;do{a.push(o=new Date(+r)),e(r,i),t(r)}while(oa((e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)}),((t,n)=>{if(t>=t)if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););})),r&&(s.count=(e,a)=>(n.setTime(+e),i.setTime(+a),t(n),t(i),Math.floor(r(n,i))),s.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?e=>o(e)%t==0:e=>s.count(0,e)%t==0):s:null)),s}const o=a((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));o.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?a((e=>{e.setTime(Math.floor(e/t)*t)}),((e,r)=>{e.setTime(+e+r*t)}),((e,r)=>(r-e)/t)):o:null);const s=o.range,l=1e3,c=6e4,u=36e5,h=864e5,f=6048e5,p=2592e6,d=31536e6,m=a((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*l)}),((t,e)=>(e-t)/l),(t=>t.getUTCSeconds())),g=m.range,y=a((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*l)}),((t,e)=>{t.setTime(+t+e*c)}),((t,e)=>(e-t)/c),(t=>t.getMinutes())),v=y.range,x=a((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*c)}),((t,e)=>(e-t)/c),(t=>t.getUTCMinutes())),_=x.range,b=a((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*l-t.getMinutes()*c)}),((t,e)=>{t.setTime(+t+e*u)}),((t,e)=>(e-t)/u),(t=>t.getHours())),w=b.range,T=a((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*u)}),((t,e)=>(e-t)/u),(t=>t.getUTCHours())),k=T.range,A=a((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*c)/h),(t=>t.getDate()-1)),M=A.range,S=a((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/h),(t=>t.getUTCDate()-1)),E=S.range,C=a((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/h),(t=>Math.floor(t/h))),I=C.range;function L(t){return a((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*c)/f))}const P=L(0),z=L(1),D=L(2),O=L(3),R=L(4),F=L(5),j=L(6),B=P.range,N=z.range,U=D.range,V=O.range,q=R.range,H=F.range,G=j.range;function Z(t){return a((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/f))}const W=Z(0),Y=Z(1),X=Z(2),$=Z(3),K=Z(4),J=Z(5),Q=Z(6),tt=W.range,et=Y.range,rt=X.range,nt=$.range,it=K.range,at=J.range,ot=Q.range,st=a((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth())),lt=st.range,ct=a((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),ut=ct.range,ht=a((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));ht.every=t=>isFinite(t=Math.floor(t))&&t>0?a((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,r)=>{e.setFullYear(e.getFullYear()+r*t)})):null;const ft=ht.range,pt=a((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));pt.every=t=>isFinite(t=Math.floor(t))&&t>0?a((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null;const dt=pt.range;var mt=r(37),gt=r(946);function yt(t,e,r,n,i,a){const s=[[m,1,l],[m,5,5e3],[m,15,15e3],[m,30,3e4],[a,1,c],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,u],[i,3,108e5],[i,6,216e5],[i,12,432e5],[n,1,h],[n,2,1728e5],[r,1,f],[e,1,p],[e,3,7776e6],[t,1,d]];function g(e,r,n){const i=Math.abs(r-e)/n,a=(0,mt.A)((([,,t])=>t)).right(s,i);if(a===s.length)return t.every((0,gt.sG)(e/d,r/d,n));if(0===a)return o.every(Math.max((0,gt.sG)(e,r,n),1));const[l,c]=s[i/s[a-1][2]{"use strict";r.r(e),r.d(e,{interval:()=>w,now:()=>p,timeout:()=>b,timer:()=>g,timerFlush:()=>y});var n,i,a=0,o=0,s=0,l=0,c=0,u=0,h="object"==typeof performance&&performance.now?performance:Date,f="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return c||(f(d),c=h.now()+u)}function d(){c=0}function m(){this._call=this._time=this._next=null}function g(t,e,r){var n=new m;return n.restart(t,e,r),n}function y(){p(),++a;for(var t,e=n;e;)(t=c-e._time)>=0&&e._call.call(void 0,t),e=e._next;--a}function v(){c=(l=h.now())+u,a=o=0;try{y()}finally{a=0,function(){var t,e,r=n,a=1/0;for(;r;)r._call?(a>r._time&&(a=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:n=e);i=t,_(a)}(),c=0}}function x(){var t=h.now(),e=t-l;e>1e3&&(u-=e,l=t)}function _(t){a||(o&&(o=clearTimeout(o)),t-c>24?(t<1/0&&(o=setTimeout(v,t-h.now()-u)),s&&(s=clearInterval(s))):(s||(l=h.now(),s=setInterval(x,1e3)),a=1,f(v)))}function b(t,e,r){var n=new m;return e=null==e?0:+e,n.restart((r=>{n.stop(),t(r+e)}),e,r),n}function w(t,e,r){var n=new m,i=e;return null==e?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?p():+r,n._restart((function a(o){o+=i,n._restart(a,i+=e,r),t(o)}),e,r)},n.restart(t,e,r),n)}m.prototype=g.prototype={constructor:m,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?p():+r)+(null==e?0:+e),this._next||i===this||(i?i._next=this:n=this,i=this),this._call=t,this._time=r,_()},stop:function(){this._call&&(this._call=null,this._time=1/0,_())}}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t=r(647),e=r.n(t),n=r(453),i=r.n(n),a=r(653),o=r.n(a);function s(t,e){let r;return function(...n){const i=this;clearTimeout(r),r=setTimeout((()=>t.apply(i,n)),e)}}function l(t){return Math.round(t.getTime()/1e3)}function c(t){return new Date(1e3*t)}function u(t,e){const r=document.getElementById("notifications"),n=document.getElementById("notification-template").content.cloneNode(!0).firstElementChild,i=n.querySelector(".btn-close");let a="";"info"===t?(n.classList.add("bg-primary","text-white"),i.classList.add("btn-close-white"),a="fa-circle-info"):"success"===t?(n.classList.add("bg-success","text-white"),i.classList.add("btn-close-white"),a="fa-circle-check"):"warning"===t?(n.classList.add("bg-warning","text-body"),a="fa-circle-exclamation"):"error"===t?(n.classList.add("bg-danger","text-white"),i.classList.add("btn-close-white"),a="fa-circle-exclamation"):(n.classList.add("bg-secondary","text-white"),i.classList.add("btn-close-white"),a="fa-comment"),n.querySelector(".toast-body").innerHTML=` `+e,r.appendChild(n);new(o())(n,{autohide:!0,delay:1e4}).show(),n.addEventListener("hidden.bs.toast",(()=>{n.remove()}))}const h="varnishmon.",f=`${h}time-range-from`,p=`${h}time-range-to`,d=["now-1h","now"];function m(t=!1){if(!t){const t=g(f),e=g(p);if(null!=t&&null!=e)return[t,e]}return varnishmon.config.scraper.enabled?d:[c(varnishmon.storage.earliest),c(varnishmon.storage.latest)]}function g(t){try{let e=localStorage.getItem(t);if(null!=e)return e}catch(e){console.error(`Failed to read '${t}' from local storage!`,e)}return null}function y(t,e){e instanceof Date&&(e=e.toISOString());try{localStorage.setItem(t,e)}catch(e){console.error(`Failed to write '${t}' to local storage!`,e)}}const v=`${h}refresh-interval`,x=[[-1,"auto"],[0,"disabled"],[1,"1s"],[2,"2s"],[3,"3s"],[4,"4s"],[5,"5s"],[10,"10s"],[15,"15s"],[30,"30s"],[60,"1m"]];function _(t){return Number.isInteger(t)&&x.map((t=>t[0])).includes(t)}const b=`${h}filter`,w=`${h}filter-history`;function T(){try{let t=localStorage.getItem(w);if(null!=t)return JSON.parse(t)}catch(t){console.error(`Failed to read '${w}' from local storage!`,t)}return[]}const k=`${h}verbosity`,A=["normal","debug"];function M(t){return A.includes(t)}const S=`${h}columns`,E=[1,2,3,4,6,12];function C(t){return Number.isInteger(t)&&E.includes(t)}const I=`${h}aggregator`,L=["avg","min","max","first","last","count"];function P(t){return L.includes(t)}const z=`${h}step`;function D(t){return Number.isInteger(t)&&t>=varnishmon.config.scraper.period}const O=[/^MGT[.](?!(?:uptime)$)/,new RegExp("MAIN[.](?!(?:"+["backend_busy","backend_conn","backend_fail","backend_recycle","backend_req","backend_retry","backend_reuse","backend_unhealthy","backend_wait_fail","backend_wait","bans_lurker_obj_killed_cutoff","bans_lurker_obj_killed","bans_obj_killed","bans","bgfetch_no_thread","busy_killed","busy_sleep","busy_wakeup","c_ykey_purges","cache_hit_grace","cache_hit","cache_hitmiss","cache_hitpass","cache_miss","client_req_400","client_req_417","client_req","client_resp_500","esi_errors","esi_maxdepth","esi_req","esi_warnings","fetch_1xx","fetch_204","fetch_304","fetch_bad","fetch_chunked","fetch_eof","fetch_failed","fetch_fast304","fetch_head","fetch_length","fetch_none","fetch_stale_deliver","fetch_stale_rearm","g_mem_file","g_mem_private","g_mem_rss","g_mem_swap","goto_dns_cache_hits","goto_dns_lookup_fails","goto_dns_lookups","losthdr","n_backend","n_expired","n_gunzip","n_gzip","n_lru_limited","n_lru_moved","n_lru_nuked","n_obj_purged","n_object_hitmiss","n_object_hitpass","n_object","n_objectcore","n_objecthead","n_purges","n_test_gunzip","n_vcl","req_dropped","req_reset","s_fetch","s_pass","s_pipe_hdrbytes","s_pipe_in","s_pipe_out","s_pipe","s_req_bodybytes","s_req_hdrbytes","s_resp_bodybytes","s_resp_hdrbytes","s_sess","s_synth","sc_bankrupt","sc_rapid_reset","sc_sock_closed","sc_vcl_failure","sess_closed_err","sess_closed","sess_conn","sess_drop","sess_dropped","sess_fail_ebadf","sess_fail_econnaborted","sess_fail_eintr","sess_fail_emfile","sess_fail_enomem","sess_fail_other","sess_fail","sess_herd","sess_queued","sess_readahead","shm_cont","shm_cycles","shm_flushes","shm_records","thread_queue_len","threads_created","threads_destroyed","threads_failed","threads_limited","threads","uptime","vcl_fail","vmods","ws_backend_overflow","ws_client_overflow","ws_session_overflow","ws_thread_overflow"].join("|")+")$)"),new RegExp("MSE[.](?!.*[.](?:"+["c_fail","c_memcache_hit","c_memcache_miss","c_ykey_purged","g_bytes","g_space","g_sparenode","g_ykey_keys","n_lru_moved","n_lru_nuked","n_vary"].join("|")+")$)"),new RegExp("MSE_BOOK[.](?!.*[.](?:"+["c_insert_timeout","c_waterlevel_purge","c_waterlevel_queue","c_waterlevel_runs","g_banlist_bytes","g_banlist_space","g_bytes","g_space","n_vary"].join("|")+")$)"),new RegExp("MSE_STORE[.](?!.*[.](?:"+["c_aio_finished_bytes_read","c_aio_finished_bytes_write","c_aio_finished_read","c_aio_finished_write","c_waterlevel_purge","c_waterlevel_queue","g_alloc_bytes","g_free_bytes","g_objects","g_ykey_keys"].join("|")+")$)"),new RegExp("MSE4[.](?!(?:"+["g_varyspec","g_ykey_keys","c_ykey_purged"].join("|")+")$)"),new RegExp("MSE4_MEM[.](?!(?:"+["c_allocation","c_allocation_buffer","c_allocation_ephemeral","c_allocation_failure","c_allocation_pass","c_allocation_persisted","c_allocation_reqbody","c_allocation_synthetic","c_eviction","c_eviction_failure","c_eviction_reorder","c_free","c_free_buffer","c_free_ephemeral","c_free_pass","c_free_persisted","c_free_reqbody","c_free_synthetic","c_memcache_hit","c_memcache_miss","g_allocations","g_bytes","g_bytes_buffer","g_bytes_ephemeral","g_bytes_pass","g_bytes_persisted","g_bytes_reqbody","g_bytes_synthetic","g_objects","g_objects_ephemeral","g_objects_pass","g_objects_persisted","g_objects_reqbody","g_objects_synthetic","g_space"].join("|")+")$)"),new RegExp("MSE4_BOOK[.](?!.*[.](?:"+["c_freeslot_queued","c_submitslot_queued","c_ykey_purged","g_freeslot_queue","g_objects","g_slots_unused","g_slots_used","g_submitslot_queue","g_unreachable_objects","g_varyspec","g_ykey_keys","online"].join("|")+")$)"),new RegExp("MSE4_STORE[.](?!.*[.](?:"+["online","g_bytes_used","g_bytes_unused","g_objects","g_allocation_queue","c_allocation_queued","g_io_queued","g_io_queued_read","g_io_queued_write","c_io_finished_read","c_io_finished_write","c_io_finished_bytes_read","c_io_finished_bytes_write","g_io_blocked_read","g_io_blocked_write","c_io_limited"].join("|")+")$)"),new RegExp("MSE4_BANJRN[.](?!.*[.](?:"+["g_ban_bytes","g_bans","g_bytes","g_overflow_ban_bytes","g_overflow_bans","g_space"].join("|")+")$)"),new RegExp("MSE4_CAT[.](?!.*[.](?:"+["c_allocation","c_allocation_ephemeral","c_allocation_pass","c_allocation_persisted","c_eviction","c_eviction_failure","c_eviction_reorder","c_free","c_free_ephemeral","c_free_pass","c_free_persisted","c_memcache_hit","c_memcache_miss","g_allocations","g_bytes","g_bytes_ephemeral","g_bytes_pass","g_bytes_persisted","g_objects","g_objects_ephemeral","g_objects_pass","g_objects_persisted"].join("|")+")$)"),new RegExp("SMA[.](?!.*[.](?:"+["c_bytes","c_fail","c_freed","c_req","g_alloc","g_bytes","g_space"].join("|")+")$)"),new RegExp("SMF[.](?!.*[.](?:"+["c_bytes","c_fail","c_freed","c_req","g_alloc","g_bytes","g_smf_frag","g_smf_large","g_smf","g_space"].join("|")+")$)"),new RegExp("SMU[.](?!.*[.](?:"+["c_bytes","c_fail","c_freed","c_req","g_alloc","g_bytes","g_space"].join("|")+")$)"),/^BROTLI[.]/,/^SLICER[.]/,new RegExp("VMOD_HTTP[.](?!(?:"+["handle_abandon","handle_completed","handle_internal_error","handle_limited","handle_requests"].join("|")+")$)"),new RegExp("KVSTORE[.](?!.*[.](?:"+[].join("|")+")$)"),new RegExp("ACCG[.](?!.*[.](?:"+["backend_200_count","backend_2xx_count","backend_304_count","backend_3xx_count","backend_404_count","backend_4xx_count","backend_503_count","backend_5xx_count","backend_req_bodybytes","backend_req_count","backend_req_hdrbytes","backend_resp_bodybytes","backend_resp_hdrbytes","client_200_count","client_2xx_count","client_304_count","client_3xx_count","client_404_count","client_4xx_count","client_503_count","client_5xx_count","client_grace_hit_count","client_hit_count","client_hit_req_bodybytes","client_hit_req_hdrbytes","client_hit_resp_bodybytes","client_hit_resp_hdrbytes","client_miss_count","client_miss_req_bodybytes","client_miss_req_hdrbytes","client_miss_resp_bodybytes","client_miss_resp_hdrbytes","client_pass_count","client_pass_req_bodybytes","client_pass_req_hdrbytes","client_pass_resp_bodybytes","client_pass_resp_hdrbytes","client_pipe_count","client_pipe_req_bodybytes","client_pipe_req_hdrbytes","client_pipe_resp_bodybytes","client_pipe_resp_hdrbytes","client_req_bodybytes","client_req_count","client_req_hdrbytes","client_resp_bodybytes","client_resp_hdrbytes","client_synth_count","client_synth_req_bodybytes","client_synth_req_hdrbytes","client_synth_resp_bodybytes","client_synth_resp_hdrbytes"].join("|")+")$)"),new RegExp("ACCG_DIAG[.](?!.*[.](?:"+["bereq_dropped","create_namespace_failure","key_without_namespace","namespace_already_set","namespace_undefined","out_of_key_slots","req_dropped","set_key_failure"].join("|")+")$)"),new RegExp("VBE[.](?!.*[.](?:"+["bereq_bodybytes","bereq_hdrbytes","beresp_bodybytes","beresp_hdrbytes","busy","conn","fail","happy","is_healthy","pipe_hdrbytes","pipe_in","pipe_out","req","unhealthy"].join("|")+")$)"),/^WAITER[.]/,/^MEMPOOL[.]/,/^LCK[.]/],R=[/^(MAIN[.]backend)/,/^(MAIN[.]bans)_?/,/^(MAIN[.]cache)/,/^(MAIN[.]client)/,/^(MAIN[.]esi_)/,/^(MAIN[.]fetch)/,/^(MAIN[.]g_mem)/,/^(MAIN[.]s_)/,/^(MAIN[.]sc_)/,/^(MAIN[.]sess_)/,/^(MAIN[.]shm_)/,/^(MAIN[.]thread)s?_?/,/^(MAIN[.]vgs_)/,/^(MAIN[.]ws_)/,/^(WAITER[.])/,/^(MEMPOOL[.])/,/^(LCK[.])/],F=[/^MGT[.]/,/^MAIN[.][*]$/,/^MAIN[.]/,/^MSE[.]/,/^MSE_/,/^MSE4[.]/,/^MSE4_/,/^SMA[.]/,/^SMF[.]/,/^SMU[.]/,/^BROTLI[.]/,/^SLICER[.]/,/^VMOD_/,/^KVSTORE[.]/,/^ACCG[.]/,/^ACCG_DIAG[.]/,/^VBE[.]/,/^WAITER[.]/,/^MEMPOOL[.]/,/^LCK[.]/];function j(t){t.sort(((t,e)=>t.name.localeCompare(e.name))),function(t){t.forEach((t=>{t.debug=-1!==O.findIndex((e=>e.test(t.name)))}))}(t);const e=function(t){const e={};return t.forEach((t=>{let r="";for(let e of R){const n=t.name.match(e);if(n&&n[1]){r=n[1]+"*";break}}if(""===r){const e=t.name.split(".");e.length>1&&(r=e.slice(0,-1).join(".")+".*")}e[r]||(e[r]=[]),e[r].push(t)})),Object.keys(e).map((t=>({name:t,metrics:e[t]})))}(t);return e.sort(((t,e)=>{const r=F.findIndex((e=>e.test(t.name))),n=F.findIndex((t=>t.test(e.name)));return-1!==r&&-1!==n?r-n:-1!==r?-1:-1!==n?1:t.name.localeCompare(e.name)})),e}function B(t,e){const r=t.sort(((t,e)=>t[0]-e[0])),n=[];for(let t=0;t{t.forEach((t=>{t.target.chart.handleVisibilityChange(t.isIntersecting)}))}),{threshold:.1}),G=new ResizeObserver((t=>{t.forEach((t=>{t.target.chart.handleSizeChange()}))})),Z={fixedrange:!1,griddash:"dash",autorange:!1,showspikes:!0,spikemode:"across",spikesnap:"cursor",spikedash:"dot",spikethickness:1};const W=class{constructor(t,e,r,n,i,a){this.container=t,this.metric=e,this.rangeFactory=r,this.refreshInterval=n,this.aggregator=i,this.step=a,this.listeners={},this.initializing=!1,this.refreshing=!1,this.debouncedHandleRefresh=s(this.handleRefresh.bind(this),500),this.visible=!1,this.interval=null,this.lastRefresh=0,this.pendingRefresh=!1,this.error=null,this.graph={element:null,x:null,y:null,step:null,range:null,zoomRange:null},H.observe(this.container),G.observe(this.container)}async init(){if(!this.initializing){this.initializing=!0;try{this.processMetric(await this.getMetric()),this.graph.element=this.renderGraph(),this.setupInterval(),this.lastRefresh=l(new Date),this.pendingRefresh=!1}catch(t){this.setError(`Failed to fetch samples of a metric: ${t}`)}finally{this.initializing=!1}}}async handleRefresh(){if(!this.refreshing){this.refreshing=!0;try{if(null!=this.graph.element&&(this.pendingRefresh=!0,this.visible))try{this.processMetric(await this.getMetric()),this.updateGraph(!1),this.clearError(),this.lastRefresh=l(new Date),this.pendingRefresh=!1}catch(t){this.setError(`Failed to fetch samples of a metric: ${t}`)}}finally{this.refreshing=!1}}}handleVisibilityChange(t){this.visible=t,this.visible?null==this.graph.element?this.init():(null==this.interval&&this.setupInterval(),(this.pendingRefresh||this.refreshInterval>0&&l(new Date)-this.lastRefresh>this.refreshInterval)&&this.debouncedHandleRefresh()):this.stopInterval()}handleSizeChange(){null!=this.graph.element&&this.debouncedHandleRefresh()}handleGraphRelayout(t){if(t["xaxis.range[0]"]&&t["xaxis.range[1]"]?this.graph.zoomRange=[new Date(t["xaxis.range[0]"]),new Date(t["xaxis.range[1]"])]:(t["xaxis.range"]&&Array.isArray(t["xaxis.range"])&&t["xaxis.range"].length,this.graph.zoomRange=null),null!=this.graph.zoomRange&&(l(this.graph.zoomRange[0])l(this.graph.range[1])&&(this.graph.zoomRange[1]=this.graph.range[1])),null!=this.graph.zoomRange){const t=l(this.graph.zoomRange[1])-l(this.graph.zoomRange[0]);if(tt!==e)))}notifyEventListeners(t,e){this.listeners[t]&&this.listeners[t].forEach((t=>t(e)))}redraw(t,e,r){let n="normal"===e&&this.metric.debug;if(!n){const e=t.split(/\s+/).filter((t=>t.length>0));e.length>0&&(n=!e.some((t=>this.metric.name.includes(t))))}this.container.classList.toggle("d-none",n),this.container.classList.forEach((t=>{t.startsWith("col-")&&this.container.classList.remove(t)})),this.container.classList.add("col-"+12/r)}setRefreshInterval(t){this.refreshInterval=t,this.visible&&null!=this.graph.element&&this.setupInterval()}refresh(){null!=this.graph.element&&(this.visible&&this.setupInterval(),this.handleRefresh())}setAggregator(t){this.aggregator=t,null!=this.graph.element&&(this.visible&&this.setupInterval(),this.handleRefresh())}setStep(t){this.step=t,null!=this.graph.element&&(this.visible&&this.setupInterval(),this.handleRefresh())}setZoomRange(t){this.graph.zoomRange=t,null!=this.graph.element&&this.updateGraph(!0)}destroy(){H.unobserve(this.container),G.unobserve(this.container),this.stopInterval(),this.clearError(),null!=this.graph.element&&U().purge(this.graph.element)}setupInterval(){this.stopInterval(),this.refreshInterval>0&&(this.interval=setInterval(this.handleRefresh.bind(this),1e3*this.refreshInterval))}stopInterval(){null!=this.interval&&(clearInterval(this.interval),this.interval=null)}setError(t){const e=this.container.querySelector(".card"),r=e.querySelector(".error-icon");null==this.error&&(e.classList.add("border-danger"),r.classList.remove("d-none"));const n=`${(new Date).toISOString()}: ${t}`;let i=q().getInstance(r);null==i?i=new(q())(r,{title:n}):i.setContent({".tooltip-inner":n}),this.error=t}clearError(){if(null!=this.error){const t=this.container.querySelector(".card");t.classList.remove("border-danger");const e=t.querySelector(".error-icon");e.classList.add("d-none");q().getInstance(e).dispose(),this.error=null}}async getMetric(){const t=this.container.querySelector(".card .loading-icon");t.classList.remove("d-none");try{const[t,e]=this.rangeFactory(),r=this.estimateOptimalStep(t,e),n="b"===this.metric.flag?"bit_and":this.aggregator;return await async function(t,e,r,n,i){const a=new URLSearchParams({from:l(e),to:l(r),step:n,aggregator:i}),o=await fetch(`/storage/metrics/${t}?${a.toString()}`);if(!o.ok)throw new Error(`Unexpected API response (${o.status}): ${o.statusText}`);const s=await o.json();return{from:c(s.from),to:c(s.to),step:s.step,samples:B(s.samples,s.step)}}(this.metric.id,t,e,r,n)}finally{t.classList.add("d-none")}}estimateOptimalStep(t,e){const r=(l(e)-l(t))/this.step,n=this.container.clientWidth,i=Math.floor(.9*n);if(i<=0)throw new Error("Failed to estimate the optimal step");return r<=i?this.step:Math.ceil(r/i)*this.step}processMetric(t){this.graph.x=[],this.graph.y=[],t.samples.forEach((t=>{this.graph.x.push(t[0]),this.graph.y.push("b"===this.metric.flag?BigInt(`0x${t[1]}`).toString(2).split("").filter((t=>"1"===t)).length:t[1])})),this.graph.step=t.step,this.graph.range=[t.from,new Date(t.to.getTime()-1e3*t.step)];const e=this.container.querySelector(".card .step-factor");if(this.graph.step!==this.step){const t=Math.round(this.graph.step/this.step);e.innerHTML=` ${t}x`}else e.innerHTML=""}renderGraph(){const t=null!=this.graph.zoomRange?this.graph.zoomRange:this.graph.range,e=[{x:this.graph.x,y:this.graph.y,type:"scatter",mode:this.estimatePlotlyDataMode(...t,this.graph.step),marker:{size:4},hovertemplate:"X: %{x|%Y-%m-%d %H:%M:%S}
Y: %{y:,.1f}",connectgaps:!1,line:{shape:"linear",width:2}}],r={autosize:!0,title:{text:this.metric.name,font:{size:14},subtitle:{text:this.metric.description}},margin:{l:60,r:10,b:40,t:40,pad:5},hovermode:"closest",xaxis:{...Z,range:Array.from(t)},yaxis:{fixedrange:!0,griddash:"dash",rangemode:"normal",title:(()=>{if("c"===this.metric.flag)return"d"===this.metric.format?"seconds":"B"===this.metric.format?"Bps":"eps";if("g"===this.metric.flag){if("d"===this.metric.format)return"seconds";if("B"===this.metric.format)return"bytes"}return""})()}},n={responsive:!0,displaylogo:!1,modeBarButtons:[["zoomIn2d","zoomOut2d","resetScale2d"],[{name:"download",title:"Download plot",icon:U().Icons.disk,click:t=>{U().downloadImage(t,{filename:`${varnishmon.storage.hostname} - ${this.metric.name}`,format:"png",width:null,height:null,scale:1}).then((()=>{u("info","Plot ready for download")})).catch((t=>{u("error",`Failed to download plot: ${t}`)}))}},{name:"copy-to-clipboard",title:"Copy plot to clipboard",icon:U().Icons.camera,click:t=>{U().toImage(t,{format:"png",width:null,height:null,scale:1}).then((t=>{fetch(t).then((t=>{t.blob().then((t=>{navigator.clipboard.write([new ClipboardItem({"image/png":t})]).then((()=>{u("info","Plot copied to clipboard")})).catch((t=>{u("error",`Failed to copy plot to clipboard: ${t}`)}))}))}))}))}}]],scrollZoom:!1},i=this.container.querySelector(".graph");return U().newPlot(i,e,r,n),i.on("plotly_relayout",this.handleGraphRelayout.bind(this)),i}updateGraph(t){const e=null!=this.graph.zoomRange?this.graph.zoomRange:this.graph.range,r={mode:this.estimatePlotlyDataMode(...e,this.graph.step)};t||(r.x=[this.graph.x],r.y=[this.graph.y]);const n={xaxis:{...Z,range:Array.from(e)}};U().update(this.graph.element,r,n)}estimatePlotlyDataMode(t,e,r){const n=(l(e)-l(t))/r,i=this.container.clientWidth;return n>Math.floor(.9*i/6)?"lines":"lines+markers"}};var Y=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],X={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(t){return"undefined"!=typeof console&&console.warn(t)},getWeek:function(t){var e=new Date(t.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var r=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-r.getTime())/864e5-3+(r.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},$={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(t){var e=t%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1};const K=$;var J=function(t,e){return void 0===e&&(e=2),("000"+t).slice(-1*e)},Q=function(t){return!0===t?1:0};function tt(t,e){var r;return function(){var n=this,i=arguments;clearTimeout(r),r=setTimeout((function(){return t.apply(n,i)}),e)}}var et=function(t){return t instanceof Array?t:[t]};function rt(t,e,r){if(!0===r)return t.classList.add(e);t.classList.remove(e)}function nt(t,e,r){var n=window.document.createElement(t);return e=e||"",r=r||"",n.className=e,void 0!==r&&(n.textContent=r),n}function it(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function at(t,e){return e(t)?t:t.parentNode?at(t.parentNode,e):void 0}function ot(t,e){var r=nt("div","numInputWrapper"),n=nt("input","numInput "+t),i=nt("span","arrowUp"),a=nt("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?n.type="number":(n.type="text",n.pattern="\\d*"),void 0!==e)for(var o in e)n.setAttribute(o,e[o]);return r.appendChild(n),r.appendChild(i),r.appendChild(a),r}function st(t){try{return"function"==typeof t.composedPath?t.composedPath()[0]:t.target}catch(e){return t.target}}var lt=function(){},ct=function(t,e,r){return r.months[e?"shorthand":"longhand"][t]},ut={D:lt,F:function(t,e,r){t.setMonth(r.months.longhand.indexOf(e))},G:function(t,e){t.setHours((t.getHours()>=12?12:0)+parseFloat(e))},H:function(t,e){t.setHours(parseFloat(e))},J:function(t,e){t.setDate(parseFloat(e))},K:function(t,e,r){t.setHours(t.getHours()%12+12*Q(new RegExp(r.amPM[1],"i").test(e)))},M:function(t,e,r){t.setMonth(r.months.shorthand.indexOf(e))},S:function(t,e){t.setSeconds(parseFloat(e))},U:function(t,e){return new Date(1e3*parseFloat(e))},W:function(t,e,r){var n=parseInt(e),i=new Date(t.getFullYear(),0,2+7*(n-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+r.firstDayOfWeek),i},Y:function(t,e){t.setFullYear(parseFloat(e))},Z:function(t,e){return new Date(e)},d:function(t,e){t.setDate(parseFloat(e))},h:function(t,e){t.setHours((t.getHours()>=12?12:0)+parseFloat(e))},i:function(t,e){t.setMinutes(parseFloat(e))},j:function(t,e){t.setDate(parseFloat(e))},l:lt,m:function(t,e){t.setMonth(parseFloat(e)-1)},n:function(t,e){t.setMonth(parseFloat(e)-1)},s:function(t,e){t.setSeconds(parseFloat(e))},u:function(t,e){return new Date(parseFloat(e))},w:lt,y:function(t,e){t.setFullYear(2e3+parseFloat(e))}},ht={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},ft={Z:function(t){return t.toISOString()},D:function(t,e,r){return e.weekdays.shorthand[ft.w(t,e,r)]},F:function(t,e,r){return ct(ft.n(t,e,r)-1,!1,e)},G:function(t,e,r){return J(ft.h(t,e,r))},H:function(t){return J(t.getHours())},J:function(t,e){return void 0!==e.ordinal?t.getDate()+e.ordinal(t.getDate()):t.getDate()},K:function(t,e){return e.amPM[Q(t.getHours()>11)]},M:function(t,e){return ct(t.getMonth(),!0,e)},S:function(t){return J(t.getSeconds())},U:function(t){return t.getTime()/1e3},W:function(t,e,r){return r.getWeek(t)},Y:function(t){return J(t.getFullYear(),4)},d:function(t){return J(t.getDate())},h:function(t){return t.getHours()%12?t.getHours()%12:12},i:function(t){return J(t.getMinutes())},j:function(t){return t.getDate()},l:function(t,e){return e.weekdays.longhand[t.getDay()]},m:function(t){return J(t.getMonth()+1)},n:function(t){return t.getMonth()+1},s:function(t){return t.getSeconds()},u:function(t){return t.getTime()},w:function(t){return t.getDay()},y:function(t){return String(t.getFullYear()).substring(2)}},pt=function(t){var e=t.config,r=void 0===e?X:e,n=t.l10n,i=void 0===n?$:n,a=t.isMobile,o=void 0!==a&&a;return function(t,e,n){var a=n||i;return void 0===r.formatDate||o?e.split("").map((function(e,n,i){return ft[e]&&"\\"!==i[n-1]?ft[e](t,a,r):"\\"!==e?e:""})).join(""):r.formatDate(t,e,a)}},dt=function(t){var e=t.config,r=void 0===e?X:e,n=t.l10n,i=void 0===n?$:n;return function(t,e,n,a){if(0===t||t){var o,s=a||i,l=t;if(t instanceof Date)o=new Date(t.getTime());else if("string"!=typeof t&&void 0!==t.toFixed)o=new Date(t);else if("string"==typeof t){var c=e||(r||X).dateFormat,u=String(t).trim();if("today"===u)o=new Date,n=!0;else if(r&&r.parseDate)o=r.parseDate(t,c);else if(/Z$/.test(u)||/GMT$/.test(u))o=new Date(t);else{for(var h=void 0,f=[],p=0,d=0,m="";p=0?new Date:new Date(r.config.minDate.getTime()),n=vt(r.config);e.setHours(n.hours,n.minutes,n.seconds,e.getMilliseconds()),r.selectedDates=[e],r.latestSelectedDateObj=e}void 0!==t&&"blur"!==t.type&&function(t){t.preventDefault();var e="keydown"===t.type,n=st(t),i=n;void 0!==r.amPM&&n===r.amPM&&(r.amPM.textContent=r.l10n.amPM[Q(r.amPM.textContent===r.l10n.amPM[0])]);var a=parseFloat(i.getAttribute("min")),o=parseFloat(i.getAttribute("max")),s=parseFloat(i.getAttribute("step")),l=parseInt(i.value,10),c=t.delta||(e?38===t.which?1:-1:0),u=l+s*c;if(void 0!==i.value&&2===i.value.length){var h=i===r.hourElement,f=i===r.minuteElement;uo&&(u=i===r.hourElement?u-o-Q(!r.amPM):a,f&&m(void 0,1,r.hourElement)),r.amPM&&h&&(1===s?u+l===23:Math.abs(u-l)>s)&&(r.amPM.textContent=r.l10n.amPM[Q(r.amPM.textContent===r.l10n.amPM[0])]),i.value=J(u)}}(t);var i=r._input.value;s(),wt(),r._input.value!==i&&r._debouncedChange()}function s(){if(void 0!==r.hourElement&&void 0!==r.minuteElement){var t,e,n=(parseInt(r.hourElement.value.slice(-2),10)||0)%24,i=(parseInt(r.minuteElement.value,10)||0)%60,a=void 0!==r.secondElement?(parseInt(r.secondElement.value,10)||0)%60:0;void 0!==r.amPM&&(t=n,e=r.amPM.textContent,n=t%12+12*Q(e===r.l10n.amPM[1]));var o=void 0!==r.config.minTime||r.config.minDate&&r.minDateHasTime&&r.latestSelectedDateObj&&0===mt(r.latestSelectedDateObj,r.config.minDate,!0),s=void 0!==r.config.maxTime||r.config.maxDate&&r.maxDateHasTime&&r.latestSelectedDateObj&&0===mt(r.latestSelectedDateObj,r.config.maxDate,!0);if(void 0!==r.config.maxTime&&void 0!==r.config.minTime&&r.config.minTime>r.config.maxTime){var l=gt(r.config.minTime.getHours(),r.config.minTime.getMinutes(),r.config.minTime.getSeconds()),u=gt(r.config.maxTime.getHours(),r.config.maxTime.getMinutes(),r.config.maxTime.getSeconds()),h=gt(n,i,a);if(h>u&&h=12)]),void 0!==r.secondElement&&(r.secondElement.value=J(n)))}function u(t){var e=st(t),r=parseInt(e.value)+(t.delta||0);(r/1e3>1||"Enter"===t.key&&!/[^\d]/.test(r.toString()))&&I(r)}function h(t,e,n,i){return e instanceof Array?e.forEach((function(e){return h(t,e,n,i)})):t instanceof Array?t.forEach((function(t){return h(t,e,n,i)})):(t.addEventListener(e,n,i),void r._handlers.push({remove:function(){return t.removeEventListener(e,n,i)}}))}function f(){$("onChange")}function p(t,e){var n=void 0!==t?r.parseDate(t):r.latestSelectedDateObj||(r.config.minDate&&r.config.minDate>r.now?r.config.minDate:r.config.maxDate&&r.config.maxDate=0&&mt(t,r.selectedDates[1])<=0)}(e)&&!ut(e)&&o.classList.add("inRange"),r.weekNumbers&&1===r.config.showMonths&&"prevMonthDay"!==t&&i%7==6&&r.weekNumbers.insertAdjacentHTML("beforeend",""+r.config.getWeek(e)+""),$("onDayCreate",o),o}function y(t){t.focus(),"range"===r.config.mode&&O(t)}function v(t){for(var e=t>0?0:r.config.showMonths-1,n=t>0?r.config.showMonths:-1,i=e;i!=n;i+=t)for(var a=r.daysContainer.children[i],o=t>0?0:a.children.length-1,s=t>0?a.children.length:-1,l=o;l!=s;l+=t){var c=a.children[l];if(-1===c.className.indexOf("hidden")&&L(c.dateObj))return c}}function x(t,e){var i=n(),a=P(i||document.body),o=void 0!==t?t:a?i:void 0!==r.selectedDateElem&&P(r.selectedDateElem)?r.selectedDateElem:void 0!==r.todayDateElem&&P(r.todayDateElem)?r.todayDateElem:v(e>0?1:-1);void 0===o?r._input.focus():a?function(t,e){for(var n=-1===t.className.indexOf("Month")?t.dateObj.getMonth():r.currentMonth,i=e>0?r.config.showMonths:-1,a=e>0?1:-1,o=n-r.currentMonth;o!=i;o+=a)for(var s=r.daysContainer.children[o],l=n-r.currentMonth===o?t.$i+e:e<0?s.children.length-1:0,c=s.children.length,u=l;u>=0&&u0?c:-1);u+=a){var h=s.children[u];if(-1===h.className.indexOf("hidden")&&L(h.dateObj)&&Math.abs(t.$i-u)>=Math.abs(e))return y(h)}r.changeMonth(a),x(v(a),0)}(o,e):y(o)}function _(t,e){for(var n=(new Date(t,e,1).getDay()-r.l10n.firstDayOfWeek+7)%7,i=r.utils.getDaysInMonth((e-1+12)%12,t),a=r.utils.getDaysInMonth(e,t),o=window.document.createDocumentFragment(),s=r.config.showMonths>1,l=s?"prevMonthDay hidden":"prevMonthDay",c=s?"nextMonthDay hidden":"nextMonthDay",u=i+1-n,h=0;u<=i;u++,h++)o.appendChild(g("flatpickr-day "+l,new Date(t,e-1,u),0,h));for(u=1;u<=a;u++,h++)o.appendChild(g("flatpickr-day",new Date(t,e,u),0,h));for(var f=a+1;f<=42-n&&(1===r.config.showMonths||h%7!=0);f++,h++)o.appendChild(g("flatpickr-day "+c,new Date(t,e+1,f%a),0,h));var p=nt("div","dayContainer");return p.appendChild(o),p}function b(){if(void 0!==r.daysContainer){it(r.daysContainer),r.weekNumbers&&it(r.weekNumbers);for(var t=document.createDocumentFragment(),e=0;e1||"dropdown"!==r.config.monthSelectorType)){var t=function(t){return!(void 0!==r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&tr.config.maxDate.getMonth())};r.monthsDropdownContainer.tabIndex=-1,r.monthsDropdownContainer.innerHTML="";for(var e=0;e<12;e++)if(t(e)){var n=nt("option","flatpickr-monthDropdown-month");n.value=new Date(r.currentYear,e).getMonth().toString(),n.textContent=ct(e,r.config.shorthandCurrentMonth,r.l10n),n.tabIndex=-1,r.currentMonth===e&&(n.selected=!0),r.monthsDropdownContainer.appendChild(n)}}}function T(){var t,e=nt("div","flatpickr-month"),n=window.document.createDocumentFragment();r.config.showMonths>1||"static"===r.config.monthSelectorType?t=nt("span","cur-month"):(r.monthsDropdownContainer=nt("select","flatpickr-monthDropdown-months"),r.monthsDropdownContainer.setAttribute("aria-label",r.l10n.monthAriaLabel),h(r.monthsDropdownContainer,"change",(function(t){var e=st(t),n=parseInt(e.value,10);r.changeMonth(n-r.currentMonth),$("onMonthChange")})),w(),t=r.monthsDropdownContainer);var i=ot("cur-year",{tabindex:"-1"}),a=i.getElementsByTagName("input")[0];a.setAttribute("aria-label",r.l10n.yearAriaLabel),r.config.minDate&&a.setAttribute("min",r.config.minDate.getFullYear().toString()),r.config.maxDate&&(a.setAttribute("max",r.config.maxDate.getFullYear().toString()),a.disabled=!!r.config.minDate&&r.config.minDate.getFullYear()===r.config.maxDate.getFullYear());var o=nt("div","flatpickr-current-month");return o.appendChild(t),o.appendChild(i),n.appendChild(o),e.appendChild(n),{container:e,yearElement:a,monthElement:t}}function k(){it(r.monthNav),r.monthNav.appendChild(r.prevMonthNav),r.config.showMonths&&(r.yearElements=[],r.monthElements=[]);for(var t=r.config.showMonths;t--;){var e=T();r.yearElements.push(e.yearElement),r.monthElements.push(e.monthElement),r.monthNav.appendChild(e.container)}r.monthNav.appendChild(r.nextMonthNav)}function A(){r.weekdayContainer?it(r.weekdayContainer):r.weekdayContainer=nt("div","flatpickr-weekdays");for(var t=r.config.showMonths;t--;){var e=nt("div","flatpickr-weekdaycontainer");r.weekdayContainer.appendChild(e)}return M(),r.weekdayContainer}function M(){if(r.weekdayContainer){var t=r.l10n.firstDayOfWeek,e=_t(r.l10n.weekdays.shorthand);t>0&&t\n "+e.join("")+"\n \n "}}function S(t,e){void 0===e&&(e=!0);var n=e?t:t-r.currentMonth;n<0&&!0===r._hidePrevMonthArrow||n>0&&!0===r._hideNextMonthArrow||(r.currentMonth+=n,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,$("onYearChange"),w()),b(),$("onMonthChange"),ft())}function E(t){return r.calendarContainer.contains(t)}function C(t){if(r.isOpen&&!r.config.inline){var e=st(t),n=E(e),i=!(e===r.input||e===r.altInput||r.element.contains(e)||t.path&&t.path.indexOf&&(~t.path.indexOf(r.input)||~t.path.indexOf(r.altInput)))&&!n&&!E(t.relatedTarget),a=!r.config.ignoredFocusElements.some((function(t){return t.contains(e)}));i&&a&&(r.config.allowInput&&r.setDate(r._input.value,!1,r.config.altInput?r.config.altFormat:r.config.dateFormat),void 0!==r.timeContainer&&void 0!==r.minuteElement&&void 0!==r.hourElement&&""!==r.input.value&&void 0!==r.input.value&&o(),r.close(),r.config&&"range"===r.config.mode&&1===r.selectedDates.length&&r.clear(!1))}}function I(t){if(!(!t||r.config.minDate&&tr.config.maxDate.getFullYear())){var e=t,n=r.currentYear!==e;r.currentYear=e||r.currentYear,r.config.maxDate&&r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth=Math.min(r.config.maxDate.getMonth(),r.currentMonth):r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&(r.currentMonth=Math.max(r.config.minDate.getMonth(),r.currentMonth)),n&&(r.redraw(),$("onYearChange"),w())}}function L(t,e){var n;void 0===e&&(e=!0);var i=r.parseDate(t,void 0,e);if(r.config.minDate&&i&&mt(i,r.config.minDate,void 0!==e?e:!r.minDateHasTime)<0||r.config.maxDate&&i&&mt(i,r.config.maxDate,void 0!==e?e:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&0===r.config.disable.length)return!0;if(void 0===i)return!1;for(var a=!!r.config.enable,o=null!==(n=r.config.enable)&&void 0!==n?n:r.config.disable,s=0,l=void 0;s=l.from.getTime()&&i.getTime()<=l.to.getTime())return a}return!a}function P(t){return void 0!==r.daysContainer&&(-1===t.className.indexOf("hidden")&&-1===t.className.indexOf("flatpickr-disabled")&&r.daysContainer.contains(t))}function z(t){var e=t.target===r._input,n=r._input.value.trimEnd()!==bt();!e||!n||t.relatedTarget&&E(t.relatedTarget)||r.setDate(r._input.value,!0,t.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function D(e){var i=st(e),a=r.config.wrap?t.contains(i):i===r._input,l=r.config.allowInput,c=r.isOpen&&(!l||!a),u=r.config.inline&&a&&!l;if(13===e.keyCode&&a){if(l)return r.setDate(r._input.value,!0,i===r.altInput?r.config.altFormat:r.config.dateFormat),r.close(),i.blur();r.open()}else if(E(i)||c||u){var h=!!r.timeContainer&&r.timeContainer.contains(i);switch(e.keyCode){case 13:h?(e.preventDefault(),o(),V()):q(e);break;case 27:e.preventDefault(),V();break;case 8:case 46:a&&!r.config.allowInput&&(e.preventDefault(),r.clear());break;case 37:case 39:if(h||a)r.hourElement&&r.hourElement.focus();else{e.preventDefault();var f=n();if(void 0!==r.daysContainer&&(!1===l||f&&P(f))){var p=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),S(p),x(v(1),0)):x(void 0,p)}}break;case 38:case 40:e.preventDefault();var d=40===e.keyCode?1:-1;r.daysContainer&&void 0!==i.$i||i===r.input||i===r.altInput?e.ctrlKey?(e.stopPropagation(),I(r.currentYear-d),x(v(1),0)):h||x(void 0,7*d):i===r.currentYearElement?I(r.currentYear-d):r.config.enableTime&&(!h&&r.hourElement&&r.hourElement.focus(),o(e),r._debouncedChange());break;case 9:if(h){var m=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter((function(t){return t})),g=m.indexOf(i);if(-1!==g){var y=m[g+(e.shiftKey?-1:1)];e.preventDefault(),(y||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(i)&&e.shiftKey&&(e.preventDefault(),r._input.focus())}}if(void 0!==r.amPM&&i===r.amPM)switch(e.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],s(),wt();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],s(),wt()}(a||E(i))&&$("onKeyDown",e)}function O(t,e){if(void 0===e&&(e="flatpickr-day"),1===r.selectedDates.length&&(!t||t.classList.contains(e)&&!t.classList.contains("flatpickr-disabled"))){for(var n=t?t.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),i=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),a=Math.min(n,r.selectedDates[0].getTime()),o=Math.max(n,r.selectedDates[0].getTime()),s=!1,l=0,c=0,u=a;ua&&ul)?l=u:u>i&&(!c||u ."+e)).forEach((function(e){var a,o,u,h=e.dateObj.getTime(),f=l>0&&h0&&h>c;if(f)return e.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(t){e.classList.remove(t)}));s&&!f||(["startRange","inRange","endRange","notAllowed"].forEach((function(t){e.classList.remove(t)})),void 0!==t&&(t.classList.add(n<=r.selectedDates[0].getTime()?"startRange":"endRange"),in&&h===i&&e.classList.add("endRange"),h>=l&&(0===c||h<=c)&&(o=i,u=n,(a=h)>Math.min(o,u)&&a0||n.getMinutes()>0||n.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter((function(t){return L(t)})),r.selectedDates.length||"min"!==t||l(n),wt()),r.daysContainer&&(U(),void 0!==n?r.currentYearElement[t]=n.getFullYear().toString():r.currentYearElement.removeAttribute(t),r.currentYearElement.disabled=!!i&&void 0!==n&&i.getFullYear()===n.getFullYear())}}function j(){return r.config.wrap?t.querySelector("[data-input]"):t}function B(){"object"!=typeof r.config.locale&&void 0===Tt.l10ns[r.config.locale]&&r.config.errorHandler(new Error("flatpickr: invalid locale "+r.config.locale)),r.l10n=xt(xt({},Tt.l10ns.default),"object"==typeof r.config.locale?r.config.locale:"default"!==r.config.locale?Tt.l10ns[r.config.locale]:void 0),ht.D="("+r.l10n.weekdays.shorthand.join("|")+")",ht.l="("+r.l10n.weekdays.longhand.join("|")+")",ht.M="("+r.l10n.months.shorthand.join("|")+")",ht.F="("+r.l10n.months.longhand.join("|")+")",ht.K="("+r.l10n.amPM[0]+"|"+r.l10n.amPM[1]+"|"+r.l10n.amPM[0].toLowerCase()+"|"+r.l10n.amPM[1].toLowerCase()+")",void 0===xt(xt({},e),JSON.parse(JSON.stringify(t.dataset||{}))).time_24hr&&void 0===Tt.defaultConfig.time_24hr&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=pt(r),r.parseDate=dt({config:r.config,l10n:r.l10n})}function N(t){if("function"!=typeof r.config.position){if(void 0!==r.calendarContainer){$("onPreCalendarPosition");var e=t||r._positionElement,n=Array.prototype.reduce.call(r.calendarContainer.children,(function(t,e){return t+e.offsetHeight}),0),i=r.calendarContainer.offsetWidth,a=r.config.position.split(" "),o=a[0],s=a.length>1?a[1]:null,l=e.getBoundingClientRect(),c=window.innerHeight-l.bottom,u="above"===o||"below"!==o&&cn,h=window.pageYOffset+l.top+(u?-n-2:e.offsetHeight+2);if(rt(r.calendarContainer,"arrowTop",!u),rt(r.calendarContainer,"arrowBottom",u),!r.config.inline){var f=window.pageXOffset+l.left,p=!1,d=!1;"center"===s?(f-=(i-l.width)/2,p=!0):"right"===s&&(f-=i-l.width,d=!0),rt(r.calendarContainer,"arrowLeft",!p&&!d),rt(r.calendarContainer,"arrowCenter",p),rt(r.calendarContainer,"arrowRight",d);var m=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=f+i>window.document.body.offsetWidth,y=m+i>window.document.body.offsetWidth;if(rt(r.calendarContainer,"rightMost",g),!r.config.static)if(r.calendarContainer.style.top=h+"px",g)if(y){var v=function(){for(var t=null,e=0;er.currentMonth+r.config.showMonths-1)&&"range"!==r.config.mode;if(r.selectedDateElem=n,"single"===r.config.mode)r.selectedDates=[i];else if("multiple"===r.config.mode){var o=ut(i);o?r.selectedDates.splice(parseInt(o),1):r.selectedDates.push(i)}else"range"===r.config.mode&&(2===r.selectedDates.length&&r.clear(!1,!1),r.latestSelectedDateObj=i,r.selectedDates.push(i),0!==mt(i,r.selectedDates[0],!0)&&r.selectedDates.sort((function(t,e){return t.getTime()-e.getTime()})));if(s(),a){var l=r.currentYear!==i.getFullYear();r.currentYear=i.getFullYear(),r.currentMonth=i.getMonth(),l&&($("onYearChange"),w()),$("onMonthChange")}if(ft(),b(),wt(),a||"range"===r.config.mode||1!==r.config.showMonths?void 0!==r.selectedDateElem&&void 0===r.hourElement&&r.selectedDateElem&&r.selectedDateElem.focus():y(n),void 0!==r.hourElement&&void 0!==r.hourElement&&r.hourElement.focus(),r.config.closeOnSelect){var c="single"===r.config.mode&&!r.config.enableTime,u="range"===r.config.mode&&2===r.selectedDates.length&&!r.config.enableTime;(c||u)&&V()}f()}}r.parseDate=dt({config:r.config,l10n:r.l10n}),r._handlers=[],r.pluginElements=[],r.loadedPlugins=[],r._bind=h,r._setHoursFromDate=l,r._positionCalendar=N,r.changeMonth=S,r.changeYear=I,r.clear=function(t,e){void 0===t&&(t=!0);void 0===e&&(e=!0);r.input.value="",void 0!==r.altInput&&(r.altInput.value="");void 0!==r.mobileInput&&(r.mobileInput.value="");r.selectedDates=[],r.latestSelectedDateObj=void 0,!0===e&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth());if(!0===r.config.enableTime){var n=vt(r.config);c(n.hours,n.minutes,n.seconds)}r.redraw(),t&&$("onChange")},r.close=function(){r.isOpen=!1,r.isMobile||(void 0!==r.calendarContainer&&r.calendarContainer.classList.remove("open"),void 0!==r._input&&r._input.classList.remove("active"));$("onClose")},r.onMouseOver=O,r._createElement=nt,r.createDay=g,r.destroy=function(){void 0!==r.config&&$("onDestroy");for(var t=r._handlers.length;t--;)r._handlers[t].remove();if(r._handlers=[],r.mobileInput)r.mobileInput.parentNode&&r.mobileInput.parentNode.removeChild(r.mobileInput),r.mobileInput=void 0;else if(r.calendarContainer&&r.calendarContainer.parentNode)if(r.config.static&&r.calendarContainer.parentNode){var e=r.calendarContainer.parentNode;if(e.lastChild&&e.removeChild(e.lastChild),e.parentNode){for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.parentNode.removeChild(e)}}else r.calendarContainer.parentNode.removeChild(r.calendarContainer);r.altInput&&(r.input.type="text",r.altInput.parentNode&&r.altInput.parentNode.removeChild(r.altInput),delete r.altInput);r.input&&(r.input.type=r.input._type,r.input.classList.remove("flatpickr-input"),r.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(t){try{delete r[t]}catch(t){}}))},r.isEnabled=L,r.jumpToDate=p,r.updateValue=wt,r.open=function(t,e){void 0===e&&(e=r._positionElement);if(!0===r.isMobile){if(t){t.preventDefault();var n=st(t);n&&n.blur()}return void 0!==r.mobileInput&&(r.mobileInput.focus(),r.mobileInput.click()),void $("onOpen")}if(r._input.disabled||r.config.inline)return;var i=r.isOpen;r.isOpen=!0,i||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),$("onOpen"),N(e));!0===r.config.enableTime&&!0===r.config.noCalendar&&(!1!==r.config.allowInput||void 0!==t&&r.timeContainer.contains(t.relatedTarget)||setTimeout((function(){return r.hourElement.select()}),50))},r.redraw=U,r.set=function(t,e){if(null!==t&&"object"==typeof t)for(var n in Object.assign(r.config,t),t)void 0!==H[n]&&H[n].forEach((function(t){return t()}));else r.config[t]=e,void 0!==H[t]?H[t].forEach((function(t){return t()})):Y.indexOf(t)>-1&&(r.config[t]=et(e));r.redraw(),wt(!0)},r.setDate=function(t,e,n){void 0===e&&(e=!1);void 0===n&&(n=r.config.dateFormat);if(0!==t&&!t||t instanceof Array&&0===t.length)return r.clear(e);G(t,n),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),p(void 0,e),l(),0===r.selectedDates.length&&r.clear(!1);wt(e),e&&$("onChange")},r.toggle=function(t){if(!0===r.isOpen)return r.close();r.open(t)};var H={locale:[B,M],showMonths:[k,a,A],minDate:[p],maxDate:[p],positionElement:[W],clickOpens:[function(){!0===r.config.clickOpens?(h(r._input,"focus",r.open),h(r._input,"click",r.open)):(r._input.removeEventListener("focus",r.open),r._input.removeEventListener("click",r.open))}]};function G(t,e){var n=[];if(t instanceof Array)n=t.map((function(t){return r.parseDate(t,e)}));else if(t instanceof Date||"number"==typeof t)n=[r.parseDate(t,e)];else if("string"==typeof t)switch(r.config.mode){case"single":case"time":n=[r.parseDate(t,e)];break;case"multiple":n=t.split(r.config.conjunction).map((function(t){return r.parseDate(t,e)}));break;case"range":n=t.split(r.l10n.rangeSeparator).map((function(t){return r.parseDate(t,e)}))}else r.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(t)));r.selectedDates=r.config.allowInvalidPreload?n:n.filter((function(t){return t instanceof Date&&L(t,!1)})),"range"===r.config.mode&&r.selectedDates.sort((function(t,e){return t.getTime()-e.getTime()}))}function Z(t){return t.slice().map((function(t){return"string"==typeof t||"number"==typeof t||t instanceof Date?r.parseDate(t,void 0,!0):t&&"object"==typeof t&&t.from&&t.to?{from:r.parseDate(t.from,void 0),to:r.parseDate(t.to,void 0)}:t})).filter((function(t){return t}))}function W(){r._positionElement=r.config.positionElement||r._input}function $(t,e){if(void 0!==r.config){var n=r.config[t];if(void 0!==n&&n.length>0)for(var i=0;n[i]&&i1||"static"===r.config.monthSelectorType?r.monthElements[e].textContent=ct(n.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=n.getMonth().toString(),t.value=n.getFullYear().toString()})),r._hidePrevMonthArrow=void 0!==r.config.minDate&&(r.currentYear===r.config.minDate.getFullYear()?r.currentMonth<=r.config.minDate.getMonth():r.currentYearr.config.maxDate.getMonth():r.currentYear>r.config.maxDate.getFullYear()))}function bt(t){var e=t||(r.config.altInput?r.config.altFormat:r.config.dateFormat);return r.selectedDates.map((function(t){return r.formatDate(t,e)})).filter((function(t,e,n){return"range"!==r.config.mode||r.config.enableTime||n.indexOf(t)===e})).join("range"!==r.config.mode?r.config.conjunction:r.l10n.rangeSeparator)}function wt(t){void 0===t&&(t=!0),void 0!==r.mobileInput&&r.mobileFormatStr&&(r.mobileInput.value=void 0!==r.latestSelectedDateObj?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=bt(r.config.dateFormat),void 0!==r.altInput&&(r.altInput.value=bt(r.config.altFormat)),!1!==t&&$("onValueUpdate")}function kt(t){var e=st(t),n=r.prevMonthNav.contains(e),i=r.nextMonthNav.contains(e);n||i?S(n?-1:1):r.yearElements.indexOf(e)>=0?e.select():e.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):e.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}return function(){r.element=r.input=t,r.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],a=xt(xt({},JSON.parse(JSON.stringify(t.dataset||{}))),e),o={};r.config.parseDate=a.parseDate,r.config.formatDate=a.formatDate,Object.defineProperty(r.config,"enable",{get:function(){return r.config._enable},set:function(t){r.config._enable=Z(t)}}),Object.defineProperty(r.config,"disable",{get:function(){return r.config._disable},set:function(t){r.config._disable=Z(t)}});var s="time"===a.mode;if(!a.dateFormat&&(a.enableTime||s)){var l=Tt.defaultConfig.dateFormat||X.dateFormat;o.dateFormat=a.noCalendar||s?"H:i"+(a.enableSeconds?":S":""):l+" H:i"+(a.enableSeconds?":S":"")}if(a.altInput&&(a.enableTime||s)&&!a.altFormat){var c=Tt.defaultConfig.altFormat||X.altFormat;o.altFormat=a.noCalendar||s?"h:i"+(a.enableSeconds?":S K":" K"):c+" h:i"+(a.enableSeconds?":S":"")+" K"}Object.defineProperty(r.config,"minDate",{get:function(){return r.config._minDate},set:F("min")}),Object.defineProperty(r.config,"maxDate",{get:function(){return r.config._maxDate},set:F("max")});var u=function(t){return function(e){r.config["min"===t?"_minTime":"_maxTime"]=r.parseDate(e,"H:i:S")}};Object.defineProperty(r.config,"minTime",{get:function(){return r.config._minTime},set:u("min")}),Object.defineProperty(r.config,"maxTime",{get:function(){return r.config._maxTime},set:u("max")}),"time"===a.mode&&(r.config.noCalendar=!0,r.config.enableTime=!0);Object.assign(r.config,o,a);for(var h=0;h-1?r.config[p]=et(f[p]).map(i).concat(r.config[p]):void 0===a[p]&&(r.config[p]=f[p])}a.altInputClass||(r.config.altInputClass=j().className+" "+r.config.altInputClass);$("onParseConfig")}(),B(),function(){if(r.input=j(),!r.input)return void r.config.errorHandler(new Error("Invalid input element specified"));r.input._type=r.input.type,r.input.type="text",r.input.classList.add("flatpickr-input"),r._input=r.input,r.config.altInput&&(r.altInput=nt(r.input.nodeName,r.config.altInputClass),r._input=r.altInput,r.altInput.placeholder=r.input.placeholder,r.altInput.disabled=r.input.disabled,r.altInput.required=r.input.required,r.altInput.tabIndex=r.input.tabIndex,r.altInput.type="text",r.input.setAttribute("type","hidden"),!r.config.static&&r.input.parentNode&&r.input.parentNode.insertBefore(r.altInput,r.input.nextSibling));r.config.allowInput||r._input.setAttribute("readonly","readonly");W()}(),function(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;var t=r.config.defaultDate||("INPUT"!==r.input.nodeName&&"TEXTAREA"!==r.input.nodeName||!r.input.placeholder||r.input.value!==r.input.placeholder?r.input.value:null);t&&G(t,r.config.dateFormat);r._initialDate=r.selectedDates.length>0?r.selectedDates[0]:r.config.minDate&&r.config.minDate.getTime()>r.now.getTime()?r.config.minDate:r.config.maxDate&&r.config.maxDate.getTime()0&&(r.latestSelectedDateObj=r.selectedDates[0]);void 0!==r.config.minTime&&(r.config.minTime=r.parseDate(r.config.minTime,"H:i"));void 0!==r.config.maxTime&&(r.config.maxTime=r.parseDate(r.config.maxTime,"H:i"));r.minDateHasTime=!!r.config.minDate&&(r.config.minDate.getHours()>0||r.config.minDate.getMinutes()>0||r.config.minDate.getSeconds()>0),r.maxDateHasTime=!!r.config.maxDate&&(r.config.maxDate.getHours()>0||r.config.maxDate.getMinutes()>0||r.config.maxDate.getSeconds()>0)}(),r.utils={getDaysInMonth:function(t,e){return void 0===t&&(t=r.currentMonth),void 0===e&&(e=r.currentYear),1===t&&(e%4==0&&e%100!=0||e%400==0)?29:r.l10n.daysInMonth[t]}},r.isMobile||function(){var t=window.document.createDocumentFragment();if(r.calendarContainer=nt("div","flatpickr-calendar"),r.calendarContainer.tabIndex=-1,!r.config.noCalendar){if(t.appendChild((r.monthNav=nt("div","flatpickr-months"),r.yearElements=[],r.monthElements=[],r.prevMonthNav=nt("span","flatpickr-prev-month"),r.prevMonthNav.innerHTML=r.config.prevArrow,r.nextMonthNav=nt("span","flatpickr-next-month"),r.nextMonthNav.innerHTML=r.config.nextArrow,k(),Object.defineProperty(r,"_hidePrevMonthArrow",{get:function(){return r.__hidePrevMonthArrow},set:function(t){r.__hidePrevMonthArrow!==t&&(rt(r.prevMonthNav,"flatpickr-disabled",t),r.__hidePrevMonthArrow=t)}}),Object.defineProperty(r,"_hideNextMonthArrow",{get:function(){return r.__hideNextMonthArrow},set:function(t){r.__hideNextMonthArrow!==t&&(rt(r.nextMonthNav,"flatpickr-disabled",t),r.__hideNextMonthArrow=t)}}),r.currentYearElement=r.yearElements[0],ft(),r.monthNav)),r.innerContainer=nt("div","flatpickr-innerContainer"),r.config.weekNumbers){var e=function(){r.calendarContainer.classList.add("hasWeeks");var t=nt("div","flatpickr-weekwrapper");t.appendChild(nt("span","flatpickr-weekday",r.l10n.weekAbbreviation));var e=nt("div","flatpickr-weeks");return t.appendChild(e),{weekWrapper:t,weekNumbers:e}}(),n=e.weekWrapper,i=e.weekNumbers;r.innerContainer.appendChild(n),r.weekNumbers=i,r.weekWrapper=n}r.rContainer=nt("div","flatpickr-rContainer"),r.rContainer.appendChild(A()),r.daysContainer||(r.daysContainer=nt("div","flatpickr-days"),r.daysContainer.tabIndex=-1),b(),r.rContainer.appendChild(r.daysContainer),r.innerContainer.appendChild(r.rContainer),t.appendChild(r.innerContainer)}r.config.enableTime&&t.appendChild(function(){r.calendarContainer.classList.add("hasTime"),r.config.noCalendar&&r.calendarContainer.classList.add("noCalendar");var t=vt(r.config);r.timeContainer=nt("div","flatpickr-time"),r.timeContainer.tabIndex=-1;var e=nt("span","flatpickr-time-separator",":"),n=ot("flatpickr-hour",{"aria-label":r.l10n.hourAriaLabel});r.hourElement=n.getElementsByTagName("input")[0];var i=ot("flatpickr-minute",{"aria-label":r.l10n.minuteAriaLabel});r.minuteElement=i.getElementsByTagName("input")[0],r.hourElement.tabIndex=r.minuteElement.tabIndex=-1,r.hourElement.value=J(r.latestSelectedDateObj?r.latestSelectedDateObj.getHours():r.config.time_24hr?t.hours:function(t){switch(t%24){case 0:case 12:return 12;default:return t%12}}(t.hours)),r.minuteElement.value=J(r.latestSelectedDateObj?r.latestSelectedDateObj.getMinutes():t.minutes),r.hourElement.setAttribute("step",r.config.hourIncrement.toString()),r.minuteElement.setAttribute("step",r.config.minuteIncrement.toString()),r.hourElement.setAttribute("min",r.config.time_24hr?"0":"1"),r.hourElement.setAttribute("max",r.config.time_24hr?"23":"12"),r.hourElement.setAttribute("maxlength","2"),r.minuteElement.setAttribute("min","0"),r.minuteElement.setAttribute("max","59"),r.minuteElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(n),r.timeContainer.appendChild(e),r.timeContainer.appendChild(i),r.config.time_24hr&&r.timeContainer.classList.add("time24hr");if(r.config.enableSeconds){r.timeContainer.classList.add("hasSeconds");var a=ot("flatpickr-second");r.secondElement=a.getElementsByTagName("input")[0],r.secondElement.value=J(r.latestSelectedDateObj?r.latestSelectedDateObj.getSeconds():t.seconds),r.secondElement.setAttribute("step",r.minuteElement.getAttribute("step")),r.secondElement.setAttribute("min","0"),r.secondElement.setAttribute("max","59"),r.secondElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(nt("span","flatpickr-time-separator",":")),r.timeContainer.appendChild(a)}r.config.time_24hr||(r.amPM=nt("span","flatpickr-am-pm",r.l10n.amPM[Q((r.latestSelectedDateObj?r.hourElement.value:r.config.defaultHour)>11)]),r.amPM.title=r.l10n.toggleTitle,r.amPM.tabIndex=-1,r.timeContainer.appendChild(r.amPM));return r.timeContainer}());rt(r.calendarContainer,"rangeMode","range"===r.config.mode),rt(r.calendarContainer,"animate",!0===r.config.animate),rt(r.calendarContainer,"multiMonth",r.config.showMonths>1),r.calendarContainer.appendChild(t);var a=void 0!==r.config.appendTo&&void 0!==r.config.appendTo.nodeType;if((r.config.inline||r.config.static)&&(r.calendarContainer.classList.add(r.config.inline?"inline":"static"),r.config.inline&&(!a&&r.element.parentNode?r.element.parentNode.insertBefore(r.calendarContainer,r._input.nextSibling):void 0!==r.config.appendTo&&r.config.appendTo.appendChild(r.calendarContainer)),r.config.static)){var o=nt("div","flatpickr-wrapper");r.element.parentNode&&r.element.parentNode.insertBefore(o,r.element),o.appendChild(r.element),r.altInput&&o.appendChild(r.altInput),o.appendChild(r.calendarContainer)}r.config.static||r.config.inline||(void 0!==r.config.appendTo?r.config.appendTo:window.document.body).appendChild(r.calendarContainer)}(),function(){r.config.wrap&&["open","close","toggle","clear"].forEach((function(t){Array.prototype.forEach.call(r.element.querySelectorAll("[data-"+t+"]"),(function(e){return h(e,"click",r[t])}))}));if(r.isMobile)return void function(){var t=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=nt("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=t,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr="datetime-local"===t?"Y-m-d\\TH:i:S":"date"===t?"Y-m-d":"H:i:S",r.selectedDates.length>0&&(r.mobileInput.defaultValue=r.mobileInput.value=r.formatDate(r.selectedDates[0],r.mobileFormatStr));r.config.minDate&&(r.mobileInput.min=r.formatDate(r.config.minDate,"Y-m-d"));r.config.maxDate&&(r.mobileInput.max=r.formatDate(r.config.maxDate,"Y-m-d"));r.input.getAttribute("step")&&(r.mobileInput.step=String(r.input.getAttribute("step")));r.input.type="hidden",void 0!==r.altInput&&(r.altInput.type="hidden");try{r.input.parentNode&&r.input.parentNode.insertBefore(r.mobileInput,r.input.nextSibling)}catch(t){}h(r.mobileInput,"change",(function(t){r.setDate(st(t).value,!1,r.mobileFormatStr),$("onChange"),$("onClose")}))}();var t=tt(R,50);r._debouncedChange=tt(f,300),r.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&h(r.daysContainer,"mouseover",(function(t){"range"===r.config.mode&&O(st(t))}));h(r._input,"keydown",D),void 0!==r.calendarContainer&&h(r.calendarContainer,"keydown",D);r.config.inline||r.config.static||h(window,"resize",t);void 0!==window.ontouchstart?h(window.document,"touchstart",C):h(window.document,"mousedown",C);h(window.document,"focus",C,{capture:!0}),!0===r.config.clickOpens&&(h(r._input,"focus",r.open),h(r._input,"click",r.open));void 0!==r.daysContainer&&(h(r.monthNav,"click",kt),h(r.monthNav,["keyup","increment"],u),h(r.daysContainer,"click",q));if(void 0!==r.timeContainer&&void 0!==r.minuteElement&&void 0!==r.hourElement){var e=function(t){return st(t).select()};h(r.timeContainer,["increment"],o),h(r.timeContainer,"blur",o,{capture:!0}),h(r.timeContainer,"click",d),h([r.hourElement,r.minuteElement],["focus","click"],e),void 0!==r.secondElement&&h(r.secondElement,"focus",(function(){return r.secondElement&&r.secondElement.select()})),void 0!==r.amPM&&h(r.amPM,"click",(function(t){o(t)}))}r.config.allowInput&&h(r._input,"blur",z)}(),(r.selectedDates.length||r.config.noCalendar)&&(r.config.enableTime&&l(r.config.noCalendar?r.latestSelectedDateObj:void 0),wt(!1)),a();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!r.isMobile&&n&&N(),$("onReady")}(),r}function wt(t,e){for(var r=Array.prototype.slice.call(t).filter((function(t){return t instanceof HTMLElement})),n=[],i=0;it}if(null!=this.expression){const t=this.expression;return()=>this.parseExpression(t)}return null}parseExpression(t){const e=new Date;if(e.setMilliseconds(0),"now"===t.toLowerCase())return e;const r=t.match(/^\s*now\s*(-|\+)\s*(\d+)([dhms])\s*$/i);if(r){const[,t,n,i]=r;let a;switch(i.toLowerCase()){case"d":a=60*n*60*24;break;case"h":a=60*n*60;break;case"m":a=60*n;break;case"s":a=n;break;default:return null}return"-"===t&&(a=-a),c(l(e)+a)}return null}}class Mt{constructor(t,e){this.fromPicker=new At(t),this.toPicker=new At(e)}setDates(t,e){this.fromPicker.setDate(t),this.toPicker.setDate(e)}getDates(){return[this.fromPicker.getDate(),this.toPicker.getDate()]}getRawDates(){return[this.fromPicker.getRawDate(),this.toPicker.getRawDate()]}getDatesFactory(){const t=this.fromPicker.getDateFactory(),e=this.toPicker.getDateFactory();return()=>[t(),e()]}hasValidDates(){const t=this.fromPicker.getDate(),e=this.toPicker.getDate();return null!=t&&null!=e&&t<=e}}function St(){function t(t,e,r){e.forEach((e=>{const r=document.createElement("option");Array.isArray(e)&&2===e.length?(r.value=e[0],r.text=e[1]):(r.value=e,r.text=e),t.appendChild(r)})),t.value=r}const e=document.getElementById("range").timeRangePicker;try{e.setDates(...m())}catch{e.setDates(...m(!0))}const r=document.getElementById("refresh-interval");t(r,x,function(){try{let t=localStorage.getItem(v);if(null!=t&&(t=parseInt(t,10),_(t)))return t}catch(t){console.error(`Failed to read '${v}' from local storage!`,t)}return varnishmon.config.scraper.enabled?-1:0}()),r.addEventListener("change",(t=>{!function(t){if(_(t))try{localStorage.setItem(v,t)}catch(t){console.error(`Failed to write '${v}' to local storage!`,t)}else console.error("Invalid refresh interval value!",t)}(parseInt(t.target.value,10))}));const n=document.getElementById("filter");n.value=function(){try{let t=localStorage.getItem(b);if(null!=t)return t}catch(t){console.error(`Failed to read '${b}' from local storage!`,t)}return""}(),n.addEventListener("change",(t=>{!function(t){try{localStorage.setItem(b,t)}catch(t){console.error(`Failed to write '${b}' to local storage!`,t)}}(t.target.value)}));const i=document.getElementById("verbosity");t(i,A,function(){try{let t=localStorage.getItem(k);if(null!=t&&M(t))return t}catch(t){console.error(`Failed to read '${k}' from local storage!`,t)}return"normal"}()),i.addEventListener("change",(t=>{!function(t){if(M(t))try{localStorage.setItem(k,t)}catch(t){console.error(`Failed to write '${k}' to local storage!`,t)}else console.error("Invalid verbosity value!",t)}(t.target.value)}));const a=document.getElementById("columns");t(a,E,function(){try{let t=localStorage.getItem(S);if(null!=t&&(t=parseInt(t,10),C(t)))return t}catch(t){console.error(`Failed to read '${S}' from local storage!`,t)}return 3}()),a.addEventListener("change",(t=>{!function(t){if(C(t))try{localStorage.setItem(S,t)}catch(t){console.error(`Failed to write '${S}' to local storage!`,t)}else console.error("Invalid columns value!",t)}(parseInt(t.target.value,10))}));const o=document.getElementById("aggregator");t(o,L,function(){try{let t=localStorage.getItem(I);if(null!=t&&P(t))return t}catch(t){console.error(`Failed to read '${I}' from local storage!`,t)}return"avg"}()),o.addEventListener("change",(t=>{!function(t){if(P(t))try{localStorage.setItem(I,t)}catch(t){console.error(`Failed to write '${I}' to local storage!`,t)}else console.error("Invalid aggregator value!",t)}(t.target.value)}));const s=document.getElementById("step");s.min=varnishmon.config.scraper.period,s.value=function(){try{let t=localStorage.getItem(z);if(null!=t&&(t=parseInt(t,10),D(t)))return t}catch(t){console.error(`Failed to read '${z}' from local storage!`,t)}return varnishmon.config.scraper.period}(),s.addEventListener("change",(t=>{const e=parseInt(t.target.value,10);e>=varnishmon.config.scraper.period?function(t){if(D(t))try{localStorage.setItem(z,t)}catch(t){console.error(`Failed to write '${z}' to local storage!`,t)}else console.error("Invalid columns value!",t)}(e):(t.stopPropagation(),s.value=varnishmon.config.scraper.period,u("error",`Step must be at least ${varnishmon.config.scraper.period} seconds, which is the metrics scraping period`))}))}function Et(){let t=parseInt(document.getElementById("refresh-interval").value,10);return t<0&&(t=varnishmon.config.scraper.period),t}function Ct(){let t=parseInt(document.getElementById("step").value,10);return t{"Enter"===t.key&&document.getElementById("apply-time-range").click()})),document.getElementById("range-to").addEventListener("keydown",(t=>{"Enter"===t.key&&document.getElementById("apply-time-range").click()})),document.getElementById("apply-time-range").addEventListener("click",(t=>{const e=document.getElementById("range");if(!e.timeRangePicker.hasValidDates())return t.stopPropagation(),void u("error","The selected time range is invalid. ISO 8601 and relative expressions like 'now-1h', 'now', 'now-1d', etc. are allowed.");!function(t,e){y(f,t),y(p,e)}(...e.timeRangePicker.getRawDates()),e.initialRange=null,Lt()})),document.getElementById("refresh-interval").addEventListener("change",(()=>{let t=Et();document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart.setRefreshInterval(t)}))})),document.getElementById("refresh").addEventListener("click",(()=>{document.getElementById("clusters").querySelectorAll(".chart").forEach((t=>{t.chart.refresh()}))})),document.getElementById("filter").addEventListener("input",s(Pt,500)),document.getElementById("verbosity").addEventListener("change",Pt),document.getElementById("columns").addEventListener("change",Pt),document.getElementById("filter").addEventListener("change",(t=>{const e=t.target.value;if(e){const t=T(),r=t.indexOf(e);0!==r&&(-1!==r&&t.splice(r,1),t.unshift(e),t.length>10&&t.pop(),function(t){try{localStorage.setItem(w,JSON.stringify(t))}catch(t){console.error(`Failed to write '${w}' to local storage!`,t)}}(t)),zt()}})),document.getElementById("aggregator").addEventListener("change",(t=>{document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart.setAggregator(t.target.value)}))})),document.getElementById("step").addEventListener("change",(()=>{const t=Ct();document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart.setStep(t)}))})),document.getElementById("reset").addEventListener("click",(()=>{!function(){for(let t=localStorage.length-1;t>=0;t--)try{const e=localStorage.key(t);e.startsWith(h)&&localStorage.removeItem(e)}catch(t){console.error("Failed to remove item from local storage!",t)}}(),location.reload()})),document.getElementById("collapse-all").addEventListener("click",(()=>{document.getElementById("clusters").querySelectorAll(".cluster").forEach((t=>{e().getInstance(t.querySelector(".accordion-collapse")).hide(),t.querySelector(".accordion-button").classList.add("collapsed")}))})),document.getElementById("expand-all").addEventListener("click",(()=>{document.getElementById("clusters").querySelectorAll(".cluster").forEach((t=>{e().getInstance(t.querySelector(".accordion-collapse")).show(),t.querySelector(".accordion-button").classList.remove("collapsed")}))}))}async function Lt(){const t=document.getElementById("clusters");t.querySelectorAll(".chart").forEach((t=>{t.chart.destroy()})),t.innerHTML="",t.appendChild(document.getElementById("spinner-template").content.cloneNode(!0).firstElementChild);const r=document.getElementById("range").timeRangePicker.getDatesFactory(),n=Et(),i=document.getElementById("aggregator").value,a=Ct();let o;try{const[t,e]=r();o=await async function(t,e,r){const n=new URLSearchParams({from:l(t),to:l(e),step:r}),i=await fetch(`/storage/metrics?${n.toString()}`);if(!i.ok)throw new Error(`Unexpected API response (${i.status}): ${i.statusText}`);const a=await i.json();return{from:c(a.from),to:c(a.to),step:a.step,clusters:j(a.metrics)}}(t,e,a)}catch(e){return t.innerHTML="",t.appendChild(document.getElementById("metrics-meditation-template").content.cloneNode(!0).firstElementChild),void u("error",`Failed to fetch metrics: ${e}`)}const s=o.clusters.length;u("info",`Fetched ${o.clusters.reduce(((t,e)=>t+e.metrics.length),0)} metrics organized in ${s} clusters`);const h=document.getElementById("cluster-template"),f=document.getElementById("chart-template");t.innerHTML="",o.clusters.forEach((o=>{const s=h.content.cloneNode(!0).firstElementChild;s.querySelector(".cluster-name").textContent=o.name,t.appendChild(s);const l=new(e())(s.querySelector(".accordion-collapse"));s.querySelector(".accordion-button").addEventListener("click",(t=>{t.currentTarget.classList.toggle("collapsed"),l.toggle()}));const c=s.querySelector(".charts");o.metrics.forEach((t=>{const e=f.content.cloneNode(!0).firstElementChild,o=new W(e,t,r,n,i,a);o.addEventListener("zoom",(t=>{document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart!==t.target&&e.chart.setZoomRange(t.range)}));const e=document.getElementById("range");null!=t.range?(null==e.initialRange&&(e.initialRange=e.timeRangePicker.getRawDates()),e.timeRangePicker.setDates(...t.range)):null!=e.initialRange&&(e.timeRangePicker.setDates(...e.initialRange),e.initialRange=null)})),e.chart=o,c.appendChild(e)}))})),Pt()}function Pt(){const t=document.getElementById("clusters");t.querySelectorAll(".chart").forEach((t=>{t.chart.redraw(document.getElementById("filter").value,document.getElementById("verbosity").value,parseInt(document.getElementById("columns").value,10))})),t.querySelectorAll(".cluster").forEach((t=>{0===t.querySelectorAll(".chart:not(.d-none)").length?t.classList.add("d-none"):t.classList.remove("d-none")}));const e=t.querySelectorAll(".cluster").length,r=t.querySelectorAll(".cluster:not(.d-none)").length,n=t.querySelectorAll(".chart").length,i=t.querySelectorAll(".chart:not(.d-none)").length;document.getElementById("filter-stats").textContent=`${i} metrics found (${n-i} hidden), organized in ${r} clusters (${e-r} hidden)`}function zt(){const t=document.getElementById("filterHistoryList");t.innerHTML="",T().forEach((e=>{const r=document.createElement("li");r.classList.add("dropdown-item"),r.textContent=e,r.addEventListener("click",(()=>{const t=document.getElementById("filter");t.value=e,t.dispatchEvent(new Event("change")),Pt()})),t.appendChild(r)}))}document.addEventListener("DOMContentLoaded",(async()=>{!function(){const t=new MutationObserver(((e,r)=>{for(const r of e)"childList"===r.type&&r.addedNodes.forEach((e=>{if(e.classList&&e.classList.contains("plotly-notifier")){e.style.display="none",t.disconnect(),e.querySelectorAll(".notifier-note").forEach((t=>{u("info",t.querySelector("span").innerText)}));const r=new MutationObserver(((t,e)=>{for(const e of t)"childList"===e.type&&e.addedNodes.forEach((t=>{t.classList&&t.classList.contains("notifier-note")&&u("info",t.querySelector("span").innerText)}))}));r.observe(e,{childList:!0})}}))}));t.observe(document.body,{childList:!0})}(),document.getElementById("range").timeRangePicker=new Mt(document.getElementById("range-from"),document.getElementById("range-to")),St(),It(),new(i())(document.getElementById("filterHistoryList")),zt(),Lt()}))})()})(); \ No newline at end of file +*/return window.Plotly=t,t},t.exports?t.exports=s():o.moduleName=s()},785:t=>{"use strict";t.exports=function(t){for(var e=t.length,r=new Array(e),n=new Array(e),i=new Array(e),a=new Array(e),o=new Array(e),s=new Array(e),l=0;l0;){e=c[c.length-1];var p=t[e];if(a[e]=0&&s[e].push(o[m])}a[e]=d}else{if(n[e]===r[e]){var g=[],y=[],v=0;for(d=l.length-1;d>=0;--d){var x=l[d];if(i[x]=!1,g.push(x),y.push(s[x]),v+=s[x].length,o[x]=h.length,x===e){l.length=d;break}}h.push(g);var _=new Array(v);for(d=0;d{"use strict";function n(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}r.d(e,{A:()=>n})},37:(t,e,r)=>{"use strict";r.d(e,{A:()=>a});var n=r(902),i=r(180);function a(t){let e,r,a;function s(t,n,i=0,a=t.length){if(i>>1;r(t[e],n)<0?i=e+1:a=e}while(i(0,n.A)(t(e),r),a=(e,r)=>t(e)-r):(e=t===n.A||t===i.A?t:o,r=t,a=t),{left:s,center:function(t,e,r=0,n=t.length){const i=s(t,e,r,n-1);return i>r&&a(t[i-1],e)>-a(t[i],e)?i-1:i},right:function(t,n,i=0,a=t.length){if(i>>1;r(t[e],n)<=0?i=e+1:a=e}while(i{"use strict";function n(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}r.d(e,{A:()=>n})},47:(t,e,r)=>{"use strict";r.d(e,{KS:()=>i,Nn:()=>a,ph:()=>n});class n{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let n=0;n0){for(a=t[--i];i>0&&(e=a,r=t[--i],a=e+r,n=r-(a-e),!n););i>0&&(n<0&&t[i-1]<0||n>0&&t[i-1]>0)&&(r=2*n,e=a+r,r==e-a&&(a=e))}return a}}function i(t,e){const r=new n;if(void 0===e)for(let e of t)(e=+e)&&r.add(e);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&r.add(i)}return+r}function a(t,e){const r=new n;let i=-1;return Float64Array.from(t,void 0===e?t=>r.add(+t||0):n=>r.add(+e(n,++i,t)||0))}},882:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Adder:()=>E.ph,InternMap:()=>C,InternSet:()=>I,ascending:()=>n.A,bin:()=>it,bisect:()=>u,bisectCenter:()=>c,bisectLeft:()=>l,bisectRight:()=>s,bisector:()=>i.A,blur:()=>h,blur2:()=>f,blurImage:()=>p,count:()=>v,cross:()=>w,cumsum:()=>T,descending:()=>k.A,deviation:()=>M,difference:()=>Vt,disjoint:()=>qt,every:()=>Rt,extent:()=>S,fcumsum:()=>E.Nn,filter:()=>jt,flatGroup:()=>B,flatRollup:()=>N,fsum:()=>E.KS,greatest:()=>ht,greatestIndex:()=>Et,group:()=>R,groupSort:()=>K,groups:()=>F,histogram:()=>it,index:()=>q,indexes:()=>H,intersection:()=>Ht,least:()=>Mt,leastIndex:()=>St,map:()=>Bt,max:()=>at,maxIndex:()=>ot,mean:()=>yt,median:()=>vt,medianIndex:()=>xt,merge:()=>_t.A,min:()=>st,minIndex:()=>lt,mode:()=>bt,nice:()=>rt,pairs:()=>wt,permute:()=>W,quantile:()=>ft,quantileIndex:()=>dt,quantileSorted:()=>pt,quickselect:()=>ct,range:()=>kt.A,rank:()=>At,reduce:()=>Nt,reverse:()=>Ut,rollup:()=>U,rollups:()=>V,scan:()=>Ct,shuffle:()=>It,shuffler:()=>Lt,some:()=>Ft,sort:()=>Y,subset:()=>Yt,sum:()=>Pt,superset:()=>Zt,thresholdFreedmanDiaconis:()=>mt,thresholdScott:()=>gt,thresholdSturges:()=>nt,tickIncrement:()=>et.lq,tickStep:()=>et.sG,ticks:()=>et.Ay,transpose:()=>zt,union:()=>Xt,variance:()=>A,zip:()=>Ot});var n=r(902),i=r(37);function a(t){return null===t?NaN:+t}const o=(0,i.A)(n.A),s=o.right,l=o.left,c=(0,i.A)(a).center,u=s;function h(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let r=t.length;if(!((r=Math.floor(r))>=0))throw new RangeError("invalid length");if(!r||!e)return t;const n=y(e),i=t.slice();return n(t,i,0,r,1),n(i,t,0,r,1),n(t,i,0,r,1),t}const f=d(y),p=d((function(t){const e=y(t);return(t,r,n,i,a)=>{e(t,r,(n<<=2)+0,(i<<=2)+0,a<<=2),e(t,r,n+1,i+1,a),e(t,r,n+2,i+2,a),e(t,r,n+3,i+3,a)}}));function d(t){return function(e,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:a,height:o}=e;if(!((a=Math.floor(a))>=0))throw new RangeError("invalid width");if(!((o=Math.floor(void 0!==o?o:i.length/a))>=0))throw new RangeError("invalid height");if(!a||!o||!r&&!n)return e;const s=r&&t(r),l=n&&t(n),c=i.slice();return s&&l?(m(s,c,i,a,o),m(s,i,c,a,o),m(s,c,i,a,o),g(l,i,c,a,o),g(l,c,i,a,o),g(l,i,c,a,o)):s?(m(s,i,c,a,o),m(s,c,i,a,o),m(s,i,c,a,o)):l&&(g(l,i,c,a,o),g(l,c,i,a,o),g(l,i,c,a,o)),e}}function m(t,e,r,n,i){for(let a=0,o=n*i;a{if(!((a-=o)>=i))return;let s=t*n[i];const l=o*t;for(let t=i,e=i+l;t{if(!((o-=s)>=a))return;let l=e*i[a];const c=s*e,u=c+s;for(let t=a,e=a+c;t=e&&++r;else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(i=+i)>=i&&++r}return r}function x(t){return 0|t.length}function _(t){return!(t>0)}function b(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function w(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),r=(t=t.map(b)).map(x),n=t.length-1,i=new Array(n+1).fill(0),a=[];if(n<0||r.some(_))return a;for(;;){a.push(i.map(((e,r)=>t[r][e])));let o=n;for(;++i[o]===r[o];){if(0===o)return e?a.map(e):a;i[o--]=0}}}function T(t,e){var r=0,n=0;return Float64Array.from(t,void 0===e?t=>r+=+t||0:i=>r+=+e(i,n++,t)||0)}var k=r(180);function A(t,e){let r,n=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(r=e-i,i+=r/++n,a+=r*(e-i));else{let o=-1;for(let s of t)null!=(s=e(s,++o,t))&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i))}if(n>1)return a/(n-1)}function M(t,e){const r=A(t,e);return r?Math.sqrt(r):r}function S(t,e){let r,n;if(void 0===e)for(const e of t)null!=e&&(void 0===r?e>=e&&(r=n=e):(r>e&&(r=e),n=a&&(r=n=a):(r>a&&(r=a),nt.pop().map((([e,r])=>[...t,e,r]))));return t}function B(t,...e){return j(F(t,...e),e)}function N(t,e,...r){return j(V(t,e,...r),r)}function U(t,e,...r){return Z(t,O,e,r)}function V(t,e,...r){return Z(t,Array.from,e,r)}function q(t,...e){return Z(t,O,G,e)}function H(t,...e){return Z(t,Array.from,G,e)}function G(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function Z(t,e,r,n){return function t(i,a){if(a>=n.length)return r(i);const o=new C,s=n[a++];let l=-1;for(const t of i){const e=s(t,++l,i),r=o.get(e);r?r.push(t):o.set(e,[t])}for(const[e,r]of o)o.set(e,t(r,a));return e(o)}(t,0)}function W(t,e){return Array.from(e,(e=>t[e]))}function Y(t,...e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[r]=e;if(r&&2!==r.length||e.length>1){const n=Uint32Array.from(t,((t,e)=>e));return e.length>1?(e=e.map((e=>t.map(e))),n.sort(((t,r)=>{for(const n of e){const e=$(n[t],n[r]);if(e)return e}}))):(r=t.map(r),n.sort(((t,e)=>$(r[t],r[e])))),W(t,n)}return t.sort(X(r))}function X(t=n.A){if(t===n.A)return $;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}function $(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}function K(t,e,r){return(2!==e.length?Y(U(t,e,r),(([t,e],[r,i])=>(0,n.A)(e,i)||(0,n.A)(t,r))):Y(R(t,r),(([t,r],[i,a])=>e(r,a)||(0,n.A)(t,i)))).map((([t])=>t))}var J=Array.prototype,Q=J.slice;J.map;function tt(t){return()=>t}var et=r(946);function rt(t,e,r){let n;for(;;){const i=(0,et.lq)(t,e,r);if(i===n||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}function nt(t){return Math.max(1,Math.ceil(Math.log(v(t))/Math.LN2)+1)}function it(){var t=O,e=S,r=nt;function n(n){Array.isArray(n)||(n=Array.from(n));var i,a,o,s=n.length,l=new Array(s);for(i=0;i=f)if(t>=f&&e===S){const t=(0,et.lq)(h,f,r);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*-t)+1)/-t))}else p.pop()}for(var d=p.length,m=0,g=d;p[m]<=h;)++m;for(;p[g-1]>f;)--g;(m||g0?p[i-1]:h,y.x1=i0)for(i=0;i=e)&&(r=e);else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(r=i)&&(r=i)}return r}function ot(t,e){let r,n=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(r=e)&&(r=e,n=i);else for(let a of t)null!=(a=e(a,++i,t))&&(r=a)&&(r=a,n=i);return n}function st(t,e){let r;if(void 0===e)for(const e of t)null!=e&&(r>e||void 0===r&&e>=e)&&(r=e);else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&(r>i||void 0===r&&i>=i)&&(r=i)}return r}function lt(t,e){let r,n=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(r>e||void 0===r&&e>=e)&&(r=e,n=i);else for(let a of t)null!=(a=e(a,++i,t))&&(r>a||void 0===r&&a>=a)&&(r=a,n=i);return n}function ct(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=void 0===i?$:X(i);n>r;){if(n-r>600){const a=n-r+1,o=e-r+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);ct(t,e,Math.max(r,Math.floor(e-o*l/a+c)),Math.min(n,Math.floor(e+(a-o)*l/a+c)),i)}const a=t[e];let o=r,s=n;for(ut(t,r,e),i(t[n],a)>0&&ut(t,r,n);o0;)--s}0===i(t[r],a)?ut(t,r,s):(++s,ut(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}return t}function ut(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function ht(t,e=n.A){let r,i=!1;if(1===e.length){let a;for(const o of t){const t=e(o);(i?(0,n.A)(t,a)>0:0===(0,n.A)(t,t))&&(r=o,a=t,i=!0)}}else for(const n of t)(i?e(n,r)>0:0===e(n,n))&&(r=n,i=!0);return r}function ft(t,e,r){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,r)),(n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return st(t);if(e>=1)return at(t);var n,i=(n-1)*e,a=Math.floor(i),o=at(ct(t,a).subarray(0,a+1));return o+(st(t.subarray(a+1))-o)*(i-a)}}function pt(t,e,r=a){if((n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,o=Math.floor(i),s=+r(t[o],o,t);return s+(+r(t[o+1],o+1,t)-s)*(i-o)}}function dt(t,e,r=a){if(!isNaN(e=+e)){if(n=Float64Array.from(t,((e,n)=>a(r(t[n],n,t)))),e<=0)return lt(n);if(e>=1)return ot(n);var n,i=Uint32Array.from(t,((t,e)=>e)),o=n.length-1,s=Math.floor(o*e);return ct(i,s,0,o,((t,e)=>$(n[t],n[e]))),(s=ht(i.subarray(0,s+1),(t=>n[t])))>=0?s:-1}}function mt(t,e,r){const n=v(t),i=ft(t,.75)-ft(t,.25);return n&&i?Math.ceil((r-e)/(2*i*Math.pow(n,-1/3))):1}function gt(t,e,r){const n=v(t),i=M(t);return n&&i?Math.ceil((r-e)*Math.cbrt(n)/(3.49*i)):1}function yt(t,e){let r=0,n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++r,n+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++r,n+=a)}if(r)return n/r}function vt(t,e){return ft(t,.5,e)}function xt(t,e){return dt(t,.5,e)}var _t=r(128);function bt(t,e){const r=new C;if(void 0===e)for(let e of t)null!=e&&e>=e&&r.set(e,(r.get(e)||0)+1);else{let n=-1;for(let i of t)null!=(i=e(i,++n,t))&&i>=i&&r.set(i,(r.get(i)||0)+1)}let n,i=0;for(const[t,e]of r)e>i&&(i=e,n=t);return n}function wt(t,e=Tt){const r=[];let n,i=!1;for(const a of t)i&&r.push(e(n,a)),n=a,i=!0;return r}function Tt(t,e){return[t,e]}var kt=r(561);function At(t,e=n.A){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(t);const i=new Float64Array(r.length);2!==e.length&&(r=r.map(e),e=n.A);const a=(t,n)=>e(r[t],r[n]);let o,s;return(t=Uint32Array.from(r,((t,e)=>e))).sort(e===n.A?(t,e)=>$(r[t],r[e]):X(a)),t.forEach(((t,e)=>{const r=a(t,void 0===o?t:o);r>=0?((void 0===o||r>0)&&(o=t,s=e),i[t]=s):i[t]=NaN})),i}function Mt(t,e=n.A){let r,i=!1;if(1===e.length){let a;for(const o of t){const t=e(o);(i?(0,n.A)(t,a)<0:0===(0,n.A)(t,t))&&(r=o,a=t,i=!0)}}else for(const n of t)(i?e(n,r)<0:0===e(n,n))&&(r=n,i=!0);return r}function St(t,e=n.A){if(1===e.length)return lt(t,e);let r,i=-1,a=-1;for(const n of t)++a,(i<0?0===e(n,n):e(n,r)<0)&&(r=n,i=a);return i}function Et(t,e=n.A){if(1===e.length)return ot(t,e);let r,i=-1,a=-1;for(const n of t)++a,(i<0?0===e(n,n):e(n,r)>0)&&(r=n,i=a);return i}function Ct(t,e){const r=St(t,e);return r<0?void 0:r}const It=Lt(Math.random);function Lt(t){return function(e,r=0,n=e.length){let i=n-(r=+r);for(;i;){const n=t()*i--|0,a=e[i+r];e[i+r]=e[n+r],e[n+r]=a}return e}}function Pt(t,e){let r=0;if(void 0===e)for(let e of t)(e=+e)&&(r+=e);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&(r+=i)}return r}function zt(t){if(!(i=t.length))return[];for(var e=-1,r=st(t,Dt),n=new Array(r);++ee(r,n,t)))}function Nt(t,e,r){if("function"!=typeof e)throw new TypeError("reducer is not a function");const n=t[Symbol.iterator]();let i,a,o=-1;if(arguments.length<3){if(({done:i,value:r}=n.next()),i)return;++o}for(;({done:i,value:a}=n.next()),!i;)r=e(r,a,++o,t);return r}function Ut(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()}function Vt(t,...e){t=new I(t);for(const r of e)for(const e of r)t.delete(e);return t}function qt(t,e){const r=e[Symbol.iterator](),n=new I;for(const e of t){if(n.has(e))return!1;let t,i;for(;({value:t,done:i}=r.next())&&!i;){if(Object.is(e,t))return!1;n.add(t)}}return!0}function Ht(t,...e){t=new I(t),e=e.map(Gt);t:for(const r of t)for(const n of e)if(!n.has(r)){t.delete(r);continue t}return t}function Gt(t){return t instanceof I?t:new I(t)}function Zt(t,e){const r=t[Symbol.iterator](),n=new Set;for(const t of e){const e=Wt(t);if(n.has(e))continue;let i,a;for(;({value:i,done:a}=r.next());){if(a)return!1;const t=Wt(i);if(n.add(t),Object.is(e,t))break}}return!0}function Wt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Yt(t,e){return Zt(e,t)}function Xt(...t){const e=new I;for(const r of t)for(const t of r)e.add(t);return e}},128:(t,e,r)=>{"use strict";function n(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}r.d(e,{A:()=>n})},561:(t,e,r)=>{"use strict";function n(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),a=new Array(i);++nn})},946:(t,e,r)=>{"use strict";r.d(e,{Ay:()=>s,lq:()=>l,sG:()=>c});const n=Math.sqrt(50),i=Math.sqrt(10),a=Math.sqrt(2);function o(t,e,r){const s=(e-t)/Math.max(0,r),l=Math.floor(Math.log10(s)),c=s/Math.pow(10,l),u=c>=n?10:c>=i?5:c>=a?2:1;let h,f,p;return l<0?(p=Math.pow(10,-l)/u,h=Math.round(t*p),f=Math.round(e*p),h/pe&&--f,p=-p):(p=Math.pow(10,l)*u,h=Math.round(t/p),f=Math.round(e/p),h*pe&&--f),f0))return[];if((t=+t)===(e=+e))return[t];const n=e=i))return[];const l=a-i+1,c=new Array(l);if(n)if(s<0)for(let t=0;t{"use strict";r.r(e),r.d(e,{dispatch:()=>l});var n={value:()=>{}};function i(){for(var t,e=0,r=arguments.length,n={};e=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),l=-1,c=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l0)for(var r,n,i=new Array(r),a=0;a{"use strict";r.r(e),r.d(e,{geoAlbers:()=>An,geoAlbersUsa:()=>Mn,geoArea:()=>it,geoAzimuthalEqualArea:()=>In,geoAzimuthalEqualAreaRaw:()=>Cn,geoAzimuthalEquidistant:()=>Pn,geoAzimuthalEquidistantRaw:()=>Ln,geoBounds:()=>Bt,geoCentroid:()=>Kt,geoCircle:()=>le,geoClipAntimeridian:()=>_e,geoClipCircle:()=>be,geoClipExtent:()=>Ce,geoClipRectangle:()=>Ee,geoConicConformal:()=>jn,geoConicConformalRaw:()=>Fn,geoConicEqualArea:()=>kn,geoConicEqualAreaRaw:()=>Tn,geoConicEquidistant:()=>Vn,geoConicEquidistantRaw:()=>Un,geoContains:()=>Ze,geoDistance:()=>Fe,geoEqualEarth:()=>Xn,geoEqualEarthRaw:()=>Yn,geoEquirectangular:()=>Nn,geoEquirectangularRaw:()=>Bn,geoGnomonic:()=>Kn,geoGnomonicRaw:()=>$n,geoGraticule:()=>$e,geoGraticule10:()=>Ke,geoIdentity:()=>Jn,geoInterpolate:()=>Je,geoLength:()=>De,geoMercator:()=>Dn,geoMercatorRaw:()=>zn,geoNaturalEarth1:()=>ti,geoNaturalEarth1Raw:()=>Qn,geoOrthographic:()=>ri,geoOrthographicRaw:()=>ei,geoPath:()=>on,geoProjection:()=>_n,geoProjectionMutator:()=>bn,geoRotation:()=>ae,geoStereographic:()=>ii,geoStereographicRaw:()=>ni,geoStream:()=>D,geoTransform:()=>sn,geoTransverseMercator:()=>oi,geoTransverseMercatorRaw:()=>ai});var n=r(47),i=1e-6,a=1e-12,o=Math.PI,s=o/2,l=o/4,c=2*o,u=180/o,h=o/180,f=Math.abs,p=Math.atan,d=Math.atan2,m=Math.cos,g=Math.ceil,y=Math.exp,v=(Math.floor,Math.hypot),x=Math.log,_=Math.pow,b=Math.sin,w=Math.sign||function(t){return t>0?1:t<0?-1:0},T=Math.sqrt,k=Math.tan;function A(t){return t>1?0:t<-1?o:Math.acos(t)}function M(t){return t>1?s:t<-1?-s:Math.asin(t)}function S(t){return(t=b(t/2))*t}function E(){}function C(t,e){t&&L.hasOwnProperty(t.type)&&L[t.type](t,e)}var I={Feature:function(t,e){C(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,i=n*r,a=m(e=(e*=h)/2+l),o=b(e),s=B*o,c=j*a+s*m(i),u=s*n*b(i);K.add(d(u,c)),F=t,j=a,B=o}function it(t){return J=new n.ph,D(t,Q),2*J}function at(t){return[d(t[1],t[0]),M(t[2])]}function ot(t){var e=t[0],r=t[1],n=m(r);return[n*m(e),n*b(e),b(r)]}function st(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function lt(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function ct(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ut(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ht(t){var e=T(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var ft,pt,dt,mt,gt,yt,vt,xt,_t,bt,wt,Tt,kt,At,Mt,St,Et={point:Ct,lineStart:Lt,lineEnd:Pt,polygonStart:function(){Et.point=zt,Et.lineStart=Dt,Et.lineEnd=Ot,Y=new n.ph,Q.polygonStart()},polygonEnd:function(){Q.polygonEnd(),Et.point=Ct,Et.lineStart=Lt,Et.lineEnd=Pt,K<0?(N=-(V=180),U=-(q=90)):Y>i?q=90:Y<-i&&(U=-90),$[0]=N,$[1]=V},sphere:function(){N=-(V=180),U=-(q=90)}};function Ct(t,e){X.push($=[N=t,V=t]),eq&&(q=e)}function It(t,e){var r=ot([t*h,e*h]);if(W){var n=lt(W,r),i=lt([n[1],-n[0],0],n);ht(i),i=at(i);var a,o=t-H,s=o>0?1:-1,l=i[0]*u*s,c=f(o)>180;c^(s*Hq&&(q=a):c^(s*H<(l=(l+360)%360-180)&&lq&&(q=e)),c?tRt(N,V)&&(V=t):Rt(t,V)>Rt(N,V)&&(N=t):V>=N?(tV&&(V=t)):t>H?Rt(N,t)>Rt(N,V)&&(V=t):Rt(t,V)>Rt(N,V)&&(N=t)}else X.push($=[N=t,V=t]);eq&&(q=e),W=r,H=t}function Lt(){Et.point=It}function Pt(){$[0]=N,$[1]=V,Et.point=Ct,W=null}function zt(t,e){if(W){var r=t-H;Y.add(f(r)>180?r+(r>0?360:-360):r)}else G=t,Z=e;Q.point(t,e),It(t,e)}function Dt(){Q.lineStart()}function Ot(){zt(G,Z),Q.lineEnd(),f(Y)>i&&(N=-(V=180)),$[0]=N,$[1]=V,W=null}function Rt(t,e){return(e-=t)<0?e+360:e}function Ft(t,e){return t[0]-e[0]}function jt(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:eRt(n[0],n[1])&&(n[1]=i[1]),Rt(i[0],n[1])>Rt(n[0],n[1])&&(n[0]=i[0])):a.push(n=i);for(o=-1/0,e=0,n=a[r=a.length-1];e<=r;n=i,++e)i=a[e],(s=Rt(n[1],i[0]))>o&&(o=s,N=i[0],V=n[1])}return X=$=null,N===1/0||U===1/0?[[NaN,NaN],[NaN,NaN]]:[[N,U],[V,q]]}var Nt={sphere:E,point:Ut,lineStart:qt,lineEnd:Zt,polygonStart:function(){Nt.lineStart=Wt,Nt.lineEnd=Yt},polygonEnd:function(){Nt.lineStart=qt,Nt.lineEnd=Zt}};function Ut(t,e){t*=h;var r=m(e*=h);Vt(r*m(t),r*b(t),b(e))}function Vt(t,e,r){++ft,dt+=(t-dt)/ft,mt+=(e-mt)/ft,gt+=(r-gt)/ft}function qt(){Nt.point=Ht}function Ht(t,e){t*=h;var r=m(e*=h);At=r*m(t),Mt=r*b(t),St=b(e),Nt.point=Gt,Vt(At,Mt,St)}function Gt(t,e){t*=h;var r=m(e*=h),n=r*m(t),i=r*b(t),a=b(e),o=d(T((o=Mt*a-St*i)*o+(o=St*n-At*a)*o+(o=At*i-Mt*n)*o),At*n+Mt*i+St*a);pt+=o,yt+=o*(At+(At=n)),vt+=o*(Mt+(Mt=i)),xt+=o*(St+(St=a)),Vt(At,Mt,St)}function Zt(){Nt.point=Ut}function Wt(){Nt.point=Xt}function Yt(){$t(Tt,kt),Nt.point=Ut}function Xt(t,e){Tt=t,kt=e,t*=h,e*=h,Nt.point=$t;var r=m(e);At=r*m(t),Mt=r*b(t),St=b(e),Vt(At,Mt,St)}function $t(t,e){t*=h;var r=m(e*=h),n=r*m(t),i=r*b(t),a=b(e),o=Mt*a-St*i,s=St*n-At*a,l=At*i-Mt*n,c=v(o,s,l),u=M(c),f=c&&-u/c;_t.add(f*o),bt.add(f*s),wt.add(f*l),pt+=u,yt+=u*(At+(At=n)),vt+=u*(Mt+(Mt=i)),xt+=u*(St+(St=a)),Vt(At,Mt,St)}function Kt(t){ft=pt=dt=mt=gt=yt=vt=xt=0,_t=new n.ph,bt=new n.ph,wt=new n.ph,D(t,Nt);var e=+_t,r=+bt,o=+wt,s=v(e,r,o);return so&&(t-=Math.round(t/c)*c),[t,e]}function ee(t,e,r){return(t%=c)?e||r?Qt(ne(t),ie(e,r)):ne(t):e||r?ie(e,r):te}function re(t){return function(e,r){return f(e+=t)>o&&(e-=Math.round(e/c)*c),[e,r]}}function ne(t){var e=re(t);return e.invert=re(-t),e}function ie(t,e){var r=m(t),n=b(t),i=m(e),a=b(e);function o(t,e){var o=m(e),s=m(t)*o,l=b(t)*o,c=b(e),u=c*r+s*n;return[d(l*i-u*a,s*r-c*n),M(u*i+l*a)]}return o.invert=function(t,e){var o=m(e),s=m(t)*o,l=b(t)*o,c=b(e),u=c*i-l*a;return[d(l*i+c*a,s*r+u*n),M(u*r-s*n)]},o}function ae(t){function e(e){return(e=t(e[0]*h,e[1]*h))[0]*=u,e[1]*=u,e}return t=ee(t[0]*h,t[1]*h,t.length>2?t[2]*h:0),e.invert=function(e){return(e=t.invert(e[0]*h,e[1]*h))[0]*=u,e[1]*=u,e},e}function oe(t,e,r,n,i,a){if(r){var o=m(e),s=b(e),l=n*r;null==i?(i=e+n*c,a=e-l/2):(i=se(o,i),a=se(o,a),(n>0?ia)&&(i+=n*c));for(var u,h=i;n>0?h>a:h1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function ue(t,e){return f(t[0]-e[0])=0;--o)a.point((h=u[o])[0],h[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,d=!d}while(!p.v);a.lineEnd()}}}function pe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,F=R*O,j=F>o,B=S*z;if(y.add(d(B*R*b(F),E*D+B*m(F))),p+=j?O+R*c:O,j^k>=r^L>=r){var N=lt(ot(T),ot(I));ht(N);var U=lt(f,N);ht(U);var V=(j^O>=0?-1:1)*M(U[2]);(u>V||u===V&&(N[0]||N[1]))&&(g+=j^O>=0?1:-1)}}return(p<-i||p0){for(h||(i.polygonStart(),h=!0),i.lineStart(),t=0;t1&&2&l&&f.push(f.pop().concat(f.shift())),o.push(f.filter(ve))}return f}}function ve(t){return t.length>1}function xe(t,e){return((t=t.x)[0]<0?t[1]-s-i:s-t[1])-((e=e.x)[0]<0?e[1]-s-i:s-e[1])}const _e=ye((function(){return!0}),(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(l,c){var u=l>0?o:-o,h=f(l-r);f(h-o)0?s:-s),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(l,n),e=0):a!==u&&h>=o&&(f(r-a)i?p((b(e)*(o=m(n))*b(r)-b(n)*(a=m(e))*b(t))/(a*o*s)):(e+n)/2}(r,n,l,c),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(u,n),e=0),t.point(r=l,n=c),a=u},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*s,n.point(-o,a),n.point(0,a),n.point(o,a),n.point(o,0),n.point(o,-a),n.point(0,-a),n.point(-o,-a),n.point(-o,0),n.point(-o,a);else if(f(t[0]-e[0])>i){var l=t[0]0,a=f(e)>i;function s(t,r){return m(t)*m(r)>e}function l(t,r,n){var a=[1,0,0],s=lt(ot(t),ot(r)),l=st(s,s),c=s[0],u=l-c*c;if(!u)return!n&&t;var h=e*l/u,p=-e*c/u,d=lt(a,s),m=ut(a,h);ct(m,ut(s,p));var g=d,y=st(m,g),v=st(g,g),x=y*y-v*(st(m,m)-1);if(!(x<0)){var _=T(x),b=ut(g,(-y-_)/v);if(ct(b,m),b=at(b),!n)return b;var w,k=t[0],A=r[0],M=t[1],S=r[1];A0^b[1]<(f(b[0]-k)o^(k<=b[0]&&b[0]<=A)){var I=ut(g,(-y+_)/v);return ct(I,m),[b,at(I)]}}}function c(e,r){var i=n?t:o-t,a=0;return e<-i?a|=1:e>i&&(a|=2),r<-i?a|=4:r>i&&(a|=8),a}return ye(s,(function(t){var e,r,i,u,h;return{lineStart:function(){u=i=!1,h=1},point:function(f,p){var d,m=[f,p],g=s(f,p),y=n?g?0:c(f,p):g?c(f+(f<0?o:-o),p):0;if(!e&&(u=i=g)&&t.lineStart(),g!==i&&(!(d=l(e,m))||ue(e,d)||ue(m,d))&&(m[2]=1),g!==i)h=0,g?(t.lineStart(),d=l(m,e),t.point(d[0],d[1])):(d=l(e,m),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(a&&e&&n^g){var v;y&r||!(v=l(m,e,!0))||(h=0,n?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!g||e&&ue(e,m)||t.point(m[0],m[1]),e=m,i=g,r=y},lineEnd:function(){i&&t.lineEnd(),e=null},clean:function(){return h|(u&&i)<<1}}}),(function(e,n,i,a){oe(a,t,r,i,e,n)}),n?[0,-t]:[-o,t-o])}var we,Te,ke,Ae,Me=1e9,Se=-Me;function Ee(t,e,r,n){function a(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function o(i,a,o,l){var u=0,h=0;if(null==i||(u=s(i,o))!==(h=s(a,o))||c(i,a)<0^o>0)do{l.point(0===u||3===u?t:r,u>1?n:e)}while((u=(u+o+4)%4)!==h);else l.point(a[0],a[1])}function s(n,a){return f(n[0]-t)0?0:3:f(n[0]-r)0?2:1:f(n[1]-e)0?1:0:a>0?3:2}function l(t,e){return c(t.x,e.x)}function c(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(i){var s,c,u,h,f,p,d,m,g,y,v,x=i,_=ce(),b={point:w,lineStart:function(){b.point=T,c&&c.push(u=[]);y=!0,g=!1,d=m=NaN},lineEnd:function(){s&&(T(h,f),p&&g&&_.rejoin(),s.push(_.result()));b.point=w,g&&x.lineEnd()},polygonStart:function(){x=_,s=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=c.length;rn&&(f-a)*(n-o)>(p-o)*(t-a)&&++e:p<=n&&(f-a)*(n-o)<(p-o)*(t-a)&&--e;return e}(),r=v&&e,a=(s=(0,ge.A)(s)).length;(r||a)&&(i.polygonStart(),r&&(i.lineStart(),o(null,null,1,i),i.lineEnd()),a&&fe(s,l,e,o,i),i.polygonEnd());x=i,s=c=u=null}};function w(t,e){a(t,e)&&x.point(t,e)}function T(i,o){var s=a(i,o);if(c&&u.push([i,o]),y)h=i,f=o,p=s,y=!1,s&&(x.lineStart(),x.point(i,o));else if(s&&g)x.point(i,o);else{var l=[d=Math.max(Se,Math.min(Me,d)),m=Math.max(Se,Math.min(Me,m))],_=[i=Math.max(Se,Math.min(Me,i)),o=Math.max(Se,Math.min(Me,o))];!function(t,e,r,n,i,a){var o,s=t[0],l=t[1],c=0,u=1,h=e[0]-s,f=e[1]-l;if(o=r-s,h||!(o>0)){if(o/=h,h<0){if(o0){if(o>u)return;o>c&&(c=o)}if(o=i-s,h||!(o<0)){if(o/=h,h<0){if(o>u)return;o>c&&(c=o)}else if(h>0){if(o0)){if(o/=f,f<0){if(o0){if(o>u)return;o>c&&(c=o)}if(o=a-l,f||!(o<0)){if(o/=f,f<0){if(o>u)return;o>c&&(c=o)}else if(f>0){if(o0&&(t[0]=s+c*h,t[1]=l+c*f),u<1&&(e[0]=s+u*h,e[1]=l+u*f),!0}}}}}(l,_,t,e,r,n)?s&&(x.lineStart(),x.point(i,o),v=!1):(g||(x.lineStart(),x.point(l[0],l[1])),x.point(_[0],_[1]),s||x.lineEnd(),v=!1)}d=i,m=o,g=s}return b}}function Ce(){var t,e,r,n=0,i=0,a=960,o=500;return r={stream:function(r){return t&&e===r?t:t=Ee(n,i,a,o)(e=r)},extent:function(s){return arguments.length?(n=+s[0][0],i=+s[0][1],a=+s[1][0],o=+s[1][1],t=e=null,r):[[n,i],[a,o]]}}}var Ie={sphere:E,point:E,lineStart:function(){Ie.point=Pe,Ie.lineEnd=Le},lineEnd:E,polygonStart:E,polygonEnd:E};function Le(){Ie.point=Ie.lineEnd=E}function Pe(t,e){Te=t*=h,ke=b(e*=h),Ae=m(e),Ie.point=ze}function ze(t,e){t*=h;var r=b(e*=h),n=m(e),i=f(t-Te),a=m(i),o=n*b(i),s=Ae*r-ke*n*a,l=ke*r+Ae*n*a;we.add(d(T(o*o+s*s),l)),Te=t,ke=r,Ae=n}function De(t){return we=new n.ph,D(t,Ie),+we}var Oe=[null,null],Re={type:"LineString",coordinates:Oe};function Fe(t,e){return Oe[0]=t,Oe[1]=e,De(Re)}var je={Feature:function(t,e){return Ne(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n0&&(i=Fe(t[o],t[o-1]))>0&&r<=i&&n<=i&&(r+n-i)*(1-Math.pow((r-n)/i,2))i})).map(c)).concat((0,We.A)(g(o/m)*m,a,m).filter((function(t){return f(t%v)>i})).map(u))}return _.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},_.outline=function(){return{type:"Polygon",coordinates:[h(n).concat(p(s).slice(1),h(r).reverse().slice(1),p(l).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.extentMajor(t).extentMinor(t):_.extentMinor()},_.extentMajor=function(t){return arguments.length?(n=+t[0][0],r=+t[1][0],l=+t[0][1],s=+t[1][1],n>r&&(t=n,n=r,r=t),l>s&&(t=l,l=s,s=t),_.precision(x)):[[n,l],[r,s]]},_.extentMinor=function(r){return arguments.length?(e=+r[0][0],t=+r[1][0],o=+r[0][1],a=+r[1][1],e>t&&(r=e,e=t,t=r),o>a&&(r=o,o=a,a=r),_.precision(x)):[[e,o],[t,a]]},_.step=function(t){return arguments.length?_.stepMajor(t).stepMinor(t):_.stepMinor()},_.stepMajor=function(t){return arguments.length?(y=+t[0],v=+t[1],_):[y,v]},_.stepMinor=function(t){return arguments.length?(d=+t[0],m=+t[1],_):[d,m]},_.precision=function(i){return arguments.length?(x=+i,c=Ye(o,a,90),u=Xe(e,t,x),h=Ye(l,s,90),p=Xe(n,r,x),_):x},_.extentMajor([[-180,-90+i],[180,90-i]]).extentMinor([[-180,-80-i],[180,80+i]])}function Ke(){return $e()()}function Je(t,e){var r=t[0]*h,n=t[1]*h,i=e[0]*h,a=e[1]*h,o=m(n),s=b(n),l=m(a),c=b(a),f=o*m(r),p=o*b(r),g=l*m(i),y=l*b(i),v=2*M(T(S(a-n)+o*l*S(i-r))),x=b(v),_=v?function(t){var e=b(t*=v)/x,r=b(v-t)/x,n=r*f+e*g,i=r*p+e*y,a=r*s+e*c;return[d(i,n)*u,d(a,T(n*n+i*i))*u]}:function(){return[r*u,n*u]};return _.distance=v,_}const Qe=t=>t;var tr,er,rr,nr,ir=new n.ph,ar=new n.ph,or={point:E,lineStart:E,lineEnd:E,polygonStart:function(){or.lineStart=sr,or.lineEnd=ur},polygonEnd:function(){or.lineStart=or.lineEnd=or.point=E,ir.add(f(ar)),ar=new n.ph},result:function(){var t=ir/2;return ir=new n.ph,t}};function sr(){or.point=lr}function lr(t,e){or.point=cr,tr=rr=t,er=nr=e}function cr(t,e){ar.add(nr*t-rr*e),rr=t,nr=e}function ur(){cr(tr,er)}const hr=or;var fr=1/0,pr=fr,dr=-fr,mr=dr,gr={point:function(t,e){tdr&&(dr=t);emr&&(mr=e)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E,result:function(){var t=[[fr,pr],[dr,mr]];return dr=mr=-(pr=fr=1/0),t}};const yr=gr;var vr,xr,_r,br,wr=0,Tr=0,kr=0,Ar=0,Mr=0,Sr=0,Er=0,Cr=0,Ir=0,Lr={point:Pr,lineStart:zr,lineEnd:Rr,polygonStart:function(){Lr.lineStart=Fr,Lr.lineEnd=jr},polygonEnd:function(){Lr.point=Pr,Lr.lineStart=zr,Lr.lineEnd=Rr},result:function(){var t=Ir?[Er/Ir,Cr/Ir]:Sr?[Ar/Sr,Mr/Sr]:kr?[wr/kr,Tr/kr]:[NaN,NaN];return wr=Tr=kr=Ar=Mr=Sr=Er=Cr=Ir=0,t}};function Pr(t,e){wr+=t,Tr+=e,++kr}function zr(){Lr.point=Dr}function Dr(t,e){Lr.point=Or,Pr(_r=t,br=e)}function Or(t,e){var r=t-_r,n=e-br,i=T(r*r+n*n);Ar+=i*(_r+t)/2,Mr+=i*(br+e)/2,Sr+=i,Pr(_r=t,br=e)}function Rr(){Lr.point=Pr}function Fr(){Lr.point=Br}function jr(){Nr(vr,xr)}function Br(t,e){Lr.point=Nr,Pr(vr=_r=t,xr=br=e)}function Nr(t,e){var r=t-_r,n=e-br,i=T(r*r+n*n);Ar+=i*(_r+t)/2,Mr+=i*(br+e)/2,Sr+=i,Er+=(i=br*t-_r*e)*(_r+t),Cr+=i*(br+e),Ir+=3*i,Pr(_r=t,br=e)}const Ur=Lr;function Vr(t){this._context=t}Vr.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,c)}},result:E};var qr,Hr,Gr,Zr,Wr,Yr=new n.ph,Xr={point:E,lineStart:function(){Xr.point=$r},lineEnd:function(){qr&&Kr(Hr,Gr),Xr.point=E},polygonStart:function(){qr=!0},polygonEnd:function(){qr=null},result:function(){var t=+Yr;return Yr=new n.ph,t}};function $r(t,e){Xr.point=Kr,Hr=Zr=t,Gr=Wr=e}function Kr(t,e){Zr-=t,Wr-=e,Yr.add(T(Zr*Zr+Wr*Wr)),Zr=t,Wr=e}const Jr=Xr;let Qr,tn,en,rn;class nn{constructor(t){this._append=null==t?an:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return an;if(e!==Qr){const t=10**e;Qr=e,tn=function(e){let r=1;this._+=e[0];for(const n=e.length;r=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(n=new nn(i)),o},o.projection(t).digits(i).context(e)}function sn(t){return{stream:ln(t)}}function ln(t){return function(e){var r=new cn;for(var n in t)r[n]=t[n];return r.stream=e,r}}function cn(){}function un(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),D(r,t.stream(yr)),e(yr.result()),null!=n&&t.clipExtent(n),t}function hn(t,e,r){return un(t,(function(r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(n/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),o=+e[0][0]+(n-a*(r[1][0]+r[0][0]))/2,s=+e[0][1]+(i-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([o,s])}),r)}function fn(t,e,r){return hn(t,[[0,0],e],r)}function pn(t,e,r){return un(t,(function(r){var n=+e,i=n/(r[1][0]-r[0][0]),a=(n-i*(r[1][0]+r[0][0]))/2,o=-i*r[0][1];t.scale(150*i).translate([a,o])}),r)}function dn(t,e,r){return un(t,(function(r){var n=+e,i=n/(r[1][1]-r[0][1]),a=-i*r[0][0],o=(n-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([a,o])}),r)}cn.prototype={constructor:cn,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var mn=16,gn=m(30*h);function yn(t,e){return+e?function(t,e){function r(n,a,o,s,l,c,u,h,p,m,g,y,v,x){var _=u-n,b=h-a,w=_*_+b*b;if(w>4*e&&v--){var k=s+m,A=l+g,S=c+y,E=T(k*k+A*A+S*S),C=M(S/=E),I=f(f(S)-1)e||f((_*D+b*O)/w-.5)>.3||s*m+l*g+c*y2?t[2]%360*h:0,P()):[v*u,x*u,_*u]},I.angle=function(t){return arguments.length?(b=t%360*h,P()):b*u},I.reflectX=function(t){return arguments.length?(w=t?-1:1,P()):w<0},I.reflectY=function(t){return arguments.length?(k=t?-1:1,P()):k<0},I.precision=function(t){return arguments.length?(o=yn(s,C=t*t),z()):T(C)},I.fitExtent=function(t,e){return hn(I,t,e)},I.fitSize=function(t,e){return fn(I,t,e)},I.fitWidth=function(t,e){return pn(I,t,e)},I.fitHeight=function(t,e){return dn(I,t,e)},function(){return e=t.apply(this,arguments),I.invert=e.invert&&L,P()}}function wn(t){var e=0,r=o/3,n=bn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*h,r=t[1]*h):[e*u,r*u]},i}function Tn(t,e){var r=b(t),n=(r+b(e))/2;if(f(n)=.12&&i<.234&&n>=-.425&&n<-.214?l:i>=.166&&i<.234&&n>=-.214&&n<-.115?c:s).invert(t)},h.stream=function(r){return t&&e===r?t:(n=[s.stream(e=r),l.stream(r),c.stream(r)],i=n.length,t={point:function(t,e){for(var r=-1;++r0?e<-s+i&&(e=-s+i):e>s-i&&(e=s-i);var r=a/_(Rn(e),n);return[r*b(n*t),a-r*m(n*t)]}return l.invert=function(t,e){var r=a-e,i=w(n)*T(t*t+r*r),l=d(t,f(r))*w(r);return r*n<0&&(l-=o*w(t)*w(r)),[l/n,2*p(_(a/i,1/n))-s]},l}function jn(){return wn(Fn).scale(109.5).parallels([30,30])}function Bn(t,e){return[t,e]}function Nn(){return _n(Bn).scale(152.63)}function Un(t,e){var r=m(t),n=t===e?b(t):(r-m(e))/(e-t),a=r/n+t;if(f(n)2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90]).scale(159.155)}Yn.invert=function(t,e){for(var r,n=e,i=n*n,o=i*i*i,s=0;s<12&&(o=(i=(n-=r=(n*(qn+Hn*i+o*(Gn+Zn*i))-e)/(qn+3*Hn*i+o*(7*Gn+9*Zn*i)))*n)*i*i,!(f(r)i&&--a>0);return[t/(.8707+(o=n*n)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),n]},ei.invert=En(M),ni.invert=En((function(t){return 2*p(t)})),ai.invert=function(t,e){return[-e,2*p(y(t))-s]}},66:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Path:()=>n.wA,path:()=>n.Ae,pathRound:()=>n.uj});var n=r(83)},83:(t,e,r)=>{"use strict";r.d(e,{Ae:()=>c,uj:()=>u,wA:()=>l});const n=Math.PI,i=2*n,a=1e-6,o=i-a;function s(t){this._+=t[0];for(let e=1,r=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return s;const r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;ea)if(Math.abs(f*c-u*h)>a&&o){let d=r-s,m=i-l,g=c*c+u*u,y=d*d+m*m,v=Math.sqrt(g),x=Math.sqrt(p),_=o*Math.tan((n-Math.acos((g+p-y)/(2*v*x)))/2),b=_/x,w=_/v;Math.abs(b-1)>a&&this._append`L${t+b*h},${e+b*f}`,this._append`A${o},${o},0,0,${+(f*d>h*m)},${this._x1=t+w*c},${this._y1=e+w*u}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,r,s,l,c){if(t=+t,e=+e,c=!!c,(r=+r)<0)throw new Error(`negative radius: ${r}`);let u=r*Math.cos(s),h=r*Math.sin(s),f=t+u,p=e+h,d=1^c,m=c?s-l:l-s;null===this._x1?this._append`M${f},${p}`:(Math.abs(this._x1-f)>a||Math.abs(this._y1-p)>a)&&this._append`L${f},${p}`,r&&(m<0&&(m=m%i+i),m>o?this._append`A${r},${r},0,1,${d},${t-u},${e-h}A${r},${r},0,1,${d},${this._x1=f},${this._y1=p}`:m>a&&this._append`A${r},${r},0,${+(m>=n)},${d},${this._x1=t+r*Math.cos(l)},${this._y1=e+r*Math.sin(l)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function c(){return new l}function u(t=3){return new l(+t)}c.prototype=l.prototype},395:(t,e,r)=>{"use strict";function n(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var i,a,o,s,l,c,u,h,f,p=t._root,d={data:n},m=t._x0,g=t._y0,y=t._x1,v=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((c=e>=(a=(m+y)/2))?m=a:y=a,(u=r>=(o=(g+v)/2))?g=o:v=o,i=p,!(p=p[h=u<<1|c]))return i[h]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,i?i[h]=d:t._root=d,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(a=(m+y)/2))?m=a:y=a,(u=r>=(o=(g+v)/2))?g=o:v=o}while((h=u<<1|c)==(f=(l>=o)<<1|s>=a));return i[f]=p,i[h]=d,t}function i(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i}function a(t){return t[0]}function o(t){return t[1]}function s(t,e,r){var n=new l(null==e?a:e,null==r?o:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function l(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function c(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}r.r(e),r.d(e,{quadtree:()=>s});var u=s.prototype=l.prototype;u.copy=function(){var t,e,r=new l(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=c(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=c(e));return r},u.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return n(this.cover(e,r),e,r,t)},u.addAll=function(t){var e,r,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,h=-1/0,f=-1/0;for(r=0;rh&&(h=i),af&&(f=a));if(c>h||u>f)return this;for(this.cover(c,u).cover(h,f),r=0;rt||t>=i||n>e||e>=a;)switch(s=(ep||(o=c.y0)>d||(s=c.x1)=v)<<1|t>=y)&&(c=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=c)}else{var x=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),b=x*x+_*_;if(b=(s=(d+g)/2))?d=s:g=s,(u=o>=(l=(m+y)/2))?m=l:y=l,e=p,!(p=p[h=u<<1|c]))return this;if(!p.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[f]=p:this._root=p),this):(this._root=i,this)},u.removeAll=function(t){for(var e=0,r=t.length;e{"use strict";function n(t){return function(){return t}}r.r(e),r.d(e,{arc:()=>k,area:()=>P,areaRadial:()=>U,curveBasis:()=>Lt,curveBasisClosed:()=>zt,curveBasisOpen:()=>Ot,curveBumpX:()=>G,curveBumpY:()=>Z,curveBundle:()=>Ft,curveCardinal:()=>Nt,curveCardinalClosed:()=>Vt,curveCardinalOpen:()=>Ht,curveCatmullRom:()=>Wt,curveCatmullRomClosed:()=>Xt,curveCatmullRomOpen:()=>Kt,curveLinear:()=>E,curveLinearClosed:()=>Qt,curveMonotoneX:()=>se,curveMonotoneY:()=>le,curveNatural:()=>he,curveStep:()=>pe,curveStepAfter:()=>me,curveStepBefore:()=>de,line:()=>L,lineRadial:()=>N,link:()=>$,linkHorizontal:()=>K,linkRadial:()=>Q,linkVertical:()=>J,pie:()=>O,pointRadial:()=>V,radialArea:()=>U,radialLine:()=>N,stack:()=>_e,stackOffsetDiverging:()=>we,stackOffsetExpand:()=>be,stackOffsetNone:()=>ge,stackOffsetSilhouette:()=>Te,stackOffsetWiggle:()=>ke,stackOrderAppearance:()=>Ae,stackOrderAscending:()=>Se,stackOrderDescending:()=>Ce,stackOrderInsideOut:()=>Ie,stackOrderNone:()=>ye,stackOrderReverse:()=>Le,symbol:()=>St,symbolAsterisk:()=>et,symbolCircle:()=>rt,symbolCross:()=>nt,symbolDiamond:()=>ot,symbolDiamond2:()=>st,symbolPlus:()=>lt,symbolSquare:()=>ct,symbolSquare2:()=>ut,symbolStar:()=>dt,symbolTimes:()=>kt,symbolTriangle:()=>gt,symbolTriangle2:()=>vt,symbolWye:()=>Tt,symbolX:()=>kt,symbols:()=>At,symbolsFill:()=>At,symbolsStroke:()=>Mt});const i=Math.abs,a=Math.atan2,o=Math.cos,s=Math.max,l=Math.min,c=Math.sin,u=Math.sqrt,h=1e-12,f=Math.PI,p=f/2,d=2*f;function m(t){return t>=1?p:t<=-1?-p:Math.asin(t)}var g=r(83);function y(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{const t=Math.floor(r);if(!(t>=0))throw new RangeError(`invalid digits: ${r}`);e=t}return t},()=>new g.wA(e)}function v(t){return t.innerRadius}function x(t){return t.outerRadius}function _(t){return t.startAngle}function b(t){return t.endAngle}function w(t){return t&&t.padAngle}function T(t,e,r,n,i,a,o){var l=t-r,c=e-n,h=(o?a:-a)/u(l*l+c*c),f=h*c,p=-h*l,d=t+f,m=e+p,g=r+f,y=n+p,v=(d+g)/2,x=(m+y)/2,_=g-d,b=y-m,w=_*_+b*b,T=i-a,k=d*y-g*m,A=(b<0?-1:1)*u(s(0,T*T*w-k*k)),M=(k*b-_*A)/w,S=(-k*_-b*A)/w,E=(k*b+_*A)/w,C=(-k*_+b*A)/w,I=M-v,L=S-x,P=E-v,z=C-x;return I*I+L*L>P*P+z*z&&(M=E,S=C),{cx:M,cy:S,x01:-f,y01:-p,x11:M*(i/T-1),y11:S*(i/T-1)}}function k(){var t=v,e=x,r=n(0),s=null,g=_,k=b,A=w,M=null,S=y(E);function E(){var n,y,v,x=+t.apply(this,arguments),_=+e.apply(this,arguments),b=g.apply(this,arguments)-p,w=k.apply(this,arguments)-p,E=i(w-b),C=w>b;if(M||(M=n=S()),_h)if(E>d-h)M.moveTo(_*o(b),_*c(b)),M.arc(0,0,_,b,w,!C),x>h&&(M.moveTo(x*o(w),x*c(w)),M.arc(0,0,x,w,b,C));else{var I,L,P=b,z=w,D=b,O=w,R=E,F=E,j=A.apply(this,arguments)/2,B=j>h&&(s?+s.apply(this,arguments):u(x*x+_*_)),N=l(i(_-x)/2,+r.apply(this,arguments)),U=N,V=N;if(B>h){var q=m(B/x*c(j)),H=m(B/_*c(j));(R-=2*q)>h?(D+=q*=C?1:-1,O-=q):(R=0,D=O=(b+w)/2),(F-=2*H)>h?(P+=H*=C?1:-1,z-=H):(F=0,P=z=(b+w)/2)}var G=_*o(P),Z=_*c(P),W=x*o(O),Y=x*c(O);if(N>h){var X,$=_*o(z),K=_*c(z),J=x*o(D),Q=x*c(D);if(E1?0:v<-1?f:Math.acos(v))/2),at=u(X[0]*X[0]+X[1]*X[1]);U=l(N,(x-at)/(it-1)),V=l(N,(_-at)/(it+1))}else U=V=0}F>h?V>h?(I=T(J,Q,G,Z,_,V,C),L=T($,K,W,Y,_,V,C),M.moveTo(I.cx+I.x01,I.cy+I.y01),Vh&&R>h?U>h?(I=T(W,Y,$,K,x,-U,C),L=T(G,Z,J,Q,x,-U,C),M.lineTo(I.cx+I.x01,I.cy+I.y01),U=h;--f)l.point(y[f],v[f]);l.lineEnd(),l.areaEnd()}g&&(y[u]=+t(p,u,n),v[u]=+e(p,u,n),l.point(i?+i(p,u,n):y[u],r?+r(p,u,n):v[u]))}if(d)return l=null,d+""||null}function h(){return L().defined(a).curve(s).context(o)}return t="function"==typeof t?t:void 0===t?C:n(+t),e="function"==typeof e?e:n(void 0===e?0:+e),r="function"==typeof r?r:void 0===r?I:n(+r),u.x=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),i=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),u):t},u.x1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:n(+t),u):i},u.y=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),r=null,u):e},u.y0=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),u):e},u.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:n(+t),u):r},u.lineX0=u.lineY0=function(){return h().x(t).y(e)},u.lineY1=function(){return h().x(t).y(r)},u.lineX1=function(){return h().x(i).y(e)},u.defined=function(t){return arguments.length?(a="function"==typeof t?t:n(!!t),u):a},u.curve=function(t){return arguments.length?(s=t,null!=o&&(l=s(o)),u):s},u.context=function(t){return arguments.length?(null==t?o=l=null:l=s(o=t),u):o},u}function z(t,e){return et?1:e>=t?0:NaN}function D(t){return t}function O(){var t=D,e=z,r=null,i=n(0),a=n(d),o=n(0);function s(n){var s,l,c,u,h,f=(n=M(n)).length,p=0,m=new Array(f),g=new Array(f),y=+i.apply(this,arguments),v=Math.min(d,Math.max(-d,a.apply(this,arguments)-y)),x=Math.min(Math.abs(v)/f,o.apply(this,arguments)),_=x*(v<0?-1:1);for(s=0;s0&&(p+=h);for(null!=e?m.sort((function(t,r){return e(g[t],g[r])})):null!=r&&m.sort((function(t,e){return r(n[t],n[e])})),s=0,c=p?(v-f*_)/p:0;s0?h*c:0)+_,g[l]={data:n[l],index:s,value:h,startAngle:y,endAngle:u,padAngle:x};return g}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,r=null,s):e},s.sort=function(t){return arguments.length?(r=t,e=null,s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),s):a},s.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:n(+t),s):o},s}S.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var R=j(E);function F(t){this._curve=t}function j(t){function e(e){return new F(t(e))}return e._curve=t,e}function B(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(j(t)):e()._curve},t}function N(){return B(L().curve(R))}function U(){var t=P().curve(R),e=t.curve,r=t.lineX0,n=t.lineX1,i=t.lineY0,a=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return B(r())},delete t.lineX0,t.lineEndAngle=function(){return B(n())},delete t.lineX1,t.lineInnerRadius=function(){return B(i())},delete t.lineY0,t.lineOuterRadius=function(){return B(a())},delete t.lineY1,t.curve=function(t){return arguments.length?e(j(t)):e()._curve},t}function V(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}F.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};class q{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}class H{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,e){if(t=+t,e=+e,0===this._point)this._point=1;else{const r=V(this._x0,this._y0),n=V(this._x0,this._y0=(this._y0+e)/2),i=V(t,this._y0),a=V(t,e);this._context.moveTo(...r),this._context.bezierCurveTo(...n,...i,...a)}this._x0=t,this._y0=e}}function G(t){return new q(t,!0)}function Z(t){return new q(t,!1)}function W(t){return new H(t)}function Y(t){return t.source}function X(t){return t.target}function $(t){let e=Y,r=X,i=C,a=I,o=null,s=null,l=y(c);function c(){let n;const c=A.call(arguments),u=e.apply(this,c),h=r.apply(this,c);if(null==o&&(s=t(n=l())),s.lineStart(),c[0]=u,s.point(+i.apply(this,c),+a.apply(this,c)),c[0]=h,s.point(+i.apply(this,c),+a.apply(this,c)),s.lineEnd(),n)return s=null,n+""||null}return c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(r=t,c):r},c.x=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),c):i},c.y=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),c):a},c.context=function(e){return arguments.length?(null==e?o=s=null:s=t(o=e),c):o},c}function K(){return $(G)}function J(){return $(Z)}function Q(){const t=$(W);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const tt=u(3),et={draw(t,e){const r=.59436*u(e+l(e/28,.75)),n=r/2,i=n*tt;t.moveTo(0,r),t.lineTo(0,-r),t.moveTo(-i,-n),t.lineTo(i,n),t.moveTo(-i,n),t.lineTo(i,-n)}},rt={draw(t,e){const r=u(e/f);t.moveTo(r,0),t.arc(0,0,r,0,d)}},nt={draw(t,e){const r=u(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},it=u(1/3),at=2*it,ot={draw(t,e){const r=u(e/at),n=r*it;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},st={draw(t,e){const r=.62625*u(e);t.moveTo(0,-r),t.lineTo(r,0),t.lineTo(0,r),t.lineTo(-r,0),t.closePath()}},lt={draw(t,e){const r=.87559*u(e-l(e/7,2));t.moveTo(-r,0),t.lineTo(r,0),t.moveTo(0,r),t.lineTo(0,-r)}},ct={draw(t,e){const r=u(e),n=-r/2;t.rect(n,n,r,r)}},ut={draw(t,e){const r=.4431*u(e);t.moveTo(r,r),t.lineTo(r,-r),t.lineTo(-r,-r),t.lineTo(-r,r),t.closePath()}},ht=c(f/10)/c(7*f/10),ft=c(d/10)*ht,pt=-o(d/10)*ht,dt={draw(t,e){const r=u(.8908130915292852*e),n=ft*r,i=pt*r;t.moveTo(0,-r),t.lineTo(n,i);for(let e=1;e<5;++e){const a=d*e/5,s=o(a),l=c(a);t.lineTo(l*r,-s*r),t.lineTo(s*n-l*i,l*n+s*i)}t.closePath()}},mt=u(3),gt={draw(t,e){const r=-u(e/(3*mt));t.moveTo(0,2*r),t.lineTo(-mt*r,-r),t.lineTo(mt*r,-r),t.closePath()}},yt=u(3),vt={draw(t,e){const r=.6824*u(e),n=r/2,i=r*yt/2;t.moveTo(0,-r),t.lineTo(i,n),t.lineTo(-i,n),t.closePath()}},xt=-.5,_t=u(3)/2,bt=1/u(12),wt=3*(bt/2+1),Tt={draw(t,e){const r=u(e/wt),n=r/2,i=r*bt,a=n,o=r*bt+r,s=-a,l=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(s,l),t.lineTo(xt*n-_t*i,_t*n+xt*i),t.lineTo(xt*a-_t*o,_t*a+xt*o),t.lineTo(xt*s-_t*l,_t*s+xt*l),t.lineTo(xt*n+_t*i,xt*i-_t*n),t.lineTo(xt*a+_t*o,xt*o-_t*a),t.lineTo(xt*s+_t*l,xt*l-_t*s),t.closePath()}},kt={draw(t,e){const r=.6189*u(e-l(e/6,1.7));t.moveTo(-r,-r),t.lineTo(r,r),t.moveTo(-r,r),t.lineTo(r,-r)}},At=[rt,nt,ot,ct,dt,gt,Tt],Mt=[rt,lt,kt,vt,et,ut,st];function St(t,e){let r=null,i=y(a);function a(){let n;if(r||(r=n=i()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),n)return r=null,n+""||null}return t="function"==typeof t?t:n(t||rt),e="function"==typeof e?e:n(void 0===e?64:+e),a.type=function(e){return arguments.length?(t="function"==typeof e?e:n(e),a):t},a.size=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),a):e},a.context=function(t){return arguments.length?(r=null==t?null:t,a):r},a}function Et(){}function Ct(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function It(t){this._context=t}function Lt(t){return new It(t)}function Pt(t){this._context=t}function zt(t){return new Pt(t)}function Dt(t){this._context=t}function Ot(t){return new Dt(t)}function Rt(t,e){this._basis=new It(t),this._beta=e}It.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Pt.prototype={areaStart:Et,areaEnd:Et,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Rt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n,i=t[0],a=e[0],o=t[r]-i,s=e[r]-a,l=-1;++l<=r;)n=l/r,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+n*o),this._beta*e[l]+(1-this._beta)*(a+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const Ft=function t(e){function r(t){return 1===e?new It(t):new Rt(t,e)}return r.beta=function(e){return t(+e)},r}(.85);function jt(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function Bt(t,e){this._context=t,this._k=(1-e)/6}Bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:jt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:jt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Nt=function t(e){function r(t){return new Bt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function Ut(t,e){this._context=t,this._k=(1-e)/6}Ut.prototype={areaStart:Et,areaEnd:Et,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:jt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Vt=function t(e){function r(t){return new Ut(t,e)}return r.tension=function(e){return t(+e)},r}(0);function qt(t,e){this._context=t,this._k=(1-e)/6}qt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:jt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ht=function t(e){function r(t){return new qt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function Gt(t,e,r){var n=t._x1,i=t._y1,a=t._x2,o=t._y2;if(t._l01_a>h){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>h){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,a,o,t._x2,t._y2)}function Zt(t,e){this._context=t,this._alpha=e}Zt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Gt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Wt=function t(e){function r(t){return e?new Zt(t,e):new Bt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Yt(t,e){this._context=t,this._alpha=e}Yt.prototype={areaStart:Et,areaEnd:Et,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Gt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Xt=function t(e){function r(t){return e?new Yt(t,e):new Ut(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function $t(t,e){this._context=t,this._alpha=e}$t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Gt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Kt=function t(e){function r(t){return e?new $t(t,e):new qt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Jt(t){this._context=t}function Qt(t){return new Jt(t)}function te(t){return t<0?-1:1}function ee(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(te(a)+te(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function re(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function ne(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,i+s*e,a-s,o-s*r,a,o)}function ie(t){this._context=t}function ae(t){this._context=new oe(t)}function oe(t){this._context=t}function se(t){return new ie(t)}function le(t){return new ae(t)}function ce(t){this._context=t}function ue(t){var e,r,n=t.length-1,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[n-1]=(t[n]+i[n-1])/2,e=0;e1)for(var r,n,i,a=1,o=t[e[0]],s=o.length;a=0;)r[e]=e;return r}function ve(t,e){return t[e]}function xe(t){const e=[];return e.key=t,e}function _e(){var t=n([]),e=ye,r=ge,i=ve;function a(n){var a,o,s=Array.from(t.apply(this,arguments),xe),l=s.length,c=-1;for(const t of n)for(a=0,++c;a0){for(var r,n,i,a=0,o=t[0].length;a0)for(var r,n,i,a,o,s,l=0,c=t[e[0]].length;l0?(n[0]=a,n[1]=a+=i):i<0?(n[1]=o,n[0]=o+=i):(n[0]=0,n[1]=i)}function Te(t,e){if((r=t.length)>0){for(var r,n=0,i=t[e[0]],a=i.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,i,a=0,o=1;oa&&(a=e,n=r);return n}function Se(t){var e=t.map(Ee);return ye(t).sort((function(t,r){return e[t]-e[r]}))}function Ee(t){for(var e,r=0,n=-1,i=t.length;++n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}}},552:(t,e,r)=>{"use strict";r.r(e),r.d(e,{timeDay:()=>A,timeDays:()=>M,timeFriday:()=>F,timeFridays:()=>H,timeHour:()=>b,timeHours:()=>w,timeInterval:()=>a,timeMillisecond:()=>o,timeMilliseconds:()=>s,timeMinute:()=>y,timeMinutes:()=>v,timeMonday:()=>z,timeMondays:()=>N,timeMonth:()=>st,timeMonths:()=>lt,timeSaturday:()=>j,timeSaturdays:()=>G,timeSecond:()=>m,timeSeconds:()=>g,timeSunday:()=>P,timeSundays:()=>B,timeThursday:()=>R,timeThursdays:()=>q,timeTickInterval:()=>bt,timeTicks:()=>_t,timeTuesday:()=>D,timeTuesdays:()=>U,timeWednesday:()=>O,timeWednesdays:()=>V,timeWeek:()=>P,timeWeeks:()=>B,timeYear:()=>ht,timeYears:()=>ft,unixDay:()=>C,unixDays:()=>I,utcDay:()=>S,utcDays:()=>E,utcFriday:()=>J,utcFridays:()=>at,utcHour:()=>T,utcHours:()=>k,utcMillisecond:()=>o,utcMilliseconds:()=>s,utcMinute:()=>x,utcMinutes:()=>_,utcMonday:()=>Y,utcMondays:()=>et,utcMonth:()=>ct,utcMonths:()=>ut,utcSaturday:()=>Q,utcSaturdays:()=>ot,utcSecond:()=>m,utcSeconds:()=>g,utcSunday:()=>W,utcSundays:()=>tt,utcThursday:()=>K,utcThursdays:()=>it,utcTickInterval:()=>xt,utcTicks:()=>vt,utcTuesday:()=>X,utcTuesdays:()=>rt,utcWednesday:()=>$,utcWednesdays:()=>nt,utcWeek:()=>W,utcWeeks:()=>tt,utcYear:()=>pt,utcYears:()=>dt});const n=new Date,i=new Date;function a(t,e,r,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=e=>(t(e=new Date(+e)),e),s.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),s.round=t=>{const e=s(t),r=s.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),s.range=(r,n,i)=>{const a=[];if(r=s.ceil(r),i=null==i?1:Math.floor(i),!(r0))return a;let o;do{a.push(o=new Date(+r)),e(r,i),t(r)}while(oa((e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)}),((t,n)=>{if(t>=t)if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););})),r&&(s.count=(e,a)=>(n.setTime(+e),i.setTime(+a),t(n),t(i),Math.floor(r(n,i))),s.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?e=>o(e)%t==0:e=>s.count(0,e)%t==0):s:null)),s}const o=a((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));o.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?a((e=>{e.setTime(Math.floor(e/t)*t)}),((e,r)=>{e.setTime(+e+r*t)}),((e,r)=>(r-e)/t)):o:null);const s=o.range,l=1e3,c=6e4,u=36e5,h=864e5,f=6048e5,p=2592e6,d=31536e6,m=a((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*l)}),((t,e)=>(e-t)/l),(t=>t.getUTCSeconds())),g=m.range,y=a((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*l)}),((t,e)=>{t.setTime(+t+e*c)}),((t,e)=>(e-t)/c),(t=>t.getMinutes())),v=y.range,x=a((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*c)}),((t,e)=>(e-t)/c),(t=>t.getUTCMinutes())),_=x.range,b=a((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*l-t.getMinutes()*c)}),((t,e)=>{t.setTime(+t+e*u)}),((t,e)=>(e-t)/u),(t=>t.getHours())),w=b.range,T=a((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*u)}),((t,e)=>(e-t)/u),(t=>t.getUTCHours())),k=T.range,A=a((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*c)/h),(t=>t.getDate()-1)),M=A.range,S=a((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/h),(t=>t.getUTCDate()-1)),E=S.range,C=a((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/h),(t=>Math.floor(t/h))),I=C.range;function L(t){return a((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*c)/f))}const P=L(0),z=L(1),D=L(2),O=L(3),R=L(4),F=L(5),j=L(6),B=P.range,N=z.range,U=D.range,V=O.range,q=R.range,H=F.range,G=j.range;function Z(t){return a((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/f))}const W=Z(0),Y=Z(1),X=Z(2),$=Z(3),K=Z(4),J=Z(5),Q=Z(6),tt=W.range,et=Y.range,rt=X.range,nt=$.range,it=K.range,at=J.range,ot=Q.range,st=a((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth())),lt=st.range,ct=a((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),ut=ct.range,ht=a((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));ht.every=t=>isFinite(t=Math.floor(t))&&t>0?a((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,r)=>{e.setFullYear(e.getFullYear()+r*t)})):null;const ft=ht.range,pt=a((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));pt.every=t=>isFinite(t=Math.floor(t))&&t>0?a((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null;const dt=pt.range;var mt=r(37),gt=r(946);function yt(t,e,r,n,i,a){const s=[[m,1,l],[m,5,5e3],[m,15,15e3],[m,30,3e4],[a,1,c],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,u],[i,3,108e5],[i,6,216e5],[i,12,432e5],[n,1,h],[n,2,1728e5],[r,1,f],[e,1,p],[e,3,7776e6],[t,1,d]];function g(e,r,n){const i=Math.abs(r-e)/n,a=(0,mt.A)((([,,t])=>t)).right(s,i);if(a===s.length)return t.every((0,gt.sG)(e/d,r/d,n));if(0===a)return o.every(Math.max((0,gt.sG)(e,r,n),1));const[l,c]=s[i/s[a-1][2]{"use strict";r.r(e),r.d(e,{interval:()=>w,now:()=>p,timeout:()=>b,timer:()=>g,timerFlush:()=>y});var n,i,a=0,o=0,s=0,l=0,c=0,u=0,h="object"==typeof performance&&performance.now?performance:Date,f="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return c||(f(d),c=h.now()+u)}function d(){c=0}function m(){this._call=this._time=this._next=null}function g(t,e,r){var n=new m;return n.restart(t,e,r),n}function y(){p(),++a;for(var t,e=n;e;)(t=c-e._time)>=0&&e._call.call(void 0,t),e=e._next;--a}function v(){c=(l=h.now())+u,a=o=0;try{y()}finally{a=0,function(){var t,e,r=n,a=1/0;for(;r;)r._call?(a>r._time&&(a=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:n=e);i=t,_(a)}(),c=0}}function x(){var t=h.now(),e=t-l;e>1e3&&(u-=e,l=t)}function _(t){a||(o&&(o=clearTimeout(o)),t-c>24?(t<1/0&&(o=setTimeout(v,t-h.now()-u)),s&&(s=clearInterval(s))):(s||(l=h.now(),s=setInterval(x,1e3)),a=1,f(v)))}function b(t,e,r){var n=new m;return e=null==e?0:+e,n.restart((r=>{n.stop(),t(r+e)}),e,r),n}function w(t,e,r){var n=new m,i=e;return null==e?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(t,e,r){e=+e,r=null==r?p():+r,n._restart((function a(o){o+=i,n._restart(a,i+=e,r),t(o)}),e,r)},n.restart(t,e,r),n)}m.prototype=g.prototype={constructor:m,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?p():+r)+(null==e?0:+e),this._next||i===this||(i?i._next=this:n=this,i=this),this._call=t,this._time=r,_()},stop:function(){this._call&&(this._call=null,this._time=1/0,_())}}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t=r(647),e=r.n(t),n=r(453),i=r.n(n),a=r(653),o=r.n(a);function s(t,e){let r;return function(...n){const i=this;clearTimeout(r),r=setTimeout((()=>t.apply(i,n)),e)}}function l(t){return Math.round(t.getTime()/1e3)}function c(t){return new Date(1e3*t)}function u(t,e){const r=document.getElementById("notifications"),n=document.getElementById("notification-template").content.cloneNode(!0).firstElementChild,i=n.querySelector(".btn-close");let a="";"info"===t?(n.classList.add("bg-primary","text-white"),i.classList.add("btn-close-white"),a="fa-circle-info"):"success"===t?(n.classList.add("bg-success","text-white"),i.classList.add("btn-close-white"),a="fa-circle-check"):"warning"===t?(n.classList.add("bg-warning","text-body"),a="fa-circle-exclamation"):"error"===t?(n.classList.add("bg-danger","text-white"),i.classList.add("btn-close-white"),a="fa-circle-exclamation"):(n.classList.add("bg-secondary","text-white"),i.classList.add("btn-close-white"),a="fa-comment"),n.querySelector(".toast-body").innerHTML=` `+e,r.appendChild(n);new(o())(n,{autohide:!0,delay:1e4}).show(),n.addEventListener("hidden.bs.toast",(()=>{n.remove()}))}const h="varnishmon.",f=`${h}time-range-from`,p=`${h}time-range-to`,d=["now-1h","now"];function m(t=!1){if(!t){const t=g(f),e=g(p);if(null!=t&&null!=e)return[t,e]}return varnishmon.config.scraper.enabled?d:[c(varnishmon.storage.earliest),c(varnishmon.storage.latest)]}function g(t){try{let e=localStorage.getItem(t);if(null!=e)return e}catch(e){console.error(`Failed to read '${t}' from local storage!`,e)}return null}function y(t,e){e instanceof Date&&(e=e.toISOString());try{localStorage.setItem(t,e)}catch(e){console.error(`Failed to write '${t}' to local storage!`,e)}}const v=`${h}refresh-interval`,x=[[-1,"auto"],[0,"disabled"],[1,"1s"],[2,"2s"],[3,"3s"],[4,"4s"],[5,"5s"],[10,"10s"],[15,"15s"],[30,"30s"],[60,"1m"]];function _(t){return Number.isInteger(t)&&x.map((t=>t[0])).includes(t)}const b=`${h}filter`,w=`${h}filter-history`;function T(){try{let t=localStorage.getItem(w);if(null!=t)return JSON.parse(t)}catch(t){console.error(`Failed to read '${w}' from local storage!`,t)}return[]}const k=`${h}verbosity`,A=["normal","debug"];function M(t){return A.includes(t)}const S=`${h}columns`,E=[1,2,3,4,6,12];function C(t){return Number.isInteger(t)&&E.includes(t)}const I=`${h}aggregator`,L=["avg","min","max","first","last","count"];function P(t){return L.includes(t)}const z=`${h}step`;function D(){return varnishmon.config.scraper.enabled?varnishmon.config.scraper.period:1}function O(t){return Number.isInteger(t)&&t>=D()}const R=[/^MGT[.](?!(?:uptime)$)/,new RegExp("MAIN[.](?!(?:"+["backend_busy","backend_conn","backend_fail","backend_recycle","backend_req","backend_retry","backend_reuse","backend_unhealthy","backend_wait_fail","backend_wait","bans_lurker_obj_killed_cutoff","bans_lurker_obj_killed","bans_obj_killed","bans","bgfetch_no_thread","busy_killed","busy_sleep","busy_wakeup","c_ykey_purges","cache_hit_grace","cache_hit","cache_hitmiss","cache_hitpass","cache_miss","client_req_400","client_req_417","client_req","client_resp_500","esi_errors","esi_maxdepth","esi_req","esi_warnings","fetch_1xx","fetch_204","fetch_304","fetch_bad","fetch_chunked","fetch_eof","fetch_failed","fetch_fast304","fetch_head","fetch_length","fetch_none","fetch_stale_deliver","fetch_stale_rearm","g_mem_file","g_mem_private","g_mem_rss","g_mem_swap","goto_dns_cache_hits","goto_dns_lookup_fails","goto_dns_lookups","losthdr","n_backend","n_expired","n_gunzip","n_gzip","n_lru_limited","n_lru_moved","n_lru_nuked","n_obj_purged","n_object_hitmiss","n_object_hitpass","n_object","n_objectcore","n_objecthead","n_purges","n_test_gunzip","n_vcl","req_dropped","req_reset","s_fetch","s_pass","s_pipe_hdrbytes","s_pipe_in","s_pipe_out","s_pipe","s_req_bodybytes","s_req_hdrbytes","s_resp_bodybytes","s_resp_hdrbytes","s_sess","s_synth","sc_bankrupt","sc_rapid_reset","sc_sock_closed","sc_vcl_failure","sess_closed_err","sess_closed","sess_conn","sess_drop","sess_dropped","sess_fail_ebadf","sess_fail_econnaborted","sess_fail_eintr","sess_fail_emfile","sess_fail_enomem","sess_fail_other","sess_fail","sess_herd","sess_queued","sess_readahead","shm_cont","shm_cycles","shm_flushes","shm_records","thread_queue_len","threads_created","threads_destroyed","threads_failed","threads_limited","threads","uptime","vcl_fail","vmods","ws_backend_overflow","ws_client_overflow","ws_session_overflow","ws_thread_overflow"].join("|")+")$)"),new RegExp("MSE[.](?!.*[.](?:"+["c_fail","c_memcache_hit","c_memcache_miss","c_ykey_purged","g_bytes","g_space","g_sparenode","g_ykey_keys","n_lru_moved","n_lru_nuked","n_vary"].join("|")+")$)"),new RegExp("MSE_BOOK[.](?!.*[.](?:"+["c_insert_timeout","c_waterlevel_purge","c_waterlevel_queue","c_waterlevel_runs","g_banlist_bytes","g_banlist_space","g_bytes","g_space","n_vary"].join("|")+")$)"),new RegExp("MSE_STORE[.](?!.*[.](?:"+["c_aio_finished_bytes_read","c_aio_finished_bytes_write","c_aio_finished_read","c_aio_finished_write","c_waterlevel_purge","c_waterlevel_queue","g_alloc_bytes","g_free_bytes","g_objects","g_ykey_keys"].join("|")+")$)"),new RegExp("MSE4[.](?!(?:"+["g_varyspec","g_ykey_keys","c_ykey_purged"].join("|")+")$)"),new RegExp("MSE4_MEM[.](?!(?:"+["c_allocation","c_allocation_buffer","c_allocation_ephemeral","c_allocation_failure","c_allocation_pass","c_allocation_persisted","c_allocation_reqbody","c_allocation_synthetic","c_eviction","c_eviction_failure","c_eviction_reorder","c_free","c_free_buffer","c_free_ephemeral","c_free_pass","c_free_persisted","c_free_reqbody","c_free_synthetic","c_memcache_hit","c_memcache_miss","g_allocations","g_bytes","g_bytes_buffer","g_bytes_ephemeral","g_bytes_pass","g_bytes_persisted","g_bytes_reqbody","g_bytes_synthetic","g_objects","g_objects_ephemeral","g_objects_pass","g_objects_persisted","g_objects_reqbody","g_objects_synthetic","g_space"].join("|")+")$)"),new RegExp("MSE4_BOOK[.](?!.*[.](?:"+["c_freeslot_queued","c_submitslot_queued","c_ykey_purged","g_freeslot_queue","g_objects","g_slots_unused","g_slots_used","g_submitslot_queue","g_unreachable_objects","g_varyspec","g_ykey_keys","online"].join("|")+")$)"),new RegExp("MSE4_STORE[.](?!.*[.](?:"+["online","g_bytes_used","g_bytes_unused","g_objects","g_allocation_queue","c_allocation_queued","g_io_queued","g_io_queued_read","g_io_queued_write","c_io_finished_read","c_io_finished_write","c_io_finished_bytes_read","c_io_finished_bytes_write","g_io_blocked_read","g_io_blocked_write","c_io_limited"].join("|")+")$)"),new RegExp("MSE4_BANJRN[.](?!.*[.](?:"+["g_ban_bytes","g_bans","g_bytes","g_overflow_ban_bytes","g_overflow_bans","g_space"].join("|")+")$)"),new RegExp("MSE4_CAT[.](?!.*[.](?:"+["c_allocation","c_allocation_ephemeral","c_allocation_pass","c_allocation_persisted","c_eviction","c_eviction_failure","c_eviction_reorder","c_free","c_free_ephemeral","c_free_pass","c_free_persisted","c_memcache_hit","c_memcache_miss","g_allocations","g_bytes","g_bytes_ephemeral","g_bytes_pass","g_bytes_persisted","g_objects","g_objects_ephemeral","g_objects_pass","g_objects_persisted"].join("|")+")$)"),new RegExp("SMA[.](?!.*[.](?:"+["c_bytes","c_fail","c_freed","c_req","g_alloc","g_bytes","g_space"].join("|")+")$)"),new RegExp("SMF[.](?!.*[.](?:"+["c_bytes","c_fail","c_freed","c_req","g_alloc","g_bytes","g_smf_frag","g_smf_large","g_smf","g_space"].join("|")+")$)"),new RegExp("SMU[.](?!.*[.](?:"+["c_bytes","c_fail","c_freed","c_req","g_alloc","g_bytes","g_space"].join("|")+")$)"),/^BROTLI[.]/,/^SLICER[.]/,new RegExp("VMOD_HTTP[.](?!(?:"+["handle_abandon","handle_completed","handle_internal_error","handle_limited","handle_requests"].join("|")+")$)"),new RegExp("KVSTORE[.](?!.*[.](?:"+[].join("|")+")$)"),new RegExp("ACCG[.](?!.*[.](?:"+["backend_200_count","backend_2xx_count","backend_304_count","backend_3xx_count","backend_404_count","backend_4xx_count","backend_503_count","backend_5xx_count","backend_req_bodybytes","backend_req_count","backend_req_hdrbytes","backend_resp_bodybytes","backend_resp_hdrbytes","client_200_count","client_2xx_count","client_304_count","client_3xx_count","client_404_count","client_4xx_count","client_503_count","client_5xx_count","client_grace_hit_count","client_hit_count","client_hit_req_bodybytes","client_hit_req_hdrbytes","client_hit_resp_bodybytes","client_hit_resp_hdrbytes","client_miss_count","client_miss_req_bodybytes","client_miss_req_hdrbytes","client_miss_resp_bodybytes","client_miss_resp_hdrbytes","client_pass_count","client_pass_req_bodybytes","client_pass_req_hdrbytes","client_pass_resp_bodybytes","client_pass_resp_hdrbytes","client_pipe_count","client_pipe_req_bodybytes","client_pipe_req_hdrbytes","client_pipe_resp_bodybytes","client_pipe_resp_hdrbytes","client_req_bodybytes","client_req_count","client_req_hdrbytes","client_resp_bodybytes","client_resp_hdrbytes","client_synth_count","client_synth_req_bodybytes","client_synth_req_hdrbytes","client_synth_resp_bodybytes","client_synth_resp_hdrbytes"].join("|")+")$)"),new RegExp("ACCG_DIAG[.](?!.*[.](?:"+["bereq_dropped","create_namespace_failure","key_without_namespace","namespace_already_set","namespace_undefined","out_of_key_slots","req_dropped","set_key_failure"].join("|")+")$)"),new RegExp("VBE[.](?!.*[.](?:"+["bereq_bodybytes","bereq_hdrbytes","beresp_bodybytes","beresp_hdrbytes","busy","conn","fail","happy","is_healthy","pipe_hdrbytes","pipe_in","pipe_out","req","unhealthy"].join("|")+")$)"),/^WAITER[.]/,/^MEMPOOL[.]/,/^LCK[.]/],F=[/^(MAIN[.]backend)/,/^(MAIN[.]bans)_?/,/^(MAIN[.]cache)/,/^(MAIN[.]client)/,/^(MAIN[.]esi_)/,/^(MAIN[.]fetch)/,/^(MAIN[.]g_mem)/,/^(MAIN[.]s_)/,/^(MAIN[.]sc_)/,/^(MAIN[.]sess_)/,/^(MAIN[.]shm_)/,/^(MAIN[.]thread)s?_?/,/^(MAIN[.]vgs_)/,/^(MAIN[.]ws_)/,/^(WAITER[.])/,/^(MEMPOOL[.])/,/^(LCK[.])/],j=[/^MGT[.]/,/^MAIN[.][*]$/,/^MAIN[.]/,/^MSE[.]/,/^MSE_/,/^MSE4[.]/,/^MSE4_/,/^SMA[.]/,/^SMF[.]/,/^SMU[.]/,/^BROTLI[.]/,/^SLICER[.]/,/^VMOD_/,/^KVSTORE[.]/,/^ACCG[.]/,/^ACCG_DIAG[.]/,/^VBE[.]/,/^WAITER[.]/,/^MEMPOOL[.]/,/^LCK[.]/];function B(t){t.sort(((t,e)=>t.name.localeCompare(e.name))),function(t){t.forEach((t=>{t.debug=-1!==R.findIndex((e=>e.test(t.name)))}))}(t);const e=function(t){const e={};return t.forEach((t=>{let r="";for(let e of F){const n=t.name.match(e);if(n&&n[1]){r=n[1]+"*";break}}if(""===r){const e=t.name.split(".");e.length>1&&(r=e.slice(0,-1).join(".")+".*")}e[r]||(e[r]=[]),e[r].push(t)})),Object.keys(e).map((t=>({name:t,metrics:e[t]})))}(t);return e.sort(((t,e)=>{const r=j.findIndex((e=>e.test(t.name))),n=j.findIndex((t=>t.test(e.name)));return-1!==r&&-1!==n?r-n:-1!==r?-1:-1!==n?1:t.name.localeCompare(e.name)})),e}function N(t,e){const r=t.sort(((t,e)=>t[0]-e[0])),n=[];for(let t=0;t{t.forEach((t=>{t.target.chart.handleVisibilityChange(t.isIntersecting)}))}),{threshold:.1}),Z=new ResizeObserver((t=>{t.forEach((t=>{t.target.chart.handleSizeChange()}))})),W={fixedrange:!1,griddash:"dash",autorange:!1,showspikes:!0,spikemode:"across",spikesnap:"cursor",spikedash:"dot",spikethickness:1};const Y=class{constructor(t,e,r,n,i,a){this.container=t,this.metric=e,this.rangeFactory=r,this.refreshInterval=n,this.aggregator=i,this.step=a,this.listeners={},this.initializing=!1,this.refreshing=!1,this.debouncedHandleRefresh=s(this.handleRefresh.bind(this),500),this.visible=!1,this.interval=null,this.lastRefresh=0,this.pendingRefresh=!1,this.error=null,this.graph={element:null,x:null,y:null,step:null,range:null,zoomRange:null},G.observe(this.container),Z.observe(this.container)}async init(){if(!this.initializing){this.initializing=!0;try{this.processMetric(await this.getMetric()),this.graph.element=this.renderGraph(),this.setupInterval(),this.lastRefresh=l(new Date),this.pendingRefresh=!1}catch(t){this.setError(`Failed to fetch samples of a metric: ${t}`)}finally{this.initializing=!1}}}async handleRefresh(){if(!this.refreshing){this.refreshing=!0;try{if(null!=this.graph.element&&(this.pendingRefresh=!0,this.visible))try{this.processMetric(await this.getMetric()),this.updateGraph(!1),this.clearError(),this.lastRefresh=l(new Date),this.pendingRefresh=!1}catch(t){this.setError(`Failed to fetch samples of a metric: ${t}`)}}finally{this.refreshing=!1}}}handleVisibilityChange(t){this.visible=t,this.visible?null==this.graph.element?this.init():(null==this.interval&&this.setupInterval(),(this.pendingRefresh||this.refreshInterval>0&&l(new Date)-this.lastRefresh>this.refreshInterval)&&this.debouncedHandleRefresh()):this.stopInterval()}handleSizeChange(){null!=this.graph.element&&this.debouncedHandleRefresh()}handleGraphRelayout(t){if(t["xaxis.range[0]"]&&t["xaxis.range[1]"]?this.graph.zoomRange=[new Date(t["xaxis.range[0]"]),new Date(t["xaxis.range[1]"])]:(t["xaxis.range"]&&Array.isArray(t["xaxis.range"])&&t["xaxis.range"].length,this.graph.zoomRange=null),null!=this.graph.zoomRange&&(l(this.graph.zoomRange[0])l(this.graph.range[1])&&(this.graph.zoomRange[1]=this.graph.range[1])),null!=this.graph.zoomRange){const t=l(this.graph.zoomRange[1])-l(this.graph.zoomRange[0]);if(tt!==e)))}notifyEventListeners(t,e){this.listeners[t]&&this.listeners[t].forEach((t=>t(e)))}redraw(t,e,r){let n="normal"===e&&this.metric.debug;if(!n){const e=t.split(/\s+/).filter((t=>t.length>0));e.length>0&&(n=!e.some((t=>this.metric.name.includes(t))))}this.container.classList.toggle("d-none",n),this.container.classList.forEach((t=>{t.startsWith("col-")&&this.container.classList.remove(t)})),this.container.classList.add("col-"+12/r)}setRefreshInterval(t){this.refreshInterval=t,this.visible&&null!=this.graph.element&&this.setupInterval()}refresh(){null!=this.graph.element&&(this.visible&&this.setupInterval(),this.handleRefresh())}setAggregator(t){this.aggregator=t,null!=this.graph.element&&(this.visible&&this.setupInterval(),this.handleRefresh())}setStep(t){this.step=t,null!=this.graph.element&&(this.visible&&this.setupInterval(),this.handleRefresh())}setZoomRange(t){this.graph.zoomRange=t,null!=this.graph.element&&this.updateGraph(!0)}destroy(){G.unobserve(this.container),Z.unobserve(this.container),this.stopInterval(),this.clearError(),null!=this.graph.element&&V().purge(this.graph.element)}setupInterval(){this.stopInterval(),this.refreshInterval>0&&(this.interval=setInterval(this.handleRefresh.bind(this),1e3*this.refreshInterval))}stopInterval(){null!=this.interval&&(clearInterval(this.interval),this.interval=null)}setError(t){const e=this.container.querySelector(".card"),r=e.querySelector(".error-icon");null==this.error&&(e.classList.add("border-danger"),r.classList.remove("d-none"));const n=`${(new Date).toISOString()}: ${t}`;let i=H().getInstance(r);null==i?i=new(H())(r,{title:n}):i.setContent({".tooltip-inner":n}),this.error=t}clearError(){if(null!=this.error){const t=this.container.querySelector(".card");t.classList.remove("border-danger");const e=t.querySelector(".error-icon");e.classList.add("d-none");H().getInstance(e).dispose(),this.error=null}}async getMetric(){const t=this.container.querySelector(".card .loading-icon");t.classList.remove("d-none");try{const[t,e]=this.rangeFactory(),r=this.estimateOptimalStep(t,e),n="b"===this.metric.flag?"bit_and":this.aggregator;return await async function(t,e,r,n,i){const a=new URLSearchParams({from:l(e),to:l(r),step:n,aggregator:i}),o=await fetch(`/storage/metrics/${t}?${a.toString()}`);if(!o.ok)throw new Error(`Unexpected API response (${o.status}): ${o.statusText}`);const s=await o.json();return{from:c(s.from),to:c(s.to),step:s.step,samples:N(s.samples,s.step)}}(this.metric.id,t,e,r,n)}finally{t.classList.add("d-none")}}estimateOptimalStep(t,e){const r=(l(e)-l(t))/this.step,n=this.container.clientWidth,i=Math.floor(.9*n);if(i<=0)throw new Error("Failed to estimate the optimal step");return r<=i?this.step:Math.ceil(r/i)*this.step}processMetric(t){this.graph.x=[],this.graph.y=[],t.samples.forEach((t=>{this.graph.x.push(t[0]),this.graph.y.push("b"===this.metric.flag?BigInt(`0x${t[1]}`).toString(2).split("").filter((t=>"1"===t)).length:t[1])})),this.graph.step=t.step,this.graph.range=[t.from,new Date(t.to.getTime()-1e3*t.step)];const e=this.container.querySelector(".card .step-factor");if(this.graph.step!==this.step){const t=Math.round(this.graph.step/this.step);e.innerHTML=` ${t}x`}else e.innerHTML=""}renderGraph(){const t=null!=this.graph.zoomRange?this.graph.zoomRange:this.graph.range,e=[{x:this.graph.x,y:this.graph.y,type:"scatter",mode:this.estimatePlotlyDataMode(...t,this.graph.step),marker:{size:4},hovertemplate:"X: %{x|%Y-%m-%d %H:%M:%S}
Y: %{y:,.1f}",connectgaps:!1,line:{shape:"linear",width:2}}],r={autosize:!0,title:{text:this.metric.name,font:{size:14},subtitle:{text:this.metric.description}},margin:{l:60,r:10,b:40,t:40,pad:5},hovermode:"closest",xaxis:{...W,range:Array.from(t)},yaxis:{fixedrange:!0,griddash:"dash",rangemode:"normal",title:(()=>{if("c"===this.metric.flag)return"d"===this.metric.format?"seconds":"B"===this.metric.format?"Bps":"eps";if("g"===this.metric.flag){if("d"===this.metric.format)return"seconds";if("B"===this.metric.format)return"bytes"}return""})()}},n={responsive:!0,displaylogo:!1,modeBarButtons:[["zoomIn2d","zoomOut2d","resetScale2d"],[{name:"download",title:"Download plot",icon:V().Icons.disk,click:t=>{V().downloadImage(t,{filename:`${varnishmon.storage.hostname} - ${this.metric.name}`,format:"png",width:null,height:null,scale:1}).then((()=>{u("info","Plot ready for download")})).catch((t=>{u("error",`Failed to download plot: ${t}`)}))}},{name:"copy-to-clipboard",title:"Copy plot to clipboard",icon:V().Icons.camera,click:t=>{V().toImage(t,{format:"png",width:null,height:null,scale:1}).then((t=>{fetch(t).then((t=>{t.blob().then((t=>{navigator.clipboard.write([new ClipboardItem({"image/png":t})]).then((()=>{u("info","Plot copied to clipboard")})).catch((t=>{u("error",`Failed to copy plot to clipboard: ${t}`)}))}))}))}))}}]],scrollZoom:!1},i=this.container.querySelector(".graph");return V().newPlot(i,e,r,n),i.on("plotly_relayout",this.handleGraphRelayout.bind(this)),i}updateGraph(t){const e=null!=this.graph.zoomRange?this.graph.zoomRange:this.graph.range,r={mode:this.estimatePlotlyDataMode(...e,this.graph.step)};t||(r.x=[this.graph.x],r.y=[this.graph.y]);const n={xaxis:{...W,range:Array.from(e)}};V().update(this.graph.element,r,n)}estimatePlotlyDataMode(t,e,r){const n=(l(e)-l(t))/r,i=this.container.clientWidth;return n>Math.floor(.9*i/6)?"lines":"lines+markers"}};var X=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],$={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(t){return"undefined"!=typeof console&&console.warn(t)},getWeek:function(t){var e=new Date(t.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var r=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-r.getTime())/864e5-3+(r.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},K={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(t){var e=t%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1};const J=K;var Q=function(t,e){return void 0===e&&(e=2),("000"+t).slice(-1*e)},tt=function(t){return!0===t?1:0};function et(t,e){var r;return function(){var n=this,i=arguments;clearTimeout(r),r=setTimeout((function(){return t.apply(n,i)}),e)}}var rt=function(t){return t instanceof Array?t:[t]};function nt(t,e,r){if(!0===r)return t.classList.add(e);t.classList.remove(e)}function it(t,e,r){var n=window.document.createElement(t);return e=e||"",r=r||"",n.className=e,void 0!==r&&(n.textContent=r),n}function at(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function ot(t,e){return e(t)?t:t.parentNode?ot(t.parentNode,e):void 0}function st(t,e){var r=it("div","numInputWrapper"),n=it("input","numInput "+t),i=it("span","arrowUp"),a=it("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?n.type="number":(n.type="text",n.pattern="\\d*"),void 0!==e)for(var o in e)n.setAttribute(o,e[o]);return r.appendChild(n),r.appendChild(i),r.appendChild(a),r}function lt(t){try{return"function"==typeof t.composedPath?t.composedPath()[0]:t.target}catch(e){return t.target}}var ct=function(){},ut=function(t,e,r){return r.months[e?"shorthand":"longhand"][t]},ht={D:ct,F:function(t,e,r){t.setMonth(r.months.longhand.indexOf(e))},G:function(t,e){t.setHours((t.getHours()>=12?12:0)+parseFloat(e))},H:function(t,e){t.setHours(parseFloat(e))},J:function(t,e){t.setDate(parseFloat(e))},K:function(t,e,r){t.setHours(t.getHours()%12+12*tt(new RegExp(r.amPM[1],"i").test(e)))},M:function(t,e,r){t.setMonth(r.months.shorthand.indexOf(e))},S:function(t,e){t.setSeconds(parseFloat(e))},U:function(t,e){return new Date(1e3*parseFloat(e))},W:function(t,e,r){var n=parseInt(e),i=new Date(t.getFullYear(),0,2+7*(n-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+r.firstDayOfWeek),i},Y:function(t,e){t.setFullYear(parseFloat(e))},Z:function(t,e){return new Date(e)},d:function(t,e){t.setDate(parseFloat(e))},h:function(t,e){t.setHours((t.getHours()>=12?12:0)+parseFloat(e))},i:function(t,e){t.setMinutes(parseFloat(e))},j:function(t,e){t.setDate(parseFloat(e))},l:ct,m:function(t,e){t.setMonth(parseFloat(e)-1)},n:function(t,e){t.setMonth(parseFloat(e)-1)},s:function(t,e){t.setSeconds(parseFloat(e))},u:function(t,e){return new Date(parseFloat(e))},w:ct,y:function(t,e){t.setFullYear(2e3+parseFloat(e))}},ft={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},pt={Z:function(t){return t.toISOString()},D:function(t,e,r){return e.weekdays.shorthand[pt.w(t,e,r)]},F:function(t,e,r){return ut(pt.n(t,e,r)-1,!1,e)},G:function(t,e,r){return Q(pt.h(t,e,r))},H:function(t){return Q(t.getHours())},J:function(t,e){return void 0!==e.ordinal?t.getDate()+e.ordinal(t.getDate()):t.getDate()},K:function(t,e){return e.amPM[tt(t.getHours()>11)]},M:function(t,e){return ut(t.getMonth(),!0,e)},S:function(t){return Q(t.getSeconds())},U:function(t){return t.getTime()/1e3},W:function(t,e,r){return r.getWeek(t)},Y:function(t){return Q(t.getFullYear(),4)},d:function(t){return Q(t.getDate())},h:function(t){return t.getHours()%12?t.getHours()%12:12},i:function(t){return Q(t.getMinutes())},j:function(t){return t.getDate()},l:function(t,e){return e.weekdays.longhand[t.getDay()]},m:function(t){return Q(t.getMonth()+1)},n:function(t){return t.getMonth()+1},s:function(t){return t.getSeconds()},u:function(t){return t.getTime()},w:function(t){return t.getDay()},y:function(t){return String(t.getFullYear()).substring(2)}},dt=function(t){var e=t.config,r=void 0===e?$:e,n=t.l10n,i=void 0===n?K:n,a=t.isMobile,o=void 0!==a&&a;return function(t,e,n){var a=n||i;return void 0===r.formatDate||o?e.split("").map((function(e,n,i){return pt[e]&&"\\"!==i[n-1]?pt[e](t,a,r):"\\"!==e?e:""})).join(""):r.formatDate(t,e,a)}},mt=function(t){var e=t.config,r=void 0===e?$:e,n=t.l10n,i=void 0===n?K:n;return function(t,e,n,a){if(0===t||t){var o,s=a||i,l=t;if(t instanceof Date)o=new Date(t.getTime());else if("string"!=typeof t&&void 0!==t.toFixed)o=new Date(t);else if("string"==typeof t){var c=e||(r||$).dateFormat,u=String(t).trim();if("today"===u)o=new Date,n=!0;else if(r&&r.parseDate)o=r.parseDate(t,c);else if(/Z$/.test(u)||/GMT$/.test(u))o=new Date(t);else{for(var h=void 0,f=[],p=0,d=0,m="";p=0?new Date:new Date(r.config.minDate.getTime()),n=xt(r.config);e.setHours(n.hours,n.minutes,n.seconds,e.getMilliseconds()),r.selectedDates=[e],r.latestSelectedDateObj=e}void 0!==t&&"blur"!==t.type&&function(t){t.preventDefault();var e="keydown"===t.type,n=lt(t),i=n;void 0!==r.amPM&&n===r.amPM&&(r.amPM.textContent=r.l10n.amPM[tt(r.amPM.textContent===r.l10n.amPM[0])]);var a=parseFloat(i.getAttribute("min")),o=parseFloat(i.getAttribute("max")),s=parseFloat(i.getAttribute("step")),l=parseInt(i.value,10),c=t.delta||(e?38===t.which?1:-1:0),u=l+s*c;if(void 0!==i.value&&2===i.value.length){var h=i===r.hourElement,f=i===r.minuteElement;uo&&(u=i===r.hourElement?u-o-tt(!r.amPM):a,f&&m(void 0,1,r.hourElement)),r.amPM&&h&&(1===s?u+l===23:Math.abs(u-l)>s)&&(r.amPM.textContent=r.l10n.amPM[tt(r.amPM.textContent===r.l10n.amPM[0])]),i.value=Q(u)}}(t);var i=r._input.value;s(),wt(),r._input.value!==i&&r._debouncedChange()}function s(){if(void 0!==r.hourElement&&void 0!==r.minuteElement){var t,e,n=(parseInt(r.hourElement.value.slice(-2),10)||0)%24,i=(parseInt(r.minuteElement.value,10)||0)%60,a=void 0!==r.secondElement?(parseInt(r.secondElement.value,10)||0)%60:0;void 0!==r.amPM&&(t=n,e=r.amPM.textContent,n=t%12+12*tt(e===r.l10n.amPM[1]));var o=void 0!==r.config.minTime||r.config.minDate&&r.minDateHasTime&&r.latestSelectedDateObj&&0===gt(r.latestSelectedDateObj,r.config.minDate,!0),s=void 0!==r.config.maxTime||r.config.maxDate&&r.maxDateHasTime&&r.latestSelectedDateObj&&0===gt(r.latestSelectedDateObj,r.config.maxDate,!0);if(void 0!==r.config.maxTime&&void 0!==r.config.minTime&&r.config.minTime>r.config.maxTime){var l=yt(r.config.minTime.getHours(),r.config.minTime.getMinutes(),r.config.minTime.getSeconds()),u=yt(r.config.maxTime.getHours(),r.config.maxTime.getMinutes(),r.config.maxTime.getSeconds()),h=yt(n,i,a);if(h>u&&h=12)]),void 0!==r.secondElement&&(r.secondElement.value=Q(n)))}function u(t){var e=lt(t),r=parseInt(e.value)+(t.delta||0);(r/1e3>1||"Enter"===t.key&&!/[^\d]/.test(r.toString()))&&I(r)}function h(t,e,n,i){return e instanceof Array?e.forEach((function(e){return h(t,e,n,i)})):t instanceof Array?t.forEach((function(t){return h(t,e,n,i)})):(t.addEventListener(e,n,i),void r._handlers.push({remove:function(){return t.removeEventListener(e,n,i)}}))}function f(){Y("onChange")}function p(t,e){var n=void 0!==t?r.parseDate(t):r.latestSelectedDateObj||(r.config.minDate&&r.config.minDate>r.now?r.config.minDate:r.config.maxDate&&r.config.maxDate=0&>(t,r.selectedDates[1])<=0)}(e)&&!ct(e)&&o.classList.add("inRange"),r.weekNumbers&&1===r.config.showMonths&&"prevMonthDay"!==t&&i%7==6&&r.weekNumbers.insertAdjacentHTML("beforeend",""+r.config.getWeek(e)+""),Y("onDayCreate",o),o}function y(t){t.focus(),"range"===r.config.mode&&O(t)}function v(t){for(var e=t>0?0:r.config.showMonths-1,n=t>0?r.config.showMonths:-1,i=e;i!=n;i+=t)for(var a=r.daysContainer.children[i],o=t>0?0:a.children.length-1,s=t>0?a.children.length:-1,l=o;l!=s;l+=t){var c=a.children[l];if(-1===c.className.indexOf("hidden")&&L(c.dateObj))return c}}function x(t,e){var i=n(),a=P(i||document.body),o=void 0!==t?t:a?i:void 0!==r.selectedDateElem&&P(r.selectedDateElem)?r.selectedDateElem:void 0!==r.todayDateElem&&P(r.todayDateElem)?r.todayDateElem:v(e>0?1:-1);void 0===o?r._input.focus():a?function(t,e){for(var n=-1===t.className.indexOf("Month")?t.dateObj.getMonth():r.currentMonth,i=e>0?r.config.showMonths:-1,a=e>0?1:-1,o=n-r.currentMonth;o!=i;o+=a)for(var s=r.daysContainer.children[o],l=n-r.currentMonth===o?t.$i+e:e<0?s.children.length-1:0,c=s.children.length,u=l;u>=0&&u0?c:-1);u+=a){var h=s.children[u];if(-1===h.className.indexOf("hidden")&&L(h.dateObj)&&Math.abs(t.$i-u)>=Math.abs(e))return y(h)}r.changeMonth(a),x(v(a),0)}(o,e):y(o)}function _(t,e){for(var n=(new Date(t,e,1).getDay()-r.l10n.firstDayOfWeek+7)%7,i=r.utils.getDaysInMonth((e-1+12)%12,t),a=r.utils.getDaysInMonth(e,t),o=window.document.createDocumentFragment(),s=r.config.showMonths>1,l=s?"prevMonthDay hidden":"prevMonthDay",c=s?"nextMonthDay hidden":"nextMonthDay",u=i+1-n,h=0;u<=i;u++,h++)o.appendChild(g("flatpickr-day "+l,new Date(t,e-1,u),0,h));for(u=1;u<=a;u++,h++)o.appendChild(g("flatpickr-day",new Date(t,e,u),0,h));for(var f=a+1;f<=42-n&&(1===r.config.showMonths||h%7!=0);f++,h++)o.appendChild(g("flatpickr-day "+c,new Date(t,e+1,f%a),0,h));var p=it("div","dayContainer");return p.appendChild(o),p}function b(){if(void 0!==r.daysContainer){at(r.daysContainer),r.weekNumbers&&at(r.weekNumbers);for(var t=document.createDocumentFragment(),e=0;e1||"dropdown"!==r.config.monthSelectorType)){var t=function(t){return!(void 0!==r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&tr.config.maxDate.getMonth())};r.monthsDropdownContainer.tabIndex=-1,r.monthsDropdownContainer.innerHTML="";for(var e=0;e<12;e++)if(t(e)){var n=it("option","flatpickr-monthDropdown-month");n.value=new Date(r.currentYear,e).getMonth().toString(),n.textContent=ut(e,r.config.shorthandCurrentMonth,r.l10n),n.tabIndex=-1,r.currentMonth===e&&(n.selected=!0),r.monthsDropdownContainer.appendChild(n)}}}function T(){var t,e=it("div","flatpickr-month"),n=window.document.createDocumentFragment();r.config.showMonths>1||"static"===r.config.monthSelectorType?t=it("span","cur-month"):(r.monthsDropdownContainer=it("select","flatpickr-monthDropdown-months"),r.monthsDropdownContainer.setAttribute("aria-label",r.l10n.monthAriaLabel),h(r.monthsDropdownContainer,"change",(function(t){var e=lt(t),n=parseInt(e.value,10);r.changeMonth(n-r.currentMonth),Y("onMonthChange")})),w(),t=r.monthsDropdownContainer);var i=st("cur-year",{tabindex:"-1"}),a=i.getElementsByTagName("input")[0];a.setAttribute("aria-label",r.l10n.yearAriaLabel),r.config.minDate&&a.setAttribute("min",r.config.minDate.getFullYear().toString()),r.config.maxDate&&(a.setAttribute("max",r.config.maxDate.getFullYear().toString()),a.disabled=!!r.config.minDate&&r.config.minDate.getFullYear()===r.config.maxDate.getFullYear());var o=it("div","flatpickr-current-month");return o.appendChild(t),o.appendChild(i),n.appendChild(o),e.appendChild(n),{container:e,yearElement:a,monthElement:t}}function k(){at(r.monthNav),r.monthNav.appendChild(r.prevMonthNav),r.config.showMonths&&(r.yearElements=[],r.monthElements=[]);for(var t=r.config.showMonths;t--;){var e=T();r.yearElements.push(e.yearElement),r.monthElements.push(e.monthElement),r.monthNav.appendChild(e.container)}r.monthNav.appendChild(r.nextMonthNav)}function A(){r.weekdayContainer?at(r.weekdayContainer):r.weekdayContainer=it("div","flatpickr-weekdays");for(var t=r.config.showMonths;t--;){var e=it("div","flatpickr-weekdaycontainer");r.weekdayContainer.appendChild(e)}return M(),r.weekdayContainer}function M(){if(r.weekdayContainer){var t=r.l10n.firstDayOfWeek,e=bt(r.l10n.weekdays.shorthand);t>0&&t\n "+e.join("")+"\n \n "}}function S(t,e){void 0===e&&(e=!0);var n=e?t:t-r.currentMonth;n<0&&!0===r._hidePrevMonthArrow||n>0&&!0===r._hideNextMonthArrow||(r.currentMonth+=n,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,Y("onYearChange"),w()),b(),Y("onMonthChange"),ht())}function E(t){return r.calendarContainer.contains(t)}function C(t){if(r.isOpen&&!r.config.inline){var e=lt(t),n=E(e),i=!(e===r.input||e===r.altInput||r.element.contains(e)||t.path&&t.path.indexOf&&(~t.path.indexOf(r.input)||~t.path.indexOf(r.altInput)))&&!n&&!E(t.relatedTarget),a=!r.config.ignoredFocusElements.some((function(t){return t.contains(e)}));i&&a&&(r.config.allowInput&&r.setDate(r._input.value,!1,r.config.altInput?r.config.altFormat:r.config.dateFormat),void 0!==r.timeContainer&&void 0!==r.minuteElement&&void 0!==r.hourElement&&""!==r.input.value&&void 0!==r.input.value&&o(),r.close(),r.config&&"range"===r.config.mode&&1===r.selectedDates.length&&r.clear(!1))}}function I(t){if(!(!t||r.config.minDate&&tr.config.maxDate.getFullYear())){var e=t,n=r.currentYear!==e;r.currentYear=e||r.currentYear,r.config.maxDate&&r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth=Math.min(r.config.maxDate.getMonth(),r.currentMonth):r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&(r.currentMonth=Math.max(r.config.minDate.getMonth(),r.currentMonth)),n&&(r.redraw(),Y("onYearChange"),w())}}function L(t,e){var n;void 0===e&&(e=!0);var i=r.parseDate(t,void 0,e);if(r.config.minDate&&i&>(i,r.config.minDate,void 0!==e?e:!r.minDateHasTime)<0||r.config.maxDate&&i&>(i,r.config.maxDate,void 0!==e?e:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&0===r.config.disable.length)return!0;if(void 0===i)return!1;for(var a=!!r.config.enable,o=null!==(n=r.config.enable)&&void 0!==n?n:r.config.disable,s=0,l=void 0;s=l.from.getTime()&&i.getTime()<=l.to.getTime())return a}return!a}function P(t){return void 0!==r.daysContainer&&(-1===t.className.indexOf("hidden")&&-1===t.className.indexOf("flatpickr-disabled")&&r.daysContainer.contains(t))}function z(t){var e=t.target===r._input,n=r._input.value.trimEnd()!==pt();!e||!n||t.relatedTarget&&E(t.relatedTarget)||r.setDate(r._input.value,!0,t.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function D(e){var i=lt(e),a=r.config.wrap?t.contains(i):i===r._input,l=r.config.allowInput,c=r.isOpen&&(!l||!a),u=r.config.inline&&a&&!l;if(13===e.keyCode&&a){if(l)return r.setDate(r._input.value,!0,i===r.altInput?r.config.altFormat:r.config.dateFormat),r.close(),i.blur();r.open()}else if(E(i)||c||u){var h=!!r.timeContainer&&r.timeContainer.contains(i);switch(e.keyCode){case 13:h?(e.preventDefault(),o(),V()):q(e);break;case 27:e.preventDefault(),V();break;case 8:case 46:a&&!r.config.allowInput&&(e.preventDefault(),r.clear());break;case 37:case 39:if(h||a)r.hourElement&&r.hourElement.focus();else{e.preventDefault();var f=n();if(void 0!==r.daysContainer&&(!1===l||f&&P(f))){var p=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),S(p),x(v(1),0)):x(void 0,p)}}break;case 38:case 40:e.preventDefault();var d=40===e.keyCode?1:-1;r.daysContainer&&void 0!==i.$i||i===r.input||i===r.altInput?e.ctrlKey?(e.stopPropagation(),I(r.currentYear-d),x(v(1),0)):h||x(void 0,7*d):i===r.currentYearElement?I(r.currentYear-d):r.config.enableTime&&(!h&&r.hourElement&&r.hourElement.focus(),o(e),r._debouncedChange());break;case 9:if(h){var m=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter((function(t){return t})),g=m.indexOf(i);if(-1!==g){var y=m[g+(e.shiftKey?-1:1)];e.preventDefault(),(y||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(i)&&e.shiftKey&&(e.preventDefault(),r._input.focus())}}if(void 0!==r.amPM&&i===r.amPM)switch(e.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],s(),wt();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],s(),wt()}(a||E(i))&&Y("onKeyDown",e)}function O(t,e){if(void 0===e&&(e="flatpickr-day"),1===r.selectedDates.length&&(!t||t.classList.contains(e)&&!t.classList.contains("flatpickr-disabled"))){for(var n=t?t.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),i=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),a=Math.min(n,r.selectedDates[0].getTime()),o=Math.max(n,r.selectedDates[0].getTime()),s=!1,l=0,c=0,u=a;ua&&ul)?l=u:u>i&&(!c||u ."+e)).forEach((function(e){var a,o,u,h=e.dateObj.getTime(),f=l>0&&h0&&h>c;if(f)return e.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(t){e.classList.remove(t)}));s&&!f||(["startRange","inRange","endRange","notAllowed"].forEach((function(t){e.classList.remove(t)})),void 0!==t&&(t.classList.add(n<=r.selectedDates[0].getTime()?"startRange":"endRange"),in&&h===i&&e.classList.add("endRange"),h>=l&&(0===c||h<=c)&&(o=i,u=n,(a=h)>Math.min(o,u)&&a0||n.getMinutes()>0||n.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter((function(t){return L(t)})),r.selectedDates.length||"min"!==t||l(n),wt()),r.daysContainer&&(U(),void 0!==n?r.currentYearElement[t]=n.getFullYear().toString():r.currentYearElement.removeAttribute(t),r.currentYearElement.disabled=!!i&&void 0!==n&&i.getFullYear()===n.getFullYear())}}function j(){return r.config.wrap?t.querySelector("[data-input]"):t}function B(){"object"!=typeof r.config.locale&&void 0===kt.l10ns[r.config.locale]&&r.config.errorHandler(new Error("flatpickr: invalid locale "+r.config.locale)),r.l10n=_t(_t({},kt.l10ns.default),"object"==typeof r.config.locale?r.config.locale:"default"!==r.config.locale?kt.l10ns[r.config.locale]:void 0),ft.D="("+r.l10n.weekdays.shorthand.join("|")+")",ft.l="("+r.l10n.weekdays.longhand.join("|")+")",ft.M="("+r.l10n.months.shorthand.join("|")+")",ft.F="("+r.l10n.months.longhand.join("|")+")",ft.K="("+r.l10n.amPM[0]+"|"+r.l10n.amPM[1]+"|"+r.l10n.amPM[0].toLowerCase()+"|"+r.l10n.amPM[1].toLowerCase()+")",void 0===_t(_t({},e),JSON.parse(JSON.stringify(t.dataset||{}))).time_24hr&&void 0===kt.defaultConfig.time_24hr&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=dt(r),r.parseDate=mt({config:r.config,l10n:r.l10n})}function N(t){if("function"!=typeof r.config.position){if(void 0!==r.calendarContainer){Y("onPreCalendarPosition");var e=t||r._positionElement,n=Array.prototype.reduce.call(r.calendarContainer.children,(function(t,e){return t+e.offsetHeight}),0),i=r.calendarContainer.offsetWidth,a=r.config.position.split(" "),o=a[0],s=a.length>1?a[1]:null,l=e.getBoundingClientRect(),c=window.innerHeight-l.bottom,u="above"===o||"below"!==o&&cn,h=window.pageYOffset+l.top+(u?-n-2:e.offsetHeight+2);if(nt(r.calendarContainer,"arrowTop",!u),nt(r.calendarContainer,"arrowBottom",u),!r.config.inline){var f=window.pageXOffset+l.left,p=!1,d=!1;"center"===s?(f-=(i-l.width)/2,p=!0):"right"===s&&(f-=i-l.width,d=!0),nt(r.calendarContainer,"arrowLeft",!p&&!d),nt(r.calendarContainer,"arrowCenter",p),nt(r.calendarContainer,"arrowRight",d);var m=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=f+i>window.document.body.offsetWidth,y=m+i>window.document.body.offsetWidth;if(nt(r.calendarContainer,"rightMost",g),!r.config.static)if(r.calendarContainer.style.top=h+"px",g)if(y){var v=function(){for(var t=null,e=0;er.currentMonth+r.config.showMonths-1)&&"range"!==r.config.mode;if(r.selectedDateElem=n,"single"===r.config.mode)r.selectedDates=[i];else if("multiple"===r.config.mode){var o=ct(i);o?r.selectedDates.splice(parseInt(o),1):r.selectedDates.push(i)}else"range"===r.config.mode&&(2===r.selectedDates.length&&r.clear(!1,!1),r.latestSelectedDateObj=i,r.selectedDates.push(i),0!==gt(i,r.selectedDates[0],!0)&&r.selectedDates.sort((function(t,e){return t.getTime()-e.getTime()})));if(s(),a){var l=r.currentYear!==i.getFullYear();r.currentYear=i.getFullYear(),r.currentMonth=i.getMonth(),l&&(Y("onYearChange"),w()),Y("onMonthChange")}if(ht(),b(),wt(),a||"range"===r.config.mode||1!==r.config.showMonths?void 0!==r.selectedDateElem&&void 0===r.hourElement&&r.selectedDateElem&&r.selectedDateElem.focus():y(n),void 0!==r.hourElement&&void 0!==r.hourElement&&r.hourElement.focus(),r.config.closeOnSelect){var c="single"===r.config.mode&&!r.config.enableTime,u="range"===r.config.mode&&2===r.selectedDates.length&&!r.config.enableTime;(c||u)&&V()}f()}}r.parseDate=mt({config:r.config,l10n:r.l10n}),r._handlers=[],r.pluginElements=[],r.loadedPlugins=[],r._bind=h,r._setHoursFromDate=l,r._positionCalendar=N,r.changeMonth=S,r.changeYear=I,r.clear=function(t,e){void 0===t&&(t=!0);void 0===e&&(e=!0);r.input.value="",void 0!==r.altInput&&(r.altInput.value="");void 0!==r.mobileInput&&(r.mobileInput.value="");r.selectedDates=[],r.latestSelectedDateObj=void 0,!0===e&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth());if(!0===r.config.enableTime){var n=xt(r.config);c(n.hours,n.minutes,n.seconds)}r.redraw(),t&&Y("onChange")},r.close=function(){r.isOpen=!1,r.isMobile||(void 0!==r.calendarContainer&&r.calendarContainer.classList.remove("open"),void 0!==r._input&&r._input.classList.remove("active"));Y("onClose")},r.onMouseOver=O,r._createElement=it,r.createDay=g,r.destroy=function(){void 0!==r.config&&Y("onDestroy");for(var t=r._handlers.length;t--;)r._handlers[t].remove();if(r._handlers=[],r.mobileInput)r.mobileInput.parentNode&&r.mobileInput.parentNode.removeChild(r.mobileInput),r.mobileInput=void 0;else if(r.calendarContainer&&r.calendarContainer.parentNode)if(r.config.static&&r.calendarContainer.parentNode){var e=r.calendarContainer.parentNode;if(e.lastChild&&e.removeChild(e.lastChild),e.parentNode){for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.parentNode.removeChild(e)}}else r.calendarContainer.parentNode.removeChild(r.calendarContainer);r.altInput&&(r.input.type="text",r.altInput.parentNode&&r.altInput.parentNode.removeChild(r.altInput),delete r.altInput);r.input&&(r.input.type=r.input._type,r.input.classList.remove("flatpickr-input"),r.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(t){try{delete r[t]}catch(t){}}))},r.isEnabled=L,r.jumpToDate=p,r.updateValue=wt,r.open=function(t,e){void 0===e&&(e=r._positionElement);if(!0===r.isMobile){if(t){t.preventDefault();var n=lt(t);n&&n.blur()}return void 0!==r.mobileInput&&(r.mobileInput.focus(),r.mobileInput.click()),void Y("onOpen")}if(r._input.disabled||r.config.inline)return;var i=r.isOpen;r.isOpen=!0,i||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),Y("onOpen"),N(e));!0===r.config.enableTime&&!0===r.config.noCalendar&&(!1!==r.config.allowInput||void 0!==t&&r.timeContainer.contains(t.relatedTarget)||setTimeout((function(){return r.hourElement.select()}),50))},r.redraw=U,r.set=function(t,e){if(null!==t&&"object"==typeof t)for(var n in Object.assign(r.config,t),t)void 0!==H[n]&&H[n].forEach((function(t){return t()}));else r.config[t]=e,void 0!==H[t]?H[t].forEach((function(t){return t()})):X.indexOf(t)>-1&&(r.config[t]=rt(e));r.redraw(),wt(!0)},r.setDate=function(t,e,n){void 0===e&&(e=!1);void 0===n&&(n=r.config.dateFormat);if(0!==t&&!t||t instanceof Array&&0===t.length)return r.clear(e);G(t,n),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),p(void 0,e),l(),0===r.selectedDates.length&&r.clear(!1);wt(e),e&&Y("onChange")},r.toggle=function(t){if(!0===r.isOpen)return r.close();r.open(t)};var H={locale:[B,M],showMonths:[k,a,A],minDate:[p],maxDate:[p],positionElement:[W],clickOpens:[function(){!0===r.config.clickOpens?(h(r._input,"focus",r.open),h(r._input,"click",r.open)):(r._input.removeEventListener("focus",r.open),r._input.removeEventListener("click",r.open))}]};function G(t,e){var n=[];if(t instanceof Array)n=t.map((function(t){return r.parseDate(t,e)}));else if(t instanceof Date||"number"==typeof t)n=[r.parseDate(t,e)];else if("string"==typeof t)switch(r.config.mode){case"single":case"time":n=[r.parseDate(t,e)];break;case"multiple":n=t.split(r.config.conjunction).map((function(t){return r.parseDate(t,e)}));break;case"range":n=t.split(r.l10n.rangeSeparator).map((function(t){return r.parseDate(t,e)}))}else r.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(t)));r.selectedDates=r.config.allowInvalidPreload?n:n.filter((function(t){return t instanceof Date&&L(t,!1)})),"range"===r.config.mode&&r.selectedDates.sort((function(t,e){return t.getTime()-e.getTime()}))}function Z(t){return t.slice().map((function(t){return"string"==typeof t||"number"==typeof t||t instanceof Date?r.parseDate(t,void 0,!0):t&&"object"==typeof t&&t.from&&t.to?{from:r.parseDate(t.from,void 0),to:r.parseDate(t.to,void 0)}:t})).filter((function(t){return t}))}function W(){r._positionElement=r.config.positionElement||r._input}function Y(t,e){if(void 0!==r.config){var n=r.config[t];if(void 0!==n&&n.length>0)for(var i=0;n[i]&&i1||"static"===r.config.monthSelectorType?r.monthElements[e].textContent=ut(n.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=n.getMonth().toString(),t.value=n.getFullYear().toString()})),r._hidePrevMonthArrow=void 0!==r.config.minDate&&(r.currentYear===r.config.minDate.getFullYear()?r.currentMonth<=r.config.minDate.getMonth():r.currentYearr.config.maxDate.getMonth():r.currentYear>r.config.maxDate.getFullYear()))}function pt(t){var e=t||(r.config.altInput?r.config.altFormat:r.config.dateFormat);return r.selectedDates.map((function(t){return r.formatDate(t,e)})).filter((function(t,e,n){return"range"!==r.config.mode||r.config.enableTime||n.indexOf(t)===e})).join("range"!==r.config.mode?r.config.conjunction:r.l10n.rangeSeparator)}function wt(t){void 0===t&&(t=!0),void 0!==r.mobileInput&&r.mobileFormatStr&&(r.mobileInput.value=void 0!==r.latestSelectedDateObj?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=pt(r.config.dateFormat),void 0!==r.altInput&&(r.altInput.value=pt(r.config.altFormat)),!1!==t&&Y("onValueUpdate")}function Tt(t){var e=lt(t),n=r.prevMonthNav.contains(e),i=r.nextMonthNav.contains(e);n||i?S(n?-1:1):r.yearElements.indexOf(e)>=0?e.select():e.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):e.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}return function(){r.element=r.input=t,r.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],a=_t(_t({},JSON.parse(JSON.stringify(t.dataset||{}))),e),o={};r.config.parseDate=a.parseDate,r.config.formatDate=a.formatDate,Object.defineProperty(r.config,"enable",{get:function(){return r.config._enable},set:function(t){r.config._enable=Z(t)}}),Object.defineProperty(r.config,"disable",{get:function(){return r.config._disable},set:function(t){r.config._disable=Z(t)}});var s="time"===a.mode;if(!a.dateFormat&&(a.enableTime||s)){var l=kt.defaultConfig.dateFormat||$.dateFormat;o.dateFormat=a.noCalendar||s?"H:i"+(a.enableSeconds?":S":""):l+" H:i"+(a.enableSeconds?":S":"")}if(a.altInput&&(a.enableTime||s)&&!a.altFormat){var c=kt.defaultConfig.altFormat||$.altFormat;o.altFormat=a.noCalendar||s?"h:i"+(a.enableSeconds?":S K":" K"):c+" h:i"+(a.enableSeconds?":S":"")+" K"}Object.defineProperty(r.config,"minDate",{get:function(){return r.config._minDate},set:F("min")}),Object.defineProperty(r.config,"maxDate",{get:function(){return r.config._maxDate},set:F("max")});var u=function(t){return function(e){r.config["min"===t?"_minTime":"_maxTime"]=r.parseDate(e,"H:i:S")}};Object.defineProperty(r.config,"minTime",{get:function(){return r.config._minTime},set:u("min")}),Object.defineProperty(r.config,"maxTime",{get:function(){return r.config._maxTime},set:u("max")}),"time"===a.mode&&(r.config.noCalendar=!0,r.config.enableTime=!0);Object.assign(r.config,o,a);for(var h=0;h-1?r.config[p]=rt(f[p]).map(i).concat(r.config[p]):void 0===a[p]&&(r.config[p]=f[p])}a.altInputClass||(r.config.altInputClass=j().className+" "+r.config.altInputClass);Y("onParseConfig")}(),B(),function(){if(r.input=j(),!r.input)return void r.config.errorHandler(new Error("Invalid input element specified"));r.input._type=r.input.type,r.input.type="text",r.input.classList.add("flatpickr-input"),r._input=r.input,r.config.altInput&&(r.altInput=it(r.input.nodeName,r.config.altInputClass),r._input=r.altInput,r.altInput.placeholder=r.input.placeholder,r.altInput.disabled=r.input.disabled,r.altInput.required=r.input.required,r.altInput.tabIndex=r.input.tabIndex,r.altInput.type="text",r.input.setAttribute("type","hidden"),!r.config.static&&r.input.parentNode&&r.input.parentNode.insertBefore(r.altInput,r.input.nextSibling));r.config.allowInput||r._input.setAttribute("readonly","readonly");W()}(),function(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;var t=r.config.defaultDate||("INPUT"!==r.input.nodeName&&"TEXTAREA"!==r.input.nodeName||!r.input.placeholder||r.input.value!==r.input.placeholder?r.input.value:null);t&&G(t,r.config.dateFormat);r._initialDate=r.selectedDates.length>0?r.selectedDates[0]:r.config.minDate&&r.config.minDate.getTime()>r.now.getTime()?r.config.minDate:r.config.maxDate&&r.config.maxDate.getTime()0&&(r.latestSelectedDateObj=r.selectedDates[0]);void 0!==r.config.minTime&&(r.config.minTime=r.parseDate(r.config.minTime,"H:i"));void 0!==r.config.maxTime&&(r.config.maxTime=r.parseDate(r.config.maxTime,"H:i"));r.minDateHasTime=!!r.config.minDate&&(r.config.minDate.getHours()>0||r.config.minDate.getMinutes()>0||r.config.minDate.getSeconds()>0),r.maxDateHasTime=!!r.config.maxDate&&(r.config.maxDate.getHours()>0||r.config.maxDate.getMinutes()>0||r.config.maxDate.getSeconds()>0)}(),r.utils={getDaysInMonth:function(t,e){return void 0===t&&(t=r.currentMonth),void 0===e&&(e=r.currentYear),1===t&&(e%4==0&&e%100!=0||e%400==0)?29:r.l10n.daysInMonth[t]}},r.isMobile||function(){var t=window.document.createDocumentFragment();if(r.calendarContainer=it("div","flatpickr-calendar"),r.calendarContainer.tabIndex=-1,!r.config.noCalendar){if(t.appendChild((r.monthNav=it("div","flatpickr-months"),r.yearElements=[],r.monthElements=[],r.prevMonthNav=it("span","flatpickr-prev-month"),r.prevMonthNav.innerHTML=r.config.prevArrow,r.nextMonthNav=it("span","flatpickr-next-month"),r.nextMonthNav.innerHTML=r.config.nextArrow,k(),Object.defineProperty(r,"_hidePrevMonthArrow",{get:function(){return r.__hidePrevMonthArrow},set:function(t){r.__hidePrevMonthArrow!==t&&(nt(r.prevMonthNav,"flatpickr-disabled",t),r.__hidePrevMonthArrow=t)}}),Object.defineProperty(r,"_hideNextMonthArrow",{get:function(){return r.__hideNextMonthArrow},set:function(t){r.__hideNextMonthArrow!==t&&(nt(r.nextMonthNav,"flatpickr-disabled",t),r.__hideNextMonthArrow=t)}}),r.currentYearElement=r.yearElements[0],ht(),r.monthNav)),r.innerContainer=it("div","flatpickr-innerContainer"),r.config.weekNumbers){var e=function(){r.calendarContainer.classList.add("hasWeeks");var t=it("div","flatpickr-weekwrapper");t.appendChild(it("span","flatpickr-weekday",r.l10n.weekAbbreviation));var e=it("div","flatpickr-weeks");return t.appendChild(e),{weekWrapper:t,weekNumbers:e}}(),n=e.weekWrapper,i=e.weekNumbers;r.innerContainer.appendChild(n),r.weekNumbers=i,r.weekWrapper=n}r.rContainer=it("div","flatpickr-rContainer"),r.rContainer.appendChild(A()),r.daysContainer||(r.daysContainer=it("div","flatpickr-days"),r.daysContainer.tabIndex=-1),b(),r.rContainer.appendChild(r.daysContainer),r.innerContainer.appendChild(r.rContainer),t.appendChild(r.innerContainer)}r.config.enableTime&&t.appendChild(function(){r.calendarContainer.classList.add("hasTime"),r.config.noCalendar&&r.calendarContainer.classList.add("noCalendar");var t=xt(r.config);r.timeContainer=it("div","flatpickr-time"),r.timeContainer.tabIndex=-1;var e=it("span","flatpickr-time-separator",":"),n=st("flatpickr-hour",{"aria-label":r.l10n.hourAriaLabel});r.hourElement=n.getElementsByTagName("input")[0];var i=st("flatpickr-minute",{"aria-label":r.l10n.minuteAriaLabel});r.minuteElement=i.getElementsByTagName("input")[0],r.hourElement.tabIndex=r.minuteElement.tabIndex=-1,r.hourElement.value=Q(r.latestSelectedDateObj?r.latestSelectedDateObj.getHours():r.config.time_24hr?t.hours:function(t){switch(t%24){case 0:case 12:return 12;default:return t%12}}(t.hours)),r.minuteElement.value=Q(r.latestSelectedDateObj?r.latestSelectedDateObj.getMinutes():t.minutes),r.hourElement.setAttribute("step",r.config.hourIncrement.toString()),r.minuteElement.setAttribute("step",r.config.minuteIncrement.toString()),r.hourElement.setAttribute("min",r.config.time_24hr?"0":"1"),r.hourElement.setAttribute("max",r.config.time_24hr?"23":"12"),r.hourElement.setAttribute("maxlength","2"),r.minuteElement.setAttribute("min","0"),r.minuteElement.setAttribute("max","59"),r.minuteElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(n),r.timeContainer.appendChild(e),r.timeContainer.appendChild(i),r.config.time_24hr&&r.timeContainer.classList.add("time24hr");if(r.config.enableSeconds){r.timeContainer.classList.add("hasSeconds");var a=st("flatpickr-second");r.secondElement=a.getElementsByTagName("input")[0],r.secondElement.value=Q(r.latestSelectedDateObj?r.latestSelectedDateObj.getSeconds():t.seconds),r.secondElement.setAttribute("step",r.minuteElement.getAttribute("step")),r.secondElement.setAttribute("min","0"),r.secondElement.setAttribute("max","59"),r.secondElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(it("span","flatpickr-time-separator",":")),r.timeContainer.appendChild(a)}r.config.time_24hr||(r.amPM=it("span","flatpickr-am-pm",r.l10n.amPM[tt((r.latestSelectedDateObj?r.hourElement.value:r.config.defaultHour)>11)]),r.amPM.title=r.l10n.toggleTitle,r.amPM.tabIndex=-1,r.timeContainer.appendChild(r.amPM));return r.timeContainer}());nt(r.calendarContainer,"rangeMode","range"===r.config.mode),nt(r.calendarContainer,"animate",!0===r.config.animate),nt(r.calendarContainer,"multiMonth",r.config.showMonths>1),r.calendarContainer.appendChild(t);var a=void 0!==r.config.appendTo&&void 0!==r.config.appendTo.nodeType;if((r.config.inline||r.config.static)&&(r.calendarContainer.classList.add(r.config.inline?"inline":"static"),r.config.inline&&(!a&&r.element.parentNode?r.element.parentNode.insertBefore(r.calendarContainer,r._input.nextSibling):void 0!==r.config.appendTo&&r.config.appendTo.appendChild(r.calendarContainer)),r.config.static)){var o=it("div","flatpickr-wrapper");r.element.parentNode&&r.element.parentNode.insertBefore(o,r.element),o.appendChild(r.element),r.altInput&&o.appendChild(r.altInput),o.appendChild(r.calendarContainer)}r.config.static||r.config.inline||(void 0!==r.config.appendTo?r.config.appendTo:window.document.body).appendChild(r.calendarContainer)}(),function(){r.config.wrap&&["open","close","toggle","clear"].forEach((function(t){Array.prototype.forEach.call(r.element.querySelectorAll("[data-"+t+"]"),(function(e){return h(e,"click",r[t])}))}));if(r.isMobile)return void function(){var t=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=it("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=t,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr="datetime-local"===t?"Y-m-d\\TH:i:S":"date"===t?"Y-m-d":"H:i:S",r.selectedDates.length>0&&(r.mobileInput.defaultValue=r.mobileInput.value=r.formatDate(r.selectedDates[0],r.mobileFormatStr));r.config.minDate&&(r.mobileInput.min=r.formatDate(r.config.minDate,"Y-m-d"));r.config.maxDate&&(r.mobileInput.max=r.formatDate(r.config.maxDate,"Y-m-d"));r.input.getAttribute("step")&&(r.mobileInput.step=String(r.input.getAttribute("step")));r.input.type="hidden",void 0!==r.altInput&&(r.altInput.type="hidden");try{r.input.parentNode&&r.input.parentNode.insertBefore(r.mobileInput,r.input.nextSibling)}catch(t){}h(r.mobileInput,"change",(function(t){r.setDate(lt(t).value,!1,r.mobileFormatStr),Y("onChange"),Y("onClose")}))}();var t=et(R,50);r._debouncedChange=et(f,300),r.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&h(r.daysContainer,"mouseover",(function(t){"range"===r.config.mode&&O(lt(t))}));h(r._input,"keydown",D),void 0!==r.calendarContainer&&h(r.calendarContainer,"keydown",D);r.config.inline||r.config.static||h(window,"resize",t);void 0!==window.ontouchstart?h(window.document,"touchstart",C):h(window.document,"mousedown",C);h(window.document,"focus",C,{capture:!0}),!0===r.config.clickOpens&&(h(r._input,"focus",r.open),h(r._input,"click",r.open));void 0!==r.daysContainer&&(h(r.monthNav,"click",Tt),h(r.monthNav,["keyup","increment"],u),h(r.daysContainer,"click",q));if(void 0!==r.timeContainer&&void 0!==r.minuteElement&&void 0!==r.hourElement){var e=function(t){return lt(t).select()};h(r.timeContainer,["increment"],o),h(r.timeContainer,"blur",o,{capture:!0}),h(r.timeContainer,"click",d),h([r.hourElement,r.minuteElement],["focus","click"],e),void 0!==r.secondElement&&h(r.secondElement,"focus",(function(){return r.secondElement&&r.secondElement.select()})),void 0!==r.amPM&&h(r.amPM,"click",(function(t){o(t)}))}r.config.allowInput&&h(r._input,"blur",z)}(),(r.selectedDates.length||r.config.noCalendar)&&(r.config.enableTime&&l(r.config.noCalendar?r.latestSelectedDateObj:void 0),wt(!1)),a();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!r.isMobile&&n&&N(),Y("onReady")}(),r}function Tt(t,e){for(var r=Array.prototype.slice.call(t).filter((function(t){return t instanceof HTMLElement})),n=[],i=0;it}if(null!=this.expression){const t=this.expression;return()=>this.parseExpression(t)}return null}parseExpression(t){const e=new Date;if(e.setMilliseconds(0),"now"===t.toLowerCase())return e;const r=t.match(/^\s*now\s*(-|\+)\s*(\d+)([dhms])\s*$/i);if(r){const[,t,n,i]=r;let a;switch(i.toLowerCase()){case"d":a=60*n*60*24;break;case"h":a=60*n*60;break;case"m":a=60*n;break;case"s":a=n;break;default:return null}return"-"===t&&(a=-a),c(l(e)+a)}return null}}class St{constructor(t,e){this.fromPicker=new Mt(t),this.toPicker=new Mt(e)}setDates(t,e){this.fromPicker.setDate(t),this.toPicker.setDate(e)}getDates(){return[this.fromPicker.getDate(),this.toPicker.getDate()]}getRawDates(){return[this.fromPicker.getRawDate(),this.toPicker.getRawDate()]}getDatesFactory(){const t=this.fromPicker.getDateFactory(),e=this.toPicker.getDateFactory();return()=>[t(),e()]}hasValidDates(){const t=this.fromPicker.getDate(),e=this.toPicker.getDate();return null!=t&&null!=e&&t<=e}}function Et(){function t(t,e,r){e.forEach((e=>{const r=document.createElement("option");Array.isArray(e)&&2===e.length?(r.value=e[0],r.text=e[1]):(r.value=e,r.text=e),t.appendChild(r)})),t.value=r}const e=document.getElementById("range").timeRangePicker;try{e.setDates(...m())}catch{e.setDates(...m(!0))}const r=document.getElementById("refresh-interval");t(r,x,function(){try{let t=localStorage.getItem(v);if(null!=t&&(t=parseInt(t,10),_(t)))return t}catch(t){console.error(`Failed to read '${v}' from local storage!`,t)}return varnishmon.config.scraper.enabled?-1:0}()),r.addEventListener("change",(t=>{!function(t){if(_(t))try{localStorage.setItem(v,t)}catch(t){console.error(`Failed to write '${v}' to local storage!`,t)}else console.error("Invalid refresh interval value!",t)}(parseInt(t.target.value,10))}));const n=document.getElementById("filter");n.value=function(){try{let t=localStorage.getItem(b);if(null!=t)return t}catch(t){console.error(`Failed to read '${b}' from local storage!`,t)}return""}(),n.addEventListener("change",(t=>{!function(t){try{localStorage.setItem(b,t)}catch(t){console.error(`Failed to write '${b}' to local storage!`,t)}}(t.target.value)}));const i=document.getElementById("verbosity");t(i,A,function(){try{let t=localStorage.getItem(k);if(null!=t&&M(t))return t}catch(t){console.error(`Failed to read '${k}' from local storage!`,t)}return"normal"}()),i.addEventListener("change",(t=>{!function(t){if(M(t))try{localStorage.setItem(k,t)}catch(t){console.error(`Failed to write '${k}' to local storage!`,t)}else console.error("Invalid verbosity value!",t)}(t.target.value)}));const a=document.getElementById("columns");t(a,E,function(){try{let t=localStorage.getItem(S);if(null!=t&&(t=parseInt(t,10),C(t)))return t}catch(t){console.error(`Failed to read '${S}' from local storage!`,t)}return 3}()),a.addEventListener("change",(t=>{!function(t){if(C(t))try{localStorage.setItem(S,t)}catch(t){console.error(`Failed to write '${S}' to local storage!`,t)}else console.error("Invalid columns value!",t)}(parseInt(t.target.value,10))}));const o=document.getElementById("aggregator");t(o,L,function(){try{let t=localStorage.getItem(I);if(null!=t&&P(t))return t}catch(t){console.error(`Failed to read '${I}' from local storage!`,t)}return"avg"}()),o.addEventListener("change",(t=>{!function(t){if(P(t))try{localStorage.setItem(I,t)}catch(t){console.error(`Failed to write '${I}' to local storage!`,t)}else console.error("Invalid aggregator value!",t)}(t.target.value)}));const s=document.getElementById("step");s.min=D(),s.value=function(){try{let t=localStorage.getItem(z);if(null!=t&&(t=parseInt(t,10),O(t)))return t}catch(t){console.error(`Failed to read '${z}' from local storage!`,t)}return varnishmon.config.scraper.enabled?varnishmon.config.scraper.period:60}(),s.addEventListener("change",(t=>{const e=parseInt(t.target.value,10),r=D();e>=r?function(t){if(O(t))try{localStorage.setItem(z,t)}catch(t){console.error(`Failed to write '${z}' to local storage!`,t)}else console.error("Invalid columns value!",t)}(e):(t.stopPropagation(),s.value=r,u("error",`Step must be at least ${r} seconds`))}))}function Ct(){let t=parseInt(document.getElementById("refresh-interval").value,10);return t<0&&(t=It()),t}function It(){let t=parseInt(document.getElementById("step").value,10);const e=D();return t{"Enter"===t.key&&document.getElementById("apply-time-range").click()})),document.getElementById("range-to").addEventListener("keydown",(t=>{"Enter"===t.key&&document.getElementById("apply-time-range").click()})),document.getElementById("apply-time-range").addEventListener("click",(t=>{const e=document.getElementById("range");if(!e.timeRangePicker.hasValidDates())return t.stopPropagation(),void u("error","The selected time range is invalid. ISO 8601 and relative expressions like 'now-1h', 'now', 'now-1d', etc. are allowed.");!function(t,e){y(f,t),y(p,e)}(...e.timeRangePicker.getRawDates()),e.initialRange=null,Pt()})),document.getElementById("refresh-interval").addEventListener("change",(()=>{let t=Ct();document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart.setRefreshInterval(t)}))})),document.getElementById("refresh").addEventListener("click",(()=>{document.getElementById("clusters").querySelectorAll(".chart").forEach((t=>{t.chart.refresh()}))})),document.getElementById("filter").addEventListener("input",s(zt,500)),document.getElementById("verbosity").addEventListener("change",zt),document.getElementById("columns").addEventListener("change",zt),document.getElementById("filter").addEventListener("change",(t=>{const e=t.target.value;if(e){const t=T(),r=t.indexOf(e);0!==r&&(-1!==r&&t.splice(r,1),t.unshift(e),t.length>10&&t.pop(),function(t){try{localStorage.setItem(w,JSON.stringify(t))}catch(t){console.error(`Failed to write '${w}' to local storage!`,t)}}(t)),Dt()}})),document.getElementById("aggregator").addEventListener("change",(t=>{document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart.setAggregator(t.target.value)}))})),document.getElementById("step").addEventListener("change",(()=>{const t=It();document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart.setStep(t)}))})),document.getElementById("reset").addEventListener("click",(()=>{!function(){for(let t=localStorage.length-1;t>=0;t--)try{const e=localStorage.key(t);e.startsWith(h)&&localStorage.removeItem(e)}catch(t){console.error("Failed to remove item from local storage!",t)}}(),location.reload()})),document.getElementById("collapse-all").addEventListener("click",(()=>{document.getElementById("clusters").querySelectorAll(".cluster").forEach((t=>{e().getInstance(t.querySelector(".accordion-collapse")).hide(),t.querySelector(".accordion-button").classList.add("collapsed")}))})),document.getElementById("expand-all").addEventListener("click",(()=>{document.getElementById("clusters").querySelectorAll(".cluster").forEach((t=>{e().getInstance(t.querySelector(".accordion-collapse")).show(),t.querySelector(".accordion-button").classList.remove("collapsed")}))}))}async function Pt(){const t=document.getElementById("clusters");t.querySelectorAll(".chart").forEach((t=>{t.chart.destroy()})),t.innerHTML="",t.appendChild(document.getElementById("spinner-template").content.cloneNode(!0).firstElementChild);const r=document.getElementById("range").timeRangePicker.getDatesFactory(),n=Ct(),i=document.getElementById("aggregator").value,a=It();let o;try{const[t,e]=r();o=await async function(t,e,r){const n=new URLSearchParams({from:l(t),to:l(e),step:r}),i=await fetch(`/storage/metrics?${n.toString()}`);if(!i.ok)throw new Error(`Unexpected API response (${i.status}): ${i.statusText}`);const a=await i.json();return{from:c(a.from),to:c(a.to),step:a.step,clusters:B(a.metrics)}}(t,e,a)}catch(e){return t.innerHTML="",t.appendChild(document.getElementById("metrics-meditation-template").content.cloneNode(!0).firstElementChild),void u("error",`Failed to fetch metrics: ${e}`)}const s=o.clusters.length;u("info",`Fetched ${o.clusters.reduce(((t,e)=>t+e.metrics.length),0)} metrics organized in ${s} clusters`);const h=document.getElementById("cluster-template"),f=document.getElementById("chart-template");t.innerHTML="",o.clusters.forEach((o=>{const s=h.content.cloneNode(!0).firstElementChild;s.querySelector(".cluster-name").textContent=o.name,t.appendChild(s);const l=new(e())(s.querySelector(".accordion-collapse"));s.querySelector(".accordion-button").addEventListener("click",(t=>{t.currentTarget.classList.toggle("collapsed"),l.toggle()}));const c=s.querySelector(".charts");o.metrics.forEach((t=>{const e=f.content.cloneNode(!0).firstElementChild,o=new Y(e,t,r,n,i,a);o.addEventListener("zoom",(t=>{document.getElementById("clusters").querySelectorAll(".chart").forEach((e=>{e.chart!==t.target&&e.chart.setZoomRange(t.range)}));const e=document.getElementById("range");null!=t.range?(null==e.initialRange&&(e.initialRange=e.timeRangePicker.getRawDates()),e.timeRangePicker.setDates(...t.range)):null!=e.initialRange&&(e.timeRangePicker.setDates(...e.initialRange),e.initialRange=null)})),e.chart=o,c.appendChild(e)}))})),zt()}function zt(){const t=document.getElementById("clusters");t.querySelectorAll(".chart").forEach((t=>{t.chart.redraw(document.getElementById("filter").value,document.getElementById("verbosity").value,parseInt(document.getElementById("columns").value,10))})),t.querySelectorAll(".cluster").forEach((t=>{0===t.querySelectorAll(".chart:not(.d-none)").length?t.classList.add("d-none"):t.classList.remove("d-none")}));const e=t.querySelectorAll(".cluster").length,r=t.querySelectorAll(".cluster:not(.d-none)").length,n=t.querySelectorAll(".chart").length,i=t.querySelectorAll(".chart:not(.d-none)").length;document.getElementById("filter-stats").textContent=`${i} metrics found (${n-i} hidden), organized in ${r} clusters (${e-r} hidden)`}function Dt(){const t=document.getElementById("filterHistoryList");t.innerHTML="",T().forEach((e=>{const r=document.createElement("li");r.classList.add("dropdown-item"),r.textContent=e,r.addEventListener("click",(()=>{const t=document.getElementById("filter");t.value=e,t.dispatchEvent(new Event("change")),zt()})),t.appendChild(r)}))}document.addEventListener("DOMContentLoaded",(async()=>{!function(){const t=new MutationObserver(((e,r)=>{for(const r of e)"childList"===r.type&&r.addedNodes.forEach((e=>{if(e.classList&&e.classList.contains("plotly-notifier")){e.style.display="none",t.disconnect(),e.querySelectorAll(".notifier-note").forEach((t=>{u("info",t.querySelector("span").innerText)}));const r=new MutationObserver(((t,e)=>{for(const e of t)"childList"===e.type&&e.addedNodes.forEach((t=>{t.classList&&t.classList.contains("notifier-note")&&u("info",t.querySelector("span").innerText)}))}));r.observe(e,{childList:!0})}}))}));t.observe(document.body,{childList:!0})}(),document.getElementById("range").timeRangePicker=new St(document.getElementById("range-from"),document.getElementById("range-to")),Et(),Lt(),new(i())(document.getElementById("filterHistoryList")),Dt(),Pt()}))})()})(); \ No newline at end of file diff --git a/assets/webpack/src/js/config.js b/assets/webpack/src/js/config.js index 6f5f636..9522956 100644 --- a/assets/webpack/src/js/config.js +++ b/assets/webpack/src/js/config.js @@ -299,6 +299,7 @@ function isValidAggregatorValue(value) { ******************************************************************************/ const STEP = `${PREFIX}step`; +const DEFAULT_STEP = 60; export function getStep() { try { @@ -313,7 +314,7 @@ export function getStep() { console.error(`Failed to read '${STEP}' from local storage!`, error); } - return varnishmon.config.scraper.period; + return varnishmon.config.scraper.enabled ? varnishmon.config.scraper.period : DEFAULT_STEP; } export function setStep(value) { @@ -329,8 +330,12 @@ export function setStep(value) { } } +export function getMinimumStep() { + return varnishmon.config.scraper.enabled ? varnishmon.config.scraper.period : 1; +} + function isValidStepValue(value) { - return Number.isInteger(value) && value >= varnishmon.config.scraper.period; + return Number.isInteger(value) && value >= getMinimumStep(); } /****************************************************************************** diff --git a/assets/webpack/src/js/index.js b/assets/webpack/src/js/index.js index af1b2d8..0269a9a 100644 --- a/assets/webpack/src/js/index.js +++ b/assets/webpack/src/js/index.js @@ -72,19 +72,17 @@ function syncConfigWithUI() { // Step. const stepSelector = document.getElementById('step'); - stepSelector.min = varnishmon.config.scraper.period; + stepSelector.min = config.getMinimumStep(); stepSelector.value = config.getStep(); stepSelector.addEventListener('change', (event) => { const value = parseInt(event.target.value, 10); - if (value >= varnishmon.config.scraper.period) { + const minimum = config.getMinimumStep(); + if (value >= minimum) { config.setStep(value); } else { event.stopPropagation(); - stepSelector.value = varnishmon.config.scraper.period; - helpers.notify( - 'error', - `Step must be at least ${varnishmon.config.scraper.period} seconds, ` + - 'which is the metrics scraping period'); + stepSelector.value = minimum; + helpers.notify('error', `Step must be at least ${minimum} seconds`); } }); } @@ -92,15 +90,16 @@ function syncConfigWithUI() { function getRefreshInterval() { let value = parseInt(document.getElementById('refresh-interval').value, 10); if (value < 0) { - value = varnishmon.config.scraper.period; + value = getStep(); } return value; } function getStep() { let value = parseInt(document.getElementById('step').value, 10); - if (value < varnishmon.config.scraper.period) { - value = varnishmon.config.scraper.period; + const minimum = config.getMinimumStep(); + if (value < minimum) { + value = minimum; } return value; } diff --git a/pkg/workers/api/web-handlers.go b/pkg/workers/api/web-handlers.go index b0495cb..f28c992 100644 --- a/pkg/workers/api/web-handlers.go +++ b/pkg/workers/api/web-handlers.go @@ -87,13 +87,17 @@ func (h *Handler) handleHomeRequest(rctx *fasthttp.RequestCtx) { } // Prepare template data & render it. + scraperPeriod := 0 + if h.app.Cfg().ScraperEnabled() { + scraperPeriod = int(h.app.Cfg().ScraperPeriod().Seconds()) + } cfg, err := json.Marshal(map[string]interface{}{ "version": config.Version(), "revision": config.Revision(), "config": map[string]interface{}{ "scraper": map[string]interface{}{ "enabled": h.app.Cfg().ScraperEnabled(), - "period": h.app.Cfg().ScraperPeriod().Seconds(), + "period": scraperPeriod, }, }, "storage": map[string]interface{}{ diff --git a/pkg/workers/storage/metrics.go b/pkg/workers/storage/metrics.go index c8e0596..6fd3ec6 100644 --- a/pkg/workers/storage/metrics.go +++ b/pkg/workers/storage/metrics.go @@ -312,8 +312,12 @@ func (stg *Storage) PushMetricSamples(timestamp time.Time, samples []*MetricSamp func (stg *Storage) unsafeNormalizeFromToAndStep( from, to time.Time, step int) (time.Time, time.Time, int, error) { - // Ensure 'step' is at least the scraper period. - period := int(stg.app.Cfg().ScraperPeriod().Seconds()) + // Ensure 'step' is at least the scraper period, if enabled. If disabled, + // 1s is the minimum resolution. + period := 1 + if stg.app.Cfg().ScraperEnabled() { + period = int(stg.app.Cfg().ScraperPeriod().Seconds()) + } if step < period { step = period } diff --git a/pkg/workers/storage/metrics_test.go b/pkg/workers/storage/metrics_test.go new file mode 100644 index 0000000..2efe29e --- /dev/null +++ b/pkg/workers/storage/metrics_test.go @@ -0,0 +1,269 @@ +package storage + +import ( + "testing" + "time" + + "github.com/allenta/varnishmon/pkg/testutil" + "github.com/stretchr/testify/suite" +) + +type MetricsTestSuite struct { + suite.Suite + testName string + stg *Storage +} + +func (suite *MetricsTestSuite) BeforeTest(suiteName, testName string) { + suite.testName = testName + + app := new(MockApplication) + app. + On("Cfg"). + Return(testutil.NewConfig( + suite.T(), + "global.loglevel", "error", + "scraper.enabled", false, + "api.enabled", false, + "db.file", "")) + suite.stg = NewStorage(app) +} + +func (suite *MetricsTestSuite) TestNormalizeFromTo() { + assert := suite.Require() + + tests := []struct { + from time.Time + to time.Time + step int + normalizedFrom time.Time + normalizedTo time.Time + normalizedStep int + }{ + { + from: time.Date(2025, time.January, 1, 13, 4, 59, 0, time.UTC), + to: time.Date(2025, time.January, 1, 13, 56, 30, 0, time.UTC), + step: 300, + normalizedFrom: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + normalizedTo: time.Date(2025, time.January, 1, 14, 0, 0, 0, time.UTC), + normalizedStep: 300, + }, + { + from: time.Date(2025, time.January, 1, 13, 4, 59, 0, time.UTC), + to: time.Date(2025, time.January, 1, 14, 0, 30, 0, time.UTC), + step: 300, + normalizedFrom: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + normalizedTo: time.Date(2025, time.January, 1, 14, 5, 0, 0, time.UTC), + normalizedStep: 300, + }, + { + from: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + to: time.Date(2025, time.January, 1, 14, 0, 0, 0, time.UTC), + step: 300, + normalizedFrom: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + normalizedTo: time.Date(2025, time.January, 1, 14, 5, 0, 0, time.UTC), + normalizedStep: 300, + }, + { + from: time.Date(2025, time.January, 1, 13, 4, 59, 0, time.UTC), + to: time.Date(2025, time.January, 1, 13, 56, 30, 0, time.UTC), + step: 0, + normalizedFrom: time.Date(2025, time.January, 1, 13, 4, 59, 0, time.UTC), + normalizedTo: time.Date(2025, time.January, 1, 13, 56, 31, 0, time.UTC), + normalizedStep: 1, + }, + { + from: time.Date(2025, time.January, 1, 13, 4, 59, 0, time.UTC), + to: time.Date(2025, time.January, 1, 13, 56, 30, 0, time.UTC), + step: -100, + normalizedFrom: time.Date(2025, time.January, 1, 13, 4, 59, 0, time.UTC), + normalizedTo: time.Date(2025, time.January, 1, 13, 56, 31, 0, time.UTC), + normalizedStep: 1, + }, + } + + for _, test := range tests { + from, to, step, err := suite.stg.unsafeNormalizeFromToAndStep(test.from, test.to, test.step) + assert.Equal(test.normalizedFrom, from) + assert.Equal(test.normalizedTo, to) + assert.Equal(test.normalizedStep, step) + assert.NoError(err) + + logBuffer := suite.stg.app.Cfg().Log().Buffer() + events := logBuffer.Events() + assert.Len(events, 0) + logBuffer.Clear() + } +} + +func (suite *MetricsTestSuite) TestPushSamplesBasics() { + assert := suite.Require() + + tests := []struct { + timestamp time.Time + samples []*MetricSample + nMetrics int + nSamples int + earliest time.Time + latest time.Time + }{ + { + timestamp: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + samples: []*MetricSample{ + &MetricSample{ + Name: "foo", + Flag: "c", + Format: "i", + Description: "foo", + Value: float64(3.14), + }, + &MetricSample{ + Name: "bar", + Flag: "g", + Format: "i", + Description: "bar", + Value: uint64(42), + }, + }, + nMetrics: 2, + nSamples: 2, + earliest: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + latest: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + }, + { + timestamp: time.Date(2025, time.January, 1, 13, 0, 5, 0, time.UTC), + samples: []*MetricSample{ + &MetricSample{ + Name: "foo", + Flag: "c", + Format: "i", + Description: "foo changed description", + Value: float64(2.71), + }, + }, + nMetrics: 2, + nSamples: 3, + earliest: time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC), + latest: time.Date(2025, time.January, 1, 13, 0, 5, 0, time.UTC), + }, + } + + for _, test := range tests { + err := suite.stg.PushMetricSamples(test.timestamp, test.samples) + assert.NoError(err) + assert.Len(suite.stg.cache.metricsByID, test.nMetrics) + assert.Len(suite.stg.cache.metricsByName, test.nMetrics) + assert.Equal(suite.stg.cache.earliest, test.earliest) + assert.Equal(suite.stg.cache.latest, test.latest) + + for _, sample := range test.samples { + var sampleClass string + switch sample.Value.(type) { + case uint64: + sampleClass = "uint64" + case float64: + sampleClass = "float64" + } + + metric, ok := suite.stg.cache.metricsByName[sample.Name] + assert.True(ok) + assert.Equal(sample.Name, metric.Name) + assert.Equal(sample.Flag, metric.Flag) + assert.Equal(sample.Format, metric.Format) + assert.Equal(sample.Description, metric.Description) + assert.Equal(sampleClass, metric.Class) + + var name, flag, format, description, class string + err = suite.stg.db.QueryRow(` + SELECT name, flag, format, description, class + FROM metrics + WHERE id = $1`, metric.ID).Scan(&name, &flag, &format, &description, &class) + assert.NoError(err) + assert.Equal(sample.Name, name) + assert.Equal(sample.Flag, flag) + assert.Equal(sample.Format, format) + assert.Equal(sample.Description, description) + assert.Equal(sampleClass, class) + + var value interface{} + err = suite.stg.db.QueryRow(` + SELECT value.`+sampleClass+` + FROM metric_values + WHERE metric_id = $1 AND timestamp = $2`, metric.ID, test.timestamp).Scan(&value) + assert.NoError(err) + assert.Equal(sample.Value, value) + } + + var nRows int + err = suite.stg.db.QueryRow("SELECT COUNT(*) FROM metrics").Scan(&nRows) + assert.NoError(err) + assert.Equal(test.nMetrics, nRows) + + err = suite.stg.db.QueryRow("SELECT COUNT(*) FROM metric_values").Scan(&nRows) + assert.NoError(err) + assert.Equal(test.nSamples, nRows) + } + + assert.Len(suite.stg.app.Cfg().Log().Buffer().Events(), 0) +} + +// Basic test reusing the state created by 'TestPushSamplesBasics'. This is +// sufficient for now, but should be reviewed and improved in the future. +func (suite *MetricsTestSuite) TestGetMetricsBasics() { + assert := suite.Require() + + suite.TestPushSamplesBasics() + + from := time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC) + to := time.Date(2025, time.January, 1, 13, 0, 5, 0, time.UTC) + step := 10 + metrics, err := suite.stg.GetMetrics(from, to, step) + + assert.NoError(err) + assert.Equal(from.Unix(), metrics["from"]) + assert.Equal(from.Unix()+int64(step), metrics["to"]) + assert.Equal(step, metrics["step"]) + assert.ElementsMatch([]map[string]interface{}{ + { + "id": suite.stg.cache.metricsByName["foo"].ID, + "name": suite.stg.cache.metricsByName["foo"].Name, + "flag": suite.stg.cache.metricsByName["foo"].Flag, + "format": suite.stg.cache.metricsByName["foo"].Format, + "description": suite.stg.cache.metricsByName["foo"].Description, + }, + { + "id": suite.stg.cache.metricsByName["bar"].ID, + "name": suite.stg.cache.metricsByName["bar"].Name, + "flag": suite.stg.cache.metricsByName["bar"].Flag, + "format": suite.stg.cache.metricsByName["bar"].Format, + "description": suite.stg.cache.metricsByName["bar"].Description, + }, + }, metrics["metrics"]) +} + +// Basic test reusing the state created by 'TestPushSamplesBasics'. This is +// sufficient for now, but should be reviewed and improved in the future. +func (suite *MetricsTestSuite) TestGetMetricBasics() { + assert := suite.Require() + + suite.TestPushSamplesBasics() + + id := suite.stg.cache.metricsByName["foo"].ID + from := time.Date(2025, time.January, 1, 13, 0, 0, 0, time.UTC) + to := time.Date(2025, time.January, 1, 13, 0, 5, 0, time.UTC) + step := 10 + aggregator := "count" + metric, err := suite.stg.GetMetric(id, from, to, step, aggregator) + + assert.NoError(err) + assert.Equal(from.Unix(), metric["from"]) + assert.Equal(from.Unix()+int64(step), metric["to"]) + assert.Equal(step, metric["step"]) + assert.ElementsMatch([][2]interface{}{ + {from.Unix(), int64(2)}, + }, metric["samples"]) +} + +func TestMetricsTestSuite(t *testing.T) { + suite.Run(t, &MetricsTestSuite{}) +}