/*! 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.observabilityShared_bundle_jsonpfunction=window.observabilityShared_bundle_jsonpfunction||[]).push([[3],{74:function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return m}));var o,r=n(0),i=n.n(r),s=n(37),u=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},o(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a="html",p="svg",c=function(t,e){var n,o,r,i={};if(t===a)r=document.createElement("div");else{if(t!==p)throw new Error('Invalid element type "'+t+'" for createPortalNode: must be "html" or "svg".');r=document.createElementNS("http://www.w3.org/2000/svg","g")}if(e&&"object"==typeof e)for(var s=0,u=Object.entries(e.attributes);s.");e.replaceChild(h.element,r),n=e,o=r}},unmount:function(t){t&&t!==o||n&&o&&(n.replaceChild(o,h.element),n=void 0,o=void 0)}};return h},l=function(t){function e(e){var n=t.call(this,e)||this;return n.addPropsChannel=function(){Object.assign(n.props.node,{setPortalProps:function(t){n.setState({nodeProps:t})}})},n.state={nodeProps:n.props.node.getInitialPortalProps()},n}return u(e,t),e.prototype.componentDidMount=function(){this.addPropsChannel()},e.prototype.componentDidUpdate=function(){this.addPropsChannel()},e.prototype.render=function(){var t=this,e=this.props,n=e.children,o=e.node;return s.createPortal(r.Children.map(n,(function(e){return r.isValidElement(e)?r.cloneElement(e,t.state.nodeProps):e})),o.element)},e}(r.PureComponent),d=function(t){function e(e){var n=t.call(this,e)||this;return n.placeholderNode=r.createRef(),n.passPropsThroughPortal(),n}return u(e,t),e.prototype.passPropsThroughPortal=function(){var t=Object.assign({},this.props,{node:void 0});this.props.node.setPortalProps(t)},e.prototype.componentDidMount=function(){var t=this.props.node;this.currentPortalNode=t;var e=this.placeholderNode.current,n=e.parentNode;t.mount(n,e),this.passPropsThroughPortal()},e.prototype.componentDidUpdate=function(){var t=this.props.node;this.currentPortalNode&&t!==this.currentPortalNode&&(this.currentPortalNode.unmount(this.placeholderNode.current),this.currentPortalNode=t);var e=this.placeholderNode.current,n=e.parentNode;t.mount(n,e),this.passPropsThroughPortal()},e.prototype.componentWillUnmount=function(){this.props.node.unmount(this.placeholderNode.current)},e.prototype.render=function(){return r.createElement("div",{ref:this.placeholderNode})},e}(r.PureComponent),h=c.bind(null,a),f=(c.bind(null,p),n(3));function m({children:t,setHeaderActionMenu:e,theme$:n}){const o=Object(r.useMemo)((()=>h()),[]);return Object(r.useEffect)((()=>(e((t=>Object(f.toMountPoint)(i.a.createElement(d,{node:o}),{theme$:n})(t))),()=>{o.unmount(),e(void 0)})),[o,e,n]),i.a.createElement(l,{node:o},t)}}}]);