"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[3405,9810],{695415:(e,t,l)=>{l.d(t,{I:()=>a});const a={HEADER_HEIGHT:49,ROW_HEIGHT:32,EDIT_FIELD_HEIGHT:84,getHeight(e,t,l,a){return Math.min((a||this.ROW_HEIGHT)*e+(l??this.HEADER_HEIGHT),(a||this.ROW_HEIGHT)*t+(l??this.HEADER_HEIGHT))},getEditContainerHeight(e,t,l){return Math.min((l||this.EDIT_FIELD_HEIGHT)*e,(l||this.EDIT_FIELD_HEIGHT)*t)}}},717582:(e,t,l)=>{l.r(t),l.d(t,{default:()=>Tt});var a=l(296540),i=l(956347),n=l(133337),r=l(530864),s=l(860923),o=l(582724),m=l(627440),d=l(596731),c=l(616009);const _={[c.h.CURRENT_SITE]:`${d.Si[m.VO.ADMINS]}/${c.h.CURRENT_SITE}`,[c.h.ALL_SITES]:`${d.Si[m.VO.ADMINS]}/${c.h.ALL_SITES}`};var E,A=l(469733),u=l(415331),I=l(801081),S=l(432589),p=l(459449),M=l(740244),O=l(566723),N=l(905410),h=l(249304),g=l(197562),C=l(71479),T=l(927099),b=l(271856),R=l(538205),D=l(822336),f=l(396660),L=l(294303),v=l(362156);!function(e){e.NAME="name",e.STATUS="is_verified",e.EMAIL="email",e.SITES="sites",e.ROLE="role",e.LAST_LOGIN="last_login",e.LAST_SITE="last_site_name"}(E||(E={}));const y={[E.NAME]:312,[E.STATUS]:132,[E.EMAIL]:312,[E.SITES]:126,[E.ROLE]:394,[E.LAST_SITE]:126,[E.LAST_LOGIN]:312},w={[E.NAME]:a.createElement(p.sA,{id:"COMMON_NAME"}),[E.STATUS]:a.createElement(p.sA,{id:"COMMON_STATUS"}),[E.EMAIL]:a.createElement(p.sA,{id:"COMMON_EMAIL"}),[E.SITES]:a.createElement(p.sA,{id:"COMMON_SITES"}),[E.ROLE]:a.createElement(p.sA,{id:"ADMINS_ROLE_LABEL"}),[E.LAST_SITE]:a.createElement(p.sA,{id:"ADMINS_LAST_SITE"}),[E.LAST_LOGIN]:a.createElement(p.sA,{id:"ADMINS_LAST_LOGIN"})};var P=l(175886);const x=({verified:e,verifiedMessage:t})=>a.createElement(T.A,{color:e?"success":"warning",size:"body"},e&&t||a.createElement(p.sA,{id:e?"COMMON_ACTIVE":"ADMINS_PENDING"}));var k=l(758649),H=l(489949),z=l(602021);const U=({siteName:e})=>{const t=(0,A.useDispatch)(),l=(0,A.useSelector)(z.Gd),i=(0,A.useSelector)(z.n),n=(0,a.useMemo)(()=>i.reduce((e,{name:t,desc:l})=>(e[t]=l,e),{}),[i]);return a.createElement(k.A,{variant:"inline",onClick:a=>{a.stopPropagation(),t((0,H.h)(e)).then(()=>{window.location.href=`${window.location.href.substring(0,window.location.href.indexOf(l.name))}${e}/dashboard${window.location.search}`})}},a.createElement(T.A,{color:"inherit",size:"body"},n[e]||e))},V=({header:{id:e}})=>w[e],F=(0,C.A)(L.A)`
  margin-left: ${O.YC}; // align with the header label padding
`,G=({sites:e})=>a.createElement(L.A,{flexDirection:"column",gap:O.YC},e.map(e=>a.createElement("div",{key:e},e))),B=(0,C.A)(L.A)`
  background: ${({theme:{motifPalette:{uBlue01:e}}})=>e};
  color: ${({theme:{motifPalette:{uBlue06:e}}})=>e};
  border-radius: ${D.Ay["desktop-radius-base"]};
  text-transform: uppercase;
  padding: 0 ${O.kc};
  height: 16px;
`,$=()=>a.createElement(B,{justifyContent:"center",alignItems:"center"},a.createElement(T.A,{weight:"bold",size:"label",color:"info"},a.createElement(p.sA,{id:"COMMON_YOU"})));var W=l(951272),q=l(87485),Y=l(25553),j=l(563715);const K=(0,Y.uh)((0,j.Hq)()),X=(0,I.Mz)(K,q.kh);var J=l(675359),Z=l(742920),Q=l(847883),ee=l(81126),te=l(776309),le=l(126457),ae=l(388151),ie=l(705426),ne=l(55896);const re=(0,C.A)(ie.A)`
  background-color: ${({theme:{motifPalette:{neutral01:e}}})=>e};
  > div {
    overflow: hidden !important;
  }
