/*! 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.securitySolution_bundle_jsonpfunction=window.securitySolution_bundle_jsonpfunction||[]).push([[41],{1504:function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(40),l=a(2),o=a.n(l),s=a(41),i=a.n(s),c=a(103),u=a(179),r=a(102),d=a(718),m=a(551),p=a(383);const b=i()(n.EuiFlexItem).withConfig({displayName:"NewNoteTabs",componentId:"sc-uq31qy-0"})(["width:100%;"]);b.displayName="NewNoteTabs";const E=o.a.memo((({note:e,noteInputHeight:t,updateNewNote:a,autoFocusDisabled:n=!1,setIsMarkdownInvalid:l})=>o.a.createElement(b,{"data-test-subj":"new-note-tabs"},o.a.createElement(p.a,{ariaLabel:m.d,onChange:a,value:e,dataTestSubj:"add-a-note",height:t,autoFocusDisabled:n,setIsMarkdownInvalid:l}))));E.displayName="NewNote";const N=i.a.div.withConfig({displayName:"AddNotesContainer",componentId:"sc-1065h8-0"})(["margin-bottom:5px;user-select:none;"]);N.displayName="AddNotesContainer";const g=i()(n.EuiFlexGroup).withConfig({displayName:"ButtonsContainer",componentId:"sc-1065h8-1"})(["margin-top:5px;"]);g.displayName="ButtonsContainer";const w=o.a.memo((({onCancelAddNote:e})=>o.a.createElement(n.EuiButtonEmpty,{"data-test-subj":"cancel",onClick:e},m.b)));w.displayName="CancelButton";const y=o.a.memo((({associateNote:e,newNote:t,onCancelAddNote:a,updateNewNote:s,autoFocusDisabled:i=!1})=>{const p=Object(c.useDispatch)(),b=Object(r.f)(),[y,I]=Object(l.useState)(!1),j=Object(l.useCallback)((e=>p(u.a.updateNote({note:e}))),[p]),h=Object(l.useCallback)((()=>{const a=null==b?void 0:b.username;a&&Object(d.b)({associateNote:e,newNote:t,updateNewNote:s,updateNote:j,user:a})}),[e,t,s,j,b]),O=Object(l.useCallback)((e=>{e.stopPropagation(),"Escape"===e.key&&null!=a&&a()}),[a]),v=Object(l.useMemo)((()=>0===t.trim().length||y),[t,y]);return o.a.createElement(N,{onKeyDown:O,role:"dialog"},o.a.createElement("div",{style:{width:"100%"}},o.a.createElement(n.EuiScreenReaderOnly,{"data-test-subj":"screenReaderOnly"},o.a.createElement("p",null,m.g)),o.a.createElement(E,{note:t,noteInputHeight:200,updateNewNote:s,autoFocusDisabled:i,setIsMarkdownInvalid:I}),o.a.createElement(g,{gutterSize:"none"},null!=a?o.a.createElement(n.EuiFlexItem,{grow:!1},o.a.createElement(w,{onCancelAddNote:a})):null,o.a.createElement(n.EuiFlexItem,{grow:!1},o.a.createElement(n.EuiButton,{"data-test-subj":"add-note",isDisabled:v,fill:!0,onClick:h},m.a)))))}));y.displayName="AddNote"},1673:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return A}));var n=a(42),l=a(40),o=a(2),s=a.n(o),i=a(103),c=a(41),u=a.n(c),r=a(116),d=a(110),m=a(111),p=a(105),b=a(118),E=a(106),N=a(179),g=a(1504),w=a(551),y=a(268),I=a(899),j=a(139),h=a(690),O=a(915),v=a(126);const C=u()(l.EuiFlexGroup).withConfig({displayName:"FullWidthFlexGroup",componentId:"sc-angm11-0"})(["width:100%;margin:0;overflow:hidden;"]),f=u()(l.EuiFlexItem).withConfig({displayName:"ScrollableFlexItem",componentId:"sc-angm11-1"})(["overflow-x:hidden;overflow-y:auto;"]),x=u.a.div.withConfig({displayName:"VerticalRule",componentId:"sc-angm11-2"})(["width:2px;height:100%;background:",";"],(({theme:e})=>e.eui.euiColorLightShade)),S=u()(l.EuiPanel).withConfig({displayName:"StyledPanel",componentId:"sc-angm11-3"})(["border:0;box-shadow:none;"]),F=u()(l.EuiFlexGroup).withConfig({displayName:"StyledEuiFlexGroup",componentId:"sc-angm11-4"})(["flex:0;"]),T=u()(l.EuiText).withConfig({displayName:"Username",componentId:"sc-angm11-5"})(["font-weight:bold;"]),k=({username:e})=>s.a.createElement(F,{gutterSize:"s",responsive:!1,alignItems:"center"},s.a.createElement(l.EuiFlexItem,{grow:!1},s.a.createElement(l.EuiAvatar,{"data-test-subj":"avatar",name:e,size:"l"})),s.a.createElement(l.EuiFlexItem,null,s.a.createElement(T,null,e))),B=s.a.memo(k),M=({users:e})=>{const t=Object(o.useMemo)((()=>e.map((e=>s.a.createElement(o.Fragment,{key:null===e.updatedBy?void 0:e.updatedBy},s.a.createElement(B,{key:null===e.updatedBy?void 0:e.updatedBy,username:String(e.updatedBy)}),s.a.createElement(l.EuiSpacer,{size:"s"}))))),[e]);return e.length?s.a.createElement(s.a.Fragment,null,s.a.createElement(l.EuiTitle,{size:"xs"},s.a.createElement("h4",null,y.d)),s.a.createElement(l.EuiHorizontalRule,{margin:"s"}),t):null};M.displayName="ParticipantsComponent";const D=s.a.memo(M),z=({timelineId:e})=>{const t=Object(i.useDispatch)(),{kibanaSecuritySolutionsPrivileges:a}=Object(v.a)(),c=Object(o.useMemo)((()=>Object(O.f)()),[]),u=Object(p.b)((t=>c(t,e)));((e,t=!0)=>{Object(o.useEffect)((()=>{const a=e?document.querySelector(e):window;t&&a&&(a.scroll?a.scroll(0,0):a.scrollTo(0,0))}))})("#scrollableNotes",!!u);const y=Object(o.useMemo)((()=>Object(j.createSelector)(m.b.selectTimeline,(e=>{var t,a;return{createdBy:e.createdBy,expandedDetail:null!==(t=e.expandedDetail)&&void 0!==t?t:{},eventIdToNoteIds:null!==(a=null==e?void 0:e.eventIdToNoteIds)&&void 0!==a?a:{},noteIds:e.noteIds,status:e.status}}))),[]),{createdBy:F,expandedDetail:T,eventIdToNoteIds:k,noteIds:M,status:z}=Object(p.a)((t=>y(t,e))),{browserFields:A,runtimeMappings:P}=Object(r.d)(d.SourcererScopeName.timeline),G=Object(o.useMemo)((()=>N.c.selectNotesAsCommentsListSelector()),[]),[R,q]=Object(o.useState)(""),H=z===E.k.immutable,_=Object(p.a)(G),L=Object(o.useMemo)((()=>{const e=Object.values(k).reduce(((e,t)=>[...e,...t]),[]);return[...M,...e]}),[M,k]),V=Object(o.useMemo)((()=>_.filter((e=>{var t;return L.includes(null!==(t=null==e?void 0:e.noteId)&&void 0!==t?t:"-1")}))),[_,L]),K=Object(o.useMemo)((()=>Object(n.uniqBy)("updatedBy",Object(n.filter)("savedObjectId",V))),[V]),U=Object(o.useCallback)((a=>t(m.a.addNote({id:e,noteId:a}))),[t,e]),W=Object(o.useCallback)((()=>{t(m.a.toggleDetailPanel({tabType:b.d.notes,id:e}))}),[t,e]),J=Object(o.useMemo)((()=>{var t;return null!==(t=T[b.d.notes])&&void 0!==t&&t.panelView?s.a.createElement(h.a,{browserFields:A,handleOnPanelClosed:W,runtimeMappings:P,tabType:b.d.notes,scopeId:e}):null}),[A,T,W,P,e]),Q=Object(o.useMemo)((()=>s.a.createElement(s.a.Fragment,null,F&&s.a.createElement(s.a.Fragment,null,s.a.createElement(l.EuiSpacer,{size:"m"}),s.a.createElement(l.EuiTitle,{size:"xs"},s.a.createElement("h4",null,w.c)),s.a.createElement(l.EuiHorizontalRule,{margin:"s"}),s.a.createElement(B,{username:F}),s.a.createElement(l.EuiSpacer,{size:"xxl"})),s.a.createElement(D,{users:K}))),[F,K]);return s.a.createElement(C,null,s.a.createElement(f,{grow:2,id:"scrollableNotes"},s.a.createElement(S,{paddingSize:"s"},s.a.createElement(l.EuiTitle,null,s.a.createElement("h3",null,w.e)),s.a.createElement(l.EuiSpacer,null),s.a.createElement(I.a,{eventIdToNoteIds:k,notes:V,timelineId:e,showTimelineDescription:!0}),s.a.createElement(l.EuiSpacer,{size:"s"}),!H&&!0===a.crud&&s.a.createElement(g.a,{associateNote:U,newNote:R,updateNewNote:q,autoFocusDisabled:!!u}))),s.a.createElement(x,null),s.a.createElement(f,{grow:1},null!=J?J:Q))};z.displayName="NotesTabContentComponent";const A=s.a.memo(z)}}]);