";throw c}},xf.Parser=wf,xf.parser=wf.parse,xf.Renderer=_f,xf.TextRenderer=bf,xf.Lexer=gf,xf.lexer=gf.lex,xf.Tokenizer=hf,xf.Slugger=Df,xf.parse=xf;xf.options,xf.setOptions,xf.use,xf.walkTokens,xf.parseInline,wf.parse,gf.lex;var kf=function(e){var t=e.title,n=e.description,r=e.unit,i=e.expr,o=e.showLegend,a=e.filename,u=e.alias,l=Wr().period,c=Qr(),s=re(null),f=_t(X(!0),2),d=f[0],h=f[1],p=_t(X(l.step||1),2),v=p[0],y=p[1],g=_t(X({limits:{enable:!1,range:{1:[0,0]}}}),2),_=g[0],b=g[1],D=oe((function(){return Array.isArray(i)&&i.every((function(e){return e}))}),[i]),w=bs({predefinedQuery:D?i:[],display:"chart",visible:d,customStep:v}),x=w.isLoading,k=w.graphData,C=w.error,E=w.warning,A=function(e){var t=Kn({},_);t.limits.range=e,b(t)};if(te((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){return h(e.isIntersecting)}))}),{threshold:.1});return s.current&&e.observe(s.current),function(){s.current&&e.unobserve(s.current)}}),[]),!D)return fr(ro,{variant:"error",children:[fr("code",{children:'"expr"'})," not found. Check the configuration file ",fr("b",{children:a}),"."]});var S=function(){return fr("div",{className:"vm-predefined-panel-header__description vm-default-styles",children:[n&&fr(m,{children:[fr("div",{children:[fr("span",{children:"Description:"}),fr("div",{dangerouslySetInnerHTML:{__html:xf.parse(n)}})]}),fr("hr",{})]}),fr("div",{children:[fr("span",{children:"Queries:"}),fr("div",{children:i.map((function(e,t){return fr("div",{children:e},"".concat(t,"_").concat(e))}))})]})]})};return fr("div",{className:"vm-predefined-panel",ref:s,children:[fr("div",{className:"vm-predefined-panel-header",children:[fr(co,{title:fr(S,{}),children:fr("div",{className:"vm-predefined-panel-header__info",children:fr(li,{})})}),fr("h3",{className:"vm-predefined-panel-header__title",children:t||""}),fr("div",{className:"vm-predefined-panel-header__step",children:fr(ss,{defaultStep:l.step,setStep:y})}),fr(ks,{yaxis:_,setYaxisLimits:A,toggleEnableLimits:function(){var e=Kn({},_);e.limits.enable=!e.limits.enable,b(e)}})]}),fr("div",{className:"vm-predefined-panel-body",children:[x&&fr(Cs,{}),C&&fr(ro,{variant:"error",children:C}),E&&fr(ro,{variant:"warning",children:E}),k&&fr(as,{data:k,period:l,customStep:v,query:i,yaxis:_,unit:r,alias:u,showLegend:o,setYaxisLimits:A,setPeriod:function(e){var t=e.from,n=e.to;c({type:"SET_PERIOD",payload:{from:t,to:n}})},fullWidth:!1})]})]})},Cf=function(e){var t=e.defaultExpanded,n=void 0!==t&&t,r=e.onChange,i=e.title,o=e.children,a=_t(X(n),2),u=a[0],l=a[1];return te((function(){r&&r(u)}),[u]),fr(m,{children:[fr("header",{className:"vm-accordion-header ".concat(u&&"vm-accordion-header_open"),onClick:function(){l((function(e){return!e}))},children:[i,fr("div",{className:"vm-accordion-header__arrow ".concat(u&&"vm-accordion-header__arrow_open"),children:fr(hi,{})})]}),u&&fr("section",{className:"vm-accordion-section",children:o},"content")]})},Ef=function(e){var t=e.index,n=e.title,r=e.panels,i=e.filename,o=po(document.body),a=oe((function(){return o.width/12}),[o]),u=_t(X(!t),2),l=u[0],c=u[1],s=_t(X([]),2),f=s[0],d=s[1];te((function(){d(r&&r.map((function(e){return e.width||12})))}),[r]);var h=_t(X({start:0,target:0,enable:!1}),2),p=h[0],v=h[1],m=function(e){if(p.enable){var t=p.start,n=Math.ceil((t-e.clientX)/a);if(!(Math.abs(n)>=12)){var r=f.map((function(e,t){return e-(t===p.target?n:0)}));d(r)}}},y=function(){v(Kn(Kn({},p),{},{enable:!1}))},g=function(e){return function(t){!function(e,t){v({start:e.clientX,target:t,enable:!0})}(t,e)}};return te((function(){return window.addEventListener("mousemove",m),window.addEventListener("mouseup",y),function(){window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",y)}}),[p]),fr("div",{className:"vm-predefined-dashboard",children:fr(Cf,{defaultExpanded:l,onChange:function(e){return c(e)},title:fr((function(){return fr("div",{className:Fi()({"vm-predefined-dashboard-header":!0,"vm-predefined-dashboard-header_open":l}),children:[(n||i)&&fr("span",{className:"vm-predefined-dashboard-header__title",children:n||"".concat(t+1,". ").concat(i)}),r&&fr("span",{className:"vm-predefined-dashboard-header__count",children:["(",r.length," panels)"]})]})}),{}),children:fr("div",{className:"vm-predefined-dashboard-panels",children:Array.isArray(r)&&r.length?r.map((function(e,t){return fr("div",{className:"vm-predefined-dashboard-panels-panel vm-block vm-block_empty-padding",style:{gridColumn:"span ".concat(f[t])},children:[fr(kf,{title:e.title,description:e.description,unit:e.unit,expr:e.expr,alias:e.alias,filename:i,showLegend:e.showLegend}),fr("button",{className:"vm-predefined-dashboard-panels-panel__resizer",onMouseDown:g(t)})]},t)})):fr("div",{className:"vm-predefined-dashboard-panels-panel__alert",children:fr(ro,{variant:"error",children:[fr("code",{children:'"panels"'})," not found. Check the configuration file ",fr("b",{children:i}),"."]})})})})})},Af=function(){!function(){var e=Wr(),t=e.duration,n=e.relativeTime,r=e.period,i=r.date,o=r.step,a=function(){var e,r=Ms((qn(e={},"g0.range_input",t),qn(e,"g0.end_input",i),qn(e,"g0.step_input",o),qn(e,"g0.relative_time",n),e));ar(r)};te(a,[t,n,i,o]),te(a,[])}();var e=_t(X([]),2),t=e[0],n=e[1],r=_t(X("0"),2),i=r[0],o=r[1],a=oe((function(){return t.map((function(e,t){return{label:e.title||"",value:"".concat(t),className:"vm-predefined-panels-tabs__tab"}}))}),[t]),u=oe((function(){return t[+i]||{}}),[t,i]),l=oe((function(){return null===u||void 0===u?void 0:u.rows}),[u]),c=oe((function(){return u.title||u.filename||""}),[u]),s=oe((function(){return Array.isArray(l)&&!!l.length}),[l]);return te((function(){Rs().then((function(e){return e.length&&n(e)}))}),[]),fr("div",{className:"vm-predefined-panels",children:[!t.length&&fr(ro,{variant:"info",children:"Dashboards not found"}),a.length>1&&fr("div",{className:"vm-predefined-panels-tabs vm-block vm-block_empty-padding",children:fr(Ti,{activeItem:i,items:a,onChange:function(e){o(e)}})}),fr("div",{className:"vm-predefined-panels__dashboards",children:[s&&l.map((function(e,t){return fr(Ef,{index:t,filename:c,title:e.title,panels:e.panels},"".concat(i,"_").concat(t))})),!!t.length&&!s&&fr(ro,{variant:"error",children:[fr("code",{children:'"rows"'})," not found. Check the configuration file ",fr("b",{children:c}),"."]})]})]})},Sf=function(e,t){var n=t.match?"&match[]="+encodeURIComponent(t.match):"",r=t.focusLabel?"&focusLabel="+encodeURIComponent(t.focusLabel):"";return"".concat(e,"/api/v1/status/tsdb?topN=").concat(t.topN,"&date=").concat(t.date).concat(n).concat(r)},Ff=function(){function e(){Dt(this,e),this.tsdbStatus=void 0,this.tabsNames=void 0,this.tsdbStatus=this.defaultTSDBStatus,this.tabsNames=["table","graph"]}return xt(e,[{key:"tsdbStatusData",get:function(){return this.tsdbStatus},set:function(e){this.tsdbStatus=e}},{key:"defaultTSDBStatus",get:function(){return{totalSeries:0,totalLabelValuePairs:0,seriesCountByMetricName:[],seriesCountByLabelName:[],seriesCountByFocusLabelValue:[],seriesCountByLabelValuePair:[],labelValueCountByLabelName:[]}}},{key:"keys",value:function(e){var t=[];return e&&(t=t.concat("seriesCountByFocusLabelValue")),t=t.concat("seriesCountByMetricName","seriesCountByLabelName","seriesCountByLabelValuePair","labelValueCountByLabelName"),t}},{key:"defaultState",get:function(){var e=this;return this.keys("job").reduce((function(t,n){return Kn(Kn({},t),{},{tabs:Kn(Kn({},t.tabs),{},qn({},n,e.tabsNames)),containerRefs:Kn(Kn({},t.containerRefs),{},qn({},n,re(null))),defaultActiveTab:Kn(Kn({},t.defaultActiveTab),{},qn({},n,0))})}),{tabs:{},containerRefs:{},defaultActiveTab:{}})}},{key:"sectionsTitles",value:function(e){return{seriesCountByMetricName:"Metric names with the highest number of series",seriesCountByLabelName:"Labels with the highest number of series",seriesCountByFocusLabelValue:'Values for "'.concat(e,'" label with the highest number of series'),seriesCountByLabelValuePair:"Label=value pairs with the highest number of series",labelValueCountByLabelName:"Labels with the highest number of unique values"}}},{key:"tablesHeaders",get:function(){return{seriesCountByMetricName:Nf,seriesCountByLabelName:Of,seriesCountByFocusLabelValue:Tf,seriesCountByLabelValuePair:Bf,labelValueCountByLabelName:Mf}}},{key:"totalSeries",value:function(e){return"labelValueCountByLabelName"===e?-1:this.tsdbStatus.totalSeries}}]),e}(),Nf=[{id:"name",label:"Metric name"},{id:"value",label:"Number of series"},{id:"percentage",label:"Percent of series"},{id:"action",label:"Action"}],Of=[{id:"name",label:"Label name"},{id:"value",label:"Number of series"},{id:"percentage",label:"Percent of series"},{id:"action",label:"Action"}],Tf=[{id:"name",label:"Label value"},{id:"value",label:"Number of series"},{id:"percentage",label:"Percent of series"},{disablePadding:!1,id:"action",label:"Action",numeric:!1}],Bf=[{id:"name",label:"Label=value pair"},{id:"value",label:"Number of series"},{id:"percentage",label:"Percent of series"},{id:"action",label:"Action"}],Mf=[{id:"name",label:"Label name"},{id:"value",label:"Number of unique values"},{id:"action",label:"Action"}],Lf={seriesCountByMetricName:function(e,t){return Pf("__name__",t)},seriesCountByLabelName:function(e,t){return"{".concat(t,'!=""}')},seriesCountByFocusLabelValue:function(e,t){return Pf(e,t)},seriesCountByLabelValuePair:function(e,t){var n=t.split("="),r=n[0],i=n.slice(1).join("=");return Pf(r,i)},labelValueCountByLabelName:function(e,t){return"{".concat(t,'!=""}')}},Pf=function(e,t){return e?"{"+e+"="+JSON.stringify(t)+"}":""},$f=function(e){var t=e.topN,n=e.error,r=e.query,i=e.onSetHistory,o=e.onRunQuery,a=e.onSetQuery,u=e.onTopNChange,l=e.onFocusLabelChange,c=e.totalSeries,s=e.totalLabelValuePairs,f=e.date,d=e.match,h=e.focusLabel,p=ni().autocomplete,v=ri(),m=Es().queryOptions,y=oe((function(){return t<1?"Number must be bigger than zero":""}),[t]);return fr("div",{className:"vm-cardinality-configurator vm-block",children:[fr("div",{className:"vm-cardinality-configurator-controls",children:[fr("div",{className:"vm-cardinality-configurator-controls__query",children:fr(us,{value:r||d||"",autocomplete:p,options:m,error:n,onArrowUp:function(){i(-1)},onArrowDown:function(){i(1)},onEnter:o,onChange:a,label:"Time series selector"})}),fr("div",{className:"vm-cardinality-configurator-controls__item",children:fr(Eo,{label:"Number of entries per table",type:"number",value:t,error:y,onChange:u})}),fr("div",{className:"vm-cardinality-configurator-controls__item",children:fr(Eo,{label:"Focus label",type:"text",value:h||"",onChange:l})}),fr("div",{className:"vm-cardinality-configurator-controls__item",children:fr(ds,{label:"Autocomplete",value:p,onChange:function(){v({type:"TOGGLE_AUTOCOMPLETE"})}})})]}),fr("div",{className:"vm-cardinality-configurator-bottom",children:[fr("div",{className:"vm-cardinality-configurator-bottom__info",children:["Analyzed ",fr("b",{children:c})," series with ",fr("b",{children:s}),' "label=value" pairs at ',fr("b",{children:f}),d&&fr("span",{children:[" for series selector ",fr("b",{children:d})]}),". Show top ",t," entries per table."]}),fr(ao,{startIcon:fr(bi,{}),onClick:o,children:"Execute Query"})]})]})};function Rf(e){var t=e.order,n=e.orderBy,r=e.onRequestSort,i=e.headerCells;return fr("thead",{className:"vm-table-header",children:fr("tr",{className:"vm-table__row vm-table__row_header",children:i.map((function(e){return fr("th",{className:Fi()({"vm-table-cell vm-table-cell_header":!0,"vm-table-cell_sort":"action"!==e.id&&"percentage"!==e.id,"vm-table-cell_right":"action"===e.id}),onClick:(i=e.id,function(e){r(e,i)}),children:fr("div",{className:"vm-table-cell__content",children:[e.label,"action"!==e.id&&"percentage"!==e.id&&fr("div",{className:Fi()({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":n===e.id,"vm-table__sort-icon_desc":"desc"===t&&n===e.id}),children:fr(vi,{})})]})},e.id);var i}))})})}function If(e,t,n){return t[n]e[n]?1:0}function jf(e,t){return"desc"===e?function(e,n){return If(e,n,t)}:function(e,n){return-If(e,n,t)}}function zf(e,t){var n=e.map((function(e,t){return[e,t]}));return n.sort((function(e,n){var r=t(e[0],n[0]);return 0!==r?r:e[1]-n[1]})),n.map((function(e){return e[0]}))}var Uf=function(e){var t=e.rows,n=e.headerCells,r=e.defaultSortColumn,i=e.tableCells,o=_t(X("desc"),2),a=o[0],u=o[1],l=_t(X(r),2),c=l[0],s=l[1],f=_t(X([]),2),d=f[0],h=f[1],p=function(e){return function(){var t=d.indexOf(e),n=[];-1===t?n=n.concat(d,e):0===t?n=n.concat(d.slice(1)):t===d.length-1?n=n.concat(d.slice(0,-1)):t>0&&(n=n.concat(d.slice(0,t),d.slice(t+1))),h(n)}},v=zf(t,jf(a,c));return fr("table",{className:"vm-table",children:[fr(Rf,{numSelected:d.length,order:a,orderBy:c,onSelectAllClick:function(e){if(e.target.checked){var n=t.map((function(e){return e.name}));h(n)}else h([])},onRequestSort:function(e,t){u(c===t&&"asc"===a?"desc":"asc"),s(t)},rowCount:t.length,headerCells:n}),fr("tbody",{className:"vm-table-header",children:v.map((function(e){return fr("tr",{className:Fi()({"vm-table__row":!0,"vm-table__row_selected":(t=e.name,-1!==d.indexOf(t))}),onClick:p(e.name),children:i(e)},e.name);var t}))})]})},Hf=function(e){var t=e.row,n=e.totalSeries,r=e.onActionClick,i=n>0?t.value/n*100:-1;return fr(m,{children:[fr("td",{className:"vm-table-cell",children:t.name},t.name),fr("td",{className:"vm-table-cell",children:t.value},t.value),i>0&&fr("td",{className:"vm-table-cell",children:fr(As,{value:i})},t.progressValue),fr("td",{className:"vm-table-cell vm-table-cell_right",children:fr("div",{className:"vm-table-cell__content",children:fr(co,{title:"Filter by ".concat(t.name),children:fr(ao,{variant:"text",size:"small",onClick:r,children:fr(Di,{})})})})},"action")]})},Yf=function(e){var t=e.data,n=e.container,r=e.configs,i=re(null),o=_t(X(),2),a=o[0],u=o[1],l=po(n),c=Kn(Kn({},r),{},{width:l.width||400});return te((function(){if(i.current){var e=new Bc(c,t,i.current);return u(e),e.destroy}}),[i.current,l]),te((function(){a&&a.setData(t)}),[t]),fr("div",{style:{height:"100%"},children:fr("div",{ref:i})})},Vf=function(e,t){return Math.round(e*(t=Math.pow(10,t)))/t},qf=1,Wf=function(e,t,n,r){return Vf(t+e*(n+r),6)},Qf=function(e,t,n,r,i){var o=1-t,a=n===qf?o/(e-1):2===n?o/e:3===n?o/(e+1):0;(isNaN(a)||a===1/0)&&(a=0);var u=n===qf?0:2===n?a/2:3===n?a:0,l=t/e,c=Vf(l,6);if(null==r)for(var s=0;s=n&&e<=i&&t>=r&&t<=o};function Zf(e,t,n,r,i){var o=this;o.x=e,o.y=t,o.w=n,o.h=r,o.l=i||0,o.o=[],o.q=null}var Jf={split:function(){var e=this,t=e.x,n=e.y,r=e.w/2,i=e.h/2,o=e.l+1;e.q=[new Zf(t+r,n,r,i,o),new Zf(t,n,r,i,o),new Zf(t,n+i,r,i,o),new Zf(t+r,n+i,r,i,o)]},quads:function(e,t,n,r,i){var o=this,a=o.q,u=o.x+o.w/2,l=o.y+o.h/2,c=tu,d=t+r>l;c&&f&&i(a[0]),s&&c&&i(a[1]),s&&d&&i(a[2]),f&&d&&i(a[3])},add:function(e){var t=this;if(null!=t.q)t.quads(e.x,e.y,e.w,e.h,(function(t){t.add(e)}));else{var n=t.o;if(n.push(e),n.length>10&&t.l<4){t.split();for(var r=function(e){var r=n[e];t.quads(r.x,r.y,r.w,r.h,(function(e){e.add(r)}))},i=0;i=0?"left":"right",e.ctx.textBaseline=1===s?"middle":i[n]>=0?"bottom":"top",e.ctx.fillText(i[n],f,g)}}))})),e.ctx.restore()}function b(e,t,n){return[0,Bc.rangeNum(0,n,.05,!0)[1]]}return{hooks:{drawClear:function(t){var n;if((y=y||new Zf(0,0,t.bbox.width,t.bbox.height)).clear(),t.series.forEach((function(e){e._paths=null})),l=d?[null].concat(m(t.data.length-1-o.length,t.data[0].length)):2===t.series.length?[null].concat(m(t.data[0].length,1)):[null].concat(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h,r=Array.from({length:t},(function(){return{offs:Array(e).fill(0),size:Array(e).fill(0)}}));return Qf(e,n,p,null,(function(e,n,i){Qf(t,1,v,null,(function(t,o,a){r[t].offs[e]=n+i*o,r[t].size[e]=i*a}))})),r}(t.data[0].length,t.data.length-1-o.length,1===t.data[0].length?1:h)),null!=(null===(n=e.disp)||void 0===n?void 0:n.fill)){c=[null];for(var r=1;r0&&!o.includes(t)&&Bc.assign(e,{paths:g,points:{show:_}})}))}}}((Kf=[1],Xf=0,ed=1,td=0,nd=function(e,t){return{stroke:e,fill:t}}({unit:3,values:function(e){return e.data[1].map((function(e,t){return 0!==t?"#33BB55":"#F79420"}))}},{unit:3,values:function(e){return e.data[1].map((function(e,t){return 0!==t?"#33BB55":"#F79420"}))}}),{which:Kf,ori:Xf,dir:ed,radius:td,disp:nd}))]},id=function(e){var t=e.rows,n=e.activeTab,r=e.onChange,i=e.tabs,o=e.chartContainer,a=e.totalSeries,u=e.tabId,l=e.onActionClick,c=e.sectionTitle,s=e.tableHeaderCells,f=oe((function(){return i.map((function(e,t){return{value:String(t),label:e,icon:fr(0===t?xi:wi,{})}}))}),[i]);return fr("div",{className:"vm-metrics-content vm-block",children:[fr("div",{className:"vm-metrics-content-header vm-section-header",children:[fr("h5",{className:"vm-section-header__title",children:c}),fr("div",{className:"vm-section-header__tabs",children:fr(Ti,{activeItem:String(n),items:f,onChange:function(e){r(e,u)}})})]}),fr("div",{ref:o,children:[0===n&&fr(Uf,{rows:t,headerCells:s,defaultSortColumn:"value",tableCells:function(e){return fr(Hf,{row:e,totalSeries:a,onActionClick:l})}}),1===n&&fr(Yf,{data:[t.map((function(e){return e.name})),t.map((function(e){return e.value})),t.map((function(e,t){return t%12==0?1:t%10==0?2:0}))],container:(null===o||void 0===o?void 0:o.current)||null,configs:rd})]})]})},od=function(){var e=Gi(),t=e.topN,n=e.match,r=e.date,i=e.focusLabel,o=Zi();!function(){var e=Gi(),t=e.topN,n=e.match,r=e.date,i=e.focusLabel,o=e.extraLabel,a=function(){var e=Ms({topN:t,date:r,match:n,extraLabel:o,focusLabel:i});ar(e)};te(a,[t,n,r,i,o]),te(a,[])}();var a=_t(X(n||""),2),u=a[0],l=a[1],c=_t(X(0),2),s=c[0],f=c[1],d=_t(X([]),2),h=d[0],p=d[1],v=function(){var e=new Ff,t=Gi(),n=t.topN,r=t.extraLabel,i=t.match,o=t.date,a=t.runQuery,u=t.focusLabel,l=hr().serverUrl,c=_t(X(!1),2),s=c[0],f=c[1],d=_t(X(),2),h=d[0],p=d[1],v=_t(X(e.defaultTSDBStatus),2),m=v[0],y=v[1];te((function(){h&&(y(e.defaultTSDBStatus),f(!1))}),[h]);var g=function(){var t=Jc(Gc().mark((function t(n){var r,i,o,a;return Gc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l){t.next=2;break}return t.abrupt("return");case 2:return p(""),f(!0),y(e.defaultTSDBStatus),r=Sf(l,n),t.prev=6,t.next=9,fetch(r);case 9:return i=t.sent,t.next=12,i.json();case 12:o=t.sent,i.ok?(a=o.data,y(Kn({},a)),f(!1)):(p(o.error),y(e.defaultTSDBStatus),f(!1)),t.next=20;break;case 16:t.prev=16,t.t0=t.catch(6),f(!1),t.t0 instanceof Error&&p("".concat(t.t0.name,": ").concat(t.t0.message));case 20:case"end":return t.stop()}}),t,null,[[6,16]])})));return function(e){return t.apply(this,arguments)}}();return te((function(){g({topN:n,extraLabel:r,match:i,date:o,focusLabel:u})}),[l,a,o]),e.tsdbStatusData=m,{isLoading:s,appConfigurator:e,error:h}}(),m=v.isLoading,y=v.appConfigurator,g=v.error,_=_t(X(y.defaultState.defaultActiveTab),2),b=_[0],D=_[1],w=y.tsdbStatusData,x=y.defaultState,k=y.tablesHeaders,C=function(e,t){D(Kn(Kn({},b),{},qn({},t,+e)))};return fr("div",{className:"vm-cardinality-panel",children:[m&&fr(Cs,{message:"Please wait while cardinality stats is calculated. \n This may take some time if the db contains big number of time series."}),fr($f,{error:"",query:u,topN:t,date:r,match:n,totalSeries:w.totalSeries,totalLabelValuePairs:w.totalLabelValuePairs,focusLabel:i,onRunQuery:function(){p((function(e){return[].concat(bt(e),[u])})),f((function(e){return e+1})),o({type:"SET_MATCH",payload:u}),o({type:"RUN_QUERY"})},onSetQuery:function(e){l(e)},onSetHistory:function(e){var t=s+e;t<0||t>=h.length||(f(t),l(h[t]))},onTopNChange:function(e){o({type:"SET_TOP_N",payload:+e})},onFocusLabelChange:function(e){o({type:"SET_FOCUS_LABEL",payload:e})}}),g&&fr(ro,{variant:"error",children:g}),y.keys(i).map((function(e){return fr(id,{sectionTitle:y.sectionsTitles(i)[e],activeTab:b[e],rows:w[e],onChange:C,onActionClick:(t=e,function(e){var n=e.currentTarget.id,r=Lf[t](i,n);l(r),p((function(e){return[].concat(bt(e),[r])})),f((function(e){return e+1})),o({type:"SET_MATCH",payload:r});var a="";"labelValueCountByLabelName"!==t&&"seriesCountByLabelName"!=t||(a=n),o({type:"SET_FOCUS_LABEL",payload:a}),o({type:"RUN_QUERY"})}),tabs:x.tabs[e],chartContainer:x.containerRefs[e],totalSeries:y.totalSeries(e),tabId:e,tableHeaderCells:k[e]},e);var t}))]})},ad=function(e){var t=e.rows,n=e.columns,r=_t(X(e.defaultOrderBy||"count"),2),i=r[0],o=r[1],a=_t(X("desc"),2),u=a[0],l=a[1],c=oe((function(){return zf(t,jf(u,i))}),[t,i,u]),s=function(e){return function(){var t;t=e,l((function(e){return"asc"===e&&i===t?"desc":"asc"})),o(t)}};return fr("table",{className:"vm-table",children:[fr("thead",{className:"vm-table-header",children:fr("tr",{className:"vm-table__row vm-table__row_header",children:n.map((function(e){return fr("th",{className:"vm-table-cell vm-table-cell_header vm-table-cell_sort",onClick:s(e.key),children:fr("div",{className:"vm-table-cell__content",children:[e.title||e.key,fr("div",{className:Fi()({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":i===e.key,"vm-table__sort-icon_desc":"desc"===u&&i===e.key}),children:fr(vi,{})})]})},e.key)}))})}),fr("tbody",{className:"vm-table-body",children:c.map((function(e,t){return fr("tr",{className:"vm-table__row",children:n.map((function(t){return fr("td",{className:"vm-table-cell",children:e[t.key]||"-"},t.key)}))},t)}))})]})},ud=["table","JSON"].map((function(e,t){return{value:String(t),label:e,icon:fr(0===t?xi:ki,{})}})),ld=function(e){var t=e.rows,n=e.title,r=e.columns,i=e.defaultOrderBy,o=_t(X(0),2),a=o[0],u=o[1];return fr("div",{className:"vm-top-queries-panel vm-block",children:[fr("div",{className:"vm-top-queries-panel-header vm-section-header",children:[fr("h5",{className:"vm-section-header__title",children:n}),fr("div",{className:"vm-section-header__tabs",children:fr(Ti,{activeItem:String(a),items:ud,onChange:function(e){u(+e)}})})]}),fr("div",{children:[0===a&&fr(ad,{rows:t,columns:r,defaultOrderBy:i}),1===a&&fr(Ds,{data:t})]})]})},cd=function(){var e=function(){var e=hr().serverUrl,t=to(),n=t.topN,r=t.maxLifetime,i=t.runQuery,o=_t(X(null),2),a=o[0],u=o[1],l=_t(X(!1),2),c=l[0],s=l[1],f=_t(X(),2),d=f[0],h=f[1],p=oe((function(){return function(e,t,n){return"".concat(e,"/api/v1/status/top_queries?topN=").concat(t||"","&maxLifetime=").concat(n||"")}(e,n,r)}),[e,n,r]),v=function(){var e=Jc(Gc().mark((function e(){var t,n;return Gc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,fetch(p);case 4:return t=e.sent,e.next=7,t.json();case 7:n=e.sent,t.ok&&["topByAvgDuration","topByCount","topBySumDuration"].forEach((function(e){var t=n[e];Array.isArray(t)&&t.forEach((function(e){return e.timeRangeHours=+(e.timeRangeSeconds/3600).toFixed(2)}))})),u(t.ok?n:null),h(String(n.error||"")),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),e.t0 instanceof Error&&"AbortError"!==e.t0.name&&h("".concat(e.t0.name,": ").concat(e.t0.message));case 16:s(!1);case 17:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(){return e.apply(this,arguments)}}();return te((function(){v()}),[i]),{data:a,error:d,loading:c}}(),t=e.data,n=e.error,r=e.loading,i=to(),o=i.topN,a=i.maxLifetime,u=ue(eo).dispatch;!function(){var e=to(),t=e.topN,n=e.maxLifetime,r=function(){var e=Ms({topN:String(t),maxLifetime:n});ar(e)};te(r,[t,n]),te(r,[])}();var l=oe((function(){var e=a.trim().split(" ").reduce((function(e,t){var n=Or(t);return n?Kn(Kn({},e),n):Kn({},e)}),{});return!!yr().duration(e).asMilliseconds()}),[a]),c=oe((function(){return!!o&&o<1}),[o]),s=oe((function(){return c?"Number must be bigger than zero":""}),[c]),f=oe((function(){return l?"":"Invalid duration value"}),[l]),d=function(e){if(!t)return e;var n=t[e];return"number"===typeof n?$c(n):n||e},h=function(){u({type:"SET_RUN_QUERY"})},p=function(e){"Enter"===e.key&&h()};return te((function(){t&&(o||u({type:"SET_TOP_N",payload:+t.topN}),a||u({type:"SET_MAX_LIFE_TIME",payload:t.maxLifetime}))}),[t]),fr("div",{className:"vm-top-queries",children:[r&&fr(Cs,{containerStyles:{height:"500px"}}),fr("div",{className:"vm-top-queries-controls vm-block",children:[fr("div",{className:"vm-top-queries-controls__fields",children:[fr(Eo,{label:"Max lifetime",value:a,error:f,helperText:"For example ".concat("30ms, 15s, 3d4h, 1y2w"),onChange:function(e){u({type:"SET_MAX_LIFE_TIME",payload:e})},onKeyDown:p}),fr(Eo,{label:"Number of returned queries",type:"number",value:o||"",error:s,onChange:function(e){u({type:"SET_TOP_N",payload:+e})},onKeyDown:p})]}),fr("div",{className:"vm-top-queries-controls-bottom",children:[fr("div",{className:"vm-top-queries-controls-bottom__info",children:["VictoriaMetrics tracks the last\xa0",fr(co,{title:"search.queryStats.lastQueriesCount",children:fr("b",{children:d("search.queryStats.lastQueriesCount")})}),"\xa0queries with durations at least\xa0",fr(co,{title:"search.queryStats.minQueryDuration",children:fr("b",{children:d("search.queryStats.minQueryDuration")})})]}),fr("div",{className:"vm-top-queries-controls-bottom__button",children:fr(ao,{startIcon:fr(bi,{}),onClick:h,children:"Execute"})})]})]}),n&&fr(ro,{variant:"error",children:n}),t&&fr(m,{children:fr("div",{className:"vm-top-queries-panels",children:[fr(ld,{rows:t.topByCount,title:"Most frequently executed queries",columns:[{key:"query"},{key:"timeRangeHours",title:"time range, hours"},{key:"count"}]}),fr(ld,{rows:t.topByAvgDuration,title:"Most heavy queries",columns:[{key:"query"},{key:"avgDurationSeconds",title:"avg duration, seconds"},{key:"timeRangeHours",title:"time range, hours"},{key:"count"}],defaultOrderBy:"avgDurationSeconds"}),fr(ld,{rows:t.topBySumDuration,title:"Queries with most summary time to execute",columns:[{key:"query"},{key:"sumDurationSeconds",title:"sum duration, seconds"},{key:"timeRangeHours",title:"time range, hours"},{key:"count"}],defaultOrderBy:"sumDurationSeconds"})]})})]})},sd=["primary","secondary","error","warning","info","success"],fd=function(e){var t=e.setLoadingTheme,n=Xn().palette,r=void 0===n?{}:n,i=function(){sd.forEach((function(e){var t=function(e){var t=e.replace("#","").trim();if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length)throw new Error("Invalid HEX color.");return(299*parseInt(t.slice(0,2),16)+587*parseInt(t.slice(2,4),16)+114*parseInt(t.slice(4,6),16))/1e3>=128?"#000000":"#FFFFFF"}(Ni("color-".concat(e)));Oi("".concat(e,"-text"),t)}))};return te((function(){sd.forEach((function(e){var t=r[e];t&&Oi("color-".concat(e),t)})),function(){var e=window,t=e.innerWidth,n=e.innerHeight,r=document.documentElement,i=r.clientWidth,o=r.clientHeight;Oi("scrollbar-width","".concat(t-i,"px")),Oi("scrollbar-height","".concat(n-o,"px"))}(),i(),t(!1)}),[]),null},dd=function(){var e=_t(X(!0),2),t=e[0],n=e[1];return fr(m,t?{children:[fr(Cs,{}),fr(fd,{setLoadingTheme:n}),";"]}:{children:fr(Un,{children:fr(oo,{children:fr(jn,{children:fr(Rn,{path:"/",element:fr(Ro,{}),children:[fr(Rn,{path:Zn.home,element:fr(Ps,{})}),fr(Rn,{path:Zn.dashboards,element:fr(Af,{})}),fr(Rn,{path:Zn.cardinality,element:fr(od,{})}),fr(Rn,{path:Zn.topQueries,element:fr(cd,{})})]})})})})})},hd=function(e){e&&n.e(27).then(n.bind(n,27)).then((function(t){var n=t.getCLS,r=t.getFID,i=t.getFCP,o=t.getLCP,a=t.getTTFB;n(e),r(e),i(e),o(e),a(e)}))},pd=document.getElementById("root");pd&&Ye(fr(dd,{}),pd),hd()}()}();
\ No newline at end of file
diff --git a/app/vmselect/vmui/static/js/main.0b7317e2.js.LICENSE.txt b/app/vmselect/vmui/static/js/main.0b7317e2.js.LICENSE.txt
new file mode 100644
index 000000000..45ffc827b
--- /dev/null
+++ b/app/vmselect/vmui/static/js/main.0b7317e2.js.LICENSE.txt
@@ -0,0 +1,29 @@
+/*!
+ Copyright (c) 2018 Jed Watson.
+ Licensed under the MIT License (MIT), see
+ http://jedwatson.github.io/classnames
+*/
+
+/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
+
+/**
+ * @remix-run/router v1.0.3
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */
+
+/**
+ * React Router v6.4.3
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */