/*! 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.snapshotRestore_bundle_jsonpfunction=window.snapshotRestore_bundle_jsonpfunction||[]).push([[1],{37:function(e,t,s){e.exports=s(17)(1466)},38:function(e,t,s){"use strict";const a=s(43),o=s(44),i=s(45);function r(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function n(e,t){return t.encode?t.strict?a(e):encodeURIComponent(e):e}function l(e,t){return t.decode?o(e):e}function c(e){return Array.isArray(e)?e.sort():"object"==typeof e?c(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function u(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){const t=(e=u(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function d(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function j(e,t){r((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const s=function(e){let t;switch(e.arrayFormat){case"index":return(e,s,a)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===a[e]&&(a[e]={}),a[e][t[1]]=s):a[e]=s};case"bracket":return(e,s,a)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==a[e]?a[e]=[].concat(a[e],s):a[e]=[s]:a[e]=s};case"comma":case"separator":return(t,s,a)=>{const o="string"==typeof s&&s.split("").indexOf(e.arrayFormatSeparator)>-1?s.split(e.arrayFormatSeparator).map((t=>l(t,e))):null===s?s:l(s,e);a[t]=o};default:return(e,t,s)=>{void 0!==s[e]?s[e]=[].concat(s[e],t):s[e]=t}}}(t),a=Object.create(null);if("string"!=typeof e)return a;if(!(e=e.trim().replace(/^[?#&]/,"")))return a;for(const o of e.split("&")){let[e,r]=i(t.decode?o.replace(/\+/g," "):o,"=");r=void 0===r?null:["comma","separator"].includes(t.arrayFormat)?r:l(r,t),s(l(e,t),r,a)}for(const e of Object.keys(a)){const s=a[e];if("object"==typeof s&&null!==s)for(const e of Object.keys(s))s[e]=d(s[e],t);else a[e]=d(s,t)}return!1===t.sort?a:(!0===t.sort?Object.keys(a).sort():Object.keys(a).sort(t.sort)).reduce(((e,t)=>{const s=a[t];return Boolean(s)&&"object"==typeof s&&!Array.isArray(s)?e[t]=c(s):e[t]=s,e}),Object.create(null))}t.extract=p,t.parse=j,t.stringify=(e,t)=>{if(!e)return"";r((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const s=s=>t.skipNull&&null==e[s]||t.skipEmptyString&&""===e[s],a=function(e){switch(e.arrayFormat){case"index":return t=>(s,a)=>{const o=s.length;return void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?s:null===a?[...s,[n(t,e),"[",o,"]"].join("")]:[...s,[n(t,e),"[",n(o,e),"]=",n(a,e)].join("")]};case"bracket":return t=>(s,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?s:null===a?[...s,[n(t,e),"[]"].join("")]:[...s,[n(t,e),"[]=",n(a,e)].join("")];case"comma":case"separator":return t=>(s,a)=>null==a||0===a.length?s:0===s.length?[[n(t,e),"=",n(a,e)].join("")]:[[s,n(a,e)].join(e.arrayFormatSeparator)];default:return t=>(s,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?s:null===a?[...s,n(t,e)]:[...s,[n(t,e),"=",n(a,e)].join("")]}}(t),o={};for(const t of Object.keys(e))s(t)||(o[t]=e[t]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map((s=>{const o=e[s];return void 0===o?"":null===o?n(s,t):Array.isArray(o)?o.reduce(a(s),[]).join("&"):n(s,t)+"="+n(o,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[s,a]=i(e,"#");return Object.assign({url:s.split("?")[0]||"",query:j(p(e),t)},t&&t.parseFragmentIdentifier&&a?{fragmentIdentifier:l(a,t)}:{})},t.stringifyUrl=(e,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=u(e.url).split("?")[0]||"",o=t.extract(e.url),i=t.parse(o,{sort:!1}),r=Object.assign(i,e.query);let l=t.stringify(r,s);l&&(l=`?${l}`);let c=function(e){let t="";const s=e.indexOf("#");return-1!==s&&(t=e.slice(s)),t}(e.url);return e.fragmentIdentifier&&(c=`#${n(e.fragmentIdentifier,s)}`),`${a}${l}${c}`}},39:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=s(32),o=s(40),i=a.__importDefault(s(42));t.default=function(e,t){i.default(e,t,o.isDeepEqual)}},40:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDeepEqual=t.off=t.on=t.isClient=void 0;var a=s(32).__importDefault(s(41));t.isClient="object"==typeof window,t.on=function(e){for(var t=[],s=1;sencodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},44:function(e,t,s){"use strict";var a="%[a-f0-9]{2}",o=new RegExp("("+a+")|([^%]+?)","gi"),i=new RegExp("("+a+")+","gi");function r(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var s=e.slice(0,t),a=e.slice(t);return Array.prototype.concat.call([],r(s),r(a))}function n(e){try{return decodeURIComponent(e)}catch(a){for(var t=e.match(o)||[],s=1;s{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const s=e.indexOf(t);return-1===s?[e]:[e.slice(0,s),e.slice(s+t.length)]}},46:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=s(32),o=s(26),i=a.__importDefault(s(47));t.default=function(e,t,s){void 0===t&&(t=0),void 0===s&&(s=[]);var a=i.default(e,t),r=a[0],n=a[1],l=a[2];return o.useEffect(l,s),[r,n]}},47:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=s(26);t.default=function(e,t){void 0===t&&(t=0);var s=a.useRef(!1),o=a.useRef(),i=a.useRef(e),r=a.useCallback((function(){return s.current}),[]),n=a.useCallback((function(){s.current=!1,o.current&&clearTimeout(o.current),o.current=setTimeout((function(){s.current=!0,i.current()}),t)}),[t]),l=a.useCallback((function(){s.current=null,o.current&&clearTimeout(o.current)}),[]);return a.useEffect((function(){i.current=e}),[e]),a.useEffect((function(){return n(),l}),[t]),[r,l,n]}},48:function(e,t,s){"use strict";s.r(t),s.d(t,"mountManagementSection",(function(){return cs}));var a=s(7),o=s(6),i=s(12),r=s(26),n=s.n(r),l=s(34),c=s(37),u=s.n(c),p=s(30);const d={services:{}},j=Object(r.createContext)(d);var x=s(39),b=s.n(x),g=s(27);const m=({children:e,component:t,render:s,...a})=>{const o=Object(r.useMemo)((()=>{if(t)return e=>Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(h,null),Object(g.jsx)(t,e))}),[t]);if(o)return Object(g.jsx)(p.Route,u()({},a,{component:o}));if(s||"function"==typeof e){const t="function"==typeof e?e:s;return Object(g.jsx)(p.Route,u()({},a,{render:e=>Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(h,null),t(e))}))}return Object(g.jsx)(p.Route,a,Object(g.jsx)(h,null),e)},h=()=>{const{executionContext:e}=Object(r.useContext)(j).services,t=Object(p.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 O=s(33);const y=({children:e,...t})=>Object(g.jsx)(p.Router,t,Object(g.jsx)(O.CompatRouter,null,e));var f=s(31);const M=({legacySwitch:e=!0,children:t})=>{const s=Object(p.useRouteMatch)();return e?Object(g.jsx)(p.Switch,null,t):Object(g.jsx)(O.Routes,null,r.Children.map(t,(e=>{if(n.a.isValidElement(e)&&e.type===m){var a;const o=Object(f.replace)(null==e?void 0:e.props.path,s.url+"/",""),i="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)(O.Route,{path:o,element:Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(h,null),(null==e||null===(a=e.props)||void 0===a?void 0:a.component)&&Object(g.jsx)(e.props.component,null)||i&&i()||t)})}return e})))};var F=s(8),S=s(28),R=s(29),E=s(13),k=s(9),v=s(11);const L=Object(r.createContext)(void 0),T=({children:e,value:t})=>Object(g.jsx)(L.Provider,{value:t},e),D=(L.Consumer,()=>{const e=Object(r.useContext)(L);if(!e)throw new Error('"useAppContext" can only be called inside of AppContext.Provider!');return e}),C=()=>D().services,I=()=>D().core,w=()=>D().config,B=()=>{const{notifications:{toasts:e}}=I();return e},P=({data:e,children:t})=>{const{i18n:s}=C();return null!=e?t:Object(g.jsx)(n.a.Fragment,null,s.translate("xpack.snapshotRestore.dataPlaceholderLabel",{defaultMessage:"-"}))},z=({epochMs:e,type:t})=>{const s=new Date(e),a=Object(g.jsx)(R.FormattedDate,{value:s,year:"numeric",month:"short",day:"2-digit"}),o=Object(g.jsx)(R.FormattedTime,{value:s,timeZoneName:"short"});return t?"date"===t?a:o:Object(g.jsx)(r.Fragment,null,a," ",o)},A=({children:e})=>{const{i18n:t}=C(),s=B(),[a,i]=Object(r.useState)([]),[n,l]=Object(r.useState)(!1),c=Object(r.useRef)(null),u=()=>{l(!1),i([])},p=()=>{const e=[...a];Object(o.e)(e).then((({data:a,error:o})=>{const{itemsDeleted:i,errors:r}=a||{itemsDeleted:void 0,errors:void 0};if(i&&i.length){const e=i.length>1?t.translate("xpack.snapshotRestore.deleteRepository.successMultipleNotificationTitle",{defaultMessage:"Removed {count} repositories",values:{count:i.length}}):t.translate("xpack.snapshotRestore.deleteRepository.successSingleNotificationTitle",{defaultMessage:"Removed repository '{name}'",values:{name:i[0]}});s.addSuccess(e),c.current&&c.current([...i])}if(o||r&&r.length){const a=r&&r.length>1||o&&e.length>1?t.translate("xpack.snapshotRestore.deleteRepository.errorMultipleNotificationTitle",{defaultMessage:"Error removing {count} repositories",values:{count:r&&r.length||e.length}}):t.translate("xpack.snapshotRestore.deleteRepository.errorSingleNotificationTitle",{defaultMessage:"Error removing repository '{name}'",values:{name:r&&r[0].name||e[0]}});s.addDanger(a)}})),u()};return Object(g.jsx)(r.Fragment,null,e(((e,t=(()=>{}))=>{if(!e||!e.length)throw new Error("No repository names specified for deletion");l(!0),i(e),c.current=t})),(()=>{if(!n)return null;const e=1===a.length;return Object(g.jsx)(S.EuiConfirmModal,{title:e?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.deleteSingleTitle",defaultMessage:"Remove repository '{name}'?",values:{name:a[0]}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.deleteMultipleTitle",defaultMessage:"Remove {count} repositories?",values:{count:a.length}}),onCancel:u,onConfirm:p,cancelButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:e?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.confirmSingleButtonLabel",defaultMessage:"Remove repository"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.confirmMultipleButtonLabel",defaultMessage:"Remove repositories"}),buttonColor:"danger","data-test-subj":"deleteRepositoryConfirmation"},e?Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.deleteSingleDescription",defaultMessage:"The snapshots in this repository will still exist, but Elasticsearch won’t have access to them. Adjust policies that use this repository to prevent scheduled snapshots from failing."})):Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.deleteMultipleListDescription",defaultMessage:"You are about to remove these repositories:"})),Object(g.jsx)("ul",null,a.map((e=>Object(g.jsx)("li",{key:e},e)))),Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteRepository.confirmModal.deleteMultipleDescription",defaultMessage:"The snapshots in these repositories will still exist, but Elasticsearch won't have access to them. Adjust policies that use these repositories to prevent scheduled snapshots from failing."}))))})())},N=(e,t=[])=>e instanceof Object?Object.keys(e).reduce(((s,a)=>{const o=N(e[a],[...t,a]);return Object.assign(s,o)}),{}):{[t.join(".")]:e};s(35);var W=s(0);const G=(e,t)=>`${e}${t}`,V=e=>e&&Array.isArray(e)?e:"string"==typeof e?e.split(","):void 0;function U(e){const{expireAfterValue:t,expireAfterUnit:s,minCount:a,maxCount:o}=e,i={expire_after:t&&s?G(t,s):void 0,min_count:a||void 0,max_count:o||void 0},r=Object.entries(i).reduce(((e,[t,s])=>(void 0!==s&&(e[t]=s),e)),{});return Object.entries(r).length?r:void 0}var _=s(3);const H=['"',"*","\\","<","|",",",">","/","?","#"],q=e=>!e||!Boolean(e.trim()),$=(e,t=!0)=>{const{name:s,type:a,settings:o}=e,{i18n:i}=_.a,r={isValid:!0,errors:{}};if(t){const e=Y(a,o);Object.keys(e).length&&(r.errors.settings=e)}q(s)&&(r.errors.name=[i.translate("xpack.snapshotRestore.repositoryValidation.nameRequired",{defaultMessage:"Repository name is required."})]),s.includes(" ")&&(r.errors.name=[i.translate("xpack.snapshotRestore.repositoryValidation.nameValidation.errorSpace",{defaultMessage:"Spaces are not allowed in the name."})]);const n=((e,t)=>{const s=Array.isArray(t)?t:[t],a=s.length;let o=!1,i=null;for(let t=0;t{switch(e){case W.g.fs:return J(t);case W.g.url:return K(t);case W.g.source:return Y(t.delegateType,t);case W.g.s3:return Q(t);case W.g.gcs:return Z(t);case W.g.hdfs:return X(t);default:return{}}},J=e=>{const t=_.a.i18n,s={},{location:a}=e;return q(a)&&(s.location=[t.translate("xpack.snapshotRestore.repositoryValidation.locationRequired",{defaultMessage:"Location is required."})]),s},K=e=>{const t=_.a.i18n,s={},{url:a}=e;return q(a)&&(s.url=[t.translate("xpack.snapshotRestore.repositoryValidation.urlRequired",{defaultMessage:"URL is required."})]),s},Q=e=>{const t=_.a.i18n,s={},{bucket:a}=e;return q(a)&&(s.bucket=[t.translate("xpack.snapshotRestore.repositoryValidation.bucketRequired",{defaultMessage:"Bucket is required."})]),s},Z=e=>{const t=_.a.i18n,s={},{bucket:a}=e;return q(a)&&(s.bucket=[t.translate("xpack.snapshotRestore.repositoryValidation.bucketRequired",{defaultMessage:"Bucket is required."})]),s},X=e=>{const t=_.a.i18n,s={},{uri:a,path:o}=e;return q(a)&&(s.uri=[t.translate("xpack.snapshotRestore.repositoryValidation.uriRequired",{defaultMessage:"URI is required."})]),q(o)&&(s.path=[t.translate("xpack.snapshotRestore.repositoryValidation.pathRequired",{defaultMessage:"Path is required."})]),s};var ee=s(2);const te=e=>!e||!Boolean(e.trim()),se=e=>!e||!Boolean(e.trim()),ae=(e,t)=>{switch(t){case k.e.fs:return e.links.snapshotRestore.registerSharedFileSystem;case k.e.url:return`${e.links.snapshotRestore.registerUrl}`;case k.e.source:return`${e.links.snapshotRestore.registerSourceOnly}`;case k.e.s3:return`${e.links.plugins.s3Repo}`;case k.e.hdfs:return`${e.links.plugins.hdfsRepo}`;case k.e.azure:return`${e.links.plugins.azureRepo}`;case k.e.gcs:return`${e.links.plugins.gcsRepo}`;default:return`${e.links.snapshotRestore.guide}`}},oe=({repository:e,onNext:t,updateRepository:s,validation:a})=>{const{error:i,isLoading:n,data:l=[]}=Object(o.t)(),{docLinks:c}=I(),u=!a.isValid,p=Object(g.jsx)(S.EuiLink,{href:c.links.plugins.snapshotRestoreRepos,target:"_blank"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.typePluginsDocLinkText",defaultMessage:"Learn more about repository types."}));return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.nameDescriptionTitle",defaultMessage:"Repository name"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.nameDescription",defaultMessage:"A unique name for the repository."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.nameLabel",defaultMessage:"Name"}),isInvalid:Boolean(u&&a.errors.name),error:a.errors.name,fullWidth:!0},Object(g.jsx)(S.EuiFieldText,{defaultValue:e.name,fullWidth:!0,onChange:e=>{s({name:e.target.value})},"data-test-subj":"nameInput"}))),Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.typeDescriptionTitle",defaultMessage:"Repository type"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiText,{id:"repositoryTypeDescription",size:"s",color:"subdued"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.defaultTypeDescription",defaultMessage:"Storage location for your snapshots. {docLink}",values:{docLink:p}})),Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,describedByIds:["repositoryTypeDescription"],fullWidth:!0,isInvalid:Boolean(u&&a.errors.type),error:a.errors.type},i?Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.loadingRepositoryTypesErrorMessage",defaultMessage:"Error loading repository types"}),error:i}):n?Object(g.jsx)(ye,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.loadingRepositoryTypesDescription",defaultMessage:"Loading repository types…"})):l.length?Object(g.jsx)(S.EuiFlexGrid,{columns:4},l.map(((t,a)=>((t,a)=>{const o=(e.type===k.e.source?e.settings.delegateType:e.type)===t,i=_.a.getRepositoryTypeName(t);return Object(g.jsx)(S.EuiFlexItem,{key:a},Object(g.jsx)(S.EuiCard,{title:i,icon:Object(g.jsx)(he,{type:t,size:"l"}),description:Object(g.jsx)(r.Fragment,null),footer:Object(g.jsx)(S.EuiButtonEmpty,{href:ae(c,t),target:"_blank",size:"xs",iconType:"iInCircle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.typeDocsLinkText",defaultMessage:"Learn more"})),selectable:{onClick:()=>{return a=t,void(e.type===k.e.source?s({settings:{delegateType:a}}):s({type:a,settings:{}}));var a},isSelected:o},"data-test-subj":`${t}RepositoryType`}))})(t,a)))):Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.noRepositoryTypesErrorTitle",defaultMessage:"No repository types available"}),color:"warning","data-test-subj":"noRepositoryTypesError"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.noRepositoryTypesErrorMessage",defaultMessage:"You can install plugins to enable different repository types. {docLink}",values:{docLink:p}}))),Object(g.jsx)(S.EuiSpacer,{size:"m"})),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.sourceOnlyDescriptionTitle",defaultMessage:"Source-only snapshots"}))),description:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.sourceOnlyDescription",defaultMessage:"Creates source-only snapshots that take up to 50% less space. {docLink}",values:{docLink:Object(g.jsx)(S.EuiLink,{href:ae(c,k.e.source),target:"_blank"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.sourceOnlyDocLinkText",defaultMessage:"Learn more about source-only repositories."}))}})),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.sourceOnlyLabel",defaultMessage:"Source-only snapshots"}),checked:e.type===k.e.source,onChange:t=>{if(t.target.checked)s({type:k.e.source,settings:{...e.settings,delegateType:e.type}});else{const{settings:{delegateType:t,...a}}=e;s({type:t||null,settings:a})}},"data-test-subj":"sourceOnlyToggle"}))),u?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.validationErrorTitle",defaultMessage:"Fix errors before continuing."}),color:"danger","data-test-subj":"repositoryFormError"}),Object(g.jsx)(S.EuiSpacer,{size:"m"})):null,Object(g.jsx)(S.EuiButton,{color:"primary",onClick:t,fill:!0,iconType:"arrowRight",iconSide:"right","data-test-subj":"nextButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.nextButtonLabel",defaultMessage:"Next"})))},ie=({isInvalid:e,error:t,defaultValue:s,updateSettings:a})=>Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.chunkSizeTitle",defaultMessage:"Chunk size"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.chunkSizeDescription",defaultMessage:"Breaks files into smaller units when taking snapshots."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.chunkSizeLabel",defaultMessage:"Chunk size"}),fullWidth:!0,isInvalid:e,error:t,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.chunkSizeHelpText",defaultMessage:"Accepts byte size units, such as {example1}, {example2}, {example3}, or {example4}. Defaults to unlimited.",values:{example1:Object(g.jsx)(S.EuiCode,null,"1g"),example2:Object(g.jsx)(S.EuiCode,null,"10mb"),example3:Object(g.jsx)(S.EuiCode,null,"5k"),example4:Object(g.jsx)(S.EuiCode,null,"1024B")}})},Object(g.jsx)(S.EuiFieldText,{defaultValue:s,fullWidth:!0,onChange:e=>a("chunkSize",e.target.value),"data-test-subj":"chunkSizeInput"}))),re=({isInvalid:e,error:t,defaultValue:s,updateSettings:a})=>Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxRestoreBytesTitle",defaultMessage:"Max restore bytes per second"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxRestoreBytesDescription",defaultMessage:"Maximum snapshot restore rate for each node."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxRestoreBytesLabel",defaultMessage:"Max restore bytes per second"}),fullWidth:!0,isInvalid:e,error:t,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxRestoreBytesHelpText",defaultMessage:"Accepts byte size units, such as {example1}, {example2}, {example3}, or {example4}. Defaults to unlimited.",values:{example1:Object(g.jsx)(S.EuiCode,null,"1g"),example2:Object(g.jsx)(S.EuiCode,null,"10mb"),example3:Object(g.jsx)(S.EuiCode,null,"5k"),example4:Object(g.jsx)(S.EuiCode,null,"1024B")}})},Object(g.jsx)(S.EuiFieldText,{defaultValue:s,fullWidth:!0,onChange:e=>a("maxRestoreBytesPerSec",e.target.value),"data-test-subj":"maxRestoreBytesInput"}))),ne=({isInvalid:e,error:t,defaultValue:s,updateSettings:a})=>Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxSnapshotBytesTitle",defaultMessage:"Max snapshot bytes per second"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxSnapshotBytesDescription",defaultMessage:"Maximum rate for creating snapshots for each node."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxSnapshotBytesLabel",defaultMessage:"Max snapshot bytes per second"}),fullWidth:!0,isInvalid:e,error:t,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.commonFields.maxSnapshotBytesHelpText",defaultMessage:"Accepts byte size units, such as {example1}, {example2}, {example3}, or {example4}. Defaults to {defaultSize} per second.",values:{example1:Object(g.jsx)(S.EuiCode,null,"1g"),example2:Object(g.jsx)(S.EuiCode,null,"10mb"),example3:Object(g.jsx)(S.EuiCode,null,"5k"),example4:Object(g.jsx)(S.EuiCode,null,"1024B"),defaultSize:Object(g.jsx)(S.EuiCode,null,"40mb")}})},Object(g.jsx)(S.EuiFieldText,{defaultValue:s,fullWidth:!0,onChange:e=>a("maxSnapshotBytesPerSec",e.target.value),"data-test-subj":"maxSnapshotBytesInput"}))),le=({repository:e,updateRepositorySettings:t,settingErrors:s})=>{const{settings:{client:a,container:o,basePath:i,compress:n,chunkSize:l,readonly:c,locationMode:u,maxRestoreBytesPerSec:p,maxSnapshotBytesPerSec:d}}=e,j=Boolean(Object.keys(s).length),x=["primary_only","secondary_only"].map((e=>({value:e,text:e}))),b=(e,s)=>{t({[e]:s})};return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.clientTitle",defaultMessage:"Client"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.clientDescription",defaultMessage:"The name of the Azure client."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.clientLabel",defaultMessage:"Client"}),fullWidth:!0,isInvalid:Boolean(j&&s.client),error:s.client},Object(g.jsx)(S.EuiFieldText,{defaultValue:a||"",fullWidth:!0,onChange:e=>{t({client:e.target.value})},"data-test-subj":"clientInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.containerTitle",defaultMessage:"Container"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.containerDescription",defaultMessage:"The name of the Azure container to use for snapshots."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.containerLabel",defaultMessage:"Container"}),fullWidth:!0,isInvalid:Boolean(j&&s.container),error:s.container},Object(g.jsx)(S.EuiFieldText,{defaultValue:o||"",fullWidth:!0,onChange:e=>{t({container:e.target.value})},"data-test-subj":"containerInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.basePathTitle",defaultMessage:"Base path"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.basePathDescription",defaultMessage:"The container path to the repository data."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.basePathLabel",defaultMessage:"Base path"}),fullWidth:!0,isInvalid:Boolean(j&&s.basePath),error:s.basePath},Object(g.jsx)(S.EuiFieldText,{defaultValue:i||"",fullWidth:!0,onChange:e=>{t({basePath:e.target.value})},"data-test-subj":"basePathInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.compressTitle",defaultMessage:"Snapshot compression"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.compressDescription",defaultMessage:"Compresses the index mapping and setting files for snapshots. Data files are not compressed."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(j&&s.compress),error:s.compress},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.compressLabel",defaultMessage:"Compress snapshots"}),checked:!(!1===n),onChange:e=>{t({compress:e.target.checked})},"data-test-subj":"compressToggle"}))),Object(g.jsx)(ie,{isInvalid:Boolean(j&&s.chunkSize),error:s.chunkSize,defaultValue:l||"",updateSettings:b}),Object(g.jsx)(ne,{isInvalid:Boolean(j&&s.maxSnapshotBytesPerSec),error:s.maxSnapshotBytesPerSec,defaultValue:d||"",updateSettings:b}),Object(g.jsx)(re,{isInvalid:Boolean(j&&s.maxRestoreBytesPerSec),error:s.maxRestoreBytesPerSec,defaultValue:p||"",updateSettings:b}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.locationModeTitle",defaultMessage:"Location mode"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.locationModeDescription",defaultMessage:"The primary or secondary location. If secondary, read-only is true."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.locationModeLabel",defaultMessage:"Location mode"}),fullWidth:!0,isInvalid:Boolean(j&&s.locationMode),error:s.locationMode},Object(g.jsx)(S.EuiSelect,{options:x,value:u||x[0].value,onChange:e=>{t({locationMode:e.target.value,readonly:e.target.value===x[1].value||c})},fullWidth:!0,"data-test-subj":"locationModeSelect"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.readonlyTitle",defaultMessage:"Read-only"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.readonlyDescription",defaultMessage:"Only one cluster should have write access to this repository. All other clusters should be read-only."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(j&&s.readonly),error:s.readonly},Object(g.jsx)(S.EuiSwitch,{disabled:u===x[1].value,label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeAzure.readonlyLabel",defaultMessage:"Read-only repository"}),checked:!!c,onChange:e=>{t({readonly:u===x[1].value||e.target.checked})},"data-test-subj":"readOnlyToggle"}))))},ce=({repository:e,updateRepositorySettings:t,settingErrors:s})=>{const{settings:{location:a,compress:o,chunkSize:i,maxRestoreBytesPerSec:n,maxSnapshotBytesPerSec:l,readonly:c}}=e,u=Boolean(Object.keys(s).length),p=(e,s)=>{t({[e]:s})};return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.locationTitle",defaultMessage:"File system location"}))),description:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryFor.typeFS.locationDescription",defaultMessage:"The location must be registered in the {settingKey} setting on all master and data nodes.",values:{settingKey:Object(g.jsx)(S.EuiCode,null,"path.repo")}})),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.locationLabel",defaultMessage:"Location (required)"}),fullWidth:!0,isInvalid:Boolean(u&&s.location),error:s.location},Object(g.jsx)(S.EuiFieldText,{defaultValue:a||"",fullWidth:!0,onChange:e=>{t({location:e.target.value})},"data-test-subj":"locationInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.compressTitle",defaultMessage:"Snapshot compression"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.compressDescription",defaultMessage:"Compresses the index mapping and setting files for snapshots. Data files are not compressed."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(u&&s.compress),error:s.compress},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.compressLabel",defaultMessage:"Compress snapshots"}),checked:!!o,onChange:e=>{t({compress:e.target.checked})},"data-test-subj":"compressToggle"}))),Object(g.jsx)(ie,{isInvalid:Boolean(u&&s.chunkSize),error:s.chunkSize,defaultValue:i||"",updateSettings:p}),Object(g.jsx)(ne,{isInvalid:Boolean(u&&s.maxSnapshotBytesPerSec),error:s.maxSnapshotBytesPerSec,defaultValue:l||"",updateSettings:p}),Object(g.jsx)(re,{isInvalid:Boolean(u&&s.maxRestoreBytesPerSec),error:s.maxRestoreBytesPerSec,defaultValue:n||"",updateSettings:p}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.readonlyTitle",defaultMessage:"Read-only"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.readonlyDescription",defaultMessage:"Only one cluster should have write access to this repository. All other clusters should be read-only."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(u&&s.readonly),error:s.readonly},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeFS.readonlyLabel",defaultMessage:"Read-only repository"}),checked:!!c,onChange:e=>{t({readonly:e.target.checked})},"data-test-subj":"readOnlyToggle"}))))},ue=({repository:e,updateRepositorySettings:t,settingErrors:s})=>{const{settings:{bucket:a,client:o,basePath:i,compress:n,chunkSize:l,maxRestoreBytesPerSec:c,maxSnapshotBytesPerSec:u,readonly:p}}=e,d=Boolean(Object.keys(s).length),j=(e,s)=>{t({[e]:s})};return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.clientTitle",defaultMessage:"Client"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.clientDescription",defaultMessage:"The name of the Google Cloud Storage client."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.clientLabel",defaultMessage:"Client"}),fullWidth:!0,isInvalid:Boolean(d&&s.client),error:s.client},Object(g.jsx)(S.EuiFieldText,{defaultValue:o||"",fullWidth:!0,onChange:e=>{t({client:e.target.value})},"data-test-subj":"clientInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.bucketTitle",defaultMessage:"Bucket"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.bucketDescription",defaultMessage:"The name of the Google Cloud Storage bucket to use for snapshots."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.bucketLabel",defaultMessage:"Bucket (required)"}),fullWidth:!0,isInvalid:Boolean(d&&s.bucket),error:s.bucket},Object(g.jsx)(S.EuiFieldText,{defaultValue:a||"",fullWidth:!0,onChange:e=>{t({bucket:e.target.value})},"data-test-subj":"bucketInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.basePathTitle",defaultMessage:"Base path"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.basePathDescription",defaultMessage:"The bucket path to the repository data."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.basePathLabel",defaultMessage:"Base path"}),fullWidth:!0,isInvalid:Boolean(d&&s.basePath),error:s.basePath},Object(g.jsx)(S.EuiFieldText,{defaultValue:i||"",fullWidth:!0,onChange:e=>{t({basePath:e.target.value})},"data-test-subj":"basePathInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.compressTitle",defaultMessage:"Compress snapshots"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.compressDescription",defaultMessage:"Compresses the index mapping and setting files for snapshots. Data files are not compressed."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(d&&s.compress),error:s.compress},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.compressLabel",defaultMessage:"Compress snapshots"}),checked:!(!1===n),onChange:e=>{t({compress:e.target.checked})},"data-test-subj":"compressToggle"}))),Object(g.jsx)(ie,{isInvalid:Boolean(d&&s.chunkSize),error:s.chunkSize,defaultValue:l||"",updateSettings:j}),Object(g.jsx)(ne,{isInvalid:Boolean(d&&s.maxSnapshotBytesPerSec),error:s.maxSnapshotBytesPerSec,defaultValue:u||"",updateSettings:j}),Object(g.jsx)(re,{isInvalid:Boolean(d&&s.maxRestoreBytesPerSec),error:s.maxRestoreBytesPerSec,defaultValue:c||"",updateSettings:j}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.readonlyTitle",defaultMessage:"Read-only"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.readonlyDescription",defaultMessage:"Only one cluster should have write access to this repository. All other clusters should be read-only."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(d&&s.readonly),error:s.readonly},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeGCS.readonlyLabel",defaultMessage:"Read-only repository"}),checked:!!p,onChange:e=>{t({readonly:e.target.checked})},"data-test-subj":"readOnlyToggle"}))))},pe=({repository:e,updateRepositorySettings:t,settingErrors:s})=>{const{name:o,settings:{delegateType:i,uri:n,path:l,loadDefaults:c,compress:u,chunkSize:p,maxRestoreBytesPerSec:d,maxSnapshotBytesPerSec:j,readonly:x,"security.principal":b,...m}}=e,h=Boolean(Object.keys(s).length),O=(e,s)=>{t({[e]:s})},[y,f]=Object(r.useState)(JSON.stringify(m,null,2)),[M,E]=Object(r.useState)(!1);return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.uriTitle",defaultMessage:"URI"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.uriDescription",defaultMessage:"The URI address for HDFS."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.uriLabel",defaultMessage:"URI (required)"}),fullWidth:!0,isInvalid:Boolean(h&&s.uri),error:s.uri},Object(g.jsx)(S.EuiFieldText,{prepend:Object(g.jsx)(S.EuiText,{size:"s",id:"hdfsRepositoryUriProtocolDescription"},"hdfs://"),defaultValue:n?n.split("hdfs://")[1]:"",fullWidth:!0,onChange:e=>{t({uri:e.target.value?`hdfs://${e.target.value}`:""})},"aria-describedby":"hdfsRepositoryUriProtocolDescription","data-test-subj":"uriInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.pathTitle",defaultMessage:"Path"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.pathDescription",defaultMessage:"The file path where data is stored."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.pathLabel",defaultMessage:"Path (required)"}),fullWidth:!0,isInvalid:Boolean(h&&s.path),error:s.path},Object(g.jsx)(S.EuiFieldText,{defaultValue:l||"",fullWidth:!0,onChange:e=>{t({path:e.target.value})},"data-test-subj":"pathInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.loadDefaultsTitle",defaultMessage:"Load defaults"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.loadDefaultsDescription",defaultMessage:"Loads the default Hadoop configuration."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(h&&s.loadDefaults),error:s.loadDefaults},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.loadDefaultsLabel",defaultMessage:"Load defaults"}),checked:!(!1===c),onChange:e=>{t({loadDefaults:e.target.checked})},"data-test-subj":"loadDefaultsToggle"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.compressTitle",defaultMessage:"Snapshot compression"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.compressDescription",defaultMessage:"Compresses the index mapping and setting files for snapshots. Data files are not compressed."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(h&&s.compress),error:s.compress},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.compressLabel",defaultMessage:"Compress snapshots"}),checked:!(!1===u),onChange:e=>{t({compress:e.target.checked})},"data-test-subj":"compressToggle"}))),Object(g.jsx)(ie,{isInvalid:Boolean(h&&s.chunkSize),error:s.chunkSize,defaultValue:p||"",updateSettings:O}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.securityPrincipalTitle",defaultMessage:"Security principal"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.securityPrincipalDescription",defaultMessage:"The Kerberos principal to use when connecting to a secured HDFS cluster."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.securityPrincipalLabel",defaultMessage:"Security principal"}),fullWidth:!0,isInvalid:Boolean(h&&s.securityPrincipal),error:s.securityPrincipal},Object(g.jsx)(S.EuiFieldText,{defaultValue:b||"",fullWidth:!0,onChange:e=>{t({"security.principal":e.target.value})},"data-test-subj":"securityPrincipalInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.configurationTitle",defaultMessage:"Configuration"}))),description:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.configurationDescription",defaultMessage:"Additional JSON format configuration parameters to add to the Hadoop configuration. Only client-oriented properties from the Hadoop core and HDFS files are recognized."})),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.configurationLabel",defaultMessage:"Configuration"}),fullWidth:!0,isInvalid:M,error:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.configurationFormatError",defaultMessage:"Invalid JSON format"}),helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.configurationKeyDescription",defaultMessage:"Keys should be in the format {confKeyFormat}.",values:{confKeyFormat:Object(g.jsx)(S.EuiCode,null,"conf.")}})},Object(g.jsx)(F.CodeEditor,{languageId:"json",value:y,"data-test-subj":"codeEditor",height:250,options:{lineNumbers:"off",tabSize:2,automaticLayout:!0},"aria-label":a.i18n.translate("xpack.snapshotRestore.repositoryForm.typeHDFS.configurationAriaLabel",{defaultMessage:"Additional configuration for HDFS repository '{name}'",values:{name:o}}),onChange:e=>{f(e);try{const s=JSON.parse(e);E(!1),t({delegateType:i,uri:n,path:l,loadDefaults:c,compress:u,chunkSize:p,"security.principal":b,...s},!0)}catch(e){E(!0)}}}))),Object(g.jsx)(ne,{isInvalid:Boolean(h&&s.maxSnapshotBytesPerSec),error:s.maxSnapshotBytesPerSec,defaultValue:j||"",updateSettings:O}),Object(g.jsx)(re,{isInvalid:Boolean(h&&s.maxRestoreBytesPerSec),error:s.maxRestoreBytesPerSec,defaultValue:d||"",updateSettings:O}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.readonlyTitle",defaultMessage:"Read-only"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.readonlyDescription",defaultMessage:"Only one cluster should have write access to this repository. All other clusters should be read-only."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(h&&s.readonly),error:s.readonly},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeHDFS.readonlyLabel",defaultMessage:"Read-only repository"}),checked:!!x,onChange:e=>{t({readonly:e.target.checked})},"data-test-subj":"readOnlyToggle"}))))},de=({repository:e,updateRepositorySettings:t,settingErrors:s})=>{const{settings:{url:a}}=e,o=Boolean(Object.keys(s).length),[i,n]=Object(r.useState)(a?a.split("://")[0]:"http");return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeReadonly.urlTitle",defaultMessage:"URL"}))),description:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeReadonly.urlDescription",defaultMessage:"The location of the snapshots."})),fullWidth:!0},Object(g.jsx)("div",null,Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"s"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeReadonly.urlSchemeLabel",defaultMessage:"Scheme"}),fullWidth:!0},Object(g.jsx)(S.EuiSelect,{options:[{value:"http",text:"http://"},{value:"https",text:"https://"},{value:"ftp",text:"ftp://"},{value:"file",text:"file://"}],value:i,onChange:e=>n(e.target.value),"aria-controls":"readonlyRepositoryUrlHelp","data-test-subj":"schemeSelect"}))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeReadonly.urlLabel",defaultMessage:"Path (required)"}),fullWidth:!0,describedByIds:["readonlyRepositoryUrlHelp"],isInvalid:Boolean(o&&s.url),error:s.url},Object(g.jsx)(S.EuiFieldText,{defaultValue:a?a.split("://")[1]:"",fullWidth:!0,onChange:e=>{t({url:`${i}://${e.target.value}`})},"data-test-subj":"urlInput"})))),Object(g.jsx)(S.EuiFormHelpText,{id:"readonlyRepositoryUrlHelp","aria-live":"polite"},function(e){switch(e){case"http":case"https":case"ftp":return Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeReadonly.urlAllowedDescription",defaultMessage:"This URL must be registered in the {settingKey} setting.",values:{settingKey:Object(g.jsx)(S.EuiCode,null,"repositories.url.allowed_urls")}});case"file":return Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeReadonly.urlFilePathDescription",defaultMessage:"This file location must be registered in the {settingKey} setting.",values:{settingKey:Object(g.jsx)(S.EuiCode,null,"path.repo")}});default:return null}}(i)))))},je=({repository:e,updateRepositorySettings:t,settingErrors:s})=>{const{settings:{bucket:a,client:o,basePath:i,compress:n,chunkSize:l,serverSideEncryption:c,bufferSize:u,cannedAcl:p,storageClass:d,maxRestoreBytesPerSec:j,maxSnapshotBytesPerSec:x,readonly:b}}=e,m=["private","public-read","public-read-write","authenticated-read","log-delivery-write","bucket-owner-read","bucket-owner-full-control"].map((e=>({value:e,text:e}))),h=Boolean(Object.keys(s).length),O=(e,s)=>{t({[e]:s})},y=["standard","reduced_redundancy","standard_ia","intelligent_tiering","onezone_ia"].map((e=>({value:e,text:e})));return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.clientTitle",defaultMessage:"Client"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.clientDescription",defaultMessage:"The name of the AWS S3 client."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.clientLabel",defaultMessage:"Client"}),fullWidth:!0,isInvalid:Boolean(h&&s.client),error:s.client},Object(g.jsx)(S.EuiFieldText,{defaultValue:o||"",fullWidth:!0,onChange:e=>{t({client:e.target.value})},"data-test-subj":"clientInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bucketTitle",defaultMessage:"Bucket"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bucketDescription",defaultMessage:"The name of the AWS S3 bucket to use for snapshots."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bucketLabel",defaultMessage:"Bucket (required)"}),fullWidth:!0,isInvalid:Boolean(h&&s.bucket),error:s.bucket},Object(g.jsx)(S.EuiFieldText,{defaultValue:a||"",fullWidth:!0,onChange:e=>{t({bucket:e.target.value})},"data-test-subj":"bucketInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.basePathTitle",defaultMessage:"Base path"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.basePathDescription",defaultMessage:"The bucket path to the repository data."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.basePathLabel",defaultMessage:"Base path"}),fullWidth:!0,isInvalid:Boolean(h&&s.basePath),error:s.basePath},Object(g.jsx)(S.EuiFieldText,{defaultValue:i||"",fullWidth:!0,onChange:e=>{t({basePath:e.target.value})},"data-test-subj":"basePathInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.compressTitle",defaultMessage:"Snapshot compression"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.compressDescription",defaultMessage:"Compresses the index mapping and setting files for snapshots. Data files are not compressed."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(h&&s.compress),error:s.compress},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.compressLabel",defaultMessage:"Compress snapshots"}),checked:!(!1===n),onChange:e=>{t({compress:e.target.checked})},"data-test-subj":"compressToggle"}))),Object(g.jsx)(ie,{isInvalid:Boolean(h&&s.chunkSize),error:s.chunkSize,defaultValue:l||"",updateSettings:O}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.serverSideEncryptionTitle",defaultMessage:"Server-side encryption"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.serverSideEncryptionDescription",defaultMessage:"Encrypts files on the server using AES256 algorithm."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(h&&s.serverSideEncryption),error:s.serverSideEncryption},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.serverSideEncryptionLabel",defaultMessage:"Server-side encryption"}),checked:!!c,onChange:e=>{t({serverSideEncryption:e.target.checked})},"data-test-subj":"serverSideEncryptionToggle"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bufferSizeTitle",defaultMessage:"Buffer size"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bufferSizeDescription",defaultMessage:"Beyond this minimum threshold, the S3 repository will use the AWS Multipart Upload API to split the chunk into several parts and upload each in its own request."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bufferSizeLabel",defaultMessage:"Buffer size"}),fullWidth:!0,isInvalid:Boolean(h&&s.bufferSize),error:s.bufferSize,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.bufferSizeHelpText",defaultMessage:"Accepts byte size units, such as {example1}, {example2}, {example3}, or {example4}. Defaults to {defaultSize} or {defaultPercentage} of JVM heap, whichever is smaller.",values:{example1:Object(g.jsx)(S.EuiCode,null,"1g"),example2:Object(g.jsx)(S.EuiCode,null,"10mb"),example3:Object(g.jsx)(S.EuiCode,null,"5k"),example4:Object(g.jsx)(S.EuiCode,null,"1024B"),defaultSize:Object(g.jsx)(S.EuiCode,null,"100mb"),defaultPercentage:Object(g.jsx)(S.EuiCode,null,"5%")}})},Object(g.jsx)(S.EuiFieldText,{defaultValue:u||"",fullWidth:!0,onChange:e=>{t({bufferSize:e.target.value})},"data-test-subj":"bufferSizeInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.cannedAclTitle",defaultMessage:"Canned ACL"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.cannedAclDescription",defaultMessage:"The canned ACL to add to new S3 buckets and objects."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.cannedAclLabel",defaultMessage:"Canned ACL"}),fullWidth:!0,isInvalid:Boolean(h&&s.cannedAcl),error:s.cannedAcl},Object(g.jsx)(S.EuiSelect,{options:m,value:p||m[0].value,onChange:e=>{t({cannedAcl:e.target.value})},fullWidth:!0,"data-test-subj":"cannedAclSelect"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.storageClassTitle",defaultMessage:"Storage class"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.storageClassDescription",defaultMessage:"The storage class for new objects in the S3 repository."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.storageClassLabel",defaultMessage:"Storage class"}),fullWidth:!0,isInvalid:Boolean(h&&s.storageClass),error:s.storageClass},Object(g.jsx)(S.EuiSelect,{options:y,value:d||y[0].value,onChange:e=>{t({storageClass:e.target.value})},fullWidth:!0,"data-test-subj":"storageClassSelect"}))),Object(g.jsx)(ne,{isInvalid:Boolean(h&&s.maxSnapshotBytesPerSec),error:s.maxSnapshotBytesPerSec,defaultValue:x||"",updateSettings:O}),Object(g.jsx)(re,{isInvalid:Boolean(h&&s.maxRestoreBytesPerSec),error:s.maxRestoreBytesPerSec,defaultValue:j||"",updateSettings:O}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.readonlyTitle",defaultMessage:"Read-only"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.readonlyDescription",defaultMessage:"Only one cluster should have write access to this repository. All other clusters should be read-only."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,isInvalid:Boolean(h&&s.readonly),error:s.readonly},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.typeS3.readonlyLabel",defaultMessage:"Read-only repository"}),checked:!!b,onChange:e=>{t({readonly:e.target.checked})},"data-test-subj":"readOnlyToggle"}))))},xe=({repository:e,updateRepository:t,settingErrors:s})=>{const{i18n:a}=C(),{type:o,settings:i}=e,r=(e,s)=>{t(s?{settings:e}:{settings:{...i,...e}})},n={[k.e.fs]:ce,[k.e.url]:de,[k.e.azure]:le,[k.e.gcs]:ue,[k.e.hdfs]:pe,[k.e.s3]:je},l=t=>{if(!t)return null;const o=n[t];return o?Object(g.jsx)(o,{repository:e,updateRepositorySettings:r,settingErrors:s}):Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.errorUnknownRepositoryTypesTitle",defaultMessage:"Unknown repository type"}),error:{error:a.translate("xpack.snapshotRestore.repositoryForm.errorUnknownRepositoryTypesMessage",{defaultMessage:"The repository type '{type}' is not supported.",values:{type:t}})}})};return o===k.e.source?l(i.delegateType):l(o)},be=({repository:e,isManagedRepository:t,isEditing:s,isSaving:a,onSave:o,updateRepository:i,validation:n,saveError:l,onBack:c})=>{const{docLinks:u}=I(),p=!n.isValid,{name:d,type:j,settings:{delegateType:x}}=e,b=j===W.g.source?x:j;return Object(g.jsx)("div",{"data-test-subj":"stepTwo"},Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiFlexGroup,{alignItems:"center",justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiTitle,{size:"m"},Object(g.jsx)("h2",{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.fields.settingsTitle",defaultMessage:"{repositoryName} settings",values:{repositoryName:`'${d}'`}})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:ae(u,b),target:"_blank",iconType:"help"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.repositoryTypeDocLink",defaultMessage:"{repositoryType} repository docs",values:{repositoryType:_.a.getRepositoryTypeName(b)}})))),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(xe,{repository:e,updateRepository:i,settingErrors:p&&n.errors.settings?n.errors.settings:{}})),p?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.validationErrorTitle",defaultMessage:"Fix errors before continuing."}),color:"danger",iconType:"cross","data-test-subj":"repositoryFormError"}),Object(g.jsx)(S.EuiSpacer,{size:"m"})):null,l?Object(g.jsx)(r.Fragment,null,l,Object(g.jsx)(S.EuiSpacer,{size:"m"})):null,(()=>{const e=s?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.saveButtonLabel",defaultMessage:"Save"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.registerButtonLabel",defaultMessage:"Register"}),i=Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.savingButtonLabel",defaultMessage:"Saving…"});return Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"m",alignItems:"center"},s?null:Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{color:"primary",iconType:"arrowLeft",onClick:c,"data-test-subj":"backButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryForm.backButtonLabel",defaultMessage:"Back"}))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButton,{color:t?"warning":"success",iconType:"check",onClick:o,fill:!t,"data-test-subj":"submitButton",isLoading:a},a?i:e)))})())},ge=({repository:e,isManagedRepository:t,isEditing:s,isSaving:a,saveError:o,clearSaveError:i,onSave:n})=>{const[l,c]=Object(r.useState)(s?2:1),[u,p]=Object(r.useState)({...e,settings:{...e.settings}}),[d,j]=Object(r.useState)({isValid:!0,errors:{}}),x=e=>{const t={...u,...e};p(t)},b=!d.isValid,m=Object.entries(N(d.errors)).reduce(((e,[t,s])=>[...e,s]),[]);return Object(g.jsx)(S.EuiForm,{isInvalid:b,error:m,"data-test-subj":"repositoryForm"},1!==l||s?Object(g.jsx)(be,{repository:u,isManagedRepository:t,isEditing:s,isSaving:a,onSave:()=>{const e=$(u,!0),{isValid:t}=e;j(e),t&&n(u)},updateRepository:x,validation:d,saveError:o,onBack:()=>{s||(j({isValid:!0,errors:{}}),c(1),i())}}):Object(g.jsx)(oe,{repository:u,onNext:()=>(()=>{const e=$(u,!1),{isValid:t}=e;j(e),t&&c(2)})(),updateRepository:x,validation:d}))};ge.defaultProps={isEditing:!1,isSaving:!1};const me=({verificationResults:e})=>e?e.valid?Object(g.jsx)(S.EuiHealth,{color:"success"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryVerification.verificationSuccessfulValue",defaultMessage:"Connected"})):Object(g.jsx)(S.EuiHealth,{color:"warning"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryVerification.verificationErrorValue",defaultMessage:"Not connected"})):Object(g.jsx)(S.EuiHealth,{color:"subdued"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryVerification.verificationUnknownValue",defaultMessage:"Unknown"})),he=({type:e,...t})=>{const s={[W.g.fs]:"storage",[W.g.url]:"eye",[W.g.azure]:"logoAzure",[W.g.gcs]:"logoGCP",[W.g.hdfs]:"logoApache",[W.g.s3]:"logoAWS"};return Object(g.jsx)(S.EuiIcon,u()({type:s[e]||"folderOpen"},t))},Oe=({children:e,...t})=>Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"flexStart",alignItems:"center",gutterSize:"s"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiText,t,Object(g.jsx)(S.EuiTextColor,{color:"subdued"},e)))),ye=({children:e})=>Object(g.jsx)(S.EuiEmptyPrompt,{title:Object(g.jsx)(S.EuiLoadingSpinner,{size:"xl"}),body:Object(g.jsx)(S.EuiText,{color:"subdued"},e),"data-test-subj":"sectionLoading"}),fe=({children:e})=>Object(g.jsx)(S.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(g.jsx)(S.EuiEmptyPrompt,{title:Object(g.jsx)(S.EuiLoadingSpinner,{size:"xl"}),body:Object(g.jsx)(S.EuiText,{color:"subdued"},e),"data-test-subj":"sectionLoading"})),Me=({children:e})=>{const{i18n:t}=C(),s=B(),[a,i]=Object(r.useState)([]),[n,l]=Object(r.useState)(!1),[c,u]=Object(r.useState)(!1),p=Object(r.useRef)(null),d=()=>{l(!1),i([])},j=()=>{const e=[...a];u(!0),Object(o.f)(e).then((({data:a,error:o})=>{const{itemsDeleted:i,errors:r}=a||{itemsDeleted:void 0,errors:void 0};if(d(),u(!1),i&&i.length){const e=i.length>1?t.translate("xpack.snapshotRestore.deleteSnapshot.successMultipleNotificationTitle",{defaultMessage:"Deleted {count} snapshots",values:{count:i.length}}):t.translate("xpack.snapshotRestore.deleteSnapshot.successSingleNotificationTitle",{defaultMessage:"Deleted snapshot '{name}'",values:{name:i[0].snapshot}});s.addSuccess(e),p.current&&p.current([...i])}if(o||r&&r.length){const a=r&&r.length>1||o&&e.length>1?t.translate("xpack.snapshotRestore.deleteSnapshot.errorMultipleNotificationTitle",{defaultMessage:"Error deleting {count} snapshots",values:{count:r&&r.length||e.length}}):t.translate("xpack.snapshotRestore.deleteSnapshot.errorSingleNotificationTitle",{defaultMessage:"Error deleting snapshot '{name}'",values:{name:r&&r[0].id.snapshot||e[0].snapshot}});s.addDanger(a)}}))};return Object(g.jsx)(r.Fragment,null,e(((e,t=(()=>{}))=>{if(!e||!e.length)throw new Error("No snapshot IDs specified for deletion");l(!0),i(e),p.current=t})),(()=>{if(!n)return null;const e=1===a.length;return Object(g.jsx)(S.EuiConfirmModal,{title:e?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.deleteSingleTitle",defaultMessage:"Delete snapshot '{name}'?",values:{name:a[0].snapshot}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.deleteMultipleTitle",defaultMessage:"Delete {count} snapshots?",values:{count:a.length}}),onCancel:d,onConfirm:j,cancelButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.confirmButtonLabel",defaultMessage:"Delete {count, plural, one {snapshot} other {snapshots}}",values:{count:a.length}}),confirmButtonDisabled:c,buttonColor:"danger","data-test-subj":"srdeleteSnapshotConfirmationModal"},e?null:Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.deleteMultipleListDescription",defaultMessage:"You are about to delete these snapshots:"})),Object(g.jsx)("ul",null,a.map((({snapshot:e,repository:t})=>Object(g.jsx)("li",{key:`${t}/${e}`},e))))),Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.deleteMultipleDescription",defaultMessage:"Restore operations associated with {count, plural, one {this snapshot} other {these snapshots}} will stop.",values:{count:a.length}})),!e&&c?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{color:"warning",title:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"s",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLoadingSpinner,null)),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.deletingCalloutTitle",defaultMessage:"Deleting snapshots"}))))},Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deleteSnapshot.confirmModal.deletingCalloutDescription",defaultMessage:"This may take a few minutes."})))):null)})())},Fe=({dataStreams:e,indices:t})=>e.concat(t),Se=()=>Object(g.jsx)(S.EuiBadge,{"data-test-subj":"dataStreamBadge",color:"primary"},a.i18n.translate("xpack.snapshotRestore.policyForm.setSettings.dataStreamBadgeContent",{defaultMessage:"Data stream"})),Re=e=>a.i18n.translate("xpack.snapshotRestore.restoreForm.dataStreamsWarningCallOut.title",{defaultMessage:"This snapshot contains {count, plural, one {a data stream} other {data streams}}",values:{count:e}}),Ee=e=>Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.dataStreamsWarningCallOut.body",defaultMessage:"Each data stream requires a matching index template. Please ensure any restored data streams have a matching index template. You can restore index templates by restoring the global cluster state. However, this may overwrite existing templates, cluster settings, ingest pipelines, and lifecycle policies. {learnMoreLink} about restoring snapshots that contain data streams.",values:{learnMoreLink:Object(g.jsx)(S.EuiLink,{target:"_blank",href:e},a.i18n.translate("xpack.snapshotRestore.restoreForm.dataStreamsWarningCallOut.body.learnMoreLink",{defaultMessage:"Learn more"}))}}),ke=({dataStreamsCount:e})=>{const{docLinks:t}=I();return Object(g.jsx)(S.EuiCallOut,{"data-test-subj":"dataStreamWarningCallOut",title:Re(e),iconType:"warning",color:"warning"},Ee(t.links.snapshotRestore.createSnapshot))},ve=({onSelectionChange:e,selectedIndicesAndDataStreams:t,indices:s,dataStreams:a})=>{if(0===t.length)return Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.noDataStreamsOrIndicesHelpText",defaultMessage:"Nothing will be restored. {selectAllLink}",values:{selectAllLink:Object(g.jsx)(S.EuiLink,{onClick:()=>{e("all")}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.selectAllIndicesLink",defaultMessage:"Select all"}))}});const o=t.reduce(((e,t)=>s.includes(t)?e+1:e),0),i=t.reduce(((e,t)=>a.includes(t)?e+1:e),0);return Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.selectDataStreamsAndIndicesHelpText",defaultMessage:"{indicesCount} {indicesCount, plural, one {index} other {indices}} and {dataStreamsCount} {dataStreamsCount, plural, one {data stream} other {data streams}} will be restored. {deselectAllLink}",values:{dataStreamsCount:i,indicesCount:o,deselectAllLink:Object(g.jsx)(S.EuiLink,{"data-test-subj":"deselectIndicesLink",onClick:()=>{e("none")}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.deselectAllIndicesLink",defaultMessage:"Deselect all"}))}})},Le=({featureStates:e})=>Object(g.jsx)(S.EuiCallOut,{"data-test-subj":"systemIndicesInfoCallOut",title:a.i18n.translate("xpack.snapshotRestore.restoreForm.stepLogistics.systemIndicesCallOut.title",{defaultMessage:"When this snapshot is restored, system indices {featuresCount, plural, =0 {} other {from {features}}} will be overwritten with data from the snapshot.",values:{featuresCount:(null==e?void 0:e.length)||0,features:null==e?void 0:e.join(", ")}}),iconType:"pin",size:"s","aria-live":"polite","aria-atomic":"true"}),Te=({isLoadingFeatures:e=!1,featuresOptions:t,selectedOptions:s,onUpdateFormSettings:a})=>{const{i18n:o}=C(),i=Object(r.useMemo)((()=>{if(!e){const e=t.map((e=>({label:e})));return Object(f.sortBy)(e,"label")}return[]}),[e,t]);return Object(g.jsx)(S.EuiFormRow,null,Object(g.jsx)(S.EuiComboBox,{"data-test-subj":"featureStatesDropdown",placeholder:o.translate("xpack.snapshotRestore.featureStatesFormField.allFeaturesLabel",{defaultMessage:"All features"}),options:i,selectedOptions:s,onChange:e=>{a({featureStates:e.map((e=>e.label))})},isLoading:e,isClearable:!0}))},De=({snapshotDetails:e,restoreSettings:t,updateRestoreSettings:s,errors:a})=>{var o;const{i18n:i}=C(),{docLinks:l}=I(),{indices:c,dataStreams:u=[],includeGlobalState:p,versionId:d,featureStates:j}=e,x=c.filter((e=>!e.startsWith(".ds"))),b=x.concat(u),m=Fe({dataStreams:u.map((e=>({label:e,value:{isDataStream:!0,name:e}}))),indices:x.map((e=>({label:e,value:{isDataStream:!1,name:e}})))}),{indices:h,renamePattern:O,renameReplacement:y,partial:f,includeGlobalState:M,featureStates:F,includeAliases:E}=t,[k,v]=Object(r.useState)(!Boolean(h)),[L,T]=Object(r.useState)((()=>Fe({dataStreams:u.map((e=>({label:e,append:Object(g.jsx)(Se,null),checked:k||"string"==typeof h||Array.isArray(h)&&h.includes(e)?"on":void 0}))),indices:x.map((e=>({label:e,checked:k||"string"==typeof h||Array.isArray(h)&&h.includes(e)?"on":void 0})))}))),[D,w]=Object(r.useState)("string"==typeof h||b.length>100?"custom":"list"),[B,P]=Object(r.useState)("string"==typeof h?h.split(","):[]),[z,A]=Object(r.useState)(Boolean(O||y)),[N,G]=Object(r.useState)({indices:[...b],renamePattern:"",renameReplacement:""}),U=Object(r.useMemo)((()=>null==F?void 0:F.map((e=>({label:e})))),[F]),_=void 0!==F&&!(null!=F&&F.includes(W.e));return Object(g.jsx)("div",{"data-test-subj":"snapshotRestoreStepLogistics",className:"snapshotRestore__restoreForm__stepLogistics"},Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogisticsTitle",defaultMessage:"Restore details"})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:l.links.snapshotRestore.restoreSnapshot,target:"_blank",iconType:"help"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.docsButtonLabel",defaultMessage:"Snapshot and Restore docs"})))),u.length?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(ke,{dataStreamsCount:u.length})):void 0,Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.dataStreamsAndIndicesTitle",defaultMessage:"Data streams and indices"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.dataStreamsAndIndicesDescription",defaultMessage:"Creates new data streams and indices if they don’t exist. Opens existing indices, including backing indices for a data stream, if they are closed and have the same number of shards as the snapshot index."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.allDataStreamsAndIndicesLabel",defaultMessage:"All data streams and indices"}),checked:k,onChange:e=>{const t=e.target.checked;v(t),s(t?{indices:void 0}:{indices:"custom"===D?B.join(","):[...N.indices||[]]})}}),k?null:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiFormRow,{className:"snapshotRestore__restoreForm__stepLogistics__indicesFieldWrapper",label:"list"===D?Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.selectDataStreamsAndIndicesLabel",defaultMessage:"Select data streams and indices"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLink,{onClick:()=>{w("custom"),s({indices:B.join(",")})}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.indicesToggleCustomLink",defaultMessage:"Use index patterns"})))):Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.indicesPatternLabel",defaultMessage:"Index patterns"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLink,{onClick:()=>{w("list"),s({indices:N.indices})}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.dataStreamsAndIndicesToggleListLink",defaultMessage:"Select data streams and indices"})))),helpText:"list"===D?Object(g.jsx)(ve,{onSelectionChange:e=>{"all"===e?(L.forEach((e=>{e.checked="on"})),s({indices:[...b]}),G({...N,indices:[...b]})):(L.forEach((e=>{e.checked=void 0})),s({indices:[]}),G({...N,indices:[]}))},selectedIndicesAndDataStreams:null!==(o=V(h))&&void 0!==o?o:[],indices:x,dataStreams:u}):null,isInvalid:Boolean(a.indices),error:a.indices},"list"===D?Object(g.jsx)(S.EuiSelectable,{allowExclusions:!1,options:L,onChange:e=>{const t=[];e.forEach((({label:e,checked:s})=>{"on"===s&&t.push(e)})),T(e),s({indices:[...t]}),G({...N,indices:[...t]})},searchable:!0,height:300},((e,t)=>Object(g.jsx)(S.EuiPanel,{paddingSize:"s",hasShadow:!1},t,e))):Object(g.jsx)(S.EuiComboBox,{options:m,renderOption:({value:e})=>null!=e&&e.isDataStream?Object(g.jsx)(S.EuiFlexGroup,{responsive:!1,justifyContent:"spaceBetween",alignItems:"center",gutterSize:"none"},Object(g.jsx)(S.EuiFlexItem,null,e.name),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(Se,null))):null==e?void 0:e.name,placeholder:i.translate("xpack.snapshotRestore.restoreForm.stepLogistics.indicesPatternPlaceholder",{defaultMessage:"Enter index patterns, i.e. logstash-*"}),selectedOptions:B.map((e=>({label:e}))),onCreateOption:e=>{if(!e.trim().length)return;const t=[...B,e];P(t),s({indices:t.join(",")})},onChange:e=>{const t=e.map((({label:e})=>e));P(t),s({indices:t.join(",")})}})))))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.renameDataStreamsAndIndicesTitle",defaultMessage:"Rename data streams and indices"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.renameDataStreamsAndIndicesDescription",defaultMessage:"Renames data streams and indices on restore. Ensure that a matching index template exists for renamed data streams."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.renameDataStreamsAndIndicesLabel",defaultMessage:"Rename data streams and indices"}),checked:z,onChange:e=>{const t=e.target.checked;A(t),s(t?{renamePattern:N.renamePattern,renameReplacement:N.renameReplacement}:{renamePattern:void 0,renameReplacement:void 0})}}),z?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.renamePatternLabel",defaultMessage:"Capture pattern"}),helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.renamePatternHelpText",defaultMessage:"Use regular expressions"}),isInvalid:Boolean(a.renamePattern),error:a.renamePattern},Object(g.jsx)(S.EuiFieldText,{value:O,placeholder:"data_(.+)",onChange:e=>{G({...N,renamePattern:e.target.value}),s({renamePattern:e.target.value})}}))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.renameReplacementLabel",defaultMessage:"Replacement pattern"}),isInvalid:Boolean(a.renameReplacement),error:a.renameReplacement},Object(g.jsx)(S.EuiFieldText,{value:y,placeholder:"restored_data_$1",onChange:e=>{G({...N,renameReplacement:e.target.value}),s({renameReplacement:e.target.value})}}))))):null))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.partialTitle",defaultMessage:"Partial restore"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.partialDescription",defaultMessage:"Allows restore of indices that don’t have snapshots of all shards."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.partialLabel",defaultMessage:"Partial restore"}),checked:void 0!==f&&f,onChange:e=>s({partial:e.target.checked})}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeGlobalStateTitle",defaultMessage:"Restore global state"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeGlobalStateDescription",defaultMessage:"Restores the global cluster state as part of the snapshot."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,helpText:p?null:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeGlobalStateDisabledDescription",defaultMessage:"Not available for this snapshot."})},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeGlobalStateLabel",defaultMessage:"Restore global state"}),checked:void 0!==M&&M,onChange:e=>s({includeGlobalState:e.target.checked}),disabled:!p,"data-test-subj":"includeGlobalStateSwitch"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeFeatureStatesTitle",defaultMessage:"Restore feature state"}))),description:Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeFeatureStatesDescription",defaultMessage:"Restores the configuration, history, and other data stored in Elasticsearch by a feature such as Elasticsearch security."}),d>7120099&&_&&Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(Le,{featureStates:null==t?void 0:t.featureStates}))),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0,helpText:j?null:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeFeatureStatesDisabledDescription",defaultMessage:"Not available for this snapshot."})},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.restoreFeatureStatesLabel",defaultMessage:"Restore feature state from"}),checked:_,onChange:e=>{const{checked:t}=e.target;s({featureStates:t?[]:[W.e]})},disabled:0===(null==j?void 0:j.length),"data-test-subj":"includeFeatureStatesSwitch"})),_&&Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(Te,{featuresOptions:j,selectedOptions:U,onUpdateFormSettings:s})),0===(null==j?void 0:j.length)&&Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiCallOut,{size:"s",iconType:"help",color:"warning","data-test-subj":"noFeatureStatesCallout",title:i.translate("xpack.snapshotRestore.restoreForm.stepLogistics.noFeatureStates",{defaultMessage:"No feature states are included in this snapshot."})}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeAliasesTitle",defaultMessage:"Restore aliases"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeAliasesDescription",defaultMessage:"Restores index aliases along with their associated indices."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepLogistics.includeAliasesLabel",defaultMessage:"Restore aliases"}),checked:void 0===E||E,onChange:e=>s({includeAliases:e.target.checked}),"data-test-subj":"includeAliasesSwitch"}))))},Ce=({restoreSettings:e,updateRestoreSettings:t,snapshotDetails:s,errors:a})=>{const{i18n:o}=C(),{docLinks:i}=I(),{indexSettings:l,ignoreIndexSettings:c}=e,{dataStreams:u}=s,[p,d]=Object(r.useState)(Boolean(l)),[j,x]=Object(r.useState)(Boolean(c)),[b,m]=Object(r.useState)({indexSettings:l||"{}",ignoreIndexSettings:c?[...c]:[]}),[h,O]=Object(r.useState)([...new Set((c||[]).concat([...ee.g].sort()))].map((e=>({label:e})))),y=Object(g.jsx)(S.EuiLink,{href:i.links.elasticsearch.indexModules,target:"_blank"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsDocLinkText",defaultMessage:"Learn more."}));return Object(g.jsx)("div",{className:"snapshotRestore__restoreForm__stepSettings"},Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettingsTitle",defaultMessage:"Index settings"})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:i.links.snapshotRestore.changeIndexSettings,target:"_blank",iconType:"help"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.docsButtonLabel",defaultMessage:"Index settings docs"})))),null!=u&&u.length?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiCallOut,{iconType:"help",title:o.translate("xpack.snapshotRestore.restoreForm.stepSettings.dataStreamsCallout.title",{defaultMessage:"Backing indices"})},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.dataStreamsCallout.description",defaultMessage:"These settings also apply to the backing indices of data streams."}))):void 0,Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsTitle",defaultMessage:"Modify index settings"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsDescription",defaultMessage:"Overrides index settings during restore. {docLink}",values:{docLink:y}}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSwitch,{"data-test-subj":"modifyIndexSettingsSwitch",label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsLabel",defaultMessage:"Modify index settings"}),checked:p,onChange:e=>{e.target.checked?(d(!0),t({indexSettings:b.indexSettings})):(d(!1),t({indexSettings:void 0}))}}),p?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsEditorLabel",defaultMessage:"Index settings"}),fullWidth:!0,isInvalid:Boolean(a.indexSettings),error:a.indexSettings,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsEditorDescription",defaultMessage:"Use JSON format: {format}",values:{format:Object(g.jsx)(S.EuiCode,null,'{ "index.number_of_replicas": 0 }')}}),"data-test-subj":"indexSettingsEditor"},Object(g.jsx)(F.CodeEditor,{languageId:"json",value:l,height:250,options:{lineNumbers:"off",tabSize:2,automaticLayout:!0},"aria-label":o.translate("xpack.snapshotRestore.restoreForm.stepSettings.indexSettingsAriaLabel",{defaultMessage:"Index settings to modify"}),onChange:e=>{t({indexSettings:e}),m({...b,indexSettings:e})}}))):null))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.ignoreIndexSettingsTitle",defaultMessage:"Reset index settings"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.ignoreIndexSettingsDescription",defaultMessage:"Resets selected settings to default during restore. {docLink}",values:{docLink:y}}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.ignoreIndexSettingsLabel",defaultMessage:"Reset index settings"}),checked:j,onChange:e=>{e.target.checked?(x(!0),t({ignoreIndexSettings:[...b.ignoreIndexSettings||[]]})):(x(!1),t({ignoreIndexSettings:void 0}))}}),j?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepSettings.selectIgnoreIndexSettingsLabel",defaultMessage:"Select settings"}),isInvalid:Boolean(a.ignoreIndexSettings),error:a.ignoreIndexSettings},Object(g.jsx)(S.EuiComboBox,{placeholder:o.translate("xpack.snapshotRestore.restoreForm.stepSettings.ignoreIndexSettingsPlaceholder",{defaultMessage:"Select or type index settings"}),options:h,selectedOptions:c?h.filter((({label:e})=>c.includes(e))):[],onChange:e=>{const s=e.map((({label:e})=>e));t({ignoreIndexSettings:s}),m({...b,ignoreIndexSettings:s})},onCreateOption:(e,s)=>{const a=e.trim().toLowerCase();a&&(!Boolean(s.find((({label:e})=>e===a)))&&O([{label:a},...h]),t({ignoreIndexSettings:[...c||[],a]}),m({...b,ignoreIndexSettings:[...c||[],a]}))},isClearable:!0}))):null))))},Ie=({items:e})=>{var t;const[s,a]=Object(r.useState)(!1),o=null!==(t=V(e))&&void 0!==t?t:[];return{items:void 0===e?"all":o.slice(0,s?1/0:10),hiddenItemsCount:o.length>10?o.length-10:0,setIsShowingFullList:a,isShowingFullList:s}},we=({indices:e})=>{const{hiddenItemsCount:t,isShowingFullList:s,items:a,setIsShowingFullList:o}=Ie({items:e});return"all"===a?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.indicesList.allIndicesValue",defaultMessage:"All indices"}):Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiText,null,a.map((e=>Object(g.jsx)("div",{key:e},Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("span",null,e)))))),t?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"xs"}),Object(g.jsx)(S.EuiLink,{onClick:()=>o(!s)},s?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.indicesList.indicesCollapseAllLink",defaultMessage:"Hide {count, plural, one {# index} other {# indices}}",values:{count:t}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.indicesList.indicesExpandAllLink",defaultMessage:"Show {count, plural, one {# index} other {# indices}}",values:{count:t}})," ",Object(g.jsx)(S.EuiIcon,{type:s?"arrowUp":"arrowDown"}))):null)},Be=({dataStreams:e})=>{const{isShowingFullList:t,setIsShowingFullList:s,items:a,hiddenItemsCount:o}=Ie({items:e});return"all"===a?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.dataStreamsList.allDataStreamsValue",defaultMessage:"All data streams"}):Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiText,null,a.map((e=>Object(g.jsx)("div",{key:e},Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("span",null,e)))))),o?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"xs"}),Object(g.jsx)(S.EuiLink,{onClick:()=>s(!t)},t?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.dataStreamsList.dataStreamsCollapseAllLink",defaultMessage:"Hide {count, plural, one {# data stream} other {# data streams}}",values:{count:o}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.dataStreamsList.dataStreamsExpandAllLink",defaultMessage:"Show {count, plural, one {# data stream} other {# data streams}}",values:{count:o}})," ",Object(g.jsx)(S.EuiIcon,{type:t?"arrowUp":"arrowDown"}))):null)},Pe=({featureStates:e})=>{const{isShowingFullList:t,setIsShowingFullList:s,items:a,hiddenItemsCount:o}=Ie({items:e});return"all"===a||0===a.length?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.featureStatesList.allFeaturesLabel",defaultMessage:"All features"}):a.find((e=>e===W.e))?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.featureStatesList.noneFeaturesLabel",defaultMessage:"No features"}):Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiText,{"data-test-subj":"featureStatesList"},a.map((e=>Object(g.jsx)("div",{key:e},Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("span",null,e)))))),o?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"xs"}),Object(g.jsx)(S.EuiLink,{onClick:()=>s(!t)},t?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.featureStatesList.featureStatesCollapseAllLink",defaultMessage:"Hide {count, plural, one {# feature} other {# features}}",values:{count:o}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.featureStatesList.featureStatesExpandAllLink",defaultMessage:"Show {count, plural, one {# feature} other {# features}}",values:{count:o}})," ",Object(g.jsx)(S.EuiIcon,{type:t?"arrowUp":"arrowDown"}))):null)},ze=({includeGlobalState:e,featureStates:t})=>{const s=e&&void 0===t,a=!t||(null==t?void 0:t.includes(W.e)),o=s||0===(null==t?void 0:t.length);return Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"policyFeatureStatesSummary"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.summary.policyFeatureStatesLabel",defaultMessage:"Include feature state {hasSpecificFeatures, plural, one {from} other {}}",values:{hasSpecificFeatures:a||o?0:1}})),Object(g.jsx)(S.EuiDescriptionListDescription,{"data-test-subj":"value"},!s&&a&&Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.summary.policyNoFeatureStatesLabel",defaultMessage:"No"}),o&&Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.summary.policyAllFeatureStatesLabel",defaultMessage:"All features"}),!a&&!o&&Object(g.jsx)(Pe,{featureStates:t}))))},Ae=({featureStates:e})=>{const t=!e||0===e.length;return Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"snapshotFeatureStatesSummary"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.summary.snapshotFeatureStatesLabel",defaultMessage:"Include feature state {hasSpecificFeatures, plural, one {from} other {}}",values:{hasSpecificFeatures:t?0:1}})),Object(g.jsx)(S.EuiDescriptionListDescription,{"data-test-subj":"value"},t?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.summary.snapshotNoFeatureStatesLabel",defaultMessage:"No"}):Object(g.jsx)(Pe,{featureStates:e}))))},Ne=({restoreSettings:e,updateCurrentStep:t})=>{const{i18n:s}=C(),{indices:a,renamePattern:o,renameReplacement:i,partial:n,includeGlobalState:l,featureStates:c,ignoreIndexSettings:u}=e,p=function(e){const{indices:t,renamePattern:s,renameReplacement:a,includeGlobalState:o,featureStates:i,partial:r,indexSettings:n,ignoreIndexSettings:l,ignoreUnavailable:c,includeAliases:u}=e;let p;if(n)try{p=JSON.parse(n)}catch(e){}return d={indices:t,rename_pattern:s,rename_replacement:a,include_global_state:o,feature_states:i,partial:r,index_settings:p,ignore_index_settings:l,ignore_unavailable:c,include_aliases:u},Object.entries(d).reduce(((e,[t,s])=>(void 0!==s&&(e[t]=s),e)),{});var d}(e),{index_settings:d}=p;return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReviewTitle",defaultMessage:"Review restore details"}))),Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTabbedContent,{tabs:[{id:"summary",name:s.translate("xpack.snapshotRestore.restoreForm.stepReview.summaryTabTitle",{defaultMessage:"Summary"}),content:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.sectionLogisticsTitle",defaultMessage:"Logistics"})," ",Object(g.jsx)(S.EuiToolTip,{content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.editStepTooltip",defaultMessage:"Edit"})},Object(g.jsx)(S.EuiLink,{onClick:()=>t(1)},Object(g.jsx)(S.EuiIcon,{type:"pencil"}))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.dataStreamsAndIndicesLabel",defaultMessage:"Data streams and indices"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,Object(g.jsx)(we,{indices:a}))))),o||i?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("h4",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.sectionRenameTitle",defaultMessage:"Rename indices"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,o?Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.renamePatternLabel",defaultMessage:"Capture pattern"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,o))):null,i?Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.renameReplacementLabel",defaultMessage:"Replacement pattern"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,i))):null)):null,void 0!==c||void 0!==l?Object(g.jsx)(S.EuiFlexGroup,null,void 0!==l?Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.includeGlobalStateLabel",defaultMessage:"Restore global state"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,!1===l?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.includeGlobalStateFalseValue",defaultMessage:"No"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.includeGlobalStateTrueValue",defaultMessage:"Yes"})))):null,void 0!==c?Object(g.jsx)(ze,{featureStates:c}):null):null,void 0!==n?Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.partialLabel",defaultMessage:"Partial restore"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,n?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.partialTrueValue",defaultMessage:"Yes"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.partialFalseValue",defaultMessage:"No"}))))):null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.sectionSettingsTitle",defaultMessage:"Index settings"})," ",Object(g.jsx)(S.EuiToolTip,{content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.editStepTooltip",defaultMessage:"Edit"})},Object(g.jsx)(S.EuiLink,{onClick:()=>t(2)},Object(g.jsx)(S.EuiIcon,{type:"pencil"}))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),d||u?Object(g.jsx)(S.EuiFlexGroup,null,d?Object(g.jsx)(S.EuiFlexItem,{style:{maxWidth:"50%"}},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.indexSettingsLabel",defaultMessage:"Modify"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,Object(g.jsx)(S.EuiFlexGrid,{columns:2,gutterSize:"none"},Object.entries(d).map((([e,t])=>Object(g.jsx)(r.Fragment,{key:e},Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)("strong",null,e))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)("span",null," ",t)))))))))):null,u?Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.ignoreIndexSettingsLabel",defaultMessage:"Reset"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,Object(g.jsx)(S.EuiText,null,Object(g.jsx)("ul",null,u.map((e=>Object(g.jsx)("li",{key:e},Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("span",null,e)))))))))):null):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.stepReview.summaryTab.noSettingsValue",defaultMessage:"No index setting modifications"}))},{id:"json",name:s.translate("xpack.snapshotRestore.restoreForm.stepReview.jsonTabTitle",{defaultMessage:"JSON"}),content:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiCodeBlock,{paddingSize:"m",language:"json",isCopyable:!0,"aria-label":s.translate("xpack.snapshotRestore.restoreForm.stepReview.jsonTab.jsonAriaLabel",{defaultMessage:"Restore settings to be executed"})},JSON.stringify(p,null,2)))}]}))},We=({currentStep:e,maxCompletedStep:t,updateCurrentStep:s})=>{const{i18n:a}=C(),o=[{title:a.translate("xpack.snapshotRestore.restoreForm.navigation.stepLogisticsName",{defaultMessage:"Logistics"}),status:1===e?"selected":t>=1?"complete":"incomplete",onClick:()=>s(1)},{title:a.translate("xpack.snapshotRestore.restoreForm.navigation.stepSettingsName",{defaultMessage:"Index settings"}),status:2===e?"selected":t>=2?"complete":"incomplete",disabled:t<1,onClick:()=>s(2)},{title:a.translate("xpack.snapshotRestore.restoreForm.navigation.stepReviewName",{defaultMessage:"Review"}),status:3===e?"selected":t>=2?"complete":"incomplete",disabled:t<2,onClick:()=>s(3)}];return Object(g.jsx)(S.EuiStepsHorizontal,{steps:o})},Ge=({snapshotDetails:e,isSaving:t,saveError:s,clearSaveError:a,onSave:o})=>{const[i,n]=Object(r.useState)(1),[l,c]=Object(r.useState)(0),u={1:De,2:Ce,3:Ne}[i],[p,d]=Object(r.useState)({featureStates:[W.e]}),[j,x]=Object(r.useState)({isValid:!0,errors:{}}),b=e=>{l{const t={...p,...e},s=(e=>{const t=_.a.i18n,{indices:s,renamePattern:a,renameReplacement:o,indexSettings:i,ignoreIndexSettings:r}=e,n={isValid:!0,errors:{indices:[],renamePattern:[],renameReplacement:[],indexSettings:[],ignoreIndexSettings:[]}};if("string"==typeof s&&0===s.trim().length&&n.errors.indices.push(t.translate("xpack.snapshotRestore.restoreValidation.indexPatternRequiredError",{defaultMessage:"At least one index pattern is required."})),Array.isArray(s)&&0===s.length&&n.errors.indices.push(t.translate("xpack.snapshotRestore.restoreValidation.indicesRequiredError",{defaultMessage:"You must select at least one data stream or index."})),void 0!==a&&te(a)&&n.errors.renamePattern.push(t.translate("xpack.snapshotRestore.restoreValidation.renamePatternRequiredError",{defaultMessage:"Capture pattern is required."})),void 0!==o&&te(o)&&n.errors.renameReplacement.push(t.translate("xpack.snapshotRestore.restoreValidation.renameReplacementRequiredError",{defaultMessage:"Replacement pattern is required."})),"string"==typeof i)try{const e=JSON.parse(i),s=Object.keys(e),a=s.length,o=a>0?s.filter((e=>ee.L.includes(e))):null;0===a&&n.errors.indexSettings.push(t.translate("xpack.snapshotRestore.restoreValidation.indexSettingsRequiredError",{defaultMessage:"At least one setting is required."})),o&&o.length>0&&n.errors.indexSettings.push(t.translate("xpack.snapshotRestore.restoreValidation.indexSettingsNotModifiableError",{defaultMessage:"You can’t modify: {settings}",values:{settings:o.map(((e,t)=>0===t?`${e} `:e))}}))}catch(e){n.errors.indexSettings.push(t.translate("xpack.snapshotRestore.restoreValidation.indexSettingsInvalidError",{defaultMessage:"Invalid JSON format"}))}if(Array.isArray(r)){const e=r.length,s=e>0?r.filter((e=>ee.M.includes(e))):null;0===e&&n.errors.ignoreIndexSettings.push(t.translate("xpack.snapshotRestore.restoreValidation.ignoreIndexSettingsRequiredError",{defaultMessage:"At least one setting is required."})),s&&s.length>0&&n.errors.ignoreIndexSettings.push(t.translate("xpack.snapshotRestore.restoreValidation.indexSettingsNotRemovableError",{defaultMessage:"You can’t reset: {settings}",values:{settings:s.map(((e,t)=>0===t?`${e} `:e))}}))}return n.errors=Object.entries(n.errors).filter((([e,t])=>t.length>0)).reduce(((e,[t,s])=>(e[t]=s,e)),{}),Object.keys(n.errors).length>0&&(n.isValid=!1),n})(t);d(t),x(s)},errors:j.errors,updateCurrentStep:b}),Object(g.jsx)(S.EuiSpacer,{size:"xl"}),s?Object(g.jsx)(r.Fragment,null,s,Object(g.jsx)(S.EuiSpacer,{size:"m"})):null,Object(g.jsx)(S.EuiFlexGroup,null,i>1?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{iconType:"arrowLeft",onClick:()=>(()=>{const e=i-1;n(e),c(e-1),a()})(),disabled:!j.isValid,"data-test-subj":"backButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.backButtonLabel",defaultMessage:"Back"}))):null,i<3?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButton,{fill:!0,iconType:"arrowRight",onClick:()=>(()=>{if(!j.isValid)return;const e=i+1;c(Math.max(i,l)),n(e)})(),disabled:!j.isValid,"data-test-subj":"nextButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.nextButtonLabel",defaultMessage:"Next"}))):null,3===i?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButton,{fill:!0,color:"success",iconType:"check",onClick:()=>{j.isValid&&o(p)},isLoading:t,"data-test-subj":"restoreButton"},t?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.savingButtonLabel",defaultMessage:"Restoring…"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreForm.submitButtonLabel",defaultMessage:"Restore snapshot"}))):null)),Object(g.jsx)(S.EuiSpacer,{size:"m"}))},Ve=({children:e})=>{const{i18n:t}=C(),s=B(),[a,i]=Object(r.useState)(""),[n,l]=Object(r.useState)(!1),c=Object(r.useRef)(null),u=()=>{l(!1),i("")};return Object(g.jsx)(r.Fragment,null,e(((e,t=(()=>{}))=>{if(!e||!e.length)throw new Error("No policy name specified for execution");l(!0),i(e),c.current=t})),n?Object(g.jsx)(S.EuiConfirmModal,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.executePolicy.confirmModal.executePolicyTitle",defaultMessage:"Run '{name}' now?",values:{name:a}}),onCancel:u,onConfirm:()=>{Object(o.i)(a).then((({data:e,error:o})=>{const{snapshotName:i}=e||{snapshotName:void 0};if(i){const e=t.translate("xpack.snapshotRestore.executePolicy.successNotificationTitle",{defaultMessage:"Policy '{name}' is running",values:{name:a}});s.addSuccess(e),c.current&&c.current()}if(o){const e=t.translate("xpack.snapshotRestore.executePolicy.errorNotificationTitle",{defaultMessage:"Error running policy '{name}'",values:{name:a}});s.addDanger(e)}})),u()},cancelButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.executePolicy.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.executePolicy.confirmModal.confirmButtonLabel",defaultMessage:"Run policy"}),"data-test-subj":"srExecutePolicyConfirmationModal"}):null)},Ue=({children:e})=>{const{i18n:t}=C(),s=B(),[a,i]=Object(r.useState)([]),[n,l]=Object(r.useState)(!1),c=Object(r.useRef)(null),u=()=>{l(!1),i([])},p=()=>{const e=[...a];Object(o.d)(e).then((({data:a,error:o})=>{const{itemsDeleted:i,errors:r}=a||{itemsDeleted:void 0,errors:void 0};if(i&&i.length){const e=i.length>1?t.translate("xpack.snapshotRestore.deletePolicy.successMultipleNotificationTitle",{defaultMessage:"Deleted {count} policies",values:{count:i.length}}):t.translate("xpack.snapshotRestore.deletePolicy.successSingleNotificationTitle",{defaultMessage:"Deleted policy '{name}'",values:{name:i[0]}});s.addSuccess(e),c.current&&c.current([...i])}if(o||r&&r.length){const a=r&&r.length>1||o&&e.length>1?t.translate("xpack.snapshotRestore.deletePolicy.errorMultipleNotificationTitle",{defaultMessage:"Error deleting {count} policies",values:{count:r&&r.length||e.length}}):t.translate("xpack.snapshotRestore.deletePolicy.errorSingleNotificationTitle",{defaultMessage:"Error deleting policy '{name}'",values:{name:r&&r[0].name||e[0]}});s.addDanger(a)}})),u()};return Object(g.jsx)(r.Fragment,null,e(((e,t=(()=>{}))=>{if(!e||!e.length)throw new Error("No policy names specified for deletion");l(!0),i(e),c.current=t})),(()=>{if(!n)return null;const e=1===a.length;return Object(g.jsx)(S.EuiConfirmModal,{title:e?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deletePolicy.confirmModal.deleteSingleTitle",defaultMessage:"Delete policy '{name}'?",values:{name:a[0]}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deletePolicy.confirmModal.deleteMultipleTitle",defaultMessage:"Delete {count} policies?",values:{count:a.length}}),onCancel:u,onConfirm:p,cancelButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deletePolicy.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deletePolicy.confirmModal.confirmButtonLabel",defaultMessage:"Delete {count, plural, one {policy} other {policies}}",values:{count:a.length}}),buttonColor:"danger","data-test-subj":"srdeletePolicyConfirmationModal"},e?null:Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.deletePolicy.confirmModal.deleteMultipleListDescription",defaultMessage:"You are about to delete these policies:"})),Object(g.jsx)("ul",null,a.map((e=>Object(g.jsx)("li",{key:e},e))))))})())},_e=({children:e})=>{const{i18n:t}=C(),{docLinks:s}=I(),a=B(),[i,n]=Object(r.useState)(ee.e),[l,c]=Object(r.useState)(!1),[u,p]=Object(r.useState)(!1),[d,j]=Object(r.useState)(!1),[x,b]=Object(r.useState)(null),[m,h]=Object(r.useState)(!1),O=Object(r.useRef)(null),[y,f]=Object(r.useState)({expression:ee.e,frequency:ee.d}),[M,F]=Object(r.useState)({}),[E,k]=Object(r.useState)(!1),L=()=>{c(!1)};return Object(g.jsx)(r.Fragment,null,e(((e,t=(()=>{}))=>{c(!0),h(Boolean(e&&e!==ee.e)),e&&(p(!0),n(e)),O.current=t})),l?Object(g.jsx)(S.EuiModal,{onClose:L},Object(g.jsx)(S.EuiModalHeader,null,Object(g.jsx)(S.EuiModalHeaderTitle,null,u?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionEditTitle",defaultMessage:"Edit retention schedule"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionAddTitle",defaultMessage:"Add retention schedule"}))),Object(g.jsx)(S.EuiModalBody,null,x&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionErrorTitle",defaultMessage:"Error saving retention schedule"}),color:"danger",iconType:"warning"},x.data&&x.data.message?Object(g.jsx)("p",null,x.data.message):null),Object(g.jsx)(S.EuiSpacer,{size:"m"})),m?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionScheduleLabel",defaultMessage:"Retention schedule"}),isInvalid:E,error:t.translate("xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionScheduleFieldErrorMessage",{defaultMessage:"Retention schedule is required."}),helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionHelpText",defaultMessage:"Use cron expression. {docLink}",values:{docLink:Object(g.jsx)(S.EuiLink,{href:s.links.watcher.cronSchedule,target:"_blank"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionHelpTextDocLinkText",defaultMessage:"Learn more."}))}}),fullWidth:!0},Object(g.jsx)(S.EuiFieldText,{defaultValue:i,fullWidth:!0,onChange:e=>n(e.target.value)})),Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)(S.EuiLink,{onClick:()=>{h(!1),n(y.expression)},"data-test-subj":"showBasicCronLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionBasicLabel",defaultMessage:"Create basic interval"})))):Object(g.jsx)(r.Fragment,null,Object(g.jsx)(v.b,{fieldToPreferredValueMap:M,cronExpression:y.expression,frequency:y.frequency,onChange:({cronExpression:e,frequency:t,fieldToPreferredValueMap:s})=>{f({expression:e,frequency:t}),F(s),n(e)}}),Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)(S.EuiLink,{onClick:()=>{h(!0)},"data-test-subj":"showAdvancedCronLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionAdvancedLabel",defaultMessage:"Create cron expression"}))))),Object(g.jsx)(S.EuiModalFooter,null,Object(g.jsx)(S.EuiButtonEmpty,{onClick:L},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionCancelButtonLabel",defaultMessage:"Cancel"})),Object(g.jsx)(S.EuiButton,{onClick:async()=>{if(!i)return void k(!0);j(!0),b(null);const{error:e}=await Object(o.n)(i);j(!1),e?b(e):(L(),a.addSuccess(t.translate("xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionSuccessMessage",{defaultMessage:"Retention schedule updated"})),O.current&&O.current())},fill:!0,isLoading:d},u?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionEditButtonLabel",defaultMessage:"Save changes"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.policyUpdateRetentionSaveButtonLabel",defaultMessage:"Schedule"})))):null)},He=({children:e})=>{const{i18n:t}=C(),s=B(),[a,i]=Object(r.useState)(!1),l=()=>{i(!1)};return Object(g.jsx)(n.a.Fragment,null,e((()=>{i(!0)})),a?Object(g.jsx)(S.EuiConfirmModal,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.executeRetention.confirmModal.executeRetentionTitle",defaultMessage:"Run snapshot retention now?"}),onCancel:l,onConfirm:()=>{Object(o.k)().then((({error:e})=>{if(e){const e=t.translate("xpack.snapshotRestore.executeRetention.errorMessage",{defaultMessage:"Error running retention"});s.addDanger(e)}else{const e=t.translate("xpack.snapshotRestore.executeRetention.successMessage",{defaultMessage:"Retention is running"});s.addSuccess(e)}})),l()},cancelButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.executeRetention.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.executeRetention.confirmModal.confirmButtonLabel",defaultMessage:"Run retention"}),"data-test-subj":"executeRetentionModal"}):null)},qe=({policy:e,updatePolicy:t,isEditing:s,currentUrl:a,errors:l})=>{const{error:c,isLoading:p,data:{repositories:d}={repositories:[]},resendRequest:j}=Object(o.r)(),{i18n:x,history:b}=C(),{docLinks:m}=I(),[h,O]=Object(r.useState)(!1),[y,f]=Object(r.useState)({name:!1,snapshotName:!1,repository:!1,schedule:!1}),[M,E]=Object(r.useState)({expression:ee.c,frequency:ee.b}),[k,L]=Object(r.useState)(Boolean(e.schedule&&e.schedule!==ee.c)),[T,D]=Object(r.useState)({});return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogisticsTitle",defaultMessage:"Logistics"})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:m.links.apis.putSnapshotLifecyclePolicy,target:"_blank",iconType:"help"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.docsButtonLabel",defaultMessage:"Logistics docs"})))),h&&Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiCallOut,{"data-test-subj":"repositoryNotFoundWarning",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.selectRepository.policyRepositoryNotFoundTitle",defaultMessage:"Repository not found"}),color:"danger",iconType:"warning"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.selectRepository.policyRepositoryNotFoundDescription",defaultMessage:"Repository {repo} does not exist. Please select an existing repository.",values:{repo:Object(g.jsx)(S.EuiCode,null,e.repository)}}))),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.nameDescriptionTitle",defaultMessage:"Policy name"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.nameDescription",defaultMessage:"A unique identifier for this policy."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.nameLabel",defaultMessage:"Name"}),isInvalid:y.name&&Boolean(l.name),error:l.name,fullWidth:!0},Object(g.jsx)(S.EuiFieldText,{defaultValue:e.name,fullWidth:!0,onBlur:()=>f({...y,name:!0}),onChange:e=>{t({name:e.target.value})},placeholder:x.translate("xpack.snapshotRestore.policyForm.stepLogistics.namePlaceholder",{defaultMessage:"daily-snapshots",description:"Example SLM policy name. Similar to index names, do not use spaces in translation."}),"data-test-subj":"nameInput",disabled:s}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.snapshotNameDescriptionTitle",defaultMessage:"Snapshot name"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.snapshotNameDescription",defaultMessage:"The name for the snapshots. A unique identifier is automatically added to each name."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policySnapshotNameLabel",defaultMessage:"Snapshot name"}),isInvalid:y.snapshotName&&Boolean(l.snapshotName),error:l.snapshotName,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policySnapshotNameHelpText",defaultMessage:"Supports date math expressions. {docLink}",values:{docLink:Object(g.jsx)(S.EuiLink,{href:m.links.date.dateMathIndexNames,target:"_blank"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policySnapshotNameHelpTextDocLink",defaultMessage:"Learn more."}))}}),fullWidth:!0},Object(g.jsx)(S.EuiFieldText,{defaultValue:e.snapshotName,fullWidth:!0,onChange:e=>{t({snapshotName:e.target.value})},onBlur:()=>f({...y,snapshotName:!0}),placeholder:x.translate("xpack.snapshotRestore.policyForm.stepLogistics.policySnapshotNamePlaceholder",{defaultMessage:"",description:"Example date math snapshot name. Keeping the same syntax is important: "}),"data-test-subj":"snapshotNameInput"}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.repositoryDescriptionTitle",defaultMessage:"Repository"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.repositoryDescription",defaultMessage:"The repository where you want to store the snapshots."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policyRepositoryLabel",defaultMessage:"Repository"}),isInvalid:y.repository&&Boolean(l.repository),error:l.repository,fullWidth:!0},(()=>{if(p)return Object(g.jsx)(Oe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.loadingRepositoriesDescription",defaultMessage:"Loading repositories…"}));if(c)return Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.loadingRepositoriesErrorMessage",defaultMessage:"Error loading repositories"}),error:c,actions:Object(g.jsx)(S.EuiButton,{onClick:()=>j(),color:"danger",iconType:"refresh","data-test-subj":"reloadRepositoriesButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.reloadRepositoriesButtonLabel",defaultMessage:"Reload repositories"}))});if(0===d.length)return Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.noRepositoriesErrorTitle",defaultMessage:"You don't have any repositories"}),error:{error:x.translate("xpack.snapshotRestore.policyForm.noRepositoriesErrorMessage",{defaultMessage:"You must register a repository to store your snapshots."})},actions:Object(g.jsx)(S.EuiButton,u()({},Object(F.reactRouterNavigate)(b,Object(i.d)(a)),{color:"danger",iconType:"plusInCircle","data-test-subj":"addRepositoryButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.addRepositoryButtonLabel",defaultMessage:"Register a repository"}))});e.repository||t({repository:d[0].name});const s=!!e.repository&&d.some((t=>t.name===e.repository));return s||l.repository||t(e,{repositoryDoesNotExist:!0}),h!==!s&&O(!s),Object(g.jsx)(S.EuiSelect,{options:d.map((({name:e})=>({value:e,text:e}))),hasNoInitialSelection:!s,value:s?e.repository:"",onBlur:()=>f({...y,repository:!0}),onChange:e=>{t({repository:e.target.value})},fullWidth:!0,"data-test-subj":"repositorySelect"})})())),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.scheduleDescriptionTitle",defaultMessage:"Schedule"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.scheduleDescription",defaultMessage:"The frequency at which to take the snapshots."}),fullWidth:!0},k?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policyScheduleLabel",defaultMessage:"Schedule"}),isInvalid:y.schedule&&Boolean(l.schedule),error:l.schedule,helpText:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policyScheduleHelpText",defaultMessage:"Use cron expression. {docLink}",values:{docLink:Object(g.jsx)(S.EuiLink,{href:m.links.apis.cronExpressions,target:"_blank"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policyScheduleHelpTextDocLink",defaultMessage:"Learn more."}))}}),fullWidth:!0},Object(g.jsx)(S.EuiFieldText,{defaultValue:e.schedule,fullWidth:!0,onChange:e=>{t({schedule:e.target.value})},onBlur:()=>f({...y,schedule:!0}),placeholder:ee.c,"data-test-subj":"advancedCronInput"})),Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)(S.EuiLink,{onClick:()=>{L(!1),t({schedule:M.expression})},"data-test-subj":"showBasicCronLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policyScheduleButtonBasicLabel",defaultMessage:"Create basic interval"})))):Object(g.jsx)(r.Fragment,null,Object(g.jsx)(v.b,{frequencyBlockList:["MINUTE"],fieldToPreferredValueMap:T,cronExpression:M.expression,frequency:M.frequency,onChange:({cronExpression:e,frequency:s,fieldToPreferredValueMap:a})=>{E({expression:e,frequency:s}),D(a),t({schedule:e})}}),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)(S.EuiLink,{onClick:()=>{L(!0)},"data-test-subj":"showAdvancedCronLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepLogistics.policyScheduleButtonAdvancedLabel",defaultMessage:"Create cron expression"}))))))},$e=({allSelected:e,selection:t,dataStreams:s,indices:a})=>Fe({dataStreams:s.map((s=>({label:s,append:Object(g.jsx)(Se,null),checked:e||t.includes(s)?"on":void 0}))),indices:a.map((s=>({label:s,checked:e||t.includes(s)?"on":void 0})))}),Ye=({onSelectionChange:e,selectedIndicesAndDataStreams:t,indices:s,dataStreams:a})=>{if(0===t.length)return Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.noDataStreamsOrIndicesHelpText",defaultMessage:"Nothing will be backed up. {selectAllLink}",values:{selectAllLink:Object(g.jsx)(S.EuiLink,{onClick:()=>{e("all")}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.selectAllIndicesLink",defaultMessage:"Select all"}))}});const o=t.reduce(((e,t)=>s.includes(t)?e+1:e),0),i=t.reduce(((e,t)=>a.includes(t)?e+1:e),0);return Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.selectDataStreamsIndicesHelpText",defaultMessage:"{indicesCount} {indicesCount, plural, one {index} other {indices}} and {dataStreamsCount} {dataStreamsCount, plural, one {data stream} other {data streams}} will be backed up. {deselectAllLink}",values:{dataStreamsCount:i,indicesCount:o,deselectAllLink:Object(g.jsx)(S.EuiLink,{"data-test-subj":"deselectIndicesLink",onClick:()=>{e("none")}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.deselectAllIndicesLink",defaultMessage:"Deselect all"}))}})},Je=({isManagedPolicy:e,dataStreams:t,indices:s,policy:a,onUpdate:o,errors:i})=>{const{i18n:n}=C(),{config:l={}}=a,c=s.concat(t),[u,p]=Object(r.useState)(null==l.indices||Array.isArray(l.indices)&&0===l.indices.length),d=e=>{o(e,{validateIndicesCount:!u})},[j,x]=Object(r.useState)((()=>Array.isArray(l.indices)&&!u?c.filter((e=>l.indices.includes(e))):[...c])),[b,m]=Object(r.useState)((()=>$e({selection:j,dataStreams:t,indices:s,allSelected:u||"string"==typeof l.indices}))),[h,O]=Object(r.useState)((()=>(({configuredIndices:e,indices:t,dataStreams:s})=>{const a=t.concat(s);return"string"==typeof e||a.length>100||Array.isArray(e)&&!e.every((e=>a.some((t=>t===e))))?"custom":"list"})({configuredIndices:l.indices,dataStreams:t,indices:s}))),[y,f]=Object(r.useState)((()=>"string"==typeof l.indices?l.indices.split(","):Array.isArray(l.indices)&&l.indices?l.indices:[])),M=Object(g.jsx)(S.EuiSwitch,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.allDataStreamsAndIndicesLabel",defaultMessage:"All data streams and indices"}),checked:u,disabled:e,"data-test-subj":"allIndicesToggle",onChange:e=>{const a=e.target.checked;p(a),a?(x(c),m($e({allSelected:u||"string"==typeof l.indices,dataStreams:t,indices:s,selection:j})),d({indices:void 0})):o({indices:"custom"===h?y.join(","):[...j||[]]},{validateIndicesCount:!0})}});return Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.dataStreamsAndIndicesTitle",defaultMessage:"Data streams and indices"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.dataStreamsAndIndicesDescription",defaultMessage:"To back up indices and data streams, manually select them or define index patterns to dynamically match them."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(r.Fragment,null,e?Object(g.jsx)(S.EuiToolTip,{position:"left",content:Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.indicesTooltip",defaultMessage:"Cloud-managed policies require all indices."}))},M):M,u?null:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiFormRow,{className:"snapshotRestore__policyForm__stepSettings__indicesFieldWrapper",label:"list"===h?Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.selectIndicesLabel",defaultMessage:"Select indices and data streams"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLink,{onClick:()=>{O("custom"),d({indices:y.join(",")})}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.indicesToggleCustomLink",defaultMessage:"Use index patterns"})))):Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.indicesPatternLabel",defaultMessage:"Index patterns"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLink,{"data-test-subj":"selectIndicesLink",onClick:()=>{O("list"),d({indices:j})}},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.dataStreamsAndIndicesToggleListLink",defaultMessage:"Select data streams and indices"})))),helpText:"list"===h?Object(g.jsx)(Ye,{onSelectionChange:e=>{"all"===e?(b.forEach((e=>{e.checked="on"})),d({indices:[...c]}),x([...c])):(b.forEach((e=>{e.checked=void 0})),d({indices:[]}),x([]))},selectedIndicesAndDataStreams:j,indices:s,dataStreams:t}):null,isInvalid:Boolean(i.indices),error:i.indices},"list"===h?Object(g.jsx)(S.EuiSelectable,{allowExclusions:!1,"data-test-subj":"indicesAndDataStreamsList",options:b,onChange:e=>{const t=[];e.forEach((({label:e,checked:s})=>{"on"===s&&t.push(e)})),m(e),d({indices:t}),x(t)},searchable:!0,height:300},((e,t)=>Object(g.jsx)(S.EuiPanel,{paddingSize:"s",hasShadow:!1},t,e))):Object(g.jsx)(S.EuiComboBox,{options:Fe({indices:s.map((e=>({label:e,value:{isDataStream:!1}}))),dataStreams:t.map((e=>({label:e,value:{isDataStream:!0}})))}),renderOption:({label:e,value:t})=>null!=t&&t.isDataStream?Object(g.jsx)(S.EuiFlexGroup,{responsive:!1,justifyContent:"spaceBetween",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},e),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(Se,null))):e,placeholder:n.translate("xpack.snapshotRestore.policyForm.stepSettings.indicesPatternPlaceholder",{defaultMessage:"Enter index patterns, i.e. logstash-*"}),selectedOptions:y.map((e=>({label:e}))),onCreateOption:e=>{if(!e.trim().length)return;const t=[...y,e];f(t),d({indices:t.join(",")})},onChange:e=>{const t=e.map((({label:e})=>e));f(t),d({indices:t.join(",")})}}))))))},Ke=({policy:e,onUpdate:t})=>{const{config:s={}}=e;return Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.includeGlobalStateDescriptionTitle",defaultMessage:"Include global state"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.includeGlobalStateDescription",defaultMessage:"Stores the global cluster state as part of the snapshot."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{"data-test-subj":"globalStateToggle",label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.policyIncludeGlobalStateLabel",defaultMessage:"Include global state"}),checked:void 0===s.includeGlobalState||s.includeGlobalState,onChange:e=>{var a;const{checked:o}=e.target,i=!(null!=s&&null!==(a=s.featureStates)&&void 0!==a&&a.includes(W.e));t({includeGlobalState:o,featureStates:o&&!i?[]:s.featureStates||[]})}})))};var Qe=s(10);const Ze=({policy:e,onUpdate:t})=>{const{config:s={}}=e,{error:a,isLoading:o,data:i}=Object(Qe.h)(),l=Object(r.useMemo)((()=>((null==i?void 0:i.features)||[]).map((e=>e.name))),[i]),c=Object(r.useMemo)((()=>{var e;return null==s||null===(e=s.featureStates)||void 0===e?void 0:e.map((e=>({label:e})))}),[s.featureStates]),u=void 0!==s.featureStates&&!s.featureStates.includes(W.e);return Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.includeFeatureStatesDescriptionTitle",defaultMessage:"Include feature state"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.includeFeatureStatesDescription",defaultMessage:"Includes the configuration, history, and other data stored in Elasticsearch by a feature such as Elasticsearch security."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{"data-test-subj":"featureStatesToggle",label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.policyIncludeFeatureStatesLabel",defaultMessage:"Include feature state from"}),checked:u,onChange:e=>{const{checked:s}=e.target;t({featureStates:s?[]:[W.e]})}})),u&&Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),a?Object(g.jsx)(S.EuiCallOut,{color:"warning",iconType:"warning",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.errorLoadingFeatureStatesLabel",defaultMessage:"There was an error loading the list of feature states"})}):Object(g.jsx)(Te,{isLoadingFeatures:o,featuresOptions:l,selectedOptions:c,onUpdateFormSettings:t})))},Xe=({policy:e,indices:t,dataStreams:s,updatePolicy:a,errors:o})=>{const{docLinks:i}=I(),{config:r={},isManagedPolicy:n}=e,l=(e,t={})=>{const s={...r,...e};a({config:s},t)};return Object(g.jsx)("div",{className:"snapshotRestore__policyForm__stepSettings"},Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettingsTitle",defaultMessage:"Snapshot settings"})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:i.links.snapshotRestore.createSnapshot,target:"_blank",iconType:"help"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.docsButtonLabel",defaultMessage:"Snapshot docs"})))),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(Je,{isManagedPolicy:n,errors:o,dataStreams:s,indices:t,policy:e,onUpdate:l}),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.ignoreUnavailableDescriptionTitle",defaultMessage:"Ignore unavailable indices"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.ignoreUnavailableDescription",defaultMessage:"Ignores indices that are unavailable when taking the snapshot. Otherwise, the entire snapshot will fail."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{"data-test-subj":"ignoreUnavailableIndicesToggle",label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.ignoreUnavailableLabel",defaultMessage:"Ignore unavailable indices"}),checked:Boolean(r.ignoreUnavailable),onChange:e=>{l({ignoreUnavailable:e.target.checked})}}))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.partialDescriptionTitle",defaultMessage:"Allow partial indices"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.partialDescription",defaultMessage:"Allows snapshots of indices with primary shards that are unavailable. Otherwise, the entire snapshot will fail."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{hasEmptyLabelSpace:!0,fullWidth:!0},Object(g.jsx)(S.EuiSwitch,{"data-test-subj":"partialIndicesToggle",label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepSettings.partialIndicesToggleSwitch",defaultMessage:"Allow partial indices"}),checked:Boolean(r.partial),onChange:e=>{l({partial:e.target.checked})}}))),Object(g.jsx)(Ke,{errors:o,policy:e,onUpdate:l}),Object(g.jsx)(Ze,{errors:o,policy:e,onUpdate:l}))},et=(e="0")=>Object.entries(W.h).map((([t,s])=>({text:_.a.getTimeUnitLabel(s,e),value:s}))),tt=({policy:e,updatePolicy:t,errors:s})=>{const{retention:a={}}=e,{docLinks:o}=I(),i=(e,s={})=>{const o={...a,...e};t({retention:o},s)},[n,l]=Object(r.useState)({expireAfterValue:!1,minCount:!1,maxCount:!1});return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetentionTitle",defaultMessage:"Snapshot retention (optional)"})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:o.links.snapshotRestore.createSnapshot,target:"_blank",iconType:"help"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.docsButtonLabel",defaultMessage:"Snapshot docs"})))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.expirationTitle",defaultMessage:"Expiration"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.expirationDescription",defaultMessage:"The time to wait before deleting snapshots."}),fullWidth:!0},Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.expireAfterLabel",defaultMessage:"Delete after"}),isInvalid:n.expireAfterValue&&Boolean(s.expireAfterValue),error:s.expireAfterValue,fullWidth:!0},Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiFieldNumber,{value:a.expireAfterValue||"",onBlur:()=>l({...n,expireAfterValue:!0}),onChange:e=>{const t=e.target.value;i({expireAfterValue:""!==t?Number(t):t})},"data-test-subj":"expireAfterValueInput",min:0})),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiSelect,{value:a.expireAfterUnit,options:et(a.expireAfterValue?a.expireAfterValue.toString():void 0),onChange:e=>{i({expireAfterUnit:e.target.value})},"data-test-subj":"expireAfterUnitSelect"}))))),Object(g.jsx)(S.EuiDescribedFormGroup,{title:Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.countTitle",defaultMessage:"Snapshots to retain"}))),description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.countDescription",defaultMessage:"The minimum and maximum number of snapshots to store for the policy."}),fullWidth:!0},Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.minCountLabel",defaultMessage:"Mininum count"}),isInvalid:n.minCount&&Boolean(s.minCount),error:s.minCount,fullWidth:!0},Object(g.jsx)(S.EuiFieldNumber,{fullWidth:!0,value:a.minCount||"",onBlur:()=>l({...n,minCount:!0}),onChange:e=>{const t=e.target.value;i({minCount:""!==t?Number(t):t})},"data-test-subj":"minCountInput",min:0}))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiFormRow,{label:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepRetention.maxCountLabel",defaultMessage:"Maximum count"}),isInvalid:n.maxCount&&Boolean(s.maxCount),error:s.maxCount,fullWidth:!0},Object(g.jsx)(S.EuiFieldNumber,{fullWidth:!0,value:a.maxCount||"",onBlur:()=>l({...n,maxCount:!0}),onChange:e=>{const t=e.target.value;i({maxCount:""!==t?Number(t):t})},"data-test-subj":"maxCountInput",min:0}))))))},st=({policy:e,updateCurrentStep:t})=>{const{i18n:s}=C(),{name:a,snapshotName:o,schedule:i,repository:n,config:l,retention:c}=e,{indices:u,includeGlobalState:p,featureStates:d,ignoreUnavailable:j,partial:x}=l||{indices:void 0,includeGlobalState:void 0,featureStates:[],ignoreUnavailable:void 0,partial:void 0},b=(e=>{const{snapshotName:t,schedule:s,repository:a,config:o,retention:i}=e,r={name:t,schedule:s,repository:a};return o&&(r.config=function(e){const{indices:t,ignoreUnavailable:s,includeGlobalState:a,featureStates:o,partial:i,metadata:r}=e,n={indices:V(t),ignore_unavailable:s,include_global_state:a,feature_states:o,partial:i,metadata:r};return Object.entries(n).reduce(((e,[t,s])=>(void 0!==s&&(e[t]=s),e)),{})}(o)),i&&U(i)&&(r.retention=U(i)),r})(e),{retention:m}=b,h=({step:e})=>Object(g.jsx)(S.EuiToolTip,{content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.editStepTooltip",defaultMessage:"Edit"})},Object(g.jsx)(S.EuiLink,{onClick:()=>t(e)},Object(g.jsx)(S.EuiIcon,{type:"pencil","aria-label":s.translate("xpack.snapshotRestore.policyForm.stepReview.editIconAriaLabel",{defaultMessage:"Edit step"})})));return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReviewTitle",defaultMessage:"Review policy"}))),Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTabbedContent,{tabs:[{id:"summary",name:s.translate("xpack.snapshotRestore.policyForm.stepReview.summaryTabTitle",{defaultMessage:"Summary"}),content:Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.sectionLogisticsTitle",defaultMessage:"Logistics"})," ",Object(g.jsx)(h,{step:1}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.nameLabel",defaultMessage:"Policy name"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,a))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.snapshotNameLabel",defaultMessage:"Snapshot name"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,o)))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.repositoryLabel",defaultMessage:"Repository"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,n))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.scheduleLabel",defaultMessage:"Schedule"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,i)))),Object(g.jsx)(S.EuiSpacer,{size:"xxl"}),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.sectionSettingsTitle",defaultMessage:"Snapshot settings"})," ",Object(g.jsx)(h,{step:2}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.dataStreamsAndIndicesLabel",defaultMessage:"Data streams and indices"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,Object(g.jsx)(we,{indices:u})))),Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.ignoreUnavailableLabel",defaultMessage:"Ignore unavailable indices"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,j?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.ignoreUnavailableTrueLabel",defaultMessage:"Yes"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.ignoreUnavailableFalseLabel",defaultMessage:"No"}))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.includeGlobalStateLabel",defaultMessage:"Include global state"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,!1===p?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.includeGlobalStateFalseLabel",defaultMessage:"No"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.includeGlobalStateTrueLabel",defaultMessage:"Yes"})))),Object(g.jsx)(ze,{includeGlobalState:p,featureStates:d})),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.partialIndicesLabel",defaultMessage:"Allow partial indices"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,x?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.partialTrueLabel",defaultMessage:"Yes"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.summaryTab.partialFalseLabel",defaultMessage:"No"}))))),m?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.retentionTab.sectionRetentionTitle",defaultMessage:"Snapshot retention"})," ",Object(g.jsx)(h,{step:3}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},c.expireAfterValue&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.retentionTab.expireAfterLabel",defaultMessage:"Delete after"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,c.expireAfterValue,c.expireAfterUnit)),c.minCount&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.retentionTab.minCountLabel",defaultMessage:"Min count"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,c.minCount)),c.maxCount&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.stepReview.retentionTab.maxCountLabel",defaultMessage:"Max count"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,c.maxCount)))):null)},{id:"json",name:s.translate("xpack.snapshotRestore.policyForm.stepReview.requestTabTitle",{defaultMessage:"Request"}),content:(()=>{const e=`PUT _slm/policy/${a}`,t=JSON.stringify(b,null,2);return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiCodeBlock,{language:"json",isCopyable:!0},`${e}\n${t}`))})()}]}))},at=({currentStep:e,maxCompletedStep:t,updateCurrentStep:s,isFormValid:a})=>{const{i18n:o}=C(),i=[{title:o.translate("xpack.snapshotRestore.policyForm.navigation.stepLogisticsName",{defaultMessage:"Logistics"}),status:1===e?"selected":t>=1?"complete":"incomplete",disabled:!a&&1!==e,onClick:()=>s(1)},{title:o.translate("xpack.snapshotRestore.policyForm.navigation.stepSettingsName",{defaultMessage:"Snapshot settings"}),status:2===e?"selected":t>=2?"complete":"incomplete",disabled:t<1||!a&&2!==e,onClick:()=>s(2)},{title:o.translate("xpack.snapshotRestore.policyForm.navigation.stepRetentionName",{defaultMessage:"Snapshot retention"}),status:3===e?"selected":t>=3?"complete":"incomplete",disabled:t<2||!a&&3!==e,onClick:()=>s(3)},{title:o.translate("xpack.snapshotRestore.policyForm.navigation.stepReviewName",{defaultMessage:"Review"}),status:4===e?"selected":t>=3?"complete":"incomplete",disabled:t<3||!a&&4!==e,onClick:()=>s(4)}];return Object(g.jsx)(S.EuiStepsHorizontal,{steps:i})},ot=({policy:e,dataStreams:t,indices:s,currentUrl:a,isEditing:o,isSaving:i,saveError:n,clearSaveError:l,onCancel:c,onSave:u})=>{var p,d;const[j,x]=Object(r.useState)(1),[b,m]=Object(r.useState)(0),h={1:qe,2:Xe,3:tt,4:st},O=h[j],[y,f]=Object(r.useState)({...e,config:{featureStates:[],includeGlobalState:!0,...e.config||{}},retention:{...e.retention,expireAfterUnit:null!==(p=null===(d=e.retention)||void 0===d?void 0:d.expireAfterUnit)&&void 0!==p?p:W.h.DAY}}),M=Boolean(o&&y.isManagedPolicy),[F,E]=Object(r.useState)({isValid:!0,errors:{}}),k=e=>{b{const s={...y,...e},a=((e,t)=>{const s=_.a.i18n,{name:a,snapshotName:o,schedule:i,repository:r,config:n,retention:l}=e,{validateIndicesCount:c,repositoryDoesNotExist:u}=t,p={isValid:!0,errors:{name:[],snapshotName:[],schedule:[],repository:[],dataStreams:[],indices:[],expireAfterValue:[],minCount:[],maxCount:[]}};return se(a)&&p.errors.name.push(s.translate("xpack.snapshotRestore.policyValidation.nameRequiredErroMessage",{defaultMessage:"Policy name is required."})),se(o)&&p.errors.snapshotName.push(s.translate("xpack.snapshotRestore.policyValidation.snapshotNameRequiredErrorMessage",{defaultMessage:"Snapshot name is required."})),(e=>{const t=e.substring(0,e.search("{"))+e.substring(e.search("}>")+1,e.length);return t!==t.toLowerCase()})(o)&&p.errors.snapshotName.push(s.translate("xpack.snapshotRestore.policyValidation.snapshotNameLowerCaseErrorMessage",{defaultMessage:"Snapshot name needs to be lowercase."})),se(i)&&p.errors.schedule.push(s.translate("xpack.snapshotRestore.policyValidation.scheduleRequiredErrorMessage",{defaultMessage:"Schedule is required."})),(se(r)||u)&&p.errors.repository.push(s.translate("xpack.snapshotRestore.policyValidation.repositoryRequiredErrorMessage",{defaultMessage:"Repository is required."})),c&&n&&"string"==typeof n.indices&&0===n.indices.trim().length&&p.errors.indices.push(s.translate("xpack.snapshotRestore.policyValidation.indexPatternRequiredErrorMessage",{defaultMessage:"At least one index pattern is required."})),c&&n&&Array.isArray(n.indices)&&0===n.indices.length&&p.errors.indices.push(s.translate("xpack.snapshotRestore.policyValidation.indicesRequiredErrorMessage",{defaultMessage:"You must select at least one data stream or index."})),l&&l.minCount&&l.maxCount&&l.minCount>l.maxCount&&p.errors.minCount.push(s.translate("xpack.snapshotRestore.policyValidation.invalidMinCountErrorMessage",{defaultMessage:"Minimum count cannot be greater than maximum count."})),l&&l.expireAfterValue&&l.expireAfterValue<0&&p.errors.expireAfterValue.push(s.translate("xpack.snapshotRestore.policyValidation.invalidNegativeDeleteAfterErrorMessage",{defaultMessage:"Delete after cannot be negative."})),l&&l.minCount&&l.minCount<0&&p.errors.minCount.push(s.translate("xpack.snapshotRestore.policyValidation.invalidNegativeMinCountErrorMessage",{defaultMessage:"Minimum count cannot be negative."})),l&&l.maxCount&&l.maxCount<0&&p.errors.maxCount.push(s.translate("xpack.snapshotRestore.policyValidation.invalidNegativeMaxCountErrorMessage",{defaultMessage:"Maximum count cannot be negative."})),p.errors=Object.entries(p.errors).filter((([e,t])=>t.length>0)).reduce(((e,[t,s])=>(e[t]=s,e)),{}),Object.keys(p.errors).length>0&&(p.isValid=!1),p})(s,t);f(s),E(a)},isEditing:o,currentUrl:a,errors:F.errors,updateCurrentStep:k}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),n?Object(g.jsx)(r.Fragment,null,n,Object(g.jsx)(S.EuiSpacer,{size:"m"})):null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiFlexGroup,null,j>1?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{iconType:"arrowLeft",onClick:()=>(()=>{const e=j-1;x(e),m(e-1),l()})(),disabled:!F.isValid},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.backButtonLabel",defaultMessage:"Back"}))):null,j(()=>{if(!F.isValid)return;const e=j+1;m(Math.max(j,b)),x(e)})(),iconSide:"right",disabled:!F.isValid,"data-test-subj":"nextButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.nextButtonLabel",defaultMessage:"Next"}))):null,j===v?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButton,{fill:!M,color:M?"warning":"success",iconType:"check",onClick:()=>{F.isValid&&u(y)},isLoading:i,"data-test-subj":"submitButton"},i?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.savingButtonLabel",defaultMessage:"Saving…"}):o?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.saveButtonLabel",defaultMessage:"Save policy"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.createButtonLabel",defaultMessage:"Create policy"}))):null)),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{onClick:()=>c()},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyForm.cancelButtonLabel",defaultMessage:"Cancel"}))))),Object(g.jsx)(S.EuiSpacer,{size:"m"}))},it=e=>{let t;try{t=decodeURI(e),t=decodeURIComponent(t)}catch(s){try{t=decodeURIComponent(e)}catch(s){t=e}}return t},rt=()=>{const e=Object(p.useParams)(),t={};for(const[s,a]of Object.entries(e))a&&(t[s]=it(a));return t},nt={sortField:"startTimeInMillis",sortDirection:"desc",pageIndex:0,pageSize:20},lt=e=>({...e,searchField:void 0,searchValue:void 0,searchMatch:void 0,searchOperator:void 0}),ct=({repository:e})=>{const{settings:{client:t,container:s,basePath:a,compress:o,chunkSize:i,readonly:n,locationMode:l,maxRestoreBytesPerSec:c,maxSnapshotBytesPerSec:u}}=e,p=[];return void 0!==t&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.clientLabel",defaultMessage:"Client"}),description:t}),void 0!==s&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.containerLabel",defaultMessage:"Container"}),description:s}),void 0!==a&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.basePathLabel",defaultMessage:"Base path"}),description:a}),void 0!==o&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.compressLabel",defaultMessage:"Snapshot compression"}),description:String(o)}),void 0!==i&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.chunkSizeLabel",defaultMessage:"Chunk size"}),description:String(i)}),void 0!==u&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.maxSnapshotBytesLabel",defaultMessage:"Max snapshot bytes per second"}),description:u}),void 0!==c&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.maxRestoreBytesLabel",defaultMessage:"Max restore bytes per second"}),description:c}),void 0!==n&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.readonlyLabel",defaultMessage:"Read-only"}),description:String(n)}),void 0!==l&&p.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeAzure.locationModeLabel",defaultMessage:"Location mode"}),description:l}),p.length?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse",listItems:p})):null},ut=({repository:{name:e,settings:t}})=>Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiCodeBlock,{paddingSize:"m",language:"json",isCopyable:!0,"aria-label":a.i18n.translate("xpack.snapshotRestore.repositoryDetails.genericSettingsDescription",{defaultMessage:"Readonly settings for repository '{name}'",values:{name:e}})},JSON.stringify(t,null,2))),pt=({repository:e})=>{const{settings:{location:t,compress:s,chunkSize:a,maxRestoreBytesPerSec:o,maxSnapshotBytesPerSec:i,readonly:n}}=e,l=[{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeFS.locationLabel",defaultMessage:"Location"}),description:t}];return void 0!==s&&l.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeFS.compressLabel",defaultMessage:"Snapshot compression"}),description:String(s)}),void 0!==a&&l.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeFS.chunkSizeLabel",defaultMessage:"Chunk size"}),description:String(a)}),void 0!==i&&l.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeFS.maxSnapshotBytesLabel",defaultMessage:"Max snapshot bytes per second"}),description:i}),void 0!==o&&l.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeFS.maxRestoreBytesLabel",defaultMessage:"Max restore bytes per second"}),description:o}),void 0!==n&&l.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeFS.readonlyLabel",defaultMessage:"Read-only"}),description:String(n)}),Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse",listItems:l}))},dt=({repository:e})=>{const{settings:{bucket:t,client:s,basePath:a,compress:o,chunkSize:i,readonly:n,maxRestoreBytesPerSec:l,maxSnapshotBytesPerSec:c}}=e,u=[{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.bucketLabel",defaultMessage:"Bucket"}),description:t||""}];return void 0!==s&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.clientLabel",defaultMessage:"Client"}),description:s}),void 0!==a&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.basePathLabel",defaultMessage:"Base path"}),description:a}),void 0!==o&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.compressLabel",defaultMessage:"Snapshot compression"}),description:String(o)}),void 0!==i&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.chunkSizeLabel",defaultMessage:"Chunk size"}),description:String(i)}),void 0!==c&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.maxSnapshotBytesLabel",defaultMessage:"Max snapshot bytes per second"}),description:c}),void 0!==l&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.maxRestoreBytesLabel",defaultMessage:"Max restore bytes per second"}),description:l}),void 0!==n&&u.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeGCS.readonlyLabel",defaultMessage:"Read-only"}),description:String(n)}),Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse",listItems:u}))},jt=({repository:e})=>{const{settings:t}=e,{uri:s,path:a,loadDefaults:o,compress:i,chunkSize:n,readonly:l,maxSnapshotBytesPerSec:c,maxRestoreBytesPerSec:u,"security.principal":p,...d}=t,j=[{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.uriLabel",defaultMessage:"URI"}),description:s||""},{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.pathLabel",defaultMessage:"Path"}),description:a||""}];return void 0!==o&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.loadDefaultsLabel",defaultMessage:"Load defaults"}),description:String(o)}),void 0!==i&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.compressLabel",defaultMessage:"Snapshot compression"}),description:String(i)}),void 0!==n&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.chunkSizeLabel",defaultMessage:"Chunk size"}),description:String(n)}),void 0!==c&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.maxSnapshotBytesLabel",defaultMessage:"Max snapshot bytes per second"}),description:c}),void 0!==u&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.maxRestoreBytesLabel",defaultMessage:"Max restore bytes per second"}),description:u}),void 0!==l&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.readonlyLabel",defaultMessage:"Read-only"}),description:String(l)}),void 0!==p&&j.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeHDFS.securityPrincipalLabel",defaultMessage:"Security principal"}),description:p}),Object.keys(d).forEach((e=>{j.push({title:Object(g.jsx)(r.Fragment,null,e),description:String(t[e])})})),Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse",listItems:j}))},xt=({repository:e})=>{const{settings:{url:t}}=e,s=[{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeReadonly.urlLabel",defaultMessage:"URL"}),description:t}];return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse",listItems:s}))},bt=({repository:e})=>{const{settings:{bucket:t,client:s,basePath:a,compress:o,chunkSize:i,serverSideEncryption:n,bufferSize:l,cannedAcl:c,storageClass:u,readonly:p,maxRestoreBytesPerSec:d,maxSnapshotBytesPerSec:j}}=e,x=[{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.bucketLabel",defaultMessage:"Bucket"}),description:t||""}];return void 0!==s&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.clientLabel",defaultMessage:"Client"}),description:s}),void 0!==a&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.basePathLabel",defaultMessage:"Base path"}),description:a}),void 0!==o&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.compressLabel",defaultMessage:"Snapshot compression"}),description:String(o)}),void 0!==i&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.chunkSizeLabel",defaultMessage:"Chunk size"}),description:String(i)}),void 0!==n&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.serverSideEncryptionLabel",defaultMessage:"Server-side encryption"}),description:String(n)}),void 0!==l&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.bufferSizeLabel",defaultMessage:"Buffer size"}),description:l}),void 0!==c&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.cannedAclLabel",defaultMessage:"Canned ACL"}),description:c}),void 0!==u&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.storageClassLabel",defaultMessage:"Storage class"}),description:u}),void 0!==j&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.maxSnapshotBytesLabel",defaultMessage:"Max snapshot bytes per second"}),description:j}),void 0!==d&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.maxRestoreBytesLabel",defaultMessage:"Max restore bytes per second"}),description:d}),void 0!==p&&x.push({title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeS3.readonlyLabel",defaultMessage:"Read-only"}),description:String(p)}),Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.settingsTitle",defaultMessage:"Settings"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse",listItems:x}))},gt=({repository:e})=>{const{type:t,settings:s}=e;switch(t){case W.g.fs:return Object(g.jsx)(pt,{repository:e});case W.g.url:return Object(g.jsx)(xt,{repository:e});case W.g.source:const{delegateType:t}=s,a={...e,type:t};return Object(g.jsx)(gt,{repository:a});case W.g.azure:return Object(g.jsx)(ct,{repository:e});case W.g.gcs:return Object(g.jsx)(dt,{repository:e});case W.g.hdfs:return Object(g.jsx)(jt,{repository:e});case W.g.s3:return Object(g.jsx)(bt,{repository:e});default:return Object(g.jsx)(ut,{repository:e})}},mt=({repositoryName:e,onClose:t,onRepositoryDeleted:s})=>{const{i18n:a,history:l}=C(),{docLinks:c}=I(),{error:p,data:d}=Object(o.s)(e),[j,x]=Object(r.useState)(void 0),[b,m]=Object(r.useState)(void 0),[h,O]=Object(r.useState)(!1),[y,f]=Object(r.useState)(!1),M=async()=>{O(!0);const{data:t}=await Object(o.y)(e);x(t.verification),O(!1)},E=async()=>{f(!0);const{data:t}=await Object(o.c)(e);m(t.cleanup),f(!1)};Object(r.useEffect)((()=>{x(void 0),O(!1),m(void 0),f(!1)}),[e]);const L=()=>Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.verificationTitle",defaultMessage:"Verification status"}))),j?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(me,{verificationResults:j}),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("h4",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.verificationDetailsTitle",defaultMessage:"Details"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),j?Object(g.jsx)(S.EuiCodeBlock,{language:"json","data-test-subj":"verificationCodeBlock"},JSON.stringify(j.valid?j.response:j.error,null,2)):null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiButton,{onClick:M,color:"primary",isLoading:h},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.verifyButtonLabel",defaultMessage:"Verify repository"}))):Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiButton,{onClick:M,color:"primary",isLoading:h,"data-test-subj":"verifyRepositoryButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.verifyButtonLabel",defaultMessage:"Verify repository"})))),T=()=>Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.cleanupTitle",defaultMessage:"Repository cleanup"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiText,{size:"s"},Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.cleanupRepositoryMessage",defaultMessage:"You can clean up a repository to delete any unreferenced data from a snapshot. This may provide storage space savings. Note: If you regularly delete snapshots, this functionality will likely not be as beneficial and should be used less frequently."}))),b?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),b.cleaned?Object(g.jsx)("div",null,Object(g.jsx)(S.EuiTitle,{size:"xs"},Object(g.jsx)("h4",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.cleanupDetailsTitle",defaultMessage:"Details"}))),Object(g.jsx)(S.EuiCodeBlock,{language:"json","data-test-subj":"cleanupCodeBlock"},JSON.stringify(b.response,null,2))):Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.cleanupErrorTitle",defaultMessage:"Error cleaning repository"}),error:b.error,"data-test-subj":"cleanupError"})):null,Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(S.EuiButton,{onClick:E,color:"primary",isLoading:y,"data-test-subj":"cleanupRepositoryButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.cleanupButtonLabel",defaultMessage:"Clean up repository"})));return Object(g.jsx)(S.EuiFlyout,{onClose:t,"data-test-subj":"repositoryDetail","aria-labelledby":"srRepositoryDetailsFlyoutTitle",size:"m",maxWidth:550},Object(g.jsx)(S.EuiFlyoutHeader,null,Object(g.jsx)(S.EuiTitle,{size:"m"},Object(g.jsx)("h2",{id:"srRepositoryDetailsFlyoutTitle","data-test-subj":"title"},e))),Object(g.jsx)(S.EuiFlyoutBody,{"data-test-subj":"content"},d?(()=>{const{repository:t,isManagedRepository:s}=d;if(!t)return null;const{type:a}=t;return Object(g.jsx)(r.Fragment,null,s?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{size:"s",color:"warning",iconType:"iInCircle",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.managedRepositoryWarningTitle",defaultMessage:"This is a managed repository used by other systems. Any changes you make might affect how these systems operate."})}),Object(g.jsx)(S.EuiSpacer,{size:"l"})):null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"flexStart"},Object(g.jsx)(S.EuiFlexItem,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.typeTitle",defaultMessage:"Repository type"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)("span",{"data-test-subj":"repositoryType"},a===k.e.source?_.a.getRepositoryTypeName(a,t.settings.delegateType):_.a.getRepositoryTypeName(a))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{size:"s",flush:"right",href:ae(c,a),target:"_blank",iconType:"help","data-test-subj":"documentationLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.repositoryTypeDocLink",defaultMessage:"Repository docs"})))),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.snapshotsTitle",defaultMessage:"Snapshots"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)("span",{"data-test-subj":"snapshotCount"},(()=>{const{snapshots:t}=d;return Number.isInteger(t.count)?0===t.count?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.zeroSnapshotsDescription",defaultMessage:"Repository has no snapshots"}):Object(g.jsx)(S.EuiLink,Object(F.reactRouterNavigate)(l,Object(i.o)(e)),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.snapshotsDescription",defaultMessage:"{count} {count, plural, one {snapshot} other {snapshots}} found",values:{count:t.count}})):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.noSnapshotInformationDescription",defaultMessage:"No snapshot information"})})()),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(gt,{repository:t}),Object(g.jsx)(S.EuiHorizontalRule,null),L(),Object(g.jsx)(S.EuiHorizontalRule,null),T())})():p?(()=>{const t=404===p.status?{data:{error:a.translate("xpack.snapshotRestore.repositoryDetails.repositoryNotFoundErrorMessage",{defaultMessage:"The repository '{name}' does not exist.",values:{name:e}})}}:p;return Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.loadingRepositoryErrorTitle",defaultMessage:"Error loading repository"}),error:t})})():Object(g.jsx)(ye,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.loadingRepositoryDescription",defaultMessage:"Loading repository…"}))),Object(g.jsx)(S.EuiFlyoutFooter,null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{iconType:"cross",flush:"left",onClick:t,"data-test-subj":"srRepositoryDetailsFlyoutCloseButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.closeButtonLabel",defaultMessage:"Close"}))),d?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiFlexGroup,{alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(A,null,(t=>Object(g.jsx)(S.EuiButtonEmpty,{color:"danger","data-test-subj":"srRepositoryDetailsDeleteActionButton",onClick:()=>t([e],s),isDisabled:d.isManagedRepository,title:d.isManagedRepository?a.translate("xpack.snapshotRestore.repositoryDetails.removeManagedRepositoryButtonTitle",{defaultMessage:"You cannot delete a managed repository."}):void 0},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.removeButtonLabel",defaultMessage:"Remove"}))))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButton,u()({},Object(F.reactRouterNavigate)(l,Object(i.f)(e)),{fill:!0,color:"primary"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryDetails.editButtonLabel",defaultMessage:"Edit"}))))):null)))},ht=({repositories:e,managedRepository:t,reload:s,openRepositoryDetailsUrl:a,onRepositoryDeleted:o})=>{const{i18n:n,uiMetricService:l,history:c}=C(),[p,d]=Object(r.useState)([]),j=[{field:"name",name:n.translate("xpack.snapshotRestore.repositoryList.table.nameColumnTitle",{defaultMessage:"Name"}),truncateText:!0,sortable:!0,render:e=>Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiLink,u()({},Object(F.reactRouterNavigate)(c,a(e),(()=>l.trackUiMetric(ee.y))),{"data-test-subj":"repositoryLink"}),e),"  ",t===e?Object(g.jsx)(S.EuiIconTip,{content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.table.managedRepositoryBadgeLabel",defaultMessage:"This is a managed repository"}),position:"right"}):null)},{field:"type",name:n.translate("xpack.snapshotRestore.repositoryList.table.typeColumnTitle",{defaultMessage:"Type"}),truncateText:!0,sortable:!0,render:(e,t)=>e===k.e.source?_.a.getRepositoryTypeName(e,t.settings.delegateType):_.a.getRepositoryTypeName(e)},{field:"actions",name:n.translate("xpack.snapshotRestore.repositoryList.table.actionsColumnTitle",{defaultMessage:"Actions"}),actions:[{render:({name:e})=>{const t=n.translate("xpack.snapshotRestore.repositoryList.table.actionEditTooltip",{defaultMessage:"Edit"});return Object(g.jsx)(S.EuiToolTip,{content:t},Object(g.jsx)(S.EuiButtonIcon,u()({"aria-label":n.translate("xpack.snapshotRestore.repositoryList.table.actionEditAriaLabel",{defaultMessage:"Edit repository `{name}`",values:{name:e}}),iconType:"pencil",color:"primary"},Object(F.reactRouterNavigate)(c,Object(i.f)(e)),{"data-test-subj":"editRepositoryButton"})))}},{render:({name:e})=>Object(g.jsx)(A,null,(s=>{const a=e!==t?n.translate("xpack.snapshotRestore.repositoryList.table.actionRemoveTooltip",{defaultMessage:"Remove"}):n.translate("xpack.snapshotRestore.repositoryList.table.deleteManagedRepositoryTooltip",{defaultMessage:"You cannot delete a managed repository."});return Object(g.jsx)(S.EuiToolTip,{content:a},Object(g.jsx)(S.EuiButtonIcon,{"aria-label":n.translate("xpack.snapshotRestore.repositoryList.table.actionRemoveAriaLabel",{defaultMessage:"Remove repository `{name}`",values:{name:e}}),iconType:"trash",color:"danger","data-test-subj":"deleteRepositoryButton",onClick:()=>s([e],o),isDisabled:Boolean(e===t)}))}))}],width:"100px"}],x={onSelectionChange:e=>d(e),selectable:({name:e})=>Boolean(e!==t),selectableMessage:e=>e?"":n.translate("xpack.snapshotRestore.repositoryList.table.deleteManagedRepositoryTooltip",{defaultMessage:"You cannot delete a managed repository."})},b={toolsLeft:p.length?Object(g.jsx)(A,null,(e=>Object(g.jsx)(S.EuiButton,{onClick:()=>e(p.map((e=>e.name)),o),color:"danger","data-test-subj":"srRepositoryListBulkDeleteActionButton"},1===p.length?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.table.deleteSingleRepositoryButton",defaultMessage:"Remove repository"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.table.deleteMultipleRepositoriesButton",defaultMessage:"Remove repositories"})))):void 0,toolsRight:[Object(g.jsx)(S.EuiButton,{key:"reloadButton",color:"success",iconType:"refresh",onClick:s,"data-test-subj":"reloadButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.table.reloadRepositoriesButton",defaultMessage:"Reload"})),Object(g.jsx)(S.EuiButton,u()({key:"registerRepo"},Object(F.reactRouterNavigate)(c,Object(i.d)(name)),{fill:!0,iconType:"plusInCircle","data-test-subj":"registerRepositoryButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.addRepositoryButtonLabel",defaultMessage:"Register repository"}))],box:{incremental:!0,schema:!0},filters:[{type:"field_value_selection",field:"type",name:n.translate("xpack.snapshotRestore.repositoryList.table.typeFilterLabel",{defaultMessage:"Type"}),multiSelect:!1,options:Object.keys(e.reduce(((e,t)=>(e[t.type]=!0,e)),{})).map((e=>({value:e,view:_.a.getRepositoryTypeName(e)})))}]};return Object(g.jsx)(S.EuiInMemoryTable,{items:e,itemId:"name",columns:j,search:b,sorting:{sort:{field:"name",direction:"asc"}},selection:x,pagination:{initialPageSize:20,pageSizeOptions:[10,20,50]},isSelectable:!0,rowProps:()=>({"data-test-subj":"row"}),cellProps:(e,t)=>({"data-test-subj":`${t.name}_cell`}),"data-test-subj":"repositoryTable"})},Ot=({history:e})=>{const{repositoryName:t}=rt(),{error:s,isLoading:a,data:{repositories:l,managedRepository:c}={repositories:void 0,managedRepository:{name:void 0}},resendRequest:p}=Object(o.r)(),{uiMetricService:d}=C(),{core:j}=D(),x=()=>{e.push(`${ee.a}/repositories`)},b=e=>{t&&e.includes(t)&&x(),e.length&&p()};let m;return Object(r.useEffect)((()=>{d.trackUiMetric(ee.x)}),[d]),Object(v.l)(j.executionContext,{type:"application",page:"snapshotRestoreRepositoryTab"}),m=a?Object(g.jsx)(v.f,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.loadingRepositoriesDescription",defaultMessage:"Loading repositories…"})):s?Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.LoadingRepositoriesErrorMessage",defaultMessage:"Error loading repositories"}),error:s}):l&&0===l.length?Object(g.jsx)(S.EuiPageContent_Deprecated,{hasShadow:!1,paddingSize:"none",verticalPosition:"center",horizontalPosition:"center"},Object(g.jsx)(S.EuiEmptyPrompt,{iconType:"managementApp",title:Object(g.jsx)("h1",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.emptyPromptTitle",defaultMessage:"Register your first repository"})),body:Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryList.emptyPromptDescription",defaultMessage:"Create a place where your snapshots will live."}))),actions:Object(g.jsx)(S.EuiButton,u()({},Object(F.reactRouterNavigate)(e,Object(i.d)()),{fill:!0,iconType:"plusInCircle","data-test-subj":"registerRepositoryButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addRepositoryButtonLabel",defaultMessage:"Register a repository"})),"data-test-subj":"emptyPrompt"})):Object(g.jsx)("section",{"data-test-subj":"repositoryList"},Object(g.jsx)(ht,{repositories:l||[],managedRepository:null==c?void 0:c.name,reload:p,openRepositoryDetailsUrl:e=>Object(i.k)(e),onRepositoryDeleted:b})),Object(g.jsx)(n.a.Fragment,null,t?Object(g.jsx)(mt,{repositoryName:t,onClose:x,onRepositoryDeleted:b}):null,m)};var yt=s(38);const ft=({state:e})=>{const{i18n:t}=C(),s={[ee.h.IN_PROGRESS]:{icon:Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"}),label:t.translate("xpack.snapshotRestore.snapshotState.inProgressLabel",{defaultMessage:"Taking snapshot…"})},[ee.h.SUCCESS]:{icon:Object(g.jsx)(S.EuiIcon,{color:"success",type:"check"}),label:t.translate("xpack.snapshotRestore.snapshotState.completeLabel",{defaultMessage:"Snapshot complete"})},[ee.h.FAILED]:{icon:Object(g.jsx)(S.EuiIcon,{color:"danger",type:"cross"}),label:t.translate("xpack.snapshotRestore.snapshotState.failedLabel",{defaultMessage:"Snapshot failed"})},[ee.h.PARTIAL]:{icon:Object(g.jsx)(S.EuiIcon,{color:"warning",type:"warning"}),label:t.translate("xpack.snapshotRestore.snapshotState.partialLabel",{defaultMessage:"Partial failure"}),tip:t.translate("xpack.snapshotRestore.snapshotState.partialTipDescription",{defaultMessage:"Global cluster state was stored, but at least one shard wasn't stored successfully. See the 'Failed indices' tab."})},[ee.h.INCOMPATIBLE]:{icon:Object(g.jsx)(S.EuiIcon,{color:"warning",type:"warning"}),label:t.translate("xpack.snapshotRestore.snapshotState.incompatibleLabel",{defaultMessage:"Incompatible version"}),tip:t.translate("xpack.snapshotRestore.snapshotState.incompatibleTipDescription",{defaultMessage:"Snapshot was created with a version of Elasticsearch incompatible with the cluster's version."})}};if(!s[e])return e;const{icon:a,label:o,tip:i}=s[e],n=i&&Object(g.jsx)(r.Fragment,null," ",Object(g.jsx)(S.EuiIconTip,{content:i}));return Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"xs",alignItems:"center",responsive:!1},Object(g.jsx)(S.EuiFlexItem,{grow:!1},a),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)("div",null,o,n)))},Mt=({snapshotDetails:e})=>{const{versionId:t,version:s,includeGlobalState:a,featureStates:o,dataStreams:r,indices:n,state:l,startTimeInMillis:c,endTimeInMillis:u,durationInMillis:p,uuid:d,policyName:j}=e,{history:x}=C();return Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"version"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemVersionLabel",defaultMessage:"Version / Version ID"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},s," / ",t)),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"uuid"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemUuidLabel",defaultMessage:"UUID"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},d))),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"state"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemStateLabel",defaultMessage:"State"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(ft,{state:l}))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"duration"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemDurationLabel",defaultMessage:"Duration"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},l===ee.h.IN_PROGRESS?Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"}):Object(g.jsx)(P,{data:p},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemDurationValueLabel","data-test-subj":"srSnapshotDetailsDurationValue",defaultMessage:"{seconds} {seconds, plural, one {second} other {seconds}}",values:{seconds:Math.ceil(p/1e3)}}))))),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"includeGlobalState"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemIncludeGlobalStateLabel",defaultMessage:"Includes global state"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},!1===a?Object(g.jsx)(R.FormattedMessage,{"data-test-subj":"withoutGlobalState",id:"xpack.snapshotRestore.snapshotDetails.itemIncludeGlobalStateNoLabel",defaultMessage:"No"}):Object(g.jsx)(R.FormattedMessage,{"data-test-subj":"withGlobalState",id:"xpack.snapshotRestore.snapshotDetails.itemIncludeGlobalStateYesLabel",defaultMessage:"Yes"}))),Object(g.jsx)(Ae,{featureStates:o})),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"indices"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemIndicesLabel",defaultMessage:"Indices ({indicesCount})",values:{indicesCount:n.length}})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(we,{indices:n})))),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"dataStreams"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemDataStreamsLabel",defaultMessage:"Data streams ({dataStreamsCount})",values:{dataStreamsCount:r.length}})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(Be,{dataStreams:r})))),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"startTime"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemStartTimeLabel",defaultMessage:"Start time"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(P,{data:c},Object(g.jsx)(z,{epochMs:c})))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"endTime"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.itemEndTimeLabel",defaultMessage:"End time"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},l===ee.h.IN_PROGRESS?Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"}):Object(g.jsx)(P,{data:u},Object(g.jsx)(z,{epochMs:u}))))),Object(g.jsx)(S.EuiFlexGroup,null,j?Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"policy"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.createdByLabel",defaultMessage:"Created by"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(S.EuiLink,Object(F.reactRouterNavigate)(x,Object(i.i)(j)),j))):null))},Ft=({indexFailures:e,snapshotState:t})=>e.length?e.map(((t,s)=>{const{index:a,failures:o}=t;return Object(g.jsx)("div",{key:a,"data-test-subj":"indexFailure"},Object(g.jsx)(S.EuiTitle,{size:"xs","data-test-subj":"index"},Object(g.jsx)("h3",null,a)),Object(g.jsx)(S.EuiSpacer,{size:"s"}),o.map(((e,t)=>{const{status:s,reason:a,shard_id:i}=e;return Object(g.jsx)("div",{key:`${i}${a}`,"data-test-subj":"failure"},Object(g.jsx)(S.EuiText,{size:"xs","data-test-subj":"shard"},Object(g.jsx)("p",null,Object(g.jsx)("strong",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.failureShardTitle",defaultMessage:"Shard {shardId}",values:{shardId:i}})))),Object(g.jsx)(S.EuiCodeBlock,{paddingSize:"s","data-test-subj":"reason",language:"text"},`${s}: ${a}`),t{const{i18n:n,uiMetricService:l,history:c}=C(),{error:p,data:d}=Object(o.w)(e,t),[j,x]=Object(r.useState)(St);let b,m;if(Object(r.useEffect)((()=>{x(St)}),[e,t]),d){const{indexFailures:e,state:t}=d,s=[{id:St,name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.summaryTabTitle",defaultMessage:"Summary"})},{id:Rt,name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.failuresTabTitle",defaultMessage:"Failed indices ({failuresCount})",values:{failuresCount:e.length}})}];b=Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiTabs,null,s.map((e=>Object(g.jsx)(S.EuiTab,{onClick:()=>{l.trackUiMetric(Et[e.id]),x(e.id)},isSelected:e.id===j,key:e.id,"data-test-subj":"tab"},e.name))))),j===St?m=Object(g.jsx)(Mt,{snapshotDetails:d}):j===Rt&&(m=Object(g.jsx)(Ft,{snapshotState:t,indexFailures:e}))}else if(p){const s=404===p.status?{data:{error:n.translate("xpack.snapshotRestore.snapshotDetails.errorSnapshotNotFound",{defaultMessage:"Either the snapshot '{snapshotId}' doesn't exist in the repository '{repositoryName}' or the repository doesn't exist.",values:{snapshotId:t,repositoryName:e}})}}:p;m=Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.errorLoadingRepositoryTitle",defaultMessage:"Error loading repository"}),error:s})}else m=Object(g.jsx)(ye,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.loadingSnapshotDescription",defaultMessage:"Loading snapshot…"}));return Object(g.jsx)(S.EuiFlyout,{onClose:s,"data-test-subj":"snapshotDetail","aria-labelledby":"srSnapshotDetailsFlyoutTitle",size:"m",maxWidth:550},Object(g.jsx)(S.EuiFlyoutHeader,null,Object(g.jsx)(S.EuiText,null,Object(g.jsx)("h2",{id:"srSnapshotDetailsFlyoutTitle","data-test-subj":"detailTitle"},t),Object(g.jsx)("p",null,Object(g.jsx)("small",null,Object(g.jsx)(S.EuiLink,u()({},Object(F.reactRouterNavigate)(c,Object(i.k)(e)),{"data-test-subj":"repositoryLink"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.repositoryTitle",defaultMessage:"'{repositoryName}' repository",values:{repositoryName:e}}))))),b),Object(g.jsx)(S.EuiFlyoutBody,{"data-test-subj":"content"},m),Object(g.jsx)(S.EuiFlyoutFooter,null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{iconType:"cross",flush:"left",onClick:s,"data-test-subj":"closeButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.closeButtonLabel",defaultMessage:"Close"}))),d?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiFlexGroup,{alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(Me,null,(s=>Object(g.jsx)(S.EuiButtonEmpty,{color:"danger","data-test-subj":"srSnapshotDetailsDeleteActionButton",onClick:()=>s([{repository:e,snapshot:t}],a),isDisabled:d.managedRepository&&d.isLastSuccessfulSnapshot,title:d.managedRepository&&d.isLastSuccessfulSnapshot?n.translate("xpack.snapshotRestore.snapshotDetails.deleteManagedRepositorySnapshotButtonTitle",{defaultMessage:"You cannot delete the last successful snapshot stored in a managed repository."}):void 0},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.deleteButtonLabel",defaultMessage:"Delete"}))))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButton,u()({},Object(F.reactRouterNavigate)(c,Object(i.l)(e,t)),{fill:!0,color:"primary",isDisabled:d.state!==ee.h.SUCCESS&&d.state!==ee.h.PARTIAL}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotDetails.restoreButtonLabel",defaultMessage:"Restore"}))))):null)))};var vt=s(46),Lt=s.n(vt);const Tt=a.i18n.translate("xpack.snapshotRestore.snapshotList.searchBar.onlyOneClauseMessage",{defaultMessage:"You can only use one clause in the search bar"}),Dt={strict:!0,fields:{snapshot:{type:"string"},repository:{type:"string"},policyName:{type:"string"}}},Ct=({listParams:e,setListParams:t,reload:s,selectedItems:o,onSnapshotDeleted:i,repositories:l})=>{const[c,u]=Object(r.useState)(e);Lt()((()=>{t(c)}),200,[c]);const p=o.length?Object(g.jsx)(Me,null,(e=>Object(g.jsx)(S.EuiButton,{onClick:()=>e(o.map((({snapshot:e,repository:t})=>({snapshot:e,repository:t}))),i),color:"danger","data-test-subj":"srSnapshotListBulkDeleteActionButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.table.deleteSnapshotButton",defaultMessage:"Delete {count, plural, one {snapshot} other {snapshots}}",values:{count:o.length}})))):[],d=[{type:"field_value_selection",field:"repository",name:a.i18n.translate("xpack.snapshotRestore.snapshotList.table.repositoryFilterLabel",{defaultMessage:"Repository"}),operator:"exact",multiSelect:!1,options:l.map((e=>({value:e,view:e})))}],j=Object(g.jsx)(S.EuiButton,{color:"success",iconType:"refresh",onClick:s,"data-test-subj":"reloadButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.table.reloadSnapshotsButton",defaultMessage:"Reload"})),[x,b]=Object(r.useState)(((e,t)=>{const{searchField:s,searchValue:a}=e;return s&&a?S.Query.parse(`${s}=${a}`,{schema:t}):S.Query.MATCH_ALL})(e,Dt)),[m,h]=Object(r.useState)(null);return Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSearchBar,{filters:d,query:x,onChange:t=>{const{query:s,error:a}=t;a?h(a):s&&(h(null),b(s),s.ast.clauses.length>1?h({name:Tt,message:Tt}):u(((e,t)=>{if(!t)return lt(e);const s=t.ast.clauses[0];return s?"term"===s.type?{...e,searchField:"snapshot",searchValue:String(s.value),searchMatch:s.match,searchOperator:"eq"}:"field"===s.type?{...e,searchField:s.field,searchValue:String(s.value),searchMatch:s.match,searchOperator:s.operator}:lt(e):lt(e)})(e,s)))},toolsLeft:p,toolsRight:j,box:{schema:Dt,incremental:!0,"data-test-subj":"snapshotListSearch"}}),Object(g.jsx)(S.EuiSpacer,null),m?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{"data-test-subj":"snapshotListSearchError",iconType:"warning",color:"danger",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.searchBar.invalidSearchMessage",defaultMessage:"Invalid search: {errorMessage}",values:{errorMessage:m.message}})}),Object(g.jsx)(S.EuiSpacer,null)):null)},It=e=>{const{snapshots:t,repositories:s,reload:a,onSnapshotDeleted:o,listParams:l,setListParams:c,totalItemCount:p,isLoading:d}=e,{i18n:j,uiMetricService:x,history:b}=C(),[m,h]=Object(r.useState)([]),O=(e=>e.filter((({state:e,repository:t,managedRepository:s})=>t===s&&"SUCCESS"===e)).sort(((e,t)=>+new Date(t.endTime)-+new Date(e.endTime)))[0])(t),y=[{field:"snapshot",name:j.translate("xpack.snapshotRestore.snapshotList.table.snapshotColumnTitle",{defaultMessage:"Snapshot"}),truncateText:!1,sortable:!0,render:(e,t)=>Object(g.jsx)(S.EuiLink,u()({},Object(v.i)(b,Object(i.n)(t.repository,e),(()=>x.trackUiMetric(ee.K))),{"data-test-subj":"snapshotLink"}),e)},{field:"repository",name:j.translate("xpack.snapshotRestore.snapshotList.table.repositoryColumnTitle",{defaultMessage:"Repository"}),truncateText:!1,sortable:!0,render:e=>Object(g.jsx)(S.EuiLink,u()({},Object(v.i)(b,Object(i.k)(e)),{"data-test-subj":"repositoryLink"}),e)},{field:"indices",name:j.translate("xpack.snapshotRestore.snapshotList.table.indicesColumnTitle",{defaultMessage:"Indices"}),truncateText:!0,sortable:!0,width:"100px",render:e=>e.length},{field:"shards.total",name:j.translate("xpack.snapshotRestore.snapshotList.table.shardsColumnTitle",{defaultMessage:"Shards"}),truncateText:!0,sortable:!0,width:"100px",render:e=>e},{field:"shards.failed",name:j.translate("xpack.snapshotRestore.snapshotList.table.failedShardsColumnTitle",{defaultMessage:"Failed shards"}),truncateText:!0,sortable:!0,width:"100px",render:e=>e},{field:"startTimeInMillis",name:j.translate("xpack.snapshotRestore.snapshotList.table.startTimeColumnTitle",{defaultMessage:"Date created"}),truncateText:!1,sortable:!0,render:e=>Object(g.jsx)(P,{data:e},Object(g.jsx)(z,{epochMs:e}))},{field:"durationInMillis",name:j.translate("xpack.snapshotRestore.snapshotList.table.durationColumnTitle",{defaultMessage:"Duration"}),truncateText:!0,sortable:!0,width:"100px",render:(e,{state:t})=>t===ee.h.IN_PROGRESS?Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"}):Object(g.jsx)(P,{data:e},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.table.durationColumnValueLabel",defaultMessage:"{seconds}s",values:{seconds:Math.ceil(e/1e3)}}))},{name:j.translate("xpack.snapshotRestore.snapshotList.table.actionsColumnTitle",{defaultMessage:"Actions"}),actions:[{render:({snapshot:e,repository:t,state:s})=>{const a=s===ee.h.SUCCESS||s===ee.h.PARTIAL,o=a?j.translate("xpack.snapshotRestore.snapshotList.table.actionRestoreTooltip",{defaultMessage:"Restore"}):s===ee.h.IN_PROGRESS?j.translate("xpack.snapshotRestore.snapshotList.table.actionRestoreDisabledInProgressTooltip",{defaultMessage:"Can't restore in-progress snapshot"}):j.translate("xpack.snapshotRestore.snapshotList.table.actionRestoreDisabledInvalidTooltip",{defaultMessage:"Can't restore invalid snapshot"});return Object(g.jsx)(S.EuiToolTip,{content:o},Object(g.jsx)(S.EuiButtonIcon,u()({"aria-label":j.translate("xpack.snapshotRestore.snapshotList.table.actionRestoreAriaLabel",{defaultMessage:"Store snapshot `{name}`",values:{name:e}}),iconType:"importAction",color:"primary","data-test-subj":"srsnapshotListRestoreActionButton"},Object(v.i)(b,Object(i.l)(t,e)),{isDisabled:!a})))}},{render:({snapshot:e,repository:t})=>Object(g.jsx)(Me,null,(s=>{const a=!!Boolean(O)&&e===O.snapshot,i=a?j.translate("xpack.snapshotRestore.snapshotList.table.deleteManagedRepositorySnapshotTooltip",{defaultMessage:"You must store the last successful snapshot in a managed repository."}):j.translate("xpack.snapshotRestore.snapshotList.table.actionDeleteTooltip",{defaultMessage:"Delete"});return Object(g.jsx)(S.EuiToolTip,{content:i},Object(g.jsx)(S.EuiButtonIcon,{"aria-label":j.translate("xpack.snapshotRestore.snapshotList.table.actionDeleteAriaLabel",{defaultMessage:"Delete snapshot '{name}'",values:{name:e}}),iconType:"trash",color:"danger","data-test-subj":"srsnapshotListDeleteActionButton",onClick:()=>s([{snapshot:e,repository:t}],o),isDisabled:a}))}))}],width:"100px"}],f={sort:{field:l.sortField,direction:l.sortDirection}},M={pageIndex:l.pageIndex,pageSize:l.pageSize,totalItemCount:p,pageSizeOptions:[10,20,50]},F={onSelectionChange:e=>h(e),selectable:({snapshot:e})=>!Boolean(O)||e!==O.snapshot,selectableMessage:e=>e?"":j.translate("xpack.snapshotRestore.snapshotList.table.deleteManagedRepositorySnapshotDescription",{defaultMessage:"You must retain the last successful snapshot in a managed repository."})};return Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(Ct,{listParams:l,setListParams:c,reload:a,selectedItems:m,onSnapshotDeleted:o,repositories:s}),Object(g.jsx)(S.EuiBasicTable,{items:t,itemId:"uuid",columns:y,sorting:f,onChange:e=>{var t,s;const{page:{index:a,size:o}={},sort:{field:i,direction:r}={}}=e;c({...l,sortField:null!==(t=i)&&void 0!==t?t:l.sortField,sortDirection:null!==(s=r)&&void 0!==s?s:l.sortDirection,pageIndex:null!=a?a:l.pageIndex,pageSize:null!=o?o:l.pageSize})},loading:d,isSelectable:!0,selection:F,pagination:M,rowProps:()=>({"data-test-subj":"row"}),cellProps:()=>({"data-test-subj":"cell"}),"data-test-subj":"snapshotTable"}))},wt=()=>{const e=Object(p.useHistory)();return Object(g.jsx)(S.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"danger"},Object(g.jsx)(S.EuiEmptyPrompt,{iconType:"managementApp","data-test-subj":"repositoryErrorsPrompt",title:Object(g.jsx)("h1",{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.errorRepositoriesTitle",defaultMessage:"Some repositories contain errors"})),body:Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.repositoryWarningDescription",defaultMessage:"Go to {repositoryLink} to fix the errors.",values:{repositoryLink:Object(g.jsx)(S.EuiLink,Object(v.i)(e,Object(i.j)()),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryWarningLinkText",defaultMessage:"Repositories"}))}}))}))},Bt=()=>{const e=Object(p.useHistory)();return Object(g.jsx)(S.EuiPageContent_Deprecated,{hasShadow:!1,paddingSize:"none",verticalPosition:"center",horizontalPosition:"center","data-test-subj":"snapshotListEmpty"},Object(g.jsx)(S.EuiEmptyPrompt,{iconType:"managementApp",title:Object(g.jsx)("h1",{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.noRepositoriesTitle",defaultMessage:"Start by registering a repository"})),body:Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.noRepositoriesDescription",defaultMessage:"You need a place where your snapshots will live."})),Object(g.jsx)("p",null,Object(g.jsx)(S.EuiButton,u()({},Object(v.i)(e,Object(i.d)()),{fill:!0,iconType:"plusInCircle","data-test-subj":"registerRepositoryButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.noRepositoriesAddButtonLabel",defaultMessage:"Register a repository"})))),"data-test-subj":"emptyPrompt"}))},Pt=({policiesCount:e})=>{const{docLinks:t}=I(),s=Object(p.useHistory)();return Object(g.jsx)(S.EuiPageContent_Deprecated,{hasShadow:!1,paddingSize:"none",verticalPosition:"center",horizontalPosition:"center"},Object(g.jsx)(S.EuiEmptyPrompt,{iconType:"managementApp",title:Object(g.jsx)("h1",{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.noSnapshotsTitle",defaultMessage:"You don't have any snapshots yet"})),body:Object(g.jsx)(v.h,{privileges:k.d.map((e=>`cluster.${e}`))},(({hasPrivileges:a})=>a?Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.usePolicyDescription",defaultMessage:"Run a Snapshot Lifecycle Policy to create a snapshot. You can also create a snapshot using {docLink}.",values:{docLink:Object(g.jsx)(S.EuiLink,{href:t.links.snapshotRestore.createSnapshot,target:"_blank","data-test-subj":"documentationLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.emptyPrompt.usePolicyDocLinkText",defaultMessage:"the Elasticsearch API"}))}})),Object(g.jsx)("p",null,0===e?Object(g.jsx)(S.EuiButton,u()({},Object(v.i)(s,Object(i.c)()),{fill:!0,iconType:"plusInCircle","data-test-subj":"addPolicyButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.addPolicyText",defaultMessage:"Create a policy"})):Object(g.jsx)(S.EuiButton,u()({},Object(v.i)(s,Object(i.h)()),{fill:!0,iconType:"list","data-test-subj":"goToPoliciesButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.goToPoliciesText",defaultMessage:"View policies"})))):Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.emptyPrompt.noSnapshotsDescription",defaultMessage:"Create a snapshot using the Elasticsearch API."})),Object(g.jsx)("p",null,Object(g.jsx)(S.EuiLink,{href:t.links.snapshotRestore.createSnapshot,target:"_blank","data-test-subj":"documentationLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.emptyPrompt.noSnapshotsDocLinkText",defaultMessage:"Learn how to create a snapshot"})," ",Object(g.jsx)(S.EuiIcon,{type:"link"})))))),"data-test-subj":"emptyPrompt"}))},zt=({location:{search:e},history:t})=>{const{repositoryName:s,snapshotId:a}=rt(),[l,c]=Object(r.useState)(nt),{error:u,isInitialRequest:p,isLoading:d,data:{snapshots:j=[],repositories:x=[],policies:b=[],errors:m={},total:h},resendRequest:O}=Object(o.x)(l),{uiMetricService:y}=C(),{core:f}=D(),M=()=>{t.push(`${ee.a}/snapshots`)},F=e=>{s&&a&&e.find((({snapshot:e,repository:t})=>e===a&&t===s))&&M(),e.length&&O()};let E;if(Object(v.l)(f.executionContext,{type:"application",page:"snapshotRestoreSnapshotTab"}),Object(r.useEffect)((()=>{if(e){const s=Object(yt.parse)(e.replace(/^\?/,""),{sort:!1}),{repository:a,policy:o}=s;o?(c((e=>({...e,searchField:"policyName",searchValue:String(o),searchMatch:"must",searchOperator:"exact"}))),t.replace(`${ee.a}/snapshots`)):a&&(c((e=>({...e,searchField:"repository",searchValue:String(a),searchMatch:"must",searchOperator:"exact"}))),t.replace(`${ee.a}/snapshots`))}}),[l,t,e]),Object(r.useEffect)((()=>{y.trackUiMetric(ee.J)}),[y]),p&&d)E=Object(g.jsx)(v.f,null,Object(g.jsx)("span",{"data-test-subj":"snapshotListEmpty"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.loadingSnapshotsDescription",defaultMessage:"Loading snapshots…"})));else if(u)E=Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.snapshotList.loadingSnapshotsErrorMessage",defaultMessage:"Error loading snapshots"}),error:u});else if(Object.keys(m).length&&0===x.length)E=Object(g.jsx)(wt,null);else if(0===x.length)E=Object(g.jsx)(Bt,null);else if(0!==h||l.searchField||d){const e=Object.keys(m).length?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryWarningTitle",defaultMessage:"Some repositories contain errors"}),color:"warning",iconType:"warning","data-test-subj":"repositoryErrorsWarning"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryWarningDescription",defaultMessage:"Snapshots might load slowly. Go to {repositoryLink} to fix the errors.",values:{repositoryLink:Object(g.jsx)(S.EuiLink,Object(v.i)(t,Object(i.j)()),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.repositoryWarningLinkText",defaultMessage:"Repositories"}))}})),Object(g.jsx)(S.EuiSpacer,null)):null;E=Object(g.jsx)("section",{"data-test-subj":"snapshotList"},e,Object(g.jsx)(It,{snapshots:j,repositories:x,reload:O,onSnapshotDeleted:F,listParams:l,setListParams:c,totalItemCount:h,isLoading:d}))}else E=Object(g.jsx)(Pt,{policiesCount:b.length});return Object(g.jsx)(n.a.Fragment,null,s&&a?Object(g.jsx)(kt,{repositoryName:s,snapshotId:a,onClose:M,onSnapshotDeleted:F}):null,E)};var At=s(36);const Nt=({shards:e})=>{const{i18n:t}=C(),s=({total:e,restored:s,percent:a})=>Object(g.jsx)(S.EuiToolTip,{position:"top",content:t.translate("xpack.snapshotRestore.restoreList.shardTable.progressTooltipLabel",{defaultMessage:"{restored} of {total} restored",values:{restored:s,total:e}})},Object(g.jsx)(S.EuiText,{size:"xs",textAlign:"center",style:{width:"100%"}},Object(g.jsx)(S.EuiProgress,{value:0===e?1:s,max:0===e?1:e,size:"xs"}),Object(g.jsx)(S.EuiSpacer,{size:"xs"}),a)),a=[{field:"id",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.indexColumnTitle",{defaultMessage:"ID"}),width:"40px",render:(e,t)=>t.primary?Object(g.jsx)(S.EuiFlexGroup,{alignItems:"center",gutterSize:"xs"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},e),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiToolTip,{position:"right",content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.shardTable.primaryTooltipLabel",defaultMessage:"Primary"})},Object(g.jsx)("strong",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.shardTable.primaryAbbreviationText",defaultMessage:"P",description:"Used as an abbreviation for 'Primary', as in 'Primary shard'"}))))):e},{field:"stage",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.stageColumnTitle",{defaultMessage:"Stage"})},{field:"startTimeInMillis",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.startTimeColumnTitle",{defaultMessage:"Start time"}),render:e=>e?Object(g.jsx)(z,{epochMs:e}):Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"})},{field:"stopTimeInMillis",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.endTimeColumnTitle",{defaultMessage:"End time"}),render:e=>e?Object(g.jsx)(z,{epochMs:e}):Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"})},{field:"totalTimeInMillis",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.durationColumnTitle",{defaultMessage:"Duration"}),render:e=>e?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.shardTable.durationValue",defaultMessage:"{seconds} {seconds, plural, one {second} other {seconds}}",values:{seconds:Math.ceil(e/1e3)}}):Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"})},{field:"repository",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.repositoryColumnTitle",{defaultMessage:"Repository"})},{field:"snapshot",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.snapshotColumnTitle",{defaultMessage:"Snapshot"})},{field:"version",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.versionColumnTitle",{defaultMessage:"Version"})},{field:"targetHost",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.targetHostColumnTitle",{defaultMessage:"Target host"})},{field:"targetNode",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.targetNodeColumnTitle",{defaultMessage:"Target node"})},{field:"bytesTotal",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.bytesColumnTitle",{defaultMessage:"Bytes"}),render:(e,{bytesRecovered:t,bytesPercent:a})=>Object(g.jsx)(s,{total:e,restored:t,percent:a})},{field:"filesTotal",name:t.translate("xpack.snapshotRestore.restoreList.shardTable.filesColumnTitle",{defaultMessage:"Files"}),render:(e,{filesRecovered:t,filesPercent:a})=>Object(g.jsx)(s,{total:e,restored:t,percent:a})}];return Object(g.jsx)(S.EuiBasicTable,{className:"snapshotRestore__shardsTable",compressed:!0,items:e,columns:a})},Wt=n.a.memo((({restores:e})=>{const{i18n:t,uiMetricService:s}=C(),[a,o]=Object(r.useState)({page:{},sort:{}}),[i,n]=Object(r.useState)({}),l=()=>{const{index:t,size:s}=a.page;return{pageIndex:null!=t?t:0,pageSize:null!=s?s:20,totalItemCount:e.length,pageSizeOptions:[10,20,50]}},c=()=>{const{field:e,direction:t}=a.sort;return{sort:{field:null!=e?e:"isComplete",direction:null!=t?t:"asc"}}},u=e=>{const{index:t}=e,a=!Boolean(p[t]);!0===a&&s.trackUiMetric(ee.B),n({...p,[t]:a})},p=Object(r.useMemo)((()=>e.reduce(((e,t)=>{const{index:s,shards:a}=t;return i[s]&&(e[s]=Object(g.jsx)(Nt,{shards:a})),e}),{})),[i,e]),d=[{field:"index",name:t.translate("xpack.snapshotRestore.restoreList.table.indexColumnTitle",{defaultMessage:"Index"}),truncateText:!0,sortable:!0},{field:"isComplete",name:t.translate("xpack.snapshotRestore.restoreList.table.statusColumnTitle",{defaultMessage:"Status"}),truncateText:!0,sortable:!0,render:e=>e?Object(g.jsx)(S.EuiHealth,{color:"success"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.table.statusColumn.completeLabel",defaultMessage:"Complete"})):Object(g.jsx)(S.EuiHealth,{color:"warning"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.table.statusColumn.inProgressLabel",defaultMessage:"In progress"}))},{field:"latestActivityTimeInMillis",name:t.translate("xpack.snapshotRestore.restoreList.table.lastActivityTitle",{defaultMessage:"Last activity"}),truncateText:!0,render:(e,{isComplete:t})=>t?Object(g.jsx)(z,{epochMs:e}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.table.lastActivityColumn.nowLabel",defaultMessage:"now"})},{field:"shards",name:t.translate("xpack.snapshotRestore.restoreList.table.shardsCompletedTitle",{defaultMessage:"Shards completed"}),truncateText:!0,render:e=>e.filter((e=>Boolean(e.stopTimeInMillis))).length},{field:"shards",name:t.translate("xpack.snapshotRestore.restoreList.table.shardsInProgressTitle",{defaultMessage:"Shards in progress"}),truncateText:!0,render:e=>e.filter((e=>!Boolean(e.stopTimeInMillis))).length},{align:At.RIGHT_ALIGNMENT,width:"40px",isExpander:!0,render:e=>Object(g.jsx)(S.EuiButtonIcon,{onClick:()=>u(e),"aria-label":p[e.index]?"Collapse":"Expand",iconType:p[e.index]?"arrowUp":"arrowDown"})}];return Object(g.jsx)(S.EuiBasicTable,{items:(()=>{const t=[...e],{sort:{field:s,direction:a}}=c(),{pageIndex:o,pageSize:i}=l();return Object(f.orderBy)(t,[s],[a]).slice(o*i,(o+1)*i)})(),itemId:"index",itemIdToExpandedRowMap:p,isExpandable:!0,columns:d,sorting:c(),pagination:l(),onChange:({page:e={},sort:t={}})=>{o({page:e,sort:t})},rowProps:e=>({"data-test-subj":"row",onClick:()=>u(e)}),cellProps:()=>({"data-test-subj":"cell"}),"data-test-subj":"restoresTable"})})),Gt=6e4,Vt=[1e4,3e4,Gt,3e5],Ut=()=>{const[e,t]=Object(r.useState)(!1),[s,a]=Object(r.useState)(Vt[1]),{error:n,isLoading:l,data:c=[],isInitialRequest:u,resendRequest:p}=Object(o.u)(s),{uiMetricService:d,history:j}=C(),{core:x}=D();let b;return Object(r.useEffect)((()=>{d.trackUiMetric(ee.C)}),[d]),Object(v.l)(x.executionContext,{type:"application",page:"snapshotRestoreRestoreTab"}),u?l?b=Object(g.jsx)(v.f,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.loadingRestoresDescription",defaultMessage:"Loading restores…"})):n&&(b=Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.loadingRestoresErrorMessage",defaultMessage:"Error loading restores"}),error:n})):b=c&&0===c.length?Object(g.jsx)(S.EuiPageContent_Deprecated,{hasShadow:!1,paddingSize:"none",verticalPosition:"center",horizontalPosition:"center"},Object(g.jsx)(S.EuiEmptyPrompt,{iconType:"managementApp",title:Object(g.jsx)("h1",{"data-test-subj":"noRestoredSnapshotsHeader"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.emptyPromptTitle",defaultMessage:"No restored snapshots"})),body:Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.emptyPromptDescription",defaultMessage:"Go to {snapshotsLink} to start a restore.",values:{snapshotsLink:Object(g.jsx)(S.EuiLink,Object(F.reactRouterNavigate)(j,Object(i.o)()),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.emptyPromptDescriptionLink",defaultMessage:"Snapshots"}))}}))),"data-test-subj":"emptyPrompt"})):Object(g.jsx)("section",{"data-test-subj":"restoreList"},Object(g.jsx)(S.EuiFlexGroup,{alignItems:"center",justifyContent:"flexStart",gutterSize:"s"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiPopover,{id:"srRestoreListIntervalMenu",button:Object(g.jsx)(S.EuiButtonEmpty,{size:"xs",iconType:"arrowDown",iconSide:"right",onClick:()=>t(!e)},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.intervalMenuButtonText",defaultMessage:"Refresh data every {interval}",values:{interval:s>=Gt?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.intervalMenu.minutesIntervalValue",defaultMessage:"{minutes} {minutes, plural, one {minute} other {minutes}}",values:{minutes:Math.ceil(s/Gt)}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.intervalMenu.secondsIntervalValue",defaultMessage:"{seconds} {seconds, plural, one {second} other {seconds}}",values:{seconds:Math.ceil(s/1e3)}})}})),isOpen:e,closePopover:()=>t(!1),panelPaddingSize:"none",anchorPosition:"downLeft"},Object(g.jsx)(S.EuiContextMenuPanel,{items:Vt.map((e=>Object(g.jsx)(S.EuiContextMenuItem,{key:e,icon:"empty",onClick:()=>{p(),a(e),t(!1)}},e>=Gt?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.intervalMenu.minutesIntervalValue",defaultMessage:"{minutes} {minutes, plural, one {minute} other {minutes}}",values:{minutes:Math.ceil(e/Gt)}}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.intervalMenu.secondsIntervalValue",defaultMessage:"{seconds} {seconds, plural, one {second} other {seconds}}",values:{seconds:Math.ceil(e/1e3)}}))))}))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},l?Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"}):null)),Object(g.jsx)(S.EuiSpacer,{size:"m"}),Object(g.jsx)(Wt,{restores:c})),Object(g.jsx)(v.h,{privileges:k.c.map((e=>`index.${e}`))},(({hasPrivileges:e,privilegesMissing:t})=>e?b:Object(g.jsx)(v.d,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.deniedPrivilegeTitle",defaultMessage:"You're missing index privileges"}),message:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreList.deniedPrivilegeDescription",defaultMessage:"To view snapshot restore status, you must have {privilegesCount, plural, one {this index privilege} other {these index privileges}} for one or more indices: {missingPrivileges}.",values:{missingPrivileges:t.index.join(", "),privilegesCount:t.index.length}})})))},_t=({policy:e})=>{const{i18n:t,history:s}=C(),{version:a,name:o,modifiedDateMillis:l,snapshotName:c,repository:u,schedule:p,nextExecutionMillis:d,config:j,stats:x,retention:b,isManagedPolicy:m}=e,{includeGlobalState:h,featureStates:O,ignoreUnavailable:y,indices:f,partial:M}=j||{includeGlobalState:void 0,featureStates:[],ignoreUnavailable:void 0,indices:void 0,partial:void 0};return Object(g.jsx)(r.Fragment,null,m?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{size:"s",color:"warning",iconType:"iInCircle",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.managedPolicyWarningTitle",defaultMessage:"This is a managed policy used by other systems. Any changes you make might affect how these systems operate."})}),Object(g.jsx)(S.EuiSpacer,{size:"l"})):null,x&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiPanel,{hasBorder:!0},Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiStat,{title:x.snapshotsTaken,description:t.translate("xpack.snapshotRestore.policyDetails.snapshotsTakenStat",{defaultMessage:"Snapshots taken"}),titleSize:"s"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiStat,{title:x.snapshotsFailed,description:t.translate("xpack.snapshotRestore.policyDetails.snapshotsFailedStat",{defaultMessage:"Failures"}),titleSize:"s"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiStat,{title:x.snapshotsDeleted,description:t.translate("xpack.snapshotRestore.policyDetails.snapshotsDeletedStat",{defaultMessage:"Deleted"}),titleSize:"s"})),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiStat,{title:x.snapshotDeletionFailures,description:t.translate("xpack.snapshotRestore.policyDetails.snapshotDeletionFailuresStat",{defaultMessage:"Deletion failures"}),titleSize:"s"})))),Object(g.jsx)(S.EuiSpacer,null)),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.generalTitle",defaultMessage:"General"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"version"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.versionLabel",defaultMessage:"Version"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},a))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"modified"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.modifiedDateLabel",defaultMessage:"Last modified"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(z,{epochMs:l}))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"name"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.snapshotNameLabel",defaultMessage:"Snapshot name"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(S.EuiLink,Object(F.reactRouterNavigate)(s,Object(i.o)(void 0,o)),c)))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"repository"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.repositoryLabel",defaultMessage:"Repository"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(S.EuiLink,Object(F.reactRouterNavigate)(s,Object(i.k)(u)),u))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"schedule"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.scheduleLabel",defaultMessage:"Schedule"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},p))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"execution"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.nextExecutionLabel",defaultMessage:"Next snapshot"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(z,{epochMs:d}))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"indices"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.dataStreamsAndIndicesLabel",defaultMessage:"Data streams and indices"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(we,{indices:f})))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"ignoreUnavailable"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.ignoreUnavailableLabel",defaultMessage:"Ignore unavailable indices"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},y?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.ignoreUnavailableTrueLabel",defaultMessage:"Yes"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.ignoreUnavailableFalseLabel",defaultMessage:"No"}))))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"includeGlobalState"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.includeGlobalStateLabel",defaultMessage:"Include global state"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},!1===h?Object(g.jsx)(R.FormattedMessage,{"data-test-subj":"withoutGlobalState",id:"xpack.snapshotRestore.policyDetails.includeGlobalStateFalseLabel",defaultMessage:"No"}):Object(g.jsx)(R.FormattedMessage,{"data-test-subj":"withGlobalStateAndFeatureStates",id:"xpack.snapshotRestore.policyDetails.includeGlobalStateTrueLabel",defaultMessage:"Yes"})))),Object(g.jsx)(ze,{includeGlobalState:h,featureStates:O})),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"partial"},Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.partialLabel",defaultMessage:"Allow partial shards"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},M?Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.partialTrueLabel",defaultMessage:"Yes"}):Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.partialFalseLabel",defaultMessage:"No"}))))),b&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiHorizontalRule,null),Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.retentionTitle",defaultMessage:"Retention"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},b.expireAfterValue&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.expireAfterLabel",defaultMessage:"Delete after"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,b.expireAfterValue,b.expireAfterUnit)),b.minCount&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.minCountLabel",defaultMessage:"Min count"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,b.minCount)),b.maxCount&&Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiDescriptionListTitle,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.maxCountLabel",defaultMessage:"Max count"})),Object(g.jsx)(S.EuiDescriptionListDescription,null,b.maxCount)))))},Ht=({policy:e})=>{const{lastSuccess:t,lastFailure:s,nextExecutionMillis:o,name:n,repository:l}=e,{history:c}=C();return t||s?Object(g.jsx)(r.Fragment,null,(()=>{if(!t)return null;const{time:e,snapshotName:s}=t;return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastSuccessTitle",defaultMessage:"Last successful snapshot"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"successDate"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastSuccess.dateLabel",defaultMessage:"Date"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(z,{epochMs:e}))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"successSnapshot"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastSuccess.snapshotNameLabel",defaultMessage:"Snapshot name"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(S.EuiLink,Object(F.reactRouterNavigate)(c,Object(i.n)(l,s)),s))))))})(),t&&s?Object(g.jsx)(S.EuiHorizontalRule,null):null,(()=>{if(!s)return null;const{time:e,snapshotName:t,details:o}=s;return Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiTitle,{size:"s"},Object(g.jsx)("h3",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastFailureTitle",defaultMessage:"Last snapshot failure"}))),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionList,{textStyle:"reverse"},Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"failureDate"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastFailure.dateLabel",defaultMessage:"Date"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(z,{epochMs:e}))),Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"failureSnapshot"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastFailure.snapshotNameLabel",defaultMessage:"Snapshot name"})),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},t))),Object(g.jsx)(S.EuiFlexGroup,null,Object(g.jsx)(S.EuiFlexItem,{"data-test-subj":"failureDetails"},Object(g.jsx)(S.EuiDescriptionListTitle,{"data-test-subj":"title"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.lastFailure.detailsLabel",defaultMessage:"Details"})),Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(S.EuiDescriptionListDescription,{className:"eui-textBreakWord","data-test-subj":"value"},Object(g.jsx)(S.EuiCodeBlock,{paddingSize:"m",language:"json",isCopyable:!0,"aria-label":a.i18n.translate("xpack.snapshotRestore.policyDetails.lastFailure.detailsAriaLabel",{defaultMessage:"Last failure details for policy '{name}'",values:{name:n}})},JSON.stringify(o,null,2)))))))})()):Object(g.jsx)(S.EuiText,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.noHistoryMessage",defaultMessage:"This policy will run on {date} at {time}.",values:{date:Object(g.jsx)(z,{epochMs:o,type:"date"}),time:Object(g.jsx)(z,{epochMs:o,type:"time"})}})))},qt="summary",$t="success",Yt={[qt]:ee.n,[$t]:ee.m},Jt=({policyName:e,onClose:t,onPolicyDeleted:s,onPolicyExecuted:a})=>{const{i18n:l,uiMetricService:c,history:p}=C(),{error:d,data:j,resendRequest:x}=Object(o.q)(e),[b,m]=Object(r.useState)(qt),[h,O]=Object(r.useState)(!1);Object(r.useEffect)((()=>{m(qt)}),[e]);const y=[{id:qt,name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.summaryTabTitle",defaultMessage:"Summary"})},{id:$t,name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.historyTabTitle",defaultMessage:"History"})}];return Object(g.jsx)(S.EuiFlyout,{onClose:t,"data-test-subj":"policyDetail","aria-labelledby":"srPolicyDetailsFlyoutTitle",size:"m",maxWidth:550},Object(g.jsx)(S.EuiFlyoutHeader,null,Object(g.jsx)(S.EuiTitle,{size:"m"},Object(g.jsx)("h2",{id:"srPolicyDetailsFlyoutTitle","data-test-subj":"title"},e," ",Object(g.jsx)(S.EuiButtonIcon,{iconType:"refresh",color:"text","aria-label":l.translate("xpack.snapshotRestore.policyDetails.reloadButtonAriaLabel",{defaultMessage:"Reload"}),onClick:()=>x()}))),j&&j.policy&&j.policy.inProgress?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiSpacer,{size:"s"}),Object(g.jsx)(Oe,{size:"s"},Object(g.jsx)(S.EuiLink,u()({},Object(F.reactRouterNavigate)(p,Object(i.n)(j.policy.repository,j.policy.inProgress.snapshotName)),{"data-test-subj":"inProgressSnapshotLink"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.inProgressSnapshotLinkText",defaultMessage:"'{snapshotName}' in progress",values:{snapshotName:j.policy.inProgress.snapshotName}})))):null,Object(g.jsx)(S.EuiTabs,null,y.map((e=>Object(g.jsx)(S.EuiTab,{onClick:()=>{c.trackUiMetric(Yt[e.id]),m(e.id)},isSelected:e.id===b,key:e.id,"data-test-subj":"tab"},e.name))))),Object(g.jsx)(S.EuiFlyoutBody,{"data-test-subj":"content"},(()=>{if(j){const{policy:e}=j;return b===$t?Object(g.jsx)(Ht,{policy:e}):Object(g.jsx)(_t,{policy:e})}return d?(()=>{const t=404===d.status?{data:{error:l.translate("xpack.snapshotRestore.policyDetails.policyNotFoundErrorMessage",{defaultMessage:"The policy '{name}' does not exist.",values:{name:e}})}}:d;return Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.loadingPolicyErrorTitle",defaultMessage:"Error loading policy"}),error:t})})():Object(g.jsx)(ye,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.loadingPolicyDescription",defaultMessage:"Loading policy…"}))})()),Object(g.jsx)(S.EuiFlyoutFooter,null,Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiButtonEmpty,{iconType:"cross",flush:"left",onClick:t,"data-test-subj":"srPolicyDetailsFlyoutCloseButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.closeButtonLabel",defaultMessage:"Close"}))),j?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(Ve,null,(t=>Object(g.jsx)(Ue,null,(o=>Object(g.jsx)(S.EuiPopover,{id:"policyActionMenu",button:Object(g.jsx)(S.EuiButton,{"data-test-subj":"policyActionMenuButton",iconSide:"right",onClick:()=>O(!h),iconType:"arrowDown",fill:!0},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyDetails.manageButtonLabel",defaultMessage:"Manage policy"})),isOpen:h,closePopover:()=>O(!1),panelPaddingSize:"none",anchorPosition:"rightUp",repositionOnScroll:!0},Object(g.jsx)(S.EuiContextMenu,{"data-test-subj":"policyActionContextMenu",initialPanelId:0,panels:[{id:0,title:l.translate("xpack.snapshotRestore.policyDetails.managePanelTitle",{defaultMessage:"Policy options"}),items:[{name:l.translate("xpack.snapshotRestore.policyDetails.executeButtonLabel",{defaultMessage:"Run now"}),icon:"play",onClick:()=>{t(e,(()=>setTimeout((()=>{a(),x()}),2e3)))},disabled:Boolean(j.policy.inProgress)},{name:l.translate("xpack.snapshotRestore.policyDetails.editButtonLabel",{defaultMessage:"Edit"}),icon:"pencil",...Object(F.reactRouterNavigate)(p,Object(i.e)(e))},{name:l.translate("xpack.snapshotRestore.policyDetails.deleteButtonLabel",{defaultMessage:"Delete"}),icon:"trash",disabled:j.policy.isManagedPolicy,onClick:()=>o([e],s)}]}]}))))))):null)))},Kt=({policies:e,reload:t,openPolicyDetailsUrl:s,onPolicyDeleted:a,onPolicyExecuted:o})=>{const{i18n:n,uiMetricService:l,history:c}=C(),[p,d]=Object(r.useState)([]),j=[{field:"name",name:n.translate("xpack.snapshotRestore.policyList.table.policyNameColumnTitle",{defaultMessage:"Policy"}),truncateText:!0,sortable:!0,render:(e,{inProgress:t,isManagedPolicy:a})=>Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"s",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiLink,u()({},Object(F.reactRouterNavigate)(c,s(e),(()=>l.trackUiMetric(ee.q))),{"data-test-subj":"policyLink"}),e)," "),a?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiIconTip,{content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.table.managedPolicyBadgeLabel",defaultMessage:"This is a managed policy"}),position:"right"})):null,t?Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiToolTip,{content:n.translate("xpack.snapshotRestore.policyList.table.inProgressTooltip",{defaultMessage:"Snapshot in progress"})},Object(g.jsx)(S.EuiLoadingSpinner,{size:"m"}))):null)},{field:"snapshotName",name:n.translate("xpack.snapshotRestore.policyList.table.snapshotNameColumnTitle",{defaultMessage:"Snapshot name"}),sortable:!0,render:(e,{lastFailure:t,lastSuccess:s})=>s&&t&&t.time>s.time?Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"s",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiToolTip,{position:"top",content:n.translate("xpack.snapshotRestore.policyList.table.lastSnapshotFailedTooltip",{defaultMessage:"Last snapshot failed"})},Object(g.jsx)(S.EuiIcon,{type:"warning",color:"danger"}))),Object(g.jsx)(S.EuiFlexItem,{grow:1},Object(g.jsx)(S.EuiText,{size:"s"},e))):e},{field:"repository",name:n.translate("xpack.snapshotRestore.policyList.table.repositoryColumnTitle",{defaultMessage:"Repository"}),truncateText:!0,sortable:!0},{field:"schedule",name:n.translate("xpack.snapshotRestore.policyList.table.scheduleColumnTitle",{defaultMessage:"Schedule"}),truncateText:!0,sortable:!0},{field:"retention",name:n.translate("xpack.snapshotRestore.policyList.table.retentionColumnTitle",{defaultMessage:"Retention"}),render:e=>e?Object(g.jsx)(S.EuiIcon,{type:"check","aria-label":n.translate("xpack.snapshotRestore.policyList.table.retentionColumnAriaLabel",{defaultMessage:"Retention configured"})}):null},{field:"nextExecutionMillis",name:n.translate("xpack.snapshotRestore.policyList.table.nextExecutionColumnTitle",{defaultMessage:"Next snapshot"}),truncateText:!0,sortable:!0,render:e=>Object(g.jsx)(z,{epochMs:e})},{name:n.translate("xpack.snapshotRestore.policyList.table.actionsColumnTitle",{defaultMessage:"Actions"}),actions:[{render:({name:e,inProgress:t,isManagedPolicy:s})=>Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"s"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(Ve,null,(s=>Object(g.jsx)(S.EuiToolTip,{content:Boolean(t)?n.translate("xpack.snapshotRestore.policyList.table.actionExecuteDisabledTooltip",{defaultMessage:"Policy is running"}):n.translate("xpack.snapshotRestore.policyList.table.actionExecuteTooltip",{defaultMessage:"Run now"})},Object(g.jsx)(S.EuiButtonIcon,{"aria-label":n.translate("xpack.snapshotRestore.policyList.table.actionExecuteAriaLabel",{defaultMessage:"Run '{name}' immediately",values:{name:e}}),iconType:"play",color:"primary","data-test-subj":"executePolicyButton",onClick:()=>s(e,o),disabled:Boolean(t)}))))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiToolTip,{content:n.translate("xpack.snapshotRestore.policyList.table.actionEditTooltip",{defaultMessage:"Edit"})},Object(g.jsx)(S.EuiButtonIcon,u()({"aria-label":n.translate("xpack.snapshotRestore.policyList.table.actionEditAriaLabel",{defaultMessage:"Edit policy '{name}'",values:{name:e}}),iconType:"pencil",color:"primary"},Object(F.reactRouterNavigate)(c,Object(i.e)(e)),{"data-test-subj":"editPolicyButton"})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(Ue,null,(t=>{const o=s?n.translate("xpack.snapshotRestore.policyList.table.deleteManagedPolicyTableActionTooltip",{defaultMessage:"You cannot delete a managed policy."}):n.translate("xpack.snapshotRestore.policyList.table.actionDeleteTooltip",{defaultMessage:"Delete"});return Object(g.jsx)(S.EuiToolTip,{content:o},Object(g.jsx)(S.EuiButtonIcon,{"aria-label":n.translate("xpack.snapshotRestore.policyList.table.actionDeleteAriaLabel",{defaultMessage:"Delete policy '{name}'",values:{name:e}}),iconType:"trash",color:"danger","data-test-subj":"deletePolicyButton",onClick:()=>t([e],a),isDisabled:s}))}))))}],width:"100px"}],x={onSelectionChange:e=>d(e),selectable:({isManagedPolicy:e})=>!e,selectableMessage:e=>e?"":n.translate("xpack.snapshotRestore.policyList.table.deleteManagedPolicySelectTooltip",{defaultMessage:"You cannot delete a managed policy."})},b={toolsLeft:p.length?Object(g.jsx)(Ue,null,(e=>Object(g.jsx)(S.EuiButton,{onClick:()=>e(p.map((({name:e})=>e)),a),color:"danger","data-test-subj":"srPolicyListBulkDeleteActionButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.table.deletePolicyButton",defaultMessage:"Delete {count, plural, one {policy} other {policies}}",values:{count:p.length}})))):void 0,toolsRight:[Object(g.jsx)(S.EuiButton,{key:"reloadPolicies",color:"success",iconType:"refresh",onClick:t,"data-test-subj":"reloadButton"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.table.reloadPoliciesButton",defaultMessage:"Reload"})),Object(g.jsx)(S.EuiButton,u()({key:"createNewPolicy"},Object(F.reactRouterNavigate)(c,Object(i.c)()),{fill:!0,iconType:"plusInCircle","data-test-subj":"createPolicyButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.table.addPolicyButton",defaultMessage:"Create policy"}))],box:{incremental:!0,schema:!0},filters:[{type:"field_value_selection",field:"repository",name:n.translate("xpack.snapshotRestore.policyList.table.repositoryFilterLabel",{defaultMessage:"Repository"}),multiSelect:!1,options:Object.keys(e.reduce(((e,t)=>(e[t.repository]=!0,e)),{})).map((e=>({value:e,view:e})))}]};return Object(g.jsx)(S.EuiInMemoryTable,{className:"snapshotRestore__policyTable",items:e,itemId:"name",columns:j,search:b,sorting:{sort:{field:"name",direction:"asc"}},selection:x,pagination:{initialPageSize:20,pageSizeOptions:[10,20,50]},isSelectable:!0,rowProps:()=>({"data-test-subj":"row"}),cellProps:()=>({"data-test-subj":"cell"}),"data-test-subj":"policyTable"})},Qt=({retentionSettings:e,onRetentionScheduleUpdated:t,isLoading:s,error:a})=>{const{i18n:o}=C(),[i,l]=Object(r.useState)(!1);return s?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiPanel,null,Object(g.jsx)(S.EuiSkeletonText,{lines:1})),Object(g.jsx)(S.EuiSpacer,null)):a?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.errorFetchingRetentionScheduleTitle",defaultMessage:"Error fetching retention schedule"}),color:"danger",iconType:"warning"},a.data&&a.data.message?Object(g.jsx)("p",null,a.data.message):null,Object(g.jsx)(S.EuiButton,{iconType:"refresh",color:"danger",onClick:t},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.errorFetchingRetentionScheduleReloadButtonLabel",defaultMessage:"Reload"}))),Object(g.jsx)(S.EuiSpacer,null)):e&&e.retentionSchedule?(c=e.retentionSchedule,Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiPanel,{hasBorder:!0},Object(g.jsx)(S.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiText,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.retentionScheduleDescription",defaultMessage:"The cron schedule for retaining snapshots is: {cronSchedule}.",values:{cronSchedule:Object(g.jsx)("strong",null,c)}})))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(S.EuiFlexGroup,{gutterSize:"s"},Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(He,null,(e=>Object(g.jsx)(S.EuiToolTip,{position:"top",content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.retentionScheduleExecuteLinkTooltip",defaultMessage:"Run retention now"})},Object(g.jsx)(S.EuiButtonIcon,{iconType:"play",onClick:()=>e(),"aria-label":o.translate("xpack.snapshotRestore.policyRetentionSchedulePanel.retentionScheduleExecuteLinkAriaLabel",{defaultMessage:"Run retention now"})}))))),Object(g.jsx)(S.EuiFlexItem,{grow:!1},Object(g.jsx)(_e,null,(e=>Object(g.jsx)(S.EuiToolTip,{position:"top",content:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.retentionScheduleEditLinkTooltip",defaultMessage:"Edit retention schedule"})},Object(g.jsx)(S.EuiButtonIcon,{iconType:"pencil",onClick:()=>e(c,t),"aria-label":o.translate("xpack.snapshotRestore.policyRetentionSchedulePanel.retentionScheduleEditLinkAriaLabel",{defaultMessage:"Edit retention schedule"})}))))))))),Object(g.jsx)(S.EuiSpacer,null))):Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.noScheduleConfiguredWarningTitle",defaultMessage:"Retention not scheduled"}),color:"warning",iconType:"warning"},Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.noScheduleConfiguredWarningDescription",defaultMessage:"One or more policies have a retention period, but no retention is scheduled."})),Object(g.jsx)(He,null,(e=>Object(g.jsx)(_e,null,(s=>Object(g.jsx)(S.EuiPopover,{id:"retentionActionMenu",button:Object(g.jsx)(S.EuiButton,{"data-test-subj":"retentionActionMenuButton",iconSide:"right",color:"warning",onClick:()=>l(!i),iconType:"arrowDown"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyRetentionSchedulePanel.manageRetentionButtonLabel",defaultMessage:"Manage retention"})),isOpen:i,closePopover:()=>l(!1),panelPaddingSize:"none",anchorPosition:"rightUp",repositionOnScroll:!0},Object(g.jsx)(S.EuiContextMenu,{"data-test-subj":"retentionActionContextMenu",initialPanelId:0,panels:[{id:0,title:o.translate("xpack.snapshotRestore.policyRetentionSchedulePanel.managePanelTitle",{defaultMessage:"Retention options"}),items:[{name:o.translate("xpack.snapshotRestore.policyRetentionSchedulePanel.executeButtonLabel",{defaultMessage:"Run now"}),icon:"play",onClick:()=>e()},{name:o.translate("xpack.snapshotRestore.policyRetentionSchedulePanel.addButtonLabel",{defaultMessage:"Schedule"}),icon:"plusInCircle",onClick:()=>s(void 0,t)}]}]}))))))),Object(g.jsx)(S.EuiSpacer,null));var c},Zt=({history:e})=>{const{policyName:t}=rt(),{error:s,isLoading:a,data:{policies:l}={policies:void 0},resendRequest:c}=Object(o.p)(),{uiMetricService:p}=C(),{core:d}=D(),{isLoading:j,error:x,data:b,resendRequest:m}=Object(o.v)(),h=e=>Object(i.i)(e),O=()=>{e.push(`${ee.a}/policies`)},y=e=>{t&&e.includes(t)&&O(),e.length&&c()},f=()=>{c()};let M;if(Object(r.useEffect)((()=>{p.trackUiMetric(ee.p)}),[p]),Object(v.l)(d.executionContext,{type:"application",page:"snapshotRestorePolicyTab"}),a)M=Object(g.jsx)(v.f,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.loadingPoliciesDescription",defaultMessage:"Loading policies…"}));else if(s)M=Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.LoadingPoliciesErrorMessage",defaultMessage:"Error loading policies"}),error:s});else if(l&&0===l.length)M=Object(g.jsx)(S.EuiPageContent_Deprecated,{hasShadow:!1,paddingSize:"none",verticalPosition:"center",horizontalPosition:"center"},Object(g.jsx)(S.EuiEmptyPrompt,{iconType:"managementApp",title:Object(g.jsx)("h1",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.emptyPromptTitle",defaultMessage:"Create your first snapshot policy"})),body:Object(g.jsx)(r.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.emptyPromptDescription",defaultMessage:"A policy automates the creation and deletion of snapshots."}))),actions:Object(g.jsx)(S.EuiButton,u()({},Object(F.reactRouterNavigate)(e,Object(i.c)()),{fill:!0,iconType:"plusInCircle","data-test-subj":"createPolicyButton"}),Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.createPolicyButton",defaultMessage:"Create a policy"})),"data-test-subj":"emptyPrompt"}));else{const e=l.map((e=>e.schedule)),t=e.length>new Set(e).size,s=Boolean(l.find((e=>e.retention)));M=Object(g.jsx)("section",{"data-test-subj":"policyList"},t?Object(g.jsx)(r.Fragment,null,Object(g.jsx)(S.EuiCallOut,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyScheduleWarningTitle",defaultMessage:"Two or more policies have the same schedule"}),color:"warning",iconType:"warning"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyScheduleWarningDescription",defaultMessage:"Only one snapshot can be taken at a time. To avoid snapshot failures, edit or delete the policies."})),Object(g.jsx)(S.EuiSpacer,null)):null,s?Object(g.jsx)(Qt,{retentionSettings:b,onRetentionScheduleUpdated:m,isLoading:j,error:x}):null,Object(g.jsx)(Kt,{policies:l||[],reload:c,openPolicyDetailsUrl:h,onPolicyDeleted:y,onPolicyExecuted:f}))}return Object(g.jsx)(v.h,{privileges:k.d.map((e=>`cluster.${e}`))},(({hasPrivileges:e,privilegesMissing:s})=>e?Object(g.jsx)(n.a.Fragment,null,t?Object(g.jsx)(Jt,{policyName:t,onClose:O,onPolicyDeleted:y,onPolicyExecuted:f}):null,M):Object(g.jsx)(v.d,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.deniedPrivilegeTitle",defaultMessage:"You're missing cluster privileges"}),message:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.policyList.deniedPrivilegeDescription",defaultMessage:"To manage Snapshot Lifecycle Policies, you must have {privilegesCount, plural, one {this cluster privilege} other {these cluster privileges}}: {missingPrivileges}.",values:{missingPrivileges:s.cluster.join(", "),privilegesCount:s.cluster.length}})})))},Xt=({match:{params:{section:e}},history:t})=>{const{slm_ui:s}=w(),{docLinks:a}=I(),o=[{id:"snapshots",name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.snapshotsTabTitle",defaultMessage:"Snapshots"})},{id:"repositories",name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.repositoriesTabTitle",defaultMessage:"Repositories"})},{id:"restore_status",name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.restoreTabTitle",defaultMessage:"Restore Status"})}];return s.enabled&&o.splice(2,0,{id:"policies",name:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.policiesTabTitle",defaultMessage:"Policies"})}),Object(r.useEffect)((()=>{i.a.setBreadcrumbs(e||"home"),i.b.setTitle(e||"home")}),[e]),Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiPageHeader,{bottomBorder:!0,pageTitle:Object(g.jsx)("span",{"data-test-subj":"appTitle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.snapshotRestoreTitle",defaultMessage:"Snapshot and Restore"})),rightSideItems:[Object(g.jsx)(S.EuiButtonEmpty,{href:a.links.snapshotRestore.guide,target:"_blank",iconType:"help","data-test-subj":"documentationLink"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.snapshotRestoreDocsLinkText",defaultMessage:"Snapshot and Restore docs"}))],description:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.home.snapshotRestoreDescription",defaultMessage:"Use repositories to store and recover backups of your Elasticsearch indices and clusters."}),tabs:o.map((s=>({onClick:()=>{return e=s.id,void t.push(encodeURI(`${ee.a}/${encodeURIComponent(e)}`));var e},isSelected:s.id===e,key:s.id,"data-test-subj":s.id.toLowerCase()+"_tab",label:s.name})))}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(M,null,Object(g.jsx)(m,{exact:!0,path:`${ee.a}/repositories/:repositoryName*`,component:Ot}),Object(g.jsx)(m,{exact:!0,path:`${ee.a}/snapshots`,component:zt}),Object(g.jsx)(m,{exact:!0,path:`${ee.a}/snapshots/:repositoryName*/:snapshotId`,component:zt}),Object(g.jsx)(m,{exact:!0,path:`${ee.a}/restore_status`,component:Ut}),Object(g.jsx)(m,{exact:!0,path:`${ee.a}/policies/:policyName*`,component:Zt})))},es=({history:e,location:{search:t}})=>{const[s,a]=Object(r.useState)(!1),[n,l]=Object(r.useState)(null);return Object(r.useEffect)((()=>{i.a.setBreadcrumbs("repositoryAdd"),i.b.setTitle("repositoryAdd")}),[]),Object(g.jsx)(S.EuiPageContentBody_Deprecated,{restrictWidth:!0,style:{width:"100%"}},Object(g.jsx)(S.EuiPageHeader,{pageTitle:Object(g.jsx)("span",{"data-test-subj":"pageTitle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addRepositoryTitle",defaultMessage:"Register repository"}))}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(ge,{repository:{name:"",type:null,settings:{}},isSaving:s,saveError:n?Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addRepository.savingRepositoryErrorTitle",defaultMessage:"Cannot register new repository"}),error:n,"data-test-subj":"saveRepositoryApiError"}):null,clearSaveError:()=>{l(null)},onSave:async s=>{a(!0),l(null);const{name:i}=s,{error:r}=await Object(o.b)(s);if(a(!1),r)l(r);else{const{redirect:s}=Object(yt.parse)(t.replace(/^\?/,""),{sort:!1});e.push(s||encodeURI(`${ee.a}/${encodeURIComponent("repositories")}/${encodeURIComponent(i)}`))}}}))},ts=({history:e})=>{const{i18n:t}=C(),{name:s}=rt();Object(r.useEffect)((()=>{i.a.setBreadcrumbs("repositoryEdit"),i.b.setTitle("repositoryEdit")}),[]);const[a,l]=Object(r.useState)({name:"",type:null,settings:{}}),{error:c,isLoading:u,data:p}=Object(o.s)(s);Object(r.useEffect)((()=>{p&&p.repository&&l(p.repository)}),[p]);const[d,j]=Object(r.useState)(!1),[x,b]=Object(r.useState)(null);if(u)return Object(g.jsx)(fe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editRepository.loadingRepositoryDescription",defaultMessage:"Loading repository details…"}));if(c)return(()=>{const e=404===c.status?{data:{error:t.translate("xpack.snapshotRestore.editRepository.repositoryNotFoundErrorMessage",{defaultMessage:"The repository '{name}' does not exist.",values:{name:s}})}}:c;return Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editRepository.loadingRepositoryErrorTitle",defaultMessage:"Error loading repository details"}),error:e})})();const{isManagedRepository:m}=p;return Object(g.jsx)(S.EuiPageContentBody_Deprecated,{restrictWidth:!0,style:{width:"100%"}},Object(g.jsx)(S.EuiPageHeader,{pageTitle:Object(g.jsx)("span",{"data-test-subj":"pageTitle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editRepositoryTitle",defaultMessage:"Edit repository"}))}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),m?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{size:"m",color:"warning",iconType:"iInCircle",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editRepository.managedRepositoryWarningTitle",defaultMessage:"This is a managed repository. Changing this repository might affect other systems that use it. Proceed with caution."})}),Object(g.jsx)(S.EuiSpacer,{size:"l"})):null,Object(g.jsx)(ge,{repository:a,isManagedRepository:m,isEditing:!0,isSaving:d,saveError:x?Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editRepository.savingRepositoryErrorTitle",defaultMessage:"Cannot save repository"}),error:x}):null,clearSaveError:()=>{b(null)},onSave:async t=>{j(!0),b(null);const{error:a}=await Object(o.h)(t);j(!1),a?b(a):e.push(encodeURI(`${ee.a}/${encodeURIComponent("repositories")}/${encodeURIComponent(s)}`))}}))},ss=({history:e})=>{const{i18n:t}=C(),{repositoryName:s,snapshotId:a}=rt();Object(r.useEffect)((()=>{i.a.setBreadcrumbs("restoreSnapshot"),i.b.setTitle("restoreSnapshot")}),[]);const[n,l]=Object(r.useState)({}),{error:c,isLoading:u,data:p}=Object(o.w)(s,a);Object(r.useEffect)((()=>{p&&l(p)}),[p]);const[d,j]=Object(r.useState)(!1),[x,b]=Object(r.useState)(null);return u?Object(g.jsx)(fe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreSnapshot.loadingSnapshotDescription",defaultMessage:"Loading snapshot details…"})):c?(()=>{const e=404===c.status?{data:{error:t.translate("xpack.snapshotRestore.restoreSnapshot.snapshotNotFoundErrorMessage",{defaultMessage:"The snapshot '{snapshot}' does not exist in repository '{repository}'.",values:{snapshot:a,repository:s}})}}:c;return Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreSnapshot.loadingSnapshotErrorTitle",defaultMessage:"Error loading snapshot details"}),error:e})})():Object(g.jsx)(S.EuiPageContentBody_Deprecated,{restrictWidth:!0,style:{width:"100%"}},Object(g.jsx)(S.EuiPageHeader,{pageTitle:Object(g.jsx)("span",{"data-test-subj":"pageTitle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreSnapshotTitle",defaultMessage:"Restore '{snapshot}'",values:{snapshot:a}}))}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(Ge,{snapshotDetails:n,isSaving:d,saveError:x?Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.restoreSnapshot.executeRestoreErrorTitle",defaultMessage:"Unable to restore snapshot"}),error:x}):null,clearSaveError:()=>{b(null)},onSave:async t=>{j(!0),b(null);const{error:i}=await Object(o.j)(s,a,t);i?(j(!1),b(i)):setTimeout((()=>{j(!1),e.push(`${ee.a}/restore_status`)}),5e3)}}))},as=({history:e,location:{pathname:t}})=>{const[s,a]=Object(r.useState)(!1),[n,l]=Object(r.useState)(null),{error:c,isLoading:u,data:p}=Object(o.o)(),{indices:d,dataStreams:j}=null!=p?p:{indices:[],dataStreams:[]};Object(r.useEffect)((()=>{i.a.setBreadcrumbs("policyAdd"),i.b.setTitle("policyAdd")}),[]);const x={name:"",snapshotName:"",schedule:ee.c,repository:"",config:{},retention:{expireAfterValue:"",expireAfterUnit:k.f.DAY,maxCount:"",minCount:""},isManagedPolicy:!1};return u?Object(g.jsx)(fe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addPolicy.loadingIndicesDescription",defaultMessage:"Loading available indices…"})):c?Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addPolicy.LoadingIndicesErrorMessage",defaultMessage:"Error loading available indices"}),error:c}):Object(g.jsx)(S.EuiPageContentBody_Deprecated,{restrictWidth:!0,style:{width:"100%"}},Object(g.jsx)(S.EuiPageHeader,{pageTitle:Object(g.jsx)("span",{"data-test-subj":"pageTitle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addPolicyTitle",defaultMessage:"Create policy"}))}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),Object(g.jsx)(ot,{policy:x,indices:d,dataStreams:j,currentUrl:t,isSaving:s,saveError:n?Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.addPolicy.savingPolicyErrorTitle",defaultMessage:"Cannot create new policy"}),error:n,"data-test-subj":"savePolicyApiError"}):null,clearSaveError:()=>{l(null)},onSave:async t=>{a(!0),l(null);const{name:s}=t,{error:i}=await Object(o.a)(t);a(!1),i?l(i):e.push(encodeURI(`${ee.a}/policies/${encodeURIComponent(s)}`))},onCancel:()=>{e.push(`${ee.a}/policies`)}}))},os=({history:e,location:{pathname:t}})=>{const{name:s}=rt(),{i18n:a}=C();Object(r.useEffect)((()=>{i.a.setBreadcrumbs("policyEdit"),i.b.setTitle("policyEdit")}),[]);const[l,c]=Object(r.useState)({name:"",snapshotName:"",schedule:"",repository:"",config:{},retention:{expireAfterValue:"",expireAfterUnit:W.h.DAY,maxCount:"",minCount:""},isManagedPolicy:!1}),{error:u,isLoading:p,data:d}=Object(o.o)(),{error:j,isLoading:x,data:b}=Object(o.q)(s);Object(r.useEffect)((()=>{if(null!=b&&b.policy){const{policy:e}=b,t={name:e.name,snapshotName:e.snapshotName,schedule:e.schedule,repository:e.repository,config:e.config,retention:e.retention,isManagedPolicy:e.isManagedPolicy};c(t)}}),[b]);const[m,h]=Object(r.useState)(!1),[O,y]=Object(r.useState)(null);return x||p?x?Object(g.jsx)(fe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicy.loadingPolicyDescription",defaultMessage:"Loading policy details…"})):Object(g.jsx)(fe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicy.loadingIndicesDescription",defaultMessage:"Loading available indices…"})):j||u?(()=>{if(j){const e=404===j.status?{data:{error:a.translate("xpack.snapshotRestore.editPolicy.policyNotFoundErrorMessage",{defaultMessage:"The policy '{name}' does not exist.",values:{name:s}})}}:j;return Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicy.loadingPolicyErrorTitle",defaultMessage:"Error loading policy details"}),error:e})}return Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicy.LoadingIndicesErrorMessage",defaultMessage:"Error loading available indices"}),error:u})})():Object(g.jsx)(S.EuiPageContentBody_Deprecated,{restrictWidth:!0,style:{width:"100%"}},Object(g.jsx)(S.EuiPageHeader,{pageTitle:Object(g.jsx)("span",{"data-test-subj":"pageTitle"},Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicyTitle",defaultMessage:"Edit policy"}))}),Object(g.jsx)(S.EuiSpacer,{size:"l"}),l.isManagedPolicy?Object(g.jsx)(n.a.Fragment,null,Object(g.jsx)(S.EuiCallOut,{size:"m",color:"warning",iconType:"iInCircle",title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicy.managedPolicyWarningTitle",defaultMessage:"This is a managed policy. Changing this policy might affect other systems that use it. Proceed with caution."})}),Object(g.jsx)(S.EuiSpacer,{size:"l"})):null,Object(g.jsx)(ot,{policy:l,dataStreams:d.dataStreams,indices:d.indices,currentUrl:t,isEditing:!0,isSaving:m,saveError:O?Object(g.jsx)(v.g,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.editPolicy.savingPolicyErrorTitle",defaultMessage:"Cannot save policy"}),error:O}):null,clearSaveError:()=>{y(null)},onSave:async t=>{h(!0),y(null);const{error:a}=await Object(o.g)(t);h(!1),a?y(a):e.push(encodeURI(`${ee.a}/policies/${encodeURIComponent(s)}`))},onCancel:()=>{e.push(encodeURI(`${ee.a}/policies/${encodeURIComponent(s)}`))}}))},is=()=>{const{slm_ui:e}=w(),{apiError:t}=Object(v.k)(),s=["repositories","snapshots","restore_status"];e.enabled&&s.push("policies");const a=s.join("|");return t?Object(g.jsx)(v.e,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.app.checkingPrivilegesErrorMessage",defaultMessage:"Error fetching user privileges from the server."}),error:t}):Object(g.jsx)(v.h,{privileges:k.b.map((e=>`cluster.${e}`))},(({isLoading:t,hasPrivileges:s,privilegesMissing:o})=>t?Object(g.jsx)(fe,null,Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.app.checkingPrivilegesDescription",defaultMessage:"Checking privileges…"})):s?Object(g.jsx)("div",{"data-test-subj":"snapshotRestoreApp",className:E.APP_WRAPPER_CLASS},Object(g.jsx)(M,null,Object(g.jsx)(m,{exact:!0,path:"/add_repository",component:es}),Object(g.jsx)(m,{exact:!0,path:"/edit_repository/:name*",component:ts}),Object(g.jsx)(m,{exact:!0,path:`/:section(${a})/:repositoryName?/:snapshotId*`,component:Xt}),Object(g.jsx)(p.Redirect,{exact:!0,from:"/restore/:repositoryName",to:"/snapshots"}),Object(g.jsx)(m,{exact:!0,path:"/restore/:repositoryName/:snapshotId*",component:ss}),e.enabled&&Object(g.jsx)(m,{exact:!0,path:"/add_policy",component:as}),e.enabled&&Object(g.jsx)(m,{exact:!0,path:"/edit_policy/:name*",component:os}),Object(g.jsx)(p.Redirect,{from:"/",to:`/${ee.f}`}),Object(g.jsx)(p.Redirect,{from:"",to:`/${ee.f}`}))):Object(g.jsx)(S.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(g.jsx)(v.d,{title:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.app.deniedPrivilegeTitle",defaultMessage:"You're missing cluster privileges"}),message:Object(g.jsx)(R.FormattedMessage,{id:"xpack.snapshotRestore.app.deniedPrivilegeDescription",defaultMessage:"To use Snapshot and Restore, you must have {privilegesCount, plural, one {this cluster privilege} other {these cluster privileges}}: {missingPrivileges}.",values:{missingPrivileges:o.cluster.join(", "),privilegesCount:o.cluster.length}})}))))},rs=({appDependencies:e,children:t})=>{const{core:s,theme$:a}=e,{i18n:{Context:o},http:i}=s;return Object(g.jsx)(v.a,{httpClient:i,privilegesEndpoint:`${k.a}privileges`},Object(g.jsx)(o,null,Object(g.jsx)(v.c,{theme$:a},Object(g.jsx)(T,{value:e},t))))},ns=({history:e})=>Object(g.jsx)(y,{history:e},Object(g.jsx)(is,null)),ls=(e,t)=>(Object(l.render)(Object(g.jsx)(F.KibanaContextProvider,{services:{uiSettings:t.services.uiSettings,settings:t.services.settings,theme:t.core.theme}},Object(g.jsx)(rs,{appDependencies:t},Object(g.jsx)(ns,{history:t.services.history}))),e),()=>{Object(l.unmountComponentAtNode)(e)});async function cs(e,t,s,r){const{element:n,setBreadcrumbs:l,history:c,theme$:u}=r,[p]=await e.getStartServices(),{chrome:{docTitle:d},settings:j}=p;i.b.setup(d.change),i.a.setup(l);const x={core:p,config:s,services:{uiSettings:e.uiSettings,settings:j,httpService:o.l,uiMetricService:t.uiMetricService,i18n:a.i18n,history:c},theme$:u},b=ls(n,x);return()=>{d.reset(),b()}}}}]);