(window.visualizations_bundle_jsonpfunction=window.visualizations_bundle_jsonpfunction||[]).push([[2],Array(78).concat([function(e,t,a){"use strict";var n,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,a){return Function.prototype.apply.call(e,t,a)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise((function(a,n){function i(a){e.removeListener(t,s),n(a)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),a([].slice.call(arguments))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,a){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,i)}))},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var l=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function d(e,t,a,n){var i,s,o,r;if(c(a),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,a.listener?a.listener:a),s=e._events),o=s[t]),void 0===o)o=s[t]=a,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[a,o]:[o,a]:n?o.unshift(a):o.push(a),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,r=l,console&&console.warn&&console.warn(r)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function b(e,t,a){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:a},i=p.bind(n);return i.listener=a,n.wrapFn=i,i}function g(e,t,a){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?a?[i.listener||i]:[i]:a?function(e){for(var t=new Array(e.length),a=0;a0&&(o=t[0]),o instanceof Error)throw o;var r=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw r.context=o,r}var l=i[e];if(void 0===l)return!1;if("function"==typeof l)s(l,this,t);else{var c=l.length,u=m(l,c);for(a=0;a=0;s--)if(a[s]===t||a[s].listener===t){o=a[s].listener,i=s;break}if(i<0)return this;0===i?a.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},r.prototype.listeners=function(e){return g(this,e,!0)},r.prototype.rawListeners=function(e){return g(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},r.prototype.listenerCount=f,r.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},,,,function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(150);case"v8light":return a(152)}},,,function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDeepEqual=t.off=t.on=t.isClient=void 0;var n=a(57).__importDefault(a(102));t.isClient="object"==typeof window,t.on=function(e){for(var t=[],a=1;a=4;++n,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),a=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&a)+(59797*(a>>>16)<<16);switch(i){case 3:a^=(255&e.charCodeAt(n+2))<<16;case 2:a^=(255&e.charCodeAt(n+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(n)))+(59797*(a>>>16)<<16)}return(((a=1540483477*(65535&(a^=a>>>13))+(59797*(a>>>16)<<16))^a>>>15)>>>0).toString(36)}},function(e,t,a){"use strict";e.exports=a(125)},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},function(e,t,a){"use strict";e.exports=a(127)},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=Object.create(null);return function(a){return void 0===t[a]&&(t[a]=e(a)),t[a]}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="undefined"!=typeof document,i=function(e,t,a){var i=e.key+"-"+t.name;(!1===a||!1===n&&void 0!==e.compat)&&void 0===e.registered[i]&&(e.registered[i]=t.styles)};t.getRegisteredStyles=function(e,t,a){var n="";return a.split(" ").forEach((function(a){void 0!==e[a]?t.push(e[a]+";"):n+=a+" "})),n},t.insertStyles=function(e,t,a){i(e,t,a);var s=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o="",r=t;do{var l=e.insert(t===r?"."+s:"",r,e.sheet,!0);n||void 0===l||(o+=l),r=r.next}while(void 0!==r);if(!n&&0!==o.length)return o}},t.registerStyles=i},,function(e,t,a){e.exports=a.p+"baad30acfe492601d08a0e839c9bb3f5.svg"},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(57),i=a(14),s=n.__importDefault(a(132));t.default=function(e,t,a){void 0===t&&(t=0),void 0===a&&(a=[]);var n=s.default(e,t),o=n[0],r=n[1],l=n[2];return i.useEffect(l,a),[o,r]}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(14);t.default=function(e,t){void 0===t&&(t=0);var a=n.useRef(!1),i=n.useRef(),s=n.useRef(e),o=n.useCallback((function(){return a.current}),[]),r=n.useCallback((function(){a.current=!1,i.current&&clearTimeout(i.current),i.current=setTimeout((function(){a.current=!0,s.current()}),t)}),[t]),l=n.useCallback((function(){a.current=null,i.current&&clearTimeout(i.current)}),[]);return n.useEffect((function(){s.current=e}),[e]),n.useEffect((function(){return r(),l}),[t]),[o,l,r]}},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(134);case"v8light":return a(136)}},function(e,t,a){var n=a(72),i=a(135);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);n(i,{insert:"head",singleton:!1}),e.exports=i.locals||{}},function(e,t,a){(t=a(73)(!1)).push([e.i,".visAppWrapper{display:flex;flex-direction:column;flex-grow:1}.visAppLoadingWrapper{align-items:center;display:flex;flex-grow:1;justify-content:center}",""]),e.exports=t},function(e,t,a){var n=a(72),i=a(137);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);n(i,{insert:"head",singleton:!1}),e.exports=i.locals||{}},function(e,t,a){(t=a(73)(!1)).push([e.i,".visAppWrapper{display:flex;flex-direction:column;flex-grow:1}.visAppLoadingWrapper{align-items:center;display:flex;flex-grow:1;justify-content:center}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(139);case"v8light":return a(141)}},function(e,t,a){var n=a(72),i=a(140);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);n(i,{insert:"head",singleton:!1}),e.exports=i.locals||{}},function(e,t,a){(t=a(73)(!1)).push([e.i,".visListingTable__typeIcon,.visListingTable__typeImage{margin-right:8px;position:relative;top:-1px}.visListingTable__typeImage{height:16px;width:16px}.visListingTable__experimentalIcon{margin-left:8px;padding:0 8px;vertical-align:initial;width:24px}.visListingTable__titleLink{text-align:left}.visListingCallout__link{text-decoration:underline}",""]),e.exports=t},function(e,t,a){var n=a(72),i=a(142);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);n(i,{insert:"head",singleton:!1}),e.exports=i.locals||{}},function(e,t,a){(t=a(73)(!1)).push([e.i,".visListingTable__typeIcon,.visListingTable__typeImage{margin-right:8px;position:relative;top:-1px}.visListingTable__typeImage{height:16px;width:16px}.visListingTable__experimentalIcon{margin-left:8px;padding:0 8px;vertical-align:initial;width:24px}.visListingTable__titleLink{text-align:left}.visListingCallout__link{text-decoration:underline}",""]),e.exports=t},,,,,,function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(57).__importDefault(a(92));t.default=function(e){n.default((function(){e()}))}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(57),i=a(14),s=n.__importDefault(a(92));t.default=function(e){var t=i.useRef(e);t.current=e,s.default((function(){return function(){return t.current()}}))}},function(e,t,a){var n=a(72),i=a(151);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);n(i,{insert:"head",singleton:!1}),e.exports=i.locals||{}},function(e,t,a){(t=a(73)(!1)).push([e.i,".visEditor{display:flex;flex:1 1 auto;flex-direction:column;height:100%}.visEditor>*{flex-shrink:0}@media only screen and (max-width:574px){.visEditor .visualization{min-height:240px}}@media only screen and (min-width:575px) and (max-width:767px){.visEditor .visualization{min-height:240px}}@media only screen and (min-width:768px) and (max-width:991px){.visEditor .visualization{min-height:240px}}.visEditor>.visualize{display:flex;flex:1 1 auto;height:100%;z-index:0}.visEditor__content{display:flex;flex:1 1 auto;flex-direction:column;width:100%;z-index:0}.visEditor__content>*{flex-shrink:0}",""]),e.exports=t},function(e,t,a){var n=a(72),i=a(153);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);n(i,{insert:"head",singleton:!1}),e.exports=i.locals||{}},function(e,t,a){(t=a(73)(!1)).push([e.i,".visEditor{display:flex;flex:1 1 auto;flex-direction:column;height:100%}.visEditor>*{flex-shrink:0}@media only screen and (max-width:574px){.visEditor .visualization{min-height:240px}}@media only screen and (min-width:575px) and (max-width:767px){.visEditor .visualization{min-height:240px}}@media only screen and (min-width:768px) and (max-width:991px){.visEditor .visualization{min-height:240px}}.visEditor>.visualize{display:flex;flex:1 1 auto;height:100%;z-index:0}.visEditor__content{display:flex;flex:1 1 auto;flex-direction:column;width:100%;z-index:0}.visEditor__content>*{flex-shrink:0}",""]),e.exports=t},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(14),i=a(85),s=function(){};t.default=function(e,t,a){if(!i.isClient)return[t,s,s];if(!e)throw new Error("useLocalStorage key may not be falsy");var o=a?a.raw?function(e){return e}:a.deserializer:JSON.parse,r=n.useState((function(){try{var n=a?a.raw?String:a.serializer:JSON.stringify,i=localStorage.getItem(e);return null!==i?o(i):(t&&localStorage.setItem(e,n(t)),t)}catch(e){return t}})),l=r[0],c=r[1],u=n.useCallback((function(t){try{var n="function"==typeof t?t(l):t;if(void 0===n)return;var i;i=a?a.raw?"string"==typeof n?n:JSON.stringify(n):a.serializer?a.serializer(n):JSON.stringify(n):JSON.stringify(n),localStorage.setItem(e,i),c(o(i))}catch(e){}}),[e,c]),d=n.useCallback((function(){try{localStorage.removeItem(e),c(void 0)}catch(e){}}),[e,c]);return[l,u,d]}},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.r(t),a.d(t,"renderApp",(function(){return Qt}));var n=a(14),i=a.n(n),s=a(33),o=a.n(s),r=a(74),l=a.n(r),c=a(55);const u={services:{}},d=Object(n.createContext)(u);var p=a(101),b=a.n(p),g=a(4);const f=({children:e,component:t,render:a,...s})=>{const o=Object(n.useMemo)((()=>{if(t)return e=>Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(m,null),Object(g.jsx)(t,e))}),[t]);if(o)return Object(g.jsx)(c.Route,l()({},s,{component:o}));if(a||"function"==typeof e){const t="function"==typeof e?e:a;return Object(g.jsx)(c.Route,l()({},s,{render:e=>Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(m,null),t(e))}))}return Object(g.jsx)(c.Route,s,Object(g.jsx)(m,null),e)},m=()=>{const{executionContext:e}=Object(n.useContext)(d).services,t=Object(c.useRouteMatch)();return function(e,t){b()((()=>(null==e||e.set(t),()=>{null==e||e.clear()})),[t])}(e,{type:"application",page:t.path,id:Object.keys(t.params).length>0?JSON.stringify(t.params):void 0}),null};var v=a(59);const j=({children:e,...t})=>Object(g.jsx)(c.Router,t,Object(g.jsx)(v.CompatRouter,null,e));var h=a(5);const x=({legacySwitch:e=!0,children:t})=>{const a=Object(c.useRouteMatch)();return e?Object(g.jsx)(c.Switch,null,t):Object(g.jsx)(v.Routes,null,n.Children.map(t,(e=>{if(i.a.isValidElement(e)&&e.type===f){var n;const s=Object(h.replace)(null==e?void 0:e.props.path,a.url+"/",""),o="function"==typeof(null==e?void 0:e.props.children)?null==e?void 0:e.props.children:null==e?void 0:e.props.render;return Object(g.jsx)(v.Route,{path:s,element:Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(m,null),(null==e||null===(n=e.props)||void 0===n?void 0:n.component)&&Object(g.jsx)(e.props.component,null)||o&&o()||t)})}return e})))};var O=a(20),y=a(37),w=a(131),C=a.n(w),S=a(9),E=a(2),k=a(38),T=a.n(k);a(104),a(109);const M=e=>{const{className:t,size:a,...n}=e,i={};return(e=>void 0===e.iconType)(e)&&(i.iconType=`logo${e.name.replace(/\s+/g,"")}`),Object(g.jsx)(S.EuiAvatar,l()({className:T()("kbnSolutionAvatar",{[`kbnSolutionAvatar--${a}`]:a},t),size:"xxl"===a?"xl":a,iconSize:a,color:"plain"},n,i))};a(114);const L=E.i18n.translate("sharedUXPackages.solutionNav.collapsibleLabel",{defaultMessage:"Collapse side navigation"}),P=E.i18n.translate("sharedUXPackages.solutionNav.openLabel",{defaultMessage:"Open side navigation"}),_=({className:e,isCollapsed:t,...a})=>{const n=T()("kbnSolutionNavCollapseButton",{"kbnSolutionNavCollapseButton-isCollapsed":t},e);return Object(g.jsx)(S.EuiButtonIcon,l()({className:n,size:"s",color:"text",iconType:t?"menuRight":"menuLeft","aria-label":t?P:L,title:t?P:L},a))},A=(e,t)=>e.map((e=>(e.tabIndex=t?-1:void 0,e.items=e.items&&A(e.items,t),e))),I=Object(S.htmlIdGenerator)("SolutionNav"),N=({children:e,headingProps:t,icon:a,isOpenOnDesktop:s=!1,items:o,mobileBreakpoints:r=["xs","s"],closeFlyoutButtonPosition:c="outside",name:u,onCollapse:d,canBeCollapsed:p=!0,...b})=>{const f=Object(S.useIsWithinBreakpoints)(r),m=Object(S.useIsWithinBreakpoints)(["m"]),v=Object(S.useIsWithinMinBreakpoint)("l"),[j,h]=Object(n.useState)(!1),x=v&&!s&&p,O=!!e,w=T()("kbnSolutionNav",{"kbnSolutionNav--hidden":x}),C=(null==t?void 0:t.id)||I("heading"),k=(null==t?void 0:t.element)||"h2",L=Object(g.jsx)(S.EuiTitle,{size:"xs",id:C,"data-test-subj":null==t?void 0:t["data-test-subj"]},Object(g.jsx)(k,null,a&&Object(g.jsx)(M,{className:"kbnSolutionNav__avatar",iconType:a,name:u}),Object(g.jsx)("strong",null,Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.solutionNav.mobileTitleText",defaultMessage:"{solutionName} {menuText}",values:{solutionName:u||"Navigation",menuText:f?E.i18n.translate("sharedUXPackages.solutionNav.menuText",{defaultMessage:"menu"}):""}})))),P=Object(n.useMemo)((()=>O?e:o?Object(g.jsx)(S.EuiSideNav,l()({"aria-labelledby":C,"aria-hidden":x,items:A(o,x),mobileBreakpoints:[]},b)):null),[e,C,O,x,o,b]);return Object(g.jsx)(i.a.Fragment,null,f&&Object(g.jsx)(S.EuiCollapsibleNavGroup,{className:w,paddingSize:"none",background:"none",title:L,titleElement:"span",isCollapsible:p,initialIsOpen:!1},Object(g.jsx)(S.EuiPanel,{color:"transparent",paddingSize:"s"},P)),m&&Object(g.jsx)(i.a.Fragment,null,(j||!p)&&Object(g.jsx)(S.EuiFlyout,{ownFocus:!1,outsideClickCloses:!0,onClose:()=>h(!1),side:"left",size:248,closeButtonPosition:c,className:"kbnSolutionNav__flyout",hideCloseButton:!p},Object(g.jsx)("div",{className:w},L,Object(g.jsx)(S.EuiSpacer,{size:"l"}),P)),p&&Object(g.jsx)(_,{isCollapsed:!0,onClick:()=>{h(!j)}})),v&&Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)("div",{className:w},L,Object(g.jsx)(S.EuiSpacer,{size:"l"}),P),p&&Object(g.jsx)(_,{isCollapsed:!s,onClick:d})))};var D=a(88);const F="solutionNavIsCollapsed",z=e=>{const t=t=>{var a;const i=Object(S.useIsWithinBreakpoints)(["m"]),s=Object(S.useIsWithinMinBreakpoint)("l"),[o,r]=Object(n.useState)(!JSON.parse(String(localStorage.getItem(F)))),{solutionNav:c,children:u,...d}=t,{euiTheme:p}=Object(S.useEuiTheme)(),{canBeCollapsed:b=!0}=c,f=i||b&&s&&!o,m=(e=>Object(D.css)("flex:0 1 0;overflow:hidden;",S.euiCanAnimate,"{transition:min-width ",e.animation.fast," ",e.animation.resistance,";}",""))(p),v=T()({"kbnSolutionNav__sidebar--shrink":f},null===(a=t.pageSideBarProps)||void 0===a?void 0:a.className,m),j=Object(g.jsx)(N,l()({isOpenOnDesktop:o,onCollapse:()=>{r(!o),localStorage.setItem(F,JSON.stringify(o))}},c)),h={paddingSize:"none",...t.pageSideBarProps,minWidth:f?p.size.xxl:void 0,className:v};return Object(g.jsx)(e,l()({},d,{pageSideBar:j,pageSideBarProps:h}),u)};var a;return t.displayName=`WithSolutionNavBar(${a=e,a.displayName||a.name||"UnnamedComponent"})`,t};var V=a(76),B=a(130),R=a.n(B);const U=E.i18n.translate("sharedUXPackages.card.noData.noPermission.title",{defaultMessage:"Contact your administrator"}),H=E.i18n.translate("sharedUXPackages.card.noData.noPermission.description",{defaultMessage:"This integration is not yet enabled. Your administrator has the required permissions to turn it on."}),$=E.i18n.translate("sharedUXPackages.card.noData.title",{defaultMessage:"Add Elastic Agent"}),G=E.i18n.translate("sharedUXPackages.card.noData.description",{defaultMessage:"Use Elastic Agent for a simple, unified way to collect data from your machines."}),q=()=>Object(g.jsx)(S.EuiImage,{size:"fullWidth",style:{width:"max(100%, 360px)",height:240,objectFit:"cover",background:"aliceblue"},url:R.a,alt:""}),Q=({title:e,description:t,canAccessFleet:a,button:n,...i})=>Object(g.jsx)(S.EuiCard,l()({css:{maxWidth:400,marginInline:"auto"},paddingSize:"l",title:a?Object(g.jsx)(S.EuiScreenReaderOnly,null,Object(g.jsx)("span",null,e||$)):Object(g.jsx)(S.EuiTextColor,{color:"default"},U),description:a?t||G:Object(g.jsx)(S.EuiTextColor,{color:"default"},H),footer:(()=>{if(a)return n&&"string"!=typeof n?n:Object(g.jsx)(S.EuiButton,{fill:!0},n||e||$)})(),isDisabled:!a,image:Object(g.jsx)(q,null)},i)),K=i.a.createContext(null),W=({children:e,...t})=>{const a={addBasePath:t.coreStart.http.basePath.prepend,canAccessFleet:t.coreStart.application.capabilities.navLinks.integrations};return Object(g.jsx)(K.Provider,{value:a},Object(g.jsx)(V.c,t,e))},X=({href:e,category:t,description:a,...i})=>{const{canAccessFleet:s,addBasePath:o}=function(){const e=Object(n.useContext)(K);if(!e)throw new Error("NoDataCard Context is missing. Ensure your component or React root is wrapped with NoDataCardContext.");return e}(),r=Object(n.useMemo)((()=>{if(e)return e;const a="/app/integrations/browse";return o(t?`${a}/${t}`:a)}),[o,e,t]);return Object(g.jsx)(V.b,null,Object(g.jsx)(Q,l()({},i,{href:r,canAccessFleet:s,description:a})))},Y=({action:e})=>{const t=Object.keys(e);if(1!==t.length)return null;const a=t[0],n="elasticAgent"===a?"empty-page-agent-action":`empty-page-${a}-action`;return Object(g.jsx)(X,l()({key:n},e[a]))},J=({solution:e,logo:t,action:a,docsLink:n,pageTitle:i,className:s})=>{const o=i||E.i18n.translate("sharedUXPackages.noDataPage.welcomeTitle",{defaultMessage:"Welcome to Elastic {solution}!",values:{solution:e}}),r=Object(g.jsx)(S.EuiLink,{href:n,target:"_blank"},Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataPage.intro.link",defaultMessage:"learn more"})),l=Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataPage.intro",defaultMessage:"Add your data to get started, or {link} about {solution}.",values:{solution:e,link:r}});return Object(g.jsx)(S.EuiPageTemplate.Section,{alignment:"center",grow:!0,className:T()("kbnNoDataPageContents",s),"data-test-subj":"kbnNoDataPage"},Object(g.jsx)(S.EuiText,{textAlign:"center"},Object(g.jsx)(M,{name:e,iconType:t||`logo${e}`,size:"xxl"}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)("h1",null,o),Object(g.jsx)(S.EuiTextColor,{color:"subdued"},Object(g.jsx)("p",null,l))),Object(g.jsx)(S.EuiSpacer,{size:"xxl"}),Object(g.jsx)(Y,{action:a}))},Z=e=>{const{className:t,noDataConfig:a,pageSideBar:n,pageSideBarProps:i,...s}=e;if(!a)return null;let o;n&&(o=Object(g.jsx)(S.EuiPageTemplate.Sidebar,i,n));const r=((e,t)=>T()("kbnPageTemplate","",t||""))(0,t);return Object(g.jsx)(S.EuiPageTemplate,l()({className:r,restrictWidth:950,panelled:!1,offset:0,minHeight:0},s),o,Object(g.jsx)(J,a))},ee=z(Z),te=({className:e,pageHeader:t,children:a,isEmptyState:i,pageSideBar:s,pageSideBarProps:o,...r})=>{let c;const[u,d]=Object(n.useState)();if(Object(n.useEffect)((()=>{const e=document.querySelector('[data-test-subj="kibanaChrome"]');if(e){const t=e.querySelector('[data-test-subj="headerGlobalNav"]');d((null==t?void 0:t.offsetTop)+(null==t?void 0:t.offsetHeight))}}),[]),i&&t&&!a){const{iconType:e,pageTitle:n,description:i,rightSideItems:s}=t,o=n?Object(g.jsx)("h1",null,n):void 0,r=i?Object(g.jsx)("p",null,i):void 0;a=Object(g.jsx)(S.EuiPageTemplate.EmptyPrompt,{iconType:e,iconColor:"",title:o,body:r,actions:s})}else t&&(c=Object(g.jsx)(S.EuiPageTemplate.Header,t));let p;if(s){const e={...o};u&&(e.sticky={offset:u}),p=Object(g.jsx)(S.EuiPageTemplate.Sidebar,e,s)}const b=((e,t)=>T()("kbnPageTemplate","",t||""))(0,e);return Object(g.jsx)(S.EuiPageTemplate,l()({className:b,offset:0,minHeight:0},r),p,c,a)},ae=z(te),ne=Object.assign((({className:e,children:t,solutionNav:a,noDataConfig:n,...i})=>n&&a?Object(g.jsx)(ee,{"data-test-subj":i["data-test-subj"],className:e,noDataConfig:n,solutionNav:a}):n?Object(g.jsx)(Z,{"data-test-subj":i["data-test-subj"],className:e,noDataConfig:n}):a?Object(g.jsx)(ae,l()({className:e,solutionNav:a,children:t},i)):Object(g.jsx)(te,l()({className:e,children:t},i))),{Sidebar:S.EuiPageTemplate.Sidebar,Header:S.EuiPageTemplate.Header,Section:S.EuiPageTemplate.Section,BottomBar:S.EuiPageTemplate.BottomBar,EmptyPrompt:S.EuiPageTemplate.EmptyPrompt}),ie=i.a.createContext(null),se=({children:e,...t})=>Object(g.jsx)(ie.Provider,{value:t},e),oe=({children:e,...t})=>{const{core:a,toMountPoint:i,savedObjectsTagging:s}=t,{openFlyout:o}=a.overlays,{theme$:r}=a.theme,l=Object(n.useMemo)((()=>({references:e})=>{if(null==s||!s.ui.components.TagList)return null;const t=s.ui.components.TagList;return Object(g.jsx)(t,{object:{references:e}})}),[null==s?void 0:s.ui.components.TagList]),c=Object(n.useCallback)(((e,t)=>o(i(e,{theme$:r}),t)),[o,i,r]);return Object(g.jsx)(se,{openFlyout:c,notifyError:(e,t)=>{a.notifications.toasts.addDanger({title:i(e),text:t})},TagList:l,TagSelector:null==s?void 0:s.ui.components.SavedObjectSaveModalTagSelector},e)},re=e=>{const[t,s]=Object(n.useState)(null),o=Object(n.useCallback)((async()=>{const{ContentEditorFlyoutContentContainer:e}=await a.e(12).then(a.bind(null,185));s((()=>e))}),[]);return Object(n.useEffect)((()=>{o()}),[o]),t?Object(g.jsx)(t,e):Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiFlyoutHeader,null),Object(g.jsx)(S.EuiFlyoutBody,null),Object(g.jsx)(S.EuiFlyoutFooter,null))};const le=i.a.createContext(null),ce=({children:e,...t})=>Object(g.jsx)(le.Provider,{value:t},e),ue=({children:e,...t})=>{var a;const{core:i,toMountPoint:s,savedObjectsTagging:o,FormattedRelative:r}=t,l=Object(n.useMemo)((()=>{if(o)return async e=>{const t=await o.ui.parseSearchQuery(e,{useName:!0});return{searchQuery:t.searchTerm,references:t.tagReferences,referencesToExclude:t.tagReferencesToExclude}}}),[o]),c=Object(n.useMemo)((()=>({references:e,onClick:t,tagRender:a})=>{if(null==o||!o.ui.components.TagList)return null;const n=o.ui.components.TagList;return Object(g.jsx)(n,{object:{references:e},onClick:t,tagRender:a})}),[null==o?void 0:o.ui.components.TagList]),u=Object(n.useCallback)((e=>null!=o&&o.ui.getTagIdsFromReferences?o.ui.getTagIdsFromReferences(e):[]),[null==o?void 0:o.ui]),d=Object(n.useCallback)((()=>null!=o&&o.ui.getTagList?o.ui.getTagList():[]),[null==o?void 0:o.ui]),p=Object(n.useCallback)((e=>u(e).length>0),[u]);return Object(g.jsx)(V.c,{coreStart:i},Object(g.jsx)(oe,{core:i,toMountPoint:s,savedObjectsTagging:o},Object(g.jsx)(ce,{canEditAdvancedSettings:Boolean(null===(a=i.application.capabilities.advancedSettings)||void 0===a?void 0:a.save),getListingLimitSettingsUrl:()=>i.application.getUrlForApp("management",{path:"/kibana/settings?query=savedObjects:listingLimit"}),notifyError:(e,t)=>{i.notifications.toasts.addDanger({title:s(e),text:t})},searchQueryParser:l,DateFormatterComp:e=>Object(g.jsx)(r,e),currentAppId$:i.application.currentAppId$,navigateToUrl:i.application.navigateToUrl,getTagList:d,TagList:c,itemHasTags:p,getTagIdsFromReferences:u,getTagManagementUrl:()=>i.http.basePath.prepend("/app/management/kibana/tags")},e)))};function de(){const e=Object(n.useContext)(le);if(!e)throw new Error("TableListViewContext is missing. Ensure your component or React root is wrapped with or .");return e}const pe={nameAscSort:E.i18n.translate("contentManagement.tableList.listing.tableSortSelect.nameAscLabel",{defaultMessage:"Name A-Z"}),nameDescSort:E.i18n.translate("contentManagement.tableList.listing.tableSortSelect.nameDescLabel",{defaultMessage:"Name Z-A"}),updatedAtAscSort:E.i18n.translate("contentManagement.tableList.listing.tableSortSelect.updatedAtAscLabel",{defaultMessage:"Least recently updated"}),updatedAtDescSort:E.i18n.translate("contentManagement.tableList.listing.tableSortSelect.updatedAtDescLabel",{defaultMessage:"Recently updated"}),headerSort:E.i18n.translate("contentManagement.tableList.listing.tableSortSelect.headerLabel",{defaultMessage:"Sort by"})};function be({tableSort:e,hasUpdatedAtMetadata:t,onChange:a}){var s,o;const{euiTheme:r}=Object(S.useEuiTheme)(),[l,c]=Object(n.useState)(!1),[u,d]=Object(n.useState)((()=>{let e=[{label:pe.nameAscSort,column:"attributes.title",direction:"asc",append:Object(g.jsx)(S.EuiIcon,{type:"sortUp"})},{label:pe.nameDescSort,column:"attributes.title",direction:"desc",append:Object(g.jsx)(S.EuiIcon,{type:"sortDown"})}];return t&&(e=e.concat([{label:pe.updatedAtDescSort,column:"updatedAt",direction:"desc",append:Object(g.jsx)(S.EuiIcon,{type:"sortDown"})},{label:pe.updatedAtAscSort,column:"updatedAt",direction:"asc",append:Object(g.jsx)(S.EuiIcon,{type:"sortUp"})}])),e})),p=null!==(s=null===(o=u.find((({checked:e})=>"on"===e)))||void 0===o?void 0:o.label)&&void 0!==s?s:"",b=Object(g.css)("border-bottom:",r.border.thin,";font-weight:",600,";padding:",r.size.s,";",""),f=Object(g.jsx)(S.EuiFilterButton,{iconType:"arrowDown",iconSide:"right",onClick:()=>{c((e=>!e))},"data-test-subj":"tableSortSelectBtn",grow:!0},p);return Object(n.useEffect)((()=>{d((t=>t.map((t=>{const a=t.column===e.field&&t.direction===e.direction?"on":void 0;return{...t,checked:a}}))))}),[e]),Object(g.jsx)(S.EuiPopover,{button:f,isOpen:l,closePopover:()=>{c(!1)},panelPaddingSize:"none",anchorPosition:"downCenter",panelProps:{css:{width:18*r.base}}},Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiText,{css:b},pe.headerSort),Object(g.jsx)(S.EuiSelectable,{singleSelection:!0,"aria-label":"some aria label",options:u,onChange:e=>{d(e);const t=e.find((({checked:e})=>"on"===e));t&&a&&a(t.column,t.direction)},"data-test-subj":"sortSelect"},(e=>e))))}const ge=navigator.platform.toLowerCase().indexOf("mac")>=0?"⌘":"^",fe={name:"pit38s",styles:"height:auto"},me={name:"1d3w5wq",styles:"width:100%"},ve=({isPopoverOpen:e,isInUse:t,options:a,totalActiveFilters:n,onFilterButtonClick:s,onSelectChange:o,closePopover:r,clearTagSelection:c})=>{const{euiTheme:u}=Object(S.useEuiTheme)(),{navigateToUrl:d,currentAppId$:p,getTagManagementUrl:b}=de(),f=a.length>10,m=Object(g.css)("padding:",u.size.s,";border-bottom:",u.border.thin,";",""),v=Object(g.css)("height:",u.size.xxxl,";","");let j={searchable:!1};return f&&(j={searchable:!0,searchProps:{compressed:!0}}),Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiPopover,{button:Object(g.jsx)(S.EuiFilterButton,{iconType:"arrowDown",iconSide:"right",onClick:s,"data-test-subj":"tagFilterPopoverButton",hasActiveFilters:n>0,numActiveFilters:n,grow:!0},"Tags"),isOpen:e,closePopover:r,panelPaddingSize:"none",anchorPosition:"downCenter",panelProps:{css:{width:18*u.base}},panelStyle:t?{transition:"none"}:void 0},Object(g.jsx)(S.EuiPopoverTitle,{paddingSize:"m",css:v},Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,"Tags"),Object(g.jsx)(S.EuiFlexItem,{grow:!1},n>0&&Object(g.jsx)(S.EuiButtonEmpty,{flush:"both",onClick:c,css:fe},E.i18n.translate("contentManagement.tableList.tagFilterPanel.clearSelectionButtonLabelLabel",{defaultMessage:"Clear selection"}))))),Object(g.jsx)(S.EuiSelectable,l()({singleSelection:!1,"aria-label":"some aria label",options:a,renderOption:e=>e.view,emptyMessage:"There aren't any tags",noMatchesMessage:"No tag matches the search",onChange:o,"data-test-subj":"tagSelectableList"},j),((e,t)=>Object(g.jsx)(i.a.Fragment,null,f?Object(g.jsx)("div",{css:m},t):Object(g.jsx)(S.EuiSpacer,{size:"s"}),e))),Object(g.jsx)(S.EuiPopoverFooter,{paddingSize:"m"},Object(g.jsx)(S.EuiFlexGroup,{direction:"column",alignItems:"center",gutterSize:"s"},Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiText,{size:"xs"},Object(g.jsx)(S.EuiTextColor,{color:"dimgrey"},E.i18n.translate("contentManagement.tableList.tagFilterPanel.modifierKeyHelpText",{defaultMessage:"{modifierKeyPrefix} + click exclude",values:{modifierKeyPrefix:ge}})))),Object(g.jsx)(S.EuiFlexItem,{css:me},Object(g.jsx)(S.EuiButton,{onClick:r},E.i18n.translate("contentManagement.tableList.tagFilterPanel.applyButtonLabel",{defaultMessage:"Apply"}))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(V.a,{coreStart:{application:{navigateToUrl:d,currentAppId$:p}}},Object(g.jsx)(S.EuiLink,{href:b(),"data-test-subj":"manageAllTagsLink",external:!0},E.i18n.translate("contentManagement.tableList.tagFilterPanel.manageAllTagsLinkLabel",{defaultMessage:"Manage tags"}))))))))},je=navigator.platform.toLowerCase().indexOf("mac")>=0,he=e=>Array.isArray(e)?e:[e],xe=e=>e.replace(" ","_"),Oe=({query:e,tagsToTableItemMap:t,getTagList:a,addOrRemoveExcludeTagFilter:i,addOrRemoveIncludeTagFilter:s})=>{const[o,r]=Object(n.useState)(!1),[l,c]=Object(n.useState)(!1),[u,d]=Object(n.useState)([]),[p,b]=Object(n.useState)({}),f=Object.keys(p).length,m=Object(n.useCallback)((e=>{const t=e.find(((e,t)=>e.checked!==u[t].checked));t&&s(t.tag)}),[u,s]),v=Object(n.useCallback)((e=>t=>{je&&t.metaKey||!je&&t.ctrlKey?i(e):s(e)}),[s,i]),j=Object(n.useCallback)((()=>{const e=a().map((e=>{var a,n;const{name:i,id:s,color:o}=e;let r;return p[i]&&(r="include"===p[i]?"on":"off"),{name:i,label:i,value:null!=s?s:"",tag:e,checked:r,view:Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"xs",justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiHealth,{color:o,"data-test-subj":`tag-searchbar-option-${xe(i)}`,onClick:v(e)},Object(g.jsx)(S.EuiText,null,i))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiBadge,{color:void 0!==r?"accent":void 0},null!==(a=null===(n=t[null!=s?s:""])||void 0===n?void 0:n.length)&&void 0!==a?a:0)))}}));d(e)}),[a,t,p,v]),h=Object(n.useCallback)((()=>{r((e=>!e))}),[]),x=Object(n.useCallback)((()=>{r(!1)}),[]);return Object(n.useEffect)((()=>{if(e){const t=e.ast.getOrFieldClause("tag",void 0,!0,"eq"),a=e.ast.getOrFieldClause("tag",void 0,!1,"eq"),n={};t&&he(t.value).forEach((e=>{n[e]="include"})),a&&he(a.value).forEach((e=>{n[e]="exclude"})),b(n)}}),[e]),Object(n.useEffect)((()=>{o?(j(),setTimeout((()=>{c(!0)}),250)):c(!1)}),[o,j]),{isPopoverOpen:o,isInUse:l,options:u,totalActiveFilters:f,onFilterButtonClick:h,onSelectChange:m,closePopover:x}};function ye({dispatch:e,items:t,isFetchingItems:a,searchQuery:i,selectedIds:s,pagination:o,tableColumns:r,tableSort:l,hasUpdatedAtMetadata:c,entityName:u,entityNamePlural:d,tagsToTableItemMap:p,tableItemsRowActions:b,deleteItems:f,renderCreateButton:m,tableCaption:v,onTableChange:j,onTableSearchChange:h,onSortChange:x,addOrRemoveExcludeTagFilter:O,addOrRemoveIncludeTagFilter:w,clearTagSelection:C}){const{getTagList:k}=de(),T=Object(n.useCallback)((()=>{if(f&&0!==s.length)return Object(g.jsx)(S.EuiButton,{color:"danger",iconType:"trash",onClick:()=>e({type:"showConfirmDeleteItemsModal"}),"data-test-subj":"deleteSelectedItems"},Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.deleteButtonMessage",defaultMessage:"Delete {itemCount} {entityName}",values:{itemCount:s.length,entityName:1===s.length?u:d}}))}),[f,e,u,d,s.length]),M=Object(n.useMemo)((()=>{if(f)return{onSelectionChange:t=>{e({type:"onSelectionChange",data:t})},selectable:e=>{var t;const a=b[e.id];return!1!==(null==a||null===(t=a.delete)||void 0===t?void 0:t.enabled)},selectableMessage:(e,t)=>{if(!e){var a,n;const e=b[t.id];return null!==(a=null==e||null===(n=e.delete)||void 0===n?void 0:n.reason)&&void 0!==a?a:E.i18n.translate("contentManagement.tableList.actionsDisabledLabel",{defaultMessage:"Actions disabled for this item"})}return""},initialSelected:[]}}),[f,e,b]),{isPopoverOpen:L,isInUse:P,closePopover:_,onFilterButtonClick:A,onSelectChange:I,options:N,totalActiveFilters:D}=Oe({query:i.query,getTagList:k,tagsToTableItemMap:p,addOrRemoveExcludeTagFilter:O,addOrRemoveIncludeTagFilter:w}),F=Object(n.useMemo)((()=>({type:"custom_component",component:()=>Object(g.jsx)(be,{tableSort:l,hasUpdatedAtMetadata:c,onChange:x})})),[c,x,l]),z=Object(n.useMemo)((()=>({type:"custom_component",component:()=>Object(g.jsx)(ve,{isPopoverOpen:L,isInUse:P,closePopover:_,options:N,totalActiveFilters:D,onFilterButtonClick:A,onSelectChange:I,clearTagSelection:C})})),[L,P,_,N,D,A,I,C]),V=Object(n.useMemo)((()=>[F,z]),[F,z]),B=Object(n.useMemo)((()=>{var e;return{onChange:h,toolsLeft:T(),toolsRight:m(),query:null!==(e=i.query)&&void 0!==e?e:void 0,box:{incremental:!0,"data-test-subj":"tableListSearchBox"},filters:V}}),[h,m,T,V,i.query]),R=Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.noMatchedItemsMessage",defaultMessage:"No {entityNamePlural} matched your search.",values:{entityNamePlural:d}});return Object(g.jsx)(S.EuiInMemoryTable,{itemId:"id",items:t,columns:r,pagination:o,loading:a,message:R,selection:M,search:B,executeQueryOptions:{enabled:!1},sorting:l?{sort:l}:void 0,onChange:j,"data-test-subj":"itemsInMemTable",rowHeader:"attributes.title",tableCaption:v,isSelectable:!0})}var we=a(61),Ce=a.n(we);const Se=({value:e,children:t})=>t(new Date(e).toDateString()),Ee=({dateTime:e,DateFormatterComp:t=Se})=>{if(!e)return Object(g.jsx)(S.EuiToolTip,{content:E.i18n.translate("contentManagement.tableList.updatedDateUnknownLabel",{defaultMessage:"Last updated unknown"})},Object(g.jsx)("span",null,"-"));const a=Ce()(e);return a.diff(Ce()(),"days")>-7?Object(g.jsx)(t,{value:new Date(e).getTime()},(e=>Object(g.jsx)(S.EuiToolTip,{content:a.format("LL LT")},Object(g.jsx)("span",null,e)))):Object(g.jsx)(S.EuiToolTip,{content:a.format("LL LT")},Object(g.jsx)("span",null,a.format("LL")))};function ke({isDeletingItems:e,items:t,entityName:a,entityNamePlural:i,onCancel:s,onConfirm:o}){const{deleteBtnLabel:r,deletingBtnLabel:l,title:c,description:u,cancelBtnLabel:d}=Object(n.useMemo)((()=>function(e,t,a){return{deleteBtnLabel:E.i18n.translate("contentManagement.tableList.listing.deleteSelectedItemsConfirmModal.confirmButtonLabel",{defaultMessage:"Delete"}),deletingBtnLabel:E.i18n.translate("contentManagement.tableList.listing.deleteSelectedItemsConfirmModal.confirmButtonLabelDeleting",{defaultMessage:"Deleting"}),title:E.i18n.translate("contentManagement.tableList.listing.deleteSelectedConfirmModal.title",{defaultMessage:"Delete {itemCount} {entityName}?",values:{itemCount:e.length,entityName:1===e.length?t:a}}),description:E.i18n.translate("contentManagement.tableList.listing.deleteConfirmModalDescription",{defaultMessage:"You can't recover deleted {entityNamePlural}.",values:{entityNamePlural:a}}),cancelBtnLabel:E.i18n.translate("contentManagement.tableList.listing.deleteSelectedItemsConfirmModal.cancelButtonLabel",{defaultMessage:"Cancel"})}}(t,a,i)),[a,i,t]);return Object(g.jsx)(S.EuiConfirmModal,{title:c,buttonColor:"danger",onCancel:s,onConfirm:o,cancelButtonText:d,confirmButtonText:e?l:r,defaultFocusedButton:"cancel"},Object(g.jsx)("p",null,u))}function Te({entityNamePlural:e,totalItems:t,listingLimit:a,canEditAdvancedSettings:n,advancedSettingsLink:s}){return Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.listingLimitExceededTitle",defaultMessage:"Listing limit exceeded"}),color:"warning",iconType:"help"},Object(g.jsx)("p",null,Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.listingLimitExceededDescription",defaultMessage:"You have {totalItems} {entityNamePlural}, but your {listingLimitText} setting prevents the table below from displaying more than {listingLimitValue}.",values:{entityNamePlural:e,totalItems:t,listingLimitValue:a,listingLimitText:Object(g.jsx)("strong",null,"listingLimit")}})," ",n?Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.listingLimitExceededDescriptionPermissions",defaultMessage:"You can change this setting under {advancedSettingsLink}.",values:{advancedSettingsLink:Object(g.jsx)(S.EuiLink,{href:s},Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.listingLimitExceeded.advancedSettingsLinkText",defaultMessage:"Advanced Settings"}))}}):Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.listingLimitExceededDescriptionNoPermissions",defaultMessage:"Contact your system administrator to change this setting."}))),Object(g.jsx)(S.EuiSpacer,{size:"m"}))}const Me=navigator.platform.toLowerCase().indexOf("mac")>=0,Le=({tag:e,onClick:t})=>Object(g.jsx)(S.EuiBadge,{color:e.color,title:e.description,"data-test-subj":`tag-${e.id}`,onClick:a=>{const n=Me&&a.metaKey||!Me&&a.ctrlKey;t(e,n)},onClickAriaLabel:E.i18n.translate("contentManagement.tableList.tagBadge.buttonLabel",{defaultMessage:"{tagName} tag button.",values:{tagName:e.name}})},e.name),Pe=e=>e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&");function _e({id:e,item:t,searchTerm:a="",getDetailViewLink:s,onClickTitle:o,onClickTag:r}){const{references:l,attributes:{title:c,description:u}}=t,{navigateToUrl:d,currentAppId$:p,TagList:b,itemHasTags:f}=de(),m=Object(n.useMemo)((()=>({application:{navigateToUrl:d,currentAppId$:p}})),[p,d]),v=Object(n.useMemo)((()=>{if(o)return e=>{e.preventDefault(),o(t)}}),[t,o]),j=Object(n.useCallback)((()=>(s?s(t):void 0)||o?Object(g.jsx)(V.a,{coreStart:m},Object(g.jsx)(S.EuiLink,{href:s?s(t):void 0,onClick:v,"data-test-subj":`${e}ListingTitleLink-${t.attributes.title.split(" ").join("-")}`},Object(g.jsx)(S.EuiHighlight,{highlightAll:!0,search:Pe(a)},c))):Object(g.jsx)("span",null,c)),[s,e,t,o,v,m,a,c]),h=f(l);return Object(g.jsx)("div",null,Object(g.jsx)(S.EuiText,{size:"s"},j()),Boolean(u)&&Object(g.jsx)(S.EuiText,{size:"s",color:"subdued"},Object(g.jsx)("p",null,Object(g.jsx)(S.EuiHighlight,{highlightAll:!0,search:Pe(a)},u))),h&&Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(b,{references:l,tagRender:e=>Object(g.jsx)(Le,{key:e.name,tag:e,onClick:r})})))}var Ae=a(77),Ie=a.n(Ae);const Ne=e=>{var t;const a={},n={...e};if(["s","title","sort","sortdir"].forEach((e=>{Array.isArray(n[e])&&(n[e]=n[e][0])})),a.s=null!==(t=n.s)&&void 0!==t?t:n.title,"title"===n.sort||"updatedAt"===n.sort){const e="title"===n.sort?"attributes.title":"updatedAt";a.sort={field:e,direction:"asc"},"desc"!==n.sortdir&&"asc"!==n.sortdir||(a.sort.direction=n.sortdir)}return a},De=e=>{const t={};return e.sort&&(t.sort=e.sort.field,t.sortdir=e.sort.direction),void 0!==e.s&&(t.s=e.s,t.title=void 0),"string"==typeof t.s&&""===t.s.trim()&&(t.s=void 0,t.title=void 0),t},Fe={title:{field:"attributes.title",name:"Name, description, tags"},updatedAt:{field:"updatedAt",name:"Last updated"}};function ze({tableCaption:e,entityName:t,entityNamePlural:a,initialFilter:s,headingId:o,initialPageSize:r,listingLimit:u,urlStateEnabled:d=!0,customTableColumn:p,emptyPrompt:b,rowItemActions:f,findItems:m,createItem:v,editItem:j,showEditActionForItem:x,deleteItems:O,getDetailViewLink:w,onClickTitle:k,id:T="userContent",contentEditor:M={enabled:!1},titleColumnName:L,withoutPageTemplateWrapper:P,onFetchSuccess:_,refreshListBouncer:A,setPageDataTestSubject:I}){if(Object(n.useEffect)((()=>{I(`${t}LandingPage`)}),[t,I]),!w&&!k)throw new Error('[TableListView] One o["getDetailViewLink" or "onClickTitle"] prop must be provided.');if(w&&k)throw new Error('[TableListView] Either "getDetailViewLink" or "onClickTitle" can be provided. Not both.');if(!1===M.isReadonly&&void 0===M.onSave)throw new Error("[TableListView] A value for [contentEditor.onSave()] must be provided when [contentEditor.isReadonly] is false.");const N=Object(n.useRef)(!1),D=Object(n.useRef)(0),F=Object(n.useRef)(0),z=Object(n.useRef)(!1),{canEditAdvancedSettings:V,getListingLimitSettingsUrl:B,getTagIdsFromReferences:R,searchQueryParser:U,notifyError:H,DateFormatterComp:$,getTagList:G}=de(),q=function(){const e=function(){const e=Object(n.useContext)(ie);if(!e)throw new Error("ContentEditorContext is missing. Ensure your component or React root is wrapped with or .");return e}(),{openFlyout:t}=e,a=Object(n.useRef)(null);return Object(n.useCallback)((n=>{if(!1===n.isReadonly&&void 0===n.onSave)throw new Error("A value for [onSave()] must be provided when [isReadonly] is false.");const i=()=>{var e;null===(e=a.current)||void 0===e||e.close()};return a.current=t(Object(g.jsx)(re,l()({},n,{onCancel:i,services:e})),{maxWidth:600,size:"m",ownFocus:!0,hideCloseButton:!0}),i}),[t,e])}();if(!function(){try{return Object(c.useLocation)(),!0}catch(e){return!1}}())throw new Error(" requires a React Router context. Ensure your component or React root is being rendered in the context of a .");const[Q,K]=function({queryParamsDeserializer:e,queryParamsSerializer:t}){const a=Object(c.useHistory)(),i=function(){const{search:e}=Object(c.useLocation)();return Object(n.useMemo)((()=>Ie.a.parse(e)),[e])}(),[s,o]=Object(n.useState)({}),r=Object(n.useCallback)((e=>{const n=t(e),s={...i,...n};a.replace({search:`?${Ie.a.stringify(s,{encode:!1})}`})}),[a,i,t]);return Object(n.useEffect)((()=>{const t=e(i);o(t)}),[i,e]),[s,r]}({queryParamsDeserializer:Ne,queryParamsSerializer:De}),W=Object(n.useMemo)((()=>function(){let e=!1;return(t,a)=>{switch(a.type){case"onFetchItems":return{...t,isFetchingItems:!0};case"onFetchItemsSuccess":{var n;const i=a.data.response.hits;let s,o=t.hasUpdatedAtMetadata;t.hasInitialFetchReturned||(o=Boolean(i.find((e=>Boolean(e.updatedAt)))),o&&!e&&(s={field:"updatedAt",direction:"desc"}));let r=t.hasNoItems;return r=""!==t.searchQuery.text?void 0:0===i.length,{...t,hasInitialFetchReturned:!0,isFetchingItems:!1,items:i,hasNoItems:r,totalItems:a.data.response.total,hasUpdatedAtMetadata:o,tableSort:null!==(n=s)&&void 0!==n?n:t.tableSort,pagination:{...t.pagination,totalItemCount:i.length}}}case"onFetchItemsError":return{...t,isFetchingItems:!1,items:[],totalItems:0,fetchError:a.data};case"onSearchQueryChange":return a.data.text===t.searchQuery.text?t:{...t,searchQuery:a.data,isFetchingItems:!0};case"onTableChange":{var i,s,o,r,l;a.data.sort&&(e=!0);const n=null!==(i=a.data.sort)&&void 0!==i?i:t.tableSort,c=null!==(s=null===(o=a.data.page)||void 0===o?void 0:o.pageIndex)&&void 0!==s?s:t.pagination.pageIndex,u=null!==(r=null===(l=a.data.page)||void 0===l?void 0:l.pageSize)&&void 0!==r?r:t.pagination.pageSize;return{...t,pagination:{...t.pagination,pageIndex:c,pageSize:u},tableSort:n}}case"showConfirmDeleteItemsModal":return{...t,showDeleteModal:!0};case"onDeleteItems":return{...t,isDeletingItems:!0};case"onCancelDeleteItems":return{...t,showDeleteModal:!1};case"onItemsDeleted":return{...t,isDeletingItems:!1,selectedIds:[],showDeleteModal:!1};case"onSelectionChange":return{...t,selectedIds:a.data.map((e=>null==e?void 0:e.id)).filter((e=>Boolean(e)))}}}}()),[]),X=Object(n.useMemo)((()=>({items:[],hasNoItems:void 0,totalItems:0,hasInitialFetchReturned:!1,isFetchingItems:!0,isDeletingItems:!1,showDeleteModal:!1,hasUpdatedAtMetadata:!1,selectedIds:[],searchQuery:{text:"",query:new S.Query(S.Ast.create([]),void 0,"")},pagination:{pageIndex:0,totalItemCount:0,pageSize:r,pageSizeOptions:Object(h.uniq)([10,20,50,r]).sort()},tableSort:{field:"attributes.title",direction:"asc"}})),[r]),[Y,J]=Object(n.useReducer)(W,X),{searchQuery:Z,hasInitialFetchReturned:ee,isFetchingItems:te,items:ae,hasNoItems:se,fetchError:oe,showDeleteModal:le,isDeletingItems:ce,selectedIds:ue,totalItems:pe,hasUpdatedAtMetadata:be,pagination:ge,tableSort:fe}=Y,me=Boolean(oe),ve=!me&&pe>u,je=Object(n.useCallback)((async()=>{J({type:"onFetchItems"});try{const e=++D.current,{searchQuery:t,references:a,referencesToExclude:n}=U?await U(Z.text):{searchQuery:Z.text,references:void 0,referencesToExclude:void 0},i=await m(t,{references:a,referencesToExclude:n});if(!N.current)return;e===D.current&&(J({type:"onFetchItemsSuccess",data:{response:i}}),_())}catch(e){J({type:"onFetchItemsError",data:e})}}),[U,Z.text,m,_]),he=Object(n.useCallback)((e=>{d?K({s:e.text}):J({type:"onSearchQueryChange",data:{query:e,text:e.text}})}),[d,K]),{addOrRemoveIncludeTagFilter:xe,addOrRemoveExcludeTagFilter:Oe,clearTagSelection:we,tagsToTableItemMap:Ce}=function({query:e,updateQuery:t,items:a}){const i=Object(n.useMemo)((()=>a.reduce(((e,t)=>{const a=t.references.filter((e=>"tag"===e.type));return a.length>0&&a.forEach((a=>{e[a.id]||(e[a.id]=[]),e[a.id].push(t.id)})),e}),{})),[a]),s=Object(n.useCallback)((a=>(n,i=e,s=!0)=>{const o=a(i,n);return s&&t(o),o}),[e,t]),o=Object(n.useCallback)((t=>(a,n)=>{const i=Boolean(n)?n:e;if(i.ast.getFieldClauses("tag")){var s;const e=null===(s=i.ast.getFieldClauses("tag").find((({match:e})=>e===t)))||void 0===s?void 0:s.value;if(e&&e.includes(a.name))return!0}return!1}),[e]),r=Object(n.useMemo)((()=>s(((e,t)=>e.addOrFieldValue("tag",t.name,!0,"eq")))),[s]),l=Object(n.useMemo)((()=>s(((e,t)=>e.removeOrFieldValue("tag",t.name)))),[s]),c=Object(n.useMemo)((()=>s(((e,t)=>e.addOrFieldValue("tag",t.name,!1,"eq")))),[s]),u=Object(n.useMemo)((()=>s(((e,t)=>e.removeOrFieldValue("tag",t.name)))),[s]),d=Object(n.useMemo)((()=>o("must")),[o]),p=Object(n.useMemo)((()=>o("must_not")),[o]);return{addOrRemoveIncludeTagFilter:Object(n.useCallback)((e=>{let t;if(p(e))t=u(e,void 0,!1);else if(d(e,t))return void l(e,t);r(e,t)}),[p,d,u,r,l]),addOrRemoveExcludeTagFilter:Object(n.useCallback)((e=>{let t;d(e)&&(t=l(e,void 0,!1)),p(e,t)?u(e,t):c(e,t)}),[d,p,l,c,u]),clearTagSelection:Object(n.useCallback)((()=>{const a=e.removeOrFieldClauses("tag");return t(a),t}),[e,t]),tagsToTableItemMap:i}}({query:Z.query,updateQuery:he,items:ae}),Se=Object(n.useCallback)((e=>{const a=R(e.references).map((t=>e.references.find((({id:e})=>e===t)))),n=q({item:{id:e.id,title:e.attributes.title,description:e.attributes.description,tags:a},entityName:t,...M,onSave:M.onSave&&(async e=>{await M.onSave(e),await je(),n()})})}),[R,q,t,M,je]),Me=Object(n.useMemo)((()=>{const e=[{field:Fe.title.field,name:null!=L?L:E.i18n.translate("contentManagement.tableList.mainColumnName",{defaultMessage:"Name, description, tags"}),sortable:!0,render:(e,t)=>Object(g.jsx)(_e,{id:T,item:t,getDetailViewLink:w,onClickTitle:k,onClickTag:(e,t)=>{t?Oe(e):xe(e)},searchTerm:Z.text})}];if(p&&e.push(p),be&&e.push({field:Fe.updatedAt.field,name:E.i18n.translate("contentManagement.tableList.lastUpdatedColumnTitle",{defaultMessage:"Last updated"}),render:(e,t)=>Object(g.jsx)(Ee,{dateTime:t.updatedAt,DateFormatterComp:$}),sortable:!0,width:"150px"}),j||!1!==M.enabled){const t=[];j&&t.push({name:e=>E.i18n.translate("contentManagement.tableList.listing.table.editActionName",{defaultMessage:"Edit {itemDescription}",values:{itemDescription:Object(h.get)(e,"attributes.title")}}),description:E.i18n.translate("contentManagement.tableList.listing.table.editActionDescription",{defaultMessage:"Edit"}),icon:"pencil",type:"icon",available:e=>!x||x(e),enabled:e=>!(null!=e&&e.error),onClick:j,"data-test-subj":"edit-action"}),!1!==M.enabled&&t.push({name:e=>E.i18n.translate("contentManagement.tableList.listing.table.viewDetailsActionName",{defaultMessage:"View {itemTitle} details",values:{itemTitle:Object(h.get)(e,"attributes.title")}}),description:E.i18n.translate("contentManagement.tableList.listing.table.viewDetailsActionDescription",{defaultMessage:"View details"}),icon:"iInCircle",type:"icon",onClick:Se,"data-test-subj":"inspect-action"}),e.push({name:E.i18n.translate("contentManagement.tableList.listing.table.actionTitle",{defaultMessage:"Actions"}),width:"100px",actions:t})}return e}),[L,p,be,j,T,w,k,Z.text,xe,Oe,$,M,Se,x]),Le=Object(n.useMemo)((()=>Object(h.keyBy)(ae,"id")),[ae]),Pe=Object(n.useMemo)((()=>ue.map((e=>Le[e]))),[ue,Le]),Ae=Object(n.useMemo)((()=>ae.reduce(((e,t)=>({...e,[t.id]:f?f(t):void 0})),{})),[ae,f]),ze=Object(n.useCallback)((async e=>{let t=S.Ast.create([]),a=e;if(U){const{references:n,referencesToExclude:i,searchQuery:s}=await U(e);if(a=s,null!=n&&n.length||null!=i&&i.length){const e=G();null!=n&&n.length&&n.forEach((({id:a})=>{const n=e.find((({id:e})=>e===a));n&&(t=t.addOrFieldValue("tag",n.name,!0,"eq"))})),null!=i&&i.length&&i.forEach((({id:a})=>{const n=e.find((({id:e})=>e===a));n&&(t=t.addOrFieldValue("tag",n.name,!1,"eq"))}))}}return""!==a.trim()&&(t=t.addClause({type:"term",value:a,match:"must"})),new S.Query(t,void 0,e)}),[G,U]),Ve=Object(n.useCallback)((e=>{if(e.query)he(e.query);else{const t=F.current+1;ze(e.queryText).then((e=>{t===F.current&&he(e)}))}}),[he,ze]),Be=Object(n.useCallback)((e=>{e.sort&&d&&K({sort:{field:"attributes.title"===e.sort.field?"title":e.sort.field,direction:e.sort.direction}}),!e.page&&d||J({type:"onTableChange",data:e})}),[K,d]),Re=Object(n.useCallback)(((e,t)=>{Be({sort:{field:e,direction:t}})}),[Be]),Ue=Object(n.useCallback)((e=>{const t={};if(e.sort){let a=e.sort.field;a===Fe.title.name?a=Fe.title.field:a===Fe.updatedAt.name&&(a=Fe.updatedAt.field),t.sort={field:a,direction:e.sort.direction}}t.page={pageIndex:e.page.index,pageSize:e.page.size},Be(t)}),[Be]),He=Object(n.useCallback)((async()=>{if(!ce){J({type:"onDeleteItems"});try{await O(Pe)}catch(e){H(Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.unableToDeleteDangerMessage",defaultMessage:"Unable to delete {entityName}(s)",values:{entityName:t}}),e)}je(),J({type:"onItemsDeleted"})}}),[O,t,je,ce,H,Pe]),$e=Object(n.useCallback)((()=>{if(v)return Object(g.jsx)(S.EuiButton,{onClick:v,"data-test-subj":"newItemButton",iconType:"plusInCircleFilled",fill:!0},Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.createNewItemButtonLabel",defaultMessage:"Create {entityName}",values:{entityName:t}}))}),[v,t]),Ge=Object(n.useCallback)((()=>b||Object(g.jsx)(S.EuiEmptyPrompt,{title:Object(g.jsx)("h1",null,Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.noAvailableItemsMessage",defaultMessage:"No {entityNamePlural} available.",values:{entityNamePlural:a}})),actions:$e()})),[b,a,$e]),qe=Object(n.useCallback)((()=>{var e;return Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.fetchErrorTitle",defaultMessage:"Fetching listing failed"}),color:"danger",iconType:"warning"},Object(g.jsx)("p",null,Object(g.jsx)(y.FormattedMessage,{id:"contentManagement.tableList.listing.fetchErrorDescription",defaultMessage:"The {entityName} listing could not be fetched: {message}.",values:{entityName:t,message:(null===(e=oe.body)||void 0===e?void 0:e.message)||oe.message}}))),Object(g.jsx)(S.EuiSpacer,{size:"m"}))}),[t,oe]);C()(je,300,[je,A]),Object(n.useEffect)((()=>{var e;d&&((async(e="")=>{const t=await ze(e);J({type:"onSearchQueryChange",data:{query:t,text:e}})})(Q.s),(e=Q.sort)&&J({type:"onTableChange",data:{sort:{field:e.field,direction:e.direction}}}))}),[Q,ze,d]),Object(n.useEffect)((()=>(N.current=!0,()=>{N.current=!1})),[]),Object(n.useEffect)((()=>{s&&!z.current&&(z.current=!0,ze(s).then(he))}),[s,ze,he]);const Qe=Object(n.useMemo)((()=>P?({children:e,"data-test-subj":t})=>Object(g.jsx)("div",{"data-test-subj":t},e):ne),[P]);if(!ee)return null;if(!me&&se)return Object(g.jsx)(Qe,{panelled:!0,isEmptyState:!0},Object(g.jsx)(ne.Section,{"aria-labelledby":ee?o:void 0},Ge()));const Ke=ce?"table-is-deleting":ee&&!te?"table-is-ready":"table-is-loading";return Object(g.jsx)(i.a.Fragment,null,ve&&Object(g.jsx)(Te,{canEditAdvancedSettings:V,advancedSettingsLink:B(),entityNamePlural:a,totalItems:pe,listingLimit:u}),me&&qe(),Object(g.jsx)("div",{"data-test-subj":Ke},Object(g.jsx)(ye,{dispatch:J,items:ae,renderCreateButton:$e,isFetchingItems:te,searchQuery:Z,tableColumns:Me,hasUpdatedAtMetadata:be,tableSort:fe,tableItemsRowActions:Ae,pagination:ge,selectedIds:ue,entityName:t,entityNamePlural:a,tagsToTableItemMap:Ce,deleteItems:O,tableCaption:e,onTableChange:Ue,onTableSearchChange:Ve,onSortChange:Re,addOrRemoveIncludeTagFilter:xe,addOrRemoveExcludeTagFilter:Oe,clearTagSelection:we}),le&&Object(g.jsx)(ke,{isDeletingItems:ce,entityName:t,entityNamePlural:a,items:Pe,onConfirm:He,onCancel:()=>J({type:"onCancelDeleteItems"})})))}const Ve=i.a.memo(ze);a(133);var Be=a(7),Re=a(94);function Ue({href:e}){return Object(g.jsx)("dl",null,Object(g.jsx)(S.EuiTitle,{size:"xxs"},Object(g.jsx)("dt",{className:"eui-displayInline"},Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.learnMore",defaultMessage:"Want to learn more?"})))," ",Object(g.jsx)("dd",{className:"eui-displayInline"},Object(g.jsx)(S.EuiLink,{href:e,target:"_blank",external:!0},Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.readDocumentation",defaultMessage:"Read the docs"}))))}const He=E.i18n.translate("sharedUXPackages.noDataViewsPrompt.addDataViewText",{defaultMessage:"Create data view"}),$e=({onClickCreate:e,canCreateNewDataView:t,dataViewsDocLink:n,emptyPromptColor:s="plain"})=>{const o=t&&Object(g.jsx)(S.EuiButton,{onClick:e,iconType:"plusInCircle",fill:!0,"data-test-subj":"createDataViewButton"},He),r=t?Object(g.jsx)("h2",null,Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.youHaveData",defaultMessage:"You have data in Elasticsearch."}),Object(g.jsx)("br",null),Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.nowCreate",defaultMessage:"Now, create a data view."})):Object(g.jsx)("h2",null,Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.noPermission.title",defaultMessage:"You need permission to create data views"})),l=t?Object(g.jsx)("p",null,Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.dataViewExplanation",defaultMessage:"Data views identify the Elasticsearch data you want to explore. You can point data views to one or more data streams, indices, and index aliases, such as your log data from yesterday, or all indices that contain your log data."})):Object(g.jsx)("p",null,Object(g.jsx)(y.FormattedMessage,{id:"sharedUXPackages.noDataViewsPrompt.noPermission.dataViewExplanation",defaultMessage:"Data views identify the Elasticsearch data that you want to explore. To create data views, ask your administrator for the required permissions."})),c=n?Object(g.jsx)(Ue,{href:n}):void 0,u=Object(Re.c)(i.a.lazy((()=>a.e(9).then(a.bind(null,181)).then((({DataViewIllustration:e})=>({default:e}))))),Object(g.jsx)(S.EuiPanel,{color:"subdued",style:{width:226,height:206}})),d=Object(g.jsx)(u,null);return Object(g.jsx)(S.EuiEmptyPrompt,{"data-test-subj":"noDataViewsPrompt",layout:"horizontal",css:Object(g.css)("max-width:",830,"px!important;flex-grow:0;",""),color:s,actions:o,icon:d,title:r,body:l,footer:c})},Ge=i.a.createContext(null),qe=({children:e,...t})=>{var a;return Object(g.jsx)(Ge.Provider,{value:{dataViewsDocLink:null===(a=t.coreStart.docLinks.links.indexPatterns)||void 0===a?void 0:a.introduction,canCreateNewDataView:t.dataViewEditor.userPermissions.editDataView(),openDataViewEditor:t.dataViewEditor.openEditor}},e)},Qe=({onDataViewCreated:e,allowAdHocDataView:t=!1})=>{const{canCreateNewDataView:a,openDataViewEditor:i,dataViewsDocLink:s}=function(){const e=Object(n.useContext)(Ge);if(!e)throw new Error("NoDataViewsPromptContext is missing. Ensure your component or React root is wrapped with NoDataViewsPromptProvider.");return e}(),o=Object(n.useRef)();Object(n.useEffect)((()=>()=>{null!=o&&o.current&&(null==o||o.current())}),[]);const r=Object(n.useCallback)((e=>{o.current=e}),[]),l=Object(n.useCallback)((()=>{if(!a)return;const n=i({onSave:t=>{e(t)},allowAdHocDataView:t});r&&r(n)}),[a,i,t,r,e]);return Object(g.jsx)($e,{onClickCreate:l,canCreateNewDataView:a,dataViewsDocLink:s})},Ke=i.a.createContext(null),We=({children:e,...t})=>{const{dataViews:a}=t,n={hasESData:a.hasData.hasESData,hasUserDataView:a.hasData.hasUserDataView};return Object(g.jsx)(Ke.Provider,{value:n},Object(g.jsx)(qe,t,Object(g.jsx)(W,t,e)))};var Xe={name:"y1f223",styles:"margin:auto"},Ye={name:"y1f223",styles:"margin:auto"};const Je=({onDataViewCreated:e,noDataConfig:t,allowAdHocDataView:a,showPlainSpinner:i})=>{const s=function(){const e=Object(n.useContext)(Ke);if(!e)throw new Error("KibanaNoDataPageContext is missing. Ensure your component or React root is wrapped with KibanaNoDataPageContext.");return e}(),{hasESData:o,hasUserDataView:r}=s,[l,c]=Object(n.useState)(!0),[u,d]=Object(n.useState)(!1),[p,b]=Object(n.useState)(!1);return Object(n.useEffect)((()=>{(async()=>{d(await o()),b(await r()),c(!1)})().catch((()=>{c(!1)}))}),[o,r]),l?i?Object(g.jsx)(S.EuiLoadingSpinner,{css:Xe,size:"xxl"}):Object(g.jsx)(S.EuiLoadingElastic,{css:Ye,size:"xxl"}):!p&&u?Object(g.jsx)(Qe,{onDataViewCreated:e,allowAdHocDataView:a}):u?null:Object(g.jsx)(Z,{noDataConfig:t})},Ze=i.a.createContext(null),et=({children:e,...t})=>{const a={kibanaGuideDocLink:t.coreStart.docLinks.links.kibana.guide,customBranding:{hasCustomBranding$:t.coreStart.customBranding.hasCustomBranding$}};return Object(g.jsx)(Ze.Provider,{value:a},Object(g.jsx)(We,t,e))};var tt=a(91),at=a.n(tt);const nt=E.i18n.translate("sharedUXPackages.noDataConfig.analytics",{defaultMessage:"Analytics"}),it=E.i18n.translate("sharedUXPackages.noDataConfig.analyticsPageTitle",{defaultMessage:"Welcome to Analytics!"}),st=E.i18n.translate("sharedUXPackages.noDataConfig.addIntegrationsTitle",{defaultMessage:"Add integrations"}),ot=E.i18n.translate("sharedUXPackages.noDataConfig.addIntegrationsDescription",{defaultMessage:"Use Elastic Agent to collect data and build out Analytics solutions."}),rt=({kibanaGuideDocLink:e,onDataViewCreated:t,allowAdHocDataView:a,showPlainSpinner:n})=>{const i={solution:nt,pageTitle:it,logo:"logoKibana",action:{elasticAgent:{title:st,description:ot,"data-test-subj":"kbnOverviewAddIntegrations"}},docsLink:e};return Object(g.jsx)(Je,{noDataConfig:i,onDataViewCreated:t,allowAdHocDataView:a,showPlainSpinner:n})},lt=({onDataViewCreated:e,allowAdHocDataView:t})=>{var a;const i=function(){const e=Object(n.useContext)(Ze);if(!e)throw new Error("AnalyticsNoDataPage Context is missing. Ensure your component or React root is wrapped with AnalyticsNoDataPageContext.");return e}(),{kibanaGuideDocLink:s,customBranding:o}=i,{hasCustomBranding$:r}=o,l=null!==(a=at()(r))&&void 0!==a&&a;return Object(g.jsx)(rt,{onDataViewCreated:e,allowAdHocDataView:t,kibanaGuideDocLink:s,showPlainSpinner:l})};a(138);var ct=a(149),ut=a.n(ct),dt=a(148),pt=a.n(dt);const bt=({title:e,description:t,headingId:a,children:i,tabs:s,activeTabId:o,changeActiveTab:r})=>{const[l,c]=Object(n.useState)(!1),[u,d]=Object(n.useState)(),p=Object(n.useCallback)((()=>{var e;return null!==(e=s.find((e=>e.id===o)))&&void 0!==e?e:s[0]}),[o,s]),b=Object(n.useCallback)((()=>{c(!0)}),[]),[f,m]=Object(n.useState)(null);return Object(n.useEffect)((()=>{!async function(){const e=await p().getTableList({onFetchSuccess:b,setPageDataTestSubject:d});m(e)}()}),[o,s,p,b]),Object(g.jsx)(ne,{panelled:!0,"data-test-subj":u},Object(g.jsx)(ne.Header,{pageTitle:Object(g.jsx)("span",{id:a},e),description:t,"data-test-subj":"top-nav",tabs:s.map((e=>({onClick:()=>r(e.id),isSelected:e.id===p().id,label:e.title})))}),Object(g.jsx)(ne.Section,{"aria-labelledby":l?a:void 0},i,f))};var gt=a(10),ft=a(16),mt=a(13),vt=a(24),jt=a(28),ht=a(0),xt=a(51),Ot=a(6),yt=a(75),wt=a(3);const Ct=e=>{var t,a,n;return{id:e.id,updatedAt:e.updatedAt,references:e.references,type:e.savedObjectType,editUrl:e.editUrl,editApp:e.editApp,icon:e.icon,stage:e.stage,savedObjectType:e.savedObjectType,typeTitle:e.typeTitle,title:null!==(t=e.title)&&void 0!==t?t:"",error:null!==(a=e.error)&&void 0!==a?a:"",attributes:{title:null!==(n=e.title)&&void 0!==n?n:"",description:e.description,editApp:e.editApp,editUrl:e.editUrl,readOnly:e.readOnly,error:e.error}}},St=()=>{const{services:{application:e,executionContext:t,chrome:a,history:s,stateTransferService:o,dashboardCapabilities:r,uiSettings:u,kbnUrlStateStorage:d,listingViewRegistry:p,serverless:b}}=Object(O.useKibana)(),{pathname:f}=Object(c.useLocation)(),m=Object(n.useRef)((()=>{}));Object(O.useExecutionContext)(t,{type:"application",page:"list"}),Object(n.useEffect)((()=>{"/new"===f?m.current=Object(jt.a)({onClose:()=>{s.push(Ot.VisualizeConstants.LANDING_PAGE_PATH)}}):m.current()}),[s,f]),pt()((()=>{o.clearEditorState(),null!=b&&b.setBreadcrumbs?b.setBreadcrumbs([]):a.setBreadcrumbs([{text:E.i18n.translate("visualizations.visualizeListingBreadcrumbsTitle",{defaultMessage:"Visualize Library"})}]),a.docTitle.change(E.i18n.translate("visualizations.listingPageTitle",{defaultMessage:"Visualize Library"}))})),ut()((()=>m.current()));const v=u.get(xt.SAVED_OBJECTS_LIMIT_SETTING),j=u.get(xt.SAVED_OBJECTS_PER_PAGE_SETTING),h=((e,t)=>{const{services:{application:a,history:i,savedObjects:s,savedObjectsTagging:o,overlays:r,toastNotifications:l,visualizeCapabilities:c}}=Object(O.useKibana)(),u=Object(n.useRef)(),d=Object(n.useCallback)((()=>{e.current=Object(jt.a)()}),[e]),p=Object(n.useCallback)((({attributes:{editUrl:e,editApp:t}})=>{t?a.navigateToApp(t,{path:e}):i.push(e)}),[a,i]),b=Object(n.useMemo)((()=>Object(yt.d)(d)),[d]),g=Object(n.useCallback)(((e,{references:a,referencesToExclude:n}={})=>Object(gt.c)(Object(ht.o)(),e,t,a,n).then((({total:e,hits:t})=>{const a=t.map(Ct);return u.current=a,{total:e,hits:a}}))),[t]),f=Object(n.useCallback)((async e=>{var t;const a=null===(t=u.current)||void 0===t?void 0:t.find((({id:t})=>t===e.id));var n;a&&await(async(e,t,a,n)=>{const i=await mt.a.get(e),s=Object(ft.b)({attributes:i.item.attributes,references:i.item.references});let{references:o}=s;const r={...s.attributes,title:a.title,description:a.description};return n.savedObjectsTagging&&(o=n.savedObjectsTagging.ui.updateTagsReferences(o,a.tags||[])),await mt.a.update({id:e,data:{...r},options:{overwrite:!0,references:o}})})(a.id,a.type,{title:e.title,description:null!==(n=e.description)&&void 0!==n?n:"",tags:e.tags},{overlays:r,savedObjectsTagging:o})}),[r,o]),m=Object(n.useMemo)((()=>({title:[{type:"warning",async fn(e,t){if(t){var a;const n=null===(a=u.current)||void 0===a?void 0:a.find((e=>e.id===t));if(n)try{await Object(vt.a)({id:t,title:e,lastSavedTitle:n.title,getEsType:()=>n.type},!1,!1,(()=>{}),{overlays:r})}catch(t){return E.i18n.translate("visualizations.visualizeListingDeleteErrorTitle.duplicateWarning",{defaultMessage:'Saving "{value}" creates a duplicate title.',values:{value:e}})}}}}]})),[r]);return{findItems:g,deleteItems:Object(n.useCallback)((async e=>{await Promise.all(e.map((e=>s.client.delete(e.savedObjectType,e.id)))).catch((e=>{l.addError(e,{title:E.i18n.translate("visualizations.visualizeListingDeleteErrorTitle",{defaultMessage:"Error deleting visualization"})})}))}),[s.client,l]),contentEditor:{isReadonly:!c.save,onSave:f,customValidators:m},editItem:p,emptyPrompt:b,createItem:d,showEditActionForItem:({attributes:{readOnly:e}})=>c.save&&!e}})(m,v),x=E.i18n.translate("visualizations.listing.table.listTitle",{defaultMessage:"Visualize Library"}),w=Object(n.useMemo)((()=>{const t=Object(g.jsx)(y.FormattedMessage,{"data-test-subj":"visualize-dashboard-flow-prompt",id:"visualizations.visualizeListingDashboardFlowDescription",defaultMessage:"Building a dashboard? Create and add your visualizations right from the {dashboardApp}.",values:{dashboardApp:Object(g.jsx)(S.EuiLink,{className:"visListingCallout__link",onClick:t=>{t.preventDefault(),e.navigateToUrl(e.getUrlForApp("dashboards"))}},Object(g.jsx)(y.FormattedMessage,{id:"visualizations.visualizeListingDashboardAppName",defaultMessage:"Dashboard application"}))}});return{title:"Visualizations",id:"visualizations",getTableList:a=>Object(g.jsx)(i.a.Fragment,null,r.createNew&&Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{size:"s",title:t,iconType:"iInCircle"}),Object(g.jsx)(S.EuiSpacer,{size:"m"})),Object(g.jsx)(Ve,l()({id:"vis",customTableColumn:Object(yt.c)(),listingLimit:v,initialPageSize:j,initialFilter:"",entityName:E.i18n.translate("visualizations.listing.table.entityName",{defaultMessage:"visualization"}),entityNamePlural:E.i18n.translate("visualizations.listing.table.entityNamePlural",{defaultMessage:"visualizations"}),getDetailViewLink:({attributes:{editApp:t,editUrl:a,error:n,readOnly:i}})=>i?void 0:((e,t,a,n,i=undefined)=>{if(i)return;let s=e.getUrlForApp(null!=a?a:Ot.VISUALIZE_APP_NAME,{path:a?n:`#${n}`});const o=Object(ht.p)().get("state:storeInSessionStorage"),r=t.get(Ot.GLOBAL_STATE_STORAGE_KEY)||{};return s=Object(wt.setStateToKbnUrl)(Ot.GLOBAL_STATE_STORAGE_KEY,r,{useHash:o},s),s})(e,d,t,a,n),tableCaption:x},h,a)))}}),[e,r.createNew,j,d,v,h,x]),C=Object(n.useMemo)((()=>[w,...Array.from(p)]),[p,w]),{activeTab:k}=Object(c.useParams)();return Object(g.jsx)(bt,{headingId:"visualizeListingHeading",title:x,tabs:C,activeTabId:k,changeActiveTab:t=>{e.navigateToUrl(`#/${t}`)}})};a(82);var Et=a(78),kt=a(154),Tt=a.n(kt);const Mt=({currentAppState:e,isChromeVisible:t,isEmbeddableRendered:a,hasUnsavedChanges:i,setHasUnsavedChanges:s,hasUnappliedChanges:o,originatingApp:r,setOriginatingApp:l,originatingPath:c,visInstance:u,stateContainer:d,visualizationIdFromUrl:p,embeddableId:b,onAppLeave:f,eventEmitter:m})=>{var v;const{services:j}=Object(O.useKibana)(),{TopNavMenu:h}=j.navigation.ui,{setHeaderActionMenu:x,visualizeCapabilities:y}=j,{embeddableHandler:w,vis:C}=u,[S,k]=Object(n.useState)(),[T,M]=Object(n.useState)(!1),[L,P]=Object(n.useState)(!1),[_,A]=Tt()("EDIT_IN_LENS_BADGE_VISIBLE",!1),I=Object(n.useCallback)((()=>{A(!0)}),[A]),N=Object(n.useCallback)((()=>{const e=w.openInspector();k(e)}),[w]),D=Object(n.useCallback)((async()=>{j.data.search.session.start()}),[j.data.search.session]),F=Object(n.useCallback)(((e,t)=>{!1===t&&D()}),[D]);Object(n.useEffect)((()=>{const e=w.getExpressionVariables$().subscribe((e=>{P(Boolean(C.type.navigateToLens&&(null==e?void 0:e.canNavigateToLens)))}));return()=>{e.unsubscribe()}}),[w,C]);const z=Object(n.useMemo)((()=>{if(a)return Object(yt.e)({hasUnsavedChanges:i,setHasUnsavedChanges:s,hasUnappliedChanges:o,openInspector:N,originatingApp:r,setOriginatingApp:l,originatingPath:c,visInstance:u,stateContainer:d,visualizationIdFromUrl:p,stateTransfer:j.stateTransferService,embeddableId:b,displayEditInLensItem:L,hideLensBadge:I,setNavigateToLens:M,showBadge:!_&&L,eventEmitter:m},j)}),[a,i,s,o,N,r,l,c,u,d,p,j,b,L,I,_,m]),[V,B]=Object(n.useState)([]),R=()=>{const e=!C.data.indexPattern||!!C.data.indexPattern.timeFieldName;return C.type.options.showTimePicker&&e},U=C.type.options.showFilterBar,H=C.type.requiresSearch&&C.type.options.showQueryInput;Object(n.useEffect)((()=>()=>{S&&S.close()}),[S]),Object(n.useEffect)((()=>(f((e=>!r||!o&&!i||j.stateTransferService.isTransferInProgress||T?e.default():e.confirm(E.i18n.translate("visualizations.confirmModal.confirmTextDescription",{defaultMessage:"Leave Visualize editor with unsaved changes?"}),E.i18n.translate("visualizations.confirmModal.title",{defaultMessage:"Unsaved changes"})))),()=>{f((e=>e.default()))})),[f,r,i,o,y.save,j.stateTransferService.isTransferInProgress,T]),Object(n.useEffect)((()=>{(async()=>{let e;if(C.data.indexPattern?e=[C.data.indexPattern]:C.type.getUsedIndexPattern&&(e=await C.type.getUsedIndexPattern(C.params)),!e||!e.length){const t=await j.dataViews.getDefault();t&&(e=[t])}e&&B(e)})()}),[j.dataViews,C.data.indexPattern,C.params,C.type]),Object(n.useEffect)((()=>{const e=d.state$.subscribe((async({dataView:e})=>{if(e&&u.vis.data.indexPattern&&e!==u.vis.data.indexPattern.id){const t=await j.dataViews.get(e);t&&B([t])}}));return()=>{e.unsubscribe()}}),[j.dataViews,d.state$,u.vis.data.indexPattern]),Object(n.useEffect)((()=>{const e=j.data.query.timefilter.timefilter.getAutoRefreshFetch$().subscribe((async e=>{try{await D()}finally{e()}}));return()=>{e.unsubscribe()}}),[j.data.query.timefilter.timefilter,D]);const $=Boolean((null===(v=C.type.editorConfig)||void 0===v?void 0:v.enableDataViewChange)&&(C.data.indexPattern&&!C.data.savedSearchId||Object(yt.f)(C.data.indexPattern))&&V.length),G=Object(n.useCallback)((async e=>{e&&d.transitions.updateDataView(e)}),[d.transitions]),q=Object(yt.f)(C.data.indexPattern);return t?Object(g.jsx)(h,{appName:Ot.VISUALIZE_APP_NAME,config:z,setMenuMountPoint:x,onQuerySubmit:F,savedQueryId:e.savedQuery,onSavedQueryIdChange:d.transitions.updateSavedQuery,indexPatterns:V,screenTitle:C.title,showAutoRefreshOnly:!R(),showDatePicker:R(),showFilterBar:U,showQueryInput:H,showSaveQuery:Boolean(j.visualizeCapabilities.saveQuery),dataViewPickerComponentProps:$&&C.data.indexPattern?{currentDataViewId:C.data.indexPattern.id,trigger:{label:q?E.i18n.translate("visualizations.fallbackDataView.label",{defaultMessage:"{type} not found",values:{type:C.data.savedSearchId?E.i18n.translate("visualizations.search.label",{defaultMessage:"Search"}):E.i18n.translate("visualizations.dataView.label",{defaultMessage:"Data view"})}}):C.data.indexPattern.getName()},isMissingCurrent:q,onChangeDataView:G}:void 0,showSearchBar:!0,useDefaultBehaviors:!0}):U?Object(g.jsx)(h,{appName:Ot.VISUALIZE_APP_NAME,setMenuMountPoint:x,indexPatterns:V,showSearchBar:!0,showSaveQuery:!1,showDatePicker:!1,showQueryInput:!1}):null},Lt=Object(n.memo)(Mt),Pt=()=>{const e=Object(g.jsx)(y.FormattedMessage,{id:"visualizations.experimentalVisInfoTitle",defaultMessage:"This functionality is in technical preview."}),t=Object(g.jsx)(y.FormattedMessage,{id:"visualizations.experimentalVisInfoText",defaultMessage:"It may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. For feedback, please create an issue in {githubLink}.",values:{githubLink:Object(g.jsx)(S.EuiLink,{external:!0,href:"https://github.com/elastic/kibana/issues/new/choose",target:"_blank"},"GitHub")}});return Object(g.jsx)(S.EuiCallOut,{className:"hide-for-sharing","data-test-subj":"experimentalVisInfo",size:"s",title:e,iconType:"beaker"},t)},_t=Object(n.memo)(Pt),At={gauge:"gauge"},It={pie:"pie",controls:"input_control_vis"},Nt={[At.gauge]:"visualization:visualize:legacyGaugeChartsLibrary"},Dt=({canEditAdvancedSettings:e,advancedSettingsLink:t,mode:a="old"})=>Object(g.jsx)(i.a.Fragment,null,e&&Object(g.jsx)(y.FormattedMessage,{id:"visualizations.newChart.conditionalMessage.newLibrary",defaultMessage:"Switch to the {type} library in {link}",values:{link:Object(g.jsx)(S.EuiLink,{href:t},Object(g.jsx)(y.FormattedMessage,{id:"visualizations.newChart.conditionalMessage.advancedSettingsLink",defaultMessage:"Advanced Settings."})),type:"old"===a?E.i18n.translate("visualizations.newChart.libraryMode.old",{defaultMessage:"old"}):E.i18n.translate("visualizations.newChart.libraryMode.new",{defaultMessage:"new"})}})),Ft=({canEditAdvancedSettings:e})=>Object(g.jsx)(i.a.Fragment,null,!e&&Object(g.jsx)(y.FormattedMessage,{id:"visualizations.legacyCharts.conditionalMessage.noPermissions",defaultMessage:"Contact your system administrator to switch to the old library."})),zt={[At.gauge]:e=>Object(g.jsx)(y.FormattedMessage,{id:"visualizations.newGaugeChart.notificationMessage",defaultMessage:"The new gauge charts library does not yet support split chart aggregation. {conditionalMessage}",values:{conditionalMessage:Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(Dt,e),Object(g.jsx)(Ft,e))}}),[It.pie]:e=>Object(g.jsx)(y.FormattedMessage,{id:"visualizations.oldPieChart.notificationMessage",defaultMessage:"You are using the legacy charts library, which will be removed in a future version. {conditionalMessage}",values:{conditionalMessage:Object(g.jsx)(i.a.Fragment,null,Object(g.jsx)(Dt,e),Object(g.jsx)(Ft,e))}}),[It.controls]:e=>Object(g.jsx)(y.FormattedMessage,{id:"visualizations.controls.notificationMessage",defaultMessage:"Input controls are deprecated and will be removed in a future release. Use the new Controls to filter and interact with your dashboard data. "})},Vt=({chartType:e,chartConfigToken:t,mode:a})=>{const{services:n}=Object(O.useKibana)(),i=n.application.capabilities.advancedSettings.save,s=n.application.getUrlForApp("management",{path:`/kibana/settings?query=${t}`}),o=zt[e];return Object(g.jsx)(S.EuiCallOut,{"data-test-subj":"vizChartWarning",title:Object(g.jsx)(o,{advancedSettingsLink:s,canEditAdvancedSettings:i,mode:a}),iconType:"warning",color:"warning",size:"s"})},Bt=({visInstance:e,appState:t,currentAppState:a,isChromeVisible:i,hasUnsavedChanges:s,setHasUnsavedChanges:o,hasUnappliedChanges:r,isEmbeddableRendered:l,onAppLeave:c,originatingApp:u,originatingPath:d,setOriginatingApp:p,visualizationIdFromUrl:b,embeddableId:f,visEditorRef:m,eventEmitter:v})=>{var j,h,x,w,C,k,T,M,L,P,_,A,I;const{services:N}=Object(O.useKibana)();Object(n.useEffect)((()=>{!async function(){const t=null==e?void 0:e.savedVis.sharingSavedObjectProps;if(N.spaces&&"aliasMatch"===(null==t?void 0:t.outcome)){var a;const n=null==t?void 0:t.aliasTargetId,i=`${Object(xt.urlFor)(n)}${N.history.location.search}`;await N.spaces.ui.redirectLegacyUrl({path:i,aliasPurpose:t.aliasPurpose,objectNoun:E.i18n.translate("visualizations.legacyUrlConflict.objectNoun",{defaultMessage:"{visName} visualization",values:{visName:null==e||null===(a=e.vis)||void 0===a?void 0:a.type.title}})})}}()}),[null==e?void 0:e.savedVis.sharingSavedObjectProps,null==e||null===(j=e.vis)||void 0===j?void 0:j.type.title,N]);const D=Object(n.useCallback)((()=>{const t=null==e?void 0:e.savedVis.id,a=null==e?void 0:e.savedVis.sharingSavedObjectProps;if(N.spaces&&"conflict"===(null==a?void 0:a.outcome)&&t){var n;const i=null==a?void 0:a.aliasTargetId,s=`${Object(xt.urlFor)(i)}${N.history.location.search}`;return N.spaces.ui.components.getLegacyUrlConflict({objectNoun:E.i18n.translate("visualizations.legacyUrlConflict.objectNoun",{defaultMessage:"{visName} visualization",values:{visName:null==e||null===(n=e.vis)||void 0===n?void 0:n.type.title}}),currentObjectId:t,otherObjectId:i,otherObjectPath:s})}return null}),[null==e?void 0:e.savedVis,N,null==e||null===(h=e.vis)||void 0===h?void 0:h.type.title]),F=null==e?void 0:e.vis.type.name,z=(V=F,B=null==e||null===(x=e.vis)||void 0===x||null===(w=x.data)||void 0===w?void 0:w.aggs,(null!==(R={[At.gauge]:()=>null==B?void 0:B.aggs.some((e=>"group"===e.schema))}[V])&&void 0!==R?R:()=>null==B?void 0:B.aggs.some((e=>"split"===e.schema)))());var V,B,R;const U=Object.values(At),H=!!F&&U.includes(F),$=Object.values(It),G=!!F&&$.includes(F),q=F&&(H||G)?Nt[F]:void 0,Q=!q||Object(ht.p)().get(q);return Object(g.jsx)("div",{className:`app-container visEditor visEditor--${null==e?void 0:e.vis.type.name}`},e&&t&&a&&Object(g.jsx)(Lt,{currentAppState:a,hasUnsavedChanges:s,setHasUnsavedChanges:o,isChromeVisible:i,isEmbeddableRendered:l,hasUnappliedChanges:r,originatingApp:u,originatingPath:d,setOriginatingApp:p,visInstance:e,stateContainer:t,visualizationIdFromUrl:b,embeddableId:f,onAppLeave:c,eventEmitter:v}),"experimental"===(null==e||null===(C=e.vis)||void 0===C||null===(k=C.type)||void 0===k?void 0:k.stage)&&!(null!=e&&null!==(T=e.vis)&&void 0!==T&&null!==(M=T.type)&&void 0!==M&&M.isDeprecated)&&Object(g.jsx)(_t,null),!Q&&z&&H&&q&&F&&Object(g.jsx)(Vt,{chartType:F,chartConfigToken:q}),(Q&&G&&q&&F||(null==e||null===(L=e.vis)||void 0===L||null===(P=L.type)||void 0===P?void 0:P.isDeprecated))&&Object(g.jsx)(Vt,{chartType:F,chartConfigToken:null!=q?q:void 0,mode:"new"}),null==e||null===(_=e.vis)||void 0===_||null===(A=_.type)||void 0===A||null===(I=A.getInfoMessage)||void 0===I?void 0:I.call(A,e.vis),D(),e&&Object(g.jsx)(S.EuiScreenReaderOnly,null,Object(g.jsx)("h1",null,"savedVis"in e&&e.savedVis.id?Object(g.jsx)(y.FormattedMessage,{id:"visualizations.pageHeading",defaultMessage:"{chartName} {chartType} visualization",values:{chartName:e.savedVis.title,chartType:e.vis.type.title}}):Object(g.jsx)(y.FormattedMessage,{id:"visualizations.byValue_pageHeading",defaultMessage:"Visualization of type {chartType} embedded into {originatingApp} app",values:{chartType:e.vis.type.title,originatingApp:u||"dashboards"}}))),Object(g.jsx)("div",{className:i?"visEditor__content":"visualize",ref:m}))},Rt=({onAppLeave:e})=>{const{id:t}=Object(c.useParams)(),[a,i]=Object(n.useState)(),[s,o]=Object(n.useState)(),[r,l]=Object(n.useState)(),[u,d]=Object(n.useState)(),{services:p}=Object(O.useKibana)(),[b]=Object(n.useState)(new Et.EventEmitter),[f,m]=Object(n.useState)(!t),v=Object(yt.g)(p.chrome);Object(n.useEffect)((()=>{const{stateTransferService:e,data:t}=p,{originatingApp:a,searchSessionId:n,embeddableId:s,originatingPath:r,valueInput:c}=e.getIncomingEditorState(Ot.VisualizeConstants.APP_ID)||{};n?t.search.session.continue(n):t.search.session.start(),d(c),l(s),i(a),o(r)}),[p]);const{savedVisInstance:j,visEditorRef:h,visEditorController:x}=Object(yt.k)(p,b,v,a,t,u),y=(null==j?void 0:j.vis.type.title.toLowerCase().replace(" ","_"))||"";Object(O.useExecutionContext)(p.executionContext,{type:"application",page:"editor"+(y?`:${y}`:""),id:t||"new"});const{appState:w,hasUnappliedChanges:C}=Object(yt.m)(p,b,j),{isEmbeddableRendered:S,currentAppState:E}=Object(yt.i)(p,b,m,w,j,x);return Object(yt.j)(p,b,w,j),Object(yt.h)(p,b,w,j),Object(n.useEffect)((()=>()=>{b.removeAllListeners()}),[b,p]),Object(g.jsx)(Bt,{visInstance:j,appState:w,currentAppState:E,isChromeVisible:v,hasUnsavedChanges:f,hasUnappliedChanges:C,isEmbeddableRendered:S,originatingApp:a,setOriginatingApp:i,originatingPath:s,visualizationIdFromUrl:t,setHasUnsavedChanges:m,visEditorRef:h,onAppLeave:e,embeddableId:r,eventEmitter:b})};let Ut;const Ht=()=>{const{services:e}=Object(O.useKibana)();return Object(n.useEffect)((()=>{e.restorePreviousUrl();const{navigated:t}=e.urlForwarding.navigateToLegacyKibanaUrl(e.history.location.pathname+e.history.location.search);if(!t){const t=E.i18n.translate("visualizations.noMatchRoute.bannerTitleText",{defaultMessage:"Page not found"});Ut=e.overlays.banners.replace(Ut,Object(O.toMountPoint)(Object(g.jsx)(O.KibanaThemeProvider,{theme$:e.theme.theme$},Object(g.jsx)(S.EuiCallOut,{color:"warning",iconType:"iInCircle",title:t},Object(g.jsx)("p",null,Object(g.jsx)(y.FormattedMessage,{id:"visualizations.noMatchRoute.bannerText",defaultMessage:"Visualize application doesn't recognize this route: {route}.",values:{route:Object(g.jsx)(S.EuiLink,{href:window.location.href},e.history.location.pathname)}})))))),setTimeout((()=>{e.overlays.banners.remove(Ut)}),15e3),e.history.replace(Ot.VisualizeConstants.LANDING_PAGE_PATH)}}),[e]),null},$t=({onAppLeave:e})=>{const[t,a]=Object(n.useState)(),[i,s]=Object(n.useState)(),{services:o}=Object(O.useKibana)(),[r]=Object(n.useState)(new Et.EventEmitter),[l,c]=Object(n.useState)(!1),[u,d]=Object(n.useState)(),[p,b]=Object(n.useState)();Object(n.useEffect)((()=>{const{stateTransferService:e,history:t,data:n}=o,{originatingApp:i,embeddableId:r,valueInput:l,searchSessionId:c,originatingPath:u}=e.getIncomingEditorState(Ot.VisualizeConstants.APP_ID)||{};s(u),a(i),b(l),d(r),l||t.replace(Ot.VisualizeConstants.LANDING_PAGE_PATH),c?n.search.session.continue(c):n.search.session.start()}),[o]);const f=Object(yt.g)(o.chrome),{byValueVisInstance:m,visEditorRef:v,visEditorController:j}=Object(yt.l)(o,r,f,p,t,i),{appState:h,hasUnappliedChanges:x}=Object(yt.m)(o,r,m),{isEmbeddableRendered:y,currentAppState:w}=Object(yt.i)(o,r,c,h,m,j);return Object(yt.j)(o,r,h,m),Object(yt.h)(o,r,h,m),Object(n.useEffect)((()=>()=>{r.removeAllListeners()}),[r]),Object(g.jsx)(Bt,{visInstance:m,appState:h,currentAppState:w,isChromeVisible:f,hasUnsavedChanges:l,hasUnappliedChanges:x,isEmbeddableRendered:y,originatingApp:t,setOriginatingApp:a,originatingPath:i,setHasUnsavedChanges:c,visEditorRef:v,embeddableId:u,onAppLeave:e,eventEmitter:r})},Gt=({core:e,dataViews:t,dataViewEditor:a,onDataViewCreated:n})=>{const i={coreStart:e,dataViews:t,dataViewEditor:a};return Object(g.jsx)(et,i,Object(g.jsx)(lt,{onDataViewCreated:n}))},qt=({onAppLeave:e})=>{const{services:{data:{query:t,dataViews:a},core:i,kbnUrlStateStorage:s,dataViewEditor:o}}=Object(O.useKibana)(),{pathname:r}=Object(c.useLocation)(),[l,u]=Object(n.useState)(!1),[d,p]=Object(n.useState)(!0),b=Object(n.useCallback)((e=>{e&&u(!1)}),[]);return Object(n.useEffect)((()=>{const{stop:e}=Object(Be.syncGlobalQueryStateWithUrl)(t,s);return()=>e()}),[t,s,r]),Object(n.useEffect)((()=>{(async()=>{if(await a.hasData.hasUserDataView().catch((()=>!1)))return await a.getDefaultDataView()||u(!0),void p(!1);u(!0),p(!1)})()}),[a]),d?Object(g.jsx)("div",{className:"visAppLoadingWrapper"},Object(g.jsx)(S.EuiLoadingSpinner,{size:"xl"})):l?Object(g.jsx)(Gt,{core:i,dataViewEditor:o,dataViews:a,onDataViewCreated:b}):Object(g.jsx)(x,null,Object(g.jsx)(f,{exact:!0,path:`${Ot.VisualizeConstants.EDIT_BY_VALUE_PATH}`},Object(g.jsx)($t,{onAppLeave:e})),Object(g.jsx)(f,{path:[Ot.VisualizeConstants.CREATE_PATH,`${Ot.VisualizeConstants.EDIT_PATH}/:id`]},Object(g.jsx)(Rt,{onAppLeave:e})),Object(g.jsx)(f,{exact:!0,path:[Ot.VisualizeConstants.LANDING_PAGE_PATH,Ot.VisualizeConstants.WIZARD_STEP_1_PAGE_PATH,Ot.VisualizeConstants.LANDING_PAGE_PATH_WITH_TAB]},Object(g.jsx)(St,null)),Object(g.jsx)(Ht,null))},Qt=({element:e,onAppLeave:t},a)=>{Object(yt.b)(a.chrome,a.docLinks),a.visualizeCapabilities.save||Object(yt.a)(a.chrome);const n=Object(g.jsx)(O.KibanaThemeProvider,{theme$:a.theme.theme$},Object(g.jsx)(j,{history:a.history},Object(g.jsx)(O.KibanaContextProvider,{services:a},Object(g.jsx)(a.presentationUtil.ContextProvider,null,Object(g.jsx)(a.i18n.Context,null,Object(g.jsx)(ue,{core:a.core,toMountPoint:O.toMountPoint,savedObjectsTagging:a.savedObjectsTagging,FormattedRelative:y.FormattedRelative},Object(g.jsx)(qt,{onAppLeave:t})))))));return o.a.render(n,e),()=>o.a.unmountComponentAtNode(e)}}])]);