`,se=({hotspotOperatorId:e,closeModal:t})=>{const l=(0,A.useDispatch)(),{isSubmitting:i,handleSubmit:n,values:{name:r}}=(0,W.j7)(),s=(0,a.useCallback)(()=>l((0,j.gH)(e)).then(()=>{t()}).catch(()=>l((0,J.ox)({icon:Z.C.danger,message:"COMMON_NOTICE_REMOVE_ERROR",values:{name:r}}))),[l,t,r,e]),o=(0,a.useCallback)(()=>l((0,le.to)({modalType:te.A.CONFIRM_HOTSPOT_OPERATOR_REMOVE,modalProps:{name:r,onConfirm:s}})),[l,s,r]),m=(0,a.useMemo)(()=>[{disabled:i,text:a.createElement(p.sA,{id:"COMMON_ACTION_REMOVE"}),type:"button",variant:"default",onClick:o},{disabled:i,text:a.createElement(p.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",variant:"default",onClick:t},{disabled:i,text:a.createElement(p.sA,{id:"COMMON_ACTION_SAVE_CHANGES"}),type:"button",variant:"primary",onClick:()=>n()}].filter(Boolean),[t,o,n,i]);return a.createElement(re,{size:"small",isOpen:Boolean(e),onRequestClose:t,title:a.createElement(p.sA,{id:"ADMINS_EDIT_ACCOUNT"}),actions:m},a.createElement(Q.A,null,a.createElement(ee.A,{column:!0,unlimitedWidth:!0},a.createElement(ae.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_NAME"}))),a.createElement(Q.A,null,a.createElement(ee.A,{column:!0,unlimitedWidth:!0},a.createElement(ae.A,{full:!0,name:"x_password",type:"password",variant:"secondary",label:"COMMON_PASSWORD",autoComplete:"new-password",passwordToggle:!0}))),a.createElement(ne.A,null))};var oe=l(546391),me=l(870443);const de=me.A.object().shape({name:me.A.string().label("COMMON_LABEL_USERNAME").required().matches(oe.mJ,{message:a.createElement(p.sA,{id:"ADMINS_ADMIN_USERNAME_REGEX"})}),x_password:me.A.string().label("COMMON_PASSWORD").required()}),ce=({hotspotOperatorId:e,closeModal:t})=>{const l=(0,A.useDispatch)(),{_id:i,name:n,x_password:r}=(0,A.useSelector)((0,a.useMemo)(()=>{return t=e,(0,I.Mz)(X,e=>e.find(({_id:e})=>t===e)||{});var t},[e])),s=(0,a.useCallback)(({name:e,x_password:a},{resetForm:n,setSubmitting:r})=>l((0,j.dt)(i,{data:{name:e,x_password:a}})).then(()=>{l((0,j.Hq)()),t(),n()}).catch(({msg:t})=>l((0,J.ox)({icon:Z.C.danger,message:"ADMINS_EDIT_ADMIN_ERROR",values:{name:e},errorMessage:t}))).finally(()=>{r(!1)}),[i,l,t]),o=(0,a.useMemo)(()=>({name:n,x_password:r}),[n,r]);return a.createElement(W.l1,{enableReinitialize:!0,initialValues:o,validationSchema:de,onSubmit:s},a.createElement(se,{closeModal:t,hotspotOperatorId:e}))};var _e=l(921243),Ee=l(314714),Ae=l(162420),ue=l(967431),Ie=l(689965),Se=l(329109),pe=l(526075),Me=l(775699),Oe=l(198494);const Ne=(0,Y.uh)((0,pe.VF)()),he=(0,I.Mz)(Ne,q.kh);var ge=l(186745),Ce=l(151360),Te=l(695415),be=l(947089),Re=l(963070),De=l(617147),fe=l(121e3),Le=l(616093);const ve=(0,C.A)("footer")`
  padding: 0 ${O.Er} ${O.Er} ${O.Er};
`,ye=({children:e})=>a.createElement(ve,null,e),we=(0,C.A)("div")`
  margin-right: auto;
`,Pe=(0,C.A)(ee.A)`
  align-items: center;
  gap: ${O.Ln};
`,xe=(0,C.A)(k.A)`
  margin-top: ${O.Ln};
