/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.
* Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */
(window.logsShared_bundle_jsonpfunction=window.logsShared_bundle_jsonpfunction||[]).push([[3],{119:function(e,t,r){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if((o=t.length)!=r.length)return!1;for(n=o;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((o=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;0!=n--;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}},120:function(e,t,r){"use strict";r.r(t),r.d(t,"LogStream",(function(){return I})),r.d(t,"LogStreamContent",(function(){return v}));var o=r(104),n=r(1),s=r.n(n),i=r(13),a=r(27),l=r(8),u=r(4),c=r(52),d=r(45),g=r(73),h=r(105);r(109),r(107),r(51),r(111),r(112),r(113),r(114),r(115);var b=r(116),m=r(5),f=r(19),p=r(33),E=r.n(p),O=r(119),j=r.n(O);class resettable_error_boundary_ResettableErrorBoundary extends s.a.Component{constructor(...e){super(...e),E()(this,"state",{latestError:void 0}),E()(this,"resetError",(()=>{this.setState((e=>({...e,latestError:void 0})))}))}componentDidUpdate({resetOnChange:e}){const{resetOnChange:t}=this.props,{latestError:r}=this.state;null==r||j()(t,e)||this.resetError()}static getDerivedStateFromError(e){return{latestError:e}}render(){const{children:e,renderError:t}=this.props,{latestError:r}=this.state;return null!=r?t({latestError:r,resetError:this.resetError}):e}}var y=r(2);const S=({children:e,resetOnChange:t=null})=>Object(y.jsx)(resettable_error_boundary_ResettableErrorBoundary,{renderError:w,resetOnChange:t},e),_=({error:e})=>e instanceof o.KQLSyntaxError?Object(y.jsx)(m.EuiEmptyPrompt,{title:Object(y.jsx)(f.FormattedMessage,{id:"xpack.logsShared.logStream.kqlErrorTitle",defaultMessage:"Invalid KQL expression",tagName:"h2"}),body:Object(y.jsx)(m.EuiCodeBlock,{className:"eui-textLeft"},e.message)}):Object(y.jsx)(m.EuiEmptyPrompt,{title:Object(y.jsx)(f.FormattedMessage,{id:"xpack.logsShared.logStream.unknownErrorTitle",defaultMessage:"An error occurred",tagName:"h2"}),body:Object(y.jsx)(m.EuiCodeBlock,{className:"eui-textLeft"},e.message)}),w=({latestError:e})=>Object(y.jsx)(_,{error:e});var x=r(44);const I=({height:e=400,...t})=>Object(y.jsx)(T,{style:{height:e}},Object(y.jsx)(S,{resetOnChange:[t.query]},Object(y.jsx)(v,t))),v=({logView:e,startTimestamp:t,endTimestamp:r,query:s,filters:i,center:m,highlight:f,columns:p,showFlyoutAction:E=!1})=>{const O=Object(n.useMemo)((()=>p?function(e){return e.map((e=>{switch(e.type){case"timestamp":{const{width:t,header:r,render:o}=e;return{timestampColumn:{id:"___#timestamp",width:t,header:r,render:o}}}case"message":{const{width:t,header:r,render:o}=e;return{messageColumn:{id:"___#message",width:t,header:r,render:o}}}case"field":{const{width:t,header:r,render:o}=e;return{fieldColumn:{id:`___#${e.field}`,field:e.field,width:t,header:r,render:o}}}}}))}(p):void 0),[p]),{services:{http:j,data:S}}=Object(a.useKibana)();if(null==j||null==S)throw new Error(" cannot access kibana core services.\n\nEnsure the component is mounted within kibana-react's hierarchy.\nRead more at https://github.com/elastic/kibana/blob/main/src/plugins/kibana_react/README.md\"\n");const{openLogEntryFlyout:_}=Object(x.b)(e),w=(()=>{const[e]=Object(a.useUiSetting$)(h.UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS),[t]=Object(a.useUiSetting$)(h.UI_SETTINGS.QUERY_STRING_OPTIONS),[r]=Object(a.useUiSetting$)(h.UI_SETTINGS.DATEFORMAT_TZ),[o]=Object(a.useUiSetting$)(h.UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX);return Object(n.useMemo)((()=>({allowLeadingWildcards:e,queryStringOptions:t,dateFormatTZ:r,ignoreFilterIfFieldNotInIndex:o})),[e,r,o,t])})(),I=Object(n.useMemo)((()=>new g.a(S.dataViews,j,S.search.search,u.h)),[S.dataViews,S.search.search,j]),{derivedDataView:v,isLoading:T,load:C,resolvedLogView:M}=Object(d.b)({initialLogViewReference:e,logViews:I}),N=Object(n.useMemo)((()=>"object"==typeof s&&"bool"in s?L(s,Object(o.buildEsQuery)(v,[],null!=i?i:[],w)):Object(o.buildEsQuery)(v,R(s),null!=i?i:[],w)),[v,i,w,s]),{entries:k,fetchEntries:A,fetchNextEntries:D,fetchPreviousEntries:F,hasMoreAfter:U,hasMoreBefore:V,isLoadingMore:q,isReloading:B}=Object(c.b)({logViewReference:e,startTimestamp:t,endTimestamp:r,query:N,center:m,columns:O}),G=Object(n.useMemo)((()=>M?null!=O?O:M.columns:[]),[M,O]),P=Object(n.useMemo)((()=>k.map((e=>({kind:"logEntry",logEntry:e,highlights:[]})))),[k]);Object(n.useEffect)((()=>{C()}),[C]),Object(n.useEffect)((()=>{A()}),[A]);const Q=Object(n.useCallback)((({fromScroll:e,pagesBeforeStart:t,pagesAfterEnd:r})=>{e&&(q||(t<2?F():r<2&&D()))}),[q,F,D]);return Object(y.jsx)(b.ScrollableLogTextStreamView,{target:m||(k.length?k[k.length-1].cursor:null),columnConfigurations:G,items:P,scale:"medium",wrap:!0,isReloading:T||B,isLoadingMore:q,hasMoreBeforeStart:V,hasMoreAfterEnd:U,isStreaming:!1,jumpToTarget:l.noop,reportVisibleInterval:Q,reloadItems:A,onOpenLogEntryFlyout:E?_:void 0,highlightedItem:null!=f?f:null,currentHighlightKey:null,startDateExpression:"",endDateExpression:"",updateDateRange:l.noop,startLiveStreaming:l.noop,hideScrollbar:!1})},T=i.euiStyled.div`
display: flex;
background-color: ${e=>e.theme.eui.euiColorEmptyShade};
`,L=(e,t)=>({bool:{must:[...e.bool.must,...t.bool.must],filter:[...e.bool.filter,...t.bool.filter],should:[...e.bool.should,...t.bool.should],must_not:[...e.bool.must_not,...t.bool.must_not]}}),R=e=>null==e?[]:"string"==typeof e?[{language:"kuery",query:e}]:"language"in e&&"query"in e?[e]:[];t.default=I}}]);