/*! 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.ml_bundle_jsonpfunction=window.ml_bundle_jsonpfunction||[]).push([[8],{259:function(e,t,l){"use strict";l.d(t,"a",(function(){return j}));var a=l(39),n=l.n(a),s=l(11),i=l(10),o=(l(2),l(21)),c=l(135),u=l(191),d=l(190),r=l(251),b=l(4);async function j(e,t){const{http:l,uiSettings:a,theme:j,i18n:m,application:{currentAppId$:p}}=e;return new Promise((async(O,w)=>{try{const x={groupsMap:Object(u.b)([]),jobsMap:{}},g=a.get("dateFormat:tz"),y="Browser"!==g?g:n.a.tz.guess(),v=()=>{f.close(),w()},M=async({jobIds:e,groups:t})=>{await f.close(),O({jobIds:e,groups:t})},f=e.overlays.openFlyout(Object(c.a)(Object(b.jsx)(o.KibanaContextProvider,{services:{...e,mlServices:Object(d.getMlGlobalServices)(l)}},Object(b.jsx)(r.a,{selectedIds:t,withTimeRangeSelector:!1,dateFormatTz:y,singleSelection:!1,timeseriesOnly:!0,onFlyoutClose:v,onSelectionConfirmed:M,maps:x})),{theme:j,i18n:m}),{"data-test-subj":"mlFlyoutJobSelector",ownFocus:!0,closeButtonProps:{"aria-label":"jobSelectorFlyout"}});p.pipe(Object(s.skip)(1),Object(s.takeUntil)(Object(i.from)(f.onClose)),Object(s.distinctUntilChanged)()).subscribe((()=>{f.close()}))}catch(e){w(e)}}))}},683:function(e,t,l){"use strict";l.r(t),l.d(t,"resolveAnomalySwimlaneUserInput",(function(){return w}));var a=l(2),n=l.n(a),s=l(135),i=l(106),o=l(117),c=l(28),u=l(15),d=l(6),r=l(4);const b=({defaultTitle:e,influencers:t,onCreate:l,onCancel:s,initialInput:i})=>{var b;const[j,m]=Object(a.useState)(e),[p,O]=Object(a.useState)(null!==(b=null==i?void 0:i.swimlaneType)&&void 0!==b?b:o.h.OVERALL),[w,x]=Object(a.useState)(null==i?void 0:i.viewBy),g=[{id:o.h.OVERALL,label:d.i18n.translate("xpack.ml.explorer.overallLabel",{defaultMessage:"Overall"})},{id:o.h.VIEW_BY,label:d.i18n.translate("xpack.ml.explorer.viewByLabel",{defaultMessage:"View by"})}],y=["",...t].map((e=>({value:e,text:e}))),v=j.length>0,M=v&&(p===o.h.OVERALL||p===o.h.VIEW_BY&&!!w),f={panelTitle:j,swimlaneType:p,...w?{viewBy:w}:{}};return Object(r.jsx)(c.EuiModal,{initialFocus:"[name=panelTitle]",onClose:s},Object(r.jsx)(c.EuiModalHeader,null,Object(r.jsx)(c.EuiModalHeaderTitle,null,Object(r.jsx)(u.FormattedMessage,{id:"xpack.ml.swimlaneEmbeddable.setupModal.title",defaultMessage:"Anomaly swim lane configuration"}))),Object(r.jsx)(c.EuiModalBody,null,Object(r.jsx)(c.EuiForm,null,Object(r.jsx)(c.EuiFormRow,{label:Object(r.jsx)(u.FormattedMessage,{id:"xpack.ml.swimlaneEmbeddable.panelTitleLabel",defaultMessage:"Panel title"}),isInvalid:!v},Object(r.jsx)(c.EuiFieldText,{id:"panelTitle",name:"panelTitle",value:j,onChange:e=>m(e.target.value),isInvalid:!v})),Object(r.jsx)(c.EuiFormRow,{label:Object(r.jsx)(u.FormattedMessage,{id:"xpack.ml.swimlaneEmbeddable.setupModal.swimlaneTypeLabel",defaultMessage:"Swim lane type"})},Object(r.jsx)(c.EuiButtonGroup,{id:"selectSwimlaneType",name:"selectSwimlaneType",color:"primary",isFullWidth:!0,legend:d.i18n.translate("xpack.ml.swimlaneEmbeddable.setupModal.swimlaneTypeLabel",{defaultMessage:"Swim lane type"}),options:g,idSelected:p,onChange:e=>O(e)})),p===o.h.VIEW_BY&&Object(r.jsx)(n.a.Fragment,null,Object(r.jsx)(c.EuiFormRow,{label:Object(r.jsx)(u.FormattedMessage,{id:"xpack.ml.explorer.viewByLabel",defaultMessage:"View by"})},Object(r.jsx)(c.EuiSelect,{id:"selectViewBy",name:"selectViewBy",options:y,value:w,onChange:e=>x(e.target.value)}))))),Object(r.jsx)(c.EuiModalFooter,null,Object(r.jsx)(c.EuiButtonEmpty,{onClick:s},Object(r.jsx)(u.FormattedMessage,{id:"xpack.ml.swimlaneEmbeddable.setupModal.cancelButtonLabel",defaultMessage:"Cancel"})),Object(r.jsx)(c.EuiButton,{isDisabled:!M,onClick:l.bind(null,f),fill:!0},Object(r.jsx)(u.FormattedMessage,{id:"xpack.ml.swimlaneEmbeddable.setupModal.confirmButtonLabel",defaultMessage:"Confirm"}))))};var j=l(272),m=l(25),p=l(259),O=l(12);async function w(e,t){const{http:l,overlays:a,theme:n,i18n:c}=e,{getJobs:u}=Object(O.mlApiServicesProvider)(new m.a(l));return new Promise((async(l,d)=>{try{var m;const{jobIds:O}=await Object(p.a)(e,null==t?void 0:t.jobIds),w=null!==(m=null==t?void 0:t.title)&&void 0!==m?m:Object(j.getDefaultSwimlanePanelTitle)(O),{jobs:x}=await u({jobId:O.join(",")}),g=Object(i.h)(x);g.push(o.j);const y=a.openModal(Object(s.a)(Object(r.jsx)(b,{defaultTitle:w,influencers:g,initialInput:t,onCreate:e=>{y.close(),l({jobIds:O,title:e.panelTitle,...e})},onCancel:()=>{y.close(),d()}}),{theme:n,i18n:c}))}catch(e){d(e)}}))}}}]);