`,ke=({siteRole:e,closeModal:t,onRemoveSiteAdmin:l,invite:i})=>{const{formatMessage:r}=(0,p.tz)(),s=(0,A.useDispatch)(),[o,m]=(0,a.useState)(!1),{values:{role:d,permissions:c},isSubmitting:_,handleSubmit:E}=(0,W.j7)(),u=()=>{i&&!o&&(m(!0),s((0,pe.t7)({name:i.name,email:i.email,for_sso:i.for_sso,super_site_permissions:i.super_site_permissions,role:d,permissions:c})).catch(({msg:e})=>s((0,J.ox)({icon:Z.C.danger,message:"ADMINS_INVITE_ERROR",values:{name:i.name},errorMessage:e}))).then(()=>{s((0,n.w)()),s((0,pe.VF)()),t()}).finally(()=>m(!1)))},I=_||o;return a.createElement(De.A,{isOpen:!0,size:"small",allowOverflow:!0,onRequestClose:t,title:`${e.site_desc} ${r({id:"ADMINS_PERMISSIONS_LABEL"})}`,footer:a.createElement(ye,null,a.createElement(L.A,{alignItems:"center",justifyContent:"flex-end",gap:O.kc},a.createElement(we,null,a.createElement(k.A,{type:"button",disabled:I,variant:"tertiary",onClick:l},a.createElement(T.A,{size:"inherit",color:"danger"},a.createElement(p.sA,{id:"COMMON_ACTION_REMOVE"})))),a.createElement(k.A,{type:"button",disabled:I,variant:"default",onClick:t},a.createElement(p.sA,{id:"COMMON_ACTION_CANCEL"})),a.createElement(k.A,{type:"button",disabled:I,variant:"primary",onClick:()=>i?u():E()},a.createElement(p.sA,{id:"COMMON_ACTION_APPLY_CHANGES"}))))},a.createElement(L.A,{paddingLeft:O.xO,flexDirection:"column"},a.createElement(fe.A,{role:d,permissions:c,disabled:I}),a.createElement(Q.A,null,a.createElement(Pe,{column:!1,unlimitedWidth:!0},a.createElement(ae.A,{type:"dropdown",sortedDropdown:!0,variant:"secondary",name:"role",options:(S=!!i,Le.A.filter(({value:e})=>e!==M.e.HOTSPOT&&(!S||e!==M.e.SUPER_ADMIN))),translateOptions:!0,validated:!0,full:!0,label:"ADMINS_ROLE_LABEL",translateLabel:!0,placeholder:"COMMON_CHOOSE_AN_OPTION",translatePlaceholder:!0,disabled:I}),i?a.createElement(xe,{disabled:I,variant:"inline",onClick:u},a.createElement(p.sA,{id:"ADMINS_RE_INVITE"})):null))));var S},He=({adminId:e,adminName:t,invite:l,siteRole:i,closeModal:r})=>{const s=(0,A.useDispatch)(),o=(0,A.useSelector)(Oe.fR),m=(0,a.useMemo)(()=>({role:i.is_super&&i.role===M.e.ADMIN?M.e.SUPER_ADMIN:i.role,permissions:i.permissions}),[i]),d=()=>{s((0,n.w)()),s((0,pe.VF)()),r()};return a.createElement(W.l1,{enableReinitialize:!0,initialValues:m,onSubmit:({role:t,permissions:l},{setSubmitting:a,resetForm:n})=>{s((0,pe.Rr)({admin:e,role:t,permissions:l,is_super:t===M.e.SUPER_ADMIN},{admin:e,role:i.role,permissions:i.permissions,is_super:i.is_super},i.site_name)).then(d).finally(()=>{a(!1),n()})}},a.createElement(ke,{siteRole:i,onRemoveSiteAdmin:()=>{r(),s((0,pe.Ag)({name:t,withRemoveGlobalPermissions:o&&i.is_super,onConfirm:l=>s((0,pe.qg)(e,l,i.site_name)).then(d).catch(()=>s((0,J.ox)({icon:Z.C.danger,message:"COMMON_NOTICE_REMOVE_ERROR",values:{name:t}})))}))},invite:l,closeModal:r}))},ze=(0,C.A)("div")`
  margin-right: ${O.YC};
  pointer-events: none;
