(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[0],{179:function(e,t,n){},194:function(e,t){},199:function(e,t,n){},200:function(e,t,n){},207:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),c=n(27),i=n.n(c),o=(n(179),n(13)),s=n(279),l=n(277),u=n(2),d=Object(a.createContext)({showInfoMessage:function(){}}),j=function(){return Object(a.useContext)(d)},b=function(e){var t=e.children,n=Object(a.useState)({}),r=Object(o.a)(n,2),c=r[0],i=r[1],j=Object(a.useState)(!1),b=Object(o.a)(j,2),O=b[0],h=b[1],f=Object(a.useState)(void 0),p=Object(o.a)(f,2),x=p[0],v=p[1];Object(a.useEffect)((function(){x&&(i({message:x,key:(new Date).getTime()}),h(!0))}),[x]);return Object(u.jsxs)(d.Provider,{value:{showInfoMessage:v},children:[Object(u.jsx)(s.a,{open:O,autoHideDuration:4e3,onClose:function(e,t){"clickaway"!==t&&(v(void 0),h(!1))},children:Object(u.jsx)(l.a,{children:c.message})},c.key),t]})},O=n(270),h=n(260),f=n(274),p=n(86),x=n(253),v=n(262),m=n(241),y=n(243),g=n(244),E=n(283),S=n(159),_=n(135),T=n.n(_),C=n(14),A=n(12),w=n(36),I=n.n(w),R=n(131),U=n.n(R),k=n(132),D=n.n(k);I.a.extend(U.a),I.a.extend(D.a);var H,M=window.screen.availWidth/2,L=1e3,N=1578e8,Y="YYYY-MM-DD[T]HH:mm:ss",q=[{long:"days",short:"d",possible:"day"},{long:"weeks",short:"w",possible:"week"},{long:"months",short:"M",possible:"mon"},{long:"years",short:"y",possible:"year"},{long:"hours",short:"h",possible:"hour"},{long:"minutes",short:"m",possible:"min"},{long:"seconds",short:"s",possible:"sec"},{long:"milliseconds",short:"ms",possible:"millisecond"}],B=q.map((function(e){return e.short})),P=function(e){var t=e.match(/\d+/g),n=e.match(/[a-zA-Z]+/g);if(n&&t&&B.includes(n[0]))return Object(C.a)({},n[0],t[0])},Q=function(e,t){var n=(t||new Date).valueOf()/1e3,a=e.trim().split(" ").reduce((function(e,t){var n=P(t);return n?Object(A.a)(Object(A.a)({},e),n):Object(A.a)({},e)}),{}),r=I.a.duration(a).asSeconds();return{start:n-r,end:n,step:Math.ceil(r/M),date:z(t||new Date)}},z=function(e){return I()(e).utc().format(Y)},F=function(e){var t=Math.floor(e%1e3),n=Math.floor(e/1e3%60),a=Math.floor(e/1e3/60%60),r=Math.floor(e/1e3/3600%24),c=Math.floor(e/864e5),i=["d","h","m","s","ms"];return[c,r,a,n,t].map((function(e,t){return e?"".concat(e).concat(i[t]):""})).filter((function(e){return e})).join(" ")},G=function(e){return new Date(1e3*e)},W=function(e,t){t?window.localStorage.setItem(e,JSON.stringify({value:t})):X([e])},V=function(e){var t=window.localStorage.getItem(e);if(null!==t)try{var n;return null===(n=JSON.parse(t))||void 0===n?void 0:n.value}catch(a){return t}},X=function(e){return e.forEach((function(e){return window.localStorage.removeItem(e)}))},J=["BASIC_AUTH_DATA","BEARER_AUTH_DATA"],K=n(133),Z=n.n(K),$=n(117),ee=n.n($),te={query:"g0.expr","time.duration":"g0.range_input","time.period.date":"g0.end_input","time.period.step":"g0.step_input",stacked:"g0.stacked"},ne=function(e){var t=new Map(Object.entries(te)),n=[];t.forEach((function(t,a){encodeURIComponent(t);var r=ee()(e,a,"");if(r){var c=encodeURIComponent(r);n.push("".concat(t,"=").concat(c))}})),function(e){var t=window;if(t){var n="".concat(t.location.protocol,"//").concat(t.location.host).concat(t.location.pathname,"?").concat(e);t.history.pushState({path:n},"",n)}}(n.join("&"))},ae=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.search,a=Z.a.parse(n,{ignoreQueryPrefix:!0});return ee()(a,e,t||"")},re=ae("g0.range_input","1h"),ce=(H=ae("g0.end_input",new Date(I()().utc().format(Y))),I()(H).utcOffset(0,!0).local().format(Y)),ie=ae("g0.expr",V("LAST_QUERY")||"\n"),oe={serverUrl:window.location.href.replace(/\/(?:prometheus\/)?(?:graph|vmui)\/.*/,"/prometheus/"),displayType:"chart",query:ie,queryHistory:{index:0,values:[ie]},time:{duration:re,period:Q(re,new Date(ce))},queryControls:{autoRefresh:!1,autocomplete:V("AUTOCOMPLETE")||!1,nocache:V("NO_CACHE")||!1}};function se(e,t){switch(t.type){case"SET_DISPLAY_TYPE":return Object(A.a)(Object(A.a)({},e),{},{displayType:t.payload});case"SET_SERVER":return Object(A.a)(Object(A.a)({},e),{},{serverUrl:t.payload});case"SET_QUERY":return Object(A.a)(Object(A.a)({},e),{},{query:t.payload});case"SET_QUERY_HISTORY_INDEX":return Object(A.a)(Object(A.a)({},e),{},{queryHistory:Object(A.a)(Object(A.a)({},e.queryHistory),{},{index:t.payload})});case"SET_QUERY_HISTORY_VALUES":return Object(A.a)(Object(A.a)({},e),{},{queryHistory:Object(A.a)(Object(A.a)({},e.queryHistory),{},{values:t.payload})});case"SET_DURATION":return Object(A.a)(Object(A.a)({},e),{},{time:Object(A.a)(Object(A.a)({},e.time),{},{duration:t.payload,period:Q(t.payload,G(e.time.period.end))})});case"SET_UNTIL":return Object(A.a)(Object(A.a)({},e),{},{time:Object(A.a)(Object(A.a)({},e.time),{},{period:Q(e.time.duration,t.payload)})});case"SET_PERIOD":var n=function(e){var t=e.to.valueOf()-e.from.valueOf();return F(t)}(t.payload);return Object(A.a)(Object(A.a)({},e),{},{queryControls:Object(A.a)(Object(A.a)({},e.queryControls),{},{autoRefresh:!1}),time:Object(A.a)(Object(A.a)({},e.time),{},{duration:n,period:Q(n,t.payload.to)})});case"TOGGLE_AUTOREFRESH":return Object(A.a)(Object(A.a)({},e),{},{queryControls:Object(A.a)(Object(A.a)({},e.queryControls),{},{autoRefresh:!e.queryControls.autoRefresh})});case"TOGGLE_AUTOCOMPLETE":return Object(A.a)(Object(A.a)({},e),{},{queryControls:Object(A.a)(Object(A.a)({},e.queryControls),{},{autocomplete:!e.queryControls.autocomplete})});case"NO_CACHE":return Object(A.a)(Object(A.a)({},e),{},{queryControls:Object(A.a)(Object(A.a)({},e.queryControls),{},{nocache:!e.queryControls.nocache})});case"RUN_QUERY":return Object(A.a)(Object(A.a)({},e),{},{time:Object(A.a)(Object(A.a)({},e.time),{},{period:Q(e.time.duration,G(e.time.period.end))})});case"RUN_QUERY_TO_NOW":return Object(A.a)(Object(A.a)({},e),{},{time:Object(A.a)(Object(A.a)({},e.time),{},{period:Q(e.time.duration)})});default:throw new Error}}var le=Object(a.createContext)({}),ue=function(){return Object(a.useContext)(le).state},de=function(){return Object(a.useContext)(le).dispatch},je=Object.entries(oe).reduce((function(e,t){var n=Object(o.a)(t,2),a=n[0],r=n[1];return Object(A.a)(Object(A.a)({},e),{},Object(C.a)({},a,ae(a)||r))}),{}),be=function(e){var t=e.children,n=Object(a.useReducer)(se,je),r=Object(o.a)(n,2),c=r[0],i=r[1];Object(a.useEffect)((function(){ne(c)}),[c]);var s=Object(a.useMemo)((function(){return{state:c,dispatch:i}}),[c,i]);return Object(u.jsx)(le.Provider,{value:s,children:t})},Oe=function(e){return Object(u.jsxs)(f.a,{position:"relative",display:"inline-flex",children:[Object(u.jsx)(m.a,Object(A.a)({variant:"determinate"},e)),Object(u.jsx)(f.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(u.jsx)(p.a,{variant:"caption",component:"div",children:"".concat(e.label,"s")})})]})},he=n(242),fe=Object(he.a)({colorizing:{color:"white"}}),pe=function(){var e=fe(),t=de(),n=ue().queryControls.autoRefresh,c=Object(a.useState)(5),i=Object(o.a)(c,2),s=i[0],l=i[1],d=Object(a.useState)(),j=Object(o.a)(d,2),b=j[0],O=j[1],h=r.a.useState(100),p=Object(o.a)(h,2),x=p[0],v=p[1];Object(a.useEffect)((function(){var e;return n&&(O((new Date).valueOf()),e=setInterval((function(){O((new Date).valueOf()),t({type:"RUN_QUERY_TO_NOW"})}),1e3*s)),function(){e&&clearInterval(e)}}),[s,n]),Object(a.useEffect)((function(){var e=setInterval((function(){if(n&&b){var e=((new Date).valueOf()-b)/1e3,t=Math.floor(e/s*100);v(t)}}),16);return function(){clearInterval(e)}}),[n,b,s]);var m=function(){l((function(e){switch(e){case 1:return 2;default:return 5;case 5:return 1}}))};return Object(u.jsxs)(f.a,{display:"flex",alignItems:"center",children:[Object(u.jsx)(y.a,{control:Object(u.jsx)(g.a,{size:"small",className:e.colorizing,checked:n,onChange:function(){t({type:"TOGGLE_AUTOREFRESH"})}}),label:"Auto-refresh"}),n&&Object(u.jsxs)(u.Fragment,{children:[Object(u.jsx)(Oe,{className:e.colorizing,label:s,value:x,onClick:function(){m()}}),Object(u.jsx)(E.a,{title:"Change delay refresh",children:Object(u.jsx)(f.a,{ml:1,children:Object(u.jsx)(S.a,{onClick:function(){m()},children:Object(u.jsx)(T.a,{style:{color:"white"}})})})})]})]})},xe=n(138),ve=n.n(xe),me=n(136),ye=n.n(me),ge=n(137),Ee=n.n(ge),Se=n(246),_e=n(286),Te=n(10),Ce=Object(Te.a)({root:{padding:6,color:"white","&.Mui-selected":{color:"white"}}})(Se.a),Ae=function(){var e=ue().displayType,t=de();return Object(u.jsxs)(_e.a,{value:e,exclusive:!0,onChange:function(n,a){return t({type:"SET_DISPLAY_TYPE",payload:null!==a&&void 0!==a?a:e})},children:[Object(u.jsxs)(Ce,{value:"chart","aria-label":"display as chart",children:[Object(u.jsx)(ye.a,{}),"\xa0Query Range as Chart"]}),Object(u.jsxs)(Ce,{value:"code","aria-label":"display as code",children:[Object(u.jsx)(Ee.a,{}),"\xa0Instant Query as JSON"]}),Object(u.jsxs)(Ce,{value:"table","aria-label":"display as table",children:[Object(u.jsx)(ve.a,{}),"\xa0Instant Query as Table"]})]})},we=n(25),Ie=n(139),Re=n.n(Ie),Ue=(n(198),n(140)),ke=n.n(Ue),De=(n(199),{yaxis:{limits:{enable:!1,range:[0,0]}}});function He(e,t){switch(t.type){case"TOGGLE_ENABLE_YAXIS_LIMITS":return Object(A.a)(Object(A.a)({},e),{},{yaxis:Object(A.a)(Object(A.a)({},e.yaxis),{},{limits:Object(A.a)(Object(A.a)({},e.yaxis.limits),{},{enable:!e.yaxis.limits.enable})})});case"SET_YAXIS_LIMITS":return Object(A.a)(Object(A.a)({},e),{},{yaxis:Object(A.a)(Object(A.a)({},e.yaxis),{},{limits:Object(A.a)(Object(A.a)({},e.yaxis.limits),{},{range:t.payload})})});default:throw new Error}}var Me=Object(a.createContext)({}),Le=function(){return Object(a.useContext)(Me).state},Ne=function(){return Object(a.useContext)(Me).dispatch},Ye=function(e){var t=e.children,n=Object(a.useReducer)(He,De),r=Object(o.a)(n,2),c=r[0],i=r[1],s=Object(a.useMemo)((function(){return{state:c,dispatch:i}}),[c,i]);return Object(u.jsx)(Me.Provider,{value:s,children:t})},qe=function(e){for(var t=0,n=0;n>8*r&255).toString(16)).substr(-2)}return a},Be=function(e){if(7!=e.length)return"0, 0, 0";var t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);return"".concat(t,", ").concat(n,", ").concat(a)},Pe=function(e){var t,n=e.u,a=e.tooltipIdx,r=e.metrics,c=e.series,i=e.tooltip,o=e.tooltipOffset,s=a.seriesIdx,l=a.dataIdx,u=n.data[s][l],d=n.data[0][l],j=(null===(t=r[s-1])||void 0===t?void 0:t.metric)||{},b=qe(c[s].label||""),O=n.over.getBoundingClientRect(),h=O.width,f=O.height,p=n.valToPos(u||0,"y"),x=n.valToPos(d,"x"),v=i.getBoundingClientRect(),m=v.width,y=v.height,g=x+m>=h,E=p+y>=f;i.style.display="grid",i.style.top="".concat(o.top+p+10-(E?y+10:0),"px"),i.style.left="".concat(o.left+x+10-(g?m+20:0),"px");var S=I()(new Date(1e3*d)).format("YYYY-MM-DD HH:mm:ss:SSS (Z)"),_=Object.keys(j).filter((function(e){return"__name__"!==e})).map((function(e){return"
".concat(e,": ").concat(j[e],"
")})).join(""),T='
');i.innerHTML="
".concat(S,'
\n
\n ').concat(T).concat(j.__name__||"",': ').concat(u,'\n
\n
').concat(_,"
")},Qe=function(e){var t=e.data,n=e.series,r=e.metrics,c=void 0===r?[]:r,i=de(),s=ue().time.period,l=Le().yaxis,d=Object(a.useRef)(null),j=Object(a.useState)(!1),b=Object(o.a)(j,2),O=b[0],h=b[1],f=Object(a.useState)(0),p=Object(o.a)(f,2),x=p[0],v=p[1],m={seriesIdx:1,dataIdx:0},y={left:0,top:0},g=document.createElement("div");g.className="u-tooltip";var E=function(e){var t=e.min,n=e.max;i({type:"SET_PERIOD",payload:{from:new Date(1e3*t),to:new Date(1e3*n)}})},S={width:d.current?d.current.offsetWidth:400,height:500,series:n,plugins:[{hooks:{ready:function(e){var t;y.left=parseFloat(e.over.style.left),y.top=parseFloat(e.over.style.top),null===(t=e.root.querySelector(".u-wrap"))||void 0===t||t.appendChild(g),e.over.addEventListener("mousedown",(function(t){if(0===t.button){h(!0),t.preventDefault();var n=t.clientX,a=function(t){t.preventDefault();var a=(e.posToVal(1,"x")-e.posToVal(0,"x"))*(t.clientX-n),r=(e.scales.x.min||1)-a,c=(e.scales.x.max||1)-a;e.setScale("x",{min:r,max:c}),E({min:r,max:c})};document.addEventListener("mousemove",a),document.addEventListener("mouseup",(function e(){h(!1),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",e)}))}})),e.over.addEventListener("wheel",(function(t){if(t.ctrlKey||t.metaKey){t.preventDefault();var n=e.over.getBoundingClientRect().width;e.cursor.left&&e.cursor.left>0&&v(e.cursor.left);var a=e.posToVal(x,"x"),r=(e.scales.x.max||0)-(e.scales.x.min||0),c=t.deltaY<0?.85*r:r/.85,i=a-x/n*c,o=i+c;e.batch((function(){e.setScale("x",{min:i,max:o}),E({min:i,max:o})}))}}))},setCursor:function(e){m.dataIdx!==e.cursor.idx&&(m.dataIdx=e.cursor.idx||0,m.seriesIdx&&m.dataIdx&&Pe({u:e,tooltipIdx:m,metrics:c,series:n,tooltip:g,tooltipOffset:y}))},setSeries:function(e,t){m.seriesIdx!==t&&(m.seriesIdx=t||0,t&&m.dataIdx?Pe({u:e,tooltipIdx:m,metrics:c,series:n,tooltip:g,tooltipOffset:y}):g.style.display="none")}}}],cursor:{drag:{x:!1,y:!1},focus:{prox:30},bind:{mouseup:function(){return null},mousedown:function(){return null},click:function(){return null},dblclick:function(){return null},mouseenter:function(){return null}}},legend:{show:!1},axes:[{space:80},{show:!0,font:"10px Arial",values:function(e,t){return t.map((function(e){return e>1e3?ke()(e).format("0.0a"):e}))}}],scales:{x:{range:function(){return[s.start,s.end]}},y:{range:function(e,t,n){return l.limits.enable?l.limits.range:[t-.05*t,n+.05*n]}}}};return Object(u.jsx)("div",{ref:d,style:{pointerEvents:O?"none":"auto",height:"500px"},children:Object(u.jsx)(Re.a,{options:S,data:t})})},ze=(n(200),function(e){var t=e.labels,n=e.onChange;return Object(u.jsx)("div",{className:"legendWrapper",children:t.map((function(e){return Object(u.jsxs)("div",{className:e.checked?"legendItem":"legendItem legendItemHide",onClick:function(t){return n(e.label,t.ctrlKey||t.metaKey)},children:[Object(u.jsx)("div",{className:"legendMarker",style:{borderColor:e.color,backgroundColor:"rgba(".concat(Be(e.color),", 0.1)")}}),Object(u.jsxs)("div",{className:"legendLabel",children:[e.checked," ",e.label]})]},e.label)}))})}),Fe=n(106),Ge=["__name__"],We=function(e){var t=e.data,n=void 0===t?[]:t,r=ue().time.period,c=Le().yaxis,i=Ne(),s=Object(a.useState)([]),l=Object(o.a)(s,2),d=l[0],j=l[1],b=Object(a.useState)([[]]),O=Object(o.a)(b,2),h=O[0],f=O[1],p=Object(a.useState)([]),x=Object(o.a)(p,2),v=x[0],m=x[1],y=Object(a.useState)([]),g=Object(o.a)(y,2),E=g[0],S=g[1],_=Object(a.useState)([]),T=Object(o.a)(_,2),C=T[0],A=T[1],w=function(e){var t=function(e){if(0===Object.keys(e.metric).length)return"Query result";var t=e.metric,n=t.__name__,a=Object(Fe.a)(t,Ge);return"".concat(n||""," {").concat(Object.entries(a).map((function(e){return"".concat(e[0],": ").concat(e[1])})).join(", "),"}")}(e);return{label:t,width:1.5,stroke:qe(t),show:!C.includes(t)}},I=function(e){return{label:e.label||"",color:e.stroke,checked:e.show||!1}};return Object(a.useEffect)((function(){var e=[],t=[],a=[],o=[];null===n||void 0===n||n.forEach((function(n){var r=w(n);o.push(r),a.push(I(r)),n.values.forEach((function(n){-1===e.indexOf(n[0])&&e.push(n[0]),t.push(+n[1])}))})),function(e){var t=e.sort((function(e,t){return e-t})),n=t[0]||0,a=t[t.length-1]||0,c=r.step||1,i=Math.round((a-n)/c);j(new Array(i).fill(0).map((function(e,t){return n+c*t})))}(e),function(e){if(!c.limits.enable||c.limits.range.every((function(e){return!e}))){var t=e.flat().sort((function(e,t){return e-t}));i({type:"SET_YAXIS_LIMITS",payload:[t[0],t[t.length-1]]})}}(t),m([{}].concat(o)),S(a)}),[n]),Object(a.useEffect)((function(){var e=[],t=[];null===n||void 0===n||n.forEach((function(n){var a=w(n);t.push(a),e.push(I(a))})),m([{}].concat(t)),S(e)}),[C]),Object(a.useEffect)((function(){f([d].concat(Object(we.a)(n.map((function(e){return d.map((function(t){var n=e.values.find((function(e){return e[0]===t}));return n?+n[1]:null}))})))))}),[d]),Object(u.jsx)(u.Fragment,{children:n.length>0?Object(u.jsxs)("div",{children:[Object(u.jsx)(Qe,{data:h,series:v,metrics:n}),Object(u.jsx)(ze,{labels:E,onChange:function(e,t){A(function(e){var t=e.hideSeries,n=e.label,a=e.metaKey,r=e.series,c=t.includes(n),i=r.map((function(e){return e.label||""})).filter((function(e){return e}));return a&&c?Object(we.a)(i.filter((function(e){return e!==n}))):a&&!c?t.length===r.length-2?[]:Object(we.a)(i.filter((function(e){return e!==n}))):c?t.filter((function(e){return e!==n})):[].concat(Object(we.a)(t),[n])}({hideSeries:C,label:e,metaKey:t,series:v}))}})]}):Object(u.jsx)("div",{style:{textAlign:"center"},children:"No data to show"})})},Ve=n(247),Xe=n(157),Je=n(248),Ke=n(249),Ze=n(250),$e=n(251),et=n(252),tt=Object(he.a)({deemphasized:{opacity:.4}}),nt=function(e){var t=e.data,n=tt(),r=function(e){return Object(a.useMemo)((function(){var t={};return e.forEach((function(e){return Object.entries(e.metric).forEach((function(e){return t[e[0]]?t[e[0]].options.add(e[1]):t[e[0]]={options:new Set([e[1]])}}))})),Object.entries(t).map((function(e){return{key:e[0],variations:e[1].options.size}})).sort((function(e,t){return e.variations-t.variations}))}),[e])}(t),c=Object(a.useMemo)((function(){return null===t||void 0===t?void 0:t.map((function(e){return{metadata:r.map((function(t){return e.metric[t.key]||"-"})),value:e.value[1]}}))}),[r,t]);return Object(u.jsx)(u.Fragment,{children:c.length>0?Object(u.jsx)(Ve.a,{component:Xe.a,children:Object(u.jsxs)(Je.a,{"aria-label":"simple table",children:[Object(u.jsx)(Ke.a,{children:Object(u.jsxs)(Ze.a,{children:[r.map((function(e,t){return Object(u.jsx)($e.a,{style:{textTransform:"capitalize"},children:e.key},t)})),Object(u.jsx)($e.a,{align:"right",children:"Value"})]})}),Object(u.jsx)(et.a,{children:c.map((function(e,t){return Object(u.jsxs)(Ze.a,{children:[e.metadata.map((function(e,a){var r=c[t-1]&&c[t-1].metadata[a];return Object(u.jsx)($e.a,{className:r===e?n.deemphasized:void 0,children:e},a)})),Object(u.jsx)($e.a,{align:"right",children:e.value})]},t)}))})]})}):Object(u.jsx)("div",{style:{textAlign:"center"},children:"No data to show"})})},at=n(280),rt=n(268),ct=n(269),it=n(265),ot=n(275),st=n(4),lt=n(9),ut=n(103),dt=n(152),jt=n(154),bt=function(e){var t=e.query,n=e.queryHistory,r=e.setHistoryIndex,c=e.setQuery,i=e.runQuery,s=e.server,l=e.oneLiner,d=void 0!==l&&l,j=e.autocomplete,b=Object(a.useRef)(null),O=Object(a.useState)(),h=Object(o.a)(O,2),f=h[0],p=h[1];Object(a.useEffect)((function(){return b.current&&p(new lt.d({parent:b.current})),function(){return null===f||void 0===f?void 0:f.destroy()}}),[]),Object(a.useEffect)((function(){var e=new dt.a;e.activateCompletion(j),e.setComplete({remote:{url:s}});var n=lt.d.updateListener.of((function(e){e.docChanged&&c(e.state.doc.toJSON().map((function(e){return e.trim()})).join(""))}));null===f||void 0===f||f.setState(st.f.create({doc:t,extensions:[jt.a,lt.k.of(ut.a),n,e.asExtension()]}))}),[s,f,j,n]);return Object(u.jsx)(u.Fragment,{children:Object(u.jsx)("div",{ref:b,className:d?"one-line-scroll":"multi-line-scroll",onKeyUp:function(e){var t=e.key,n=e.ctrlKey,a=e.metaKey,c=n||a;"Enter"===t&&c?i():"ArrowUp"===t&&c?r(-1):"ArrowDown"===t&&c&&r(1)}})})},Ot=n(256),ht=n(273),ft=function(){return Object(u.jsx)(Ve.a,{component:Xe.a,children:Object(u.jsxs)(Je.a,{"aria-label":"simple table",size:"small",children:[Object(u.jsx)(Ke.a,{children:Object(u.jsxs)(Ze.a,{children:[Object(u.jsx)($e.a,{children:"Long"}),Object(u.jsx)($e.a,{children:"Short"})]})}),Object(u.jsx)(et.a,{children:q.map((function(e,t){return Object(u.jsxs)(Ze.a,{children:[Object(u.jsx)($e.a,{component:"th",scope:"row",children:e.long}),Object(u.jsx)($e.a,{children:e.short})]},t)}))})]})})},pt=Object(he.a)({inlineBtn:{"&:hover":{cursor:"pointer"}}}),xt=function(e){var t=e.handler,n=e.text,a=pt();return Object(u.jsx)(x.a,{component:"span",className:a.inlineBtn,onClick:t,children:n})},vt=function(e){var t=e.setDuration,n=Object(a.useState)(!1),c=Object(o.a)(n,2),i=c[0],s=c[1],l=r.a.useState(null),d=Object(o.a)(l,2),j=d[0],b=d[1],O=Object(a.useState)(),h=Object(o.a)(O,2),x=h[0],v=h[1],m=ue().time,y=m.period.end,g=m.duration,E=de(),S=Object(a.useState)(g),_=Object(o.a)(S,2),T=_[0],C=_[1];Object(a.useEffect)((function(){C(g)}),[g]),Object(a.useEffect)((function(){v(function(e){return I()(e).format(Y)}(G(y)))}),[y]),Object(a.useEffect)((function(){if(!i){var e=function(e){var t=e.trim().split(" ").reduce((function(e,t){var n=P(t);return n?Object(A.a)(Object(A.a)({},e),n):Object(A.a)({},e)}),{}),n=I.a.duration(t).asMilliseconds();return nN?F(N):e}(T);C(e),t(e)}}),[T,i]);var w=function(){b(null)},R=Boolean(j);return Object(u.jsxs)(f.a,{m:1,flexDirection:"row",display:"flex",children:[Object(u.jsxs)(f.a,{px:1,children:[Object(u.jsx)(f.a,{children:Object(u.jsx)(ot.a,{label:"Duration",value:T,onChange:function(e){C(e.target.value)},fullWidth:!0,onBlur:function(){s(!1)},onFocus:function(){s(!0)}})}),Object(u.jsx)(f.a,{my:2,children:Object(u.jsxs)(p.a,{variant:"body2",children:["Possible options",Object(u.jsx)("span",{"aria-owns":R?"mouse-over-popover":void 0,"aria-haspopup":"true",style:{cursor:"pointer"},onMouseEnter:function(e){b(e.currentTarget)},onMouseLeave:w,children:":\xa0"}),Object(u.jsx)(Ot.a,{open:R,anchorEl:j,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},style:{pointerEvents:"none"},onClose:w,disableRestoreFocus:!0,children:Object(u.jsx)(ft,{})}),Object(u.jsx)(xt,{handler:function(){return C("5m")},text:"5m"}),",\xa0",Object(u.jsx)(xt,{handler:function(){return C("1h")},text:"1h"}),",\xa0",Object(u.jsx)(xt,{handler:function(){return C("1h 30m")},text:"1h 30m"})]})})]}),Object(u.jsxs)(f.a,{px:1,children:[Object(u.jsx)(f.a,{children:Object(u.jsx)(ht.a,{variant:"inline",ampm:!1,label:"Until",value:x,onChange:function(e){return E({type:"SET_UNTIL",payload:e})},onError:console.log,format:"DD/MM/YYYY HH:mm:ss"})}),Object(u.jsx)(f.a,{my:2,children:Object(u.jsxs)(p.a,{variant:"body2",children:["Will be changed to current time for auto-refresh mode.\xa0",Object(u.jsx)(xt,{handler:function(){return E({type:"RUN_QUERY_TO_NOW"})},text:"Switch to now"})]})})]})]})},mt=n(144),yt=n.n(mt),gt=n(146),Et=n.n(gt),St=n(266),_t=n(285),Tt=n(281),Ct=n(263),At=n(267),wt=n(276),It=n(258),Rt=n(255),Ut=n(284),kt=n(254),Dt=n(261),Ht=n(278),Mt=n(257),Lt=n(264),Nt=n(259),Yt=["children","value","index"],qt=function(e){var t=e.children,n=e.value,a=e.index,r=Object(Fe.a)(e,Yt);return Object(u.jsx)("div",Object(A.a)(Object(A.a)({role:"tabpanel",hidden:n!==a,id:"auth-config-tabpanel-".concat(a),"aria-labelledby":"auth-config-tab-".concat(a)},r),{},{children:n===a&&Object(u.jsx)(f.a,{py:2,children:t})}))},Bt=n(142),Pt=n.n(Bt),Qt=n(143),zt=n.n(Qt),Ft={authMethod:"NO_AUTH",saveAuthLocally:!1},Gt=V("AUTH_TYPE"),Wt=V("BASIC_AUTH_DATA"),Vt=V("BEARER_AUTH_DATA"),Xt=Object(A.a)(Object(A.a)({},Ft),{},{authMethod:Gt||Ft.authMethod,basicData:Wt,bearerData:Vt,saveAuthLocally:!(!Wt&&!Vt)}),Jt=function(){X(J)};function Kt(e,t){switch(t.type){case"SET_BASIC_AUTH":return t.payload.checkbox?W("BASIC_AUTH_DATA",t.payload.value):Jt(),W("AUTH_TYPE","BASIC_AUTH"),Object(A.a)(Object(A.a)({},e),{},{authMethod:"BASIC_AUTH",basicData:t.payload.value});case"SET_BEARER_AUTH":return t.payload.checkbox?W("BEARER_AUTH_DATA",t.payload.value):Jt(),W("AUTH_TYPE","BEARER_AUTH"),Object(A.a)(Object(A.a)({},e),{},{authMethod:"BEARER_AUTH",bearerData:t.payload.value});case"SET_NO_AUTH":return!t.payload.checkbox&&Jt(),W("AUTH_TYPE","NO_AUTH"),Object(A.a)(Object(A.a)({},e),{},{authMethod:"NO_AUTH"});default:throw new Error}}var Zt=Object(a.createContext)({}),$t=function(){return Object(a.useContext)(Zt).state},en=function(e){var t=e.children,n=Object(a.useReducer)(Kt,Xt),r=Object(o.a)(n,2),c=r[0],i=r[1],s=Object(a.useMemo)((function(){return{state:c,dispatch:i}}),[c,i]);return Object(u.jsx)(Zt.Provider,{value:s,children:t})},tn=Object(he.a)((function(){return Object(Tt.a)({tabsContent:{height:"200px"}})})),nn="Bearer ",an=[{title:"No auth",id:"NO_AUTH"},{title:"Basic Auth",id:"BASIC_AUTH"},{title:"Bearer Token",id:"BEARER_AUTH"}],rn=function(e){var t=tn(),n=e.onClose,r=e.open,c=$t(),i=c.saveAuthLocally,s=c.basicData,l=c.bearerData,d=c.authMethod,j=Object(a.useContext)(Zt).dispatch,b=Object(a.useState)(i),O=Object(o.a)(b,2),h=O[0],x=O[1],v=Object(a.useState)(s||{password:"",login:""}),m=Object(o.a)(v,2),g=m[0],E=m[1],S=Object(a.useState)((null===l||void 0===l?void 0:l.token)||nn),_=Object(o.a)(S,2),T=_[0],C=_[1],w=Object(a.useState)(an.findIndex((function(e){return e.id===d}))||0),I=Object(o.a)(w,2),R=I[0],U=I[1],k=function(){n()};return Object(u.jsxs)(_t.a,{onClose:k,"aria-labelledby":"simple-dialog-title",open:r,children:[Object(u.jsx)(St.a,{id:"simple-dialog-title",children:"Request Auth Settings"}),Object(u.jsxs)(Ct.a,{children:[Object(u.jsx)(At.a,{children:"This affects Authorization header sent to the server you specify. Not shown in URL and can be optionally stored on a client side"}),Object(u.jsx)(wt.a,{value:R,onChange:function(e,t){U(t)},indicatorColor:"primary",textColor:"primary",children:an.map((function(e){return Object(u.jsx)(It.a,{label:e.title},e.id)}))}),Object(u.jsxs)(f.a,{p:0,display:"flex",flexDirection:"column",className:t.tabsContent,children:[Object(u.jsxs)(f.a,{flexGrow:1,children:[Object(u.jsx)(qt,{value:R,index:0,children:Object(u.jsx)(p.a,{style:{fontStyle:"italic"},children:"No Authorization Header"})}),Object(u.jsxs)(qt,{value:R,index:1,children:[Object(u.jsxs)(Rt.a,{margin:"dense",fullWidth:!0,children:[Object(u.jsx)(Ut.a,{htmlFor:"basic-login",children:"User"}),Object(u.jsx)(kt.a,{id:"basic-login",startAdornment:Object(u.jsx)(Dt.a,{position:"start",children:Object(u.jsx)(Pt.a,{})}),required:!0,onChange:function(e){return E((function(t){return Object(A.a)(Object(A.a)({},t),{},{login:e.target.value||""})}))},value:(null===g||void 0===g?void 0:g.login)||""})]}),Object(u.jsxs)(Rt.a,{margin:"dense",fullWidth:!0,children:[Object(u.jsx)(Ut.a,{htmlFor:"basic-pass",children:"Password"}),Object(u.jsx)(kt.a,{id:"basic-pass",startAdornment:Object(u.jsx)(Dt.a,{position:"start",children:Object(u.jsx)(zt.a,{})}),onChange:function(e){return E((function(t){return Object(A.a)(Object(A.a)({},t),{},{password:e.target.value||""})}))},value:(null===g||void 0===g?void 0:g.password)||""})]})]}),Object(u.jsx)(qt,{value:R,index:2,children:Object(u.jsx)(ot.a,{id:"bearer-auth",label:"Bearer token",multiline:!0,fullWidth:!0,value:T,onChange:function(e){var t=e.target.value;t.startsWith(nn)?C(t):C(nn)},InputProps:{onPaste:function(e){var t=e.clipboardData.getData("text/plain");t.startsWith(nn)?C(t):C(nn+t),e.preventDefault()}},maxRows:6})})]}),Object(u.jsxs)(Rt.a,{children:[Object(u.jsx)(y.a,{control:Object(u.jsx)(Ht.a,{checked:h,onChange:function(){return x((function(e){return!e}))},name:"checkedB",color:"primary"}),label:"Persist Auth Data Locally"}),Object(u.jsx)(Mt.a,{children:h?"Auth Data and the Selected method will be saved to LocalStorage":"Auth Data won't be saved. All previously saved Auth Data will be removed"})]})]})]}),Object(u.jsx)(Lt.a,{children:Object(u.jsx)(Nt.a,{onClick:function(){switch(R){case 0:j({type:"SET_NO_AUTH",payload:{checkbox:h}});break;case 1:j({type:"SET_BASIC_AUTH",payload:{checkbox:h,value:g}});break;case 2:j({type:"SET_BEARER_AUTH",payload:{checkbox:h,value:{token:T}}})}k()},color:"primary",children:"Apply"})})]})},cn=n(145),on=n.n(cn),sn=n(245),ln=n(119),un=n.n(ln),dn=function(){var e=ue(),t=e.serverUrl,n=e.query,r=e.queryHistory,c=e.time.duration,i=e.queryControls,s=i.autocomplete,l=i.nocache,d=de(),j=Le().yaxis,b=Ne(),O=Object(a.useState)(!1),h=Object(o.a)(O,2),x=h[0],v=h[1],m=Object(a.useState)(!0),_=Object(o.a)(m,2),T=_[0],C=_[1],A=Object(a.useRef)(null),w=function(){var e=r.values;d({type:"RUN_QUERY"}),n!==e[e.length-1]&&(d({type:"SET_QUERY_HISTORY_INDEX",payload:e.length}),d({type:"SET_QUERY_HISTORY_VALUES",payload:[].concat(Object(we.a)(e),[n])}))},I=function(e){n!==e&&d({type:"SET_QUERY",payload:e})};return Object(u.jsxs)(u.Fragment,{children:[Object(u.jsxs)(at.a,{expanded:T,onChange:function(){return C((function(e){return!e}))},children:[Object(u.jsxs)(rt.a,{expandIcon:Object(u.jsx)(yt.a,{}),"aria-controls":"panel1a-content",id:"panel1a-header",children:[Object(u.jsx)(f.a,{mr:2,children:Object(u.jsx)(p.a,{variant:"h6",component:"h2",children:"Query Configuration"})}),Object(u.jsx)(f.a,{flexGrow:1,onClick:function(e){return e.stopPropagation()},onFocusCapture:function(e){return e.stopPropagation()},children:Object(u.jsx)(sn.a,{disablePortal:!T,container:A.current,children:Object(u.jsxs)(f.a,{display:"flex",alignItems:"center",children:[Object(u.jsx)(f.a,{width:"100%",children:Object(u.jsx)(bt,{server:t,query:n,oneLiner:!T,autocomplete:s,queryHistory:r,setHistoryIndex:function(e){var t=r.index+e;t<-1||t>r.values.length||(d({type:"SET_QUERY_HISTORY_INDEX",payload:t}),I(r.values[t]||""))},runQuery:w,setQuery:I})}),Object(u.jsx)(E.a,{title:"Execute Query",children:Object(u.jsx)(S.a,{onClick:w,children:Object(u.jsx)(on.a,{})})})]})})})]}),Object(u.jsx)(ct.a,{children:Object(u.jsxs)(it.a,{container:!0,spacing:2,children:[Object(u.jsx)(it.a,{item:!0,xs:12,md:6,children:Object(u.jsxs)(f.a,{display:"grid",gridGap:16,children:[Object(u.jsxs)(f.a,{display:"flex",alignItems:"center",children:[Object(u.jsx)(ot.a,{variant:"outlined",fullWidth:!0,label:"Server URL",value:t,inputProps:{style:{fontFamily:"Monospace"}},onChange:function(e){var t=e.target.value;d({type:"SET_SERVER",payload:t})}}),Object(u.jsx)(f.a,{children:Object(u.jsx)(E.a,{title:"Request Auth Settings",children:Object(u.jsx)(S.a,{onClick:function(){return v(!0)},children:Object(u.jsx)(Et.a,{})})})})]}),Object(u.jsx)(f.a,{flexGrow:1,children:Object(u.jsx)("div",{ref:A})})]})}),Object(u.jsx)(it.a,{item:!0,xs:8,md:6,children:Object(u.jsx)(f.a,{style:{borderRadius:"4px",borderColor:"#b9b9b9",borderStyle:"solid",borderWidth:"1px",height:"100%"},children:Object(u.jsx)(vt,{setDuration:function(e){return d({type:"SET_DURATION",payload:e})},duration:c})})}),Object(u.jsx)(it.a,{item:!0,xs:12,children:Object(u.jsxs)(f.a,{px:1,display:"flex",alignItems:"center",minHeight:52,children:[Object(u.jsx)(f.a,{children:Object(u.jsx)(y.a,{control:Object(u.jsx)(g.a,{size:"small",checked:s,onChange:function(){d({type:"TOGGLE_AUTOCOMPLETE"}),W("AUTOCOMPLETE",!s)}}),label:"Enable autocomplete"})}),Object(u.jsx)(f.a,{ml:4,children:Object(u.jsx)(y.a,{control:Object(u.jsx)(g.a,{size:"small",checked:!l,onChange:function(){d({type:"NO_CACHE"}),W("NO_CACHE",!l)}}),label:"Enable cache"})}),Object(u.jsxs)(f.a,{ml:4,display:"flex",alignItems:"center",children:[Object(u.jsx)(y.a,{control:Object(u.jsx)(g.a,{size:"small",checked:j.limits.enable,onChange:function(){b({type:"TOGGLE_ENABLE_YAXIS_LIMITS"})}}),label:"fix the limits for y-axis"}),j.limits.enable&&Object(u.jsxs)(f.a,{display:"grid",gridTemplateColumns:"120px 120px",gridGap:10,children:[Object(u.jsx)(ot.a,{label:"Min",type:"number",size:"small",variant:"outlined",defaultValue:j.limits.range[0],onChange:un()((function(e){var t=e.target.value;b({type:"SET_YAXIS_LIMITS",payload:[+t,j.limits.range[1]]})}),750)}),Object(u.jsx)(ot.a,{label:"Max",type:"number",size:"small",variant:"outlined",defaultValue:j.limits.range[1],onChange:un()((function(e){var t=e.target.value;b({type:"SET_YAXIS_LIMITS",payload:[j.limits.range[0],+t]})}),750)})]})]})]})})]})})]}),Object(u.jsx)(rn,{open:x,onClose:function(){return v(!1)}})]})},jn=n(101),bn=n.n(jn),On=n(147),hn=function(){var e=ue(),t=e.query,n=e.displayType,r=e.serverUrl,c=e.time.period,i=e.queryControls.nocache,s=$t(),l=s.basicData,u=s.bearerData,d=s.authMethod,j=Object(a.useState)(!1),b=Object(o.a)(j,2),O=b[0],h=b[1],f=Object(a.useState)(),p=Object(o.a)(f,2),x=p[0],v=p[1],m=Object(a.useState)(),y=Object(o.a)(m,2),g=y[0],E=y[1],S=Object(a.useState)(),_=Object(o.a)(S,2),T=_[0],C=_[1],w=Object(a.useState)(),I=Object(o.a)(w,2),R=I[0],U=I[1];Object(a.useEffect)((function(){T&&(v(void 0),E(void 0))}),[T]);var k=Object(a.useMemo)((function(){if(!R)return!0;var e=(R.end-R.start)/3,t=e/(c.end-c.start)>=.7,n=c.end>R.end+e,a=c.start