!function(e){function t(t){for(var n,r,a=t[0],o=t[1],s=0,l=[];s!!e&&"object"==typeof e&&"string"==typeof e.id&&"function"==typeof e.getInput&&"function"==typeof e.supportedTriggers;var a=n(0),o=n.n(a),s=n(13),d=n.n(s),l=n(7),u=n(8),c=n(6),p=n(19),b=n(17);const m=["lastReloadRequestTime","executionContext","searchSessionId","hidePanelTitles","disabledActions","disableTriggers","enhancements","syncColors","syncCursor","syncTooltips","viewMode","title","id"],h=["hidePanelTitles","disabledActions","disableTriggers","enhancements","syncColors","syncCursor","syncTooltips","title","id"],f=e=>Object(l.omit)(e,m),g=(e,t)=>{const{title:n,hidePanelTitles:i,...r}=Object(l.pick)(e,h),{title:a,hidePanelTitles:o,...s}=Object(l.pick)(t,h);return n===a&&Boolean(i)===Boolean(o)&&!!d()(r,s)};function v(e,t){var n;return e.hidePanelTitles?"":null!==(n=e.title)&&void 0!==n?n:t.defaultTitle}function y(e,t){var n;return e.hidePanelTitles?"":null!==(n=e.description)&&void 0!==n?n:t.defaultDescription}class embeddable_Embeddable{constructor(e,t,n){o()(this,"runtimeId",embeddable_Embeddable.runtimeId++),o()(this,"parent",void 0),o()(this,"isContainer",!1),o()(this,"deferEmbeddableLoad",!1),o()(this,"id",void 0),o()(this,"fatalError",void 0),o()(this,"output",void 0),o()(this,"input",void 0),o()(this,"inputSubject",new u.ReplaySubject(1)),o()(this,"outputSubject",new u.ReplaySubject(1)),o()(this,"input$",this.inputSubject.asObservable()),o()(this,"output$",this.outputSubject.asObservable()),o()(this,"renderComplete",new p.RenderCompleteDispatcher),o()(this,"parentSubscription",void 0),o()(this,"destroyed",!1),this.id=e.id,this.output={title:v(e,t),description:y(e,t),...this.reportsEmbeddableLoad()?{}:{loading:!1,rendered:!0},...t},this.input={viewMode:b.a.EDIT,...e},this.parent=n,this.inputSubject.next(this.input),this.outputSubject.next(this.output),n&&(this.parentSubscription=u.merge(n.getInput$(),n.getOutput$()).subscribe((()=>{if(!n.getInput().panels[this.id])return;const e=n.getInputForChild(this.id);this.onResetInput(e)}))),this.getOutput$().pipe(Object(c.map)((({title:e})=>e||"")),Object(c.distinctUntilChanged)()).subscribe((e=>this.renderComplete.setTitle(e)))}reportsEmbeddableLoad(){return!1}refreshInputFromParent(){if(!this.parent)return;if(!this.parent.getInput().panels[this.id])return;const e=this.parent.getInputForChild(this.id);this.onResetInput(e)}getIsContainer(){return!0===this.isContainer}getUpdated$(){return Object(u.merge)(this.getInput$().pipe(Object(c.skip)(1)),this.getOutput$().pipe(Object(c.skip)(1))).pipe(Object(c.debounceTime)(0))}getInput$(){return this.input$}getOutput$(){return this.output$}getOutput(){return this.output}async getExplicitInputIsEqual(e){const t=this.getExplicitInput();return g(e,t)&&d()(f(e),f(t))}getExplicitInput(){const e=this.getRoot();var t,n,i;return e.getIsContainer()&&null!==(t=null===(n=e.getInput().panels)||void 0===n||null===(i=n[this.id])||void 0===i?void 0:i.explicitInput)&&void 0!==t?t:this.getInput()}getPersistableInput(){return this.getExplicitInput()}getInput(){return this.input}getTitle(){var e;return null!==(e=this.output.title)&&void 0!==e?e:""}getDescription(){var e;return null!==(e=this.output.description)&&void 0!==e?e:""}getRoot(){let e=this;for(;e.parent;)e=e.parent;return e}updateInput(e){if(this.destroyed)throw new Error("Embeddable has been destroyed");this.parent?this.parent.updateInputForChild(this.id,e):this.onInputChanged(e)}render(e){if(this.renderComplete.setEl(e),this.renderComplete.setTitle(this.output.title||""),this.destroyed)throw new Error("Embeddable has been destroyed")}getInspectorAdapters(){}destroy(){this.destroyed=!0,this.inputSubject.complete(),this.outputSubject.complete(),this.parentSubscription&&this.parentSubscription.unsubscribe()}setInitializationFinished(){var e;this.deferEmbeddableLoad&&null!==(e=this.parent)&&void 0!==e&&e.isContainer&&this.parent.setChildLoaded(this)}updateOutput(e){const t={...this.output,...e};d()(this.output,t)||(this.output=t,this.outputSubject.next(this.output))}onFatalError(e){var t;this.fatalError=e,this.outputSubject.error(e),this.deferEmbeddableLoad&&null!==(t=this.parent)&&void 0!==t&&t.isContainer&&this.parent.setChildLoaded(this)}onResetInput(e){if(!d()(this.input,e)){const t=this.input.lastReloadRequestTime;this.input=e,this.inputSubject.next(e),this.updateOutput({title:v(this.input,this.output),description:y(this.input,this.output)}),t!==e.lastReloadRequestTime&&this.reload()}}onInputChanged(e){const t=Object(l.cloneDeep)({...this.input,...e});this.onResetInput(t)}supportedTriggers(){return[]}}o()(embeddable_Embeddable,"runtimeId",0);var _=n(3),E=n.n(_),j=n(25),O=n(1);function x({children:e,embeddable:t,error:n}){const[i,r]=Object(_.useState)(),a=Object(_.useRef)(null);return Object(_.useEffect)((()=>{var i,o;if(!a.current)return;const s=null!==(i=null==t||null===(o=t.catchError)||void 0===o?void 0:o.bind(t))&&void 0!==i?i:e;if(!s)return;const d=s("string"==typeof n?{message:n,name:""}:n,a.current);if(Object(l.isFunction)(d))return d;Object(j.isPromise)(d)?d.then(r):r(d)}),[e,t,n]),Object(O.jsx)("div",{ref:a},i)}const P=e=>{var t;return{isContainerType:null!==(t=e.isContainerType)&&void 0!==t&&t,canCreateNew:e.canCreateNew?e.canCreateNew.bind(e):()=>!0,getDefaultInput:e.getDefaultInput?e.getDefaultInput.bind(e):()=>({}),getExplicitInput:e.getExplicitInput?e.getExplicitInput.bind(e):()=>Promise.resolve({}),createFromSavedObject:e.createFromSavedObject?e.createFromSavedObject.bind(e):(t,n,i)=>{throw new Error(`Creation from saved object not supported by type ${e.type}`)},create:e.create.bind(e),type:e.type,isEditable:e.isEditable.bind(e),getDisplayName:e.getDisplayName.bind(e),getDescription:e.getDescription?e.getDescription.bind(e):()=>"",getIconType:e.getIconType?e.getIconType.bind(e):()=>"empty",savedObjectMetaData:e.savedObjectMetaData,telemetry:e.telemetry||((e,t)=>t),inject:e.inject||(e=>e),extract:e.extract||(e=>({state:e,references:[]})),migrations:e.migrations||{},grouping:e.grouping}};var I=n(31);function w(e){return Boolean(e.fatalError||void 0!==e.error)}n(46);class error_embeddable_ErrorEmbeddable extends embeddable_Embeddable{constructor(e,t,n){super(t,{},n),o()(this,"type","error"),o()(this,"error",void 0),this.error=e}reload(){}render(){const e="string"==typeof this.error?{message:this.error,name:""}:this.error;return Object(O.jsx)(I.a,{embeddable:this,error:e})}}var T=n(26),A=n.n(T);const C=e=>class WithEmbeddableSubscription extends E.a.Component{constructor(e){super(e),o()(this,"subscription",void 0),o()(this,"mounted",!1),this.state={input:this.props.embeddable.getInput(),output:this.props.embeddable.getOutput()}}componentDidMount(){this.mounted=!0,this.subscription=u.merge(this.props.embeddable.getOutput$(),this.props.embeddable.getInput$()).subscribe((()=>{this.mounted&&this.setState({input:this.props.embeddable.getInput(),output:this.props.embeddable.getOutput()})}))}componentWillUnmount(){this.mounted=!1,this.subscription&&this.subscription.unsubscribe()}render(){return Object(O.jsx)(e,A()({input:this.state.input,output:this.state.output},this.props))}};var M=n(4);class embeddable_root_EmbeddableRoot extends E.a.Component{constructor(e){super(e),o()(this,"root",void 0),o()(this,"alreadyMounted",!1),o()(this,"updateNode",(e=>{Object(j.isPromise)(e)?e.then(this.updateNode):this.setState({node:e})})),this.root=E.a.createRef(),this.state={}}componentDidMount(){var e,t;null!==(e=this.root)&&void 0!==e&&e.current&&this.props.embeddable&&(this.alreadyMounted=!0,this.updateNode(null!==(t=this.props.embeddable.render(this.root.current))&&void 0!==t?t:void 0))}componentDidUpdate(e){var t;let n=!1;var i;null!==(t=this.root)&&void 0!==t&&t.current&&this.props.embeddable&&!this.alreadyMounted&&(this.alreadyMounted=!0,this.updateNode(null!==(i=this.props.embeddable.render(this.root.current))&&void 0!==i?i:void 0),n=!0),!n&&this.root&&this.root.current&&this.props.embeddable&&this.alreadyMounted&&this.props.input&&(null==e?void 0:e.input)!==this.props.input&&this.props.embeddable.updateInput(this.props.input)}shouldComponentUpdate({embeddable:e,error:t,input:n,loading:i},{node:r}){return Boolean(t!==this.props.error||i!==this.props.loading||e!==this.props.embeddable||this.root&&this.root.current&&e&&!this.alreadyMounted||n!==this.props.input||r!==this.state.node)}render(){return Object(O.jsx)(E.a.Fragment,null,Object(O.jsx)("div",{ref:this.root},this.state.node),this.props.loading&&Object(O.jsx)(M.EuiLoadingSpinner,{"data-test-subj":"embedSpinner"}),this.props.error&&Object(O.jsx)(x,{embeddable:this.props.embeddable,error:this.props.error},(({message:e})=>Object(O.jsx)(M.EuiText,{"data-test-subj":"embedError"},e))))}}var R=n(18);function S({input:e,factory:t,onInputUpdated:n}){const[i,r]=Object(_.useState)(void 0),[a,o]=Object(_.useState)(!1),[s,d]=Object(_.useState)(),l=E.a.useRef(e);return Object(_.useEffect)((()=>{l.current=e}),[e]),Object(_.useEffect)((()=>{let e,n=!1;return r(void 0),o(!0),t.create(l.current).then((t=>{n?t&&t.destroy():(e=t,r(t))})).catch((e=>{n||d(null==e?void 0:e.message)})).finally((()=>{n||o(!1)})),()=>{n=!0,e&&e.destroy()}}),[t]),Object(_.useEffect)((()=>{if(!i)return;if(w(i))return;if(!n)return;const e=i.getInput$().subscribe((e=>{n(e)}));return()=>{e.unsubscribe()}}),[i,n]),[i,a,s]}const F=e=>function(e){return"factory"in e}(e)?Object(O.jsx)(k,e):Object(O.jsx)(embeddable_root_EmbeddableRoot,{embeddable:e.embeddable,input:e.input}),k=({factory:e,input:t,onInputUpdated:n})=>{const[i,r,a]=S({factory:e,input:t,onInputUpdated:n});return Object(O.jsx)(embeddable_root_EmbeddableRoot,{embeddable:i,loading:r,error:a,input:t})};var L=n(14),D=n(5);const N="CONTEXT_MENU_TRIGGER",B={id:N,title:D.i18n.translate("embeddableApi.contextMenuTrigger.title",{defaultMessage:"Context menu"}),description:D.i18n.translate("embeddableApi.contextMenuTrigger.description",{defaultMessage:"A new action will be added to the panel's context menu"})},z="PANEL_HOVER_TRIGGER",U={id:z,title:D.i18n.translate("embeddableApi.panelHoverTrigger.title",{defaultMessage:"Panel hover"}),description:D.i18n.translate("embeddableApi.panelHoverTrigger.description",{defaultMessage:"A new action will be added to the panel's hover menu"})},G="PANEL_BADGE_TRIGGER",$={id:G,title:D.i18n.translate("embeddableApi.panelBadgeTrigger.title",{defaultMessage:"Panel badges"}),description:D.i18n.translate("embeddableApi.panelBadgeTrigger.description",{defaultMessage:"Actions appear in title bar when an embeddable loads in a panel."})},V="PANEL_NOTIFICATION_TRIGGER",H={id:V,title:D.i18n.translate("embeddableApi.panelNotificationTrigger.title",{defaultMessage:"Panel notifications"}),description:D.i18n.translate("embeddableApi.panelNotificationTrigger.description",{defaultMessage:"Actions appear in top-right corner of a panel."})},K="SELECT_RANGE_TRIGGER",q={id:K,title:D.i18n.translate("embeddableApi.selectRangeTrigger.title",{defaultMessage:"Range selection"}),description:D.i18n.translate("embeddableApi.selectRangeTrigger.description",{defaultMessage:"A range of values on the visualization"})},W="VALUE_CLICK_TRIGGER",J={id:W,title:D.i18n.translate("embeddableApi.valueClickTrigger.title",{defaultMessage:"Single click"}),description:D.i18n.translate("embeddableApi.valueClickTrigger.description",{defaultMessage:"A data point click on the visualization"})},Q="MULTI_VALUE_CLICK_TRIGGER",Y={id:Q,title:D.i18n.translate("embeddableApi.multiValueClickTrigger.title",{defaultMessage:"Multi click"}),description:D.i18n.translate("embeddableApi.multiValueClickTrigger.description",{defaultMessage:"Selecting multiple values of a single dimension on the visualization"})},X="CELL_VALUE_TRIGGER",Z={id:X,title:D.i18n.translate("embeddableApi.cellValueTrigger.title",{defaultMessage:"Cell value"}),description:D.i18n.translate("embeddableApi.cellValueTrigger.description",{defaultMessage:"Actions appear in the cell value options on the visualization"})},ee=e=>e.data&&"data"in e.data&&Array.isArray(e.data.data)&&e.data.data.length>0&&"column"in e.data.data[0],te=e=>e.data&&"data"in e.data&&Array.isArray(e.data.data)&&e.data.data.length>0&&"cells"in e.data.data[0],ne=e=>e.data&&"range"in e.data,ie=e=>!!e.data&&"object"==typeof e.data&&"number"==typeof e.data.rowIndex,re=e=>!!e&&"object"==typeof e&&!!e.embeddable&&"object"==typeof e.embeddable;var ae=n(34);const oe=e=>Object.keys(e);class container_Container extends embeddable_Embeddable{constructor(e,t,n,i,r){super(e,t,i),o()(this,"isContainer",!0),o()(this,"children",{}),o()(this,"subscription",void 0),o()(this,"anyChildOutputChange$",void 0),this.getFactory=n,this.getFactory=n;const a=Boolean((null==r?void 0:r.initializeSequentially)||(null==r?void 0:r.childIdInitializeOrder)),s=this.getInput$().pipe(Object(c.take)(1),Object(c.mergeMap)((async e=>{const t=this.initializeChildEmbeddables(e,r);a&&await t}))),l=this.getInput$().pipe(Object(c.pairwise)());this.subscription=s.pipe(Object(c.combineLatestWith)(l)).subscribe((([e,[{panels:t},{panels:n}]])=>{this.maybeUpdateChildren(n,t)})),this.anyChildOutputChange$=this.getOutput$().pipe(Object(c.map)((()=>this.getChildIds())),Object(c.distinctUntilChanged)(d.a),Object(c.switchMap)((e=>Object(u.merge)(...e.map((e=>this.getChild(e).getOutput$().pipe(Object(c.catchError)((()=>u.EMPTY)),Object(c.map)((()=>e)))))))))}setChildLoaded(e){this.input.panels[e.id]?(this.children[e.id]=e,this.updateOutput({embeddableLoaded:{...this.output.embeddableLoaded,[e.id]:!0}})):e.destroy()}updateInputForChild(e,t){if(!this.input.panels[e])throw new i.b;const n={panels:{...this.input.panels,[e]:{...this.input.panels[e],explicitInput:{...this.input.panels[e].explicitInput,...t}}}};this.updateInput(n)}reload(){Object.values(this.children).forEach((e=>e.reload()))}async addNewEmbeddable(e,t){const n=this.getFactory(e);if(!n)throw new i.a(e);const r=this.createNewPanelState(n,t);return this.createAndSaveEmbeddable(e,r)}async replaceEmbeddable(e,t,n){if(!this.input.panels[e])throw new i.b;if(n&&n!==this.input.panels[e].type){if(!this.getFactory(n))throw new i.a(n);this.updateInput({panels:{...this.input.panels,[e]:{...this.input.panels[e],explicitInput:{...t,id:e},type:n}}})}else this.updateInputForChild(e,t);await this.untilEmbeddableLoaded(e)}removeEmbeddable(e){const t=this.onRemoveEmbeddable(e);this.updateInput({panels:t})}onRemoveEmbeddable(e){const t={...this.input.panels};return delete t[e],t}getChildIds(){return Object.keys(this.children)}getChild(e){return this.children[e]}getInputForChild(e){const t=this.getInheritedInput(e),n=this.getPanelState(e),i=n.explicitInput,r={};return oe(n.explicitInput).forEach((e=>{void 0===i[e]&&void 0!==t[e]||(r[e]=i[e])})),{...t,...r}}getAnyChildOutputChange$(){return this.anyChildOutputChange$}destroy(){var e;super.destroy(),Object.values(this.children).forEach((e=>e.destroy())),null===(e=this.subscription)||void 0===e||e.unsubscribe()}async untilEmbeddableLoaded(e){if(!this.input.panels[e])throw new i.b;return this.output.embeddableLoaded[e]?this.children[e]:new Promise(((t,n)=>{const i=Object(u.merge)(this.getOutput$(),this.getInput$()).subscribe((()=>{this.output.embeddableLoaded[e]&&(i.unsubscribe(),t(this.children[e])),void 0===this.input.panels[e]&&(i.unsubscribe(),t(void 0))}))}))}async getExplicitInputIsEqual(e){const{panels:t,...n}=e,{panels:i,...r}=this.getInput();if(!Object(l.isEqual)(n,r))return!1;const a=Object.keys(t),o=Object.keys(i);if(a.length!==o.length||Object(l.xor)(a,o).length>0)return!1;for(const e of a){const n=await this.untilEmbeddableLoaded(e),i=t[e].explicitInput;if(!w(n)&&!await n.getExplicitInputIsEqual(i))return!1}return!0}createNewPanelState(e,t={}){const n=t.id||Object(ae.v4)(),i=this.createNewExplicitEmbeddableInput(n,e,t);return{type:e.type,explicitInput:{...i,id:n}}}getPanelState(e){if(void 0===this.input.panels[e])throw new i.b;return this.input.panels[e]}async initializeChildEmbeddables(e,t){let n=Object.keys(e.panels);if(null!=t&&t.childIdInitializeOrder){const e=new Set;for(const i of[...t.childIdInitializeOrder,...n])!e.has(i)&&Boolean(this.getInput().panels[i])&&e.add(i);n=Array.from(e)}for(const i of n)if(null!=t&&t.initializeSequentially){const t=await this.onPanelAdded(e.panels[i]);t&&!w(t)&&await this.untilEmbeddableLoaded(i)}else this.onPanelAdded(e.panels[i])}async createAndSaveEmbeddable(e,t){return this.updateInput({panels:{...this.input.panels,[t.explicitInput.id]:t}}),await this.untilEmbeddableLoaded(t.explicitInput.id)}createNewExplicitEmbeddableInput(e,t,n={}){const i=this.getInheritedInput(e),r=t.getDefaultInput(n),a=n;return oe(r).forEach((e=>{void 0===i[e]&&void 0===a[e]&&(a[e]=r[e])})),a}onPanelRemoved(e){const t=this.getChild(e);t&&(t.destroy(),delete this.children[e]),this.updateOutput({embeddableLoaded:{...this.output.embeddableLoaded,[e]:void 0}})}async onPanelAdded(e){let t;this.updateOutput({embeddableLoaded:{...this.output.embeddableLoaded,[e.explicitInput.id]:!1}});const n=this.getInputForChild(e.explicitInput.id);try{const r=this.getFactory(e.type);if(!r)throw new i.a(e.type);t=Object(R.a)(n)?await r.createFromSavedObject(n.savedObjectId,n,this):await r.create(n,this)}catch(n){t=new error_embeddable_ErrorEmbeddable(n,{id:e.explicitInput.id},this)}return t?t.deferEmbeddableLoad||this.setChildLoaded(t):void 0===t&&this.removeEmbeddable(e.explicitInput.id),t}panelHasChanged(e,t){if(e.type!==t.type)return!0}maybeUpdateChildren(e,t){Object.keys({...e,...this.output.embeddableLoaded}).forEach((n=>void 0!==e[n]&&void 0===this.output.embeddableLoaded[n]?this.onPanelAdded(e[n]):void 0===e[n]&&void 0!==this.output.embeddableLoaded[n]?this.onPanelRemoved(n):void(e[n]&&t[n]&&this.panelHasChanged(e[n],t[n])&&(this.onPanelRemoved(n),this.onPanelAdded(e[n])))))}}var se=n(21);function de(e){return!!e.inputIsRefType&&!!e.getInputAsValueType&&!!e.getInputAsRefType}function le(e){return!!e.getSelfStyledOptions}function ue(e){return!!e.getFilters&&!!e.getQuery}var ce=n(28);const pe={...ce.COMPARE_ALL_OPTIONS,state:!1};function be(e,t){return e.pipe(Object(c.map)((()=>t()))).pipe(Object(c.startWith)(t()),Object(c.distinctUntilChanged)(((e,t)=>!!d()([e.searchSessionId,e.query,e.timeRange,e.timeslice],[t.searchSessionId,t.query,t.timeRange,t.timeslice])&&Object(ce.onlyDisabledFiltersChanged)(e.filters,t.filters,pe))),Object(c.skip)(1))}},function(e,t){e.exports=__kbnSharedDeps__.React},function(e,t){e.exports=__kbnSharedDeps__.ElasticEui},function(e,t){e.exports=__kbnSharedDeps__.KbnI18n},function(e,t){e.exports=__kbnSharedDeps__.RxjsOperators},function(e,t){e.exports=__kbnSharedDeps__.Lodash},function(e,t){e.exports=__kbnSharedDeps__.Rxjs},function(e,t,n){"use strict";n.d(t,"b",(function(){return PanelNotFoundError})),n.d(t,"a",(function(){return EmbeddableFactoryNotFoundError}));var i=n(0),r=n.n(i),a=n(5);class PanelNotFoundError extends Error{constructor(){super(a.i18n.translate("embeddableApi.errors.paneldoesNotExist",{defaultMessage:"Panel not found"})),r()(this,"code","PANEL_NOT_FOUND")}}class EmbeddableFactoryNotFoundError extends Error{constructor(e){super(a.i18n.translate("embeddableApi.errors.embeddableFactoryNotFound",{defaultMessage:"{type} can't be loaded. Please upgrade to the default distribution of Elasticsearch and Kibana with the appropriate license.",values:{type:e}})),r()(this,"code","EMBEDDABLE_FACTORY_NOT_FOUND")}}},function(e,t,n){"use strict";n.d(t,"g",(function(){return inspect_panel_action_InspectPanelAction})),n.d(t,"c",(function(){return s})),n.d(t,"e",(function(){return customize_panel_action_CustomizePanelAction})),n.d(t,"d",(function(){return custom_time_range_badge_CustomTimeRangeBadge})),n.d(t,"a",(function(){return y})),n.d(t,"f",(function(){return edit_panel_action_EditPanelAction})),n.d(t,"b",(function(){return w})),n.d(t,"i",(function(){return remove_panel_action_RemovePanelAction})),n.d(t,"h",(function(){return A})),n.d(t,"j",(function(){return o}));var i=n(0),r=n.n(i),a=n(5);const o=e=>Boolean(e.openOverlay&&e.clearOverlays),s="openInspector";class inspect_panel_action_InspectPanelAction{constructor(e){r()(this,"type",s),r()(this,"id",s),r()(this,"order",20),this.inspector=e}getDisplayName(){return a.i18n.translate("embeddableApi.panel.inspectPanel.displayName",{defaultMessage:"Inspect"})}getIconType(){return"inspect"}async isCompatible({embeddable:e}){return this.inspector.isAvailable(e.getInspectorAdapters())}async execute({embeddable:e}){const t=e.getInspectorAdapters();if(!await this.isCompatible({embeddable:e})||void 0===t)throw new Error("Action not compatible with context");const n=e.getRoot(),i=o(n)?n:void 0,r=this.inspector.open(t,{title:e.getTitle(),options:{fileName:e.getTitle()||e.getInput().title||e.getOutput().defaultTitle||a.i18n.translate("embeddableApi.panel.inspectPanel.untitledEmbeddableFilename",{defaultMessage:"untitled"})}}),s=e.destroy;e.destroy=()=>{i&&i.clearOverlays(),r.close(),s&&s.call(e)},r.onClose.finally((()=>{i&&i.clearOverlays(),e.destroy=s})),null==i||i.openOverlay(r)}}var d=n(3),l=n.n(d),u=n(20),c=n(24),p=n(14),b=n(4),m=n(12);function h(e){if(!e.parent)return!1;const t=e.parent;return!!t.getInput().panels[e.id]&&void 0===t.getInput().panels[e.id].explicitInput.timeRange}var f=n(2),g=n(1);const v=e=>{var t,n;const{onClose:i,embeddable:r,dateFormat:o,timeRangeCompatible:s}=e,u=r.getInput().viewMode===f.r.EDIT,[c,p]=Object(d.useState)(r.getInput().hidePanelTitles),[v,y]=Object(d.useState)(null!==(t=r.getInput().description)&&void 0!==t?t:r.getOutput().defaultDescription),[_,E]=Object(d.useState)(null!==(n=r.getInput().title)&&void 0!==n?n:r.getOutput().defaultTitle),[j,O]=Object(d.useState)(!!s&&h(r)),[x,P]=Object(d.useState)(s?r.getInput().timeRange:void 0),I=e.commonlyUsedRanges?e.commonlyUsedRanges.map((({from:e,to:t,display:n})=>({start:e,end:t,label:n}))):void 0;return Object(g.jsx)(l.a.Fragment,null,Object(g.jsx)(b.EuiFlyoutHeader,{hasBorder:!0},Object(g.jsx)(b.EuiTitle,{size:"m"},Object(g.jsx)("h2",null,Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.title",defaultMessage:"Panel settings"})))),Object(g.jsx)(b.EuiFlyoutBody,null,Object(g.jsx)(b.EuiForm,null,u?Object(g.jsx)(l.a.Fragment,null,Object(g.jsx)(b.EuiFormRow,null,Object(g.jsx)(b.EuiSwitch,{checked:!c,"data-test-subj":"customEmbeddablePanelHideTitleSwitch",disabled:!u,id:"hideTitle",label:Object(g.jsx)(m.FormattedMessage,{defaultMessage:"Show title",id:"embeddableApi.customizePanel.flyout.optionsMenuForm.showTitle"}),onChange:e=>p(!e.target.checked)})),Object(g.jsx)(b.EuiFormRow,{label:Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.optionsMenuForm.panelTitleFormRowLabel",defaultMessage:"Title"}),labelAppend:Object(g.jsx)(b.EuiButtonEmpty,{size:"xs","data-test-subj":"resetCustomEmbeddablePanelTitleButton",onClick:()=>E(r.getOutput().defaultTitle),disabled:c||!u||r.getOutput().defaultTitle===_,"aria-label":a.i18n.translate("embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomTitleButtonAriaLabel",{defaultMessage:"Reset title"})},Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomTitleButtonLabel",defaultMessage:"Reset"}))},Object(g.jsx)(b.EuiFieldText,{id:"panelTitleInput",className:"panelTitleInputText","data-test-subj":"customEmbeddablePanelTitleInput",name:"title",type:"text",disabled:c||!u,value:null!=_?_:"",onChange:e=>E(e.target.value),"aria-label":a.i18n.translate("embeddableApi.customizePanel.flyout.optionsMenuForm.panelTitleInputAriaLabel",{defaultMessage:"Enter a custom title for your panel"})})),Object(g.jsx)(b.EuiFormRow,{label:Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.optionsMenuForm.panelDescriptionFormRowLabel",defaultMessage:"Description"}),labelAppend:Object(g.jsx)(b.EuiButtonEmpty,{size:"xs","data-test-subj":"resetCustomEmbeddablePanelDescriptionButton",onClick:()=>{y(r.getOutput().defaultDescription)},disabled:c||!u||r.getOutput().defaultDescription===v,"aria-label":a.i18n.translate("embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomDescriptionButtonAriaLabel",{defaultMessage:"Reset description"})},Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.modal.optionsMenuForm.resetCustomDescriptionButtonLabel",defaultMessage:"Reset"}))},Object(g.jsx)(b.EuiTextArea,{id:"panelDescriptionInput",className:"panelDescriptionInputText","data-test-subj":"customEmbeddablePanelDescriptionInput",disabled:c||!u,name:"description",value:null!=v?v:"",onChange:e=>y(e.target.value),"aria-label":a.i18n.translate("embeddableApi.customizePanel.flyout.optionsMenuForm.panelDescriptionAriaLabel",{defaultMessage:"Enter a custom description for your panel"})}))):null,s?Object(g.jsx)(l.a.Fragment,null,function(e){return!!e.parent&&void 0!==e.parent.getInput().timeRange}(r)?Object(g.jsx)(b.EuiFormRow,null,Object(g.jsx)(b.EuiSwitch,{checked:!j,"data-test-subj":"customizePanelShowCustomTimeRange",id:"showCustomTimeRange",label:Object(g.jsx)(m.FormattedMessage,{defaultMessage:"Apply custom time range",id:"embeddableApi.customizePanel.flyout.optionsMenuForm.showCustomTimeRangeSwitch"}),onChange:e=>O(!e.target.checked)})):null,j?null:Object(g.jsx)(b.EuiFormRow,{label:Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.optionsMenuForm.panelTimeRangeFormRowLabel",defaultMessage:"Time range"})},Object(g.jsx)(b.EuiSuperDatePicker,{start:null!==(w=null==x?void 0:x.from)&&void 0!==w?w:void 0,end:null!==(T=null==x?void 0:x.to)&&void 0!==T?T:void 0,onTimeChange:({start:e,end:t})=>P({from:e,to:t}),showUpdateButton:!1,dateFormat:o,commonlyUsedRanges:I,"data-test-subj":"customizePanelTimeRangeDatePicker"}))):null)),Object(g.jsx)(b.EuiFlyoutFooter,null,Object(g.jsx)(b.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(b.EuiFlexItem,{grow:!1},Object(g.jsx)(b.EuiButtonEmpty,{"data-test-subj":"cancelCustomizePanelButton",onClick:i},Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.cancelButtonTitle",defaultMessage:"Cancel"}))),Object(g.jsx)(b.EuiFlexItem,{grow:!1},Object(g.jsx)(b.EuiButton,{"data-test-subj":"saveCustomizePanelButton",onClick:()=>{const e={hidePanelTitles:c,title:_===r.getOutput().defaultTitle?void 0:_,description:v===r.getOutput().defaultDescription?void 0:v};Boolean(s)&&(e.timeRange=j?void 0:x),r.updateInput(e),i()},fill:!0},Object(g.jsx)(m.FormattedMessage,{id:"embeddableApi.customizePanel.flyout.saveButtonTitle",defaultMessage:"Apply"}))))));var w,T},y="ACTION_CUSTOMIZE_PANEL",_="visualization";function E(e){return e.type===_}function j(e){return void 0!==e.getInput().timeRange}class customize_panel_action_CustomizePanelAction{constructor(e,t,n,i){r()(this,"type",y),r()(this,"id",y),r()(this,"order",40),this.overlays=e,this.theme=t,this.commonlyUsedRanges=n,this.dateFormat=i}isTimeRangeCompatible({embeddable:e}){const t=E(e)&&"input_control_vis"===e.getOutput().visTypeName,n=E(e)&&"markdown"===e.getOutput().visTypeName,i="image"===e.type;return Boolean(e&&j(e)&&!t&&!n&&!i)}getDisplayName({embeddable:e}){return a.i18n.translate("embeddableApi.customizePanel.action.displayName",{defaultMessage:"Panel settings"})}getIconType(){return"gear"}async isCompatible({embeddable:e}){return e.getInput().viewMode===p.a.EDIT||this.isTimeRangeCompatible({embeddable:e})}async execute({embeddable:e}){if(!await this.isCompatible({embeddable:e}))throw new c.IncompatibleActionError;const t=e.getRoot(),n=o(t)?t:void 0,i=this.overlays.openFlyout(Object(u.toMountPoint)(Object(g.jsx)(v,{embeddable:e,timeRangeCompatible:this.isTimeRangeCompatible({embeddable:e}),dateFormat:this.dateFormat,commonlyUsedRanges:this.commonlyUsedRanges,onClose:()=>{n&&n.clearOverlays(),i.close()}}),{theme$:this.theme.theme$}),{size:"s","data-test-subj":"customizePanel",onClose:e=>{n&&n.clearOverlays(),e.close()}});null==n||n.openOverlay(i)}}var O=n(35);const x="CUSTOM_TIME_RANGE_BADGE";class custom_time_range_badge_CustomTimeRangeBadge extends customize_panel_action_CustomizePanelAction{constructor(...e){super(...e),r()(this,"type",x),r()(this,"id",x),r()(this,"order",7)}getDisplayName({embeddable:e}){var t;return Object(O.renderToString)(Object(g.jsx)(b.PrettyDuration,{timeFrom:e.getInput().timeRange.from,timeTo:e.getInput().timeRange.to,dateFormat:null!==(t=this.dateFormat)&&void 0!==t?t:"Browser"}))}getIconType(){return"calendar"}async isCompatible({embeddable:e}){return Boolean(e&&j(e)&&!h(e))}}var P=n(6),I=n(9);const w="editPanel";class edit_panel_action_EditPanelAction{constructor(e,t,n,i){var a;r()(this,"type",w),r()(this,"id",w),r()(this,"order",50),r()(this,"currentAppId",void 0),this.getEmbeddableFactory=e,this.application=t,this.stateTransfer=n,this.getOriginatingPath=i,null!==(a=this.application)&&void 0!==a&&a.currentAppId$&&this.application.currentAppId$.pipe(Object(P.take)(1)).subscribe((e=>this.currentAppId=e))}getDisplayName({embeddable:e}){const t=this.getEmbeddableFactory(e.type);if(!t)throw new I.a(e.type);return a.i18n.translate("embeddableApi.panel.editPanel.displayName",{defaultMessage:"Edit {value}",values:{value:t.getDisplayName()}})}getIconType(){return"pencil"}async isCompatible({embeddable:e}){const t=Boolean(e&&e.getOutput().editable&&(e.getOutput().editUrl||e.getOutput().editApp&&e.getOutput().editPath||e.getOutput().editableWithExplicitInput)),n=e.getInput().viewMode===p.a.EDIT;return Boolean(t&&n)}async execute(e){const t=e.embeddable,{editableWithExplicitInput:n}=t.getOutput();if(n){var i;const e=this.getEmbeddableFactory(t.type);if(!e)throw new I.a(t.type);const n=t.getExplicitInput(),r=await e.getExplicitInput(n);return void(null===(i=t.parent)||void 0===i||i.replaceEmbeddable(t.id,r))}const r=this.getAppTarget(e);if(r)return void(this.stateTransfer&&r.state?await this.stateTransfer.navigateToEditor(r.app,{path:r.path,state:r.state}):await this.application.navigateToApp(r.app,{path:r.path}));const a=await this.getHref(e);a&&(window.location.href=a)}getAppTarget({embeddable:e}){const t=e?e.getOutput().editApp:void 0,n=e?e.getOutput().editPath:void 0;if(t&&n){if(this.currentAppId){var i;const r=null===(i=this.getOriginatingPath)||void 0===i?void 0:i.call(this);return{app:t,path:n,state:{originatingApp:this.currentAppId,valueInput:this.getExplicitInput({embeddable:e}),embeddableId:e.id,searchSessionId:e.getInput().searchSessionId,originatingPath:r}}}return{app:t,path:n}}}async getHref({embeddable:e}){return(e?e.getOutput().editUrl:void 0)||""}getExplicitInput({embeddable:e}){var t,n,i,r,a;return null!==(t=null===(n=e.getRoot())||void 0===n||null===(i=n.getInput())||void 0===i||null===(r=i.panels)||void 0===r||null===(a=r[e.id])||void 0===a?void 0:a.explicitInput)&&void 0!==t?t:e.getInput()}}var T=n(36);const A="deletePanel";class remove_panel_action_RemovePanelAction{constructor(){r()(this,"type",A),r()(this,"id",A),r()(this,"order",1)}getDisplayName(){return a.i18n.translate("embeddableApi.panel.removePanel.displayName",{defaultMessage:"Delete from dashboard"})}getIconType(){return"trash"}async isCompatible({embeddable:e}){var t,n;const i=(null===(t=e.parent)||void 0===t||null===(n=t.getExpandedPanelId)||void 0===n?void 0:n.call(t))===e.id;return Boolean(e.parent&&e.getInput().viewMode===p.a.EDIT&&!i)}async execute({embeddable:e}){if(!e.parent||!await this.isCompatible({embeddable:e}))throw new T.IncompatibleActionError;e.parent.removeEmbeddable(e.id)}}},function(e,t,n){"use strict";n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){return o}));const i=(e,t)=>t,r=e=>({state:e,references:[]}),a=(e,t)=>e,o={}},function(e,t){e.exports=__kbnSharedDeps__.KbnI18nReact},function(e,t,n){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,a[r]))return!1;for(r=i;0!=r--;){var o=a[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},function(e,t,n){"use strict";var i=n(17);n.d(t,"a",(function(){return i.a}))},function(e,t,n){"use strict";let i,r,a,o,s,d,l,u;n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return r})),n.d(t,"g",(function(){return a})),n.d(t,"d",(function(){return o})),n.d(t,"i",(function(){return s})),n.d(t,"e",(function(){return l})),n.d(t,"a",(function(){return u})),n.d(t,"h",(function(){return p})),n.d(t,"f",(function(){return b}));const c=new(n(8).BehaviorSubject)(!1),p=()=>c.value?Promise.resolve():new Promise((e=>{const t=c.subscribe((n=>{n&&(t.unsubscribe(),e())}))})),b=(e,t,n)=>{i=e,a=n.uiActions,o=n.inspector,r=t,s=n.usageCollection,d=n.savedObjectsManagement,l=n.savedObjectsTaggingOss,u=n.contentManagement,c.next(!0)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return s})),n.d(t,"e",(function(){return d.a}));var i=n(11);const r=e=>t=>{const n=t.enhancements||{},r=e.getEmbeddableFactory(t.type),a=Object(i.b)(t);let o=a.state;const s=a.references;if(r){const e=r.extract(t);o=e.state,s.push(...e.references)}return o.enhancements={},Object.keys(n).forEach((t=>{if(!n[t])return;const i=e.getEnhancement(t).extract(n[t]);s.push(...i.references),o.enhancements[t]=i.state})),{state:o,references:s}},a=e=>(t,n)=>{const r=t.enhancements||{},a=e.getEmbeddableFactory(t.type);let o=Object(i.c)(t,n);return a&&(o=a.inject(o,n)),o.enhancements={},Object.keys(r).forEach((t=>{r[t]&&(o.enhancements[t]=e.getEnhancement(t).inject(r[t],n))})),o},o=e=>{const t=(n,r)=>{const a=n.enhancements||{},o=e.getEmbeddableFactory(n.type);let s=i.a[r]?i.a[r](n):n;const d="function"==typeof(null==o?void 0:o.migrations)?null==o?void 0:o.migrations():(null==o?void 0:o.migrations)||{};return d[r]&&(s=d[r](s)),null!=o&&o.isContainerType&&(s.panels=(n.panels||[]).map((e=>t(e,r)))),s.enhancements={},Object.keys(a).forEach((t=>{if(!a[t])return;const n=e.getEnhancement(t),i="function"==typeof(null==n?void 0:n.migrations)?null==n?void 0:n.migrations():(null==n?void 0:n.migrations)||{},o=i[r]?i[r](a[t]):a[t];s.enhancements[t]=o})),s};return t},s=e=>(t,n={})=>{const r=t.enhancements||{},a=e.getEmbeddableFactory(t.type);let o=Object(i.d)(t,n);return a&&(o=a.telemetry(t,o)),Object.keys(r).map((t=>{r[t]&&(o=e.getEnhancement(t).telemetry(r[t],o))})),o};var d=n(18)},function(e,t,n){"use strict";let i;n.d(t,"a",(function(){return i})),function(e){e.EDIT="edit",e.PREVIEW="preview",e.PRINT="print",e.VIEW="view"}(i||(i={}))},function(e,t,n){"use strict";function i(e){return Boolean(e.savedObjectId)}n.d(t,"a",(function(){return i}))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/kibanaUtils/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/kibanaReact/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){"use strict";n.d(t,"a",(function(){return embeddable_state_transfer_EmbeddableStateTransfer}));var i=n(0),r=n.n(i),a=n(7),o=n(19);const s="embeddable_editor_state";function d(e){return c("originatingApp",e,"string")}const l="embeddable_package_state";function u(e){return c("type",e,"string")&&c("input",e,"object")}function c(e,t,n){return Boolean(t)&&e in t&&(!n||typeof t[e]===n)}const p="EMBEDDABLE_STATE_TRANSFER";class embeddable_state_transfer_EmbeddableStateTransfer{constructor(e,t,n,i){r()(this,"isTransferInProgress",void 0),r()(this,"storage",void 0),r()(this,"appList",void 0),r()(this,"getAppNameFromId",(e=>{var t,n;return null===(t=this.appList)||void 0===t||null===(n=t.get(e))||void 0===n?void 0:n.title})),this.navigateToApp=e,this.storage=i||new o.Storage(sessionStorage),this.isTransferInProgress=!1,this.appList=n,t.subscribe((()=>{this.isTransferInProgress=!1}))}getIncomingEditorState(e,t){return this.getIncomingState(d,e,s,{keysToRemoveAfterFetch:t?[s]:void 0})}clearEditorState(e){const t=this.storage.get(p);var n;t&&(e?null===(n=t[s])||void 0===n||delete n[e]:delete t[s],this.storage.set(p,t))}getIncomingEmbeddablePackage(e,t){return this.getIncomingState(u,e,l,{keysToRemoveAfterFetch:t?[l]:void 0})}async navigateToEditor(e,t){this.isTransferInProgress=!0,await this.navigateToWithState(e,s,{...t})}async navigateToWithEmbeddablePackage(e,t){this.isTransferInProgress=!0,await this.navigateToWithState(e,l,{...t})}getIncomingState(e,t,n,i){var r,o;const s=null===(r=this.storage.get(p))||void 0===r||null===(o=r[n])||void 0===o?void 0:o[t],d=!e||e(s)?Object(a.cloneDeep)(s):void 0;if(d&&null!=i&&i.keysToRemoveAfterFetch){const e={...this.storage.get(p)};i.keysToRemoveAfterFetch.forEach((t=>{delete e[t]})),this.storage.set(p,e)}return d}async navigateToWithState(e,t,n){var i;const r=(null===(i=this.storage.get(p))||void 0===i?void 0:i[t])||{},a={...this.storage.get(p),[t]:{...r,[e]:null==n?void 0:n.state}};this.storage.set(p,a),await this.navigateToApp(e,{path:null==n?void 0:n.path,openInNewTab:null==n?void 0:n.openInNewTab,skipAppLeave:null==n?void 0:n.skipAppLeave})}}},function(e,t,n){"use strict";var i,r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function o(e){for(var t=-1,n=0;nl?()=>null==e?void 0:e.execute({embeddable:t}):void 0),[e,t,l]),p=Object(a.useMemo)((()=>null==e?void 0:e.getDisplayName({embeddable:t})),[e,t]),b=Object(a.useMemo)((()=>t.getTitle()),[t]),m=Object(a.useMemo)((()=>b?i.i18n.translate("embeddableApi.panel.editPanel.displayName",{defaultMessage:"Edit {value}",values:{value:b}}):p),[p,b]);return Object(a.useEffect)((()=>{const n=Object(r.merge)(t.getInput$(),t.getOutput$()).pipe(Object(r.switchMap)((()=>{var n;return null!==(n=null==e?void 0:e.isCompatible({embeddable:t}))&&void 0!==n?n:Object(r.of)(!1)})),Object(r.distinctUntilChanged)()).subscribe(u);return()=>n.unsubscribe()}),[e,t]),Object(d.jsx)(o.EuiEmptyPrompt,{body:Object(d.jsx)(o.EuiText,{size:"s"},Object(d.jsx)(s.Markdown,{markdown:n.message,openLinksInNewTab:!0,"data-test-subj":"errorMessageMarkdown"})),"data-test-subj":"embeddableStackError",iconType:"warning",iconColor:"danger",layout:"vertical",actions:l&&Object(d.jsx)(o.EuiButtonEmpty,{"aria-label":m,onClick:c,size:"s"},p)})}},function(e,t){e.exports=__kbnSharedDeps__.TsLib},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/kibanaUtils/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.Uuid},function(e,t){e.exports=__kbnSharedDeps__.ReactDomServer},function(e,t,n){"use strict";var i=n(24);n.o(i,"IncompatibleActionError")&&n.d(t,"IncompatibleActionError",(function(){return i.IncompatibleActionError}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(32),r=n(3),a=i.__importDefault(n(51));t.default=function(e,t){void 0===t&&(t=[]);var n=a.default(e,t,{loading:!0}),i=n[0],o=n[1];return r.useEffect((function(){o()}),[o]),i}},function(e,t,n){"use strict";n.r(t),n.d(t,"isReferenceOrValueEmbeddable",(function(){return d.C})),n.d(t,"Container",(function(){return d.c})),n.d(t,"CONTEXT_MENU_TRIGGER",(function(){return d.b})),n.d(t,"contextMenuTrigger",(function(){return d.t})),n.d(t,"defaultEmbeddableFactoryProvider",(function(){return d.u})),n.d(t,"Embeddable",(function(){return d.d})),n.d(t,"EmbeddableFactoryNotFoundError",(function(){return d.f})),n.d(t,"EmbeddableRoot",(function(){return d.h})),n.d(t,"ErrorEmbeddable",(function(){return d.j})),n.d(t,"isEmbeddable",(function(){return d.x})),n.d(t,"isErrorEmbeddable",(function(){return d.y})),n.d(t,"PANEL_BADGE_TRIGGER",(function(){return d.l})),n.d(t,"panelBadgeTrigger",(function(){return d.J})),n.d(t,"PANEL_NOTIFICATION_TRIGGER",(function(){return d.n})),n.d(t,"panelNotificationTrigger",(function(){return d.L})),n.d(t,"PanelNotFoundError",(function(){return d.o})),n.d(t,"SELECT_RANGE_TRIGGER",(function(){return d.p})),n.d(t,"VALUE_CLICK_TRIGGER",(function(){return d.q})),n.d(t,"MULTI_VALUE_CLICK_TRIGGER",(function(){return d.k})),n.d(t,"CELL_VALUE_TRIGGER",(function(){return d.a})),n.d(t,"cellValueTrigger",(function(){return d.s})),n.d(t,"ViewMode",(function(){return d.r})),n.d(t,"withEmbeddableSubscription",(function(){return d.R})),n.d(t,"genericEmbeddableInputIsEqual",(function(){return d.v})),n.d(t,"omitGenericEmbeddableInput",(function(){return d.I})),n.d(t,"isSavedObjectEmbeddableInput",(function(){return d.E})),n.d(t,"isRangeSelectTriggerContext",(function(){return d.B})),n.d(t,"isValueClickTriggerContext",(function(){return d.G})),n.d(t,"isMultiValueClickTriggerContext",(function(){return d.A})),n.d(t,"isRowClickTriggerContext",(function(){return d.D})),n.d(t,"isContextMenuTriggerContext",(function(){return d.w})),n.d(t,"EmbeddableStateTransfer",(function(){return d.i})),n.d(t,"EmbeddableRenderer",(function(){return d.g})),n.d(t,"useEmbeddableFactory",(function(){return d.P})),n.d(t,"isFilterableEmbeddable",(function(){return d.z})),n.d(t,"shouldFetch$",(function(){return d.N})),n.d(t,"shouldRefreshFilterCompareOptions",(function(){return d.O})),n.d(t,"PANEL_HOVER_TRIGGER",(function(){return d.m})),n.d(t,"panelHoverTrigger",(function(){return d.K})),n.d(t,"EmbeddablePanel",(function(){return A})),n.d(t,"InspectPanelAction",(function(){return j.g})),n.d(t,"ACTION_INSPECT_PANEL",(function(){return j.c})),n.d(t,"CustomizePanelAction",(function(){return j.e})),n.d(t,"ACTION_CUSTOMIZE_PANEL",(function(){return j.a})),n.d(t,"EditPanelAction",(function(){return j.f})),n.d(t,"ACTION_EDIT_PANEL",(function(){return j.b})),n.d(t,"RemovePanelAction",(function(){return j.i})),n.d(t,"REMOVE_PANEL_ACTION",(function(){return j.h})),n.d(t,"tracksOverlays",(function(){return j.j})),n.d(t,"AttributeService",(function(){return attribute_service_AttributeService})),n.d(t,"ATTRIBUTE_SERVICE_KEY",(function(){return h})),n.d(t,"plugin",(function(){return S})),n.d(t,"openAddPanelFlyout",(function(){return R})),n(41);var i=n(0),r=n.n(i),a=n(7),o=n(27),s=n(33),d=n(2),l=n(21),u=n(3),c=n.n(u),p=n(5),b=n(29),m=n(1);const h="attributes";class attribute_service_AttributeService{constructor(e,t,n,i){if(r()(this,"inputIsRefType",(e=>Object(d.E)(e))),r()(this,"getInputAsValueType",(async e=>{if(!this.inputIsRefType(e))return e;const{attributes:t}=await this.unwrapAttributes(e),{savedObjectId:n,...i}=e;return{...i,attributes:Object(a.omit)(t,["title","description"])}})),r()(this,"getInputAsRefType",(async(e,t)=>this.inputIsRefType(e)?e:new Promise(((n,i)=>{t&&t.showSaveModal&&Object(b.showSaveModal)(Object(m.jsx)(b.SavedObjectSaveModal,{onSave:async t=>{await this.options.checkForDuplicateTitle(t);try{const i={...e[h]};i.title=t.newTitle;const r=await this.wrapAttributes(i,!0),o=Object(a.omit)(e,[h,"title"]);return n({...o,...r}),{id:r.savedObjectId}}catch(e){return i(e),{error:e}}},onClose:()=>{},title:Object(a.get)(t,"saveModalTitle",e[h].title),showCopyOnSave:!1,objectType:this.type,showDescription:!1}))})))),this.type=e,this.toasts=t,this.options=n,i&&!i(this.type))throw new d.f(this.type)}async defaultUnwrapMethod(e){return Promise.resolve({attributes:{...e}})}async unwrapAttributes(e){return this.inputIsRefType(e)?this.options.unwrapMethod?await this.options.unwrapMethod(e.savedObjectId):await this.defaultUnwrapMethod(e):{attributes:e[h]}}async wrapAttributes(e,t,n){const i=n||{},r=n&&this.inputIsRefType(n)?n.savedObjectId:void 0;if(!t)return{[h]:e};try{const t=await this.options.saveMethod(e,r);return"id"in t?{...i,savedObjectId:t.id}:{...i}}catch(e){return this.toasts.addDanger({title:p.i18n.translate("embeddableApi.attributeService.saveToLibraryError",{defaultMessage:"An error occurred while saving. Error: {errorMessage}",values:{errorMessage:e.message}}),"data-test-subj":"attributeServiceSaveFailure"}),Promise.reject({error:e})}}}var f=n(16),g=n(11),v=n(19);const[y,_]=Object(v.createGetterSetter)("Theme");var E=n(15),j=n(10);class plugin_EmbeddablePublicPlugin{constructor(e){r()(this,"embeddableFactoryDefinitions",new Map),r()(this,"embeddableFactories",new Map),r()(this,"enhancements",new Map),r()(this,"customEmbeddableFactoryProvider",void 0),r()(this,"stateTransferService",{}),r()(this,"isRegistryReady",!1),r()(this,"appList",void 0),r()(this,"appListSubscription",void 0),r()(this,"registerEnhancement",(e=>{if(this.enhancements.has(e.id))throw new Error(`enhancement with id ${e.id} already exists in the registry`);this.enhancements.set(e.id,{id:e.id,telemetry:e.telemetry||((e,t)=>t),inject:e.inject||a.identity,extract:e.extract||(e=>({state:e,references:[]})),migrations:e.migrations||{}})})),r()(this,"getEnhancement",(e=>this.enhancements.get(e)||{id:"unknown",telemetry:(e,t)=>t,inject:a.identity,extract:e=>({state:e,references:[]}),migrations:{}})),r()(this,"getEmbeddableFactories",(()=>(this.ensureFactoriesExist(),this.embeddableFactories.values()))),r()(this,"registerEmbeddableFactory",((e,t)=>{if(this.embeddableFactoryDefinitions.has(e))throw new Error(`Embeddable factory [embeddableFactoryId = ${e}] already registered in Embeddables API.`);return this.embeddableFactoryDefinitions.set(e,t),()=>this.getEmbeddableFactory(e)})),r()(this,"getEmbeddableFactory",(e=>{if(!this.isRegistryReady)throw new Error("Embeddable factories can only be retrieved after setup lifecycle.");return this.ensureFactoryExists(e),this.embeddableFactories.get(e)})),r()(this,"ensureFactoriesExist",(()=>{this.embeddableFactoryDefinitions.forEach((e=>this.ensureFactoryExists(e.type)))})),r()(this,"ensureFactoryExists",(e=>{if(!this.embeddableFactories.get(e)){const t=this.embeddableFactoryDefinitions.get(e);if(!t)return;this.embeddableFactories.set(e,this.customEmbeddableFactoryProvider?this.customEmbeddableFactoryProvider(t):Object(d.u)(t))}}))}setup(e,{uiActions:t}){return _(e.theme),(e=>{e.registerTrigger(d.t),e.registerTrigger(d.K),e.registerTrigger(d.J),e.registerTrigger(d.L),e.registerTrigger(d.M),e.registerTrigger(d.Q),e.registerTrigger(d.H),e.registerTrigger(d.s)})(t),{registerEmbeddableFactory:this.registerEmbeddableFactory,registerEnhancement:this.registerEnhancement,setCustomEmbeddableFactoryProvider:e=>{if(this.customEmbeddableFactoryProvider)throw new Error("Custom embeddable factory provider is already set, and can only be set once");this.customEmbeddableFactoryProvider=e}}}start(e,t){this.embeddableFactoryDefinitions.forEach((e=>{this.embeddableFactories.set(e.type,this.customEmbeddableFactoryProvider?this.customEmbeddableFactoryProvider(e):Object(d.u)(e))}));const{uiActions:n}=t,{overlays:i,theme:r,uiSettings:a}=e,u=a.get(o.UI_SETTINGS.DATE_FORMAT),c=a.get(o.UI_SETTINGS.TIMEPICKER_QUICK_RANGES),p=new j.d(i,r,c,u);n.addTriggerAction(d.l,p),this.appListSubscription=e.application.applications$.subscribe((e=>{this.appList=e})),this.stateTransferService=new l.a(e.application.navigateToApp,e.application.currentAppId$,this.appList),this.isRegistryReady=!0;const b={getEmbeddableFactory:this.getEmbeddableFactory,getEnhancement:this.getEnhancement},m=()=>((e,t,n)=>{const i=new Set;for(const e of Object.keys(g.a))i.add(e);for(const t of e){const e=t.migrations,n="function"==typeof e?e():e;Object.keys(n).forEach((e=>i.add(e)))}for(const e of t){const t=e.migrations,n="function"==typeof t?t():t;Object.keys(n).forEach((e=>i.add(e)))}const r={};return i.forEach((e=>{r[e]=t=>({...n(t,e)})})),r})(Array.from(this.embeddableFactories.values()),Array.from(this.enhancements.values()),Object(f.c)(b)),h={getEmbeddableFactory:this.getEmbeddableFactory,getEmbeddableFactories:this.getEmbeddableFactories,getAttributeService:(t,n)=>new attribute_service_AttributeService(t,e.notifications.toasts,n,this.getEmbeddableFactory),getStateTransfer:t=>t?new l.a(e.application.navigateToApp,e.application.currentAppId$,this.appList,t):this.stateTransferService,telemetry:Object(f.d)(b),extract:Object(f.a)(b),inject:Object(f.b)(b),getAllMigrations:m,migrateToLatest:e=>Object(s.migrateToLatest)(m(),e)};return Object(E.f)(e,h,t),h}stop(){this.appListSubscription&&this.appListSubscription.unsubscribe()}}var O=n(26),x=n.n(O),P=n(37),I=n.n(P),w=n(4);const T=({showShadow:e})=>Object(m.jsx)(w.EuiPanel,{role:"figure",paddingSize:"none",hasShadow:e,className:"embPanel embPanel--loading embPanel-isLoading","data-test-subj":"embeddablePanelLoadingIndicator"},Object(m.jsx)(w.EuiLoadingChart,{size:"l",mono:!0})),A=e=>{const t=(({embeddable:e})=>{const{loading:t,value:i}=I()((async()=>{const t=Object(E.h)(),i=n.e(2).then(n.bind(null,60)),r="function"==typeof e?e():Promise.resolve(e),[,a,o]=await Promise.all([t,r,i]);return{panelModule:o,unwrappedEmbeddable:a}}),[]);if(!t&&null!=i&&i.panelModule&&null!=i&&i.unwrappedEmbeddable)return{unwrappedEmbeddable:i.unwrappedEmbeddable,Panel:i.panelModule.EmbeddablePanel}})({embeddable:e.embeddable});if(!t)return Object(m.jsx)(T,null);const{embeddable:i,...r}=e;return Object(m.jsx)(t.Panel,x()({embeddable:t.unwrappedEmbeddable},r))};var C=n(20);const M=c.a.lazy((async()=>({default:(await n.e(1).then(n.bind(null,59))).AddPanelFlyout}))),R=({container:e,onAddPanel:t,onClose:n})=>E.b.overlays.openFlyout(Object(C.toMountPoint)(Object(m.jsx)(u.Suspense,{fallback:Object(m.jsx)(w.EuiLoadingSpinner,null)},Object(m.jsx)(M,{container:e,onAddPanel:t})),{theme$:E.b.theme.theme$}),{"data-test-subj":"dashboardAddPanel",ownFocus:!0,onClose:e=>{n&&n(),e.close()}});function S(e){return new plugin_EmbeddablePublicPlugin(e)}},function(e,t,n){n(40),__kbnBundles__.define("plugin/embeddable/public",n,38),__kbnBundles__.define("plugin/embeddable/common",n,53)},function(e,t,n){n.p=window.__kbnPublicPath__.embeddable},function(e,t,n){switch(window.__kbnThemeTag__){case"v8dark":return n(42);case"v8light":return n(44)}},function(e,t,n){var i=n(22),r=n(43);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},function(e,t,n){(t=n(23)(!1)).push([e.i,'.embPanel{display:flex;flex:1;flex-direction:column;height:100%;min-height:26px;position:relative;z-index:auto}.embPanel-isLoading{align-items:center;justify-content:center}.embPanel .embPanel__content{border-bottom-left-radius:6px;border-bottom-right-radius:6px;display:flex;flex:1 1 100%;min-height:0;overflow:hidden;z-index:1}.embPanel .embPanel__content[data-error]{display:none}.embPanel .embPanel__content--fullWidth{width:100%}.embPanel__header{display:flex;flex:0 0 auto;justify-content:flex-end}.embPanel__title{align-items:center;color:#dfe5ef;display:flex;flex-grow:1;flex-wrap:wrap;font-size:12px;font-size:.85714rem;font-weight:700;line-height:1.14286rem;line-height:1.5;overflow:hidden;overflow-wrap:break-word!important;word-break:break-word}.embPanel__title:not(:empty){line-height:24px;padding-left:8px}.embPanel__title .embPanel__titleInner{align-items:center;display:flex;overflow:hidden;padding-right:8px}.embPanel__title .embPanel__titleTooltipAnchor{max-width:100%}.embPanel__title .embPanel__titleText{font-weight:700;max-width:100%;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}.embPanel__title .embPanel__placeholderTitleText{color:#535966;font-weight:400}.embPanel--dragHandle:not(.embPanel__title){flex-grow:1}.embPanel__header--floater{left:0;position:absolute;right:0;top:0}.embPanel__header--floater *{z-index:1000}.embPanel__optionsMenuButton{background-color:#d4dae51a;border-bottom-right-radius:0;border-top-left-radius:0}.embPanel__optionsMenuButton:focus{background-color:#36a2ef33}.embPanel__optionsMenuPopover-loading{width:256px}.embPanel__optionsMenuPopover-notification:after{color:#f68fbe;content:"•";font-size:24px;position:absolute;right:0;top:0;transform:translate(50%,-50%)}.embPanel .embPanel__optionsMenuButton{opacity:0}.embPanel .embPanel__optionsMenuButton:focus,.embPanel:hover .embPanel__optionsMenuButton{opacity:1}.embPanel--editing{outline-color:#535966!important;outline-style:dashed!important;outline-width:1px;transition:all .15s cubic-bezier(.694,.0482,.335,1)}.embPanel--editing:focus,.embPanel--editing:hover{box-shadow:0 1px 5px #00000040,0 3.6px 13px rgba(0,0,0,.175),0 8.4px 23px #00000026,0 23px 35px rgba(0,0,0,.125)}.embPanel--editing .embPanel--dragHandle{transition:background-color .15s cubic-bezier(.694,.0482,.335,1)}.embPanel--editing .embPanel--dragHandle:hover{background-color:#f3d3714d;cursor:move}.embPanel--editing .embPanel__optionsMenuButton{opacity:1}.embPanel--loading .embPanel__title{color:#7a7f89}.embPanel__error{padding:24px}.embPanel__error>*{max-height:100%;overflow:auto}.embPanel__label{padding-left:8px;position:absolute;z-index:1000}',""]),e.exports=t},function(e,t,n){var i=n(22),r=n(45);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},function(e,t,n){(t=n(23)(!1)).push([e.i,'.embPanel{display:flex;flex:1;flex-direction:column;height:100%;min-height:26px;position:relative;z-index:auto}.embPanel-isLoading{align-items:center;justify-content:center}.embPanel .embPanel__content{border-bottom-left-radius:6px;border-bottom-right-radius:6px;display:flex;flex:1 1 100%;min-height:0;overflow:hidden;z-index:1}.embPanel .embPanel__content[data-error]{display:none}.embPanel .embPanel__content--fullWidth{width:100%}.embPanel__header{display:flex;flex:0 0 auto;justify-content:flex-end}.embPanel__title{align-items:center;color:#1a1c21;display:flex;flex-grow:1;flex-wrap:wrap;font-size:12px;font-size:.85714rem;font-weight:700;line-height:1.14286rem;line-height:1.5;overflow:hidden;overflow-wrap:break-word!important;word-break:break-word}.embPanel__title:not(:empty){line-height:24px;padding-left:8px}.embPanel__title .embPanel__titleInner{align-items:center;display:flex;overflow:hidden;padding-right:8px}.embPanel__title .embPanel__titleTooltipAnchor{max-width:100%}.embPanel__title .embPanel__titleText{font-weight:700;max-width:100%;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}.embPanel__title .embPanel__placeholderTitleText{color:#98a2b3;font-weight:400}.embPanel--dragHandle:not(.embPanel__title){flex-grow:1}.embPanel__header--floater{left:0;position:absolute;right:0;top:0}.embPanel__header--floater *{z-index:1000}.embPanel__optionsMenuButton{background-color:#3437411a;border-bottom-right-radius:0;border-top-left-radius:0}.embPanel__optionsMenuButton:focus{background-color:#0077cc1a}.embPanel__optionsMenuPopover-loading{width:256px}.embPanel__optionsMenuPopover-notification:after{color:#f04e98;content:"•";font-size:24px;position:absolute;right:0;top:0;transform:translate(50%,-50%)}.embPanel .embPanel__optionsMenuButton{opacity:0}.embPanel .embPanel__optionsMenuButton:focus,.embPanel:hover .embPanel__optionsMenuButton{opacity:1}.embPanel--editing{outline-color:#98a2b3!important;outline-style:dashed!important;outline-width:1px;transition:all .15s cubic-bezier(.694,.0482,.335,1)}.embPanel--editing:focus,.embPanel--editing:hover{box-shadow:0 1px 5px #0000001a,0 3.6px 13px #00000012,0 8.4px 23px #0000000f,0 23px 35px #0000000d}.embPanel--editing .embPanel--dragHandle{transition:background-color .15s cubic-bezier(.694,.0482,.335,1)}.embPanel--editing .embPanel--dragHandle:hover{background-color:#fec5141a;cursor:move}.embPanel--editing .embPanel__optionsMenuButton{opacity:1}.embPanel--loading .embPanel__title{color:#69707d}.embPanel__error{padding:24px}.embPanel__error>*{max-height:100%;overflow:auto}.embPanel__label{padding-left:8px;position:absolute;z-index:1000}',""]),e.exports=t},function(e,t,n){switch(window.__kbnThemeTag__){case"v8dark":return n(47);case"v8light":return n(49)}},function(e,t,n){var i=n(22),r=n(48);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},function(e,t,n){(t=n(23)(!1)).push([e.i,".errorEmbeddableCompact__popover{height:100%}.errorEmbeddableCompact__popoverAnchor{max-width:100%}.errorEmbeddableCompact__button :hover{text-decoration:underline;-webkit-text-decoration-color:#7a7f89!important;text-decoration-color:#7a7f89!important}.errorEmbeddableCompact__text{color:#7a7f89;font-size:12px}",""]),e.exports=t},function(e,t,n){var i=n(22),r=n(50);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},function(e,t,n){(t=n(23)(!1)).push([e.i,".errorEmbeddableCompact__popover{height:100%}.errorEmbeddableCompact__popoverAnchor{max-width:100%}.errorEmbeddableCompact__button :hover{text-decoration:underline;-webkit-text-decoration-color:#69707d!important;text-decoration-color:#69707d!important}.errorEmbeddableCompact__text{color:#69707d;font-size:12px}",""]),e.exports=t},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(32),r=n(3),a=i.__importDefault(n(52));t.default=function(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={loading:!1});var o=r.useRef(0),s=a.default(),d=r.useState(n),l=d[0],u=d[1],c=r.useCallback((function(){for(var t=[],n=0;n