`,Ue=[{id:"site_desc",label:a.createElement(p.sA,{id:"COMMON_SITE"}),sortable:!0,minWidth:100,renderCell:({site_desc:e})=>a.createElement(T.A,{size:"body",color:"secondary"},e)},{id:"role",label:a.createElement(p.sA,{id:"ADMINS_ROLE_LABEL"}),sortable:!0,minWidth:150,renderCell:({role:e,is_super:t},l,i,{rowHovered:n})=>a.createElement(L.A,{width:"100%",justifyContent:"space-between"},a.createElement(T.A,{size:"body",color:"secondary"},a.createElement(p.sA,{id:(0,P.c)({role:e,is_super:t})})),n?a.createElement(ze,null,a.createElement(T.A,{size:"inherit",color:"info"},a.createElement(p.sA,{id:"COMMON_ACTION_EDIT"}))):null)}],Ve=({adminId:e,adminName:t,invite:l,roles:i,isSuper:n})=>{const r=(0,A.useDispatch)(),s=(0,A.useSelector)(z.n),o=(0,a.useMemo)(()=>s.every(({name:e})=>i.some(({site_name:t})=>t===e)),[s,i]),[m,d]=(0,a.useState)(null),c=(0,a.useCallback)(()=>{r((0,le.to)({modalType:te.A.ADD_ADMIN_MODAL,modalProps:{adminId:e}}))},[r,e]),_=(0,a.useMemo)(()=>i.map(e=>({...e,is_super:n})),[i,n]),E=(0,a.useCallback)(()=>{d(null)},[]);return a.createElement(L.A,{alignItems:"flex-start",flexDirection:"column",gap:O.kc},o||l?null:a.createElement(k.A,{variant:"link",type:"submit",onClick:c},a.createElement(T.A,{size:"body",color:"inherit"},a.createElement(p.sA,{id:"ADMINS_ADD_SITE_PERMISSION"}))),a.createElement(Re.A,{truncateHeaderCells:!0,columns:Ue,items:_,idField:"site_id",onRowClick:d,disableColumnFilters:!0,disableTextPointer:!0,disableSelection:!0}),m?a.createElement(He,{siteRole:m,invite:l,adminId:e,adminName:t,closeModal:E}):null)},Fe=me.A.object().shape({name:me.A.string().label("COMMON_LABEL_USERNAME").required().matches(oe.mJ,{message:a.createElement(p.sA,{id:"ADMINS_ADMIN_USERNAME_REGEX"})}),email:me.A.string().when("requires_new_password",{is:!1,then:me.A.string().label("COMMON_EMAIL").email().required()}),email_alert_grouping_enabled:me.A.boolean().label("COMMON_GROUP_SIMILAR_NOTIFICATIONS"),email_alert_grouping_delay:me.A.number().when("email_alert_grouping_enabled",{is:!0,then:me.A.number().label("COMMON_GROUP_WITHIN").required().min(1).max(60)}),x_password:me.A.string().when(["isSelf","requires_new_password"],{is:(e,t)=>e&&t,then:me.A.string().label("ADMINS_CURRENT_PASSWORD_LABEL").required()}),x_oldpassword:me.A.string().when(["isSelf"],{is:!0,then:me.A.string().when(["requires_new_password"],{is:!1,then:me.A.string().label("ADMINS_CURRENT_PASSWORD_LABEL").required()})})});var Ge=l(649810);const Be=({onConfirm:e,isValid:t,...l})=>{const i=(0,A.useDispatch)();return a.createElement(Ge.default,{message:"ADMINS_CONFIRM_CHANGES_PASSWORD_DESCRIPTION",title:"ADMINS_CONFIRM_CHANGES",confirmButtonProps:{disabled:!t},onConfirm:()=>{e(),i((0,le.AS)())},...l})};var $e=l(734707);const We=({siteAdmin:{name:e,_id:t,super_roles:l},onRemove:i})=>{const n=(0,A.useDispatch)(),[r,s]=(0,a.useState)(!1);return a.createElement($e.Ay,{variant:"link",onClick:()=>{n((0,pe.Ag)({name:e,withRemoveGlobalPermissions:!1,onConfirm:()=>(s(!0),n(l?.length?(0,pe.rz)(t):(0,pe.T7)(t)).then(i).catch(()=>n((0,J.ox)({icon:Z.C.danger,message:"COMMON_NOTICE_REMOVE_ERROR",values:{name:e}}))).finally(()=>s(!1)))}))},loader:r?"spinner":null,type:"button"},a.createElement(L.A,{alignItems:"center",justifyContent:"flex-start"},a.createElement(T.A,{size:"inherit",color:"danger"},a.createElement(p.sA,{id:"COMMON_ACTION_REMOVE"}))))};var qe;!function(e){e.HTML="html_email_enabled",e.PROF="is_professional_installer"}(qe||(qe={}));const Ye=[{value:qe.HTML,label:"COMMON_ENABLE_HTML_EMAIL_TEMPLATE"},{value:qe.PROF,label:"COMMON_ENABLE_OPTIONS_FOR_PROF_INST"}],je=({id:e,value:t,children:l})=>t||l?a.createElement(L.A,{justifyContent:"space-between"},a.createElement(T.A,{size:"body"},a.createElement(p.sA,{id:e})),t?a.createElement(T.A,{color:"tertiary",size:"body"},t):null,l):null,Ke=({labelId:e,field:t,tooltipMessageId:l,children:i,disabled:n,allowReadOnly:r})=>a.createElement(L.A,{alignItems:"center",height:Te.I.ROW_HEIGHT},i??a.createElement(ae.A,{name:t,type:"realCheckbox",disabled:n,allowReadOnly:r}),a.createElement(T.A,{size:"body",color:n?"disabled":"inherit"},a.createElement(L.A,{alignContent:"center",gap:O.YC},a.createElement(p.sA,{id:e}),l?a.createElement(b.A,{description:a.createElement(p.sA,{id:l}),portal:!0},a.createElement(Ae.A,{style:{marginBottom:"2px"},isActive:!0,size:"original"})):null))),Xe=({labelId:e,field:t,permission:l,disabled:i})=>{const{values:n,setFieldValue:r}=(0,W.j7)(),s=n[t];return s?a.createElement(Ke,{labelId:e,field:t,disabled:i},a.createElement(Ee.A,{id:"adoption",checked:s.includes(l),disabled:i,onChange:({target:{checked:e}})=>r(t,e?[...s,l].sort():s.filter(e=>e!==l))})):null},Je=({headingId:e,children:t,...l})=>a.createElement(Ie.A,{flex:"1 1 100%"},e&&a.createElement(T.A,{size:"header-xs",weight:"bold"},a.createElement(p.sA,{id:e})),a.createElement(L.A,{gap:O.kc,marginTop:e?O.Ln:void 0,flexDirection:"column",...l},t)),Ze=(e,t,l,a)=>{if(l){const{email_alert_grouping_delay:e}=a||{};return{...a||{},x_oldpassword:"",x_password:"",isSelf:l,...e?{email_alert_grouping_delay:(0,ue.A)(e/60,2)}:{}}}return{push_alert_enabled:t?.push_alert_enabled,email_alert_enabled:t?.email_alert_enabled,super_site_permissions:[],...e||{},x_password:"",role:e?.is_super?M.e.SUPER_ADMIN:e?.role,isSelf:l,email_alert_grouping_delay:e?.email_alert_grouping_delay?(0,ue.A)(e.email_alert_grouping_delay/60,2):1}},Qe=({adminId:e,adminName:t,close:l})=>{const i=(0,A.useDispatch)(),r=(0,A.useSelector)(Oe.fR),s=(0,A.useSelector)(Oe.rK),o=(0,A.useSelector)(Oe.lt),m=(0,A.useSelector)((0,a.useMemo)(()=>{return t=e,(0,I.Mz)(he,e=>e.find(({_id:e})=>e===t));var t},[e])),d=(0,A.useSelector)((0,a.useMemo)(()=>(0,ge.p)(e),[e])),c=(0,A.useSelector)(z.Gd),_=m&&!m.is_verified&&c?.name,[E,u]=(0,a.useState)(!1),S=s===e,O=(0,A.useSelector)(z.EL),N=!m||!m.is_verified,h=!N&&(S||!O),g=!(r||s===e),C=(0,a.useCallback)(()=>{i((0,pe.VF)()),i((0,n.w)())},[i]),T=(0,a.useCallback)((e,{resetForm:t,setSubmitting:l})=>{const{name:a,email:n,x_password:r,x_oldpassword:s,email_alert_enabled:o,push_alert_enabled:d,html_email_enabled:c,is_professional_installer:_,email_alert_grouping_enabled:E,email_alert_grouping_delay:A,_id:u,is_super:I,is_verified:p,role:O,super_site_permissions:N,super_site_role:h,permissions:g}=e,T=o&&E?(0,ue.A)(60*A):0,b=o&&E;if(S){const e={email:n,name:a,x_oldpassword:s,x_password:r,email_alert_enabled:o,email_alert_grouping_enabled:b,email_alert_grouping_delay:T,push_alert_enabled:d,html_email_enabled:c,is_professional_installer:_};i((0,Me.yf)(e)).then(C).catch(({msg:e})=>i((0,J.ox)({icon:Z.C.danger,message:"ADMINS_EDIT_SELF_ERROR",errorMessage:e}))).finally(()=>{l(!1),t()})}else{let e=[];O===M.e.ADMIN?e=N:O===M.e.SUPER_ADMIN&&(e=be.CY.map(({value:e})=>e));const s={admin:u,email:n,email_alert_enabled:o,email_alert_grouping_enabled:b,email_alert_grouping_delay:T,html_email_enabled:c,is_professional_installer:_,is_super:I,is_verified:p,name:a,permissions:O!==M.e.READ_ONLY?be.zi.map(({value:e})=>e):g,push_alert_enabled:d,role:O,super_site_permissions:e,super_site_role:h,x_password:r};i((0,pe.Rr)(s,m)).then(C).catch(({msg:e})=>i((0,J.ox)({icon:Z.C.danger,message:"ADMINS_EDIT_ADMIN_ERROR",values:{name:a},errorMessage:e}))).finally(()=>{l(!1),t()})}},[S,m,C,i]);return a.createElement(W.l1,{initialValues:Ze(m,d,S,o),enableReinitialize:!0,onSubmit:T,validationSchema:Fe},({values:i,handleSubmit:n,handleReset:r,dirty:s,isValid:o})=>a.createElement(a.Fragment,null,a.createElement(L.A,{flexDirection:"column"},a.createElement(Je,null,a.createElement(je,{id:"COMMON_EMAIL",value:i.email}),a.createElement(je,{id:"COMMON_STATUS"},a.createElement(x,{verified:!!(m?.is_verified??d?.is_verified),verifiedMessage:a.createElement(p.sA,{id:"ADMINS_VERIFIED"})})),d?.last_site_name?a.createElement(je,{id:"ADMINS_LAST_SITE"},a.createElement(U,{siteName:d.last_site_name})):null,a.createElement(je,{id:"ADMINS_LAST_LOGIN_IP",value:m?.last_login_ip})),g?null:a.createElement(a.Fragment,null,a.createElement(Je,null,a.createElement(ae.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_LABEL_USERNAME",allowReadOnly:h,disabled:N}),a.createElement(ae.A,{full:!0,name:"x_password",type:"password",variant:"secondary",label:"ADMINS_EDIT_PASSWORD_LABEL",autoComplete:"new-password",passwordToggle:!0,allowReadOnly:h,disabled:N})),a.createElement(Je,null,a.createElement(Ke,{labelId:"COMMON_ACTIONS_REMOTE_ACCESS",tooltipMessageId:"ADMINS_ADMIN_REMOTE_DESCRIPTION",disabled:!0},a.createElement(Ee.A,{id:"remoteAccess",readOnly:!0,disabled:!0,checked:!!(d?.ubic_uuid??m?.for_sso)})),i.role!==M.e.READ_ONLY||S?null:a.createElement(a.Fragment,null,a.createElement(Xe,{labelId:"ADMINS_PERMISSION_DEVICE_ADOPTION",field:"permissions",disabled:N,permission:be.aX.ADOPT_DEVICES}),a.createElement(Xe,{labelId:"ADMINS_PERMISSION_DEVICE_RESTART",field:"permissions",disabled:N,permission:be.aX.RESTART_DEVICES})),i.role===M.e.ADMIN?a.createElement(a.Fragment,null,a.createElement(Xe,{labelId:"ADMINS_PERMISSION_DASHBOARD_EDITING",field:"super_site_permissions",disabled:N,permission:be.pl.EDIT_DASHBOARD}),a.createElement(Xe,{labelId:"ADMINS_PERMISSION_SYSTEM_STATS",field:"super_site_permissions",disabled:N,permission:be.pl.ACCESS_SYSTEM_STATS}),a.createElement(Xe,{labelId:"ADMINS_PERMISSION_READ_ONLY_ACCESS_TO_ALL_SITES",field:"super_site_permissions",disabled:N,permission:be.pl.READ_ONLY_ALL_SITES}),a.createElement(Xe,{labelId:"ADMINS_PERMISSION_SHOW_PENDING_DEVICES",field:"super_site_permissions",disabled:N,permission:be.pl.SHOW_PENDING_DEVICES})):null),d?.roles?.length||_?a.createElement(Je,{headingId:"ADMINS_ADMIN_SITE_PERMISSIONS"},a.createElement(Ve,{roles:[...d?.roles||[],..._?[{site_id:c._id,site_name:c.name,site_desc:c.desc,permissions:m.permissions,role:m.role}]:[]],isSuper:m?.is_super??d?.is_super,invite:_?{name:i.name,email:i.email,super_site_permissions:i.super_site_permissions,for_sso:m.for_sso}:null,adminId:e,adminName:t})):null,a.createElement(Je,{headingId:"ADMINS_PUSH_NOTIFICATION_SETTINGS"},a.createElement(Ke,{labelId:"COMMON_MOBILE",disabled:N,field:"push_alert_enabled"}),a.createElement(Ke,{labelId:"COMMON_EMAIL",disabled:N,field:"email_alert_enabled"}),a.createElement(Ce.A,{hidden:!i.email_alert_enabled,height:Te.I.ROW_HEIGHT},a.createElement(L.A,{justifyContent:"space-between",alignItems:"center"},a.createElement(ae.A,{type:"realCheckbox",name:"email_alert_grouping_enabled",allowReadOnly:h,disabled:N},a.createElement(p.sA,{id:"COMMON_GROUP_SIMILAR_NOTIFICATIONS"})),i.email_alert_grouping_enabled&&a.createElement(L.A,{width:120},a.createElement(ae.A,{name:"email_alert_grouping_delay",type:"number",variant:"secondary",allowReadOnly:h,disabled:N,min:1,full:!0}))))),i.role!==M.e.READ_ONLY&&S?a.createElement(Je,{headingId:"ADMINS_ADMIN_ADVANCED_OPTIONS"},Ye.map(({label:e,value:t})=>a.createElement(Ke,{field:t,labelId:e,allowReadOnly:h,key:t}))):null)),!d||d.roles?.length||_?null:a.createElement(Je,{alignItems:"flex-start"},a.createElement(We,{siteAdmin:d,onRemove:()=>{C(),l()}})),a.createElement(Be,{isOpen:E,isValid:o,onConfirm:()=>{u(!1),n()},onCancel:()=>{r(),u(!1)}},a.createElement(ae.A,{full:!0,name:"x_oldpassword",type:"password",autoComplete:"new-password",variant:"secondary",passwordToggle:!0,allowReadOnly:h})),a.createElement(Se.A,{isDirty:s,onFormSubmit:o?n:()=>u(!0),onFormCancel:r})))},et=({adminId:e,adminName:t,close:l,...i})=>a.createElement(_e.A,{in:!!e,side:"right",header:a.createElement(T.A,{weight:"bold",size:"body"},t),onClose:l},e?a.createElement(Qe,{adminId:e,adminName:t,close:l,...i}):null);var tt=l(59308),lt=l(269672);const at=e=>(0,I.Mz)(he,ge.f,X,Oe.rK,(t,l,a,i)=>e===c.h.CURRENT_SITE?[...t.map(({_id:e,avatar_url:t,name:l,role:a,email:n,is_super:r,is_verified:s,last_login_timestamp:o})=>({_id:e,name:l,avatar_url:t,isSelf:e===i,role:a,email:n,is_super:r,is_verified:s,last_login_timestamp:1e3*o})),...a.map(e=>({_id:e._id,isSelf:e._id===i,name:e.name,role:M.e.HOTSPOT,email:void 0,is_super:!1,is_verified:!0}))]:[...l.map(({_id:e,avatar_url:t,name:l,email:a,is_super:n,is_verified:r,roles:s,last_site_name:o,last_login_timestamp:m})=>({_id:e,avatar_url:t,name:l,isSelf:e===i,email:a,is_super:n,is_verified:r,last_site_name:o,last_login_timestamp:1e3*m,role:s.every(e=>e.role===s[0]?.role)?s[0]?.role:M.e.MULTIPLE,sites:s.map(({site_desc:e})=>e)}))]),it=e=>(0,I.Mz)(at(e),e=>e.map(({_id:e,name:t,email:l})=>({id:e,name:t,email:l}))),nt=({section:e})=>{const{formatMessage:t}=(0,p.tz)(),l=(0,A.useSelector)((e=>(0,I.Mz)(at(e),(0,tt.U)(lt.U4.ADMINS),(e,t)=>e.filter(({_id:e})=>!t||t.has(e))))(e)),{editAdminModalId:n=null}=(0,i.g)(),[r,s]=(0,a.useState)(n),[o,m]=(0,a.useState)(null),[d,_]=(0,a.useState)(0),u=(0,a.useMemo)(()=>((e,t)=>[{id:E.NAME,header:V,size:y[E.NAME],cell:({row:{original:{avatar_url:e,name:t,isSelf:l}}})=>a.createElement(F,{alignItems:"center",gap:O.YC},a.createElement(R.A,{image:e}),a.createElement(T.A,{size:"body",color:"secondary"},t),l?a.createElement($,null):null)},{id:E.STATUS,header:V,size:y[E.STATUS],cell:({row:{original:{is_verified:e}}})=>a.createElement(x,{verified:e})},{id:E.EMAIL,header:V,size:y[E.EMAIL],cell:({row:{original:{email:e}}})=>a.createElement(T.A,{size:"body",color:"secondary"},e||a.createElement(p.sA,{id:"COMMON_FALLBACK"}))},...e===c.h.ALL_SITES?[{id:E.SITES,header:V,size:y[E.SITES],cell:({row:{original:{sites:e=[]}}})=>e.length?a.createElement(L.A,null,a.createElement(b.A,{description:a.createElement(G,{sites:e}),portal:!0},e.length)):0}]:[],{compare:(0,f.l0)(({role:e,is_super:l})=>t({id:(0,P.c)({is_super:l,role:e})})),id:E.ROLE,header:V,size:y[E.ROLE],cell:({row:{original:{is_super:e,role:t}}})=>a.createElement(p.sA,{id:(0,P.c)({is_super:e,role:t})})},...e===c.h.ALL_SITES?[{id:E.LAST_SITE,header:V,size:y[E.LAST_SITE],cell:({row:{original:{last_site_name:e}}})=>e?a.createElement(U,{siteName:e}):a.createElement(p.sA,{id:"COMMON_FALLBACK"})}]:[],{id:E.LAST_LOGIN,header:V,size:y[E.LAST_LOGIN],cell:({row:{original:{last_login_timestamp:e}}})=>e?a.createElement(T.A,{size:"body",color:"secondary",truncate:!0},a.createElement(v.A,{timestamp:e})):a.createElement(p.sA,{id:"COMMON_FALLBACK"})}])(e,t),[e,t]),C=(0,a.useCallback)(({_id:e,role:t,name:l})=>{t!==M.e.HOTSPOT?m({adminId:e,adminName:l}):s(e)},[m]),D=(0,a.useCallback)(()=>s(void 0),[]),w=(0,a.useCallback)(({rowsPerPage:e,pageNumber:t})=>a.createElement(S.A,{columns:u,data:l,rowStyle:O.gc,width:"100%",onRowClick:C,pageIndex:t,pageSize:e}),[u,l,C]);return a.createElement(g.A,null,a.createElement(N.A,{itemCount:l.length,tableType:h.l.ADMINS,onRenderTable:w,onPageChanged:_,pageNumber:d}),r?a.createElement(ce,{closeModal:D,hotspotOperatorId:r}):null,a.createElement(et,{...o,close:()=>m(null)}))};const rt=(0,l(189601).WY)()((0,I.Mz)(()=>({[c.h.CURRENT_SITE]:{[m.o9.ROUTE_COMPONENT]:nt,[m.o9.SIDE_NAVIGATION]:void 0,[m.o9.ROUTE]:{[m.Fm.AVAILABLE]:!0},[m.o9.NAVIGATION]:{[m.mx.AVAILABLE]:!0},[m.o9.DEPENDENCIES]:void 0},[c.h.ALL_SITES]:{[m.o9.ROUTE_COMPONENT]:nt,[m.o9.SIDE_NAVIGATION]:void 0,[m.o9.ROUTE]:{[m.Fm.AVAILABLE]:!0},[m.o9.NAVIGATION]:{[m.mx.AVAILABLE]:!0},[m.o9.DEPENDENCIES]:void 0}})),e=>e),st=e=>{const t=(0,A.useSelector)(rt);return a.createElement(u.A,{routes:t,...e})};var ot=l(834959),mt=l(413357),dt=l(592510),ct=l(457311),_t=l(75585),Et=l(572112),At=l(365930),ut=l(852182),It=l(974546),St=l(879077),pt=l(639775),Mt=l(451919);const Ot=["id","name","email"],Nt=new It.A.Document({tokenize:"forward",cache:500,encode:pt.Rd,document:{store:Ot,id:"id",index:Ot}}),ht=({section:e})=>a.createElement(St.A,{lsKey:Mt.UZ.ADMIN_SEARCH,searchModelName:lt.U4.ADMINS,searchIndex:Nt,enabledColumns:Ot,records:(0,A.useSelector)(it(e)),recordIdKey:"id"}),gt=[{id:c.h.CURRENT_SITE,intlKey:"ADMINS_CURRENT_SITE",label:a.createElement(p.sA,{id:"ADMINS_CURRENT_SITE"})},{id:c.h.ALL_SITES,intlKey:"ADMINS_ALL_SITES",label:a.createElement(p.sA,{id:"ADMINS_ALL_SITES"})}],Ct=({section:e})=>{const t=(0,A.useDispatch)(),l=(0,A.useSelector)(z.EL),i=(0,A.useSelector)(Oe.fR);return a.createElement(ut.A,{showBorderBottom:!1,hideFilterButton:!0,rightContent:l?null:a.createElement(k.A,{type:"button",name:"add-new-admin",variant:"inline",size:"medium",onClick:()=>{t((0,le.to)({modalType:te.A.ADD_ADMIN_MODAL}))},Icon:a.createElement(_t.A,null)}),leftContent:a.createElement(ht,{section:e})},i?a.createElement(At.A,{routes:gt,currentRoute:e,breakPointWidth:Et.A.ML.TO,paramKey:d.On,variant:"capsule"}):null)},Tt=(0,i.y)(({match:{params:e}})=>(0,o.A)([(0,mt.Zi)(ot.B.ADMINS),(0,pe.VF)(void 0,{crudCacheStrategy:{type:dt.e.CACHE}}),(0,n.w)(void 0,{crudCacheStrategy:{type:dt.e.CACHE}}),(0,j.Hq)(void 0,{crudCacheStrategy:{type:dt.e.CACHE}}),(0,ct.Uc)(void 0,{crudCacheStrategy:{type:dt.e.CACHE}})],a.createElement(s.A,null,a.createElement(Ct,{section:e.section}),a.createElement(a.Suspense,{fallback:null},a.createElement(i.dO,null,a.createElement(r.F,{path:_[c.h.CURRENT_SITE],render:t=>a.createElement(st,{id:c.h.CURRENT_SITE,section:e.section,...t})}),a.createElement(r.F,{path:_[c.h.ALL_SITES],render:t=>a.createElement(st,{id:c.h.ALL_SITES,section:e.section,...t})})))),{trackingName:m.VO.ADMINS}))},197562:(e,t,l)=>{l.d(t,{A:()=>n});var a=l(71479),i=l(566723);const n=(0,a.A)("div")`
  height: 100%;
  flex: 1;
  overflow: scroll;
  margin-left: ${i.Ln};
  padding: ${i.Ln} 0 0 0;
