/*! 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.timelines_bundle_jsonpfunction=window.timelines_bundle_jsonpfunction||[]).push([[1],{60:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var a=n(4),o=n(54),r=n(0),i=n.n(r);const c=o.i18n.translate("xpack.timelines.hoverActions.tooltipWithKeyboardShortcut.pressTooltipLabel",{defaultMessage:"Press"}),s=({additionalScreenReaderOnlyContext:e="",content:t,shortcut:n,showShortcut:o})=>i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{"data-test-subj":"content"},t),""!==e&&i.a.createElement(a.EuiScreenReaderOnly,{"data-test-subj":"additionalScreenReaderOnlyContext"},i.a.createElement("p",null,e)),o&&i.a.createElement(a.EuiText,{color:"subdued","data-test-subj":"shortcut",size:"s",textAlign:"center"},i.a.createElement("span",null,c)," ",i.a.createElement(a.EuiBadge,{color:"hollow"},n))),l=i.a.memo(s);l.displayName="TooltipWithKeyboardShortcut"},62:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var a=n(0),o=n(7),r=n(2),i=n(55),c=n(57);const s=()=>{const{toasts:e}=Object(i.useKibana)().services.notifications,t=Object(a.useRef)(null==e?void 0:e.addError.bind(e)).current,n=Object(a.useRef)(null==e?void 0:e.addSuccess.bind(e)).current,o=Object(a.useRef)(null==e?void 0:e.addWarning.bind(e)).current;return{api:e,addError:Object(a.useCallback)(((e,n)=>{const a=l(e);return t(a,n)}),[t]),addSuccess:n,addWarning:o}},l=e=>null!=e&&Object(c.isEsError)(e)?u(e):Object(r.i)(e)?d(e):e instanceof Error?p(e):m(e),u=e=>{var t,n,a,o,r;const i=null!=e.err?e.err:e,c=null!=(null===(t=e.err)||void 0===t?void 0:t.statusCode)?`(${e.err.statusCode})`:null!=e.statusCode?`(${e.statusCode})`:"",s=f(i),l=new Error(`${null!==(n=null===(a=e.attributes)||void 0===a?void 0:a.reason)&&void 0!==n?n:e.message} ${c}`);return l.name=null!==(o=null===(r=e.attributes)||void 0===r?void 0:r.reason)&&void 0!==o?o:e.message,null!=s&&(l.stack=s),l},d=e=>{const t=Object(r.j)(e)?`(${e.body.statusCode})`:Object(r.k)(e)?`(${e.body.status_code})`:"",n=f(e),a=new Error(`${""!==String(e.body.message).trim()?e.body.message:e.message} ${t}`);return a.name=null!=e.name?e.name:"",null!=n&&(a.stack=n),a},p=e=>{const t=f(e),n=new Error(e.message);return n.name=e.name,null!=t&&(n.stack=t),n},m=e=>{const t=f(e),n=Object(o.isString)(e)?e:e instanceof Object&&null!=t?t:String(e),a=new Error(n);return a.name=n,null!=t&&(a.stack=t),a},f=e=>{try{return JSON.stringify(e,((e,t)=>{const n=b(t);return y(n)?void 0:n}),2)}catch(e){return}},b=e=>e instanceof Error?{...e,name:e.name,message:e.message,stack:e.stack}:e,y=e=>{if(!(e instanceof Object))return!1;try{return"{}"===JSON.stringify(e)}catch(e){return!1}}},63:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return c}));var a=n(54);const o=a.i18n.translate("xpack.timelines.hoverActions.addToTimeline",{defaultMessage:"Add to timeline investigation"}),r=(e,t)=>a.i18n.translate("xpack.timelines.hoverActions.addToTimeline.addedFieldMessage",{values:{fieldOrValue:e,isTimeline:t},defaultMessage:"Added {fieldOrValue} to {isTimeline, select, true {timeline} false {template}}"}),i=a.i18n.translate("xpack.timelines.dragAndDrop.copyToClipboardTooltip",{defaultMessage:"Copy to Clipboard"}),c=e=>a.i18n.translate("xpack.timelines.clipboard.copy.successToastTitle",{values:{field:e},defaultMessage:"Copied field {field} to the clipboard"})},64:function(e,t,n){"use strict";var a=n(65),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,r,i,c,s,l,u=!1;t||(t={}),n=t.debug||!1;try{if(i=a(),c=document.createRange(),s=document.getSelection(),(l=document.createElement("span")).textContent=e,l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(a){if(a.stopPropagation(),t.format)if(a.preventDefault(),void 0===a.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=o[t.format]||o.default;window.clipboardData.setData(r,e)}else a.clipboardData.clearData(),a.clipboardData.setData(t.format,e);t.onCopy&&(a.preventDefault(),t.onCopy(a.clipboardData))})),document.body.appendChild(l),c.selectNodeContents(l),s.addRange(c),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(a){n&&console.error("unable to copy using execCommand: ",a),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(a){n&&console.error("unable to copy using clipboardData: ",a),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(c):s.removeAllRanges()),l&&document.body.removeChild(l),i()}return u}},65:function(e,t){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],a=0;a{const{addSuccess:s}=Object(l.a)(),u=f()("copy-to-clipboard",{securitySolution__hoverActionButton:n});return i.a.createElement(d.EuiButtonIcon,{"aria-label":g,className:u,"data-test-subj":"clipboard",iconSize:"s",iconType:"copyClipboard",onClick:e=>{e.preventDefault(),e.stopPropagation();const n=o()(`${t}`,{debug:!0});null!=a&&a({content:t,isSuccess:n}),n&&s(`${b} ${r} ${y}`,{toastLifeTimeMs:c})}},e)},C=i.a.memo((({isHoverAction:e,keyboardShortcut:t="",showTooltip:n=!0,text:a,titleSummary:o})=>n?i.a.createElement(d.EuiToolTip,{content:i.a.createElement(p.a,{additionalScreenReaderOnlyContext:a,content:u.c,shortcut:t,showShortcut:""!==t})},i.a.createElement(v,{content:a,isHoverAction:e,titleSummary:o,toastLifeTimeMs:800})):i.a.createElement(v,{content:a,isHoverAction:e,titleSummary:o,toastLifeTimeMs:800})));C.displayName="WithCopyToClipboard";const E=c.i18n.translate("xpack.timelines.hoverActions.fieldLabel",{defaultMessage:"Field"}),h="c",S="copy-to-clipboard",O=i.a.memo((({Component:e,field:t,isHoverAction:n,onClick:a,keyboardEvent:c,ownFocus:d,value:p})=>{const{addSuccess:m}=Object(l.a)(),f=Object(r.useRef)(null);Object(r.useEffect)((()=>{if(d&&(null==c?void 0:c.key)===h){var e;Object(s.t)(c);const t=null===(e=f.current)||void 0===e?void 0:e.querySelector(`.${S}`);null!=t&&t.click(),null!=a&&a()}}),[a,c,d]);const b=Object(r.useMemo)((()=>`${t}${null!=p?`: "${p}"`:""}`),[t,p]),y=Object(r.useCallback)((()=>{const e=o()(b,{debug:!0});null!=a&&a(),e&&m(Object(u.d)(t),{toastLifeTimeMs:800})}),[m,t,a,b]);return e?i.a.createElement(e,{"aria-label":u.c,"data-test-subj":"copy-to-clipboard",icon:"copy",iconType:"copy",onClick:y,title:u.c},u.c):i.a.createElement("div",{ref:f},i.a.createElement(C,{"data-test-subj":"copy-to-clipboard",isHoverAction:n,keyboardShortcut:d?h:"",text:b,titleSummary:E}))}));O.displayName="CopyButton"}}]);