/*! 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.licenseManagement_bundle_jsonpfunction=window.licenseManagement_bundle_jsonpfunction||[]).push([[1],Array(29).concat([function(e,t,n){"use strict";t.__esModule=!0;var r=c(n(83));t.combineActions=r.default;var a=c(n(42));t.createAction=a.default;var o=c(n(86));t.createActions=o.default;var s=c(n(95));t.createCurriedAction=s.default;var i=c(n(61));t.handleAction=i.default;var u=c(n(98));function c(e){return e&&e.__esModule?e:{default:e}}t.handleActions=u.default},function(e,t,n){e.exports=n(7)(2964)},function(e,t,n){e.exports=n(7)(1466)},function(e,t,n){"use strict";t.__esModule=!0;var r={batch:!0},a=n(67);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===a[e]||(t[e]=a[e]))}));var o=n(82);t.batch=o.unstable_batchedUpdates,(0,n(46).setBatch)(o.unstable_batchedUpdates)},function(e,t,n){"use strict";var r=n(30).default;t.__esModule=!0,t.default=t.ReactReduxContext=void 0;var a=r(n(16)).default.createContext(null);t.ReactReduxContext=a;var o=a;t.default=o},function(e,t,n){"use strict";e.exports=function(e,t,n,r,a,o,s,i){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,s,i],l=0;(u=new Error(t.replace(/%s/g,(function(){return c[l++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(e,t,n){"use strict";t.__esModule=!0,t.ACTION_TYPE_DELIMITER=t.DEFAULT_NAMESPACE=void 0,t.DEFAULT_NAMESPACE="/",t.ACTION_TYPE_DELIMITER="||"},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0,t.default=function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0,t.default=function(e){return"function"==typeof e}},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0,t.default=function(e){return"undefined"!=typeof Map&&e instanceof Map}},function(e,t,n){"use strict";t.__esModule=!0,t.createSubscription=function(e,t){var n,o=a;function s(){u.onStateChange&&u.onStateChange()}function i(){var a,i,u;n||(n=t?t.addNestedSub(s):e.subscribe(s),a=(0,r.getBatch)(),i=null,u=null,o={clear:function(){i=null,u=null},notify:function(){a((function(){for(var e=i;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],t=i;t;)e.push(t),t=t.next;return e},subscribe:function(e){var t=!0,n=u={callback:e,next:null,prev:u};return n.prev?n.prev.next=n:i=n,function(){t&&null!==i&&(t=!1,n.next?n.next.prev=n.prev:u=n.prev,n.prev?n.prev.next=n.next:i=n.next)}}})}var u={addNestedSub:function(e){return i(),o.subscribe(e)},notifyNestedSubs:function(){o.notify()},handleChangeWrapper:s,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,o.clear(),o=a)},getListeners:function(){return o}};return u};var r=n(46),a={notify:function(){},get:function(){return[]}}},function(e,t,n){"use strict";t.__esModule=!0,t.useIsomorphicLayoutEffect=void 0;var r=n(16),a="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?r.useLayoutEffect:r.useEffect;t.useIsomorphicLayoutEffect=a},function(e,t,n){e.exports=n(7)(1467)},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t,n){void 0===t&&(t=o.default),(0,r.default)((0,a.default)(t)||(0,s.default)(t),"Expected payloadCreator to be a function, undefined or null");var i=(0,s.default)(t)||t===o.default?o.default:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a=0;r--){var a=t[r](e);if(a)return a}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function j(e,t){return e===t}function b(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?s.default:n,b=t.mapStateToPropsFactories,g=void 0===b?c.default:b,m=t.mapDispatchToPropsFactories,v=void 0===m?u.default:m,h=t.mergePropsFactories,x=void 0===h?l.default:h,O=t.selectorFactory,y=void 0===O?d.default:O;return function(e,t,n,s){void 0===s&&(s={});var u=s,c=u.pure,l=void 0===c||c,d=u.areStatesEqual,b=void 0===d?j:d,m=u.areOwnPropsEqual,h=void 0===m?i.default:m,O=u.areStatePropsEqual,M=void 0===O?i.default:O,E=u.areMergedPropsEqual,_=void 0===E?i.default:E,T=(0,o.default)(u,f),S=p(e,g,"mapStateToProps"),w=p(t,v,"mapDispatchToProps"),C=p(n,x,"mergeProps");return r(y,(0,a.default)({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:S,initMapDispatchToProps:w,initMergeProps:C,pure:l,areStatesEqual:b,areOwnPropsEqual:h,areStatePropsEqual:M,areMergedPropsEqual:_},T))}}var g=b();t.default=g},function(e,t,n){"use strict";var r=n(30).default;t.__esModule=!0,t.default=void 0,t.whenMapDispatchToPropsIsFunction=s,t.whenMapDispatchToPropsIsMissing=i,t.whenMapDispatchToPropsIsObject=u;var a=r(n(74)),o=n(49);function s(e){return"function"==typeof e?(0,o.wrapMapToPropsFunc)(e,"mapDispatchToProps"):void 0}function i(e){return e?void 0:(0,o.wrapMapToPropsConstant)((function(e){return{dispatch:e}}))}function u(e){return e&&"object"==typeof e?(0,o.wrapMapToPropsConstant)((function(t){return(0,a.default)(e,t)})):void 0}var c=[s,i,u];t.default=c},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){var n={},r=function(r){var a=e[r];"function"==typeof a&&(n[r]=function(){return t(a.apply(void 0,arguments))})};for(var a in e)r(a);return n}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0,t.whenMapStateToPropsIsFunction=a,t.whenMapStateToPropsIsMissing=o;var r=n(49);function a(e){return"function"==typeof e?(0,r.wrapMapToPropsFunc)(e,"mapStateToProps"):void 0}function o(e){return e?void 0:(0,r.wrapMapToPropsConstant)((function(){return{}}))}var s=[a,o];t.default=s},function(e,t,n){"use strict";var r=n(30).default;t.__esModule=!0,t.default=void 0,t.defaultMergeProps=o,t.whenMergePropsIsFunction=i,t.whenMergePropsIsOmitted=u,t.wrapMergePropsFunc=s;var a=r(n(31));function o(e,t,n){return(0,a.default)({},n,e,t)}function s(e){return function(t,n){n.displayName;var r,a=n.pure,o=n.areMergedPropsEqual,s=!1;return function(t,n,i){var u=e(t,n,i);return s?a&&o(u,r)||(r=u):(s=!0,r=u),r}}}function i(e){return"function"==typeof e?s(e):void 0}function u(e){return e?void 0:function(){return o}}r(n(50));var c=[i,u];t.default=c},function(e,t,n){"use strict";var r=n(30).default;t.__esModule=!0,t.default=function(e,t){var n=t.initMapStateToProps,r=t.initMapDispatchToProps,u=t.initMergeProps,c=(0,a.default)(t,o),l=n(e,c),d=r(e,c),f=u(e,c);return(c.pure?i:s)(l,d,f,e,c)},t.impureFinalPropsSelectorFactory=s,t.pureFinalPropsSelectorFactory=i;var a=r(n(41)),o=(r(n(79)),["initMapStateToProps","initMapDispatchToProps","initMergeProps"]);function s(e,t,n,r){return function(a,o){return n(e(a,o),t(r,o),o)}}function i(e,t,n,r,a){var o,s,i,u,c,l=a.areStatesEqual,d=a.areOwnPropsEqual,f=a.areStatePropsEqual,p=!1;return function(a,j){return p?function(a,p){var j,b,g=!d(p,s),m=!l(a,o);return o=a,s=p,g&&m?(i=e(o,s),t.dependsOnOwnProps&&(u=t(r,s)),c=n(i,u,s)):g?(e.dependsOnOwnProps&&(i=e(o,s)),t.dependsOnOwnProps&&(u=t(r,s)),c=n(i,u,s)):m?(j=e(o,s),b=!f(j,i),i=j,b&&(c=n(i,u,s)),c):c}(a,j):(i=e(o=a,s=j),u=t(r,s),c=n(i,u,s),p=!0,c)}}},function(e,t,n){"use strict";var r=n(30).default;t.__esModule=!0,t.default=function(e,t,n,r){o(e,"mapStateToProps",r),o(t,"mapDispatchToProps",r),o(n,"mergeProps",r)};var a=r(n(51));function o(e,t,n){if(!e)throw new Error("Unexpected value for "+t+" in "+n+".");"mapStateToProps"!==t&&"mapDispatchToProps"!==t||Object.prototype.hasOwnProperty.call(e,"dependsOnOwnProps")||(0,a.default)("The selector for "+t+" of "+n+" did not specify a value for dependsOnOwnProps.")}},function(e,t,n){"use strict";t.__esModule=!0,t.createDispatchHook=o,t.useDispatch=void 0;var r=n(33),a=n(52);function o(e){void 0===e&&(e=r.ReactReduxContext);var t=e===r.ReactReduxContext?a.useStore:(0,a.createStoreHook)(e);return function(){return t().dispatch}}var s=o();t.useDispatch=s},function(e,t,n){"use strict";t.__esModule=!0,t.createSelectorHook=c,t.useSelector=void 0;var r=n(16),a=n(53),o=n(39),s=n(40),i=n(33),u=function(e,t){return e===t};function c(e){void 0===e&&(e=i.ReactReduxContext);var t=e===i.ReactReduxContext?a.useReduxContext:function(){return(0,r.useContext)(e)};return function(e,n){void 0===n&&(n=u);var a=t(),i=function(e,t,n,a){var i,u=(0,r.useReducer)((function(e){return e+1}),0)[1],c=(0,r.useMemo)((function(){return(0,o.createSubscription)(n,a)}),[n,a]),l=(0,r.useRef)(),d=(0,r.useRef)(),f=(0,r.useRef)(),p=(0,r.useRef)(),j=n.getState();try{if(e!==d.current||j!==f.current||l.current){var b=e(j);i=void 0!==p.current&&t(b,p.current)?p.current:b}else i=p.current}catch(e){throw l.current&&(e.message+="\nThe error may be correlated with this previous error:\n"+l.current.stack+"\n\n"),e}return(0,s.useIsomorphicLayoutEffect)((function(){d.current=e,f.current=j,p.current=i,l.current=void 0})),(0,s.useIsomorphicLayoutEffect)((function(){function e(){try{var e=n.getState();if(e===f.current)return;var r=d.current(e);if(t(r,p.current))return;p.current=r,f.current=e}catch(e){l.current=e}u()}return c.onStateChange=e,c.trySubscribe(),e(),function(){return c.tryUnsubscribe()}}),[n,c]),i}(e,n,a.store,a.subscription);return(0,r.useDebugValue)(i),i}}var l=c();t.useSelector=l},function(e,t,n){"use strict";t.__esModule=!0,t.unstable_batchedUpdates=void 0;var r=n(22);t.unstable_batchedUpdates=r.unstable_batchedUpdates},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),o=1;o=t?e.apply(this,r):function(){return n.apply(this,r.concat([].slice.call(arguments)))}}}},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0,t.default=function(e){return void 0===e}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t,n){void 0===n&&(n={}),(0,a.default)((0,o.default)(e)||(0,s.default)(e),"Expected handlers to be a plain object.");var d=(0,u.default)(e,n),f=(0,i.default)(d).map((function(e){return(0,c.default)(e,(0,l.default)(e,d),t)})),p=r.default.apply(void 0,f.concat([t]));return function(e,n){return void 0===e&&(e=t),p(e,n)}};var r=d(n(99)),a=d(n(34)),o=d(n(36)),s=d(n(38)),i=d(n(44)),u=d(n(100)),c=d(n(61)),l=d(n(60));function d(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){for(var e=arguments.length,t=Array(e),n=0;n2?n-2:0),s=2;s1?t-1:0),r=1;r-1){var o=n[a];return a>0&&(n.splice(a,1),n.unshift(o)),o.value}return r}return{get:a,put:function(t,o){a(t)===r&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(d,p);function b(){var t=j.get(arguments);if(t===r){if(t=e.apply(null,arguments),f){var n=j.getEntries().find((function(e){return f(e.value,t)}));n&&(t=n.value)}j.put(arguments,t)}return t}return b.clearCache=function(){return j.clear()},b};var r="NOT_FOUND",a=function(e,t){return e===t};function o(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,a=0;a{const s=Object(r.useMemo)((()=>{if(t)return e=>Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(b,null),Object(p.jsx)(t,e))}),[t]);if(s)return Object(p.jsx)(u.Route,i()({},o,{component:s}));if(n||"function"==typeof e){const t="function"==typeof e?e:n;return Object(p.jsx)(u.Route,i()({},o,{render:e=>Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(b,null),t(e))}))}return Object(p.jsx)(u.Route,o,Object(p.jsx)(b,null),e)},b=()=>{const{executionContext:e}=Object(r.useContext)(l).services,t=Object(u.useRouteMatch)();return function(e,t){f()((()=>(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 g=n(24);const m=({children:e,...t})=>Object(p.jsx)(u.Router,t,Object(p.jsx)(g.CompatRouter,null,e));var v=n(25);const h=({legacySwitch:e=!0,children:t})=>{const n=Object(u.useRouteMatch)();return e?Object(p.jsx)(u.Switch,null,t):Object(p.jsx)(g.Routes,null,r.Children.map(t,(e=>{if(a.a.isValidElement(e)&&e.type===j){var r;const o=Object(v.replace)(null==e?void 0:e.props.path,n.url+"/",""),s="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(p.jsx)(g.Route,{path:o,element:Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(b,null),(null==e||null===(r=e.props)||void 0===r?void 0:r.component)&&Object(p.jsx)(e.props.component,null)||s&&s()||t)})}return e})))};var x=n(32),O=n(26),y=n(20);const M=Object(r.createContext)(void 0),E=({children:e,value:t})=>Object(p.jsx)(M.Provider,{value:t},e),_=M.Consumer;var T=n(62),S=n(105),w=n.n(S),C=n(2),L=n(103),P=n(29);const k=Object(P.createAction)("LICENSE_MANAGEMENT_ADD_LICENSE"),A=Object(P.handleActions)({[k]:(e,{payload:t})=>t},{});var I=n(1);const D=Object(P.createAction)("LICENSE_MANAGEMENT_ADD_UPLOAD_ERROR_MESSAGE"),F=Object(P.createAction)("LICENSE_MANAGEMENT_UPLOAD_LICENSE_STATUS"),R=C.i18n.translate("xpack.licenseMgmt.uploadLicense.genericUploadErrorMessage",{defaultMessage:"Error encountered uploading license:"}),N=Object(P.handleActions)({[F]:(e,{payload:t})=>t},{}),B=Object(P.createAction)("LICENSE_MANAGEMENT_START_BASIC_LICENSE_STATUS"),U=Object(P.createAction)("LICENSE_MANAGEMENT_CANCEL_START_BASIC_LICENSE"),q=Object(P.handleActions)({[B]:(e,{payload:t})=>t,[U]:()=>({})},{}),z=Object(P.handleActions)({[D]:(e,{payload:t})=>t},""),H=Object(P.createAction)("LICENSE_MANAGEMENT_TRIAL_STATUS_LOADED"),K=Object(P.handleActions)({[H]:(e,{payload:t})=>({canStartTrial:t})},{}),Y=Object(P.createAction)("LICENSE_MANAGEMENT_PERMISSIONS_LOADING"),G=Object(P.createAction)("LICENSE_MANAGEMENT_PERMISSIONS_SUCCESS"),W=Object(P.createAction)("LICENSE_MANAGEMENT_PERMISSIONS_ERROR"),$=Object(P.handleActions)({[Y]:(e,{payload:t})=>({loading:t}),[G]:(e,{payload:t})=>({hasPermission:t}),[W]:(e,{payload:t})=>({error:t})},{});var X=n(27),J=n.n(X);const V=Object(T.combineReducers)({license:A,uploadStatus:N,uploadErrorMessage:z,trialStatus:K,startBasicStatus:q,permissions:$}),Z=e=>e.permissions.hasPermission,Q=e=>e.permissions.loading,ee=e=>e.permissions.error,te=e=>e.license,ne=e=>te(e).type,re=e=>te(e).expiryDateInMillis,ae=e=>"basic"===ne(e)?null:re(e)?J.a.tz(re(e),J.a.tz.guess()):null,oe=e=>(new Date).getTime()>re(e),se=e=>{const{type:t}=te(e);return"trial"===t||(e=>{const t=new Date,n=ae(e);return n&&n.isAfter(t)&&n.diff(t,"days")<=25})(e)||oe(e)},ie=e=>!!e.uploadStatus.acknowledge,ue=e=>!!e.uploadStatus.applying,ce=e=>e.uploadStatus.messages,le=e=>!!e.uploadStatus.invalid,de=e=>e.uploadErrorMessage,fe=e=>{const t=ne(e);return e.trialStatus.canStartTrial&&"trial"!==t&&("platinum"!==t&&"enterprise"!==t||oe(e))},pe=e=>{if(e.trialStatus.canStartTrial)return!1;const{type:t}=te(e);return"platinum"!==t&&"enterprise"!==t||oe(e)},je=e=>!!e.startBasicStatus.acknowledge,be=e=>e.startBasicStatus.messages,ge=Object(L.createSelector)(te,(e=>{const t=ae(e);return t?t.format("LLL z"):null}),oe,((e,t,n)=>{const{isActive:r,type:a}=e;return{type:Object(v.capitalize)(a),isExpired:n,expirationDate:t,status:r?C.i18n.translate("xpack.licenseMgmt.licenseDashboard.licenseStatus.activeLicenseStatusText",{defaultMessage:"active"}):C.i18n.translate("xpack.licenseMgmt.licenseDashboard.licenseStatus.inactiveLicenseStatusText",{defaultMessage:"inactive"})}})),me=({appDependencies:e,children:t})=>{const{core:n,plugins:r,services:a,store:{initialLicense:o},theme$:s}=e,{http:i,notifications:{toasts:u},i18n:{Context:c}}=n,l=((e={},t={})=>{const n=[Object(T.applyMiddleware)(w.a.withExtraArgument(t))];return window.__REDUX_DEVTOOLS_EXTENSION__&&n.push(window.__REDUX_DEVTOOLS_EXTENSION__()),Object(T.createStore)(V,e,Object(T.compose)(...n))})({license:o},{history:e.services.history,toasts:u,http:i,telemetry:r.telemetry,licensing:r.licensing,breadcrumbService:a.breadcrumbService});return Object(p.jsx)(c,null,Object(p.jsx)(y.KibanaThemeProvider,{theme$:s},Object(p.jsx)(x.Provider,{store:l},Object(p.jsx)(E,{value:e},t))))};var ve=n(19),he=n(18),xe=n(0),Oe=n.n(xe),ye=n(28);class telemetry_opt_in_TelemetryOptIn extends a.a.Component{constructor(...e){super(...e),Oe()(this,"state",{showMoreTelemetryInfo:!1,showExample:!1}),Oe()(this,"closeReadMorePopover",(()=>{this.setState({showMoreTelemetryInfo:!1})})),Oe()(this,"onClickReadMore",(()=>{const{showMoreTelemetryInfo:e}=this.state;this.setState({showMoreTelemetryInfo:!e})})),Oe()(this,"onClickExample",(()=>{this.setState({showExample:!0}),this.closeReadMorePopover()})),Oe()(this,"onChangeOptIn",(e=>{const t=e.target.checked,{onOptInChange:n}=this.props;n(t)}))}render(){const{showMoreTelemetryInfo:e,showExample:t}=this.state,{isStartTrial:n,isOptingInToTelemetry:o,telemetry:s}=this.props;let i,u=null;t&&(u=Object(p.jsx)(a.a.Suspense,{fallback:Object(p.jsx)(he.EuiLoadingSpinner,null)},Object(p.jsx)(ye.LazyOptInExampleFlyout,{onClose:()=>this.setState({showExample:!1}),fetchExample:s.telemetryService.fetchExample}))),n||(i=Object(p.jsx)(r.Fragment,null,Object(p.jsx)(he.EuiSpacer,{size:"s"}),Object(p.jsx)(he.EuiTitle,{size:"s"},Object(p.jsx)("h4",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.telemetryOptIn.customersHelpSupportDescription",defaultMessage:"Help Elastic support provide better service"}))),Object(p.jsx)(he.EuiSpacer,{size:"s"})));const c=Object(p.jsx)(he.EuiLink,{onClick:this.onClickReadMore},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.telemetryOptIn.readMoreLinkText",defaultMessage:"Read more"})),l=Object(p.jsx)(he.EuiPopover,{ownFocus:!0,id:"readMorePopover",button:c,isOpen:e,closePopover:this.closeReadMorePopover,className:"eui-AlignBaseline"},Object(p.jsx)(he.EuiText,{className:"licManagement__narrowText"},Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.telemetryOptIn.featureUsageWarningMessage",defaultMessage:"This feature periodically sends basic feature usage statistics. This information will not be shared outside of Elastic. See an {exampleLink} or read our {telemetryPrivacyStatementLink}. You can disable this feature any time.",values:{exampleLink:Object(p.jsx)(he.EuiLink,{onClick:this.onClickExample},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.telemetryOptIn.exampleLinkText",defaultMessage:"example"})),telemetryPrivacyStatementLink:Object(p.jsx)(he.EuiLink,{href:s.telemetryConstants.getPrivacyStatementUrl(),target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.telemetryOptIn.telemetryPrivacyStatementLinkText",defaultMessage:"telemetry privacy statement"}))}}))));return Object(p.jsx)(r.Fragment,null,u,i,Object(p.jsx)(he.EuiCheckbox,{label:Object(p.jsx)("span",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.telemetryOptIn.sendBasicFeatureStatisticsLabel",defaultMessage:"Send basic feature usage statistics to Elastic periodically. {popover}",values:{popover:l}})),id:"isOptingInToTelemetry",checked:o,onChange:this.onChangeOptIn}))}}function Me(e){if(e){const{telemetryService:t}=e,n=t.getIsOptedIn();return t.getCanChangeOptInStatus()&&!n}return!1}class start_trial_StartTrial extends r.Component{constructor(...e){super(...e),Oe()(this,"cancelRef",void 0),Oe()(this,"confirmRef",void 0),Oe()(this,"state",{showConfirmation:!1,isOptingInToTelemetry:!1}),Oe()(this,"onOptInChange",(e=>{this.setState({isOptingInToTelemetry:e})})),Oe()(this,"onStartLicenseTrial",(()=>{const{telemetry:e,startLicenseTrial:t}=this.props;this.state.isOptingInToTelemetry&&e&&e.telemetryService.setOptIn(!0),t()})),Oe()(this,"cancel",(()=>{this.setState({showConfirmation:!1})}))}UNSAFE_componentWillMount(){this.props.loadTrialStatus()}acknowledgeModal(e){const{showConfirmation:t,isOptingInToTelemetry:n}=this.state,{telemetry:r}=this.props;return t?Object(p.jsx)(he.EuiModal,{className:"licManagement__modal",onClose:this.cancel},Object(p.jsx)(he.EuiModalHeader,null,Object(p.jsx)(he.EuiModalHeaderTitle,{"data-test-subj":"confirmModalTitleText"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalTitle",defaultMessage:"Start your free 30-day trial"}))),Object(p.jsx)(he.EuiModalBody,null,Object(p.jsx)(he.EuiText,{"data-test-subj":"confirmModalBodyText"},Object(p.jsx)("div",null,Object(p.jsx)(he.EuiText,null,Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription",defaultMessage:"This trial is for the full set of {subscriptionFeaturesLinkText} of the Elastic Stack. You'll get immediate access to:",values:{subscriptionFeaturesLinkText:Object(p.jsx)(he.EuiLink,{href:I.EXTERNAL_LINKS.SUBSCRIPTIONS,target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.subscriptionFeaturesLinkText",defaultMessage:"subscription features"}))}})),Object(p.jsx)("ul",null,Object(p.jsx)("li",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.mashingLearningFeatureTitle",defaultMessage:"Machine learning"})),Object(p.jsx)("li",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.alertingFeatureTitle",defaultMessage:"Alerting"})),Object(p.jsx)("li",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.graphCapabilitiesFeatureTitle",defaultMessage:"Graph capabilities"})),Object(p.jsx)("li",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.dataBaseConnectivityFeatureTitle",defaultMessage:"{jdbcStandard} and {odbcStandard} connectivity for {sqlDataBase}",values:{jdbcStandard:"JDBC",odbcStandard:"ODBC",sqlDataBase:"SQL"}}))),Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.securityFeaturesConfigurationDescription",defaultMessage:"Advanced security features, such as authentication ({authenticationTypeList}), field- and document-level security, and auditing, require configuration. See the {securityDocumentationLinkText} for instructions.",values:{authenticationTypeList:"AD/LDAP, SAML, PKI, SAML/SSO",securityDocumentationLinkText:Object(p.jsx)(he.EuiLink,{href:e.security,target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.securityDocumentationLinkText",defaultMessage:"documentation"}))}})),Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.termsAndConditionsDescription",defaultMessage:"By starting this trial, you agree that it is subject to these {termsAndConditionsLinkText}.",values:{termsAndConditionsLinkText:Object(p.jsx)(he.EuiLink,{href:I.EXTERNAL_LINKS.TRIAL_LICENSE,target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModalDescription.termsAndConditionsLinkText",defaultMessage:"terms and conditions"}))}})))))),Object(p.jsx)(he.EuiModalFooter,null,Object(p.jsx)(he.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center"},Object(p.jsx)(he.EuiFlexItem,{grow:!1},Me(r)&&Object(p.jsx)(telemetry_opt_in_TelemetryOptIn,{telemetry:r,isStartTrial:!0,onOptInChange:this.onOptInChange,isOptingInToTelemetry:n})),Object(p.jsx)(he.EuiFlexItem,{grow:!1,className:"licManagement__ieFlex"},Object(p.jsx)(he.EuiFlexGroup,{responsive:!1},Object(p.jsx)(he.EuiFlexItem,{grow:!1,className:"licManagement__ieFlex"},Object(p.jsx)(he.EuiButtonEmpty,{"data-test-subj":"confirmModalCancelButton",onClick:this.cancel,buttonRef:this.cancelRef},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}))),Object(p.jsx)(he.EuiFlexItem,{grow:!1,className:"licManagement__ieFlex"},Object(p.jsx)(he.EuiButton,{"data-test-subj":"confirmModalConfirmButton",onClick:this.onStartLicenseTrial,fill:!0,buttonRef:this.confirmRef,color:"primary"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.confirmModal.startTrialButtonLabel",defaultMessage:"Start my trial"})))))))):null}render(){const{shouldShowStartTrial:e}=this.props;if(!e)return null;const t=Object(p.jsx)("span",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.subscriptionFeaturesExperienceDescription",defaultMessage:"Experience what machine learning, advanced security, and all our other {subscriptionFeaturesLinkText} have to offer.",values:{subscriptionFeaturesLinkText:Object(p.jsx)(he.EuiLink,{href:I.EXTERNAL_LINKS.SUBSCRIPTIONS,target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.subscriptionFeaturesLinkText",defaultMessage:"subscription features"}))}})),n=Object(p.jsx)(he.EuiButton,{"data-test-subj":"startTrialButton",onClick:()=>this.setState({showConfirmation:!0})},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrial.startTrialButtonLabel",defaultMessage:"Start trial"}));return Object(p.jsx)(_,null,(e=>Object(p.jsx)(he.EuiFlexItem,null,this.acknowledgeModal(e.docLinks),Object(p.jsx)(he.EuiCard,{hasBorder:!0,title:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.startTrialTitle",defaultMessage:"Start a 30-day trial"}),description:t,footer:n}))))}}const Ee={loadTrialStatus:()=>async(e,t,{http:n})=>{const r=await function(e){return e.get(`${I.API_BASE_PATH}/start_trial`,{headers:{contentType:"application/json"},cache:"no-cache"})}(n);e(H(r))},startLicenseTrial:()=>async(e,t,{licensing:n,toasts:r,http:a})=>{const{trial_was_started:o,error_message:s}=await function(e){return e.post(`${I.API_BASE_PATH}/start_trial`,{headers:{contentType:"application/json"},cache:"no-cache"})}(a);if(!o)return r.addDanger(s);await n.refresh(),window.location.reload()}},_e=Object(x.connect)((e=>({shouldShowStartTrial:fe(e)})),Ee)(start_trial_StartTrial),Te=({license:e,...t})=>Object(p.jsx)(he.EuiPageHeader,i()({},t,{pageTitle:Object(p.jsx)("span",{"data-test-subj":"licenseText"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.licenseStatus.activeLicenseStatusTitle",defaultMessage:"Your {licenseType} license is {status}",values:{licenseType:e.type,status:e.status}})),description:Object(p.jsx)("span",{"data-test-subj":"licenseSubText"},e.expirationDate?Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.licenseStatus.activeLicenseStatusDescription",defaultMessage:"Your license will expire on {licenseExpirationDate}",values:{licenseExpirationDate:Object(p.jsx)("strong",null,e.expirationDate)}}):Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.licenseStatus.permanentActiveLicenseStatusDescription",defaultMessage:"Your license will never expire."}))})),Se=({license:e,...t})=>Object(p.jsx)(he.EuiPageHeader,i()({},t,{pageTitle:Object(p.jsx)("span",{"data-test-subj":"licenseText"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.licenseStatus.expiredLicenseStatusTitle",defaultMessage:"Your {licenseType} license has expired",values:{licenseType:e.type}})),description:Object(p.jsx)("span",{"data-test-subj":"licenseSubText"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.licenseStatus.expiredLicenseStatusDescription",defaultMessage:"Your license expired on {licenseExpirationDate}",values:{licenseExpirationDate:Object(p.jsx)("strong",null,e.expirationDate)}}))})),we=()=>{const e=Object(x.useSelector)(ge);return Object(p.jsx)(a.a.Fragment,null,e.isExpired?Object(p.jsx)(Se,{license:e,bottomBorder:!0,iconType:"warning",iconProps:{color:"danger"}}):Object(p.jsx)(Te,{license:e,bottomBorder:!0,iconType:"checkInCircleFilled",iconProps:{color:"success"}}),Object(p.jsx)(he.EuiSpacer,{size:"l"}))},Ce=({uploadPath:e="/upload_license"})=>{const{services:t}=(()=>{const e=Object(r.useContext)(M);if(!e)throw new Error('"useAppContext" can only be called inside of AppContext.Provider!');return e})();return Object(p.jsx)(he.EuiCard,{hasBorder:!0,title:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.addLicense.updateLicenseTitle",defaultMessage:"Update your license"}),description:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.addLicense.useAvailableLicenseDescription",defaultMessage:"If you already have a new license, upload it now."}),footer:Object(p.jsx)(he.EuiButton,i()({"data-test-subj":"updateLicenseButton"},Object(y.reactRouterNavigate)(t.history,e)),Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.addLicense.updateLicenseButtonLabel",defaultMessage:"Update license"}))})};class revert_to_basic_RevertToBasic extends a.a.PureComponent{constructor(...e){super(...e),Oe()(this,"cancel",(()=>{this.props.uploadLicenseStatus({})}))}acknowledgeModal(){const{needsAcknowledgement:e,messages:[t,...n]=[],startBasicLicense:r,cancelStartBasicLicense:a,licenseType:o}=this.props;return e?Object(p.jsx)(he.EuiConfirmModal,{title:C.i18n.translate("xpack.licenseMgmt.licenseDashboard.revertToBasic.confirmModalTitle",{defaultMessage:"Confirm Revert to Basic License"}),onCancel:a,onConfirm:()=>r(o,!0),cancelButtonText:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.revertToBasic.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.revertToBasic.confirmModal.confirmButtonLabel",defaultMessage:"Confirm"})},Object(p.jsx)("div",null,Object(p.jsx)(he.EuiText,null,t),Object(p.jsx)(he.EuiText,null,Object(p.jsx)("ul",null,n.map((e=>Object(p.jsx)("li",{key:e},e))))))):null}render(){const{licenseType:e,shouldShowRevertToBasicLicense:t,startBasicLicense:n}=this.props;if(!t)return null;const r=Object(p.jsx)("span",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.revertToBasic.revertToFreeFeaturesDescription",defaultMessage:"You’ll revert to our free features and lose access to machine learning, advanced security, and other {subscriptionFeaturesLinkText}.",values:{subscriptionFeaturesLinkText:Object(p.jsx)(he.EuiLink,{href:I.EXTERNAL_LINKS.SUBSCRIPTIONS,target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.revertToBasic.subscriptionFeaturesLinkText",defaultMessage:"subscription features"}))}}));return Object(p.jsx)(he.EuiFlexItem,null,this.acknowledgeModal(),Object(p.jsx)(he.EuiCard,{hasBorder:!0,title:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.revertToBasic.acknowledgeModalTitle",defaultMessage:"Revert to Basic license"}),description:r,footer:Object(p.jsx)(he.EuiButton,{"data-test-subj":"revertToBasicButton",onClick:()=>n(e)},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.revertToBasic.acknowledgeModal.revertToBasicButtonLabel",defaultMessage:"Revert to Basic"}))}))}}const Le={startBasicLicense:(e,t)=>async(n,r,{licensing:a,toasts:o,http:s})=>{const{acknowledged:i,basic_was_started:u,error_message:c,acknowledge:l}=await function(e,t){return e.post(`${I.API_BASE_PATH}/start_basic`,{query:{acknowledge:t?"true":""},headers:{contentType:"application/json"},body:null,cache:"no-cache"})}(s,t);if(i){if(!u)return o.addDanger(c);await a.refresh(),window.location.reload()}else{const t=Object.values(l).slice(1).map((e=>e[0])),r=C.i18n.translate("xpack.licenseMgmt.replacingCurrentLicenseWithBasicLicenseWarningMessage",{defaultMessage:"Some functionality will be lost if you replace your {currentLicenseType} license with a BASIC license. Review the list of features below.",values:{currentLicenseType:e.toUpperCase()}});n(B({acknowledge:!0,messages:[r,...t]}))}},cancelStartBasicLicense:U},Pe=Object(x.connect)((e=>({shouldShowRevertToBasicLicense:se(e),licenseType:ne(e),needsAcknowledgement:je(e),messages:be(e)})),Le)(revert_to_basic_RevertToBasic),ke=Object(x.connect)((e=>({shouldShowRequestTrialExtension:pe(e)})))((({shouldShowRequestTrialExtension:e})=>{if(!e)return null;const t=Object(p.jsx)("span",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.requestTrialExtension.howToContinueUsingPluginsDescription",defaultMessage:"If you’d like to continue using machine learning, advanced security, and our other awesome {subscriptionFeaturesLinkText}, request an extension now.",values:{subscriptionFeaturesLinkText:Object(p.jsx)(he.EuiLink,{href:I.EXTERNAL_LINKS.SUBSCRIPTIONS,target:"_blank"},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.requestTrialExtension.subscriptionFeaturesLinkText",defaultMessage:"subscription features"}))}}));return Object(p.jsx)(he.EuiFlexItem,null,Object(p.jsx)(he.EuiCard,{hasBorder:!0,title:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.requestTrialExtension.extendYourTrialTitle",defaultMessage:"Extend your trial"}),description:t,footer:Object(p.jsx)(he.EuiButton,{"data-test-subj":"extendTrialButton",target:"_blank",href:I.EXTERNAL_LINKS.TRIAL_EXTENSION},Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.licenseDashboard.requestTrialExtension.extendTrialButtonLabel",defaultMessage:"Extend trial"}))}))})),Ae=e=>(t,n,{breadcrumbService:r})=>{r.setBreadcrumbs(e)},Ie={setBreadcrumb:Ae},De=Object(x.connect)(null,Ie)((({setBreadcrumb:e,telemetry:t}={setBreadcrumb:()=>{}})=>(Object(r.useEffect)((()=>{e("dashboard")})),Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(we,null),Object(p.jsx)(he.EuiPageContentBody_Deprecated,null,Object(p.jsx)(he.EuiFlexGroup,{justifyContent:"spaceAround"},Object(p.jsx)(he.EuiFlexItem,null,Object(p.jsx)(Ce,null)),Object(p.jsx)(_e,{telemetry:t}),Object(p.jsx)(ke,null),Object(p.jsx)(Pe,null)))))));class upload_license_UploadLicense extends a.a.PureComponent{constructor(...e){super(...e),Oe()(this,"state",{isOptingInToTelemetry:!1}),Oe()(this,"onOptInChange",(e=>{this.setState({isOptingInToTelemetry:e})})),Oe()(this,"send",(e=>{const t=this.file,n=new FileReader;n.onload=({target:{result:t}})=>{var n;this.state.isOptingInToTelemetry&&(null===(n=this.props.telemetry)||void 0===n||n.telemetryService.setOptIn(!0)),this.props.uploadLicense(t,this.props.currentLicenseType,e)},n.readAsText(t)})),Oe()(this,"cancel",(()=>{this.props.uploadLicenseStatus({})})),Oe()(this,"handleFile",(([e])=>{e&&this.props.addUploadErrorMessage(""),this.file=e})),Oe()(this,"submit",(e=>{e.preventDefault(),this.file?this.send():this.props.addUploadErrorMessage(Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.licenseFileNotSelectedErrorMessage",defaultMessage:"You must select a license file."}))}))}componentDidMount(){this.props.setBreadcrumb("upload"),this.props.addUploadErrorMessage("")}acknowledgeModal(){const{needsAcknowledgement:e,messages:[t,...n]=[]}=this.props;return e?Object(p.jsx)(he.EuiConfirmModal,{title:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.confirmModalTitle",defaultMessage:"Confirm License Upload"}),onCancel:this.cancel,onConfirm:()=>this.send(!0),cancelButtonText:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.confirmModal.cancelButtonLabel",defaultMessage:"Cancel"}),confirmButtonText:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.confirmModal.confirmButtonLabel",defaultMessage:"Confirm"})},Object(p.jsx)("div",null,Object(p.jsx)(he.EuiText,null,t),Object(p.jsx)(he.EuiText,null,Object(p.jsx)("ul",null,n.map((e=>Object(p.jsx)("li",{key:e},e))))))):null}errorMessage(){const{errorMessage:e}=this.props;return e?[e]:null}render(){const{currentLicenseType:e,applying:t,telemetry:n,history:r}=this.props;return Object(p.jsx)(he.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(p.jsx)(he.EuiPageContentBody_Deprecated,null,Object(p.jsx)(he.EuiTitle,{size:"m"},Object(p.jsx)("h1",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.uploadLicenseTitle",defaultMessage:"Upload your license"}))),Object(p.jsx)(he.EuiSpacer,null),this.acknowledgeModal(),Object(p.jsx)(he.EuiText,null,Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.licenseKeyTypeDescription",defaultMessage:"Your license key is a JSON file with a signature attached."})),Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.replacingCurrentLicenseWarningMessage",defaultMessage:"Uploading a license will replace your current {currentLicenseType} license.",values:{currentLicenseType:Object(p.jsx)("strong",null,e.toUpperCase())}}))),Object(p.jsx)(he.EuiSpacer,null),Object(p.jsx)(he.EuiForm,{isInvalid:!!this.errorMessage(),error:this.errorMessage()},Object(p.jsx)(he.EuiFilePicker,{fullWidth:!0,id:"licenseFile",initialPromptText:Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.selectLicenseFileDescription",defaultMessage:"Select or drag your license file"}),onChange:this.handleFile}),Object(p.jsx)(he.EuiSpacer,{size:"m"}),Me(n)&&Object(p.jsx)(telemetry_opt_in_TelemetryOptIn,{isOptingInToTelemetry:this.state.isOptingInToTelemetry,onOptInChange:this.onOptInChange,telemetry:n}),Object(p.jsx)(he.EuiSpacer,{size:"m"}),Object(p.jsx)(he.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(p.jsx)(he.EuiFlexItem,{grow:!1},Object(p.jsx)(he.EuiButtonEmpty,i()({"data-test-subj":"cancelUploadButton"},Object(y.reactRouterNavigate)(r,"/home")),Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.cancelButtonLabel",defaultMessage:"Cancel"}))),Object(p.jsx)(he.EuiFlexItem,{grow:!1},Object(p.jsx)(he.EuiButton,{"data-test-subj":"uploadLicenseButton",fill:!0,isLoading:t,onClick:this.submit},t?Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.uploadingButtonLabel",defaultMessage:"Uploading…"}):Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.uploadLicense.uploadButtonLabel",defaultMessage:"Upload"})))))))}}const Fe={addUploadErrorMessage:D,uploadLicense:(e,t,n)=>async(r,a,o)=>{r(F({applying:!0}));let s=null;try{({type:s}=JSON.parse(e).license)}catch(e){return r(F({})),r(D(C.i18n.translate("xpack.licenseMgmt.uploadLicense.checkLicenseFileErrorMessage",{defaultMessage:"{genericUploadError} Check your license file.",values:{genericUploadError:R}})))}try{const a=await function(e,t,n){return e.put(I.API_BASE_PATH,{query:{acknowledge:n?"true":""},body:t,headers:{contentType:"application/json"},cache:"no-cache"})}(o.http,e,n);await(async(e,t,n,r,{history:a,licensing:o})=>{const{error:s,acknowledged:i,license_status:u,acknowledge:c}=e;if(s)t(F({})),t(D(`${R} ${s.reason}`));else if(i)if("invalid"===u)t(F({})),t(D(C.i18n.translate("xpack.licenseMgmt.uploadLicense.invalidLicenseErrorMessage",{defaultMessage:"The supplied license is not valid for this product."})));else if("expired"===u)t(F({})),t(D(C.i18n.translate("xpack.licenseMgmt.uploadLicense.expiredLicenseErrorMessage",{defaultMessage:"The supplied license has expired."})));else{const e=await o.refresh();t(k(e)),t(F({})),a.replace("/home"),window.location.reload()}else{const e=Object.values(c).slice(1),a=C.i18n.translate("xpack.licenseMgmt.uploadLicense.problemWithUploadedLicenseDescription",{defaultMessage:"Some functionality will be lost if you replace your {currentLicenseType} license with a {newLicenseType} license. Review the list of features below.",values:{currentLicenseType:n.toUpperCase(),newLicenseType:r.toUpperCase()}});t(F({acknowledge:!0,messages:[a,...e]}))}})(a,r,t,s,o)}catch(e){const t=e.responseJSON&&e.responseJSON.error.reason?e.responseJSON.error.reason:C.i18n.translate("xpack.licenseMgmt.uploadLicense.unknownErrorErrorMessage",{defaultMessage:"Unknown error."});r(F({})),r(D(`${R} ${t}`))}},uploadLicenseStatus:F,setBreadcrumb:Ae},Re=Object(x.connect)((e=>({isInvalid:le(e),needsAcknowledgement:ie(e),messages:ce(e),errorMessage:de(e),applying:ue(e),currentLicenseType:ne(e)||""})),Fe)(upload_license_UploadLicense);var Ne=n(3);const Be={loadPermissions:()=>async(e,t,{http:n})=>{e(Y(!0));try{const t=await function(e){return e.post(`${I.API_BASE_PATH}/permissions`,{headers:{contentType:"application/json"},cache:"no-cache"})}(n);e(Y(!1)),e(G(t.hasPermission))}catch(t){e(Y(!1)),e(W(t))}}},Ue=Object(u.withRouter)(Object(x.connect)((e=>({hasPermission:Z(e),permissionsLoading:Q(e),permissionsError:ee(e)})),Be)((({hasPermission:e,permissionsLoading:t,permissionsError:n,telemetry:a,loadPermissions:o,executionContext:s})=>{if(Object(y.useExecutionContext)(s,{type:"application",page:"licenseManagement"}),Object(r.useEffect)((()=>{o()}),[o]),t)return Object(p.jsx)(he.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(p.jsx)(O.SectionLoading,null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.app.loadingPermissionsDescription",defaultMessage:"Checking permissions…"})));if(n){var u;const e=null==n||null===(u=n.data)||void 0===u?void 0:u.message;return Object(p.jsx)(he.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"danger"},Object(p.jsx)(he.EuiEmptyPrompt,{iconType:"warning",title:Object(p.jsx)("h1",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.app.checkingPermissionsErrorMessage",defaultMessage:"Error checking permissions"})),body:e?Object(p.jsx)("p",null,e):null}))}if(!e)return Object(p.jsx)(he.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(p.jsx)(he.EuiEmptyPrompt,{iconType:"securityApp",title:Object(p.jsx)("h1",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.app.deniedPermissionTitle",defaultMessage:"Cluster privileges required"})),body:Object(p.jsx)("p",null,Object(p.jsx)(ve.FormattedMessage,{id:"xpack.licenseMgmt.app.deniedPermissionDescription",defaultMessage:"To use License Management, you must have {permissionType} privileges.",values:{permissionType:Object(p.jsx)("strong",null,I.APP_PERMISSION)}}))}));const c=e=>t=>Object(p.jsx)(e,i()({},t,{telemetry:a}));return Object(p.jsx)(he.EuiPageBody,null,Object(p.jsx)(h,null,Object(p.jsx)(j,{path:`/${Ne.b}`,component:c(Re)}),Object(p.jsx)(j,{path:["/"],component:c(De)})))}))),qe=e=>Object(p.jsx)(m,{history:e.history},Object(p.jsx)(Ue,e)),ze=(e,t)=>(Object(o.render)(Object(p.jsx)(me,{appDependencies:t},Object(p.jsx)(qe,{telemetry:t.plugins.telemetry,history:t.services.history,executionContext:t.core.executionContext})),e),()=>{Object(o.unmountComponentAtNode)(e)})}])]);