`},151360:(e,t,l)=>{l.d(t,{A:()=>a});const a=(0,l(71479).A)("div",{shouldForwardProp:e=>"hidden"!==e&&"height"!==e})`
  /* Height animation from UIC <Accordion/> */
  transition:
    height 300ms cubic-bezier(0.7, 0, 0.3, 1),
    opacity 100ms ease-in;
  height: ${e=>e.height}px; // cannot animate to height: auto
  opacity: 1;
  ${e=>e.hidden&&"\n    visibility: hidden;\n    height: 0;\n    min-height: unset;\n    opacity: 0;\n  "}
`},649810:(e,t,l)=>{l.r(t),l.d(t,{default:()=>E});var a=l(296540),i=l(469733),n=l(927099),r=l(71479),s=l(459449),o=l(126457),m=l(372737),d=l(705426);const c=(0,r.A)("div")`
  line-height: 1.5;
  word-break: break-word;
`,_=(0,r.A)(n.A)`
  color: ${({theme:{motifPalette:{text01:e}}})=>e} !important;
  padding-right: ${({theme:{spacing:e}})=>e["spacing-xl"]};
`,E=({message:e,title:t,onConfirm:l,children:r=null,messageValues:E={},size:A="small",titleValues:u={},onCancel:I=null,confirmButtonProps:S={},confirmButtonText:p,...M})=>{const O=(0,i.useDispatch)(),N=(0,a.useCallback)(()=>{I?I():O((0,o.AS)())},[I,O]);return(0,a.useEffect)(()=>{function e(e){e.stopPropagation(),e.key===m.U.ENTER?l():e.key===m.U.ESCAPE&&N()}return window.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0)}},[N,l]),a.createElement(d.A,{actions:[{text:a.createElement(s.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",onClick:N},{text:a.createElement(s.sA,{id:p??"COMMON_ACTION_CONFIRM"}),type:"button",variant:"primary",onClick:()=>l(),...S}],size:A,title:a.createElement(_,{size:"header-xs",truncate:!0},a.createElement(s.sA,{id:t,values:u})),...M},a.createElement(c,null,a.createElement(n.A,{size:"body"},a.createElement(s.sA,{id:e,values:E}))),r)}}}]);