/*! 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. */!function(e){function t(t){for(var i,s,r=t[0],o=t[1],a=0,u=[];a{const i=Object(n.useContext)(o),s=Object(r.jsx)(u,{breadcrumb:t},e);return i?s:Object(r.jsx)(c,null,s)},c=({children:e,onChange:t})=>{const{services:i}=Object(s.useKibana)(),a=Object(n.useRef)([]),c=e=>{const n=e.map(((t,i)=>i===e.length-1?{...t,href:void 0}:t));t?t(n):i.chrome&&l(i.chrome)(n)};return Object(r.jsx)(o.Provider,{value:{parents:[],onMount:e=>{e.length>a.current.length&&(a.current=e,c(e))},onUnmount:e=>{e.length{const{parents:i,onMount:s,onUnmount:a}=Object(n.useContext)(o),c=[...i,e];return Object(n.useEffect)((()=>(s(c),()=>a(i))),[e.text,e.href]),Object(r.jsx)(o.Provider,{value:{parents:c,onMount:s,onUnmount:a}},t)};function l(e,t=e.setBreadcrumbs){return i=>{t(i),0===i.length?e.docTitle.reset():e.docTitle.change(function(e,t=2){return e.slice(0,t).reverse().map((({text:e})=>e))}(i))}}},function(e,t){e.exports=__kbnSharedDeps__.ReactDom},function(e,t,i){"use strict";i.d(t,"a",(function(){return p})),i.d(t,"b",(function(){return g})),i.d(t,"c",(function(){return v}));var n=i(13),s=i.n(n),r=i(2),o=i.n(r),a=i(12);const c={services:{}},u=Object(r.createContext)(c);var l=i(37),d=i.n(l),h=i(0);const p=({children:e,component:t,render:i,...n})=>{const c=Object(r.useMemo)((()=>{if(t)return e=>Object(h.jsx)(o.a.Fragment,null,Object(h.jsx)(f,null),Object(h.jsx)(t,e))}),[t]);if(c)return Object(h.jsx)(a.Route,s()({},n,{component:c}));if(i||"function"==typeof e){const t="function"==typeof e?e:i;return Object(h.jsx)(a.Route,s()({},n,{render:e=>Object(h.jsx)(o.a.Fragment,null,Object(h.jsx)(f,null),t(e))}))}return Object(h.jsx)(a.Route,n,Object(h.jsx)(f,null),e)},f=()=>{const{executionContext:e}=Object(r.useContext)(u).services,t=Object(a.useRouteMatch)();return function(e,t){d()((()=>(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 b=i(20);const g=({children:e,...t})=>Object(h.jsx)(a.Router,t,Object(h.jsx)(b.CompatRouter,null,e));var m=i(18);const v=({legacySwitch:e=!0,children:t})=>{const i=Object(a.useRouteMatch)();return e?Object(h.jsx)(a.Switch,null,t):Object(h.jsx)(b.Routes,null,r.Children.map(t,(e=>{if(o.a.isValidElement(e)&&e.type===p){var n;const s=Object(m.replace)(null==e?void 0:e.props.path,i.url+"/",""),r="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(h.jsx)(b.Route,{path:s,element:Object(h.jsx)(o.a.Fragment,null,Object(h.jsx)(f,null),(null==e||null===(n=e.props)||void 0===n?void 0:n.component)&&Object(h.jsx)(e.props.component,null)||r&&r()||t)})}return e})))}},function(e,t){e.exports=__kbnSharedDeps__.Rxjs},function(e,t,i){"use strict";i.d(t,"a",(function(){return n})),i.d(t,"b",(function(){return s})),i.d(t,"c",(function(){return r})),i.d(t,"d",(function(){return o})),i.d(t,"e",(function(){return a})),i.d(t,"h",(function(){return c})),i.d(t,"j",(function(){return u})),i.d(t,"g",(function(){return l})),i.d(t,"f",(function(){return d})),i.d(t,"m",(function(){return h})),i.d(t,"k",(function(){return p})),i.d(t,"i",(function(){return f})),i.d(t,"l",(function(){return b})),i.d(t,"n",(function(){return g}));const n="*",s="auth_provider_hint",r="auth_url_hash",o="provider",a="msg",c="next",u="kbn-session-error-reason",l=/^(?! )[a-zA-Z0-9 !"#$%&'()*+,\-./\\:;<=>?@\[\]^_`{|}~]*[a-zA-Z0-9!"#$%&'()*+,\-./\\:;<=>?@\[\]^_`{|}~]$/,d=1024,h=5e3,p=3e5,f=1e3,b=6e4,g="/internal/security/session"},function(e,t){e.exports=__kbnSharedDeps__.ReactRouterDom},function(e,t,i){e.exports=i(28)(1466)},function(e,t){e.exports=__kbnSharedDeps__.RxjsOperators},function(e,t,i){"use strict";i.d(t,"b",(function(){return r})),i.d(t,"d",(function(){return o})),i.d(t,"a",(function(){return a.a})),i.d(t,"e",(function(){return a.d})),i.d(t,"c",(function(){return a.c}));var n=i(27),s=i.n(n);const[r,o]=s()((({userProfiles:e,users:t})=>({userProfiles:e,users:t})));var a=i(17)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(23),s=i(2),r=n.__importDefault(i(43));t.default=function(e,t){var i=s.useState(t),n=i[0],o=i[1];return r.default((function(){var t=e.subscribe(o);return function(){return t.unsubscribe()}}),[e]),n}},function(e,t,i){"use strict";i.d(t,"a",(function(){return l})),i.d(t,"b",(function(){return d})),i.d(t,"c",(function(){return h})),i.d(t,"d",(function(){return p}));var n=i(27),s=i.n(n),r=i(30),o=i.n(r),a=i(16),c=i.n(a),u=i(15);const[l,d]=s()((({authc:e})=>e));function h(){const e=d();return o()(e.getCurrentUser,[e])}function p(e){const{userProfiles:t}=Object(u.d)(),i=c()(t.dataUpdates$);return o()((()=>t.getCurrent(e?{dataPath:e}:void 0)),[t,i])}},function(e,t){e.exports=__kbnSharedDeps__.Lodash},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n=i(4),s=i(2),r=i(5),o=i(32);const a=({featureId:e,tooltip:t})=>{const{save:i}=Object(o.a)(e);return function(e,t=[null==e?void 0:e.iconType,null==e?void 0:e.text,null==e?void 0:e.tooltip]){const{services:i}=Object(r.useKibana)();Object(s.useEffect)((()=>{if(e)return i.chrome.setBadge(e),()=>i.chrome.setBadge()}),t)}(i?void 0:{iconType:"glasses",text:n.i18n.translate("xpack.security.management.readonlyBadge.text",{defaultMessage:"Read only"}),tooltip:t},[i]),null}},function(e,t){e.exports=__kbnSharedDeps__.ReactRouterDomV5Compat},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));const n=e=>{try{return decodeURIComponent(e)}catch{return e}}},function(e,t,i){"use strict";i.d(t,"f",(function(){return a})),i.d(t,"g",(function(){return c})),i.d(t,"h",(function(){return s})),i.d(t,"b",(function(){return h})),i.d(t,"a",(function(){return p})),i.d(t,"o",(function(){return l})),i.d(t,"c",(function(){return d})),i.d(t,"d",(function(){return O})),i.d(t,"j",(function(){return v})),i.d(t,"l",(function(){return x})),i.d(t,"m",(function(){return m})),i.d(t,"n",(function(){return j})),i.d(t,"i",(function(){return y})),i.d(t,"k",(function(){return g})),i.d(t,"p",(function(){return S})),i.d(t,"e",(function(){return _}));var n=i(3);function s(e){return e.full_name||e.email||e.username}const r=97,o=2;function a(e,t){if(t&&t.color)return t.color;const i=s(e).codePointAt(0)||r;return n.VISUALIZATION_COLORS[i%n.VISUALIZATION_COLORS.length]}function c(e,t){if(t&&t.initials)return t.initials;const i=s(e).split(" "),n=Math.min(o,i.length);return i.splice(n,i.length),i.map((e=>e.substring(0,1))).join("")}const u=["reserved","native"];function l(e){return"anonymous"===e.authentication_provider.type}function d(e){return!l(e)&&"http"!==e.authentication_provider.type}function h(e){return u.includes(e.authentication_realm.type)&&!l(e)}function p(e,t){return"native"===e.authentication_realm.type&&t.management.security.users}var f=i(18),b=i(4);function g(e){var t,i;return null===(t=null===(i=e.transient_metadata)||void 0===i?void 0:i.enabled)||void 0===t||t}function m(e){var t,i;return null!==(t=null===(i=e.metadata)||void 0===i?void 0:i._reserved)&&void 0!==t&&t}function v(e){var t,i;return null!==(t=null===(i=e.metadata)||void 0===i?void 0:i._deprecated)&&void 0!==t&&t}function j(e){var t,i;return null!==(t=m(e)&&(null===(i=e.name)||void 0===i?void 0:i.endsWith("_system")))&&void 0!==t&&t}function y(e){var t,i;return null!==(t=m(e)&&((null===(i=e.name)||void 0===i?void 0:i.endsWith("_admin"))||"superuser"===e.name))&&void 0!==t&&t}function _(e){return b.i18n.translate("xpack.security.common.extendedRoleDeprecationNotice",{defaultMessage:"The {roleName} role is deprecated. {reason}",values:{roleName:e.name,reason:P(e)}})}function x(e){var t,i;return m(e)||(null!==(t=null===(i=e._transform_error)||void 0===i?void 0:i.length)&&void 0!==t?t:0)>0}function O(e){return Object(f.cloneDeep)(e)}function S(e){const t=O(e);return t.name="",t}function P(e){var t,i;return null!==(t=null===(i=e.metadata)||void 0===i?void 0:i._deprecated_reason)&&void 0!==t?t:""}},function(e,t){e.exports=__kbnSharedDeps__.TsLib},function(e,t,i){"use strict";i.r(t),i.d(t,"UserAPIClient",(function(){return n.UserAPIClient})),i.d(t,"usersManagementApp",(function(){return b}));var n=i(26),s=(i(2),i(8)),r=i(12),o=i(4),a=i(6),c=i(5),u=i(9),l=i(7),d=i(17),h=i(19),p=i(21),f=i(0);const b=Object.freeze({id:"users",create({authc:e,getStartServices:t}){const n=o.i18n.translate("xpack.security.management.usersTitle",{defaultMessage:"Users"});return{id:this.id,order:10,title:n,async mount({element:n,theme$:a,setBreadcrumbs:c,history:d}){const[[b],{UsersGridPage:m},{CreateUserPage:v,EditUserPage:j},{UserAPIClient:y},{RolesAPIClient:_}]=await Promise.all([t(),i.e(13).then(i.bind(null,306)),i.e(9).then(i.bind(null,303)),Promise.resolve().then(i.bind(null,26)),Promise.resolve().then(i.bind(null,31))]);return Object(s.render)(Object(f.jsx)(g,{services:b,theme$:a,history:d,authc:e,onChange:Object(l.c)(b.chrome,c)},Object(f.jsx)(h.a,{featureId:"users",tooltip:o.i18n.translate("xpack.security.management.users.readonlyTooltip",{defaultMessage:"Unable to create or edit users"})}),Object(f.jsx)(l.a,{text:o.i18n.translate("xpack.security.users.breadcrumb",{defaultMessage:"Users"}),href:"/"},Object(f.jsx)(u.c,null,Object(f.jsx)(u.a,{path:["/",""],exact:!0},Object(f.jsx)(m,{notifications:b.notifications,userAPIClient:new y(b.http),rolesAPIClient:new _(b.http),history:d,navigateToApp:b.application.navigateToApp,readOnly:!b.application.capabilities.users.save})),Object(f.jsx)(u.a,{path:"/create"},Object(f.jsx)(l.a,{text:o.i18n.translate("xpack.security.users.editUserPage.createBreadcrumb",{defaultMessage:"Create"}),href:"/create"},Object(f.jsx)(v,null))),Object(f.jsx)(u.a,{path:"/edit/:username",render:e=>{const t=Object(p.a)(e.match.params.username);return Object(f.jsx)(l.a,{text:t,href:`/edit/${encodeURIComponent(t)}`},Object(f.jsx)(j,{username:t}))}}),Object(f.jsx)(u.a,{path:"/edit"},Object(f.jsx)(r.Redirect,{to:"/create"}))))),n),()=>{Object(s.unmountComponentAtNode)(n)}}}}}),g=({services:e,theme$:t,history:i,authc:n,onChange:s,children:r})=>Object(f.jsx)(c.KibanaContextProvider,{services:e},Object(f.jsx)(d.a,{authc:n},Object(f.jsx)(a.I18nProvider,null,Object(f.jsx)(c.KibanaThemeProvider,{theme$:t},Object(f.jsx)(u.b,{history:i},Object(f.jsx)(l.b,{onChange:s},r))))))},function(e,t,i){"use strict";i.d(t,"a",(function(){return f})),i.d(t,"c",(function(){return _})),i.d(t,"d",(function(){return A})),i.d(t,"b",(function(){return C}));var n=i(13),s=i.n(n),r=i(3),o=i(2),a=i.n(o);const c=97,u=2;function l(e,t){if(t&&t.color)return t.color;const i=h(e).codePointAt(0)||c;return r.VISUALIZATION_COLORS[i%r.VISUALIZATION_COLORS.length]}function d(e,t){if(t&&t.initials)return t.initials;const i=h(e).split(" "),n=Math.min(u,i.length);return i.splice(n,i.length),i.map((e=>e.substring(0,1))).join("")}function h(e){return e.full_name||e.email||e.username}var p=i(0);const f=({user:e,avatar:t,...i})=>{const{euiTheme:n}=Object(r.useEuiTheme)();if(!e)return Object(p.jsx)(r.EuiAvatar,s()({name:"",color:n.colors.lightestShade,initials:"?"},i));const o=h(e);return null!=t&&t.imageUrl?Object(p.jsx)(r.EuiAvatar,s()({name:o,imageUrl:t.imageUrl,color:"plain"},i)):Object(p.jsx)(r.EuiAvatar,s()({name:o,initials:d(e,t),initialsLength:u,color:l(e,t)},i))};var b=i(4),g=i(6);const m="null",v=({selectedOptions:e,defaultOptions:t,options:i,onChange:n,onSearchChange:s,isLoading:c=!1,singleSelection:u=!1,limit:l,height:d,loadingMessage:h,noMatchesMessage:v,emptyMessage:_,errorMessage:x,searchPlaceholder:O,searchInputId:S,selectedStatusMessage:P,limitReachedMessage:C,nullOptionLabel:w,defaultOptionsLabel:A,clearButtonLabel:E})=>{const[k,M]=Object(o.useState)([]),[I,R]=Object(o.useState)(""),T=e?e.length:0,L=!!l&&T>=l,U=()=>{i||M((i=>{const n=[...i],s=e?e.filter((e=>!n.find((t=>y(t,e))))).map((e=>j(e,w))):[],r=t?t.filter((e=>!n.find((t=>y(t,e)))&&!s.find((t=>y(t,e))))).map((e=>j(e,w))):[];if(r.length){const e=(e=>{let t=e.findIndex((e=>e.isGroupLabel));return-1===t&&(t=e.push({label:null!=A?A:b.i18n.translate("userProfileComponents.userProfilesSelectable.defaultOptionsLabel",{defaultMessage:"Suggested"}),isGroupLabel:!0})-1),t})(n);n.splice(e,0,...s),n.push(...r)}else n.push(...s);return n}))};return Object(o.useEffect)((()=>{i?M(i.map((e=>j(e,w)))):(M([]),U())}),[i]),Object(o.useEffect)(U,[t,e]),Object(o.useEffect)((()=>{M((t=>t.map((t=>{if(e){var i;const n=void 0===e.find((e=>y(t,e)))?void 0:"on",s=!n&&L;return{...t,checked:n,disabled:s,prepend:t.data?Object(p.jsx)(f,{user:t.data.user,avatar:null===(i=t.data.data)||void 0===i?void 0:i.avatar,size:"s",isDisabled:s}):void 0}}return{...t,checked:void 0,disabled:void 0}}))))}),[i,t,e]),Object(p.jsx)(r.EuiSelectable,{options:k,onChange:t=>{if(!n)return;const i=t.filter((t=>!(t.isGroupLabel||"on"!==t.checked||e&&void 0!==e.find((e=>y(t,e)))))).map((e=>e.key===m?null:e.data));e&&!u&&e.forEach((e=>{const n=t.find((t=>y(t,e)));void 0!==n&&"on"!==n.checked||(n&&n.key===m?i.unshift(e):i.push(e))})),n(i)},style:{maxHeight:d},singleSelection:u,searchable:!0,searchProps:{placeholder:null!=O?O:b.i18n.translate("userProfileComponents.userProfilesSelectable.searchPlaceholder",{defaultMessage:"Search"}),value:I,onChange:e=>{R(e),null==s||s(e)},isLoading:c,isClearable:!c,id:S},isPreFiltered:!0,listProps:{onFocusBadge:!1},loadingMessage:h,noMatchesMessage:v,emptyMessage:_,errorMessage:x,renderOption:(e,t)=>e.user?Object(p.jsx)(r.EuiFlexGroup,{alignItems:"center",justifyContent:"spaceBetween",gutterSize:"s",responsive:!1},Object(p.jsx)(r.EuiFlexItem,null,Object(p.jsx)(r.EuiHighlight,{search:t},e.label)),e.user.email&&e.user.email!==e.label?Object(p.jsx)(r.EuiFlexItem,{grow:!1},Object(p.jsx)(r.EuiTextColor,{color:e.disabled?"disabled":"subdued"},t?Object(p.jsx)(r.EuiHighlight,{search:t},e.user.email):e.user.email)):void 0):Object(p.jsx)(r.EuiHighlight,{search:t},e.label)},((e,t)=>Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(r.EuiPanel,{hasShadow:!1,paddingSize:"s"},t,u?void 0:Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(r.EuiSpacer,{size:"s"}),Object(p.jsx)(r.EuiFlexGroup,{alignItems:"center",justifyContent:"spaceBetween",gutterSize:"s",responsive:!1},Object(p.jsx)(r.EuiFlexItem,{grow:!1},Object(p.jsx)(r.EuiText,{size:"xs",color:"subdued"},P?P(T):Object(p.jsx)(g.FormattedMessage,{id:"userProfileComponents.userProfilesSelectable.selectedStatusMessage",defaultMessage:"{count, plural, one {# user selected} other {# users selected}}",values:{count:T}}))),Object(p.jsx)(r.EuiFlexItem,{grow:!1},T?Object(p.jsx)(r.EuiButtonEmpty,{size:"xs",flush:"right",onClick:()=>null==n?void 0:n([]),style:{height:"1rem"}},null!=E?E:Object(p.jsx)(g.FormattedMessage,{id:"userProfileComponents.userProfilesSelectable.clearButtonLabel",defaultMessage:"Remove all users"})):void 0)))),l&&T>=l?Object(p.jsx)(a.a.Fragment,null,Object(p.jsx)(r.EuiHorizontalRule,{margin:"none"}),Object(p.jsx)(r.EuiCallOut,{title:C?C(l):Object(p.jsx)(g.FormattedMessage,{id:"userProfileComponents.userProfilesSelectable.limitReachedMessage",defaultMessage:"You've selected the maximum of {count, plural, one {# user} other {# users}}",values:{count:l}}),color:"warning",size:"s"})):void 0,Object(p.jsx)(r.EuiHorizontalRule,{margin:"none"}),e)))};function j(e,t){return e?{key:e.uid,label:h(e.user),data:e}:{key:m,label:null!=t?t:b.i18n.translate("userProfileComponents.userProfilesSelectable.nullOptionLabel",{defaultMessage:"No users"})}}function y(e,t){return e.key===(t?t.uid:m)}const _=({title:e,selectableProps:t,...i})=>{const n=Object(r.useGeneratedHtmlId)({prefix:"searchInput",conditionalId:t.searchInputId});return Object(p.jsx)(r.EuiPopover,s()({panelPaddingSize:"none",initialFocus:`#${n}`},i),Object(p.jsx)(r.EuiContextMenuPanel,{title:e},Object(p.jsx)(v,s()({},t,{searchInputId:n}))))};var x=i(16),O=i.n(x);const S=a.a.createContext(null),P=({children:e,...t})=>Object(p.jsx)(S.Provider,{value:t},e),C=({children:e,...t})=>{const{core:{notifications:i,theme:n},security:{userProfiles:s},toMountPoint:r}=t;return Object(p.jsx)(P,{userProfileApiClient:s,notifySuccess:({title:e,text:t},s)=>{const o={};null!=s&&s.durationMs&&(o.toastLifeTimeMs=s.durationMs),i.toasts.addSuccess({title:e,text:t?r(t,{theme$:n.theme$}):void 0},o)}},e)},w={notificationSuccess:{title:b.i18n.translate("userProfileComponents.updateUserProfile.notification.submitSuccessTitle",{defaultMessage:"Profile updated"}),pageReloadText:b.i18n.translate("userProfileComponents.updateUserProfile.notification.requiresPageReloadDescription",{defaultMessage:"One or more settings require you to reload the page to take effect."})}},A=({notificationSuccess:e={},pageReloadChecker:t}={})=>{const{userProfileApiClient:i,notifySuccess:n}=function(){const e=Object(o.useContext)(S);if(!e)throw new Error("UserProfilesContext is missing. Ensure your component or React root is wrapped with or .");return e}(),{userProfile$:s}=i,{enabled:a=!0,title:c=w.notificationSuccess.title,pageReloadText:u=w.notificationSuccess.pageReloadText}=e,[l,d]=Object(o.useState)(!1),h=O()(s),f=Object(o.useRef)(),g=Object(o.useCallback)((({isRefreshRequired:e=!1}={})=>{e?n({title:c,text:Object(p.jsx)(r.EuiFlexGroup,{justifyContent:"flexEnd",gutterSize:"s"},Object(p.jsx)(r.EuiFlexItem,{grow:!1},Object(p.jsx)("p",null,u),Object(p.jsx)(r.EuiButton,{size:"s",onClick:()=>window.location.reload(),"data-test-subj":"windowReloadButton"},b.i18n.translate("userProfileComponents.updateUserProfile.notification.requiresPageReloadButtonLabel",{defaultMessage:"Reload page"}))))},{durationMs:3e5}):n({title:c})}),[c,n,u]),m=Object(o.useCallback)((e=>{if(d(!1),a){const i=null==t?void 0:t(f.current,e);g({isRefreshRequired:i})}}),[a,g,t]);return{update:Object(o.useCallback)((e=>(f.current=h,d(!0),i.update(e).then((()=>m(e))))),[i,m,h]),showSuccessNotification:g,userProfileData:h,isLoading:l}}},function(e,t,i){"use strict";i.r(t),i.d(t,"UserAPIClient",(function(){return UserAPIClient}));const n="/internal/security/users";class UserAPIClient{constructor(e){this.http=e}async getUsers(){return await this.http.get(n)}async getUser(e){return await this.http.get(`${n}/${encodeURIComponent(e)}`)}async deleteUser(e){await this.http.delete(`${n}/${encodeURIComponent(e)}`)}async saveUser(e){await this.http.post(`${n}/${encodeURIComponent(e.username)}`,{body:JSON.stringify(e)})}async changePassword(e,t,i){const s={newPassword:t};i&&(s.password=i),await this.http.post(`${n}/${encodeURIComponent(e)}/password`,{body:JSON.stringify(s)})}async disableUser(e){await this.http.post(`${n}/${encodeURIComponent(e)}/_disable`)}async enableUser(e){await this.http.post(`${n}/${encodeURIComponent(e)}/_enable`)}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(2),s=!1,r={};t.default=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),o=1;o=0||(s[i]=e[i]);return s}(t,["children"]),o=e(r),c=s,u=0;u{const{roleName:n}=Object(s.useParams)(),o=n?Object(l.a)(n):void 0,a="edit"===i&&n&&o?{text:o,href:`/edit/${encodeURIComponent(n)}`}:{text:r.i18n.translate("xpack.security.roles.createBreadcrumb",{defaultMessage:"Create"})},u=null==_?void 0:_.ui;return Object(d.jsx)(c.a,{text:a.text,href:a.href},Object(d.jsx)(O,{action:i,roleName:o,rolesAPIClient:T,userAPIClient:new w(k),indicesAPIClient:new P(k),privilegesAPIClient:new C(k),getFeatures:y.getFeatures,http:k,notifications:I,fatalErrors:t,license:e,docLinks:E,uiCapabilities:A.capabilities,dataViews:j,history:m,spacesApiUi:u}))};return Object(n.render)(Object(d.jsx)(o.KibanaContextProvider,{services:v},Object(d.jsx)(M.Context,null,Object(d.jsx)(o.KibanaThemeProvider,{theme$:b},Object(d.jsx)(a.b,{history:m},Object(d.jsx)(u.a,{featureId:"roles",tooltip:r.i18n.translate("xpack.security.management.roles.readonlyTooltip",{defaultMessage:"Unable to create or edit roles"})}),Object(d.jsx)(c.b,{onChange:Object(c.c)(R,g)},Object(d.jsx)(c.a,{text:p,href:"/"},Object(d.jsx)(a.a,{path:["/",""],exact:!0},Object(d.jsx)(x,{notifications:I,rolesAPIClient:T,history:m,readOnly:!v.application.capabilities.roles.save})),Object(d.jsx)(a.a,{path:"/edit/:roleName?"},Object(d.jsx)(L,{action:"edit"})),Object(d.jsx)(a.a,{path:"/clone/:roleName"},Object(d.jsx)(L,{action:"clone"})))))))),f),()=>{Object(n.unmountComponentAtNode)(f)}}}}});var p=i(33)},function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var n=i(5);function s(e){const{services:t}=Object(n.useKibana)();return e?t.application.capabilities[e]:t.application.capabilities}},function(e,t,i){"use strict";i.r(t),i.d(t,"RolesAPIClient",(function(){return RolesAPIClient}));var n=i(22);class RolesAPIClient{constructor(e){this.http=e}async getRoles(){return await this.http.get("/api/security/role")}async getRole(e){return await this.http.get(`/api/security/role/${encodeURIComponent(e)}`)}async deleteRole(e){await this.http.delete(`/api/security/role/${encodeURIComponent(e)}`)}async saveRole({role:e,createOnly:t=!1}){await this.http.put(`/api/security/role/${encodeURIComponent(e.name)}`,{body:JSON.stringify(this.transformRoleForSave(Object(n.d)(e))),query:{createOnly:t}})}transformRoleForSave(e){var t,i;const n=e=>!("clusters"in e&&e.clusters&&e.clusters.length>0)&&0===e.names.length&&0===e.privileges.length;return e.elasticsearch.indices=e.elasticsearch.indices.filter((e=>!n(e))),e.elasticsearch.remote_indices=null===(t=e.elasticsearch.remote_indices)||void 0===t?void 0:t.filter((e=>!n(e))),e.elasticsearch.indices.forEach((e=>e.query||delete e.query)),null===(i=e.elasticsearch.remote_indices)||void 0===i||i.forEach((e=>e.query||delete e.query)),e.kibana.forEach((e=>{e.base.length>0&&(e.feature={})})),delete e.name,delete e.transient_metadata,delete e._unrecognized_applications,delete e._transform_error,e}}},function(e,t,i){"use strict";i.d(t,"b",(function(){return p})),i.d(t,"a",(function(){return f})),i.d(t,"c",(function(){return l})),i.d(t,"d",(function(){return u}));var n=i(2),s=i.n(n),r=i(16),o=i.n(r),a=i(0);const c=s.a.createContext(null),u=({children:e,...t})=>{const{navigateToUrl:i,currentAppId:n}=t;return Object(a.jsx)(c.Provider,{value:{navigateToUrl:i,currentAppId:n}},e)},l=({children:e,coreStart:t})=>{const{navigateToUrl:i,currentAppId$:n}=t.application,s=o()(n,void 0);return Object(a.jsx)(c.Provider,{value:{navigateToUrl:i,currentAppId:s}},e)};i(3),i(13);const d={name:"36bnqj",styles:"display:flex;flex:1"},h=({children:e,navigateToUrl:t,currentAppId:i})=>{const s=Object(n.useRef)(null),r=Object(n.useCallback)((e=>(({event:e,container:t,navigateToUrl:i,currentAppId:n})=>{if(!t||!n)return;const s=((e,t)=>{let i=e;do{var n,s;if("a"===(null===(n=i)||void 0===n?void 0:n.tagName.toLowerCase()))return i;const e=null===(s=i)||void 0===s?void 0:s.parentElement;if(!e||e===document.body||e===t)break;i=e}while(parent||parent!==document.body||parent!==t)})(e.target,t);if(!s)return;const r=s.href,o=""===s.target||"_self"===s.target,a=0===e.button;r&&o&&a&&!e.defaultPrevented&&!(e=>e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)(e)&&(e.preventDefault(),i(s.href))})({event:e,currentAppId:i,navigateToUrl:t,container:s.current})),[i,t]);return Object(a.jsx)("div",{onClick:r,ref:s,css:d},e)},p=({children:e})=>Object(a.jsx)(h,function(){const e=Object(n.useContext)(c);if(!e)throw new Error("RedirectAppLinksContext is missing. Ensure your component or React root is wrapped with RedirectAppLinksProvider.");return e}(),e),f=({children:e,...t})=>{const i=Object(a.jsx)(p,null,e);if(void 0!==t.coreStart){const{coreStart:e}=t;return Object(a.jsx)(l,{coreStart:e},i)}const{navigateToUrl:n,currentAppId:s}=t;return Object(a.jsx)(u,{currentAppId:s,navigateToUrl:n},i)}},function(e,t,i){"use strict";(function(e){i.d(t,"a",(function(){return Sha256}));var n=i(1),s=i.n(n);const r=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=new Array(64);class Sha256{constructor(){s()(this,"_a",void 0),s()(this,"_b",void 0),s()(this,"_c",void 0),s()(this,"_d",void 0),s()(this,"_e",void 0),s()(this,"_f",void 0),s()(this,"_g",void 0),s()(this,"_h",void 0),s()(this,"_block",void 0),s()(this,"_finalSize",void 0),s()(this,"_blockSize",void 0),s()(this,"_len",void 0),s()(this,"_s",void 0),s()(this,"_w",void 0),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._w=o,this._block=e.alloc(64),this._finalSize=56,this._blockSize=64,this._len=0,this._s=0}update(t,i){"string"==typeof t&&(i=i||"utf8",t=e.from(t,i));const n=this._len+=t.length;let s=this._s||0,r=0;const o=this._block;for(;s=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(t,this._blockSize-4),this._update(this._block),this._hash().toString(e)}_update(e){const t=this._w;let i,n=0|this._a,s=0|this._b,o=0|this._c,h=0|this._d,p=0|this._e,f=0|this._f,b=0|this._g,g=0|this._h;for(i=0;i<16;++i)t[i]=e.readInt32BE(4*i);for(;i<64;++i)t[i]=0|(((m=t[i-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10)+t[i-7]+d(t[i-15])+t[i-16];var m;for(let e=0;e<64;++e){const i=g+l(p)+a(p,f,b)+r[e]+t[e]|0,d=u(n)+c(n,s,o)|0;g=b,b=f,f=p,p=h+i|0,h=o,o=s,s=n,n=i+d|0}this._a=n+this._a|0,this._b=s+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=p+this._e|0,this._f=f+this._f|0,this._g=b+this._g|0,this._h=g+this._h|0}_hash(){const t=e.alloc(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t}}function a(e,t,i){return i^e&(t^i)}function c(e,t,i){return e&t|i&(e|t)}function u(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}}).call(this,i(45).Buffer)},function(e,t,i){i.r(t);var n=__kbnBundles__.get("entry/core/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(n))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(23),s=i(40),r=n.__importDefault(i(42));t.default=function(e,t){r.default(e,t,s.isDeepEqual)}},function(e,t,i){i(39),__kbnBundles__.define("plugin/security/public",i,46)},function(e,t,i){i.p=window.__kbnPublicPath__.security},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDeepEqual=t.off=t.on=t.isClient=void 0;var n=i(23).__importDefault(i(41));t.isClient="object"==typeof window,t.on=function(e){for(var t=[],i=1;iObject(c.unmountComponentAtNode)(e)}})}}),j=({services:e,theme$:t,history:i,authc:n,securityApiClients:s,onChange:r,children:o})=>Object(m.jsx)(h.KibanaContextProvider,{services:e},Object(m.jsx)(b.a,{authc:n},Object(m.jsx)(b.b,s,Object(m.jsx)(d.I18nProvider,null,Object(m.jsx)(h.KibanaThemeProvider,{theme$:t},Object(m.jsx)(p.b,{history:i},Object(m.jsx)(g.b,{onChange:r},Object(m.jsx)(f.b,{core:e,security:{userProfiles:s.userProfiles},toMountPoint:h.toMountPoint},o))))))));var y=i(18),_=i(10);class user_profile_api_client_UserProfileAPIClient{constructor(e){s()(this,"internalDataUpdates$",new _.Subject),s()(this,"dataUpdates$",this.internalDataUpdates$.asObservable()),s()(this,"_userProfile$",new _.BehaviorSubject(null)),s()(this,"userProfile$",this._userProfile$.asObservable()),this.http=e}getCurrent(e){return this.http.get("/internal/security/user_profile",{query:{dataPath:null==e?void 0:e.dataPath}}).then((e=>{var t;const i=null!==(t=null==e?void 0:e.data)&&void 0!==t?t:{},n=Object(y.merge)(this._userProfile$.getValue(),i);return this._userProfile$.next(n),e}))}bulkGet(e){return this.http.post("/internal/security/user_profile/_bulk_get",{body:JSON.stringify({...e,uids:[...e.uids]})})}suggest(e,t){return this.http.post(e,{body:JSON.stringify(t)})}update(e){const t=this._userProfile$.getValue();return this._userProfile$.next(e),this.http.post("/internal/security/user_profile/_data",{body:JSON.stringify(e)}).then((()=>{this.internalDataUpdates$.next(e)})).catch((e=>(this._userProfile$.next(t),Promise.reject(e))))}}var x=i(14),O=i(35);class analytics_service_AnalyticsService{constructor(){s()(this,"securityLicense",void 0),s()(this,"securityFeaturesSubscription",void 0)}setup({analytics:e,authc:t,cloudId:i,http:n,securityLicense:s}){this.securityLicense=s,!1===n.anonymousPaths.isAnonymous(window.location.pathname)&&function(e,t,i){e.registerContextProvider({name:"user_id",context$:Object(_.from)(t.getCurrentUser()).pipe(Object(_.map)((e=>e.elastic_cloud_user?{userId:e.username,isElasticCloudUser:!0}:{userId:i?`${i}:${e.username}`:e.username,isElasticCloudUser:!1})),Object(_.map)((({userId:e,isElasticCloudUser:t})=>{return{userId:(i=e,(new O.a).update(i,"utf8").digest("hex")),isElasticCloudUser:t};var i})),Object(_.catchError)((()=>Object(_.of)({userId:void 0,isElasticCloudUser:!1})))),schema:{userId:{type:"keyword",_meta:{description:"The user id scoped as seen by Cloud (hashed)",optional:!0}},isElasticCloudUser:{type:"boolean",_meta:{description:"`true` if the user is managed by ESS."}}}})}(e,t,i)}start({http:e}){this.securityFeaturesSubscription=this.securityLicense.features$.pipe(Object(_.filter)((({allowLogin:e})=>e)),Object(x.throttleTime)(5e3)).subscribe((async()=>{try{await analytics_service_AnalyticsService.recordAuthTypeAnalytics(e)}catch{}}))}stop(){this.securityFeaturesSubscription&&(this.securityFeaturesSubscription.unsubscribe(),this.securityFeaturesSubscription=void 0)}static async recordAuthTypeAnalytics(e){localStorage.setItem(analytics_service_AnalyticsService.AuthTypeInfoStorageKey,JSON.stringify(await e.post("/internal/security/analytics/_record_auth_type",{body:localStorage.getItem(analytics_service_AnalyticsService.AuthTypeInfoStorageKey)})))}}s()(analytics_service_AnalyticsService,"AuthTypeInfoStorageKey","kibana.security.userAuthType");const S=Object.freeze({isEnabled:!1,accessURLParameters:null});class anonymous_access_service_AnonymousAccessService{constructor(){s()(this,"internalService",void 0)}setup({share:e}){e.setAnonymousAccessServiceProvider((()=>this.internalService))}start({http:e}){this.internalService={getCapabilities:()=>e.get("/internal/security/anonymous_access/capabilities"),getState:()=>e.anonymousPaths.isAnonymous(window.location.pathname)?Promise.resolve(S):e.get("/internal/security/anonymous_access/state").catch((()=>S))}}}const P=Object.freeze({id:"security_access_agreement",create({application:e,getStartServices:t}){e.register({id:this.id,title:r.i18n.translate("xpack.security.accessAgreementAppTitle",{defaultMessage:"Access Agreement"}),chromeless:!0,appRoute:"/security/access_agreement",async mount({element:e,theme$:n}){const[[s],{renderAccessAgreementPage:r}]=await Promise.all([t(),Promise.all([i.e(0),i.e(1),i.e(2),i.e(11)]).then(i.bind(null,290))]);return r(s.i18n,{element:e,theme$:n},{http:s.http,notifications:s.notifications,fatalErrors:s.fatalErrors})}})}});var C=i(11);const w=Object.freeze({id:"security_capture_url",create({application:e,fatalErrors:t,http:n}){n.anonymousPaths.register("/internal/security/capture-url"),e.register({id:this.id,title:"Capture URL",chromeless:!0,appRoute:"/internal/security/capture-url",async mount(){try{const{parseNext:e}=await i.e(0).then(i.bind(null,95)),t=new URL(e(window.location.href,n.basePath.serverBasePath),window.location.origin);t.searchParams.append(C.c,window.location.hash),window.location.replace(t.toString())}catch(e){t.add(new Error(`Cannot parse current URL: ${e&&e.message}.`))}return()=>{}}})}}),A=Object.freeze({id:"security_logged_out",create({application:e,http:t,getStartServices:n}){t.anonymousPaths.register("/security/logged_out"),e.register({id:this.id,title:r.i18n.translate("xpack.security.loggedOutAppTitle",{defaultMessage:"Logged out"}),chromeless:!0,appRoute:"/security/logged_out",async mount({element:e,theme$:t}){const[[s],{renderLoggedOutPage:r}]=await Promise.all([n(),Promise.all([i.e(0),i.e(1),i.e(17)]).then(i.bind(null,291))]);return r(s.i18n,{element:e,theme$:t},{basePath:s.http.basePath,customBranding:s.customBranding})}})}}),E=Object.freeze({id:"security_login",create({application:e,http:t,getStartServices:n,config:s}){t.anonymousPaths.register("/login"),e.register({id:this.id,title:r.i18n.translate("xpack.security.loginAppTitle",{defaultMessage:"Login"}),chromeless:!0,appRoute:"/login",async mount({element:e,theme$:t}){const[[r],{renderLoginPage:o}]=await Promise.all([n(),Promise.all([i.e(2),i.e(7)]).then(i.bind(null,301))]);return o(r.i18n,{element:e,theme$:t},{customBranding:r.customBranding,http:r.http,notifications:r.notifications,fatalErrors:r.fatalErrors,loginAssistanceMessage:s.loginAssistanceMessage,sameSiteCookies:s.sameSiteCookies})}})}}),k=Object.freeze({id:"security_logout",create({application:e,http:t}){t.anonymousPaths.register("/logout"),e.register({id:this.id,title:r.i18n.translate("xpack.security.logoutAppTitle",{defaultMessage:"Logout"}),chromeless:!0,appRoute:"/logout",mount:async()=>(window.sessionStorage.clear(),window.localStorage.removeItem(analytics_service_AnalyticsService.AuthTypeInfoStorageKey),window.location.href=t.basePath.prepend(`/api/security/logout${window.location.search}`),()=>{})})}}),M=Object.freeze({id:"security_overwritten_session",create({application:e,authc:t,getStartServices:n}){e.register({id:this.id,title:r.i18n.translate("xpack.security.overwrittenSessionAppTitle",{defaultMessage:"Overwritten Session"}),chromeless:!0,appRoute:"/security/overwritten_session",async mount({element:e,theme$:s}){const[[r],{renderOverwrittenSessionPage:o}]=await Promise.all([n(),Promise.all([i.e(0),i.e(1),i.e(18)]).then(i.bind(null,292))]);return o(r.i18n,{element:e,theme$:s},{authc:t,basePath:r.http.basePath})}})}});class authentication_service_AuthenticationService{setup({application:e,fatalErrors:t,config:i,getStartServices:n,http:s}){const r=async()=>await s.get("/internal/security/me",{asSystemRequest:!0});return P.create({application:e,getStartServices:n}),w.create({application:e,fatalErrors:t,http:s}),E.create({application:e,config:i,getStartServices:n,http:s}),k.create({application:e,http:s}),A.create({application:e,getStartServices:n,http:s}),M.create({application:e,authc:{getCurrentUser:r},getStartServices:n}),{getCurrentUser:r,areAPIKeysEnabled:async()=>(await s.get("/internal/security/api_key/_enabled")).apiKeysEnabled}}}var I=i(17),R=i(19);const T=Object.freeze({id:"api_keys",create({authc:e,getStartServices:t}){return{id:this.id,order:30,title:r.i18n.translate("xpack.security.management.apiKeysTitle",{defaultMessage:"API keys"}),async mount({element:n,theme$:s,setBreadcrumbs:o,history:a}){const[[u],{APIKeysGridPage:l}]=await Promise.all([t(),Promise.all([i.e(3),i.e(4),i.e(15)]).then(i.bind(null,300))]);return Object(c.render)(Object(m.jsx)(L,{services:u,theme$:s,history:a,authc:e,onChange:Object(g.c)(u.chrome,o)},Object(m.jsx)(g.a,{text:r.i18n.translate("xpack.security.management.apiKeysTitle",{defaultMessage:"API keys"}),href:"/"},Object(m.jsx)(l,null))),n),()=>{Object(c.unmountComponentAtNode)(n)}}}}}),L=({services:e,theme$:t,history:i,authc:n,onChange:s,children:o})=>Object(m.jsx)(h.KibanaContextProvider,{services:e},Object(m.jsx)(I.a,{authc:n},Object(m.jsx)(d.I18nProvider,null,Object(m.jsx)(h.KibanaThemeProvider,{theme$:t},Object(m.jsx)(p.b,{history:i},Object(m.jsx)(R.a,{featureId:"api_keys",tooltip:r.i18n.translate("xpack.security.management.api_keys.readonlyTooltip",{defaultMessage:"Unable to create or edit API keys"})}),Object(m.jsx)(g.b,{onChange:s},o))))));var U=i(12),$=i(21);const F=Object.freeze({id:"role_mappings",create({getStartServices:e}){const t=r.i18n.translate("xpack.security.management.roleMappingsTitle",{defaultMessage:"Role Mappings"});return{id:this.id,order:40,title:t,async mount({element:n,theme$:s,setBreadcrumbs:o,history:a}){const[[u],{RoleMappingsGridPage:l},{EditRoleMappingPage:d},{RoleMappingsAPIClient:f},{RolesAPIClient:b}]=await Promise.all([e(),Promise.all([i.e(3),i.e(12)]).then(i.bind(null,302)),i.e(8).then(i.bind(null,299)),i.e(19).then(i.bind(null,293)),Promise.resolve().then(i.bind(null,31))]);u.chrome.docTitle.change(t);const v=new f(u.http),j=({action:e})=>{const{name:t}=Object(U.useParams)(),i=t?Object($.a)(t):void 0,n="edit"===e&&t&&i?{text:i,href:`/edit/${encodeURIComponent(t)}`}:{text:r.i18n.translate("xpack.security.roleMappings.createBreadcrumb",{defaultMessage:"Create"})};return Object(m.jsx)(g.a,{text:n.text,href:n.href},Object(m.jsx)(d,{action:e,name:i,roleMappingsAPI:v,rolesAPIClient:new b(u.http),notifications:u.notifications,docLinks:u.docLinks,history:a,readOnly:!u.application.capabilities.role_mappings.save}))};return Object(c.render)(Object(m.jsx)(h.KibanaContextProvider,{services:u},Object(m.jsx)(u.i18n.Context,null,Object(m.jsx)(h.KibanaThemeProvider,{theme$:s},Object(m.jsx)(p.b,{history:a},Object(m.jsx)(R.a,{"data-test-subj":"readOnlyBadge",featureId:"role_mappings",tooltip:r.i18n.translate("xpack.security.management.roleMappings.readonlyTooltip",{defaultMessage:"Unable to create or edit role mappings"})}),Object(m.jsx)(g.b,{onChange:Object(g.c)(u.chrome,o)},Object(m.jsx)(g.a,{text:t,href:"/"},Object(m.jsx)(p.a,{path:["/",""],exact:!0},Object(m.jsx)(l,{notifications:u.notifications,rolesAPIClient:new b(u.http),roleMappingsAPI:v,docLinks:u.docLinks,history:a,navigateToApp:u.application.navigateToApp,readOnly:!u.application.capabilities.role_mappings.save})),Object(m.jsx)(p.a,{path:"/edit/:name?"},Object(m.jsx)(j,{action:"edit"})),Object(m.jsx)(p.a,{path:"/clone/:name"},Object(m.jsx)(j,{action:"clone"})))))))),n),()=>{Object(c.unmountComponentAtNode)(n)}}}}});var B=i(31),z=i(24);class management_service_ManagementService{constructor(){s()(this,"license",void 0),s()(this,"licenseFeaturesSubscription",void 0),s()(this,"securitySection",void 0)}setup({getStartServices:e,management:t,authc:i,license:n,fatalErrors:s,uiConfig:r}){this.license=n,this.securitySection=t.sections.section.security,r&&!r.userManagementEnabled||this.securitySection.registerApp(z.usersManagementApp.create({authc:i,getStartServices:e})),r&&!r.roleManagementEnabled||this.securitySection.registerApp(B.rolesManagementApp.create({fatalErrors:s,license:n,getStartServices:e})),this.securitySection.registerApp(T.create({authc:i,getStartServices:e})),r&&!r.roleMappingManagementEnabled||this.securitySection.registerApp(F.create({getStartServices:e}))}start({capabilities:e,uiConfig:t}){this.licenseFeaturesSubscription=this.license.features$.subscribe((async i=>{const n=this.securitySection,s=[[n.getApp(T.id),i.showLinks]];t&&!t.userManagementEnabled||s.push([n.getApp(z.usersManagementApp.id),i.showLinks]),t&&!t.roleManagementEnabled||s.push([n.getApp(B.rolesManagementApp.id),i.showLinks]),t&&!t.roleMappingManagementEnabled||s.push([n.getApp(F.id),i.showLinks&&i.showRoleMappingsManagement]);for(const[t,i]of s)!0===e.management.security[t.id]?t.enabled!==i&&(i?t.enable():t.disable()):t.disable()}))}stop(){this.licenseFeaturesSubscription&&(this.licenseFeaturesSubscription.unsubscribe(),this.licenseFeaturesSubscription=void 0)}}var D=i(26),N=i(34),K=i(3),V=i(16),H=i.n(V),q=i(22);const G=({items:e})=>Object(m.jsx)(a.a.Fragment,null,Object(m.jsx)(K.EuiContextMenuPanel,null,e.map(((e,t)=>e.content?Object(m.jsx)(o.Fragment,{key:t},e.content):Object(m.jsx)(K.EuiContextMenuItem,{key:t,icon:e.icon,size:"s",href:e.href,"data-test-subj":e["data-test-subj"]},e.name))))),W=({editProfileUrl:e,logoutUrl:t,userMenuLinks$:i,buildFlavour:n})=>{const s=H()(i,[]),[a,c]=Object(o.useState)(!1),u=Object(b.e)("avatar,userSettings"),l=Object(b.c)(),h=l.value?Object(q.h)(l.value):"",p=Object(m.jsx)(K.EuiHeaderSectionItemButton,{"aria-controls":"headerUserMenu","aria-expanded":a,"aria-haspopup":"true","aria-label":r.i18n.translate("xpack.security.navControlComponent.accountMenuAriaLabel",{defaultMessage:"Account menu"}),onClick:()=>c((e=>!!l.value&&!e)),"data-test-subj":"userMenuButton",style:{lineHeight:"normal"}},u.value?Object(m.jsx)(f.a,{user:u.value.user,avatar:u.value.data.avatar,size:"s","data-test-subj":"userMenuAvatar"}):l.value&&u.error?Object(m.jsx)(f.a,{user:l.value,size:"s","data-test-subj":"userMenuAvatar"}):Object(m.jsx)(K.EuiLoadingSpinner,{size:"m"})),g=[];if(s.length){const e=s.sort((({order:e=1/0},{order:t=1/0})=>e-t)).map((({label:e,iconType:t,href:i,content:n})=>({name:e,icon:Object(m.jsx)(K.EuiIcon,{type:t,size:"m"}),href:i,"data-test-subj":`userMenuLink__${e}`,content:n})));g.push(...e)}const v=!!l.value&&Object(q.o)(l.value),j=s.some((({setAsProfile:e})=>!0===e));if(!v&&!j){const t={name:Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.navControlComponent.editProfileLinkText",defaultMessage:"Edit profile"}),icon:Object(m.jsx)(K.EuiIcon,{type:"user",size:"m"}),href:e,onClick:()=>{c(!1)},"data-test-subj":"profileLink"};g.unshift(t)}return g.push({name:v?Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.navControlComponent.loginLinkText",defaultMessage:"Log in"}):"serverless"===n?Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.navControlComponent.closeProjectLinkText",defaultMessage:"Close project"}):Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.navControlComponent.logoutLinkText",defaultMessage:"Log out"}),icon:Object(m.jsx)(K.EuiIcon,{type:"exit",size:"m"}),href:t,"data-test-subj":"logoutLink"}),Object(m.jsx)(K.EuiPopover,{id:"headerUserMenu",ownFocus:!0,button:p,isOpen:a,anchorPosition:"downRight",repositionOnScroll:!0,closePopover:()=>c(!1),panelPaddingSize:"none",buffer:0},Object(m.jsx)("div",{"data-test-subj":"userMenu"},Object(m.jsx)(K.EuiContextMenu,{className:"chrNavControl__userMenu",initialPanelId:0,panels:[{id:0,title:h,content:Object(m.jsx)(G,{items:g})}]})))};class nav_control_service_SecurityNavControlService{constructor(e){s()(this,"securityLicense",void 0),s()(this,"logoutUrl",void 0),s()(this,"securityApiClients",void 0),s()(this,"navControlRegistered",void 0),s()(this,"securityFeaturesSubscription",void 0),s()(this,"stop$",new _.ReplaySubject(1)),s()(this,"userMenuLinks$",new _.BehaviorSubject([])),this.buildFlavor=e}setup({securityLicense:e,logoutUrl:t,securityApiClients:i}){this.securityLicense=e,this.logoutUrl=t,this.securityApiClients=i}start({core:e,authc:t}){return this.securityFeaturesSubscription=this.securityLicense.features$.subscribe((({showLinks:i})=>{!e.http.anonymousPaths.isAnonymous(window.location.pathname)&&i&&!this.navControlRegistered&&this.registerSecurityNavControl(e,t)})),{getUserMenuLinks$:()=>this.userMenuLinks$.pipe(Object(x.map)(this.sortUserMenuLinks),Object(x.takeUntil)(this.stop$)),addUserMenuLinks:e=>{const t=this.userMenuLinks$.value,i=t.find((({setAsProfile:e})=>!0===e)),n=e.filter((({setAsProfile:e})=>!0===e)).length;if(i&&n>0)throw new Error(`Only one custom profile link can be set. A custom profile link named ${i.label} (${i.href}) already exists`);if(n>1)throw new Error(`Only one custom profile link can be passed at a time (found ${n})`);const s=[...t,...e];this.userMenuLinks$.next(s)}}}stop(){this.securityFeaturesSubscription&&(this.securityFeaturesSubscription.unsubscribe(),this.securityFeaturesSubscription=void 0),this.navControlRegistered=!1,this.stop$.next()}registerSecurityNavControl(e,t){const{theme$:i}=e.theme;e.chrome.navControls.registerRight({order:4e3,mount:n=>(u.a.render(Object(m.jsx)(J,{services:e,authc:t,theme$:i,securityApiClients:this.securityApiClients},Object(m.jsx)(W,{editProfileUrl:e.http.basePath.prepend("/security/account"),logoutUrl:this.logoutUrl,userMenuLinks$:this.userMenuLinks$,buildFlavour:this.buildFlavor})),n),()=>u.a.unmountComponentAtNode(n))}),this.navControlRegistered=!0}sortUserMenuLinks(e){return Object(y.sortBy)(e,"order")}}const J=({authc:e,services:t,theme$:i,securityApiClients:n,children:s})=>Object(m.jsx)(h.KibanaContextProvider,{services:t},Object(m.jsx)(b.a,{authc:e},Object(m.jsx)(b.b,n,Object(m.jsx)(d.I18nProvider,null,Object(m.jsx)(h.KibanaThemeProvider,{theme$:i},Object(m.jsx)(N.a,{coreStart:t},s)))))),Y=r.i18n.translate("xpack.security.checkup.insecureClusterTitle",{defaultMessage:"Your data is not secure"}),Z=(e,t)=>i=>(Object(c.render)(Object(m.jsx)((()=>{const[i,n]=Object(o.useState)(!1),s=`${e.links.security.elasticsearchEnableSecurity}?blade=kibanasecuritymessage`;return Object(m.jsx)(d.I18nProvider,null,Object(m.jsx)("div",{"data-test-subj":"insecureClusterAlertText"},Object(m.jsx)(K.EuiText,{size:"s"},Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.checkup.insecureClusterMessage",defaultMessage:"Don’t lose one bit. Enable our free security features."})),Object(m.jsx)(K.EuiSpacer,null),Object(m.jsx)(K.EuiCheckbox,{id:"persistDismissedAlertPreference",checked:i,onChange:e=>n(e.target.checked),label:r.i18n.translate("xpack.security.checkup.dontShowAgain",{defaultMessage:"Don't show again"})}),Object(m.jsx)(K.EuiSpacer,null),Object(m.jsx)(K.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(m.jsx)(K.EuiFlexItem,{grow:!1},Object(m.jsx)(K.EuiButton,{size:"s",color:"primary",fill:!0,href:s,target:"_blank","data-test-subj":"learnMoreButton"},r.i18n.translate("xpack.security.checkup.enableButtonText",{defaultMessage:"Enable security"}))),Object(m.jsx)(K.EuiFlexItem,{grow:!1},Object(m.jsx)(K.EuiButton,{size:"s",onClick:()=>t(i),"data-test-subj":"dismissAlertButton"},r.i18n.translate("xpack.security.checkup.dismissButtonText",{defaultMessage:"Dismiss"}))))))}),null),i),()=>Object(c.unmountComponentAtNode)(i)),X=Object.freeze({displayAlert:!1});class security_checkup_service_SecurityCheckupService{constructor(e,t){s()(this,"enabled",void 0),s()(this,"alertVisibility$",void 0),s()(this,"storage",void 0),s()(this,"alertToast",void 0),s()(this,"storageKey",void 0),this.storage=t,this.enabled=e.showInsecureClusterWarning,this.alertVisibility$=new _.BehaviorSubject(this.enabled)}setup({http:e}){const t=e.basePath.serverBasePath;this.storageKey=`insecureClusterWarningVisibility${t}`,this.enabled=this.enabled&&this.getPersistedVisibilityPreference(),this.alertVisibility$.next(this.enabled)}start(e){this.enabled&&this.initializeAlert(e)}initializeAlert({http:e,notifications:t,docLinks:i}){const n=Object(_.from)(this.getSecurityCheckupState(e));Object(_.combineLatest)([n,this.alertVisibility$]).pipe(Object(x.map)((([{displayAlert:e},t])=>e&&t)),Object(x.distinctUntilChanged)()).subscribe((e=>{e&&!this.alertToast?this.alertToast=t.toasts.addWarning({title:Y,text:Z(i,(e=>this.setAlertVisibility(!1,e))),iconType:"warning"},{toastLifeTimeMs:864e6}):!e&&this.alertToast&&(t.toasts.remove(this.alertToast),this.alertToast=void 0)}))}getSecurityCheckupState(e){return e.anonymousPaths.isAnonymous(window.location.pathname)?Promise.resolve(X):e.get("/internal/security/security_checkup/state").catch((()=>X))}setAlertVisibility(e,t){this.enabled&&(this.alertVisibility$.next(e),t&&this.setPersistedVisibilityPreference(e))}getPersistedVisibilityPreference(){var e;const t=null!==(e=this.storage.getItem(this.storageKey))&&void 0!==e?e:"{}";try{const{show:e=!0}=JSON.parse(t);return e}catch(e){return!0}}setPersistedVisibilityPreference(e){this.storage.setItem(this.storageKey,JSON.stringify({show:e}))}}class session_expired_SessionExpired{constructor(e,t,i){this.application=e,this.logoutUrl=t,this.tenant=i}logout(e){const t=(()=>{const{location:e}=window,t=encodeURIComponent(`${e.pathname}${e.search}${e.hash}`);return`&${C.h}=${t}`})(),i=(e=>{const t=`${this.tenant}/session_provider`,i=sessionStorage.getItem(t);return i?`&${C.d}=${encodeURIComponent(i)}`:""})();this.application.navigateToUrl(`${this.logoutUrl}?${C.e}=${e}${t}${i}`,{forceRedirect:!0,skipAppLeave:!0})}}var Q=i(29),ee=i.n(Q);const te=({sessionState$:e,onExtend:t})=>{const i=H()(e),[{loading:n},s]=ee()(t);if(!i||!i.expiresInMs)return null;const r=Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.sessionExpirationToast.body",defaultMessage:"You will be logged out {timeout}.",values:{timeout:Object(m.jsx)(d.FormattedRelative,{value:Math.max(i.expiresInMs-C.m,0)+Date.now(),updateInterval:1e3})}});return i.canBeExtended?Object(m.jsx)(a.a.Fragment,null,r,Object(m.jsx)(K.EuiSpacer,{size:"m"}),Object(m.jsx)(K.EuiFlexGroup,{justifyContent:"flexEnd",gutterSize:"s"},Object(m.jsx)(K.EuiFlexItem,{grow:!1},Object(m.jsx)(K.EuiButton,{size:"s",color:"warning",isLoading:n,onClick:s},Object(m.jsx)(d.FormattedMessage,{id:"xpack.security.sessionExpirationToast.extendButton",defaultMessage:"Stay logged in"}))))):r};let ie;!function(e){e.SESSION_EXPIRED="SESSION_EXPIRED",e.CONCURRENCY_LIMIT="CONCURRENCY_LIMIT",e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.LOGGED_OUT="LOGGED_OUT",e.UNAUTHENTICATED="UNAUTHENTICATED"}(ie||(ie={}));class session_timeout_SessionTimeout{constructor(e,t,i,n){s()(this,"channel",void 0),s()(this,"isVisible","hidden"!==document.visibilityState),s()(this,"isFetchingSessionInfo",!1),s()(this,"consecutiveErrorCount",0),s()(this,"snoozedWarningState",void 0),s()(this,"sessionState$",new _.BehaviorSubject({lastExtensionTime:0,expiresInMs:null,canBeExtended:!1})),s()(this,"subscription",void 0),s()(this,"warningToast",void 0),s()(this,"stopActivityMonitor",void 0),s()(this,"stopVisibilityMonitor",void 0),s()(this,"removeHttpInterceptor",void 0),s()(this,"stopRefreshTimer",void 0),s()(this,"stopWarningTimer",void 0),s()(this,"stopLogoutTimer",void 0),s()(this,"handleChannelMessage",(e=>{this.isSessionState(e.data)&&this.sessionState$.next(e.data)})),s()(this,"isSessionState",(e=>"object"==typeof e&&Object.hasOwn(null!=e?e:{},"canBeExtended"))),s()(this,"handleHttpRequest",(e=>{if(-1===e.path.indexOf("://")&&!e.path.startsWith("//"))return e.asSystemRequest?void 0:{...e,asSystemRequest:!this.isVisible}})),s()(this,"handleUserActivity",(()=>{this.shouldExtend()&&this.fetchSessionInfo(!0)})),s()(this,"handleVisibilityChange",(e=>{this.isVisible=e,e&&this.handleUserActivity()})),s()(this,"resetTimers",(({lastExtensionTime:e,expiresInMs:t})=>{var i,n,s;if(this.stopRefreshTimer=null===(i=this.stopRefreshTimer)||void 0===i?void 0:i.call(this),this.stopWarningTimer=null===(n=this.stopWarningTimer)||void 0===n?void 0:n.call(this),this.stopLogoutTimer=null===(s=this.stopLogoutTimer)||void 0===s?void 0:s.call(this),null!==t){const i=Math.max(t-C.m,0),n=Math.max(i-C.k,this.snoozedWarningState?this.snoozedWarningState.lastExtensionTime+this.snoozedWarningState.expiresInMs-C.m-e:0,0),s=n-C.i;this.stopLogoutTimer=ne((()=>this.sessionExpired.logout(ie.SESSION_EXPIRED)),i),n>0&&this.hideWarning(),n0&&s{var i,n,s;null!==e?(t&&!this.stopActivityMonitor&&(this.stopActivityMonitor=function(e){const t=["mousemove","mousedown","wheel","touchstart","keydown"];for(const i of t)window.addEventListener(i,e);return()=>{for(const i of t)window.removeEventListener(i,e)}}(this.handleUserActivity)),this.removeHttpInterceptor||(this.removeHttpInterceptor=this.http.intercept({request:this.handleHttpRequest})),this.stopVisibilityMonitor||(this.stopVisibilityMonitor=function(e){const t=()=>e("hidden"!==document.visibilityState);return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}(this.handleVisibilityChange))):(this.removeHttpInterceptor=null===(i=this.removeHttpInterceptor)||void 0===i?void 0:i.call(this),this.stopActivityMonitor=null===(n=this.stopActivityMonitor)||void 0===n?void 0:n.call(this),this.stopVisibilityMonitor=null===(s=this.stopVisibilityMonitor)||void 0===s?void 0:s.call(this))})),s()(this,"fetchSessionInfo",(async(e=!1)=>{this.isFetchingSessionInfo=!0;try{const t=await this.http.fetch(C.n,{method:e?"POST":"GET",asSystemRequest:!e});if(this.consecutiveErrorCount=0,t){const{expiresInMs:e,canBeExtended:i}=t,n={lastExtensionTime:Date.now(),expiresInMs:e,canBeExtended:i};return this.sessionState$.next(n),this.channel&&this.channel.postMessage(n),n}}catch(e){this.consecutiveErrorCount++}finally{this.isFetchingSessionInfo=!1}})),s()(this,"showWarning",(()=>{if(!this.warningToast){const e=async()=>{const{canBeExtended:e}=this.sessionState$.getValue();e&&await this.fetchSessionInfo(!0)},t=()=>(this.hideWarning(!0),e()),i=((e,t,i)=>({color:"warning",iconType:"clock",title:r.i18n.translate("xpack.security.sessionExpirationToast.title",{defaultMessage:"Session timeout"}),text:Object(h.toMountPoint)(Object(m.jsx)(te,{sessionState$:e,onExtend:t})),onClose:i,toastLifeTimeMs:2147483647}))(this.sessionState$,e,t);this.warningToast=this.notifications.toasts.add(i)}})),s()(this,"hideWarning",((e=!1)=>{this.warningToast&&(this.notifications.toasts.remove(this.warningToast),this.warningToast=void 0,e&&(this.snoozedWarningState=this.sessionState$.getValue()))})),this.notifications=e,this.sessionExpired=t,this.http=i,this.tenant=n}async start(){if(!this.http.anonymousPaths.isAnonymous(window.location.pathname)){this.subscription=this.sessionState$.pipe(Object(x.skip)(1),Object(x.throttleTime)(1e3),Object(x.tap)(this.toggleEventHandlers)).subscribe(this.resetTimers);try{this.channel=new BroadcastChannel(`${this.tenant}/session_timeout`),this.channel.onmessage=e=>this.handleChannelMessage(e)}catch(e){console.warn("Failed to load broadcast channel. Session management will not be kept in sync when multiple tabs are loaded.",e)}return this.fetchSessionInfo()}}stop(){var e,t;const i={lastExtensionTime:0,expiresInMs:null,canBeExtended:!1};this.toggleEventHandlers(i),this.resetTimers(i),null===(e=this.subscription)||void 0===e||e.unsubscribe(),null===(t=this.channel)||void 0===t||t.close()}shouldExtend(){const{lastExtensionTime:e}=this.sessionState$.getValue();return!this.isFetchingSessionInfo&&!this.warningToast&&Date.now()>e+C.l*Math.exp(this.consecutiveErrorCount)}}function ne(e,t,i){var n;const s=2147483647;let r;return(i=null!==(n=i)&&void 0!==n?n:e=>r=e)(t>s?window.setTimeout((()=>ne(e,t-s,i)),s):window.setTimeout(e,t)),()=>clearTimeout(r)}class unauthorized_response_http_interceptor_UnauthorizedResponseHttpInterceptor{constructor(e,t){this.sessionExpired=e,this.anonymousPaths=t}responseError(e,t){if(this.anonymousPaths.isAnonymous(window.location.pathname))return;if("omit"===e.request.credentials)return;const{response:i}=e;if(i&&401===i.status){const e=i.headers.get(C.j);this.sessionExpired.logout(e===ie.SESSION_EXPIRED||e===ie.CONCURRENCY_LIMIT?e:ie.AUTHENTICATION_ERROR),t.halt()}}}var se=i(13),re=i.n(se);class suspense_error_boundary_SuspenseErrorBoundary extends o.Component{constructor(...e){super(...e),s()(this,"state",{error:null})}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){const{notifications:t}=this.props;if(t){const i=r.i18n.translate("xpack.security.uiApi.errorBoundaryToastTitle",{defaultMessage:"Failed to load Kibana asset"}),n=r.i18n.translate("xpack.security.uiApi.errorBoundaryToastMessage",{defaultMessage:"Reload page to continue."});t.toasts.addError(e,{title:i,toastMessage:n})}}render(){const{children:e,notifications:t}=this.props,{error:i}=this.state;return!t||i?null:Object(m.jsx)(o.Suspense,{fallback:Object(m.jsx)(K.EuiLoadingSpinner,null)},e)}}const oe=({fn:e,core:t,props:i})=>{const{notifications:n}=t,s=Object(o.useMemo)((()=>Object(o.lazy)((()=>e().then((e=>({default:e})))))),[e]);return n?Object(m.jsx)(suspense_error_boundary_SuspenseErrorBoundary,{notifications:n},Object(m.jsx)(s,i)):null},ae=async()=>{const{PersonalInfo:e}=await i.e(22).then(i.bind(null,297));return t=>Object(m.jsx)(e,t)},ce=({core:e})=>{function t(t){return i=>Object(m.jsx)(oe,{fn:t,core:e,props:i})}return{getPersonalInfo:t(ae),getChangePassword:t((()=>(async e=>{const{ChangePassword:t}=await i.e(16).then(i.bind(null,296));return i=>Object(m.jsx)(t,re()({notifications:e.notifications,userAPIClient:new z.UserAPIClient(e.http)},i))})(e)))}},ue=({core:e})=>({components:ce({core:e})});class license_service_SecurityLicenseService{constructor(){s()(this,"licenseSubscription",void 0)}setup({license$:e}){let t;return this.licenseSubscription=e.subscribe((e=>{t=e})),{license:Object.freeze({isLicenseAvailable:()=>{var e,i;return null!==(e=null===(i=t)||void 0===i?void 0:i.isAvailable)&&void 0!==e&&e},isEnabled:()=>this.isSecurityEnabledFromRawLicense(t),hasAtLeast:e=>{var i;return null===(i=t)||void 0===i?void 0:i.hasAtLeast(e)},getFeatures:()=>this.calculateFeaturesFromRawLicense(t),features$:e.pipe(Object(x.map)((e=>this.calculateFeaturesFromRawLicense(e))))})}}stop(){this.licenseSubscription&&(this.licenseSubscription.unsubscribe(),this.licenseSubscription=void 0)}isSecurityEnabledFromRawLicense(e){if(!e)return!1;const t=e.getFeature("security");return void 0!==t&&t.isAvailable&&t.isEnabled}calculateFeaturesFromRawLicense(e){if(null==e||!e.isAvailable)return{showLogin:!0,allowLogin:!1,showLinks:!1,showRoleMappingsManagement:!1,allowAccessAgreement:!1,allowAuditLogging:!1,allowRoleDocumentLevelSecurity:!1,allowRoleFieldLevelSecurity:!1,allowRoleRemoteIndexPrivileges:!1,allowRbac:!1,allowSubFeaturePrivileges:!1,allowUserProfileCollaboration:!1,layout:void 0===e||null!=e&&e.isAvailable?"error-es-unavailable":"error-xpack-unavailable"};if(!this.isSecurityEnabledFromRawLicense(e))return{showLogin:!1,allowLogin:!1,showLinks:!1,showRoleMappingsManagement:!1,allowAccessAgreement:!1,allowAuditLogging:!1,allowRoleDocumentLevelSecurity:!1,allowRoleFieldLevelSecurity:!1,allowRoleRemoteIndexPrivileges:!1,allowRbac:!1,allowSubFeaturePrivileges:!1,allowUserProfileCollaboration:!1};const t=e.hasAtLeast("standard"),i=e.hasAtLeast("gold"),n=e.hasAtLeast("platinum");return{showLogin:!0,allowLogin:!0,showLinks:!0,showRoleMappingsManagement:i,allowAccessAgreement:i,allowAuditLogging:i,allowSubFeaturePrivileges:i,allowRoleDocumentLevelSecurity:n,allowRoleFieldLevelSecurity:n,allowRoleRemoteIndexPrivileges:n,allowRbac:!0,allowUserProfileCollaboration:t}}}class plugin_SecurityPlugin{constructor(e){s()(this,"config",void 0),s()(this,"sessionTimeout",void 0),s()(this,"authenticationService",new authentication_service_AuthenticationService),s()(this,"navControlService",void 0),s()(this,"securityLicenseService",new license_service_SecurityLicenseService),s()(this,"managementService",new management_service_ManagementService),s()(this,"securityCheckupService",void 0),s()(this,"anonymousAccessService",new anonymous_access_service_AnonymousAccessService),s()(this,"analyticsService",new analytics_service_AnalyticsService),s()(this,"authc",void 0),s()(this,"securityApiClients",void 0),this.initializerContext=e,this.config=this.initializerContext.config.get(),this.securityCheckupService=new security_checkup_service_SecurityCheckupService(this.config,localStorage),this.navControlService=new nav_control_service_SecurityNavControlService(e.env.packageInfo.buildFlavor)}setup(e,{cloud:t,home:i,licensing:n,management:s,share:o}){const{license:a}=this.securityLicenseService.setup({license$:n.license$});return this.securityCheckupService.setup({http:e.http}),this.authc=this.authenticationService.setup({application:e.application,fatalErrors:e.fatalErrors,config:this.config,getStartServices:e.getStartServices,http:e.http}),this.securityApiClients={userProfiles:new user_profile_api_client_UserProfileAPIClient(e.http),users:new D.UserAPIClient(e.http)},this.navControlService.setup({securityLicense:a,logoutUrl:le(e.http),securityApiClients:this.securityApiClients}),this.analyticsService.setup({analytics:e.analytics,authc:this.authc,cloudId:null==t?void 0:t.cloudId,http:e.http,securityLicense:a}),v.create({authc:this.authc,application:e.application,getStartServices:e.getStartServices,securityApiClients:this.securityApiClients}),s&&this.managementService.setup({license:a,management:s,authc:this.authc,fatalErrors:e.fatalErrors,getStartServices:e.getStartServices,uiConfig:this.config.ui}),s&&i&&i.featureCatalogue.register({id:"security",title:r.i18n.translate("xpack.security.registerFeature.securitySettingsTitle",{defaultMessage:"Manage permissions"}),description:r.i18n.translate("xpack.security.registerFeature.securitySettingsDescription",{defaultMessage:"Control who has access and what tasks they can perform."}),icon:"securityApp",path:"/app/management/security/roles",showOnHomePage:!0,category:"admin",order:600}),o&&this.anonymousAccessService.setup({share:o}),{authc:this.authc,license:a}}start(e,{management:t,share:i}){const{application:n,http:s,notifications:r,docLinks:o}=e,{anonymousPaths:a}=s,c=le(s),u=s.basePath.serverBasePath,l=new session_expired_SessionExpired(n,c,u);return s.intercept(new unauthorized_response_http_interceptor_UnauthorizedResponseHttpInterceptor(l,a)),this.sessionTimeout=new session_timeout_SessionTimeout(r,l,s,u),this.sessionTimeout.start(),this.securityCheckupService.start({http:s,notifications:r,docLinks:o}),t&&this.managementService.start({capabilities:n.capabilities,uiConfig:this.config.ui}),i&&this.anonymousAccessService.start({http:s}),this.analyticsService.start({http:e.http}),{uiApi:ue({core:e}),navControlService:this.navControlService.start({core:e,authc:this.authc}),authc:this.authc,userProfiles:{getCurrent:this.securityApiClients.userProfiles.getCurrent.bind(this.securityApiClients.userProfiles),bulkGet:this.securityApiClients.userProfiles.bulkGet.bind(this.securityApiClients.userProfiles),suggest:this.securityApiClients.userProfiles.suggest.bind(this.securityApiClients.userProfiles),update:this.securityApiClients.userProfiles.update.bind(this.securityApiClients.userProfiles),userProfile$:this.securityApiClients.userProfiles.userProfile$}}}stop(){var e;null===(e=this.sessionTimeout)||void 0===e||e.stop(),this.navControlService.stop(),this.securityLicenseService.stop(),this.managementService.stop(),this.analyticsService.stop()}}function le(e){return`${e.basePath.serverBasePath}/logout`}const de=e=>new plugin_SecurityPlugin(e)},function(e,t){e.exports=__kbnSharedDeps__.Classnames},function(e,t){e.exports=__kbnSharedDeps__.KbnUiTheme},function(e,t){e.exports=__kbnSharedDeps__.SaferLodashSet},function(e,t){e.exports=__kbnSharedDeps__.MomentTimezone},function(e,t){e.exports=__kbnSharedDeps__.EmotionCache},function(e,t,i){i.r(t);var n=__kbnBundles__.get("plugin/spaces/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(n))},function(e,t,i){i.r(t);var n=__kbnBundles__.get("plugin/features/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(n))},function(e,t,i){i.r(t);var n=__kbnBundles__.get("plugin/esUiShared/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(n))},function(e,t){e.exports=__kbnSharedDeps__.KbnMonaco},function(e,t,i){i.r(t);var n=__kbnBundles__.get("plugin/spaces/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(n))},function(e,t){e.exports=__kbnSharedDeps__.KbnStd}]);