diff --git a/app/vlselect/vmui/asset-manifest.json b/app/vlselect/vmui/asset-manifest.json index 089f1f01e..70b897d17 100644 --- a/app/vlselect/vmui/asset-manifest.json +++ b/app/vlselect/vmui/asset-manifest.json @@ -1,13 +1,13 @@ { "files": { - "main.css": "./static/css/main.c9cc37dd.css", - "main.js": "./static/js/main.867f457f.js", + "main.css": "./static/css/main.cbbca000.css", + "main.js": "./static/js/main.3d2eb957.js", "static/js/685.f772060c.chunk.js": "./static/js/685.f772060c.chunk.js", "static/media/MetricsQL.md": "./static/media/MetricsQL.a00044c91d9781cf8557.md", "index.html": "./index.html" }, "entrypoints": [ - "static/css/main.c9cc37dd.css", - "static/js/main.867f457f.js" + "static/css/main.cbbca000.css", + "static/js/main.3d2eb957.js" ] } \ No newline at end of file diff --git a/app/vlselect/vmui/index.html b/app/vlselect/vmui/index.html index d8e2f0e50..6e0a3aa75 100644 --- a/app/vlselect/vmui/index.html +++ b/app/vlselect/vmui/index.html @@ -1 +1 @@ -
'+(o?i:fo(i,!0))+"
\n":""+(o?i:fo(i,!0))+"
\n"}blockquote(e){let{tokens:t}=e;const n=this.parser.parse(t);return"\n".concat(n,"\n")}html(e){let{text:t}=e;return t}heading(e){let{tokens:t,depth:n}=e;return"
".concat(this.parser.parseInline(t),"
\n")}table(e){let t="",n="";for(let o=0;o".concat(t,"
")}br(e){return"An error occurred:
"+fo(n.message+"",!0)+"";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function da(e,t){return ua.parse(e,t)}da.options=da.setOptions=function(e){return ua.setOptions(e),da.defaults=ua.defaults,io(da.defaults),da},da.getDefaults=oo,da.defaults=ao,da.use=function(){return ua.use(...arguments),da.defaults=ua.defaults,io(da.defaults),da},da.walkTokens=function(e,t){return ua.walkTokens(e,t)},da.parseInline=ua.parseInline,da.Parser=sa,da.parser=sa.parse,da.Renderer=ia,da.TextRenderer=la,da.Lexer=aa,da.lexer=aa.lex,da.Tokenizer=ko,da.Hooks=ca,da.parse=da;da.options,da.setOptions,da.use,da.walkTokens,da.parseInline,sa.parse,aa.lex;var ha=function(e){return e.group="group",e.table="table",e.json="json",e}(ha||{});const pa=[{label:"Group",value:ha.group,icon:mt(Fn,{})},{label:"Table",value:ha.table,icon:mt(Nn,{})},{label:"JSON",value:ha.json,icon:mt(Tn,{})}],fa=e=>{let{data:n}=e;const{isMobile:r}=vr(),{timezone:a}=Gt(),{setSearchParamsFromKeys:i}=Lr(),l=(0,t.useRef)(null),[s,c]=Or(ha.group,"view"),[u,d]=(0,t.useState)([]),{value:h,toggle:p}=jr(!1),f=(0,t.useMemo)((()=>n.map((e=>({...e,_vmui_time:e._time?o()(e._time).tz().format("".concat(wt,".SSS")):"",_vmui_data:JSON.stringify(e,null,2),_vmui_markdown:e._msg?da(e._msg.replace(/```/g,"\n```\n")):""})))),[n,a]),m=(0,t.useMemo)((()=>{if(null===f||void 0===f||!f.length)return[];const e=["_vmui_data","_vmui_time","_vmui_markdown"],t=new Set;for(const n of f)for(const e in n)t.add(e);return Array.from(t).filter((t=>!e.includes(t)))}),[f]);return mt("div",{className:Zn()({"vm-explore-logs-body":!0,"vm-block":!0,"vm-block_mobile":r}),children:[mt("div",{className:Zn()({"vm-explore-logs-body-header":!0,"vm-section-header":!0,"vm-explore-logs-body-header_mobile":r}),children:[mt("div",{className:"vm-section-header__tabs",children:[mt(er,{activeItem:String(s),items:pa,onChange:e=>{c(e),i({view:e})}}),mt("div",{className:"vm-explore-logs-body-header__log-info",children:["Total logs returned: ",mt("b",{children:n.length})]})]}),s===ha.table&&mt("div",{className:"vm-explore-logs-body-header__settings",children:mt(Br,{columns:m,selectedColumns:u,onChangeColumns:d,tableCompact:h,toggleTableCompact:p})}),s===ha.group&&mt("div",{className:"vm-explore-logs-body-header__settings",ref:l})]}),mt("div",{className:Zn()({"vm-explore-logs-body__table":!0,"vm-explore-logs-body__table_mobile":r}),children:[!n.length&&mt("div",{className:"vm-explore-logs-body__empty",children:"No logs found"}),!!n.length&&mt(pt.FK,{children:[s===ha.table&&mt(qr,{logs:f,displayColumns:u,tableCompact:h,columns:m}),s===ha.group&&mt(eo,{logs:f,columns:m,settingsRef:l}),s===ha.json&&mt(Dr,{data:n})]})]})]})},ma=(e,n,r)=>{const[a]=$e(),[i,l]=(0,t.useState)([]),[s,c]=(0,t.useState)([]),[u,d]=(0,t.useState)(),h=(0,t.useRef)(new AbortController),p=(0,t.useMemo)((()=>(e=>"".concat(e,"/select/logsql/query"))(e)),[e]),f=e=>{try{return JSON.parse(e)}catch(Fd){return null}},m=(0,t.useCallback)((async e=>{h.current.abort(),h.current=new AbortController;const{signal:t}=h.current,i=Date.now();c((e=>({...e,[i]:!0}))),d(void 0);try{const s=((e,t,n,r)=>({signal:r,method:"POST",headers:{Accept:"application/stream+json",AccountID:a.get("accountID")||"0",ProjectID:a.get("projectID")||"0"},body:new URLSearchParams({query:e.trim(),limit:"".concat(n),start:o()(1e3*t.start).tz().toISOString(),end:o()(1e3*t.end).tz().toISOString()})}))(n,e,r,t),u=await fetch(p,s),h=await u.text();if(!u.ok||!u.body)return d(h),l([]),c((e=>({...e,[i]:!1}))),!1;const m=h.split("\n").filter((e=>e)).slice(0,r).map(f).filter((e=>e));return l(m),c((e=>({...e,[i]:!1}))),!0}catch(Fd){return c((e=>({...e,[i]:!1}))),Fd instanceof Error&&"AbortError"!==Fd.name&&(d(String(Fd)),console.error(Fd),l([])),!1}}),[p,n,r,a]);return{logs:i,isLoading:Object.values(s).some((e=>e)),error:u,fetchLogs:m}},_a=e=>{let{containerStyles:t,message:n}=e;const{isDarkTheme:r}=gt();return mt("div",{className:Zn()({"vm-spinner":!0,"vm-spinner_dark":r}),style:t,children:[mt("div",{className:"half-circle-spinner",children:[mt("div",{className:"circle circle-1"}),mt("div",{className:"circle circle-2"})]}),n&&mt("div",{className:"vm-spinner__message",children:n})]})};var ga=function(e){return e[e.mouse=0]="mouse",e[e.keyboard=1]="keyboard",e}(ga||{});const va=e=>{var n;let{value:r,options:o,anchor:a,disabled:i,minLength:l=2,fullWidth:s,selected:c,noOptionsText:u,label:d,disabledFullScreen:h,offset:p,maxDisplayResults:f,loading:m,onSelect:_,onOpenAutocomplete:g,onFoundOptions:v,onChangeWrapperRef:y}=e;const{isMobile:b}=vr(),w=(0,t.useRef)(null),[k,x]=(0,t.useState)({index:-1}),[S,A]=(0,t.useState)(""),[E,C]=(0,t.useState)(0),{value:M,setValue:N,setFalse:T}=jr(!1),P=(0,t.useMemo)((()=>{if(!M)return[];try{const e=new RegExp(String(r.trim()),"i"),t=o.filter((t=>e.test(t.value))).sort(((t,n)=>{var o,a;return t.value.toLowerCase()===r.trim().toLowerCase()?-1:n.value.toLowerCase()===r.trim().toLowerCase()?1:((null===(o=t.value.match(e))||void 0===o?void 0:o.index)||0)-((null===(a=n.value.match(e))||void 0===a?void 0:a.index)||0)}));return C(t.length),A(t.length>Number(null===f||void 0===f?void 0:f.limit)&&(null===f||void 0===f?void 0:f.message)||""),null!==f&&void 0!==f&&f.limit?t.slice(0,f.limit):t}catch(Fd){return[]}}),[M,o,r]),D=(0,t.useMemo)((()=>{var e;return 1===P.length&&(null===(e=P[0])||void 0===e?void 0:e.value)===r}),[P]),O=(0,t.useMemo)((()=>u&&!P.length),[u,P]),L=()=>{x({index:-1})},R=(0,t.useCallback)((e=>{const{key:t,ctrlKey:n,metaKey:r,shiftKey:o}=e,a=n||r||o,i=P.length&&!D;if("ArrowUp"===t&&!a&&i&&(e.preventDefault(),x((e=>{let{index:t}=e;return{index:t<=0?0:t-1,type:ga.keyboard}}))),"ArrowDown"===t&&!a&&i){e.preventDefault();const t=P.length-1;x((e=>{let{index:n}=e;return{index:n>=t?t:n+1,type:ga.keyboard}}))}if("Enter"===t){const e=P[k.index];e&&_(e.value),c||T()}"Escape"===t&&T()}),[k,P,D,T,_,c]);return(0,t.useEffect)((()=>{N(r.length>=l)}),[r,o]),Jn("keydown",R),(0,t.useEffect)((()=>{if(!w.current||k.type===ga.mouse)return;const e=w.current.childNodes[k.index];null!==e&&void 0!==e&&e.scrollIntoView&&e.scrollIntoView({block:"center"})}),[k,P]),(0,t.useEffect)((()=>{x({index:-1})}),[P]),(0,t.useEffect)((()=>{g&&g(M)}),[M]),(0,t.useEffect)((()=>{v&&v(D?[]:P)}),[P,D]),(0,t.useEffect)((()=>{y&&y(w)}),[w]),mt(Qr,{open:M,buttonRef:a,placement:"bottom-left",onClose:T,fullWidth:s,title:b?d:void 0,disabledFullScreen:h,offset:p,children:[mt("div",{className:Zn()({"vm-autocomplete":!0,"vm-autocomplete_mobile":b&&!h}),ref:w,children:[m&&mt("div",{className:"vm-autocomplete__loader",children:[mt(bn,{}),mt("span",{children:"Loading..."})]}),O&&mt("div",{className:"vm-autocomplete__no-options",children:u}),!D&&P.map(((e,t)=>{return mt("div",{className:Zn()({"vm-list-item":!0,"vm-list-item_mobile":b,"vm-list-item_active":t===k.index,"vm-list-item_multiselect":c,"vm-list-item_multiselect_selected":null===c||void 0===c?void 0:c.includes(e.value),"vm-list-item_with-icon":e.icon}),id:"$autocomplete$".concat(e.value),onClick:(r=e.value,()=>{i||(_(r),c||T())}),onMouseEnter:(n=t,()=>{x({index:n,type:ga.mouse})}),onMouseLeave:L,children:[(null===c||void 0===c?void 0:c.includes(e.value))&&mt(Pn,{}),mt(pt.FK,{children:e.icon}),mt("span",{children:e.value})]},"".concat(t).concat(e.value));var n,r}))]}),S&&mt("div",{className:"vm-autocomplete-message",children:["Shown ",null===f||void 0===f?void 0:f.limit," results out of ",E,". ",S]}),(null===(n=P[k.index])||void 0===n?void 0:n.description)&&mt("div",{className:"vm-autocomplete-info",children:[mt("div",{className:"vm-autocomplete-info__type",children:P[k.index].type}),mt("div",{className:"vm-autocomplete-info__description",dangerouslySetInnerHTML:{__html:P[k.index].description||""}})]})]})};var ya=n(267),ba=n.n(ya);const wa=e=>e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&"),ka=e=>JSON.stringify(e).slice(1,-1),xa=e=>{const t=e.match(/["`']/g);return!!t&&t.length%2!==0};var Sa=function(e){return e.metric="metric",e.label="label",e.labelValue="labelValue",e}(Sa||{});const Aa={[Sa.metric]:mt(Hn,{}),[Sa.label]:mt(Bn,{}),[Sa.labelValue]:mt(Un,{})},Ea=n.p+"static/media/MetricsQL.a00044c91d9781cf8557.md",Ca=e=>{const t='$1 target="_blank" class="'.concat("vm-link vm-link_colored",'" $2').concat("https://docs.victoriametrics.com/MetricsQL.html","#");return e.replace(/({let t="";return Array.from(e).map((e=>{var n;const r="h3"===e.tagName.toLowerCase();return t=r?null!==(n=e.textContent)&&void 0!==n?n:"":t,r?null:((e,t)=>{var n;const r=null!==(n=t.textContent)&&void 0!==n?n:"",o=(e=>{const t=[];let n=e.nextElementSibling;for(;n&&"p"===n.tagName.toLowerCase();)n&&t.push(n),n=n.nextElementSibling;return t})(t).map((e=>{var t;return null!==(t=e.outerHTML)&&void 0!==t?t:""})).join("\n");return{type:e,value:r,description:Ca(o),icon:mt(Vn,{})}})(t,e)})).filter(Boolean)},Na=()=>{const{metricsQLFunctions:e}=ln(),n=sn();return(0,t.useEffect)((()=>{e.length||(async()=>{try{const e=await fetch(Ea),t=(e=>{const t=document.createElement("div");t.innerHTML=da(e);const n=t.querySelectorAll("".concat("h3",", ").concat("h4"));return Ma(n)})(await e.text());n({type:"SET_METRICSQL_FUNCTIONS",payload:t})}catch(Fd){console.error("Error fetching or processing the MetricsQL.md file:",Fd)}})()}),[]),e},Ta=e=>{let{value:n,anchorEl:r,caretPosition:a,hasHelperText:i,onSelect:l,onFoundOptions:s}=e;const[c,u]=(0,t.useState)({top:0,left:0}),d=Na(),h=(0,t.useMemo)((()=>{if(a[0]!==a[1])return{beforeCursor:n,afterCursor:""};return{beforeCursor:n.substring(0,a[0]),afterCursor:n.substring(a[1])}}),[n,a]),p=(0,t.useMemo)((()=>{const e=h.beforeCursor.split(/\s(or|and|unless|default|ifnot|if|group_left|group_right)\s|}|\+|\|-|\*|\/|\^/i);return e[e.length-1]}),[h]),f=(0,t.useMemo)((()=>{const e=[...p.matchAll(/\w+\((?
'+(o?i:ho(i,!0))+"
\n":""+(o?i:ho(i,!0))+"
\n"}blockquote(e){let{tokens:t}=e;const n=this.parser.parse(t);return"\n".concat(n,"\n")}html(e){let{text:t}=e;return t}heading(e){let{tokens:t,depth:n}=e;return"
".concat(this.parser.parseInline(t),"
\n")}table(e){let t="",n="";for(let o=0;o".concat(t,"
")}br(e){return"An error occurred:
"+ho(n.message+"",!0)+"";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function ca(e,t){return sa.parse(e,t)}ca.options=ca.setOptions=function(e){return sa.setOptions(e),ca.defaults=sa.defaults,oo(ca.defaults),ca},ca.getDefaults=no,ca.defaults=ro,ca.use=function(){return sa.use(...arguments),ca.defaults=sa.defaults,oo(ca.defaults),ca},ca.walkTokens=function(e,t){return sa.walkTokens(e,t)},ca.parseInline=sa.parseInline,ca.Parser=ia,ca.parser=ia.parse,ca.Renderer=oa,ca.TextRenderer=aa,ca.Lexer=ra,ca.lexer=ra.lex,ca.Tokenizer=bo,ca.Hooks=la,ca.parse=ca;ca.options,ca.setOptions,ca.use,ca.walkTokens,ca.parseInline,ia.parse,ra.lex;var ua=function(e){return e.group="group",e.table="table",e.json="json",e}(ua||{});const da=[{label:"Group",value:ua.group,icon:mt(Fn,{})},{label:"Table",value:ua.table,icon:mt(Nn,{})},{label:"JSON",value:ua.json,icon:mt(Tn,{})}],ha=e=>{let{data:n}=e;const{isMobile:r}=vr(),{timezone:a}=Gt(),{setSearchParamsFromKeys:i}=Rr(),l=(0,t.useRef)(null),[s,c]=Or(ua.group,"view"),[u,d]=(0,t.useState)([]),{value:h,toggle:p}=Fr(!1),f=(0,t.useMemo)((()=>n.map((e=>({...e,_vmui_time:e._time?o()(e._time).tz().format("".concat(wt,".SSS")):"",_vmui_data:JSON.stringify(e,null,2),_vmui_markdown:e._msg?ca(e._msg.replace(/```/g,"\n```\n")):""})))),[n,a]),m=(0,t.useMemo)((()=>{if(null===f||void 0===f||!f.length)return[];const e=["_vmui_data","_vmui_time","_vmui_markdown"],t=new Set;for(const n of f)for(const e in n)t.add(e);return Array.from(t).filter((t=>!e.includes(t)))}),[f]);return mt("div",{className:Kn()({"vm-explore-logs-body":!0,"vm-block":!0,"vm-block_mobile":r}),children:[mt("div",{className:Kn()({"vm-explore-logs-body-header":!0,"vm-section-header":!0,"vm-explore-logs-body-header_mobile":r}),children:[mt("div",{className:"vm-section-header__tabs",children:[mt(er,{activeItem:String(s),items:da,onChange:e=>{c(e),i({view:e})}}),mt("div",{className:"vm-explore-logs-body-header__log-info",children:["Total logs returned: ",mt("b",{children:n.length})]})]}),s===ua.table&&mt("div",{className:"vm-explore-logs-body-header__settings",children:mt(Ur,{columns:m,defaultColumns:u,onChangeColumns:d,tableCompact:h,toggleTableCompact:p})}),s===ua.group&&mt("div",{className:"vm-explore-logs-body-header__settings",ref:l})]}),mt("div",{className:Kn()({"vm-explore-logs-body__table":!0,"vm-explore-logs-body__table_mobile":r}),children:[!n.length&&mt("div",{className:"vm-explore-logs-body__empty",children:"No logs found"}),!!n.length&&mt(pt.FK,{children:[s===ua.table&&mt(Zr,{logs:f,displayColumns:u,tableCompact:h,columns:m}),s===ua.group&&mt(Jr,{logs:f,columns:m,settingsRef:l}),s===ua.json&&mt(Dr,{data:n})]})]})]})},pa=(e,n,r)=>{const[a]=$e(),[i,l]=(0,t.useState)([]),[s,c]=(0,t.useState)([]),[u,d]=(0,t.useState)(),h=(0,t.useRef)(new AbortController),p=(0,t.useMemo)((()=>(e=>"".concat(e,"/select/logsql/query"))(e)),[e]),f=e=>{try{return JSON.parse(e)}catch(zd){return null}},m=(0,t.useCallback)((async e=>{h.current.abort(),h.current=new AbortController;const{signal:t}=h.current,i=Date.now();c((e=>({...e,[i]:!0}))),d(void 0);try{const s=((e,t,n,r)=>({signal:r,method:"POST",headers:{Accept:"application/stream+json",AccountID:a.get("accountID")||"0",ProjectID:a.get("projectID")||"0"},body:new URLSearchParams({query:e.trim(),limit:"".concat(n),start:o()(1e3*t.start).tz().toISOString(),end:o()(1e3*t.end).tz().toISOString()})}))(n,e,r,t),u=await fetch(p,s),h=await u.text();if(!u.ok||!u.body)return d(h),l([]),c((e=>({...e,[i]:!1}))),!1;const m=h.split("\n").filter((e=>e)).slice(0,r).map(f).filter((e=>e));return l(m),c((e=>({...e,[i]:!1}))),!0}catch(zd){return c((e=>({...e,[i]:!1}))),zd instanceof Error&&"AbortError"!==zd.name&&(d(String(zd)),console.error(zd),l([])),!1}}),[p,n,r,a]);return{logs:i,isLoading:Object.values(s).some((e=>e)),error:u,fetchLogs:m}},fa=e=>{let{containerStyles:t,message:n}=e;const{isDarkTheme:r}=gt();return mt("div",{className:Kn()({"vm-spinner":!0,"vm-spinner_dark":r}),style:t,children:[mt("div",{className:"half-circle-spinner",children:[mt("div",{className:"circle circle-1"}),mt("div",{className:"circle circle-2"})]}),n&&mt("div",{className:"vm-spinner__message",children:n})]})};var ma=function(e){return e[e.mouse=0]="mouse",e[e.keyboard=1]="keyboard",e}(ma||{});const _a=e=>{var n;let{value:r,options:o,anchor:a,disabled:i,minLength:l=2,fullWidth:s,selected:c,noOptionsText:u,label:d,disabledFullScreen:h,offset:p,maxDisplayResults:f,loading:m,onSelect:_,onOpenAutocomplete:g,onFoundOptions:v,onChangeWrapperRef:y}=e;const{isMobile:b}=vr(),w=(0,t.useRef)(null),[k,x]=(0,t.useState)({index:-1}),[S,A]=(0,t.useState)(""),[E,C]=(0,t.useState)(0),{value:M,setValue:N,setFalse:T}=Fr(!1),P=(0,t.useMemo)((()=>{if(!M)return[];try{const e=new RegExp(String(r.trim()),"i"),t=o.filter((t=>e.test(t.value))).sort(((t,n)=>{var o,a;return t.value.toLowerCase()===r.trim().toLowerCase()?-1:n.value.toLowerCase()===r.trim().toLowerCase()?1:((null===(o=t.value.match(e))||void 0===o?void 0:o.index)||0)-((null===(a=n.value.match(e))||void 0===a?void 0:a.index)||0)}));return C(t.length),A(t.length>Number(null===f||void 0===f?void 0:f.limit)&&(null===f||void 0===f?void 0:f.message)||""),null!==f&&void 0!==f&&f.limit?t.slice(0,f.limit):t}catch(zd){return[]}}),[M,o,r]),D=(0,t.useMemo)((()=>{var e;return 1===P.length&&(null===(e=P[0])||void 0===e?void 0:e.value)===r}),[P]),O=(0,t.useMemo)((()=>u&&!P.length),[u,P]),R=()=>{x({index:-1})},L=(0,t.useCallback)((e=>{const{key:t,ctrlKey:n,metaKey:r,shiftKey:o}=e,a=n||r||o,i=P.length&&!D;if("ArrowUp"===t&&!a&&i&&(e.preventDefault(),x((e=>{let{index:t}=e;return{index:t<=0?0:t-1,type:ma.keyboard}}))),"ArrowDown"===t&&!a&&i){e.preventDefault();const t=P.length-1;x((e=>{let{index:n}=e;return{index:n>=t?t:n+1,type:ma.keyboard}}))}if("Enter"===t){const e=P[k.index];e&&_(e.value),c||T()}"Escape"===t&&T()}),[k,P,D,T,_,c]);return(0,t.useEffect)((()=>{N(r.length>=l)}),[r,o]),Jn("keydown",L),(0,t.useEffect)((()=>{if(!w.current||k.type===ma.mouse)return;const e=w.current.childNodes[k.index];null!==e&&void 0!==e&&e.scrollIntoView&&e.scrollIntoView({block:"center"})}),[k,P]),(0,t.useEffect)((()=>{x({index:-1})}),[P]),(0,t.useEffect)((()=>{g&&g(M)}),[M]),(0,t.useEffect)((()=>{v&&v(D?[]:P)}),[P,D]),(0,t.useEffect)((()=>{y&&y(w)}),[w]),mt(Ir,{open:M,buttonRef:a,placement:"bottom-left",onClose:T,fullWidth:s,title:b?d:void 0,disabledFullScreen:h,offset:p,children:[mt("div",{className:Kn()({"vm-autocomplete":!0,"vm-autocomplete_mobile":b&&!h}),ref:w,children:[m&&mt("div",{className:"vm-autocomplete__loader",children:[mt(bn,{}),mt("span",{children:"Loading..."})]}),O&&mt("div",{className:"vm-autocomplete__no-options",children:u}),!D&&P.map(((e,t)=>{return mt("div",{className:Kn()({"vm-list-item":!0,"vm-list-item_mobile":b,"vm-list-item_active":t===k.index,"vm-list-item_multiselect":c,"vm-list-item_multiselect_selected":null===c||void 0===c?void 0:c.includes(e.value),"vm-list-item_with-icon":e.icon}),id:"$autocomplete$".concat(e.value),onClick:(r=e.value,()=>{i||(_(r),c||T())}),onMouseEnter:(n=t,()=>{x({index:n,type:ma.mouse})}),onMouseLeave:R,children:[(null===c||void 0===c?void 0:c.includes(e.value))&&mt(Pn,{}),mt(pt.FK,{children:e.icon}),mt("span",{children:e.value})]},"".concat(t).concat(e.value));var n,r}))]}),S&&mt("div",{className:"vm-autocomplete-message",children:["Shown ",null===f||void 0===f?void 0:f.limit," results out of ",E,". ",S]}),(null===(n=P[k.index])||void 0===n?void 0:n.description)&&mt("div",{className:"vm-autocomplete-info",children:[mt("div",{className:"vm-autocomplete-info__type",children:P[k.index].type}),mt("div",{className:"vm-autocomplete-info__description",dangerouslySetInnerHTML:{__html:P[k.index].description||""}})]})]})};var ga=n(267),va=n.n(ga);const ya=e=>e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&"),ba=e=>JSON.stringify(e).slice(1,-1),wa=e=>{const t=e.match(/["`']/g);return!!t&&t.length%2!==0};var ka=function(e){return e.metric="metric",e.label="label",e.labelValue="labelValue",e}(ka||{});const xa={[ka.metric]:mt(Hn,{}),[ka.label]:mt(Bn,{}),[ka.labelValue]:mt(Un,{})},Sa=n.p+"static/media/MetricsQL.a00044c91d9781cf8557.md",Aa=e=>{const t='$1 target="_blank" class="'.concat("vm-link vm-link_colored",'" $2').concat("https://docs.victoriametrics.com/MetricsQL.html","#");return e.replace(/({let t="";return Array.from(e).map((e=>{var n;const r="h3"===e.tagName.toLowerCase();return t=r?null!==(n=e.textContent)&&void 0!==n?n:"":t,r?null:((e,t)=>{var n;const r=null!==(n=t.textContent)&&void 0!==n?n:"",o=(e=>{const t=[];let n=e.nextElementSibling;for(;n&&"p"===n.tagName.toLowerCase();)n&&t.push(n),n=n.nextElementSibling;return t})(t).map((e=>{var t;return null!==(t=e.outerHTML)&&void 0!==t?t:""})).join("\n");return{type:e,value:r,description:Aa(o),icon:mt(Vn,{})}})(t,e)})).filter(Boolean)},Ca=()=>{const{metricsQLFunctions:e}=ln(),n=sn();return(0,t.useEffect)((()=>{e.length||(async()=>{try{const e=await fetch(Sa),t=(e=>{const t=document.createElement("div");t.innerHTML=ca(e);const n=t.querySelectorAll("".concat("h3",", ").concat("h4"));return Ea(n)})(await e.text());n({type:"SET_METRICSQL_FUNCTIONS",payload:t})}catch(zd){console.error("Error fetching or processing the MetricsQL.md file:",zd)}})()}),[]),e},Ma=e=>{let{value:n,anchorEl:r,caretPosition:a,hasHelperText:i,onSelect:l,onFoundOptions:s}=e;const[c,u]=(0,t.useState)({top:0,left:0}),d=Ca(),h=(0,t.useMemo)((()=>{if(a[0]!==a[1])return{beforeCursor:n,afterCursor:""};return{beforeCursor:n.substring(0,a[0]),afterCursor:n.substring(a[1])}}),[n,a]),p=(0,t.useMemo)((()=>{const e=h.beforeCursor.split(/\s(or|and|unless|default|ifnot|if|group_left|group_right)\s|}|\+|\|-|\*|\/|\^/i);return e[e.length-1]}),[h]),f=(0,t.useMemo)((()=>{const e=[...p.matchAll(/\w+\((?
'+(a?i:ii(i,!0))+"
\n":""+(a?i:ii(i,!0))+"
\n"}blockquote(e){let{tokens:t}=e;const n=this.parser.parse(t);return"\n".concat(n,"\n")}html(e){let{text:t}=e;return t}heading(e){let{tokens:t,depth:n}=e;return"
".concat(this.parser.parseInline(t),"
\n")}table(e){let t="",n="";for(let a=0;a".concat(t,"
")}br(e){return"An error occurred:
"+ii(n.message+"",!0)+"";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function rl(e,t){return nl.parse(e,t)}rl.options=rl.setOptions=function(e){return nl.setOptions(e),rl.defaults=nl.defaults,Xo(rl.defaults),rl},rl.getDefaults=Go,rl.defaults=Jo,rl.use=function(){return nl.use(...arguments),rl.defaults=nl.defaults,Xo(rl.defaults),rl},rl.walkTokens=function(e,t){return nl.walkTokens(e,t)},rl.parseInline=nl.parseInline,rl.Parser=el,rl.parser=el.parse,rl.Renderer=Ji,rl.TextRenderer=Xi,rl.Lexer=Gi,rl.lexer=Gi.lex,rl.Tokenizer=pi,rl.Hooks=tl,rl.parse=rl;rl.options,rl.setOptions,rl.use,rl.walkTokens,rl.parseInline,el.parse,Gi.lex;const al=n.p+"static/media/MetricsQL.a00044c91d9781cf8557.md",ol=e=>{const t='$1 target="_blank" class="'.concat("vm-link vm-link_colored",'" $2').concat("https://docs.victoriametrics.com/MetricsQL.html","#");return e.replace(/({let t="";return Array.from(e).map((e=>{var n;const r="h3"===e.tagName.toLowerCase();return t=r?null!==(n=e.textContent)&&void 0!==n?n:"":t,r?null:((e,t)=>{var n;const r=null!==(n=t.textContent)&&void 0!==n?n:"",a=(e=>{const t=[];let n=e.nextElementSibling;for(;n&&"p"===n.tagName.toLowerCase();)n&&t.push(n),n=n.nextElementSibling;return t})(t).map((e=>{var t;return null!==(t=e.outerHTML)&&void 0!==t?t:""})).join("\n");return{type:e,value:r,description:ol(a),icon:Nt(gr,{})}})(t,e)})).filter(Boolean)},ll=()=>{const{metricsQLFunctions:e}=Cn(),t=En();return(0,r.useEffect)((()=>{e.length||(async()=>{try{const e=await fetch(al),n=(e=>{const t=document.createElement("div");t.innerHTML=rl(e);const n=t.querySelectorAll("".concat("h3",", ").concat("h4"));return il(n)})(await e.text());t({type:"SET_METRICSQL_FUNCTIONS",payload:n})}catch(Lp){console.error("Error fetching or processing the MetricsQL.md file:",Lp)}})()}),[]),e},sl=e=>{let{value:t,anchorEl:n,caretPosition:a,hasHelperText:i,onSelect:l,onFoundOptions:s}=e;const[c,u]=(0,r.useState)({top:0,left:0}),d=ll(),h=(0,r.useMemo)((()=>{if(a[0]!==a[1])return{beforeCursor:t,afterCursor:""};return{beforeCursor:t.substring(0,a[0]),afterCursor:t.substring(a[1])}}),[t,a]),m=(0,r.useMemo)((()=>{const e=h.beforeCursor.split(/\s(or|and|unless|default|ifnot|if|group_left|group_right)\s|}|\+|\|-|\*|\/|\^/i);return e[e.length-1]}),[h]),p=(0,r.useMemo)((()=>{const e=[...m.matchAll(/\w+\((?