summaryrefslogtreecommitdiffstats
path: root/web/gui/v2/324.4fc60bcaa065dab2898f.chunk.js
blob: 406e8574e5f99fa66bfa02265c4f48eb61fb0aa1 (plain)
1
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="12692396-4134-4763-9df4-2b214c6d38b6",e._sentryDebugIdIdentifier="sentry-dbid-12692396-4134-4763-9df4-2b214c6d38b6")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"d3c83511ea495cef1d9f8179d5492b454e88bcc8"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[324],{80959:function(e,t,n){var r=n(87462),a=n(45987),o=n(67294),l=n(15557),i=["message","title","footer"];t.Z=function(e){var t=e.message,n=e.title,c=e.footer,u=(0,a.Z)(e,i),s=(null===u||void 0===u?void 0:u["data-testid"])||"functionError";return o.createElement(l.Flex,(0,r.Z)({alignItems:"center",column:!0,"data-testid":s,flex:!0,gap:3,justifyContent:"center",padding:[0,20]},u),o.createElement(l.H3,{"data-testid":"".concat(s,"-title")},n),o.createElement(l.TextBig,{color:"textDescription","data-testid":"".concat(s,"-message")},t),c)}},34324:function(e,t,n){n.r(t),n.d(t,{default:function(){return vr}});var r={};n.r(r),n.d(r,{base:function(){return yn},table:function(){return bn}});var a=n(29439),o=n(67294),l=n(91268),i=n(96929),c=n(3322),u=(n(82526),n(57327),n(41539),n(88449),n(2490),n(59849),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070),n(4942)),s=(n(47941),n(21249),n(57640),n(9924),n(60677)),d=n(15557),m=n(54316),f=n(46667),p=n(82351),v=n(29814),g=n(72843),b=n(37518),y=n(87462),h=(n(85827),n(25387),n(72608),n(69826),n(31672),n(59461),n(97193)),E=n(8144);function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var w=function(e){var t=e.roomId,n=e.flavour,r=e.availableFns,a=function(e){var t="fn"===e;return(0,o.useMemo)((function(){return{Live:{head:{label:"Live nodes",textColor:"textLite",iconName:"connectivityStatusLive",hasFn:t},node:{textColor:"text",showFn:t,requireFn:t}},Stale:{head:{label:"Stale nodes",textColor:"textLite",iconName:"connectivityStatusStale"},node:{textColor:"text",disabled:t}},Offline:{head:{label:"Offline nodes",textColor:"textLite",iconName:"connectivityStatusOffline",disabled:t},node:{textColor:"textLite",disabled:t}}}}),[e])}(n),l=function(e){var t=(0,c.ZQ)({extraKey:e}).aggregations;return(0,o.useMemo)((function(){return null!==t&&void 0!==t&&t.node_ids?t.node_ids.buckets.reduce((function(e,t){return O(O({},e),{},(0,u.Z)({},t.key,t.hits.doc_count))}),{}):null}),[t])}(n),i="fn"===n,s=(0,c.CE)({extraKey:n}),d=(0,o.useMemo)((function(){var e;return Array.isArray(r)&&(null===(e=r.find((function(e){return e.name===s})))||void 0===e?void 0:e.nodes)||{}}),[s,r]),m=(0,o.useCallback)((function(e){return!!d&&!d[e]}),[d]),f=(0,o.useCallback)((function(){return Object.keys(d)}),[d]);return o.createElement(E.Z,{title:"Nodes",testIdPrefix:"nodes",baseKey:t,extraKey:n,param:"selectedNodeIds",multi:"feed"===n},o.createElement(h.Z,(0,y.Z)({key:n,baseKey:t,extraKey:n,statusProps:a,background:"mainBackground",itemProps:{padding:[1,1,1,.5],maxLength:30},searchMargin:[0,0,2],height:{max:"300px"},multi:"feed"===n,nodeCounts:l},i&&{useFilteredIds:f},{checkIsDisabled:m})))},S=n(46742),C=function(e){return e.name},Z=function(e){var t=e.param,n=e.baseKey,r=e.extraKey,a=e.testIdPrefix,l=e.title,i=e.items,c=void 0===i?[]:i,u=e.multi,s=void 0!==u&&u;return c.length?o.createElement(E.Z,{title:l,testIdPrefix:a,baseKey:n,extraKey:r,param:t,multi:s},o.createElement(S.ZP,{param:t,baseKey:n,extraKey:r,testIdPrefix:a,collection:c,multi:s,getValue:C,getLabel:C})):null},j=n(93433),k=(n(92222),{none:!0,facet:!0}),P=function(e,t){var n=(0,c.ZQ)({extraKey:e}),r=n.loaded,a=n.loading,l=n.columns,i=n.sortedColumns,u=(0,o.useRef)([]);return(0,o.useMemo)((function(){return!r||a||(u.current=i.reduce((function(e,n){return!l[n].filter||k[l[n].filter]?e:[].concat((0,j.Z)(e),[t(n,l)])}),[])),u.current}),[r,a])},I=n(95248),T=n(71002),D=(n(64211),n(41874),n(69720),n(26699),n(32023),n(54678),n(4480));function F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var N={query:function(e,t,n){var r=n.columnVisibility,o=(null===t||void 0===t?void 0:t.toLowerCase())||"";return Object.entries(e).some((function(e){var t=(0,a.Z)(e,2),n=t[0],l=t[1];return!!r[n]&&(null!==l&&"undefined"!==typeof l&&(Array.isArray(l)?l.some((function(e){return String(e).toLowerCase().includes(o)})):("object"===(0,T.Z)(l)&&Object.keys(l).some((function(e){return String(l[e]).toLowerCase().includes(o)})),String(l).toLowerCase().includes(o))))}))}},z=function(e){return function(t,n){return!e.some((function(e){var r=(0,a.Z)(e,2),o=r[0],l=r[1];return N[o]?!N[o](t,l,n):!function(e){return function(t,n,r){var a;if("range"===(null===(a=r.columns[e])||void 0===a?void 0:a.filter)&&null!==n&&void 0!==n&&n.length)return t[e]>=n[0]&&t[e]<=n[1];if(!Array.isArray(n)||!n.length)return!0;var o=t[e];return"number"===typeof o?(o=parseFloat(o),n.some((function(e){return parseFloat(e)===o}))):n.includes(o)}}(o)(t,l,n)}))}},A=(0,D.CG)({key:"fnDataFiltered",get:function(e){var t=e.extraKey,n=e.roomId,r=e.omit,a=void 0===r?[]:r,o=e.keepAll,l=e.fn;return function(e){var r,i=e.get,u=null===(r=i((0,I.dz)({key:n,extraKey:"".concat(l,"Settings")})))||void 0===r?void 0:r.sortColumn,s=i((0,I.dz)({key:n,extraKey:t})),d=Object.keys(s).reduce((function(e,t){return a.includes(t)||e.push([t,s[t]]),e}),[]),m=i((0,c.tD)({id:l})),f=m.columnVisibility,p=m.data,v=m.columns;if(m.aggregations||!d.length||!p)return p||[];var g=z(d);return o?p.map((function(e){return g(e,{columnVisibility:f,columns:v,sortColumn:u})?e:K(K({},e),{},{hidden:!0})})):p.filter((function(e){return g(e,{columnVisibility:f,columns:v,sortColumn:u})}))}},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extraKey,n=void 0===t?"fn":t,r=e.omit,a=void 0===r?[]:r,o=e.keepAll,l=void 0!==o&&o,i=(0,c.CE)({extraKey:n}),u=(0,b.UL)();return(0,D.sJ)(A({extraKey:"".concat(i||n,"Filters"),fn:i,roomId:u,omit:a,keepAll:l}))},R=(n(2707),n(6557)),M=function(e){return e.id},B={string:function(e,t){return e.localeCompare(t,void 0,{sensitivity:"accent"})},integer:function(e,t){return e-t}},_={table:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.param,r=t.columns;return Object.entries(e.reduce((function(e,t){var a,o;return e[t[n]]={count:((null===(a=e[t[n]])||void 0===a?void 0:a.count)||0)+(t.hidden?0:1),type:null===(o=r[n])||void 0===o?void 0:o.type},e}),{})).map((function(e){var t=(0,a.Z)(e,2),n=t[0],r=t[1];return{id:n,type:r.type,count:r.count}})).sort((function(e,t){return(B[e.type]||B.integer)(e.id,t.id)}))},default:n.n(R)()},V=function(e,t){return{key:e,type:t[e].filter}},U={multiselect:function(e){var t=e.param,n=e.baseKey,r=e.extraKey,a=e.filtersKey,l=e.testIdPrefix,i=e.title,u=function(e){var t=e.extraKey,n=e.filtersKey,r=e.param,a=L({extraKey:t,omit:[r],keepAll:!0}),l=(0,I.tk)(r,{extraKey:n}),i=(0,c.ZQ)({key:"type",extraKey:t}),u=_[i]||_.default,s=(0,c.ZQ)({key:"columns",extraKey:t});return(0,o.useMemo)((function(){return u(a,{param:r,columns:s})}),[r,a,l])}({param:t,extraKey:r,filtersKey:a});return u&&u.length?o.createElement(E.Z,{title:i,testIdPrefix:l,baseKey:n,extraKey:a,param:t,defaultIsOpen:!1},o.createElement(S.ZP,{param:t,baseKey:n,extraKey:a,testIdPrefix:l,collection:u,capitalized:!1,getValue:M,getLabel:M})):null},range:function(e){var t=e.param,n=e.baseKey,r=e.extraKey,l=e.filtersKey,i=e.testIdPrefix,u=e.title,s=(0,c.ZQ)({extraKey:r}).columns,m=(0,I.I0)(t,{defaultValue:[],key:n,extraKey:l}),f=(0,a.Z)(m,2),p=f[0],v=f[1];if(!s[t])return null;var g=1*s[t].range.min,b=1*s[t].range.max;return o.createElement(E.Z,{title:u,testIdPrefix:i,baseKey:n,extraKey:l,param:t,defaultIsOpen:!1},o.createElement(d.Box,{padding:[2,0],width:"100%"},o.createElement(d.MultiRangeInput,{min:g,max:b,onChange:function(e){var t=e.min,n=e.max;return v([t,n])},initMin:p[0]?1*p[0]:g,initMax:p[1]?1*p[1]:b})))}},W=function(e){var t=e.roomId,n=e.extraKey,r=(0,c.CE)({extraKey:n}),a=function(e){return P(e,V)}(n);return a.map((function(e){var a=U[e.type]||U.multiselect;return o.createElement(a,{key:e.key,title:e.key,testIdPrefix:"function",baseKey:t,extraKey:n,filtersKey:"".concat(r||n,"Filters"),param:e.key})}))},H=function(e){return e.name||e.id},Q=function(e){return e.id},q=function(e){var t=e.title,n=e.options,r=e.param,a=e.baseKey,l=e.filtersKey,i=e.testIdPrefix;return null!==n&&void 0!==n&&n.length?o.createElement(E.Z,{title:t,testIdPrefix:i,baseKey:a,extraKey:l,param:r,defaultIsOpen:!1},o.createElement(S.ZP,{param:r,baseKey:a,extraKey:l,testIdPrefix:i,collection:n,capitalized:!1,getValue:Q,getLabel:H})):null},G={nodes:!0},X=function(e){var t=e.roomId,n=e.extraKey,r=(0,c.CE)({extraKey:n}),a=(0,c.Cf)(n);return a.length?a.map((function(e){return G[e.id]?null:o.createElement(q,{key:e.id,title:e.name,options:e.options,param:e.id,testIdPrefix:"function",baseKey:t,filtersKey:"".concat(r||n,"Filters")})})):null},J=(0,o.memo)((function(e){var t=e.flavour,n=e.refetch,r=e.availableFns,a=(0,b.UL)(),l=(0,c.ZQ)({extraKey:t}),i=l.loaded,u=l.aggregations,s=l.error;return o.createElement(d.Flex,{column:!0,overflow:{vertical:"auto"},padding:[0,3,30]},"fn"===t&&o.createElement(Z,{title:"Function",testIdPrefix:"function",baseKey:a,extraKey:t,param:"selected",items:r}),o.createElement(w,{roomId:a,flavour:t,availableFns:r}),i&&!u&&!s&&o.createElement(W,{roomId:a,extraKey:t}),i&&u&&!s&&o.createElement(X,{roomId:a,extraKey:t,onFilter:n}))})),Y=n(45987),$=(n(38862),n(32586)),ee=n(76184),te=n(52428),ne=["selectedRowData","setSelectedRowData"],re=function(e){var t=e.data;return o.createElement(ee.Z,{name:"Files"},o.createElement(d.Flex,{gap:1,padding:[0,1],alignItems:"center"},o.createElement(d.Box,{sx:{fontWeight:"500",letterSpacing:"1px"},as:d.Text,color:"textLite"},"{;}"),o.createElement(d.TextSmall,null,"Copy data as"),o.createElement(d.Flex,{cursor:"pointer",gap:1,onClick:(0,te.J)(JSON.stringify(t),{text:"JSON copied to clipboard"})},o.createElement(d.TextSmall,{color:"primary"},"json"),o.createElement(d.Icon,{color:"primary",size:"small",name:"copy"}))))},ae=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.data,r=void 0===n?{}:n,o=t.columns,l=void 0===o?{}:o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],c=arguments.length>2?arguments[2]:void 0;return Object.entries(r).reduce((function(t,n){var r,o=(0,a.Z)(n,2),i=o[0],u=o[1],s=c?"".concat(c,".").concat(i):(null===(r=l[i])||void 0===r?void 0:r.displayName)||i,d=Array.isArray(u);return d&&"object"===(0,T.Z)(u[0])&&null!==u[0]||d&&u.length>1?t.push([s,JSON.stringify(u)]):u&&"object"===(0,T.Z)(u)?e({data:u},t,s):t.push([s,d?u.length>1?"[".concat(u.join(", "),"]"):u[0]:u]),t}),i)},oe=function(e){var t=e.selectedRowData,n=void 0===t?{}:t,r=e.setSelectedRowData,l=(0,Y.Z)(e,ne),i=(0,o.useMemo)((function(){return ae(n).sort((function(e,t){var n=(0,a.Z)(e,1)[0],r=(0,a.Z)(t,1)[0];return n.localeCompare(r)}))}),[n]);return o.createElement(d.Flex,(0,y.Z)({column:!0,gap:2,overflow:{vertical:"auto"},padding:[2,3]},l),o.createElement(d.Flex,{justifyContent:"between",padding:[2,0],border:{side:"bottom",color:"borderSecondary"}},o.createElement(d.TextBig,{strong:!0},"Row info"),i.length>0&&o.createElement(d.Box,{onClick:function(){return r()},cursor:"pointer"},o.createElement(d.TextSmall,{color:"primary"},"Clear selection"))),Array.isArray(i)&&i.length?o.createElement(o.Fragment,null,i.map((function(e){var t=(0,a.Z)(e,2),n=t[0],r=t[1];return o.createElement($.Z,{key:n,size:"small",name:n,testId:"rightBar-rowInfoContent-".concat(n),padding:[1,0,0]},r)})),o.createElement(re,{data:n})):o.createElement(d.Text,null,"Select a row to see raw data"))};function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?le(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ce={color:{active:"success",notActive:"textLite"}},ue={filters:ie(ie({iconName:"filterList"},ce),{},{width:"19px",Content:J,dataTestId:"fnFilters",label:"Filters"}),info:ie(ie({iconName:"information"},ce),{},{width:"19px",dataTestId:"info",Content:oe,label:"Info"})},se=Object.keys(ue),de=(0,s.default)(d.Tabs).withConfig({displayName:"sidebar__StyledTabs",componentId:"sc-1x1ez62-0"})(["overflow:hidden;height:100%;"]),me=function(e){var t=e.isActive,n=e.color,r=e.name,a=e.label;return o.createElement(p.Z,{plain:!0,content:a},o.createElement(d.Icon,{name:r,color:t?n.active:n.notActive,height:"18px",width:"18px"}))},fe=function(e){var t=(0,f.Z)(!0),n=(0,a.Z)(t,3),r=n[0],l=n[1],i=n[2],c=(0,o.useState)(0),u=(0,a.Z)(c,2),s=u[0],p=u[1];return(0,o.useEffect)((function(){e.selectedRowData&&(p(1),i())}),[e.selectedRowData]),o.createElement(m.ZP,{collapsedComponent:o.createElement(v.Z,{availableTabs:ue,onClickTab:l,tabsToShow:se}),header:o.createElement(g.Z,{icon:"filterList",isOpen:r,onToggle:l,title:"Filters"}),isOpen:r},o.createElement(d.Flex,{"data-testid":"overview-info",column:!0,overflow:"hidden",height:"100%"},o.createElement(de,{selected:s,onChange:p,noDefaultBorder:!0},se.map((function(t,n){var r=ue[t],a=r.iconName,l=r.color,i=r.Content,c=r.dataTestId,u=r.label;return o.createElement(d.Tab,{style:{display:1===se.length?"none":"inherit"},"data-testid":c,maxWidth:"100%",key:a,small:!0,label:o.createElement(me,{isActive:s===n,name:a,color:l,label:u})},o.createElement(d.Flex,{column:!0,overflow:"hidden",height:"calc(100% - 60px)",position:"relative"},o.createElement(i,e)))})))))},pe=n(36560),ve=n(78266),ge=(n(41817),n(97945)),be=n(74059),ye=n(49254),he=n(89250),Ee=function(e){var t=(0,I.XT)(e),n=(0,he.TH)().state;return(0,o.useEffect)((function(){null!==n&&void 0!==n&&n.nodeId&&t([n.nodeId])}),[]),null===n||void 0===n?void 0:n.nodeId},xe=n(91008),Oe=n(80959),we=["paramsKey"],Se=function(e){var t=e.paramsKey,n=(0,Y.Z)(e,we),r=(null===n||void 0===n?void 0:n["data-testid"])||"capableNodesError",a=(0,I.c6)(t),l=(0,ge.bV)(null===a||void 0===a?void 0:a[0],"name");return o.createElement(d.Flex,(0,y.Z)({alignItems:"center",flex:!0,gap:8,justifyContent:"center"},n,{"data-testid":r}),o.createElement(d.Icon,{"data-testid":"".concat(r,"-icon"),height:"230px",name:"unreachableNode",width:"230px"}),o.createElement(Oe.Z,{"data-testid":"".concat(r,"-details"),gap:2,title:l?"".concat(l," is not configured for Functions"):"Your nodes are not configured for Functions",message:o.createElement(o.Fragment,null,"Learn how to configure your nodes"," ",o.createElement(xe.Z,{Component:d.TextBig,"data-ga":"functions-capable-nodes-error::click-docs-link::functions-view","data-testid":"".concat(r,"-docsLink"),href:"https://learn.netdata.cloud/docs/nightly/operations/run-time-troubleshooting-with-functions#prerequisites",target:"_blank",rel:"noopener noreferrer"},"to support functions")),width:{max:"fit-content"}}))},Ce=n(64599),Ze=n(70842),je=n(39469),ke=n(36657),Pe=n(91128),Ie=n(62554),Te=(0,s.default)(d.Flex).attrs({alignItems:"center",border:{side:"bottom",color:"borderSecondary"},padding:[2]}).withConfig({displayName:"styled__MenuItem",componentId:"sc-fmyuo7-0"})(["&:last-child{border:none;}"]),De=(0,s.default)(d.TextInput).withConfig({displayName:"styled__TextInput",componentId:"sc-fmyuo7-1"})(['margin:0 10px;min-width:unset;width:45px;> div{margin:0;}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}input[type="number"]{-moz-appearance:textfield;}']),Fe=["onClose","targetRef","paramsKey"];function Ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ke(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ze=function(e){var t=e.onClose,n=e.targetRef,r=e.paramsKey,l=(0,Y.Z)(e,Fe),i=(null===l||void 0===l?void 0:l["data-testid"])||"refreshOptions",u=(0,c.ZQ)(Ne({key:"updateEvery"},r)),s=(0,c.WO)(r),m=(0,a.Z)(s,2),p=m[0],v=m[1],g=(0,f.Z)(p),b=(0,a.Z)(g,2),y=b[0],h=b[1];(0,Ie.Z)((function(){!!p!==!!y&&v(y)}),200,[p,y]);var E=(0,c.FF)(Ne(Ne({},r),{},{defaultValue:u})),x=(0,a.Z)(E,2),O=x[0],w=x[1],S=(0,o.useState)(O),C=(0,a.Z)(S,2),Z=C[0],j=C[1];return(0,Ie.Z)((function(){O!==Z&&w(Z)}),400,[O,Z]),n.current?o.createElement(d.Drop,{align:{top:"bottom",right:"right"},animation:!0,background:"dropdown",close:t,column:!0,"data-testid":i,margin:[.5,0,0],onClickOutside:t,onEsc:t,round:1,target:n.current,width:58},o.createElement(Te,{"data-testid":"".concat(i,"-autoRefresh"),justifyContent:"between"},o.createElement(d.Text,{color:"menuItem","data-testid":"".concat(i,"-autoRefresh-label")},"Auto Refresh"),o.createElement(d.Toggle,{colored:!0,checked:y,"data-ga":"functions-refresh-options::auto-refresh-switch::functions-view::".concat(y?"enabled":"disabled"),"data-testid":"".concat(i,"-autoRefresh-switch"),onChange:h})),o.createElement(Te,{"data-testid":"".concat(i,"-pollingInterval")},o.createElement(d.Text,{color:"menuItem","data-testid":"".concat(i,"-pollingInterval-label")},"Refresh every"),o.createElement(De,{"data-ga":"functions-refresh-options::polling-interval::functions-view","data-testid":"".concat(i,"-pollingInterval-input"),min:1,onChange:function(e){var t=+e.target.value;t>0&&j(t)},size:"tiny",type:"number",value:Z}),o.createElement(d.Text,{color:"menuItem","data-testid":"".concat(i,"-pollingInterval-units")},"seconds"))):null},Ae=n(89405),Le=function(e){var t=e.paramsKey,n=(0,c.ZQ)(t).updatedAt,r=(0,Ae.rA)(),a=r.localeTimeString,l=r.localeDateString;return o.createElement(d.TextMicro,{color:"textLite"},"Last updated: ",l(n,{long:!0})," ",a(n,{secs:!0}))},Re=s.default.div.withConfig({displayName:"reload__IconsContainer",componentId:"sc-1nbamjz-0"})(["position:relative;"]),Me=(0,s.default)(d.Icon).withConfig({displayName:"reload__SmallIcon",componentId:"sc-1nbamjz-1"})(["position:absolute;top:3px;left:3px;"]),Be=function(e){var t=e.onRefresh,n=e.dataGa,r=e.testId,a=e.paramsKey,l=(0,c.T2)(a);return o.createElement(Re,null,o.createElement(Me,{name:l?"playSolid":"pauseSolid",width:"8px",height:"8px",color:l?"primary":"text"}),o.createElement(d.IconButton,{"data-testid":"".concat(r,"-refreshNowBtn"),"data-ga":"".concat(n,"::click-refresh-now::functions-view"),flavour:"hollow",icon:"refresh",onClick:function(){return t({merge:!1})},disabled:l}))},_e=["onRefresh","paramsKey"],Ve={fn:{dataGa:"functions-header",hasAutoRefresh:!0,Title:function(e){var t=e.name,n=e.fn,r=void 0===n?"Processes":n;return t?"".concat(r," on ").concat(t):r},TextContent:function(e){var t=e.testId;return o.createElement(o.Fragment,null,"Netdata Functions enable detailed low-level monitoring at the edge. Use this tab to execute functions on your node and see the results immediately."," ",o.createElement(xe.Z,{Component:d.Text,"data-ga":"functions-header::click-docs-link::functions-view","data-testid":"".concat(t,"-docsLink"),href:"https://learn.netdata.cloud/docs/nightly/concepts/netdata-functions",target:"_blank",rel:"noopener noreferrer"},"Read the Netdata functions documentation to learn more"),".")}},feed:{dataGa:"feed-header",Title:function(){return"Events"},TextContent:function(e){var t=e.testId;return o.createElement(o.Fragment,null,"Troubleshoot faster with Netdata Events. Access topology and alert events across the war room in one convenient location."," ",o.createElement(xe.Z,{Component:d.Text,"data-ga":"feed-header::click-docs-link::feed-view","data-testid":"".concat(t,"-docsLink"),href:"https://learn.netdata.cloud/docs/nightly/concepts/events-feed",target:"_blank",rel:"noopener noreferrer"},"Read the Events feed documentation to learn more"),".")}}},Ue=(0,o.memo)((function(e){var t=e.onRefresh,n=e.paramsKey,r=(0,Y.Z)(e,_e),l=(null===r||void 0===r?void 0:r["data-testid"])||"functionsHeader",i=(0,o.useRef)(),u=Ve[n.extraKey],s=u.dataGa,m=u.hasAutoRefresh,p=u.TextContent,v=u.Title,g=(0,f.Z)(!1),b=(0,a.Z)(g,4),y=b[0],h=b[1],E=b[3],x=(0,I.c6)(n),O=(0,ge.bV)(null===x||void 0===x?void 0:x[0],"name"),w=(0,c.ZQ)(n),S=w.loaded,C=w.data,Z=w.totalSize,j=(0,c.CE)(n);return o.createElement(d.Flex,{"data-testid":l,justifyContent:"between",margin:[0,0,3]},o.createElement(d.Flex,{column:!0,gap:2,"data-testid":"".concat(l,"-info"),width:{max:164}},o.createElement(d.Flex,{gap:2,alignItems:"baseline"},o.createElement(d.H1,{"data-testid":"".concat(l,"-title")},o.createElement(v,{name:O,fn:j})),S&&o.createElement(d.TextSmall,{color:"textLite",strong:!0},"(",Z||(null===C||void 0===C?void 0:C.length)||0," results)")),o.createElement(d.Flex,{column:!0,gap:2},o.createElement(d.Text,{"data-testid":"".concat(l,"-description"),color:"textLite"},o.createElement(p,{testId:l})))),o.createElement(d.Flex,{alignItems:"end",column:!0,gap:1},o.createElement(d.Flex,{gap:1},o.createElement(Be,{testId:l,dataGa:s,onRefresh:t,paramsKey:n}),m&&o.createElement(d.IconButton,{"data-testid":"".concat(l,"-refreshOptionsBtn"),"data-ga":"".concat(s,"::click-refresh-options::functions-view"),flavour:"hollow",icon:"chevron_down",ref:i,onClick:h}),y&&o.createElement(ze,{"data-testid":"".concat(l,"-refreshOptions"),isOpen:y,onClose:E,targetRef:i,paramsKey:n})),o.createElement(Le,{paramsKey:n})))}),(function(e,t){return e.onRefresh===t.onRefresh})),We=n(41331),He=(n(88386),n(55436)),Qe=["icon","iconRotate","children","onClick","strong","testId","textAlign","wrap"],qe=["description","tooltipValue","value","valueOptions","wrap"],Ge=(0,s.default)(d.Icon).attrs({color:"text",height:"16px",width:"16px"}).withConfig({displayName:"value__Arrow",componentId:"sc-1ahoh2y-0"})(["rotate:",";transition:all 200ms ease;"],(function(e){return e.rotate})),Xe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.transform,r=t.decimalPoints,a=void 0===r?0:r,l=t.units,i=t.defaultValue,c=(0,He.Ol)();return(0,o.useMemo)((function(){switch(n){case"number":return(0,He.Jw)(e,{decimalPoints:a,units:l,defaultValue:i});case"duration":return(0,He.kl)(e,{defaultValue:i});case"datetime":return c(e,{defaultValue:i});case"datetime_usec":return c(e,{defaultValue:i,usec:!0});default:return null===e||"undefined"===typeof e?i:e}}),[e,l])},Je=function(e){var t=e.description,n=void 0===t?"":t,r=e.value,a=e.units,l=void 0===a?"":a;return n?o.createElement(d.Flex,{column:!0,gap:1,justifyContent:"center"},o.createElement(d.TextSmall,{color:"bright"},n),o.createElement(d.TextSmall,{strong:!0,color:"bright",textAlign:"center"},r," ",l)):"".concat(r," ").concat(l)},Ye=(0,o.forwardRef)((function(e,t){var n=e.icon,r=e.iconRotate,a=e.children,l=e.onClick,i=e.strong,c=e.testId,u=void 0===c?"cell":c,s=e.textAlign,m=e.wrap,f=(0,Y.Z)(e,Qe);return o.createElement(d.Flex,(0,y.Z)({cursor:l?"pointer":"inherit",gap:.5,onClick:l,overflow:"hidden",ref:t,width:{max:"100%"},flexWrap:!0},f),n&&o.createElement(Ge,{name:n,rotate:r}),o.createElement(d.TextSmall,{"data-testid":"".concat(u,"-value"),strong:i,textAlign:s,truncate:!m,whiteSpace:m?"wrap":"nowrap"},a))})),$e=function(e){var t=e.description,n=void 0===t?"":t,r=e.tooltipValue,a=e.value,l=e.valueOptions,i=void 0===l?{}:l,c=e.wrap,u=(0,Y.Z)(e,qe),s=Xe(a,i);return o.createElement(p.Z,(0,y.Z)({content:!c&&o.createElement(Je,{description:n,value:r||a,units:i.units}),"data-testid":"tableCell",isBasic:!0},u),o.createElement(Ye,{wrap:c},s))},et=["description","maxValue","strong","type","value","valueOptions","wrap"],tt=function(e){var t=e.description,n=void 0===t?"":t,r=e.maxValue,a=e.strong,l=e.type,i=e.value,c=e.valueOptions,u=void 0===c?{}:c,s=e.wrap,m=(0,Y.Z)(e,et),f=100*i/r,v="bar"===l,g=(null===m||void 0===m?void 0:m["data-testid"])||"progressTableCell",b=Xe(i,u);return o.createElement(p.Z,{content:o.createElement(Je,{description:n,value:i,units:u.units}),isBasic:!0,stretch:"align"},o.createElement(d.Flex,{column:!0,"data-testid":g,gap:1,flexWrap:s},!v&&o.createElement(Ye,{strong:a,testid:g},b),o.createElement(d.ProgressBar,{background:"sideBarMini",border:"none",color:["green","netdata"],containerWidth:"100%","data-testid":"".concat(g,"-bar"),height:2,width:"".concat(f,"%")})))},nt=["value","wrap"],rt=function(e){var t=e.value,n=e.wrap,r=(0,Y.Z)(e,nt);return t=Array.isArray(t)?t:[t],o.createElement(d.Flex,{alignItems:"center",gap:1,flexWrap:n},t.map((function(e,t){return o.createElement(d.Flex,(0,y.Z)({"data-testid":"tableCell",key:"".concat(e,"-").concat(t)},r),o.createElement(d.Pill,{flavour:"neutral",color:"neutralPillColor",size:"small"},e))})))},at=n(20686),ot=["color"],lt=function(e){var t=e.hide,n=e.user;return t||!n?null:o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"by"),o.createElement(it,null,n))},it=function(e){var t=e.color,n=void 0===t?"textDescription":t,r=(0,Y.Z)(e,ot);return o.createElement(d.TextSmall,(0,y.Z)({color:n,strong:!0},r))},ct=function(e){var t=e.type,n=e.text,r=void 0===n?t:n,a=e.hollow,l=a?"".concat(t.toLowerCase(),"AlertsTable"):t.toLowerCase();return o.createElement(at.Z,(0,y.Z)({type:l},a&&{border:!1}),r)},ut=(0,s.default)(d.Flex).attrs({gap:1,flexWrap:!0,alignItems:"center"}).withConfig({displayName:"components__Container",componentId:"sc-1qr6qv2-0"})([""]),st=n(79655),dt=["chart","hosts","alert"];function mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pt={CLEAR:0,WARNING:1,CRITICAL:2,UNINITIALIZED:3,UNDEFINED:4},vt=function(e){var t=e.chart,n=e.nodeId,r=e.nodeName,a=e.spaceSlug,l=e.roomSlug,i=e.alert,c=(0,he.s0)(),u=(0,ge.m3)(n),s=(0,o.useCallback)((function(){i?c(u,{state:{alertId:null===i||void 0===i?void 0:i.id}}):c(u)}),[u,i]),m="/spaces/".concat(a,"/rooms/").concat(l,"/alerts/").concat(null===i||void 0===i?void 0:i.id),f=i.current,v=i.name,g=i.previous;if("ERROR"===f.status)return o.createElement(ut,null,o.createElement(d.TextSmall,null,"For the alert"),o.createElement(xe.Z,{Component:it,as:st.rU,to:m},v),o.createElement(d.TextSmall,null,"for"),o.createElement(xe.Z,{Component:it,onClick:s},t.name),o.createElement(d.TextSmall,null,"on"),o.createElement(xe.Z,{Component:it,onClick:s},r),o.createElement(d.TextSmall,null,"we couldn't calculate the current value"),o.createElement(p.Z,{align:"bottom",content:"Please check your alert configuration"},o.createElement(d.Icon,{color:"nodeBadgeColor",size:"small",name:"information"})));if("REMOVED"===f.status)return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Alert"),o.createElement(xe.Z,{Component:it,as:st.rU,to:m},v),o.createElement(d.TextSmall,null,"for"),o.createElement(xe.Z,{Component:it,onClick:s},t.name),o.createElement(d.TextSmall,null,"on"),o.createElement(xe.Z,{Component:it,onClick:s},r),o.createElement(d.TextSmall,null,"is no longer available, state can't be assessed"));var b=pt[f.status]===pt.CLEAR;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Alert"),o.createElement(xe.Z,{Component:it,as:st.rU,to:m},v),o.createElement(d.TextSmall,null,"for"),o.createElement(xe.Z,{Component:it,onClick:s},t.name),o.createElement(d.TextSmall,null,"on"),o.createElement(xe.Z,{Component:it,onClick:s},r),b?o.createElement(d.TextSmall,null,"recovered"):o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,pt[g.status]===pt.CRITICAL?"was demoted":pt[g.status]===pt.WARNING?"escalated":pt[f.status]===pt.UNDEFINED?"transitioned":"was raised"),o.createElement(d.TextSmall,null,"to"),o.createElement(ct,{type:f.status}),pt[f.status]===pt.UNDEFINED&&o.createElement(d.TextSmall,null,"state")),o.createElement(d.TextSmall,null,"with value"),o.createElement(ct,{type:f.status,text:f.value_string,hollow:!0,padding:[0]}))},gt=function(e){var t=e.id,n=e.name,r=(0,be.uk)(),a=(0,b.tE)(t,"slug"),l="/spaces/".concat(r,"/rooms/").concat(a,"/home");return o.createElement(xe.Z,{Component:it,as:st.rU,to:l},n)},bt=function(e){var t=e.rooms;return t.map((function(e,n){return o.createElement(o.Fragment,{key:e.id},n>0&&(n<t.length-1?", ":" and "),o.createElement(gt,e))}))},yt=function(e){var t=e.rooms;if(!t.length)return null;var n=t.length>1?"rooms":"room";return o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"on ",n),o.createElement(bt,{rooms:t}))},ht=function(e){var t=e.contexts;t.map((function(e,n){return o.createElement(o.Fragment,{key:e},n>0&&(n<t.length-1?", ":" and "),o.createElement(it,null,e))}))},Et=function(e){var t=e.contexts;if(!t.length)return null;var n=t.length>1?"contexts":"context";return o.createElement(d.TextSmall,null,"on ",n," ",o.createElement(ht,{contexts:t}))},xt={month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0},Ot=function(e){var t=e.start,n=e.end,r=(0,Ae.rA)().localeDateString;if(!t||!n)return null;var a=r(new Date(t),xt),l=r(new Date(n),xt);return o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"(scheduled ",a," - ",l,")"))},wt={"silencing-rule-created":"created","silencing-rule-deleted":"deleted","silencing-rule-changed":"changed"},St=function(e){var t=e.rooms,n=void 0===t?[]:t,r=e.contexts,a=void 0===r?[]:r;return n.length||a.length?o.createElement(o.Fragment,null,!!n.length&&o.createElement(yt,{rooms:n}),!!n.length&&!!a.length&&o.createElement(d.TextSmall,null,"and ",o.createElement(Et,{contexts:a}))):null},Ct=function(e){var t,n=e.action,r=e.notification,a=e.user,l=e.room,i=e.context,c=((null===r||void 0===r||null===(t=r.silencing)||void 0===t?void 0:t.rule)||[])[0],u=null===a||void 0===a?void 0:a.name,s=(null===i||void 0===i?void 0:i.name)||[];return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Silencing rule"),o.createElement(it,null,c.name),o.createElement(St,{rooms:l,contexts:s}),o.createElement(d.TextSmall,null,"was ",wt[n]),o.createElement(lt,{user:u}),o.createElement(Ot,c))},Zt=n(62200),jt=function(e,t){var n,r;return(null===(n=e.target)||void 0===n?void 0:n[t])||(null===(r=e.target)||void 0===r?void 0:r.id)||e[t]||e.id},kt=function(e){return Array.isArray(e)?e[0].name||e[0].id:e.name||e.id},Pt=function(e){var t=e.statistics,n=(null===t||void 0===t?void 0:t.nodes)||{},r=n.live,a=n.stale,l=n.removed,i=n.total;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Space statistics. Nodes:"),o.createElement(d.TextSmall,{color:Zt.WV.live.statusTextSmallColor},r," live"),o.createElement(d.TextSmall,null,","),o.createElement(d.TextSmall,{color:Zt.WV.stale.statusTextSmallColor},a," stale"),o.createElement(d.TextSmall,null,","),o.createElement(d.TextSmall,{color:Zt.WV.offline.statusTextSmallColor},l," removed"),o.createElement(d.TextSmall,null,","),o.createElement(d.TextSmall,{strong:!0},i," total"))},It=(n(69810),n(86035),n(6973)),Tt=function(e){var t=e.stateColor,n=e.state;return o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"became"),o.createElement(it,{color:t},n))},Dt=function(e){var t=e.stateColor,n=e.state;return o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"was"),o.createElement(it,{color:t},n))},Ft={"node-created":Tt,"node-state-live":Tt,"node-state-stale":Tt,"node-state-offline":Tt,"node-removed":Dt,"node-deleted":Dt,"node-restored":Dt,default:Dt},Kt=function(e){var t,n=e.action,r=e.hosts,a=(void 0===r?[]:r)[0],l=a.id,i=a.name,c=(0,he.s0)(),u=(0,ge.m3)(l),s=(0,o.useCallback)((function(){return c(u)}),[u]),m=Ft[n],f=n.split("-").at(-1),p=null===(t=It.B[f])||void 0===t?void 0:t.statusTextSmallColor;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Node"),o.createElement(xe.Z,{Component:it,onClick:s},i),o.createElement(m,{stateColor:p,state:f}))},Nt=function(e){var t=e.room,n=(0,b.Hm)("untouchable");return o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"was added to",n?" room":""),o.createElement(it,null,n?kt(t):"this room"))},zt=function(e){var t=e.room,n=(0,b.Hm)("untouchable");return o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"was removed from",n?" room":""),o.createElement(it,null,n?kt(t):"this room"))},At={"room-created":function(){return o.createElement(d.TextSmall,null,"was created")},"room-deleted":function(){return o.createElement(d.TextSmall,null,"was deleted")},"room-node-added":Nt,"room-node-removed":zt,"room-user-added":Nt,"room-user-removed":zt},Lt=function(e){var t,n=e.action,r=e.hosts,a=void 0===r?[]:r,l=e.Netdata,i=e.user,c=At[n],u=null===(t=a[0])||void 0===t?void 0:t.name;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Node"),o.createElement(it,null,u),o.createElement(c,{room:l.room}),o.createElement(lt,{user:null===i||void 0===i?void 0:i.name}))},Rt=function(e){var t=e.action,n=e.Netdata,r=e.user,a=At[t];return o.createElement(ut,null,o.createElement(d.TextSmall,null,"User"),o.createElement(it,null,jt(r,"name")),o.createElement(a,{room:n.room}),o.createElement(lt,{hide:!r.target,user:r.name}))},Mt=function(e){var t=e.action,n=e.Netdata,r=e.user,a=At[t];return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Room"),o.createElement(it,null,kt(n.room)),o.createElement(a,null),o.createElement(lt,{user:r.name}))},Bt={"alert-node-transition":function(e){var t=e.chart,n=e.hosts,r=e.alert,a=(0,Y.Z)(e,dt);return n.map((function(e,n){var l=e.id,i=e.name,c=ft(ft({},r),{},{name:r.name[n]},r.current?{current:ft(ft({},r.current),r.current.status?{status:r.current.status[n]||r.current.status[0]}:{})}:{});return o.createElement(vt,(0,y.Z)({key:l,chart:t,nodeId:l,nodeName:i,alert:c},a))}))},"node-created":Kt,"node-state-live":Kt,"node-state-stale":Kt,"node-state-offline":Kt,"node-removed":Kt,"node-deleted":Kt,"node-restored":Kt,"agent-connected":function(e){var t=e.agentId;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Agent with claim ID"),o.createElement(it,null,t)," ",o.createElement(d.TextSmall,null,"has connected to Netdata"))},"agent-disconnected":function(e){var t=e.agentId,n=e.reason;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Agent with claim ID"),o.createElement(it,null,t),o.createElement(d.TextSmall,null,"has disconnected from Netdata with reason: \u201c",n,"\u201d"))},"agent-authenticated":function(e){var t=e.agentId;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Agent with claim ID"),o.createElement(it,null,t),o.createElement(d.TextSmall,null,"has successfully authenticated"))},"agent-authentication-failed":function(e){var t=e.agentId;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Agent with claim ID"),o.createElement(it,null,t),o.createElement(d.TextSmall,null,"has failed to authenticate"))},"room-created":Mt,"room-deleted":Mt,"room-node-added":Lt,"room-node-removed":Lt,"room-user-added":Rt,"room-user-removed":Rt,"space-created":function(e){var t=e.Netdata,n=e.user;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"Space"),o.createElement(it,null,t.space.name||t.space.id),o.createElement(d.TextSmall,null,"was created"),o.createElement(lt,{user:n.name}))},"space-statistics":Pt,"space-user-added":function(e){var t=e.Netdata,n=e.user,r=((null===t||void 0===t?void 0:t.inviter)||{}).name;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"User"),o.createElement(it,null,jt(n,"name")),o.createElement(d.TextSmall,null,"was added to this space"),r&&o.createElement(o.Fragment,null,o.createElement(d.TextSmall,null,"by invite of"),o.createElement(it,null,r)))},"space-user-changed":function(e){var t,n=e.user;if(!(null===(t=n.changes)||void 0===t||!t.roles)&&1===Object.keys(n.changes).length){var r=n.changes.roles.length>1,a=n.changes.roles.join(", ");return o.createElement(ut,null,o.createElement(d.TextSmall,null,"User ",r?"roles":"role"," for"),o.createElement(it,null,jt(n,"name")),o.createElement(d.TextSmall,null,r?"were":"was"," changed to"),o.createElement(it,null,a),o.createElement(lt,{hide:!n.target,user:n.name}))}return o.createElement(ut,null,o.createElement(d.TextSmall,null,"User"),o.createElement(it,null,jt(n,"name")),o.createElement(d.TextSmall,null,"was modified"))},"space-user-invited":function(e){var t=e.user;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"User"),o.createElement(it,null,jt(t,"email")),o.createElement(d.TextSmall,null,"was invited to this space"),o.createElement(lt,{user:t.name}))},"space-user-removed":function(e){var t=e.user,n=(t.target||{}).name;return o.createElement(ut,null,o.createElement(d.TextSmall,null,"User"),o.createElement(it,null,jt(t,"name")),o.createElement(d.TextSmall,null,"was removed from this space"),n&&o.createElement(lt,{user:t.name}))},"space-user-uninvited":function(e){var t=e.event,n=e.user;return"space-invite-expired"===t.reason?o.createElement(ut,null,o.createElement(d.TextSmall,null,"The invite for"),o.createElement(it,null,jt(n,"email")),o.createElement(d.TextSmall,null,"to this space has expired")):o.createElement(ut,null,o.createElement(d.TextSmall,null,"User"),o.createElement(it,null,jt(n,"email")),o.createElement(d.TextSmall,null,"was uninvited from this space"),o.createElement(lt,{hide:!n.target,user:n.name}))},"silencing-rule-created":Ct,"silencing-rule-deleted":Ct,"silencing-rule-changed":Ct},_t=function(e){var t=e.data,n=t.source,r=n.action,a=n.roomId,l=n.space,i=(0,be.vu)(l.id,"slug"),c=(0,b.tE)(a,"slug"),u=Bt[r];return u?o.createElement(u,(0,y.Z)({},t.source,{spaceSlug:i,roomSlug:c})):o.createElement(ut,null,o.createElement(d.Text,null,"Event")," ",o.createElement(d.Text,{strong:!0},r)," ",o.createElement(d.Text,null,"emitted"))},Vt=["value"],Ut=["visualization","type","value"],Wt={bar:tt,"bar-with-integer":tt,duration:tt,pill:rt,number:$e,string:$e,feedTemplate:_t,datetime:function(e){var t=e.value,n=(0,Y.Z)(e,Vt),r=new Date(t),a=(0,Ae.rA)(),l=a.localeTimeString,i=a.localeDateString,c=isNaN(r.valueOf())?"Missing date & time":"".concat(i(r,{long:!1})," ").concat(l(r,{secs:!0}));return o.createElement($e,(0,y.Z)({value:c},n))},value:$e},Ht={bar:tt,pill:rt,value:$e,feedTemplate:_t},Qt=function(e){var t=e.visualization,n=e.type,r=e.value,a=(0,Y.Z)(e,Ut),l=Ht[t]||Wt[n]||Ht.value;return o.createElement(l,(0,y.Z)({value:r,type:n},a))},qt=["displayName","name","sortable","sticky","units","max","maxValue","dummy","cellSize","valueOptions","summary","type","visualization","wrap"];function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gt(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Jt={sum:"sum",min:"min",max:"max",extent:"extent",mean:"mean",median:"median",unique:"unique",uniqueCount:"uniqueCount",count:"count"};function Yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yt(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var en=(0,o.memo)(d.NetdataTable,(function(e,t){return(0,We.ZP)(e,t,{keep:["columnVisibility","data","fnQuery","sortBy","virtualizeOptions"]})})),tn={cellStyles:{height:"46px"},headStyles:{height:"44px"},styles:{verticalAlign:"middle"}},nn=(0,o.memo)((0,o.forwardRef)((function(e,t){var n=e["data-testid"],r=e.paramsKey,l=e.refetch,i=e.onShowInfo,u=(0,c.ZQ)(r),s=u.columns,m=u.sortedColumns,f=u.sortColumn,p=u.sortDirection,v=u.columnVisibility,g=u.pinnedColumns,y=u.loading,h=u.totalSize,E=u.anchor,x=u.retentionWarning,O=u.groupByColumns,w=(0,o.useState)(""),S=(0,a.Z)(w,2),C=S[0],Z=S[1],k=L(r),P="feed"===r.extraKey,T=function(e,t,n){var r=n.groupBy;return(0,o.useMemo)((function(){return e.reduce((function(e,n){var a=t[n],l=a.displayName,i=a.name,c=a.sortable,u=a.sticky,s=a.units,m=a.max,f=a.maxValue,p=a.dummy,v=a.cellSize,g=a.valueOptions,b=a.summary,y=a.type,h=a.visualization,E=a.wrap,x=void 0!==E&&E,O=(0,Y.Z)(a,qt);return p?e:[].concat((0,j.Z)(e),[Xt(Xt(Xt({},O),{},{id:l,accessorFn:function(e){return e[n]},cell:function(e){var t=e.getValue,n=e.row,a=e.cell.getIsAggregated(),l=t(),c=a&&(Jt[b]===Jt.count||Jt[b]===Jt.uniqueCount||!Jt[b]);return o.createElement(Qt,{description:i,data:n.original,maxValue:m||f.value,padding:n.depth>0?[0,0,0,2.5*n.depth]:[0],strong:a,value:c?"".concat(l,"x"):l,tooltipValue:c?"".concat(l," ").concat(1===l?"item":"items"," associated with ").concat(r," grouping"):l,valueOptions:c?Xt(Xt({},g),{},{transform:"none"}):g,type:y,visualization:h,wrap:x})},header:o.createElement(d.Flex,{column:!0},o.createElement(d.TextMicro,{strong:!0},l),s&&o.createElement(d.TextNano,null,"(",s,")")),enableSorting:c,aggregationFn:Jt[b]||Jt.count},v),{},{meta:Xt({biggestCellIndexPerColumn:null===f||void 0===f?void 0:f.index,sticky:u,styles:{verticalAlign:"middle"}},l!==i?{tooltip:i}:{})})])}),[])}),[t,r])}(m,s,$t({},P?{}:{groupBy:C})),D=(0,c.CE)(r),F=(0,b.UL)(),K=(0,c.fg)($t({key:"sortColumn"},r)),N=(0,a.Z)(K,2),z=N[0],A=N[1],R=(0,c.fg)($t({key:"sortDirection"},r)),M=(0,a.Z)(R,2),B=M[0],_=M[1],V=(0,c.kU)($t({key:"query"},r)),U=(0,a.Z)(V,2),W=U[0],H=U[1],Q=(0,c.I_)($t({key:"columnVisibility"},r)),q=(0,I.I0)(z,{defaultValue:[],key:F,extraKey:"".concat(D,"RangeFilter")}),G=(0,a.Z)(q,2)[1],X=(0,o.useMemo)((function(){return z||f?[{id:z||f,desc:"descending"===(B||p)}]:[]}),[f,p,z,B]),J=(0,o.useCallback)((function(e){var t=e(),n=(0,a.Z)(t,1)[0],r=(null===n||void 0===n?void 0:n.id)||r,o=null!==n&&void 0!==n&&n.desc?p||"descending":"ascending";A(r),_(o),z!==r&&G([])}),[z,G,f,p]),$=(0,o.useCallback)((function(e){Q((function(t){return $t($t({},t),e())}))}),[]),ee=(0,o.useMemo)((function(){return{left:g}}),[g]),te=(0,o.useMemo)((function(){return{overscan:10,hasNextPage:h>k.length,loading:y,loadMore:function(){y||h<=k.length||l({anchor:E,merge:!0})},warning:x}}),[k.length,y]),ne=(0,o.useCallback)((function(e){var t=e.data;return i({data:t.json||t,columns:s})}),[]);return o.createElement(en,{groupByColumns:O,onClickRow:ne,autoFixedColumns:!0,columnPinning:ee,columnVisibility:v,data:k,dataColumns:T,dataGa:"functions",enableColumnPinning:!!g.length,enableColumnVisibility:!P,enableCustomSearch:!P,enablePinning:!P&&!!g.length,enableResize:!0,enableSorting:!P,globalFilter:P?null:W,onColumnVisibilityChange:$,onGlobalSearchChange:P?null:H,onGroupByChange:P?null:Z,onSortingChange:P?null:J,sortBy:X,testPrefix:n,virtualizeOptions:te,meta:tn,ref:t})})),(function(){return!0})),rn=n(18997),an=n(4808),on=(n(26833),n(50361)),ln=n.n(on),cn=n(38609),un=n(81732),sn=n(85672),dn=["defaultSortColumn","updateEvery","merge","groupBy","showIds","pagination","items"],mn=["data","type","updateEvery"];function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var vn={minSize:sn.bb.xs,maxSize:sn.bb.xl},gn={bar:{size:sn.bb.xs},value:{minSize:sn.bb.sm,size:sn.bb.md},feedTemplate:{size:sn.bb.xxl,minSize:sn.bb.lg,maxSize:5e3},pill:{size:sn.bb.md,minSize:sn.bb.md}},bn=function(e,t,n){var r=t.defaultSortColumn,a=t.updateEvery,o=t.merge,l=t.groupBy,i=t.showIds,c=void 0===i||i,u=t.pagination,s=t.items,d=(0,Y.Z)(t,dn),m=ln()(o?(0,cn.Z)(n.columns,t.columns):t.columns),f={},p=Object.keys(m).reduce((function(e,t){var n=m[t],r=n.id,a=n.name,o=n.sticky,l=n.visible,i=n.index;return n.displayName=c?r||t:a,e.columnVisibility[n.displayName]=l,o&&e.pinnedColumns.push(n.displayName),n.valueOptions=n.valueOptions||{},n.cellSize=function(e,t){var n=e.visualization;return e.fullWidth?gn.feedTemplate:t?{minSize:sn.bb.xs,maxSize:sn.bb.md,size:sn.bb.xs}:pn(pn({},vn),gn[n]||gn.xs)}(pn(pn({},n),{},{visualization:n.visualization||n.type}),n.uniqueKey),"undefined"!==typeof i&&(f[i]=t),e}),{columnVisibility:{},pinnedColumns:[]}),v=t.data.map((function(e){return e.reduce((function(e,t,n){var r,a,o=f[n];if(!o)return e;var l=m[o],i=isNaN(t)?(null===t||void 0===t?void 0:t.length)||0:t;"flexTemplate"!==l.type&&(!l.maxValue||i>l.maxValue.value)&&(l.maxValue={index:n,value:i});var c=(null===l||void 0===l||null===(r=l.range)||void 0===r?void 0:r.min)||t,u=(null===l||void 0===l||null===(a=l.range)||void 0===a?void 0:a.max)||l.max||t;return l.range={min:c<t?c:t,max:u>t?u:t},e[o]=t,e}),{})})),g=o?(n.data||[]).concat(v):v,b=null!==u&&void 0!==u&&u.enabled&&u.column?{anchor:g[g.length-1][m[u.column].index]}:{};e(pn(pn(pn(pn(pn({},un.Zn.table),d),{},{groupByColumns:l,data:g,columns:o?(0,cn.Z)(n.columns,m):m,updatedAt:(new Date).getTime(),updateEvery:a,sortedColumns:Object.values(f),sortColumn:r,sortDirection:r?m[r].sort:"descending"},p),b),{},{totalSize:(null===s||void 0===s?void 0:s.matched)||g.length,loading:!1,loaded:!0}))},yn=function(e,t){var n=t.data,r=t.type,a=t.updateEvery,o=(0,Y.Z)(t,mn);e(pn(pn(pn({},un.Zn.default),o),{},{data:n,updateEvery:a,type:r,loading:!1,loaded:!0}))};function hn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function En(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hn(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var xn={default:{fetch:an.Ru,isEnabled:function(e){var t=e.nodeIds,n=e.fn;return!(null===t||void 0===t||!t.length)&&!!n}},feed:{fetch:an.bj,isEnabled:function(e){var t=e.roomId,n=e.fn;return!!t&&!!n}}},On=function(){var e=(0,I.by)(),t=e.after,n=e.before;return(0,o.useMemo)((function(){if(t>0)return[{after:t,before:n},t,n];var e=Date.now();return[{after:e+1e3*t,before:e},t,n]}),[t,n])},wn=n(92501),Sn=(n(47042),n(26495)),Cn=n(36337),Zn=n(19221),jn=n(23148),kn=(0,D.cn)({key:"feedChart",default:{navigation:"pan"}});function Pn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function In(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pn(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Tn=(0,D.CG)({key:"feedChartState",get:function(e){var t=e.key;return function(e){var n=(0,e.get)(kn);return t?n[t]:n}},set:function(e){var t=e.key;return function(e,n){(0,e.set)(kn,(function(e){return t?In(In({},e),{},(0,u.Z)({},t,n)):In(In({},e),n)}))}}}),Dn=function(e){return(0,D.sJ)(Tn({key:e}))},Fn=function(e){return(0,D.Zl)(Tn({key:e}))},Kn=(n(41203),["icon","hoverIndicator","padding"]);function Nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nn(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var An=(0,s.default)(d.Button).attrs((function(e){return{flavour:"borderless",iconColor:e.active?"textDescription":"border",iconSize:"small",padding:[.5],small:!0}})).withConfig({displayName:"styled__Button",componentId:"sc-8s0lqd-0"})(["&&{background-color:",";height:20px;width:20px;&:hover{background-color:",";.button-icon__color{fill:",";}}}"],(function(e){var t=e.theme;return e.active?(0,d.getColor)("borderSecondary")({theme:t}):"initial"}),(function(e){var t=e.theme;return(0,d.getColor)("borderSecondary")({theme:t})}),(function(e){var t=e.theme;return(0,d.getColor)("textDescription")({theme:t})})),Ln=(0,s.default)(d.Flex).attrs({padding:[.5],gap:1,round:!0,border:{side:"all",color:"borderSecondary"}}).withConfig({displayName:"styled__Container",componentId:"sc-8s0lqd-1"})(["position:absolute;top:18px;right:8px;background:",";&:hover{background:",";}"],(0,d.getRgbColor)("elementBackground",.5),(0,d.getColor)("elementBackground")),Rn=function(e){var t=e.active,n=e.disabled,r=e.defaultColor;return t?"textDescription":n?"disabled":void 0===r?"border":r},Mn=(s.default.button.attrs((function(e){var t=e.icon,n=e.hoverIndicator,r=void 0===n||n,a=e.padding,o=void 0===a?0:a,l=(0,Y.Z)(e,Kn);return zn(zn({},l),{},{children:t,active:l.active||l["aria-expanded"],hoverIndicator:r,padding:o})})).withConfig({displayName:"styled__StyledButton",componentId:"sc-8s0lqd-2"})(["border:initial;padding:",";height:fit-content;line-height:0;background:",";cursor:pointer;svg{fill:",";stroke:",";}"," &:hover{",";svg{fill:",";stroke:",";}}"],(function(e){return e.padding}),(function(e){var t=e.theme;return e.active?(0,d.getColor)("borderSecondary")({theme:t}):"initial"}),(function(e){var t=e.active,n=e.disabled,r=e.theme;return e.stroked?"none":(0,d.getColor)(Rn({active:t,disabled:n}))({theme:r})}),(function(e){var t=e.active,n=e.disabled,r=e.theme;return e.stroked?(0,d.getColor)(Rn({active:t,disabled:n}))({theme:r}):"none"}),(function(e){var t=e.active,n=e.hoverIndicator;return(t||n)&&"\n    border-radius: 4px;\n  "}),(function(e){var t=e.theme,n=e.hoverIndicator,r=e.disabled;return n&&!r&&"background: ".concat((0,d.getColor)("borderSecondary")({theme:t}),";")}),(function(e){var t=e.theme,n=e.stroked,r=e.disabled;return n?"none":(0,d.getColor)(Rn({defaultColor:"textDescription",disabled:r}))({theme:t})}),(function(e){var t=e.theme,n=e.stroked,r=e.disabled;return n?(0,d.getColor)(Rn({defaultColor:"textDescription",disabled:r}))({theme:t}):"none"})),["testIdPrefix"]),Bn=(0,o.forwardRef)((function(e,t){var n,r=e.testIdPrefix,l=(0,Y.Z)(e,Mn),i=(0,I.I0)(),c=(0,a.Z)(i,2),u=c[0],s=u.after,d=u.before,m=c[1],f=[Dn(n="navigation"),Fn(n)],p=(0,a.Z)(f,2),v=p[0],g=p[1],b=(0,o.useCallback)((function(e){var t=s,n=d;if(s<0){var r=Date.now();t=r+1e3*s,n=r}var a=e*Math.round((n-t)/4);m({after:t+a,before:n-a})}),[s,d]),h=s>0&&Math.abs(d-s)<2e3||-1===s;return o.createElement(Ln,(0,y.Z)({"data-testid":"chartToolbox","data-track":"chart-toolbox::hover-chart::".concat(r),"data-toolbox":"true",ref:t},l),o.createElement(An,{active:"pan"===v,"data-testid":"chartToolbox-pan","data-track":"chart-toolbox::pan-click::".concat(r),icon:"panTool",onClick:function(){return g("pan")},title:"Pan"}),o.createElement(An,{active:"highlight"===v,"data-testid":"chartToolbox-highlight","data-track":"chart-toolbox::highlight-click::".concat(r),icon:"highlightArea",onClick:function(){return g("highlight")},title:"Highlight"}),o.createElement(An,{active:"zoom"===v,"data-testid":"chartToolbox-zoom","data-track":"chart-toolbox::zoom-click::".concat(r),disabled:h,icon:"dragHorizontal",onClick:function(){g("zoom")},title:"Select and zoom"}),o.createElement(An,{"data-testid":"chartToolbox-zoomIn","data-track":"chart-toolbox::zoom-in-click::".concat(r),disabled:h,icon:"zoomIn",onClick:function(){b(1)},title:"Zoom in"}),o.createElement(An,{"data-testid":"chartToolbox-zoomOut","data-track":"chart-toolbox::zoom-out-click::".concat(r),icon:"zoomOut",onClick:function(){b(-1)},title:"Zoom out"}),o.createElement(An,{"data-testid":"chartToolbox-zoomReset","data-track":"chart-toolbox::zoom-reset-click::".concat(r),disabled:-900===s&&0===d,icon:"zoomReset",onClick:function(){m({after:-900,before:0})},title:"Zoom reset"}))}));function _n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_n(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_n(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Un={after:null,before:null};jn.kL.register(Cn.Z,jn.vn,jn.ZL,jn.uw,jn.De,jn.f$,jn.FB,jn.u,Zn.ZP);var Wn=function(e){var t,n=e.paramsKey,r=e.testIdPrefix,l=(0,o.useRef)(),i=(0,o.useContext)(s.ThemeContext),u=(0,I.I0)(),m=(0,a.Z)(u,2),p=m[0],v=m[1],g=(0,o.useState)([]),b=(0,a.Z)(g,2),y=b[0],h=b[1],E=(0,o.useState)(Un),x=(0,a.Z)(E,2),O=x[0],w=x[1],S=(0,o.useState)(!1),C=(0,a.Z)(S,2),Z=C[0],k=C[1],P=(0,o.useState)(!1),T=(0,a.Z)(P,2),D=T[0],F=T[1],K=(0,o.useState)([]),N=(0,a.Z)(K,2),z=N[0],A=N[1],L=(0,o.useState)(null),R=(0,a.Z)(L,2),M=R[0],B=R[1],_=(0,o.useState)("second"),V=(0,a.Z)(_,2),U=V[0],W=V[1],H=(0,f.Z)(!1),Q=(0,a.Z)(H,4),q=Q[0],G=Q[2],X=Q[3],J=(0,c.ZQ)(n).aggregations,Y=Dn().navigation,$=(0,Ae.rA)(),ee=$.localeTimeString,te=$.localeDateString,ne=On(),re=(0,a.Z)(ne,1)[0],ae=re.before-re.after,oe=(0,o.useMemo)((function(){var e=Date.now();return{min:re.after-ae,max:0===p.before?re.before:e<re.before+ae?e:re.before+ae}}),[re.after,re.before,p.before]),le=[{backgroundColor:(0,d.getColor)("primary")({theme:i}),borderWidth:0,data:y,label:"Histogram",maxBarThickness:50,minBarLength:0}];(0,o.useEffect)((function(){var e;if(null!==J&&void 0!==J&&null!==(e=J.event_histogram)&&void 0!==e&&null!==(e=e.hits)&&void 0!==e&&e.buckets){var t=J.event_histogram.hits.buckets.reduce((function(e,t){var n=t.key,r=t.doc_count;return{data:[].concat((0,j.Z)(e.data),[r]),labels:[].concat((0,j.Z)(e.labels),[n])}}),{data:[],labels:[]}),n=(0,He.BZ)(p.after,p.before)||{};h(t.data),A(t.labels),B(null),W(n.unit)}}),[null===J||void 0===J||null===(t=J.event_histogram)||void 0===t||null===(t=t.hits)||void 0===t?void 0:t.buckets]);var ie=(0,o.useMemo)((function(){return{animation:!1,interaction:{axis:"x"},maintainAspectRatio:!1,plugins:{annotation:{annotations:Vn({},O.after&&O.before?{annotation:{type:"box",backgroundColor:"rgba(128,128,128,0.3)",borderDash:[1,5,1,1],borderWidth:1,xMax:O.before,xMin:O.after,xScaleID:"x"}}:{})},legend:{align:"start",display:!1,position:"bottom"},zoom:{limits:{x:oe},pan:{enabled:"pan"===Y&&!Z,mode:"x",onPanStart:function(e){e.chart.canvas.style.cursor="grabbing"},onPanComplete:function(e){var t=e.chart;t.canvas.style.cursor="default";var n=t.scales.x,r=n.min,a=n.max;B({min:Math.round(r),max:Math.round(a)}),v({after:Math.round(r),before:Math.round(a)}),t.update()},threshold:1},zoom:{drag:{enabled:"zoom"===Y||Z},mode:"x",onZoomStart:function(e){e.chart.canvas.style.cursor="col-resize"},onZoomComplete:function(e){var t=e.chart;if("zoom"===Y||Z){t.canvas.style.cursor="default";var n=t.scales.x,r=n.min,a=n.max;v({after:Math.round(r),before:Math.round(a)}),k(!1)}}}}},responsive:!0,scales:{x:Vn({type:"time",grid:{drawBorder:!0,drawOnChartArea:!1,drawTicks:!0,offset:!1},parsing:!1,ticks:Vn({color:(0,d.getColor)("textLite")({theme:i}),font:{size:11},autoSkip:!0,maxTicksLimit:20},"minute"===U&&ae>=1e3*sn.Kl?{callback:function(e){var t=te(e,{month:"2-digit",day:"2-digit",year:"numeric",long:!1,dateStyle:void 0}).split("/").reverse().slice(1).join("-"),n=ee(e,{secs:!1});return"".concat(t," ").concat(n)}}:{}),time:{displayFormats:{week:"yyyy-MM-dd",day:"MM-dd",hour:"MM-dd HH:mm",minute:"HH:mm",second:"HH:mm:ss"},tooltipFormat:"yyyy-MM-dd HH:mm:ss",unit:U||"second"}},M?{min:M.min,max:M.max}:{}),y:{beginAtZero:!0,ticks:{precision:0,color:(0,d.getColor)("textLite")({theme:i}),font:{size:11}}}}}}),[O,ae,Z,Y,M,B,U,oe]);if((0,o.useEffect)((function(){var e=function(e){"Shift"===e.key&&(e.preventDefault(),k(!0))};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[]),!y.length)return null;return o.createElement(d.Flex,{position:"relative",height:{min:50},onMouseEnter:G,onMouseLeave:X},q&&o.createElement(Bn,{testIdPrefix:r}),o.createElement(Sn.$Q,{data:{datasets:le,labels:z},onMouseDown:function(e){if(e.preventDefault(),"highlight"===Y){F(!0);var t=e.nativeEvent.offsetX||e.nativeEvent.layerX,n=l.current;n.canvas.style.cursor="crosshair",w({after:Math.round(n.scales.x.getValueForPixel(t)),before:null})}},onMouseMove:function(e){if(e.preventDefault(),"highlight"===Y&&D){var t=e.nativeEvent.offsetX||e.nativeEvent.layerX,n=l.current;w((function(e){return Vn(Vn({},e),{},{before:Math.round(n.scales.x.getValueForPixel(t))})}))}},onMouseUp:function(e){e.preventDefault(),F(!1);var t=e.nativeEvent.offsetX||e.nativeEvent.layerX,n=l.current;n.canvas.style.cursor="default",O.after===Math.round(n.scales.x.getValueForPixel(t))?w(Un):w(O)},options:ie,ref:l}))},Hn=["sorter"];function Qn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qn(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Gn=function(e){return{label:e,value:e}},Xn=function(e){var t=e.paramsKey,n=e.initData,r=e.initFilter,l=(0,c.ZQ)(t),i=l.charts,m=l.loading,f=L(t),p=(0,o.useContext)(s.ThemeContext),v=Object.keys(i).map(Gn),g=P(t.extraKey,Gn),b=(0,o.useState)(n),y=(0,a.Z)(b,2),h=y[0],E=y[1],x=(0,o.useState)(r),O=(0,a.Z)(x,2),w=O[0],S=O[1],C=(0,c.CE)(t);(0,o.useEffect)((function(){E(n)}),[n]),(0,o.useEffect)((function(){S(r)}),[r]);var Z=(0,o.useMemo)((function(){if(!i[h])return{datasets:[],labels:[]};var e=i[h].columns,t=null===f||void 0===f?void 0:f.reduce((function(t,n){var r=n[w];return t[r]?qn(qn({},t),{},(0,u.Z)({},r,e.reduce((function(e,t){var r;return qn(qn({},e),{},(r={},(0,u.Z)(r,t,e[t]+n[t]),(0,u.Z)(r,"sorter",e.sorter+n[t]),r))}),t[r]))):qn(qn({},t),{},(0,u.Z)({},r,e.reduce((function(e,t,a){var o;return qn(qn(qn({},e),0===a?{label:r,sorter:n[t]}:{}),{},(o={},(0,u.Z)(o,t,n[t]),(0,u.Z)(o,"sorter",e.sorter?e.sorter+n[t]:n[t]),o))}),{})))}),{}),n=Object.values(t).sort((function(e,t){return t.sorter-e.sorter})).slice(0,15).map((function(e){e.sorter;return qn({},(0,Y.Z)(e,Hn))}));return{datasets:i[h].columns.map((function(e,t){return{backgroundColor:sn.vK[t],borderWidth:0,data:n.map((function(t){return t[e]})),label:e,maxBarThickness:50,minBarLength:0}})),labels:n.map((function(e){return e.label}))}}),[C,i,h,w,f]),j={animation:!1,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{boxWidth:4,boxHeight:20,title:{color:(0,d.getColor)("textLite")({theme:p})}}}},responsive:!0,scales:{x:{stacked:!0},y:{stacked:!0}}};return o.createElement(d.Flex,{column:!0,"data-testid":"functionsCharts",gap:3,width:"50%"},o.createElement(d.Flex,{alignItems:"center","data-testid":"functionsChart".concat(h,"-selects"),gap:2},o.createElement(d.Select,{"data-ga":"functions-chart-".concat(h,"::select-data::functions-view"),"data-testid":"functionsChart".concat(h,"-dataSelect"),isLoading:m,onChange:function(e){var t=e.value;return E(t)},options:v,styles:{size:"tiny",minWidth:120},value:{label:h,value:h}}),o.createElement(d.Text,{"data-testid":"functionsChart".concat(h,"-perLabel"),color:"textLite"},"per"),o.createElement(d.Select,{"data-ga":"functions-chart-".concat(w,"::select-filter::functions-view"),"data-testid":"functionsChart".concat(w,"-filterSelect"),isLoading:m,onChange:function(e){var t=e.value;return S(t)},options:g,styles:{size:"tiny",minWidth:120},value:{label:w,value:w}})),o.createElement(d.Flex,{position:"relative",height:{min:60},width:{min:"100%"}},o.createElement(Sn.$Q,{data:Z,options:j})))},Jn=["margin","defaultCharts"],Yn=["paramsKey","testIdPrefix","availableFns","availableFnsLoaded","hasError"],$n={extraKey:"fn"},er={fn:{Chart:function(e){var t=e.margin,n=e.defaultCharts,r=(0,Y.Z)(e,Jn);return o.createElement(d.Flex,{gap:6,margin:t},n.map((function(e,t){var n=(0,a.Z)(e,2),l=n[0],i=n[1];return o.createElement(Xn,(0,y.Z)({key:t,initData:l,initFilter:i},r))})))},loadingMessage:"Loading function..."},feed:{Chart:Wn,loadingMessage:"Loading events..."}},tr={table:nn},nr=(0,o.memo)((function(e){var t=e.paramsKey,n=void 0===t?$n:t,l=e.testIdPrefix,i=void 0===l?"functions":l,u=e.availableFns,s=e.availableFnsLoaded,m=e.hasError,f=(0,Y.Z)(e,Yn),p=er[n.extraKey]||er.fn,v=p.Chart,g=p.loadingMessage,h=(0,c.Hv)(n),E=(0,a.Z)(h,2),x=E[0],O=E[1],w=(0,I.c6)(n),S=(0,c.ZQ)(n),C=S.loaded,Z=S.data,j=S.error,k=S.type,P=S.retentionWarning,T=S.defaultCharts,D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,a.Z)(e,1)[0],n=(0,ge.bV)(t,"name");return 1===e.length&&n?"on ".concat(n):"on your selected node"}(w);(0,o.useEffect)((function(){var e;null!==x&&void 0!==x&&x.length||null===u||void 0===u||null===(e=u[0])||void 0===e||!e.name||m||O([u[0].name])}),[s,x]);var F=(0,ke.useHovered)({},[C]),K=(0,a.Z)(F,2),N=K[0],z=K[1],A=(0,Pe.Z)();(0,o.useEffect)((function(){A(z)}),[z]);var L=function(e,t,n){var l=(0,be.th)(),i=(0,b.vf)(),u=(0,c.T2)(n),s=(0,c.e6)(n),d=(0,c.mO)(n),m=(0,a.Z)(d,2),f=m[0],p=m[1],v=(0,o.useRef)();v.current=f;var g=function(e){var t=e.data,n=void 0===t?{}:t;(r[n.type]||yn)(p,n,v.current)},y=xn[t]||xn.default,h=y.fetch,E=y.isEnabled,x=On(),O=(0,a.Z)(x,3),w=O[0],S=O[1],C=O[2],Z=(0,o.useRef)();Z.current=w;var j=(0,b.UL)(),k=(0,I.by)(null,{key:j,extraKey:"".concat(t||n.extraKey,"Filters")}),P=(0,ge.Xw)(e),T=(0,je.zp)(),D=(0,a.Z)(T,1)[0].loading;return(0,rn.Z)((function(){return{enabled:!D&&E({nodeIds:e,fn:t,roomId:j}),fetch:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return h(En(En(En(En({roomId:j,spaceId:l,nodeIds:e,cloudNodeIds:P,fn:t,roomSlug:i},k),Z.current),n),{},{acceptedParams:f.acceptedParams}))},onStart:function(){return p({loading:!0})},onFail:function(e){var t;null!==(t=e)&&void 0!==t&&null!==(t=t.response)&&void 0!==t&&t.data&&(e=e.response.data),p({error:e,loading:!1,loaded:!0})},onReceive:g,polling:u||!1,pollingOptions:{pollingInterval:1e3*(s||f.updateEvery),shouldPause:!0},force:!0}}),[j,null===e||void 0===e?void 0:e.length,null===e||void 0===e?void 0:e[0],t,u,u&&s,!!f.aggregations&&k,S,C,D])}(w,x[0],n);if(!C||!s)return o.createElement(ve.Z,{title:g,"data-testid":"".concat(i,"Loading")});if(m)return o.createElement(wn.NY,{title:"Functions couldn't be loaded",message:"We couldn't find any available functions."});if(j&&"canceled"!==j)return"ErrNodeResourceNotFound"===(null===j||void 0===j?void 0:j.errorMsgKey)?o.createElement(Oe.Z,{message:"Please review your selection and try again.",title:"".concat("feed"===n.extraKey?"Events are":'Function "'.concat(x,'" is')," not available ").concat(D,".")}):o.createElement(wn.NY,{title:"".concat("feed"===n.extraKey?"Events":"Functions"," couldn't be loaded"),message:"ErrForbidden"===(null===j||void 0===j?void 0:j.errorMsgKey)?"Forbidden":""});var R=tr[k]||tr.table;return o.createElement(d.Box,{overflow:{horizontal:"hidden",vertical:"auto"},column:!0,padding:[4,4,0],gap:2},o.createElement(Ue,{nodeIds:w,onRefresh:L,paramsKey:n}),o.createElement(v,{paramsKey:n,testIdPrefix:i,defaultCharts:T}),C&&null!==Z&&void 0!==Z&&Z.length?o.createElement(R,(0,y.Z)({"data-testid":"".concat(i,"Component"),paramsKey:n,refetch:L,ref:N},f)):o.createElement(d.Flex,{column:!0,justifyContent:"center",alignItems:"center",alignSelf:"center",margin:["feed"===n.extraKey?3:30,0,0],gap:3},o.createElement(d.H3,null,"No results to display"),o.createElement(d.Text,{color:"textDescription",textAlign:"center"},"Double-check your search or filters and dates and try again with different conditions"),P&&o.createElement(d.Text,{color:"text",textAlign:"center"},P)))})),rr=nr,ar=n(24533),or=["paramsKey","hasError","refreshAvailableFns","availableFnsLoaded","availableFns"];function lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ir(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lr(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var cr=function(e){var t=(0,je.Hu)();return o.createElement(d.Button,(0,y.Z)({label:"Get a fresh agent token",onClick:t},e))},ur="Functions expose sensitive information about your systems and applications. To protect your privacy, Netdata exposes this information only to logged-in users and claimed agents. When viewing Functions directly on a  Netdata Agent UI, this information is sent directly from the Netdata Agent to your web browser, without exposing it to any third parties.",sr={notLoggedIn:{title:"Sign in to Netdata to use Functions",description:ur,footer:o.createElement(Ce.Z,null)},notClaimed:{title:"Connect this agent to Netdata to use Functions",description:ur,footer:o.createElement(Ze.Z,null)},noAccess:{title:"This agent belongs to a Netdata Space you are not member of",description:ur,footer:o.createElement(d.TextBig,{color:"textDescription"},"Ask for an invitation from the administrators of the Netdata Space of the agent to use functions.")},bearerError:{title:"You are not authorized to use Functions",description:ur,footer:o.createElement(cr,null)}},dr={extraKey:"fn"},mr=["paramsKey"],fr={extraKey:"feed"},pr={fn:{Component:function(e){var t=e.paramsKey,n=void 0===t?dr:t,r=e.hasError,l=e.refreshAvailableFns,i=e.availableFnsLoaded,u=e.availableFns,s=(0,Y.Z)(e,or),d=(0,I.H7)(n),m=(0,I.wT)(n),f=(0,a.Z)(m,2),p=f[0],v=f[1],g=(0,ge.M2)(d),b=Ee(n),h=(0,c.CE)(n);(0,o.useEffect)((function(){var e;if(null!==d&&void 0!==d&&d.length&&!b&&(null===p||void 0===p||!p.length)&&h){var t=null===(e=u.find((function(e){return e.name===h})))||void 0===e?void 0:e.nodes;t&&v([Object.keys(t)[0]])}}),[b,v,p,h]);var E=(0,ye.ej)(),x=(0,a.Z)(E,1)[0],O=(0,je.zp)(),w=(0,a.Z)(O,1)[0],S=w.bearerProtection,C=w.error,Z=w.token,j=(0,be.Q6)(),k=(0,ar.Lz)(),P=(0,a.Z)(k,1)[0],T=P.canBeClaimed,D=P.cloudStatus;if((0,o.useEffect)((function(){r&&l()}),[D,Z]),!g.length)return o.createElement(Se,{paramsKey:n});if(j&&(r||C&&S)){var F=function(e){var t=e.userStatus,n=e.userNodeStatus,r=e.accessError,a=e.canBeClaimed;return e.cloudStatus,sr[t]?sr[t]:r?sr.notLoggedIn:a?sr.notClaimed:sr[n]?sr[n]:sr.bearerError}(ir(ir({},x),{},{bearerError:C,canBeClaimed:T,cloudStatus:D})),K=F.title,N=F.description,z=F.footer;return o.createElement(Oe.Z,{title:K,message:N,footer:z})}return o.createElement(rr,(0,y.Z)({testIdPrefix:"fn",paramsKey:n,availableFnsLoaded:i,availableFns:u},s))},paramsKey:{extraKey:"fn"},loading:"Loading functions..."},feed:{Component:function(e){var t=e.paramsKey,n=void 0===t?fr:t,r=(0,Y.Z)(e,mr);return Ee(n),o.createElement(rr,(0,y.Z)({testIdPrefix:"feed",paramsKey:n},r))},paramsKey:{extraKey:"feed"},loading:"Loading events..."}},vr=function(e){var t=e.flavour,n=pr[t]||pr.fn,r=n.Component,u=n.paramsKey,s=n.loading,d=(0,i.zN)(),m=(0,i.fD)(),f=(0,o.useState)(),p=(0,a.Z)(f,2),v=p[0],g=p[1],b=(0,c.KO)(u.extraKey),y=b.loaded,h=b.value,E=b.hasError,x=b.refresh;return m?d.length||"fn"!==t?o.createElement(l.Z,{"data-testid":"".concat(t,"Page"),margin:[0,0,8,0],rightBar:o.createElement(fe,{flavour:t,selectedRowData:v,setSelectedRowData:g,availableFns:h})},o.createElement(r,{testIdPrefix:t,paramsKey:u,onShowInfo:g,availableFnsLoaded:y,availableFns:h,refreshAvailableFns:x,hasError:E})):o.createElement(pe.Z,null):o.createElement(ve.Z,{title:s})}}}]);