@digital-realty/ui-user-management 11.0.5 → 11.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/ui-user-management.js +24 -20
- package/dist/ui-user-management6.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as s}from"tslib";import{css as E,LitElement as I,html as l,svg as Oe,nothing as x}from"lit";import{customElement as b,property as d,state as u,query as F,queryAsync as Gi}from"lit/decorators.js";import{MobxLitElement as Ie}from"@adobe/lit-mobx";import{elementTheme as le,baseTheme as _e}from"@digital-realty/theme";import Pt from"toastify-js";import{ApplicationInsights as Ki}from"@microsoft/applicationinsights-web";import"@digital-realty/ix-progress/ix-progress.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import{makeAutoObservable as Ji,toJS as ke,observable as Mt,makeObservable as Zi}from"mobx";import{gql as Ee,GraphQLClient as Wi}from"graphql-request";import{User as Qi,UserManager as Yi}from"oidc-client-ts";import Bt from"i18next";import{initLitI18n as Xi}from"lit-i18n";import{Router as he}from"@vaadin/router";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-dialog/ix-dialog.js";import"@digital-realty/ix-textbox/ix-textbox.js";import"@digital-realty/ix-phone-input/ix-phone-input.js";import{parsePhoneNumberWithError as Lt,AsYouType as eo,isPossiblePhoneNumber as to}from"libphonenumber-js";import{classMap as io}from"lit/directives/class-map.js";import oo from"validator";import"@digital-realty/ix-tree/ix-tree.js";import"@digital-realty/ix-multi-select/ix-multi-select.js";import{IconTypeMap as no,updateNodeCheckedStatus as me,flattenTree as ao,findChildNodeById as ze,collapseAllNodes as qe,calculateCheckedEndNodesCount as Ot,getCheckedAndIndeterminateNodesOnly as zt,buildTreeFromFlatArray as qt,updateChildrenCount as Ht}from"@digital-realty/ix-generic-tree";import{repeat as st}from"lit/directives/repeat.js";import"@digital-realty/ix-tabs/ix-tabs.js";import"@digital-realty/ix-tabs/ix-primary-tab.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-card/ix-card.js";import Vt from"lodash.debounce";import"@digital-realty/ix-generic-tree/ix-generic-tree.js";import"@digital-realty/ix-accordion/ix-accordion.js";import"@digital-realty/ix-divider/ix-divider.js";import"@digital-realty/ix-phone-number/ix-phone-number.js";import"@material/web/icon/icon.js";import"@digital-realty/ix-select/ix-select.js";const so="http://localhost".replace(/\/+$/,"");class te{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:so}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Gt}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const ro=new te;class Z{constructor(t=ro){this.configuration=t,this.fetchApi=async(i,o)=>{let n={url:i,init:o};for(const r of this.middleware)r.pre&&(n=await r.pre({fetch:this.fetchApi,...n})||n);let a;try{a=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(r){for(const c of this.middleware)c.onError&&(a=await c.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:r,response:a?a.clone():void 0})||a);if(a===void 0)throw r instanceof Error?new uo(r,"The request failed and the interceptors did not return an alternative response"):r}for(const r of this.middleware)r.post&&(a=await r.post({fetch:this.fetchApi,url:n.url,init:n.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(o=>({pre:o}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(o=>({post:o}));return this.withMiddleware(...i)}isJsonMime(t){return t?Z.jsonRegex.test(t):!1}async request(t,i){const{url:o,init:n}=await this.createFetchParams(t,i),a=await this.fetchApi(o,n);if(a&&a.status>=200&&a.status<300)return a;throw new jt(a,"Response returned an error code")}async createFetchParams(t,i){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(h=>n[h]===void 0?delete n[h]:{});const a=typeof i=="function"?i:async()=>i,r={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},c={...r,...await a({init:r,context:t})};let p;co(c.body)||c.body instanceof URLSearchParams||lo(c.body)?p=c.body:this.isJsonMime(n["Content-Type"])?p=JSON.stringify(c.body):p=c.body;const g={...c,body:p};return{url:o,init:g}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}Z.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function lo(e){return typeof Blob<"u"&&e instanceof Blob}function co(e){return typeof FormData<"u"&&e instanceof FormData}class jt extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class uo extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class R extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function f(e,t){return e[t]!=null}function Gt(e,t=""){return Object.keys(e).map(i=>Kt(i,e[i],t)).filter(i=>i.length>0).join("&")}function Kt(e,t,i=""){const o=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(a=>encodeURIComponent(String(a))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Kt(e,n,i)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Gt(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}class S{constructor(t,i=o=>o){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class ge{constructor(t){this.raw=t}async value(){}}const _={AccountSwitched:"account-switched",AuthenticationComplete:"authentication",CancelCreateUser:"cancel-create-user",ChangeUserAccount:"change-user-account",CloseDrawer:"close-drawer",CheckToggle:"check-toggle",CloseDialog:"close-dialog",CreateNewContact:"create-new-contact",CreateRole:"create-role",CreateUser:"create-user",AddRole:"add-role",ChangeAccountAssociation:"change-account",UpdateChanges:"update-changes",ReloadAccount:"reload-account",CreateUserClicked:"create-user-clicked",DrawerClose:"drawer-close",DuplicateRole:"duplicate-role",ErrorRaised:"um:error-raised",EvacAssistanceRequired:"evac-assistance-required",GridViewUpdate:"grid-view-update",NextButtonToggle:"next-button-toggle",NextStep:"next-step",OpenDialog:"open-dialog",PreviousStep:"previous-step",RefreshTable:"refresh-table",ResetSuccess:"reset-success",RouteChanged:"vaadin-router-location-changed",SetStep:"set-step",ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",ToggleDrawer:"toggle-drawer",ToggleNavBar:"toggle-menu",UpdateAccounts:"update-accounts",UpdateContact:"update-contact",UpdateDFA:"update-dfa",UpdateForm:"update-form",UserFlagUpdate:"user-flag-update",EditProfile:"edit-profile"},Jt=(e,t,i,o)=>{Pt({text:e,duration:t,newWindow:!1,close:!1,gravity:"bottom",position:i!=null?i:"right",stopOnFocus:!0,className:"success-toast",style:{background:"rgb(76, 175, 80)",minWidth:o!=null?o:"344px",maxHeight:"68px"}}).showToast()},Zt=(e,t,i)=>{Pt({text:e,duration:t,newWindow:!1,close:!1,gravity:"bottom",position:i!=null?i:"right",stopOnFocus:!0,style:{background:"rgb(219, 0, 40)",minWidth:"fit-content"}}).showToast()};function D(){var e;const t=(e=window.gpConfig)===null||e===void 0?void 0:e["ui-user-management"];if(!t)throw new Error("ui-user-management config not loaded. Ensure config.json is fetched before app bootstrap.");return t}class po{constructor(){this.fetchAppInsightsFromWindow=()=>window._appInsights,this.tryFetchShellAppInsights=()=>{const i=this.fetchAppInsightsFromWindow();if(!i){const o=this.buildStandaloneAppInsights();return o.trackException({severityLevel:4,exception:new Error("Application Insights instance could not be located on window. Falling back to standalone instance.")}),o}return i},this.buildStandaloneAppInsights=()=>{const i=new Ki({config:{connectionString:D().UserManagement.UI.AppInsights.ConnectionString,isCookieUseDisabled:!0}});return i.loadAppInsights(),this.fetchAppInsightsFromWindow()&&i.trackException({severityLevel:4,exception:new Error("Application Insights instance already exists on window, but we're registering it again in standalone. This will cause issues with telemetry.")}),i};const t=D();this.appInsights=t.UserManagement.UI.AppInsights.ShouldUseGlobal?this.tryFetchShellAppInsights():this.buildStandaloneAppInsights()}}const ho=new po;var mo=ho.appInsights;class Dt{constructor(){this.displayErrorBinding=this.displayError.bind(this),this.setupErrorHandler=()=>{document.addEventListener(_.ErrorRaised,this.displayErrorBinding)},this.destroyErrorHandler=()=>{document.removeEventListener(_.ErrorRaised,this.displayErrorBinding)},this.handleError=async(t,i)=>{let o=t;o.userMessage=i,t instanceof jt&&await t.response.json().then(n=>{var a;o.message=n.detail,n.status===403&&(o.userMessage=(a=n.detail)!==null&&a!==void 0?a:"You don't have permission to perform this action.")}).catch(()=>{o.message="Failed to get the error details from response."}),t instanceof PromiseRejectionEvent&&(o=await t.reason),mo.trackException({exception:o}),this.displayError(o),console.error(o)},this.setupErrorHandler()}static getInstance(){return this.instance||(this.instance=new Dt),this.instance}displayError(t){let i="";typeof t=="string"?i=t:"userMessage"in t?i=t.userMessage:"message"in t&&(typeof t.message=="object"?i=JSON.stringify(t.message):i=String(t.message)),Zt(i,5e3,"center")}consoleError(t){console.error(t)}}const m=Dt.getInstance(),Wt=E`:host{--navbar-width:256px;--navbar-closed-width:80px;--logo-padding-left:0px;--navbar-icon-min-width:24px}.nav-bar{background:linear-gradient(#1456e0 20.5%,#0d2497 113.5%)}.nav-bar.wide{background:linear-gradient(90.27deg,#1456e0 0,#0d2497 99.23%)}.nav-bar.long{width:var(--navbar-width)}.nav-bar.long.closed{width:var(--navbar-closed-width)}.white-icon{--md-icon-button-icon-color:white;--md-sys-color-on-surface-variant:white}.animate-width{transition:width .3s ease,viewBox .3s ease,left .3s ease,opacity 3s ease}.expand-cta{--md-icon-button-icon-color:#94a3b8}.divider{border-color:#fff;opacity:.2;margin:0;flex-shrink:0;border-width:0 0 thin;border-style:solid}`;let Qt=class extends I{render(){return l` <ix-icon-button @click="${()=>{localStorage.clear(),window.location.href="/"}}" icon="restart_alt"> </ix-icon-button> `}};Qt=s([b("dev-clear-storage-button")],Qt);const A=E` *, ::before, ::after {
|
|
1
|
+
import{__decorate as s}from"tslib";import{css as E,LitElement as I,html as l,svg as Oe,nothing as x}from"lit";import{customElement as b,property as d,state as u,query as U,queryAsync as eo}from"lit/decorators.js";import{MobxLitElement as Ie}from"@adobe/lit-mobx";import{elementTheme as ce,baseTheme as _e}from"@digital-realty/theme";import zt from"toastify-js";import{ApplicationInsights as to}from"@microsoft/applicationinsights-web";import"@digital-realty/ix-progress/ix-progress.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import{makeAutoObservable as io,toJS as ke,observable as qt,makeObservable as oo}from"mobx";import{gql as Ee,GraphQLClient as no}from"graphql-request";import{User as ao,UserManager as so}from"oidc-client-ts";import Ht from"i18next";import{initLitI18n as ro}from"lit-i18n";import{Router as he}from"@vaadin/router";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-dialog/ix-dialog.js";import"@digital-realty/ix-textbox/ix-textbox.js";import"@digital-realty/ix-phone-input/ix-phone-input.js";import{parsePhoneNumberWithError as Vt,AsYouType as lo,isPossiblePhoneNumber as co}from"libphonenumber-js";import{classMap as uo}from"lit/directives/class-map.js";import po from"validator";import"@digital-realty/ix-tree/ix-tree.js";import"@digital-realty/ix-multi-select/ix-multi-select.js";import{IconTypeMap as ho,updateNodeCheckedStatus as me,flattenTree as mo,findChildNodeById as ze,collapseAllNodes as qe,calculateCheckedEndNodesCount as jt,getCheckedAndIndeterminateNodesOnly as Gt,buildTreeFromFlatArray as Kt,updateChildrenCount as Jt}from"@digital-realty/ix-generic-tree";import{repeat as lt}from"lit/directives/repeat.js";import"@digital-realty/ix-tabs/ix-tabs.js";import"@digital-realty/ix-tabs/ix-primary-tab.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-card/ix-card.js";import Zt from"lodash.debounce";import"@digital-realty/ix-generic-tree/ix-generic-tree.js";import"@digital-realty/ix-accordion/ix-accordion.js";import"@digital-realty/ix-divider/ix-divider.js";import"@digital-realty/ix-phone-number/ix-phone-number.js";import"@material/web/icon/icon.js";import"@digital-realty/ix-select/ix-select.js";const go="http://localhost".replace(/\/+$/,"");class te{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:go}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Qt}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const vo=new te;class W{constructor(t=vo){this.configuration=t,this.fetchApi=async(i,o)=>{let n={url:i,init:o};for(const r of this.middleware)r.pre&&(n=await r.pre({fetch:this.fetchApi,...n})||n);let a;try{a=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(r){for(const c of this.middleware)c.onError&&(a=await c.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:r,response:a?a.clone():void 0})||a);if(a===void 0)throw r instanceof Error?new bo(r,"The request failed and the interceptors did not return an alternative response"):r}for(const r of this.middleware)r.post&&(a=await r.post({fetch:this.fetchApi,url:n.url,init:n.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(o=>({pre:o}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(o=>({post:o}));return this.withMiddleware(...i)}isJsonMime(t){return t?W.jsonRegex.test(t):!1}async request(t,i){const{url:o,init:n}=await this.createFetchParams(t,i),a=await this.fetchApi(o,n);if(a&&a.status>=200&&a.status<300)return a;throw new Wt(a,"Response returned an error code")}async createFetchParams(t,i){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(h=>n[h]===void 0?delete n[h]:{});const a=typeof i=="function"?i:async()=>i,r={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},c={...r,...await a({init:r,context:t})};let p;yo(c.body)||c.body instanceof URLSearchParams||fo(c.body)?p=c.body:this.isJsonMime(n["Content-Type"])?p=JSON.stringify(c.body):p=c.body;const g={...c,body:p};return{url:o,init:g}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}W.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function fo(e){return typeof Blob<"u"&&e instanceof Blob}function yo(e){return typeof FormData<"u"&&e instanceof FormData}class Wt extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class bo extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class R extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function f(e,t){return e[t]!=null}function Qt(e,t=""){return Object.keys(e).map(i=>Yt(i,e[i],t)).filter(i=>i.length>0).join("&")}function Yt(e,t,i=""){const o=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(a=>encodeURIComponent(String(a))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Yt(e,n,i)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Qt(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}class S{constructor(t,i=o=>o){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class ge{constructor(t){this.raw=t}async value(){}}const _={AccountSwitched:"account-switched",AuthenticationComplete:"authentication",CancelCreateUser:"cancel-create-user",ChangeUserAccount:"change-user-account",CloseDrawer:"close-drawer",CheckToggle:"check-toggle",CloseDialog:"close-dialog",CreateNewContact:"create-new-contact",CreateRole:"create-role",CreateUser:"create-user",AddRole:"add-role",ChangeAccountAssociation:"change-account",UpdateChanges:"update-changes",ReloadAccount:"reload-account",CreateUserClicked:"create-user-clicked",DrawerClose:"drawer-close",DuplicateRole:"duplicate-role",ErrorRaised:"um:error-raised",EvacAssistanceRequired:"evac-assistance-required",GridViewUpdate:"grid-view-update",NextButtonToggle:"next-button-toggle",NextStep:"next-step",OpenDialog:"open-dialog",PreviousStep:"previous-step",RefreshTable:"refresh-table",ResetSuccess:"reset-success",RouteChanged:"vaadin-router-location-changed",SetStep:"set-step",ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",ToggleDrawer:"toggle-drawer",ToggleNavBar:"toggle-menu",UpdateAccounts:"update-accounts",UpdateContact:"update-contact",UpdateDFA:"update-dfa",UpdateForm:"update-form",UserFlagUpdate:"user-flag-update",EditProfile:"edit-profile"},Xt=(e,t,i,o)=>{zt({text:e,duration:t,newWindow:!1,close:!1,gravity:"bottom",position:i!=null?i:"right",stopOnFocus:!0,className:"success-toast",style:{background:"rgb(76, 175, 80)",minWidth:o!=null?o:"344px",maxHeight:"68px"}}).showToast()},ei=(e,t,i)=>{zt({text:e,duration:t,newWindow:!1,close:!1,gravity:"bottom",position:i!=null?i:"right",stopOnFocus:!0,style:{background:"rgb(219, 0, 40)",minWidth:"fit-content"}}).showToast()};function D(){var e;const t=(e=window.gpConfig)===null||e===void 0?void 0:e["ui-user-management"];if(!t)throw new Error("ui-user-management config not loaded. Ensure config.json is fetched before app bootstrap.");return t}class xo{constructor(){this.fetchAppInsightsFromWindow=()=>window._appInsights,this.tryFetchShellAppInsights=()=>{const i=this.fetchAppInsightsFromWindow();if(!i){const o=this.buildStandaloneAppInsights();return o.trackException({severityLevel:4,exception:new Error("Application Insights instance could not be located on window. Falling back to standalone instance.")}),o}return i},this.buildStandaloneAppInsights=()=>{const i=new to({config:{connectionString:D().UserManagement.UI.AppInsights.ConnectionString,isCookieUseDisabled:!0}});return i.loadAppInsights(),this.fetchAppInsightsFromWindow()&&i.trackException({severityLevel:4,exception:new Error("Application Insights instance already exists on window, but we're registering it again in standalone. This will cause issues with telemetry.")}),i};const t=D();this.appInsights=t.UserManagement.UI.AppInsights.ShouldUseGlobal?this.tryFetchShellAppInsights():this.buildStandaloneAppInsights()}}const wo=new xo;var Ao=wo.appInsights;class Ot{constructor(){this.displayErrorBinding=this.displayError.bind(this),this.setupErrorHandler=()=>{document.addEventListener(_.ErrorRaised,this.displayErrorBinding)},this.destroyErrorHandler=()=>{document.removeEventListener(_.ErrorRaised,this.displayErrorBinding)},this.handleError=async(t,i)=>{let o=t;o.userMessage=i,t instanceof Wt&&await t.response.json().then(n=>{var a;o.message=n.detail,n.status===403&&(o.userMessage=(a=n.detail)!==null&&a!==void 0?a:"You don't have permission to perform this action.")}).catch(()=>{o.message="Failed to get the error details from response."}),t instanceof PromiseRejectionEvent&&(o=await t.reason),Ao.trackException({exception:o}),this.displayError(o),console.error(o)},this.setupErrorHandler()}static getInstance(){return this.instance||(this.instance=new Ot),this.instance}displayError(t){let i="";typeof t=="string"?i=t:"userMessage"in t?i=t.userMessage:"message"in t&&(typeof t.message=="object"?i=JSON.stringify(t.message):i=String(t.message)),ei(i,5e3,"center")}consoleError(t){console.error(t)}}const m=Ot.getInstance(),ti=E`:host{--navbar-width:256px;--navbar-closed-width:80px;--logo-padding-left:0px;--navbar-icon-min-width:24px}.nav-bar{background:linear-gradient(#1456e0 20.5%,#0d2497 113.5%)}.nav-bar.wide{background:linear-gradient(90.27deg,#1456e0 0,#0d2497 99.23%)}.nav-bar.long{width:var(--navbar-width)}.nav-bar.long.closed{width:var(--navbar-closed-width)}.white-icon{--md-icon-button-icon-color:white;--md-sys-color-on-surface-variant:white}.animate-width{transition:width .3s ease,viewBox .3s ease,left .3s ease,opacity 3s ease}.expand-cta{--md-icon-button-icon-color:#94a3b8}.divider{border-color:#fff;opacity:.2;margin:0;flex-shrink:0;border-width:0 0 thin;border-style:solid}`;let ii=class extends I{render(){return l` <ix-icon-button @click="${()=>{localStorage.clear(),window.location.href="/"}}" icon="restart_alt"> </ix-icon-button> `}};ii=s([b("dev-clear-storage-button")],ii);const A=E` *, ::before, ::after {
|
|
2
2
|
--tw-border-spacing-x: 0;
|
|
3
3
|
--tw-border-spacing-y: 0;
|
|
4
4
|
--tw-translate-x: 0;
|
|
@@ -609,6 +609,18 @@ video {
|
|
|
609
609
|
text-transform:var(--text-caption-transform);
|
|
610
610
|
}
|
|
611
611
|
|
|
612
|
+
.sr-only {
|
|
613
|
+
position: absolute;
|
|
614
|
+
width: 1px;
|
|
615
|
+
height: 1px;
|
|
616
|
+
padding: 0;
|
|
617
|
+
margin: -1px;
|
|
618
|
+
overflow: hidden;
|
|
619
|
+
clip: rect(0, 0, 0, 0);
|
|
620
|
+
white-space: nowrap;
|
|
621
|
+
border-width: 0;
|
|
622
|
+
}
|
|
623
|
+
|
|
612
624
|
.visible {
|
|
613
625
|
visibility: visible;
|
|
614
626
|
}
|
|
@@ -669,6 +681,10 @@ video {
|
|
|
669
681
|
z-index: 50;
|
|
670
682
|
}
|
|
671
683
|
|
|
684
|
+
.float-right {
|
|
685
|
+
float: right;
|
|
686
|
+
}
|
|
687
|
+
|
|
672
688
|
.m-0 {
|
|
673
689
|
margin: 0px;
|
|
674
690
|
}
|
|
@@ -821,10 +837,6 @@ video {
|
|
|
821
837
|
max-height: 24rem;
|
|
822
838
|
}
|
|
823
839
|
|
|
824
|
-
.max-h-\\[250px\\] {
|
|
825
|
-
max-height: 250px;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
840
|
.max-h-\\[25vh\\] {
|
|
829
841
|
max-height: 25vh;
|
|
830
842
|
}
|
|
@@ -837,10 +849,6 @@ video {
|
|
|
837
849
|
max-height: 100vh;
|
|
838
850
|
}
|
|
839
851
|
|
|
840
|
-
.min-h-\\[250px\\] {
|
|
841
|
-
min-height: 250px;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
852
|
.min-h-full {
|
|
845
853
|
min-height: 100%;
|
|
846
854
|
}
|
|
@@ -1360,10 +1368,6 @@ video {
|
|
|
1360
1368
|
font-weight: 700;
|
|
1361
1369
|
}
|
|
1362
1370
|
|
|
1363
|
-
.font-extralight {
|
|
1364
|
-
font-weight: 200;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
1371
|
.font-medium {
|
|
1368
1372
|
font-weight: 500;
|
|
1369
1373
|
}
|
|
@@ -1698,7 +1702,7 @@ video {
|
|
|
1698
1702
|
<path d="M3 3C1.897 3 1 3.897 1 5V21H11V19H3V5H13V12C13 10.37 13.792 8.93544 15 8.02344V5C15 3.897 14.103 3 13 3H3ZM5 7V9H7V7H5ZM9 7V9H11V7H9ZM18 9C16.318 9 15 10.317 15 12C15 13.683 16.318 15 18 15C19.682 15 21 13.683 21 12C21 10.317 19.682 9 18 9ZM5 11V13H7V11H5ZM9 11V13H11V11H9ZM18 11C18.58 11 19 11.421 19 12C19 12.579 18.58 13 18 13C17.42 13 17 12.579 17 12C17 11.421 17.42 11 18 11ZM5 15V17H7V15H5ZM9 15V17H11V15H9ZM18 16C15.149 16 13 17.4558 13 19.3848V21H23V19.3848C23 17.4558 20.851 16 18 16ZM18 18C19.47 18 20.4895 18.504 20.8535 19H15.1465C15.5095 18.504 16.53 18 18 18Z"></path>
|
|
1699
1703
|
`,roleManagementIcon:Oe`
|
|
1700
1704
|
<path d="M12 3C9.80271 3 8 4.80271 8 7C8 9.19729 9.80271 11 12 11C14.1973 11 16 9.19729 16 7C16 4.80271 14.1973 3 12 3ZM12 5C13.1164 5 14 5.88359 14 7C14 8.11641 13.1164 9 12 9C10.8836 9 10 8.11641 10 7C10 5.88359 10.8836 5 12 5ZM18 12C16.1872 12 14.5593 12.8158 13.457 14.0957C12.9584 14.0389 12.4662 14 12 14C10.255 14 8.18716 14.4098 6.44922 15.0957C5.58025 15.4387 4.7947 15.846 4.16602 16.3691C3.53734 16.8922 3 17.5994 3 18.5V21H12.8145C13.8556 22.789 15.7903 24 18 24C21.3019 24 24 21.3019 24 18C24 14.6981 21.3019 12 18 12ZM18 14C19.0039 14 19.9057 14.377 20.6055 14.9805L18 17.5859L16.707 16.293L15.293 17.707L18 20.4141L21.7559 16.6582C21.9049 17.0789 22 17.5261 22 18C22 20.221 20.221 22 18 22C15.779 22 14 20.221 14 18C14 15.779 15.779 14 18 14ZM12 16C12.1083 16 12.2316 16.0115 12.3457 16.0156C12.1256 16.6382 12 17.3041 12 18C12 18.3415 12.0364 18.6738 12.0918 19H5V18.5C5 18.4346 5.06759 18.2205 5.44531 17.9062C5.82304 17.592 6.44549 17.2456 7.18164 16.9551C8.65395 16.374 10.586 16 12 16Z"></path>
|
|
1701
|
-
`};class go{constructor(){this.error=void 0,this.loading=!0,this.permissions=[],this.email=void 0,this.accountNumber="",this.accounts=[],this.accountHierarchy=[],this.permissionAssignment=[],Ji(this)}setPermissions(t){this.permissions=structuredClone(t)}setError(t){this.error=t}set setLoading(t){this.loading=t}get getLoading(){return this.loading}clearError(){this.error=void 0}getMyPermissions(){return ke(this.permissionAssignment)}setMyPermissions(t){this.permissionAssignment=structuredClone(t)}getPermissions(){return ke(this.permissions)}setEmail(t){this.email=t}getEmail(){return this.email}setAccountNumber(t){this.accountNumber=t}getAccountNumber(){return this.accountNumber}setAccounts(t){this.accounts=t}getAccounts(){return ke(this.accounts)}setAccountHierarchy(t){this.accountHierarchy=t}getAccountHierarchy(){return ke(this.accountHierarchy)}}const U=new go,C={user:"User",externalUser:"External User",internalUser:"Internal User",customRoles:"Custom Roles",internalRoles:"Internal Roles",defaultRoles:"Default System Roles",assignInternalRole:"Assign Internal Role"},y={read:"read",update:"update",create:"create",approve:"approve"};function vo(e){return fo(e)}function fo(e,t){return e==null?e:{account_number:f(e,"account_number")?e.account_number:void 0,parent_account_number:f(e,"parent_account_number")?e.parent_account_number:void 0,name:f(e,"name")?e.name:void 0,friendly_name:f(e,"friendly_name")?e.friendly_name:void 0}}function Yt(e){return yo(e)}function yo(e,t){return e}function rt(e){return bo(e)}function bo(e,t){return e==null?e:{id:e.id,account_number:e.account_number,account_name:e.account_name,account_friendly_name:e.account_friendly_name,status:Yt(e.status),updated_at:e.updated_at,updated_by:e.updated_by,user_id:e.user_id}}function xo(e){if(e!==void 0)return e===null?null:{user_id:e.user_id,account_number:e.account_number}}function wo(e){if(e!==void 0)return e===null?null:{status:e.status}}function Ao(e){if(e!==void 0)return e===null?null:{role_id:e.role_id,user_id:e.user_id,account_number:e.account_number,location_id:e.location_id}}function Co(e){if(e!==void 0)return e===null?null:{RoleAssignmentInput:e.RoleAssignmentInput===void 0?void 0:e.RoleAssignmentInput.map(Ao)}}function To(e){return Io(e)}function Io(e,t){return e}function Tr(e){return e}function _o(e){if(e!==void 0)return e===null?null:{user_flag_type:e.user_flag_type,user_id:e.user_id,account_number:e.account_number,location_id:e.location_id}}function ko(e){if(e!==void 0)return e===null?null:{UserFlagAssignmentInputs:e.UserFlagAssignmentInputs===void 0?void 0:e.UserFlagAssignmentInputs.map(_o)}}function Re(e){if(e!==void 0)return e===null?null:{permission_id:e.permission_id,privilege:e.privilege}}function Eo(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re),account_number:e.account_number}}function Ro(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re)}}function So(e){if(e!==void 0)return e===null?null:{email_address:e.email_address}}function Uo(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re)}}function $o(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re)}}function No(e){return Fo(e)}function Fo(e,t){return e==null?e:{first_name:f(e,"first_name")?e.first_name:void 0,last_name:f(e,"last_name")?e.last_name:void 0,email:f(e,"email")?e.email:void 0,account_permission_group:f(e,"account_permission_group")?e.account_permission_group:void 0,account_associations:f(e,"account_associations")?e.account_associations:void 0}}function Do(e){return Po(e)}function Po(e,t){return e==null?e:{items:f(e,"items")?e.items.map(No):void 0}}function Mo(e){return Bo(e)}function Bo(e,t){return e==null?e:{id:e.id,name:e.name,is_non_location:e.is_non_location,category:f(e,"category")?e.category:void 0,privileges:e.privileges,internal_privileges:e.internal_privileges,is_internal:e.is_internal}}function Lo(e){return Oo(e)}function Oo(e,t){return e==null?e:{account_number:e.account_number,permission_name:e.permission_name,privilege:e.privilege,privilege_is_internal:e.privilege_is_internal,is_non_location:f(e,"is_non_location")?e.is_non_location:void 0}}function zo(e){return qo(e)}function qo(e,t){return e==null?e:{permission_id:e.permission_id,permission_name:e.permission_name,is_non_location:e.is_non_location,privilege:f(e,"privilege")?e.privilege:void 0}}function lt(e){return Ho(e)}function Ho(e,t){return e==null?e:{id:e.id,name:e.name,account_number:f(e,"account_number")?e.account_number:void 0,role_type:e.role_type,permissions:e.permissions.map(zo)}}function ct(e){return Vo(e)}function Vo(e,t){return e==null?e:{role_id:e.role_id,user_id:e.user_id,account_number:e.account_number,location_id:f(e,"location_id")?e.location_id:void 0,id:e.id,is_active:e.is_active}}function jo(e){if(e!==void 0){if(e===null)return null;switch(e.role_type){case"CUSTOM":return Eo(e);case"DEFAULT":return Ro(e);case"GLOBALACCESS":return Uo(e);case"INTERNAL":return $o(e);default:throw new Error(`No variant of RoleCreate exists with 'role_type=${e.role_type}'`)}}}function Go(e){if(e!==void 0)return e===null?null:{role_name:e.role_name,permissions:e.permissions.map(Re)}}function Ko(e){return Jo(e)}function Jo(e,t){return e==null?e:{id:e.id,account_number:e.account_number,account_name:e.account_name,account_friendly_name:e.account_friendly_name,status:Yt(e.status),updated_at:e.updated_at,updated_by:e.updated_by}}function dt(e){return Zo(e)}function Zo(e,t){return e==null?e:{first_name:e.first_name,last_name:e.last_name,email:e.email,phone:e.phone,evacuation_assistance_required:f(e,"evacuation_assistance_required")?e.evacuation_assistance_required:void 0,id:e.id,is_active:f(e,"is_active")?e.is_active:void 0,account_associations:f(e,"account_associations")?e.account_associations.map(Ko):void 0}}function ut(e){return Wo(e)}function Wo(e,t){return e==null?e:{user_flag_type:To(e.user_flag_type),user_id:e.user_id,account_number:e.account_number,location_id:e.location_id,id:e.id,is_active:f(e,"is_active")?e.is_active:void 0}}function Qo(e){if(e!==void 0)return e===null?null:{first_name:e.first_name,last_name:e.last_name,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacuation_assistance_required,account_numbers:e.account_numbers}}function Yo(e){if(e!==void 0)return e===null?null:{first_name:e.first_name,last_name:e.last_name,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacuation_assistance_required}}function Xo(e){return en(e)}function en(e,t){return e==null?e:{number:f(e,"number")?e.number:void 0,total_pages:f(e,"total_pages")?e.total_pages:void 0,first:f(e,"first")?e.first:void 0,last:f(e,"last")?e.last:void 0,size:f(e,"size")?e.size:void 0,number_of_elements:f(e,"number_of_elements")?e.number_of_elements:void 0,total_elements:f(e,"total_elements")?e.total_elements:void 0}}function tn(e){return on(e)}function on(e,t){return e==null?e:{content:f(e,"content")?e.content.map(dt):void 0,pageable:f(e,"pageable")?Xo(e.pageable):void 0}}function nn(e){return an(e)}function an(e,t){return e==null?e:{email_address:f(e,"email_address")?e.email_address:void 0,is_verified:f(e,"is_verified")?e.is_verified:void 0,reason:f(e,"reason")?e.reason:void 0}}class sn extends Z{async createAccountAssociationRaw(t,i){if(t.accountAssociationInput===null||t.accountAssociationInput===void 0)throw new R("accountAssociationInput","Required parameter requestParameters.accountAssociationInput was null or undefined when calling createAccountAssociation.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations",method:"POST",headers:n,query:o,body:xo(t.accountAssociationInput)},i);return new S(a,r=>rt(r))}async createAccountAssociation(t,i){return await(await this.createAccountAssociationRaw(t,i)).value()}async getAccountAssociationsRaw(t,i){const o={};t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.userId!==void 0&&(o.user_id=t.userId),t.status!==void 0&&(o.status=t.status);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(rt))}async getAccountAssociations(t={},i){return await(await this.getAccountAssociationsRaw(t,i)).value()}async getUserAccountAssociationRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getUserAccountAssociation.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>rt(r))}async getUserAccountAssociation(t,i){return await(await this.getUserAccountAssociationRaw(t,i)).value()}async updateAccountAssociationStatusRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling updateAccountAssociationStatus.");if(t.accountAssociationStatusUpdate===null||t.accountAssociationStatusUpdate===void 0)throw new R("accountAssociationStatusUpdate","Required parameter requestParameters.accountAssociationStatusUpdate was null or undefined when calling updateAccountAssociationStatus.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PATCH",headers:n,query:o,body:wo(t.accountAssociationStatusUpdate)},i);return new ge(a)}async updateAccountAssociationStatus(t,i){await this.updateAccountAssociationStatusRaw(t,i)}}class rn extends Z{async getAccountsRaw(t){const i={},o={};this.configuration&&this.configuration.accessToken&&(o.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/accounts",method:"GET",headers:o,query:i},t);return new S(n,a=>a.map(vo))}async getAccounts(t){return await(await this.getAccountsRaw(t)).value()}}class ln extends Z{async getPermissionsRaw(t){const i={},o={};this.configuration&&this.configuration.accessToken&&(o.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/permissions",method:"GET",headers:o,query:i},t);return new S(n,a=>a.map(Mo))}async getPermissions(t){return await(await this.getPermissionsRaw(t)).value()}async getUserPermissionsRaw(t,i){const o={};t.excludeSiblings!==void 0&&(o.exclude_siblings=t.excludeSiblings),t.excludeParents!==void 0&&(o.exclude_parents=t.excludeParents);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/my-permissions",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(Lo))}async getUserPermissions(t={},i){return await(await this.getUserPermissionsRaw(t,i)).value()}}class cn extends Z{async createRoleAssignmentsRaw(t,i){if(t.createRoleAssignment===null||t.createRoleAssignment===void 0)throw new R("createRoleAssignment","Required parameter requestParameters.createRoleAssignment was null or undefined when calling createRoleAssignments.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments",method:"POST",headers:n,query:o,body:Co(t.createRoleAssignment)},i);return new S(a,r=>r.map(ct))}async createRoleAssignments(t,i){return await(await this.createRoleAssignmentsRaw(t,i)).value()}async deleteRoleAssignmentRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling deleteRoleAssignment.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:n,query:o},i);return new ge(a)}async deleteRoleAssignment(t,i){await this.deleteRoleAssignmentRaw(t,i)}async getRoleAssignmentRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getRoleAssignment.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>ct(r))}async getRoleAssignment(t,i){return await(await this.getRoleAssignmentRaw(t,i)).value()}async getRoleAssignmentsRaw(t,i){const o={};t.roleId!==void 0&&(o.role_id=t.roleId),t.userId!==void 0&&(o.user_id=t.userId),t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.locationId!==void 0&&(o.location_id=t.locationId),t.roleType!==void 0&&(o.role_type=t.roleType);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(ct))}async getRoleAssignments(t={},i){return await(await this.getRoleAssignmentsRaw(t,i)).value()}}class dn extends Z{async createRoleRaw(t,i){if(t.roleCreate===null||t.roleCreate===void 0)throw new R("roleCreate","Required parameter requestParameters.roleCreate was null or undefined when calling createRole.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles",method:"POST",headers:n,query:o,body:jo(t.roleCreate)},i);return new S(a,r=>lt(r))}async createRole(t,i){return await(await this.createRoleRaw(t,i)).value()}async deleteRoleRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling deleteRole.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:n,query:o},i);return new ge(a)}async deleteRole(t,i){await this.deleteRoleRaw(t,i)}async getRoleRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getRole.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>lt(r))}async getRole(t,i){return await(await this.getRoleRaw(t,i)).value()}async getRolesRaw(t,i){const o={};t.roleType!==void 0&&(o.role_type=t.roleType);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(lt))}async getRoles(t={},i){return await(await this.getRolesRaw(t,i)).value()}async updateRoleRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling updateRole.");if(t.roleUpdate===null||t.roleUpdate===void 0)throw new R("roleUpdate","Required parameter requestParameters.roleUpdate was null or undefined when calling updateRole.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PUT",headers:n,query:o,body:Go(t.roleUpdate)},i);return new ge(a)}async updateRole(t,i){await this.updateRoleRaw(t,i)}}class un extends Z{async createUserFlagsRaw(t,i){if(t.createUserFlagAssignment===null||t.createUserFlagAssignment===void 0)throw new R("createUserFlagAssignment","Required parameter requestParameters.createUserFlagAssignment was null or undefined when calling createUserFlags.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags",method:"POST",headers:n,query:o,body:ko(t.createUserFlagAssignment)},i);return new S(a,r=>r.map(ut))}async createUserFlags(t,i){return await(await this.createUserFlagsRaw(t,i)).value()}async deleteUserFlagRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling deleteUserFlag.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:n,query:o},i);return new ge(a)}async deleteUserFlag(t,i){await this.deleteUserFlagRaw(t,i)}async getUserFlagRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getUserFlag.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>ut(r))}async getUserFlag(t,i){return await(await this.getUserFlagRaw(t,i)).value()}async getUserFlagsRaw(t,i){const o={};t.userFlagType!==void 0&&(o.user_flag_type=t.userFlagType),t.userId!==void 0&&(o.user_id=t.userId),t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.locationId!==void 0&&(o.location_id=t.locationId);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(ut))}async getUserFlags(t={},i){return await(await this.getUserFlagsRaw(t,i)).value()}}class pn extends Z{async createUserRaw(t,i){if(t.userInput===null||t.userInput===void 0)throw new R("userInput","Required parameter requestParameters.userInput was null or undefined when calling createUser.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users",method:"POST",headers:n,query:o,body:Qo(t.userInput)},i);return new S(a,r=>dt(r))}async createUser(t,i){return await(await this.createUserRaw(t,i)).value()}async getMyAccountsAdminsAndApproversRaw(t){const i={},o={};this.configuration&&this.configuration.accessToken&&(o.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/users/admins-and-approvers",method:"GET",headers:o,query:i},t);return new S(n,a=>Do(a))}async getMyAccountsAdminsAndApprovers(t){return await(await this.getMyAccountsAdminsAndApproversRaw(t)).value()}async getUserRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getUser.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>dt(r))}async getUser(t,i){return await(await this.getUserRaw(t,i)).value()}async getUsersRaw(t,i){const o={};t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.includeChildAccounts!==void 0&&(o.include_child_accounts=t.includeChildAccounts),t.page!==void 0&&(o.page=t.page),t.size!==void 0&&(o.size=t.size),t.firstName!==void 0&&(o.first_name=t.firstName),t.lastName!==void 0&&(o.last_name=t.lastName),t.email!==void 0&&(o.email=t.email),t.sort!==void 0&&(o.sort=t.sort),t.order!==void 0&&(o.order=t.order);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users",method:"GET",headers:n,query:o},i);return new S(a,r=>tn(r))}async getUsers(t={},i){return await(await this.getUsersRaw(t,i)).value()}async updateUserRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling updateUser.");if(t.userProfile===null||t.userProfile===void 0)throw new R("userProfile","Required parameter requestParameters.userProfile was null or undefined when calling updateUser.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PUT",headers:n,query:o,body:Yo(t.userProfile)},i);return new ge(a)}async updateUser(t,i){await this.updateUserRaw(t,i)}}class hn extends Z{async verifyEmailRaw(t,i){if(t.emailVerificationInput===null||t.emailVerificationInput===void 0)throw new R("emailVerificationInput","Required parameter requestParameters.emailVerificationInput was null or undefined when calling verifyEmail.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-attr-verification/email",method:"POST",headers:n,query:o,body:So(t.emailVerificationInput)},i);return new S(a,r=>nn(r))}async verifyEmail(t,i){return await(await this.verifyEmailRaw(t,i)).value()}}const mn=Ee`
|
|
1705
|
+
`};class Co{constructor(){this.error=void 0,this.loading=!0,this.permissions=[],this.email=void 0,this.accountNumber="",this.accounts=[],this.accountHierarchy=[],this.permissionAssignment=[],io(this)}setPermissions(t){this.permissions=structuredClone(t)}setError(t){this.error=t}set setLoading(t){this.loading=t}get getLoading(){return this.loading}clearError(){this.error=void 0}getMyPermissions(){return ke(this.permissionAssignment)}setMyPermissions(t){this.permissionAssignment=structuredClone(t)}getPermissions(){return ke(this.permissions)}setEmail(t){this.email=t}getEmail(){return this.email}setAccountNumber(t){this.accountNumber=t}getAccountNumber(){return this.accountNumber}setAccounts(t){this.accounts=t}getAccounts(){return ke(this.accounts)}setAccountHierarchy(t){this.accountHierarchy=t}getAccountHierarchy(){return ke(this.accountHierarchy)}}const $=new Co,C={user:"User",externalUser:"External User",internalUser:"Internal User",customRoles:"Custom Roles",internalRoles:"Internal Roles",defaultRoles:"Default System Roles",assignInternalRole:"Assign Internal Role"},y={read:"read",update:"update",create:"create",approve:"approve"};function To(e){return Io(e)}function Io(e,t){return e==null?e:{account_number:f(e,"account_number")?e.account_number:void 0,parent_account_number:f(e,"parent_account_number")?e.parent_account_number:void 0,name:f(e,"name")?e.name:void 0,friendly_name:f(e,"friendly_name")?e.friendly_name:void 0}}function oi(e){return _o(e)}function _o(e,t){return e}function ct(e){return ko(e)}function ko(e,t){return e==null?e:{id:e.id,account_number:e.account_number,account_name:e.account_name,account_friendly_name:e.account_friendly_name,status:oi(e.status),updated_at:e.updated_at,updated_by:e.updated_by,user_id:e.user_id}}function Eo(e){if(e!==void 0)return e===null?null:{user_id:e.user_id,account_number:e.account_number}}function Ro(e){if(e!==void 0)return e===null?null:{status:e.status}}function So(e){if(e!==void 0)return e===null?null:{role_id:e.role_id,user_id:e.user_id,account_number:e.account_number,location_id:e.location_id}}function $o(e){if(e!==void 0)return e===null?null:{RoleAssignmentInput:e.RoleAssignmentInput===void 0?void 0:e.RoleAssignmentInput.map(So)}}function Uo(e){return No(e)}function No(e,t){return e}function Tr(e){return e}function Fo(e){if(e!==void 0)return e===null?null:{user_flag_type:e.user_flag_type,user_id:e.user_id,account_number:e.account_number,location_id:e.location_id}}function Do(e){if(e!==void 0)return e===null?null:{UserFlagAssignmentInputs:e.UserFlagAssignmentInputs===void 0?void 0:e.UserFlagAssignmentInputs.map(Fo)}}function Re(e){if(e!==void 0)return e===null?null:{permission_id:e.permission_id,privilege:e.privilege}}function Po(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re),account_number:e.account_number}}function Mo(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re)}}function Bo(e){if(e!==void 0)return e===null?null:{email_address:e.email_address}}function Lo(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re)}}function Oo(e){if(e!==void 0)return e===null?null:{name:e.name,role_type:e.role_type,permissions:e.permissions.map(Re)}}function zo(e){return qo(e)}function qo(e,t){return e==null?e:{first_name:f(e,"first_name")?e.first_name:void 0,last_name:f(e,"last_name")?e.last_name:void 0,email:f(e,"email")?e.email:void 0,account_permission_group:f(e,"account_permission_group")?e.account_permission_group:void 0,account_associations:f(e,"account_associations")?e.account_associations:void 0}}function Ho(e){return Vo(e)}function Vo(e,t){return e==null?e:{items:f(e,"items")?e.items.map(zo):void 0}}function jo(e){return Go(e)}function Go(e,t){return e==null?e:{id:e.id,name:e.name,is_non_location:e.is_non_location,category:f(e,"category")?e.category:void 0,privileges:e.privileges,internal_privileges:e.internal_privileges,is_internal:e.is_internal}}function Ko(e){return Jo(e)}function Jo(e,t){return e==null?e:{account_number:e.account_number,permission_name:e.permission_name,privilege:e.privilege,privilege_is_internal:e.privilege_is_internal,is_non_location:f(e,"is_non_location")?e.is_non_location:void 0}}function Zo(e){return Wo(e)}function Wo(e,t){return e==null?e:{permission_id:e.permission_id,permission_name:e.permission_name,is_non_location:e.is_non_location,privilege:f(e,"privilege")?e.privilege:void 0}}function dt(e){return Qo(e)}function Qo(e,t){return e==null?e:{id:e.id,name:e.name,account_number:f(e,"account_number")?e.account_number:void 0,role_type:e.role_type,permissions:e.permissions.map(Zo)}}function ut(e){return Yo(e)}function Yo(e,t){return e==null?e:{role_id:e.role_id,user_id:e.user_id,account_number:e.account_number,location_id:f(e,"location_id")?e.location_id:void 0,id:e.id,is_active:e.is_active}}function Xo(e){if(e!==void 0){if(e===null)return null;switch(e.role_type){case"CUSTOM":return Po(e);case"DEFAULT":return Mo(e);case"GLOBALACCESS":return Lo(e);case"INTERNAL":return Oo(e);default:throw new Error(`No variant of RoleCreate exists with 'role_type=${e.role_type}'`)}}}function en(e){if(e!==void 0)return e===null?null:{role_name:e.role_name,permissions:e.permissions.map(Re)}}function tn(e){return on(e)}function on(e,t){return e==null?e:{id:e.id,account_number:e.account_number,account_name:e.account_name,account_friendly_name:e.account_friendly_name,status:oi(e.status),updated_at:e.updated_at,updated_by:e.updated_by}}function pt(e){return nn(e)}function nn(e,t){return e==null?e:{first_name:e.first_name,last_name:e.last_name,email:e.email,phone:e.phone,evacuation_assistance_required:f(e,"evacuation_assistance_required")?e.evacuation_assistance_required:void 0,id:e.id,is_active:f(e,"is_active")?e.is_active:void 0,account_associations:f(e,"account_associations")?e.account_associations.map(tn):void 0}}function ht(e){return an(e)}function an(e,t){return e==null?e:{user_flag_type:Uo(e.user_flag_type),user_id:e.user_id,account_number:e.account_number,location_id:e.location_id,id:e.id,is_active:f(e,"is_active")?e.is_active:void 0}}function sn(e){if(e!==void 0)return e===null?null:{first_name:e.first_name,last_name:e.last_name,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacuation_assistance_required,account_numbers:e.account_numbers}}function rn(e){if(e!==void 0)return e===null?null:{first_name:e.first_name,last_name:e.last_name,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacuation_assistance_required}}function ln(e){return cn(e)}function cn(e,t){return e==null?e:{number:f(e,"number")?e.number:void 0,total_pages:f(e,"total_pages")?e.total_pages:void 0,first:f(e,"first")?e.first:void 0,last:f(e,"last")?e.last:void 0,size:f(e,"size")?e.size:void 0,number_of_elements:f(e,"number_of_elements")?e.number_of_elements:void 0,total_elements:f(e,"total_elements")?e.total_elements:void 0}}function dn(e){return un(e)}function un(e,t){return e==null?e:{content:f(e,"content")?e.content.map(pt):void 0,pageable:f(e,"pageable")?ln(e.pageable):void 0}}function pn(e){return hn(e)}function hn(e,t){return e==null?e:{email_address:f(e,"email_address")?e.email_address:void 0,is_verified:f(e,"is_verified")?e.is_verified:void 0,reason:f(e,"reason")?e.reason:void 0}}class mn extends W{async createAccountAssociationRaw(t,i){if(t.accountAssociationInput===null||t.accountAssociationInput===void 0)throw new R("accountAssociationInput","Required parameter requestParameters.accountAssociationInput was null or undefined when calling createAccountAssociation.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations",method:"POST",headers:n,query:o,body:Eo(t.accountAssociationInput)},i);return new S(a,r=>ct(r))}async createAccountAssociation(t,i){return await(await this.createAccountAssociationRaw(t,i)).value()}async getAccountAssociationsRaw(t,i){const o={};t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.userId!==void 0&&(o.user_id=t.userId),t.status!==void 0&&(o.status=t.status);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(ct))}async getAccountAssociations(t={},i){return await(await this.getAccountAssociationsRaw(t,i)).value()}async getUserAccountAssociationRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getUserAccountAssociation.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>ct(r))}async getUserAccountAssociation(t,i){return await(await this.getUserAccountAssociationRaw(t,i)).value()}async updateAccountAssociationStatusRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling updateAccountAssociationStatus.");if(t.accountAssociationStatusUpdate===null||t.accountAssociationStatusUpdate===void 0)throw new R("accountAssociationStatusUpdate","Required parameter requestParameters.accountAssociationStatusUpdate was null or undefined when calling updateAccountAssociationStatus.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/account-associations/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PATCH",headers:n,query:o,body:Ro(t.accountAssociationStatusUpdate)},i);return new ge(a)}async updateAccountAssociationStatus(t,i){await this.updateAccountAssociationStatusRaw(t,i)}}class gn extends W{async getAccountsRaw(t){const i={},o={};this.configuration&&this.configuration.accessToken&&(o.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/accounts",method:"GET",headers:o,query:i},t);return new S(n,a=>a.map(To))}async getAccounts(t){return await(await this.getAccountsRaw(t)).value()}}class vn extends W{async getPermissionsRaw(t){const i={},o={};this.configuration&&this.configuration.accessToken&&(o.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/permissions",method:"GET",headers:o,query:i},t);return new S(n,a=>a.map(jo))}async getPermissions(t){return await(await this.getPermissionsRaw(t)).value()}async getUserPermissionsRaw(t,i){const o={};t.excludeSiblings!==void 0&&(o.exclude_siblings=t.excludeSiblings),t.excludeParents!==void 0&&(o.exclude_parents=t.excludeParents);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/my-permissions",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(Ko))}async getUserPermissions(t={},i){return await(await this.getUserPermissionsRaw(t,i)).value()}}class fn extends W{async createRoleAssignmentsRaw(t,i){if(t.createRoleAssignment===null||t.createRoleAssignment===void 0)throw new R("createRoleAssignment","Required parameter requestParameters.createRoleAssignment was null or undefined when calling createRoleAssignments.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments",method:"POST",headers:n,query:o,body:$o(t.createRoleAssignment)},i);return new S(a,r=>r.map(ut))}async createRoleAssignments(t,i){return await(await this.createRoleAssignmentsRaw(t,i)).value()}async deleteRoleAssignmentRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling deleteRoleAssignment.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:n,query:o},i);return new ge(a)}async deleteRoleAssignment(t,i){await this.deleteRoleAssignmentRaw(t,i)}async getRoleAssignmentRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getRoleAssignment.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>ut(r))}async getRoleAssignment(t,i){return await(await this.getRoleAssignmentRaw(t,i)).value()}async getRoleAssignmentsRaw(t,i){const o={};t.roleId!==void 0&&(o.role_id=t.roleId),t.userId!==void 0&&(o.user_id=t.userId),t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.locationId!==void 0&&(o.location_id=t.locationId),t.roleType!==void 0&&(o.role_type=t.roleType);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/role-assignments",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(ut))}async getRoleAssignments(t={},i){return await(await this.getRoleAssignmentsRaw(t,i)).value()}}class yn extends W{async createRoleRaw(t,i){if(t.roleCreate===null||t.roleCreate===void 0)throw new R("roleCreate","Required parameter requestParameters.roleCreate was null or undefined when calling createRole.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles",method:"POST",headers:n,query:o,body:Xo(t.roleCreate)},i);return new S(a,r=>dt(r))}async createRole(t,i){return await(await this.createRoleRaw(t,i)).value()}async deleteRoleRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling deleteRole.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:n,query:o},i);return new ge(a)}async deleteRole(t,i){await this.deleteRoleRaw(t,i)}async getRoleRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getRole.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>dt(r))}async getRole(t,i){return await(await this.getRoleRaw(t,i)).value()}async getRolesRaw(t,i){const o={};t.roleType!==void 0&&(o.role_type=t.roleType);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(dt))}async getRoles(t={},i){return await(await this.getRolesRaw(t,i)).value()}async updateRoleRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling updateRole.");if(t.roleUpdate===null||t.roleUpdate===void 0)throw new R("roleUpdate","Required parameter requestParameters.roleUpdate was null or undefined when calling updateRole.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PUT",headers:n,query:o,body:en(t.roleUpdate)},i);return new ge(a)}async updateRole(t,i){await this.updateRoleRaw(t,i)}}class bn extends W{async createUserFlagsRaw(t,i){if(t.createUserFlagAssignment===null||t.createUserFlagAssignment===void 0)throw new R("createUserFlagAssignment","Required parameter requestParameters.createUserFlagAssignment was null or undefined when calling createUserFlags.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags",method:"POST",headers:n,query:o,body:Do(t.createUserFlagAssignment)},i);return new S(a,r=>r.map(ht))}async createUserFlags(t,i){return await(await this.createUserFlagsRaw(t,i)).value()}async deleteUserFlagRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling deleteUserFlag.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:n,query:o},i);return new ge(a)}async deleteUserFlag(t,i){await this.deleteUserFlagRaw(t,i)}async getUserFlagRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getUserFlag.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>ht(r))}async getUserFlag(t,i){return await(await this.getUserFlagRaw(t,i)).value()}async getUserFlagsRaw(t,i){const o={};t.userFlagType!==void 0&&(o.user_flag_type=t.userFlagType),t.userId!==void 0&&(o.user_id=t.userId),t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.locationId!==void 0&&(o.location_id=t.locationId);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-flags",method:"GET",headers:n,query:o},i);return new S(a,r=>r.map(ht))}async getUserFlags(t={},i){return await(await this.getUserFlagsRaw(t,i)).value()}}class xn extends W{async createUserRaw(t,i){if(t.userInput===null||t.userInput===void 0)throw new R("userInput","Required parameter requestParameters.userInput was null or undefined when calling createUser.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users",method:"POST",headers:n,query:o,body:sn(t.userInput)},i);return new S(a,r=>pt(r))}async createUser(t,i){return await(await this.createUserRaw(t,i)).value()}async getMyAccountsAdminsAndApproversRaw(t){const i={},o={};this.configuration&&this.configuration.accessToken&&(o.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/users/admins-and-approvers",method:"GET",headers:o,query:i},t);return new S(n,a=>Ho(a))}async getMyAccountsAdminsAndApprovers(t){return await(await this.getMyAccountsAdminsAndApproversRaw(t)).value()}async getUserRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling getUser.");const o={},n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:n,query:o},i);return new S(a,r=>pt(r))}async getUser(t,i){return await(await this.getUserRaw(t,i)).value()}async getUsersRaw(t,i){const o={};t.accountNumber!==void 0&&(o.account_number=t.accountNumber),t.includeChildAccounts!==void 0&&(o.include_child_accounts=t.includeChildAccounts),t.page!==void 0&&(o.page=t.page),t.size!==void 0&&(o.size=t.size),t.firstName!==void 0&&(o.first_name=t.firstName),t.lastName!==void 0&&(o.last_name=t.lastName),t.email!==void 0&&(o.email=t.email),t.sort!==void 0&&(o.sort=t.sort),t.order!==void 0&&(o.order=t.order);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users",method:"GET",headers:n,query:o},i);return new S(a,r=>dn(r))}async getUsers(t={},i){return await(await this.getUsersRaw(t,i)).value()}async updateUserRaw(t,i){if(t.id===null||t.id===void 0)throw new R("id","Required parameter requestParameters.id was null or undefined when calling updateUser.");if(t.userProfile===null||t.userProfile===void 0)throw new R("userProfile","Required parameter requestParameters.userProfile was null or undefined when calling updateUser.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PUT",headers:n,query:o,body:rn(t.userProfile)},i);return new ge(a)}async updateUser(t,i){await this.updateUserRaw(t,i)}}class wn extends W{async verifyEmailRaw(t,i){if(t.emailVerificationInput===null||t.emailVerificationInput===void 0)throw new R("emailVerificationInput","Required parameter requestParameters.emailVerificationInput was null or undefined when calling verifyEmail.");const o={},n={};n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const a=await this.request({path:"/user-attr-verification/email",method:"POST",headers:n,query:o,body:Bo(t.emailVerificationInput)},i);return new S(a,r=>pn(r))}async verifyEmail(t,i){return await(await this.verifyEmailRaw(t,i)).value()}}const An=Ee`
|
|
1702
1706
|
fragment RoleFields on RoleInventory {
|
|
1703
1707
|
id
|
|
1704
1708
|
accountNumber
|
|
@@ -1772,7 +1776,7 @@ video {
|
|
|
1772
1776
|
}
|
|
1773
1777
|
}
|
|
1774
1778
|
}
|
|
1775
|
-
`,
|
|
1779
|
+
`,Cn=Ee`
|
|
1776
1780
|
fragment FlagFields on FlagInventory {
|
|
1777
1781
|
id
|
|
1778
1782
|
accountNumber
|
|
@@ -1844,7 +1848,7 @@ video {
|
|
|
1844
1848
|
}
|
|
1845
1849
|
}
|
|
1846
1850
|
}
|
|
1847
|
-
`,
|
|
1851
|
+
`,Tn=Ee`
|
|
1848
1852
|
fragment AccountFields on AccountInventory {
|
|
1849
1853
|
id
|
|
1850
1854
|
accountNumber
|
|
@@ -1902,7 +1906,7 @@ video {
|
|
|
1902
1906
|
}
|
|
1903
1907
|
}
|
|
1904
1908
|
}
|
|
1905
|
-
`,
|
|
1909
|
+
`,In=Ee`
|
|
1906
1910
|
fragment RoleFields on RoleInventory {
|
|
1907
1911
|
id
|
|
1908
1912
|
accountNumber
|
|
@@ -1942,7 +1946,7 @@ video {
|
|
|
1942
1946
|
}
|
|
1943
1947
|
}
|
|
1944
1948
|
}
|
|
1945
|
-
`,
|
|
1949
|
+
`,_n=Ee`
|
|
1946
1950
|
fragment FlagFields on FlagInventory {
|
|
1947
1951
|
id
|
|
1948
1952
|
accountNumber
|
|
@@ -1982,7 +1986,7 @@ video {
|
|
|
1982
1986
|
}
|
|
1983
1987
|
}
|
|
1984
1988
|
}
|
|
1985
|
-
`;class bn{constructor(t){this.config=t,this.gqlClient=new Wi(this.config.url),this.config.accessToken&&this.gqlClient.setHeader("authorization",this.config.accessToken)}async GetRolesInventory(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(mn,{...t})}async GetFlagsInventory(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(gn,{...t})}async GetAccountInventory(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(vn,{...t})}async SaveAccountRoleAssignments(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(fn,{...t})}async SaveAccountFlagAssignments(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(yn,{...t})}}const xn="http://localhost".replace(/\/+$/,"");class Xt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:xn}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ei}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const wn=new Xt;class at{constructor(t=wn){this.configuration=t,this.fetchApi=async(i,o)=>{let n={url:i,init:o};for(const r of this.middleware)r.pre&&(n=await r.pre({fetch:this.fetchApi,...n})||n);let a;try{a=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(r){for(const c of this.middleware)c.onError&&(a=await c.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:r,response:a?a.clone():void 0})||a);if(a===void 0)throw r instanceof Error?new In(r,"The request failed and the interceptors did not return an alternative response"):r}for(const r of this.middleware)r.post&&(a=await r.post({fetch:this.fetchApi,url:n.url,init:n.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(o=>({pre:o}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(o=>({post:o}));return this.withMiddleware(...i)}isJsonMime(t){return t?at.jsonRegex.test(t):!1}async request(t,i){const{url:o,init:n}=await this.createFetchParams(t,i),a=await this.fetchApi(o,n);if(a&&a.status>=200&&a.status<300)return a;throw new Tn(a,"Response returned an error code")}async createFetchParams(t,i){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(h=>n[h]===void 0?delete n[h]:{});const a=typeof i=="function"?i:async()=>i,r={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},c={...r,...await a({init:r,context:t})};let p;Cn(c.body)||c.body instanceof URLSearchParams||An(c.body)?p=c.body:this.isJsonMime(n["Content-Type"])?p=JSON.stringify(c.body):p=c.body;const g={...c,body:p};return{url:o,init:g}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}at.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function An(e){return typeof Blob<"u"&&e instanceof Blob}function Cn(e){return typeof FormData<"u"&&e instanceof FormData}class Tn extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class In extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class _n extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function ie(e,t){return e[t]!=null}function ei(e,t=""){return Object.keys(e).map(i=>ti(i,e[i],t)).filter(i=>i.length>0).join("&")}function ti(e,t,i=""){const o=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(a=>encodeURIComponent(String(a))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${n}`}if(t instanceof Set){const n=Array.from(t);return ti(e,n,i)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ei(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}class ii{constructor(t,i=o=>o){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}function oi(e){return kn(e)}function kn(e,t){return e==null?e:{firstName:ie(e,"firstName")?e.firstName:void 0,lastName:ie(e,"lastName")?e.lastName:void 0,contactPhoneNumber:ie(e,"contactPhoneNumber")?e.contactPhoneNumber:void 0,preferredLanguage:ie(e,"preferredLanguage")?e.preferredLanguage:void 0,preferredTimezone:ie(e,"preferredTimezone")?e.preferredTimezone:void 0,timezoneOverridden:ie(e,"timezoneOverridden")?e.timezoneOverridden:void 0,preferredDateFormat:ie(e,"preferredDateFormat")?e.preferredDateFormat:void 0,preferredTimeFormat:ie(e,"preferredTimeFormat")?e.preferredTimeFormat:void 0,email:ie(e,"email")?e.email:void 0}}function En(e){if(e!==void 0)return e===null?null:{firstName:e.firstName,lastName:e.lastName,contactPhoneNumber:e.contactPhoneNumber,preferredLanguage:e.preferredLanguage,preferredTimezone:e.preferredTimezone,timezoneOverridden:e.timezoneOverridden,preferredDateFormat:e.preferredDateFormat,preferredTimeFormat:e.preferredTimeFormat}}class Rn extends at{async getUserSettingsRaw(t){const i={},o={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("bearerToken",[]);r&&(o.Authorization=`Bearer ${r}`)}const n=await this.request({path:"/user-profile",method:"GET",headers:o,query:i},t);return new ii(n,a=>oi(a))}async getUserSettings(t){return await(await this.getUserSettingsRaw(t)).value()}async userProfilePatchRaw(t,i){if(t.profileSettingEditInput===null||t.profileSettingEditInput===void 0)throw new _n("profileSettingEditInput","Required parameter requestParameters.profileSettingEditInput was null or undefined when calling userProfilePatch.");const o={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,c=await r("bearerToken",[]);c&&(n.Authorization=`Bearer ${c}`)}const a=await this.request({path:"/user-profile",method:"PATCH",headers:n,query:o,body:En(t.profileSettingEditInput)},i);return new ii(a,r=>oi(r))}async userProfilePatch(t,i){return await(await this.userProfilePatchRaw(t,i)).value()}}class Sn{constructor(t){this.configuration=t}get InventoryApi(){return new bn({url:this.configuration.userManagementAggregationApiUrl,accessToken:this.getToken()})}get UsersApi(){return new pn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get AccountAssociationApi(){return new sn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get AccountsApi(){return new rn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get RolesApi(){return new dn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get PermissionsApi(){return new ln(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get RoleAssignmentsApi(){return new cn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get UserFlagsApi(){return new un(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get VerificationApi(){return new hn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get UserProfileSettingsApi(){var t;const i=((t=this.getToken())!==null&&t!==void 0?t:"").replace(/^Bearer\s+/i,""),o={};return new Rn(new Xt({basePath:this.configuration.LoginAuthority,accessToken:i,headers:o}))}getToken(){return this.configuration.getTokenFn?this.configuration.getTokenFn():void 0}}class Un extends Qi{constructor(t,i){super({...t}),this.hashed_identifier="",this.email="",this.account_number="",this.hashed_identifier=i}get getEmail(){var t;return(t=this.email)!==null&&t!==void 0?t:this.profile.email}get getAccount(){var t;return(t=this.account_number)!==null&&t!==void 0?t:this.profile.account_number}}class Le{constructor({loginAuthority:t,clientId:i,scope:o,postLogoutRedirectUri:n,userStorageKey:a=D().UserManagement.UI.UserManagementUIStorageKey,xauthStorageKey:r=D().UserManagement.UI.UserManagementXAuthUIStorageKey,redirectUrlKey:c="redirect-url",authPaths:p={authenticate:"authenticate",authCallback:"auth-callback",logout:"logout"}}){this.configuration={loginAuthority:t,clientId:i,scope:o,postLogoutRedirectUri:n,userStorageKey:a,xauthStorageKey:r,redirectUrlKey:c,authPaths:p};const{location:g}=window,h=`${g.protocol}//${g.hostname}${g.port?`:${g.port}`:""}`,L={authority:this.configuration.loginAuthority,client_id:this.configuration.clientId,redirect_uri:`${h}/${this.configuration.authPaths.authCallback}`,response_type:"code",scope:this.configuration.scope,post_logout_redirect_uri:this.configuration.postLogoutRedirectUri,loadUserInfo:!0};this.userManager=new Yi(L)}isLoggedIn(){const t=this.getUser();if(t===null)return!1;if(!t.expires_at)return!0;const i=new Date,o=new Date(t.expires_at*1e3);return i<o}redirectToAuth(t=!1){const i=this.isAuthenticating();(t||!i)&&(i||localStorage.setItem(this.configuration.redirectUrlKey,window.location.href),window.location.href=`/${this.configuration.authPaths.authenticate}`)}isAuthenticating(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authenticate?(this.userManager.signinRedirect(),!0):!1}isHandlingAuthCallback(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authCallback?(this.userManager.signinRedirectCallback().then(Le.ensureValidUser).then(Le.addHashedIdToUserProfile).then(i=>this.saveUser(i)).then(()=>this.authSuccessRedirect()).catch(()=>this.redirectToAuth()),!0):!1}authSuccessRedirect(){let t="/";const i=localStorage.getItem(this.configuration.redirectUrlKey);i&&(localStorage.removeItem(this.configuration.redirectUrlKey),t=i),window.location.href=t}redirectToLogout(){this.isHandlingLogout()||(window.location.href=`/${this.configuration.authPaths.logout}`)}isHandlingLogout(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.logout?(this.clearUser(),window.localStorage.clear(),this.userManager.signoutRedirect({id_token_hint:this.getIdToken()}),!0):!1}isProcessing(){return this.isAuthenticating()||this.isHandlingAuthCallback()||this.isHandlingLogout()}saveUser(t){localStorage.setItem(this.configuration.userStorageKey,JSON.stringify(t))}clearUser(){localStorage.removeItem(this.configuration.userStorageKey)}getXAuthUser(){const t=localStorage.getItem(this.configuration.xauthStorageKey);if(t){const i=JSON.parse(t);if(i!=null&&i.email&&i!=null&&i.account_number)return i}}getTokenUser(){const t=localStorage.getItem(this.configuration.userStorageKey);if(t)return JSON.parse(t)}getUser(){const t=this.getTokenUser();return t?(t.profile.email||(t.profile.email=this.getXAuthUser().email),t!=null?t:null):null}getUserDetails(){const t={accountNumber:"",email:""},i=this.getUser();return i&&(t.accountNumber=i.profile.account_number,t.email=i.profile.email),t}getUserProfileSub(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.sub}getUserLocale(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.locale}getIdToken(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.id_token}getAccessToken(){var t;return`Bearer ${(t=this.getUser())===null||t===void 0?void 0:t.access_token}`}static async hashValue(t){const i=new TextEncoder().encode(t),o=await crypto.subtle.digest("SHA-256",i);return Array.from(new Uint8Array(o)).map(n=>n.toString(16).padStart(2,"0")).join("")}static async addHashedIdToUserProfile(t){const i=`${t.profile.sub}-${t.profile.customer_id}`,o=await Le.hashValue(i);return new Un(t,o)}static ensureValidUser(t){if(!t.id_token)throw new Error("Missing property:id_token");return t}}const ve=D(),fe=new Le({loginAuthority:ve.LoginAuthority,clientId:ve.LoginService.UserManagementUIClientId,scope:ve.LoginService.UserManagementUIScopes}),v=new Sn({userManagementApiUrl:ve.UserManagement.UI.UserManagementApiUrl,userManagementAggregationApiUrl:ve.UserManagement.UI.UserManagementAggregationApiUrl,LoginAuthority:ve.LoginAuthority,getTokenFn:()=>fe.getAccessToken()});var $n="Alerts",Nn="Content",Fn="DCIM",Dn="Invoices",Pn="Marketplace",Mn="Release",Bn="Security",Ln={"Account Information":"Account Information",Alerts:$n,"Cloud Connect":"Cloud Connect",Content:Nn,"Cross Connect":"Cross Connect","Custom Role":"Custom Role","Custom Roles":"Custom Roles","Customer Equipment Connection (CEC)":"Customer Equipment Connection (CEC)","Customer Support":"Customer Care","Customer Support Team":"Customer Support Team",DCIM:Fn,"DCIM-enabled location data":"DCIM-enabled location data","Default System Roles":"Default System Roles","EMEA MarketPlace":"EMEA MarketPlace","External User":"External User","Internal Roles":"Internal Roles","Internal User":"Internal User","Internet Exchange":"Internet Exchange","Intra-Customer Connectivity (ICC)":"Intra-Customer Connectivity (ICC)",Invoices:Dn,"IP Bandwidth":"IP Bandwidth",Marketplace:Pn,"OSP Access":"OSP Access","Permanent Badge":"Permanent Badge","Planned Site Maintenance":"Maintenance & Incident Notifications","PoP/POE Room Access":"PoP/POE Room Access",Release:Mn,"Remote Hands":"Remote Hands","Remote Hands Package":"Remote Hands Package",Security:Bn,"Service Exchange Cloud Router":"Service Exchange Cloud Router","Service Exchange Port":"Service Exchange Port","Shipping & Receiving":"Deliveries & Removals","Space & Power":"Space & Power","Trouble Ticket":"Trouble Ticket","Visitor Access":"Visitor Access"};Bt.use(Xi).init({resources:{en:{translation:{...Ln}}},interpolation:{escapeValue:!1},lng:"en",debug:!1});const ni=e=>Bt.t(e),On=e=>{const t=[];return e.forEach(i=>{t.push({id:i.id,name:ni(i.name),isNonLocation:i.is_non_location,category:i.category,privileges:i.privileges,internalPrivileges:i.internal_privileges,isInternal:i.is_internal})}),t},zn=e=>{const t=[];return e.forEach(i=>{t.push({accountNumber:i.account_number,permissionName:ni(i.permission_name),privilege:i.privilege})}),t};class qn{async get(){try{const t=await v.PermissionsApi.getPermissions();return On(t)}catch(t){return m.handleError(t,"Could not get permissions."),[]}}async getMyPermissions(t){try{const i=await v.PermissionsApi.getUserPermissions(t);return zn(i)}catch(i){return m.handleError(i,"Could not retrieve current user's permissions."),[]}}}const Ve=new qn,Hn=e=>{const t=[];return e.forEach(i=>{t.push({accountNumber:i.account_number,name:i.name,parentAccountNumber:i.parent_account_number,displayName:i.friendly_name})}),t};class Vn{async get(){try{const t=await v.AccountsApi.getAccounts();return Hn(t)}catch(t){return m.handleError(t,"Failed to get accounts."),[]}}}const ai=new Vn;class jn{constructor(){this.myPermissions=[]}isProfileOfLoggedInUser(t){var i;return((i=U==null?void 0:U.getEmail())===null||i===void 0?void 0:i.toLowerCase())===(t==null?void 0:t.toLowerCase())}hasUserRead(t){return this.hasPermission(C.user,y.read,t)}hasUserUpdate(t){return this.hasPermission(C.user,y.update,t)}hasExternalUserRead(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.read,t):this.hasPermission(C.externalUser,y.read,t)}hasExternalUserUpdate(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.update,t):this.hasPermission(C.externalUser,y.update,t)}hasExternalUserCreate(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.create,t):this.hasPermission(C.externalUser,y.create,t)}hasInternalUserRead(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.read,t):this.hasPermission(C.internalUser,y.read,t)}hasInternalUserUpdate(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.update,t):this.hasPermission(C.internalUser,y.update,t)}hasCustomRolesApprove(t){return this.hasPermission(C.customRoles,y.approve,t)}hasCustomRolesCreate(t){return this.hasPermission(C.customRoles,y.create,t)}hasCustomRolesUpdate(t){return this.hasPermission(C.customRoles,y.update,t)}hasCustomRolesRead(t){return this.hasPermission(C.customRoles,y.read,t)}hasInternalRolesCreate(t){return this.hasPermission(C.internalRoles,y.create,t)}hasInternalRolesUpdate(t){return this.hasPermission(C.internalRoles,y.update,t)}hasInternalRolesRead(t){return this.hasPermission(C.internalRoles,y.read,t)}hasDefaultSystemRolesCreate(t){return this.hasPermission(C.defaultRoles,y.create,t)}hasDefaultSystemRolesUpdate(t){return this.hasPermission(C.defaultRoles,y.update,t)}hasDefaultSystemRolesRead(t){return this.hasPermission(C.defaultRoles,y.read,t)}hasRoleManagementAccess(t){return this.hasPermission(C.defaultRoles,y.read,t)||this.hasPermission(C.customRoles,y.read,t)||this.hasPermission(C.internalRoles,y.read,t)||this.hasPermission(C.externalUser,y.read,t)}hasUserManagementAccess(){return D().UserManagement.InternalUserRetired?this.hasUserRead():this.hasExternalUserRead()||this.hasInternalUserRead()}hasAssignInternalRoleCreate(t){return this.hasPermission(C.assignInternalRole,y.create,t)}async refreshPermissions(){this.myPermissions=await Ve.getMyPermissions({excludeParents:!1,excludeSiblings:!0})}async refreshAccounts(){const t=await ai.get();U.setAccounts(t)}hasPrivilegeLevel(t,i){const o=[y.approve,y.create,y.update,y.read],n=o.findIndex(r=>r===t.toLowerCase()),a=o.findIndex(r=>r===i.toLowerCase());return n>=a}hasPermission(t,i,o){let{myPermissions:n}=this,a=!1;return o&&(n=n.filter(r=>r.accountNumber===o)),n.length&&i&&(a=n.some(r=>r.permissionName===t&&this.hasPrivilegeLevel(i,r.privilege))),a}}const P=new jn,si="uppercase font-bold tracking-wider",ri={LocalStorage:{},SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges"}};let pt=class extends I{constructor(){super(...arguments),this.routeName=null}return(){window.sessionStorage.getItem(ri.SessionStorage.HasOutstandingChanges)!=="true"&&this.routeName&&Ge(this.routeName)}render(){return l` <ix-button appearance="text" has-icon @click="${this.return}" data-testid="um-back-button"> <md-icon slot="icon">arrow_back</md-icon> <span class="${si}">Back</span> </ix-button>`}};s([d()],pt.prototype,"routeName",void 0),pt=s([b("um-back-button")],pt);const Se=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))};let li=class extends I{dispatchCreateUserEvent(){Se(this,_.CreateUserClicked)}render(){return l` <ix-button @click="${this.dispatchCreateUserEvent}" has-icon> <md-icon slot="icon">add</md-icon> <span class="${si}">Create User</span> </ix-button>`}};li=s([b("um-create-user-button")],li);const z={Home:"Home",UserManagement:"User Management",RoleManagement:"Role Management",UserManagementDetails:"User Management Details"},ci=[{name:z.Home,path:"(/?)",component:"home-view",action:()=>{import("./ui-user-management2.js")}},{name:z.UserManagement,path:"/user-management",component:"user-management-view",headerRight:l``,action:async()=>{P.hasUserManagementAccess()?import("./ui-user-management3.js"):he.go("/")}},{name:z.RoleManagement,path:"/role-management",component:"role-management-view",action:async()=>{P.hasRoleManagementAccess()?import("./ui-user-management4.js"):he.go("/")}},{name:z.UserManagementDetails,path:"/user-management-details",component:"user-management-details-view",hideAccountSwitcher:!0,headerLeft:l`<um-back-button routeName="${z.UserManagement}"></um-back-button>`,action:async()=>{P.hasUserManagementAccess()?import("./ui-user-management6.js"):he.go("/")}}];let W=null;function di(){const{pathname:e,search:t,hash:i}=window.location;he.go({pathname:e,search:t,hash:i})}function Gn(e,t,i){const o=i.map(n=>({...n,path:`${t}${n.path}`,redirect:n.redirect?`${t}${n.redirect}`:null}));o.push({path:"(.*)",component:"no-elem"}),W=new he(e),W.setRoutes(o),window.addEventListener("shell-after-navigate",di)}function Kn(){return W}function Jn(){W==null||W.unsubscribe(),W==null||W.removeRoutes(),W=null,window.removeEventListener("shell-after-navigate",di)}function je(e,t){return W&&W.urlForName(e,t)}function Ge(e,t){const i=je(e);i&&he.go({pathname:i,hash:t})}const Zn=e=>{var t,i,o,n,a,r;const c=ci.find(g=>g.name===e),p=(r=(a=(n=(o=(i=(t=window.document.querySelector("gp-bootstrap"))===null||t===void 0?void 0:t.shadowRoot)===null||i===void 0?void 0:i.querySelector("global-portal-app"))===null||o===void 0?void 0:o.shadowRoot)===null||n===void 0?void 0:n.querySelector("ui-user-management"))===null||a===void 0?void 0:a.getAttribute("baseurl"))!==null&&r!==void 0?r:"";return window.location.pathname===`${p}${c==null?void 0:c.path}`};let ht=class extends Ie{constructor(){super(...arguments),this.setNavigationItemsBinding=this.setNavigationItems.bind(this),this.navigationItems=[],this.compact=!1}static get styles(){return[Wt,A]}connectedCallback(){super.connectedCallback(),window.addEventListener(_.RouteChanged,this.setNavigationItemsBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.RouteChanged,this.setNavigationItemsBinding)}setNavigationItems(){this.requestUpdate(),!this.navigationItems.length&&(this.navigationItems=[{href:je(z.UserManagement),title:"User Management",icon:l`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="white"> ${He.userManagementIcon} </svg>`},{href:je(z.RoleManagement),title:"Role Management",icon:l`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="white"> ${He.roleManagementIcon} </svg>`}])}toggleCompact(){Se(this,_.ToggleNavBar),setTimeout(()=>{window.dispatchEvent(new Event("resize"))},301)}renderNavigation(){return P.hasExternalUserRead()?l`${this.navigationItems.map(e=>l` <li class="relative m-1"> <div class="${e.href===window.location.pathname?"bg-white opacity-[.16] inset-0 rounded-md absolute":""}"></div> <a href="${e.href}" class="${e.href===window.location.pathname?"flex px-6 py-4 gap-4 rounded-md font-bold":"flex px-6 py-4 gap-4 rounded-md font-bold opacity-60"}"> <div class="w-6 shrink-0">${e.icon}</div> <div class="grow text-left"> <div class="${this.compact?"w-0":"w-full"} animate-width overflow-hidden"> ${e.title} </div> </div> </a> </li> `)}`:x}render(){return l` <ix-icon-button @click="${this.toggleCompact}" icon="chevron_right" class="drop-shadow-lg items-center expand-cta bg-white rounded-full text-slate-600 h-8 w-8 absolute z-20 lg:right-0 lg:top-[34px] hidden top-[27px] right-[-8px] sm:flex ${this.compact?"animate-spin-180-backwards":"animate-spin-180-forwards"}"> </ix-icon-button> <nav class="flex flex-col overflow-hidden min-h-full rounded-xl drop-shadow text-center nav-bar long text-white ${this.compact?"closed":""} whitespace-nowrap animate-width"> <div class="m-1 px-6 py-4 hidden sm:block"> <svg @click="${this.toggleCompact}" focusable="false" viewBox="0 0 178 27" fill="white" class="w-[200px]"> ${He.digitalRealtyLogoWithText} </svg> </div> <hr class="divider hidden sm:block"> <ul class="grow"> ${this.renderNavigation()} </ul> <dev-clear-storage-button class="white-icon self-start p-5"></dev-clear-storage-button> </nav> `}};s([d({type:Boolean})],ht.prototype,"compact",void 0),ht=s([b("navigation-bar")],ht);const Wn=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.header-container{display:flex;align-items:center;margin-bottom:16px}.header-container-back-btn{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.back{padding-left:12px}.arrow-back-icon{font-size:22px;align-items:center;padding-right:1px}.header-rhs-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.profile{background-color:#092241;height:35px;margin-right:30px;margin-left:30px;border-radius:10px;color:#fff;padding-left:20px;padding-right:20px;display:flex;align-items:center}.logout{height:35px;border-radius:10px;border:none;background-color:#1456e0;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;padding-left:15px;padding-right:15px}.logout svg{width:1em;height:1em;font-size:20px;margin-right:5px}.add-icon{font-size:20px;align-items:center}`;let ye=class extends Ie{constructor(){super(...arguments),this.updateLayoutBinding=this.updateLayout.bind(this),this.pageTitle="",this.showCreateUserButton=!1,this.showHeader=!0}connectedCallback(){super.connectedCallback(),window.addEventListener(_.RouteChanged,this.updateLayoutBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.RouteChanged,this.updateLayoutBinding)}updateLayout(e){switch(this.pageTitle=e.detail.location.route.name||"",this.pageTitle){case"User Management":this.showCreateUserButton=P.hasExternalUserCreate(),this.showHeader=!0;break;case"Role Management":this.showCreateUserButton=!1,this.showHeader=!0;break;case"User Management Details":this.showCreateUserButton=!1,this.showHeader=!1;break}}getRoute(){return this.pageTitle==="User Management Details"?z.UserManagement:z.Home}dispatchCreateUserEvent(){Se(this,_.CreateUser)}renderAppHeader(){return l` <div class="flex gap-2 items-center mt-4 mb-8 justify-between"> <div> ${this.showHeader?l`<h1 class="dlr-text-page-title">${this.pageTitle}</h1>`:l` <um-back-button .routeName="${this.getRoute()}"></um-back-button> `} </div> <div class="items-center flex gap-2 flex-wrap justify-end"> ${this.showCreateUserButton?l` <ix-button @click="${this.dispatchCreateUserEvent}" has-icon data-testid="create-user-button"> Create User <md-icon slot="icon">add</md-icon> </ix-button> `:x} </div> </div> `}render(){return l`${this.renderAppHeader()}`}};ye.styles=[A,Wn],s([d({type:String})],ye.prototype,"pageTitle",void 0),s([u()],ye.prototype,"showCreateUserButton",void 0),s([u()],ye.prototype,"showHeader",void 0),ye=s([b("app-header")],ye);const Qn=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{--md-outlined-text-field-label-text-color:black}.input-group{display:flex;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}.textfield{width:100%}@media screen and (max-width:600px){.input-group{flex-direction:column}}`,q=e=>e?e.component.value:null,Ke=(e,t)=>{if(!e)return;const i=e.component;i.value=t},be=e=>{if(!e)return null;const{input:t}=e;return t.value},mt=(e,t)=>{if(!e)return;const{input:i}=e;i.value=t},Yn=e=>e?e.component.checked:null,Xn=(e,t)=>{if(!e)return;const i=e.component;i.checked=t};function ui(e){const t=JSON.stringify(e);return JSON.parse(t)}const ea=(e,t,i)=>e.sort((o,n)=>(o[t]<n[t]?-1:1)*(i?1:-1));function ta(e){const t={};for(const[i,o]of Object.entries(e))for(const n of i.split(" "))t[n]=o;return io(t)}const ia=e=>{try{const t=e.startsWith("+")?Lt(e):Lt(`+${e}`),i=`+${t.countryCallingCode} ${new eo(t.country||"US").input(t.nationalNumber)}`;return i.endsWith(")")||i.endsWith("(")?e:i}catch(t){return e}},oa=()=>window.matchMedia("(min-width: 1024px)").matches,Ue={phone:"^[+]?[(]?[0-9]{3}[)]?[-s.]?[0-9]{3}[-s.]?[0-9]{4,6}$",name:D().UserManagement.UI.ValidationRegexPatterns.name,alphabetOnly:"^[A-Za-z]+$"},$e=(e,t)=>{const i=e;return"component"in i&&i.component.reportValidity(),t?(i.error=!1,i.errorText="",!0):(i.error=!0,i.errorText="This field is mandatory",!1)},pi=(e,t,i)=>{const o=e;return t!=null&&t.match(o.pattern)?(o.error=!1,o.errorText="",!0):(o.error=!0,o.errorText=i,!1)},hi=(e,t,i)=>{if(!t)return!1;const o=e;return oo.isEmail(t)?(o.error=!1,o.errorText="",!0):(o.error=!0,o.errorText=i,!1)},na=e=>e.error,aa=(e,t)=>{const i=t;return q(e)===i},gt=(e,t,i)=>{const o=q(e);return e.required&&!$e(e,o)||e.pattern&&!pi(e,o,i)||e.type==="email"&&!hi(e,o,i)?!1:!(na(e)||aa(e,t))},vt=(e,t)=>{const i=be(e),o=e;return to(i)?(o.error=!1,!0):(o.error=!0,o.errorText=t,!1)},sa=(e,t)=>{t.length>0&&t.forEach(i=>{const o=e.find(n=>n.id===i.field);o&&(o.error=!0,o.errorText=i.error,o.focus())})},w={CancelCreateUser:"cancel-create-user",CloseDrawer:"close-drawer",CreateContact:"create-contact",CreateNewContact:"create-new-contact",EvacAssistanceRequired:"evac-assistance-required",NextButtonToggle:"next-button-toggle",NextStep:"next-step",ResetSuccess:"reset-success",SetStep:"set-step",ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",ToggleDrawer:"toggle-drawer",UpdateAccounts:"update-accounts",UpdateContact:"update-contact",UpdateDFA:"update-dfa",UpdateFlags:"update-flags",ValidateStep:"validate-step"};let ce=class extends I{constructor(){super(...arguments),this.validatingForm=!1,this._newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this._nextButtonEnabled=!1}firstUpdated(){this._newContact=this.newContact,this.validateStep(),this.dispatchValidateStepEvent()}get firstName(){return this.renderRoot.querySelector("#first-name")}get lastName(){return this.renderRoot.querySelector("#last-name")}get email(){return this.renderRoot.querySelector("#email")}get phone(){return this.renderRoot.querySelector("#phone-number")}validateStep(){this._nextButtonEnabled=!(this.isInvalid()||this.isEmpty())}validateInput(e,t){const i=q(e);if(this.updateContactDetails(),e.required&&!$e(e,i)){this._nextButtonEnabled=!1;return}e.pattern&&!pi(e,i,t)&&(this._nextButtonEnabled=!1),this.validateStep(),this.dispatchNextButtonToggleEvent()}async validateEmailInput(e,t){this._nextButtonEnabled=!1;const i=q(e);if(this.updateContactDetails(),e.required&&!$e(e,i)){this._nextButtonEnabled=!1;return}if(!hi(e,i,t)){this._nextButtonEnabled=!1;return}clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout(async()=>{const o={emailVerificationInput:{email_address:i!=null?i:""}};try{(await v.VerificationApi.verifyEmail(o)).is_verified?(e.error=!1,e.errorText="",this._nextButtonEnabled=!(this.isInvalid()||this.isEmpty())):(e.error=!0,e.errorText=`${t}`,this._nextButtonEnabled=!1)}catch(n){e.error=!0,e.errorText="An error occurred during email verification. Please try again later.",this._nextButtonEnabled=!1}},500),this.validateStep(),this.dispatchNextButtonToggleEvent()}validatePhoneInput(e,t){const i=be(e);if(mt(e,i),this.updateContactDetails(),e.required&&!$e(e,i)){this._nextButtonEnabled=!1;return}if(!vt(e,t)){this._nextButtonEnabled=!1;return}this.validateStep(),this.dispatchNextButtonToggleEvent()}updateContactDetails(){var e,t,i,o;this._newContact={firstName:(e=q(this.firstName))!==null&&e!==void 0?e:"",lastName:(t=q(this.lastName))!==null&&t!==void 0?t:"",email:(i=q(this.email))!==null&&i!==void 0?i:"",phone:(o=be(this.phone))!==null&&o!==void 0?o:"",accounts:this._newContact.accounts,evacAssistance:this._newContact.evacAssistance},this.dispatchUpdateContactEvent()}clearTextFields(){this._newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},Ke(this.firstName,""),Ke(this.lastName,""),Ke(this.email,""),this.phone.reset(),mt(this.phone,"")}resetErrorStates(){this.firstName.error=!1,this.lastName.error=!1,this.email.error=!1,this.phone.error=!1}isInvalid(){return this.firstName.error||this.lastName.error||this.email.error||this.phone.error}isEmpty(){return!this._newContact.firstName||!this._newContact.lastName||!this._newContact.email||!this._newContact.phone}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchUpdateContactEvent(){const e=new CustomEvent(w.UpdateContact,{detail:{newContact:this._newContact},bubbles:!0,composed:!0});this.dispatchEvent(e)}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){return l` <div class="input-group"> <ix-textbox required id="first-name" label="First name" name="first-name" type="text" value="${this._newContact.firstName}" @input="${()=>this.validateInput(this.firstName,"Invalid first name")}" pattern="${Ue.name}" maxLength="50" data-testid="step-one-first-name"></ix-textbox> <ix-textbox required id="last-name" label="Last name" name="last-name" type="text" value="${this._newContact.lastName}" @input="${()=>this.validateInput(this.lastName,"Invalid last name")}" pattern="${Ue.name}" maxLength="50" data-testid="step-one-last-name"></ix-textbox> </div> <div class="input-group"> <ix-textbox required id="email" label="Email Address" name="email" type="email" value="${this._newContact.email}" @input="${()=>this.validateEmailInput(this.email,"Invalid email address")}" data-testid="step-one-email"></ix-textbox> <ix-phone-input required id="phone-number" label="Phone Number" name="phone" value="${this._newContact.phone}" @input="${()=>this.validatePhoneInput(this.phone,"Invalid phone number")}" @country-change="${()=>this.phone.value?this.validatePhoneInput(this.phone,"Invalid phone number"):null}" data-testid="step-one-phone-number"></ix-phone-input> </div> <div style="display:flex;justify-content:flex-end;padding-top:8px"> <ix-button type="submit" ?disabled="${!this._nextButtonEnabled||this.validatingForm}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-one-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> `}};ce.styles=[Qn,A],s([d({type:Object})],ce.prototype,"newContact",void 0),s([d({type:Boolean})],ce.prototype,"validatingForm",void 0),s([u()],ce.prototype,"_newContact",void 0),s([u()],ce.prototype,"_nextButtonEnabled",void 0),ce=s([b("create-user-step-one")],ce);function mi(e){var t;for(const i of e)if(i.checked||!((t=i.children)===null||t===void 0)&&t.length&&mi(i.children))return!0;return!1}function ra(e){return e.some(t=>t.subaccounts.length)?"nested":"flat"}function gi(e,t){var i,o;if(t==="flat")return e.filter(a=>a.checked);const n=[];for(const a of e){a.checked&&n.push(a);const r=(i=a.children)===null||i===void 0?void 0:i.every(c=>c.checked);if(!((o=a.children)===null||o===void 0)&&o.length&&(a.indeterminate||!r)){const c=gi(a.children,t);n.push(...c)}}return n}let de=class extends I{constructor(){super(...arguments),this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._accountTree=this.accountTree,this.validateStep(),this.dispatchValidateStepEvent()}renderAccounts(){var e,t;if(!this._accountTree)return x;const i=(t=(e=this._accountTree)===null||e===void 0?void 0:e.children)===null||t===void 0?void 0:t.some(o=>{var n;return(n=o.children)===null||n===void 0?void 0:n.length});return l` <div class="overflow-auto pb-[2px]"> <ix-tree checkboxesEnabled .rootNode="${this._accountTree}" .rollup="${!1}" .disableEndNodePointer="${!0}" .selectNodeOnClick="${!0}" ?removeChevron="${!i}" @on-tree-node-checked="${()=>this.toggleAccountChecked()}" data-testid="step-two-account-tree"></ix-tree> </div> `}validateStep(){!this._accountTree||!this.ixTree||(this._nextButtonEnabled=mi([this._accountTree]))}async toggleAccountChecked(){!this._accountTree||!this.ixTree||(await this.ixTree.updateComplete,this._accountTree=this.ixTree.rootNode,this.dispatchUpdateAccountsEvent(),this.validateStep(),this.dispatchNextButtonToggleEvent())}dispatchUpdateAccountsEvent(){this.dispatchEvent(new CustomEvent(w.UpdateAccounts,{detail:{rootNode:this._accountTree},bubbles:!0,composed:!0}))}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){return l` <div class="flex flex-col overflow-hidden"> ${this.renderAccounts()} <div class="flex justify-end mt-6"> <ix-button type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-two-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};de.styles=[A,le],s([d({type:Object})],de.prototype,"accountTree",void 0),s([u()],de.prototype,"_accountTree",void 0),s([u()],de.prototype,"_nextButtonEnabled",void 0),s([F("ix-tree")],de.prototype,"ixTree",void 0),de=s([b("create-user-step-two")],de);const la=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{--ix-chip-container-color:var(--md-sys-color-primary);--md-input-chip-outline-color:var(--md-sys-color-primary);--md-input-chip-label-text-color:white;--md-outlined-field-leading-content-color:black;--md-outlined-field-label-text-color:black}.accounts-roles-container{display:flex;flex-direction:column;margin-bottom:10px;padding-left:2px}.accounts-roles-container>*{padding-bottom:15px}.accounts-roles-container>:not(:first-child){padding-top:20px}.account-roles-name{padding-bottom:10px}.account-roles{display:flex;flex-direction:column;gap:8px;height:100%}`;function ue(e,t,i=void 0){const o=no[e.type]||(e.type==="Port"?"":"chevron_right"),n={id:e.id,label:e.label,children:[],secondaryLabel:e.secondaryLabel,parentId:e.parentId,childrenCount:e.childrenCount,disabled:e.isAssignable===!1,checkedChildrenCount:e.checkedChildrenCount,indeterminate:e.status==="INDETERMINATE",customerKnownSpaceName:e.customerKnownSpaceName,checked:i!=null?i:e.status==="CHECKED",originalCheckedStatus:i!=null?i:e.status==="CHECKED",inherited:e.inherited,icon:o};return t.children.push(n),e.inventoryItems&&e.inventoryItems.forEach(a=>{ue(a,n,i?n.checked:void 0)}),t}function vi(e){var t;const i=o=>{o.checked=!1};return e.children&&!((t=e.children)===null||t===void 0)&&t.length&&e.children.forEach(o=>vi(o)),i(e)}const ae=[{key:"ACCOUNTING_CONTACT",text:"Accounting flag",desc:"Authorized to discuss billing issues with DLR Accounts Receivable Group."},{key:"OPERATIONS_CONTACT",text:"Operations flag",desc:"Receives Planned Maintenance, Corrective Maintenance and Project Work notifications. Point of contact for DLR operations team."},{key:"EMERGENCY_CONTACT",text:"Emergency flag",desc:"Receives Incident Notifications. Point of contact during unplanned, emergency maintenance."},{key:"INTERCONNECTION_NOTIFICATIONS",text:"Interconnection Notifications",desc:"Receives notifications about interconnectivity orders."}],ft=e=>{var t;return(t=ae.find(i=>i.text===e))===null||t===void 0?void 0:t.key},ca=e=>{var t;return(t=ae.find(i=>i.key===e))===null||t===void 0?void 0:t.text};let K=class extends I{constructor(){super(...arguments),this.checkedAccounts=[],this.roles=[],this.dataForAccounts=[],this.treeData=[],this._dataForAccounts=[],this._treeData=[],this._nextButtonEnabled=!1,this.multiSelectOpen=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._treeData=this.treeData,this.validateStep(),this.dispatchValidateStepEvent()}getRoles(e){return this.roles.filter(t=>t.accountId===e)[0].roles}getRolesData(e){const t=this.roles.filter(o=>o.accountId===e)[0],i=[];return t.roles.forEach(o=>{var n;o.removed=!0;const a={id:"root",label:"",children:[],customerKnownSpaceName:""},r=(n=this._treeData.find(p=>p.accountNumber===e))===null||n===void 0?void 0:n.data;r&&r.length&&ue(r[0],a);const c={accountId:e,role:o,locations:[],genericTreeView:a};i.push(c)}),i}getFlagsData(e){const t=[];return ae.forEach(i=>{const o={accountId:e,flag:i,locations:[],genericFlagsData:[]};t.push(o)}),t}renderMultiSelectRoles(){this._dataForAccounts.length===0&&(this._dataForAccounts=this.checkedAccounts.map(t=>({accountId:t.id,accountName:t.label,rolesData:this.getRolesData(t.id),flagsData:this.getFlagsData(t.id),flagData:[],active:!1})));const e={};return this._dataForAccounts.forEach(t=>{e[t.accountId]=t.rolesData.filter(i=>i.role.removed===!0).map(i=>i.role.name)}),this._dataForAccounts.map(t=>{const i=[...new Set(this.getRoles(t.accountId).map(o=>o.name))].map(o=>({label:o,selected:!e[t.accountId].includes(o)}));return l` <div> <div class="account-roles-name">${t.accountName}</div> <ix-multi-select data-testid="multi-select-roles-${t.accountId}" required id="${`${t.accountId}-multi-select`}" style="max-width:99%" class="multi-select" .menuPositioning="${"popover"}" .items="${i}" .label="${"Roles"}" @toggle-multi-select-item="${o=>this.handleMultiSelect(t.accountId,o.detail.label,o.detail.selected)}" @remove-multi-select-item="${o=>this.handleMultiSelect(t.accountId,o.detail,!1)}" @clear-multi-select="${()=>this.handleMultiSelectClear(t.accountId)}" @select-menu="${o=>this.handleSelectMenu(o)}"></ix-multi-select> </div> `})}handleSelectMenu(e){e.detail.value==="open"?this.multiSelectOpen=!0:this.multiSelectOpen=!1}handleMultiSelect(e,t,i){var o,n,a;const[r]=this._dataForAccounts.filter(h=>h.accountId===e),c=this.getRoles(r.accountId).find(h=>h.name===t);if(!c)return;const p=r.rolesData.findIndex(h=>h.role.id===c.id);if(c.permissions.every(h=>h.isNonLocation)){const h=(o=r.rolesData[p])===null||o===void 0?void 0:o.genericTreeView;if(!((n=h==null?void 0:h.children)===null||n===void 0)&&n.length){const L=h.children[0];L.checked=!0,me(L,h),r.rolesData[p].locations.push(L)}}const g=r.rolesData.findIndex(h=>h.role.id===(c==null?void 0:c.id));if(r.rolesData[g].role.removed=!(i&&g>=0),!i){const h={id:"root",label:"",children:[],customerKnownSpaceName:""},L=(a=this._treeData.find(ji=>ji.accountNumber===e))===null||a===void 0?void 0:a.data;L&&L.length&&ue(L[0],h),r.rolesData[g].locations=[],r.rolesData[g].genericTreeView=h}this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}validateStep(){const e=this._dataForAccounts.every(i=>i.rolesData.filter(o=>o.role.removed===!1).length),t=this._dataForAccounts.length===this.checkedAccounts.length;this._nextButtonEnabled=e&&t}handleMultiSelectClear(e){const t=this._dataForAccounts.filter(i=>i.accountId===e)[0];this._dataForAccounts.find(i=>i.accountId===e).rolesData=this.getRolesData(t.accountId),this._nextButtonEnabled=!1,this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}dispatchUpdateDFAEvent(){const e=new CustomEvent(w.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(e)}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){const e=this.multiSelectOpen?"overflow-hidden":"overflow-auto";return l` <div class="wizard-step-content flex flex-col overflow-hidden"> <div class="p-1 dlr-text-default ${e}">${this.renderMultiSelectRoles()}</div> <div class="flex justify-end" style="padding-top:8px"> <ix-button class="pt-2" type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-three-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};K.styles=[la,A,_e],s([d({type:Array})],K.prototype,"checkedAccounts",void 0),s([d({type:Array})],K.prototype,"roles",void 0),s([d({type:Array})],K.prototype,"dataForAccounts",void 0),s([d({type:Array})],K.prototype,"treeData",void 0),s([u()],K.prototype,"_dataForAccounts",void 0),s([u()],K.prototype,"_treeData",void 0),s([u()],K.prototype,"_nextButtonEnabled",void 0),s([u()],K.prototype,"multiSelectOpen",void 0),K=s([b("create-user-step-three")],K);const Je=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.permission-container{padding:1rem 1.5rem 0 1.5rem}ix-icon-button{--md-sys-color-on-surface-variant:black}.permission-dialog-container{padding:1rem 1rem 0 1rem;width:500px}.permission-container-row{display:block;padding:8px;margin-top:12px;margin-bottom:12px;box-shadow:#e1e4e8 0 0 0 1px inset;border-radius:8px}.permission-container-item{display:flex;flex-direction:row;width:100%}.permission-arrow{width:30px;cursor:pointer}.permission-name{line-height:24px;color:#092241}.permission-item{display:grid;grid-template-columns:1fr 20%;gap:16px;-webkit-box-align:center;align-items:center;-webkit-box-flex:1;flex-grow:1;padding-top:5px}.permission-item-privilege{margin:0;color:#333}.permission-container-row-create-user{display:flex;padding:12px;margin-top:10px;margin-bottom:10px;height:24px;width:475px;box-shadow:#e1e4e8 0 0 0 1px inset;border-radius:8px}.non-location{margin:10px 5px 5px 5px;background-color:#f5f7ff;padding:8px;border-radius:5px}.non-location-icon{padding-left:8px}.permissions-dialog-container{max-height:70vh;overflow-x:auto}`;class H{}H.ROW=e=>`permission-group-row-${e}`,H.CATEGORY=e=>`permission-group-category-${e}`,H.OVERALL_PERM=e=>`permission-group-overall-${e}`,H.BTN_EXPAND=e=>`permission-group-btn-expand-${e}`,H.PERM_NAME=e=>`permission-group-name-${e}`,H.PERM_PRIVILEGE=e=>`permission-group-privilege-${e}`;let Ne=class extends I{constructor(){super(...arguments),this.permissionGroup=void 0,this.isOpen=!1}onClick(){this.isOpen=!this.isOpen,this.requestUpdate()}renderPermissionItemRow(e,t){return l` <div class="flex justify-between pl-11 items-center permission-item"> <p data-testid="${H.PERM_NAME(e)}">${e}</p> <p class="capitalize permission-item-privilege pr-4" data-testid="${H.PERM_PRIVILEGE(e)}"> <small>${t}</small> </p> </div> `}renderPermissionItems(e){return this.isOpen?l`<div class="permission-items-container"> ${e.filter(t=>!t.isNonLocation).map(t=>this.renderPermissionItemRow(t.name,t.privilege))} </div>`:x}render(){var e,t,i,o,n,a,r,c,p,g,h,L;return l`<div class="permission-container-row" data-testid="${H.ROW((t=(e=this.permissionGroup)===null||e===void 0?void 0:e.category)!==null&&t!==void 0?t:"")}"> <div class="flex items-center justify-between"> <div class="flex items-center"> <ix-icon-button icon="${this.isOpen?"arrow_drop_down":"arrow_right"}" @click="${this.onClick}" data-testid="${H.BTN_EXPAND((o=(i=this.permissionGroup)===null||i===void 0?void 0:i.category)!==null&&o!==void 0?o:"")}"> </ix-icon-button> <p class="m-0 permission-name permission-item-name pl-1" id="permission-item-name" data-testid="${H.CATEGORY((a=(n=this.permissionGroup)===null||n===void 0?void 0:n.category)!==null&&a!==void 0?a:"")}"> ${(r=this.permissionGroup)===null||r===void 0?void 0:r.category} </p> </div> <p class="m-0 pl-4 capitalize permission-overall-privilege mr-4" data-testid="${H.OVERALL_PERM((p=(c=this.permissionGroup)===null||c===void 0?void 0:c.category)!==null&&p!==void 0?p:"")}"> <small>${(g=this.permissionGroup)===null||g===void 0?void 0:g.overallPrivilege}</small> </p> </div> ${this.renderPermissionItems((L=(h=this.permissionGroup)===null||h===void 0?void 0:h.items)!==null&&L!==void 0?L:[])} </div>`}};Ne.styles=[Je,A],s([d({type:Object,attribute:!1})],Ne.prototype,"permissionGroup",void 0),s([u()],Ne.prototype,"isOpen",void 0),Ne=s([b("permission-group")],Ne);class xe{}xe.ROW=e=>`non-location-permission-row-${e}`,xe.NAME=e=>`non-location-permission-item-${e}`,xe.PRIVILEGE=e=>`non-location-permission-privilege-${e}`;let Ze=class extends I{constructor(){super(...arguments),this.permission=void 0}render(){var e,t,i,o,n,a,r,c;return l`<div class="permission-container-row" data-testid="${xe.ROW((t=(e=this.permission)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"")}"> <div class="flex items-center justify-between"> <div class="flex items-center"> <p class="m-0 permission-name permission-item-name pl-1" data-testid="${xe.NAME((o=(i=this.permission)===null||i===void 0?void 0:i.name)!==null&&o!==void 0?o:"")}"> ${(n=this.permission)===null||n===void 0?void 0:n.name} </p> </div> <p class="m-0 pl-4 capitalize permission-overall-privilege mr-4" data-testid="${xe.PRIVILEGE((r=(a=this.permission)===null||a===void 0?void 0:a.name)!==null&&r!==void 0?r:"")}"> <small>${(c=this.permission)===null||c===void 0?void 0:c.privilege}</small> </p> </div> <div class="permission-items-container"> <div class="flex pl-13 items-center permission-item non-location"> <span class="non-location-icon"><md-icon slot="icon">info</md-icon></span> <p class="text-left dlr-text-caption"> You don't need to select location or assets for this permission </p> </div> </div> </div>`}};Ze.styles=[Je,A],s([d({type:Object,attribute:!1})],Ze.prototype,"permission",void 0),Ze=s([b("non-location-permission")],Ze);let We=class extends I{constructor(){super(...arguments),this.permission=void 0}render(){var e,t;return l` <div class="permission-container-row"> <div class="flex items-center justify-between"> <div class="flex items-center"> <p class="m-0 permission-name pl-1">${(e=this.permission)===null||e===void 0?void 0:e.name}</p> </div> <p class="m-0 pl-4 capitalize permission-overall-privilege mr-4"> <small>${(t=this.permission)===null||t===void 0?void 0:t.privilege}</small> </p> </div> </div> `}};We.styles=[Je,A],s([d({type:Object,attribute:!1})],We.prototype,"permission",void 0),We=s([b("non-category-permission")],We);const da={AMER:"North America"},yt={Global:0,Continent:1,Country:2,City:3,Site:4,Floor:5,Room:6,Cage:7,Row:8,Cabinet:9},bt=e=>{var t,i;const o=yt[e.type];return o===yt.Continent&&e.label?(t=da[e.label])!==null&&t!==void 0?t:e.label:e.label&&o>yt.Site&&/^[0-9]{1,3}$/.test(e.label)?`${e.type} ${e.label}`:(i=e.label)!==null&&i!==void 0?i:void 0},ua=e=>({id:e.id,accountNumber:e.accountNumber,roleId:e.roleId,parentId:e.parentInventoryId,customerKnownSpaceName:e.customerKnownSpaceName,type:e.type,label:bt(e),isAssignable:e.isAssignable,secondaryLabel:e.secondaryLabel,childrenCount:e.childrenCount,inventoryItems:Qe(e.inventoryItems),selected:e.selected,searched:e.searched,status:e.permissionStatus,inherited:e.inherited}),Qe=e=>{const t=[];return e==null||e.forEach(i=>{t.push(ua(i))}),t},pa=e=>{var t,i,o,n,a,r,c,p;return{contactId:e.id,accountId:e.accountNumber,roleId:e.roleId,isInternal:e.isInternal,startInventoryId:e.location,searchLocationText:(t=e.searchLocationText)!==null&&t!==void 0?t:"",level1:!0,level2:!0,level3:(i=e.allChildren)!==null&&i!==void 0?i:!1,level4:(o=e.allChildren)!==null&&o!==void 0?o:!1,level5:(n=e.allChildren)!==null&&n!==void 0?n:!1,level6:(a=e.allChildren)!==null&&a!==void 0?a:!1,level7:(r=e.allChildren)!==null&&r!==void 0?r:!1,level8:(c=e.allChildren)!==null&&c!==void 0?c:!1,level9:(p=e.allChildren)!==null&&p!==void 0?p:!1}},ha=e=>({contactId:e.id,accountId:e.accountNumber,flag:e.flag,isInternal:e.isInternal,startInventoryId:e.location,level1:!0,level2:!0,level3:!0,level4:!0,level5:!0,level6:!0,level7:!0,level8:!0,level9:!0}),ma=e=>{var t,i,o,n,a,r,c;return{accountId:e.accountNumber,isInternal:e.isInternal,level1:!0,level2:!0,level3:(t=e.allChildren)!==null&&t!==void 0?t:!1,level4:(i=e.allChildren)!==null&&i!==void 0?i:!1,level5:(o=e.allChildren)!==null&&o!==void 0?o:!1,level6:(n=e.allChildren)!==null&&n!==void 0?n:!1,level7:(a=e.allChildren)!==null&&a!==void 0?a:!1,level8:(r=e.allChildren)!==null&&r!==void 0?r:!1,level9:(c=e.allChildren)!==null&&c!==void 0?c:!1}},ga=e=>({id:e.id,accountNumber:e.accountNumber,flag:e.flag,parentId:e.parentInventoryId,customerKnownSpaceName:e.customerKnownSpaceName,type:e.type,isAssignable:e.isAssignable,label:bt(e),secondaryLabel:e.secondaryLabel,childrenCount:e.childrenCount,checkedChildrenCount:e.checkedChildrenCount,inventoryItems:fi(e.inventoryItems),selected:e.selected,searched:!1,status:e.permissionStatus,inherited:e.inherited}),fi=e=>{const t=[];return e==null||e.forEach(i=>{t.push(ga(i))}),t},yi=e=>{const t=[];return e==null||e.forEach(i=>{t.push(va(i))}),t},va=e=>({id:e.id,accountNumber:e.accountNumber,parentId:e.parentInventoryId,customerKnownSpaceName:e.customerKnownSpaceName,type:e.type,isAssignable:e.isAssignable,label:bt(e),secondaryLabel:e.secondaryLabel,childrenCount:e.childrenCount,inventoryItems:yi(e.inventoryItems)}),bi=e=>{const t=[];return e==null||e.forEach(i=>{t.push({id:i.id,customerKnownName:i.customerKnownName,permissionStatus:i.permissionStatus})}),t},fa=e=>({roleId:e.roleId,roleLocations:bi(e.locations)}),ya=e=>{const t=[];return e==null||e.forEach(i=>{t.push(fa(i))}),t},ba=e=>({contactId:e.contactId,accountNumber:e.accountNumber,locations:ya(e.roleLocations),isInternal:e.isInternal}),xa=e=>({flag:ft(e.flag),flagLocations:bi(e.locations)}),wa=e=>{const t=[];return e==null||e.forEach(i=>{t.push(xa(i))}),t},Aa=e=>({contactId:e.contactId,accountNumber:e.accountNumber,locations:wa(e.flagLocations),isInternal:e.isInternal});class Ca{async getRoleInventory(t){try{const i=pa(t),o=await v.InventoryApi.GetRolesInventory(i);return o!=null&&o.getRoleTree?Qe([o.getRoleTree]):[]}catch(i){return m.handleError(i,"Failed to load the portal access tree."),[]}}async getFlagInventory(t){try{const i=ha(t),o=await v.InventoryApi.GetFlagsInventory(i);return o!=null&&o.getFlagTree?fi([o==null?void 0:o.getFlagTree]):[]}catch(i){return m.handleError(i,"Failed to load the portal access tree."),[]}}async getAccountInventory(t){try{const i=ma(t),o=await v.InventoryApi.GetAccountInventory(i);return o!=null&&o.getAccountTree?yi([o==null?void 0:o.getAccountTree]):[]}catch(i){return m.handleError(i,"Failed to get account inventory."),[]}}async saveAccountRoleInventory(t){try{const i=ba(t),o=await v.InventoryApi.SaveAccountRoleAssignments(i);return Qe(o==null?void 0:o.saveAccountRoleAssignments)}catch(i){return null}}async saveAccountFlagInventory(t){try{const i=Aa(t),o=await v.InventoryApi.SaveAccountFlagAssignments(i);return Qe(o==null?void 0:o.saveAccountUserFlagAssignments)}catch(i){return null}}}const Fe=new Ca,Ta=e=>({role_id:e.roleId,user_id:e.contactId,account_number:e.accountNumber,location_id:e.location}),xi=e=>({roleId:e.role_id,contactId:e.user_id,accountNumber:e.account_number,location:e.location_id,id:e.id,isActive:e.is_active}),Ia=e=>{const t=[];return e.forEach(i=>t.push(Ta(i))),t},wi=e=>{const t=[];return e.forEach(i=>t.push(xi(i))),t},_a=e=>({userId:e.contactId,roleId:e.roleId,accountNumber:e.accountNumber,roleType:e.roleType}),ka=e=>({id:e.id}),Ea=e=>({createRoleAssignment:{RoleAssignmentInput:Ia(e.roleAssignmentInput)}}),Ra=e=>({id:e.id});class Sa{async get(t){try{const i=_a(t),o=await v.RoleAssignmentsApi.getRoleAssignments(i);return wi(o)}catch(i){return m.handleError(i,"Failed to get role assignments."),[]}}async getById(t){try{const i=ka(t),o=await v.RoleAssignmentsApi.getRoleAssignment(i);return xi(o)}catch(i){return m.handleError(i,"Failed to get role assignment"),{}}}async create(t){try{const i=Ea(t),o=await v.RoleAssignmentsApi.createRoleAssignments(i);return wi(o)}catch(i){return m.handleError(i,"Failed to create role assignment."),[]}}async delete(t){try{const i=Ra(t);return v.RoleAssignmentsApi.deleteRoleAssignment(i)}catch(i){return m.handleError(i,"Failed to delete role assignment.")}}}const De=new Sa,Ua=async e=>{for(const t of e)await Promise.all(t.map(i=>i))},we=async e=>{const t=[];for(const i of e){const o=await Promise.all(i.map(n=>n));t.push(o)}return t},$a=e=>({user_flag_type:e.userFlagType,user_id:e.contactId,account_number:e.accountNumber,location_id:e.location}),Ai=e=>({userFlagType:e.user_flag_type,contactId:e.user_id,accountNumber:e.account_number,location:e.location_id,id:e.id}),Na=e=>{const t=[];return e.forEach(i=>t.push($a(i))),t},Ci=e=>{const t=[];return e.forEach(i=>t.push(Ai(i))),t},Fa=e=>({userId:e.contactId,accountNumber:e.accountNumber,userFlagType:e.userFlagType,locationId:e.location}),Da=e=>({id:e.id}),Pa=e=>({createUserFlagAssignment:{UserFlagAssignmentInputs:Na(e.userFlagAssignmentInput)}}),Ma=e=>({id:e.id});class Ba{async get(t){try{const i=Fa(t),o=await v.UserFlagsApi.getUserFlags(i);return Ci(o)}catch(i){return m.handleError(i,"Failed to get assigned user flags."),[]}}async getById(t){try{const i=Da(t),o=await v.UserFlagsApi.getUserFlag(i);return Ai(o)}catch(i){return m.handleError(i,"Failed to get user flag assignment."),{}}}async create(t){try{const i=Pa(t),o=await v.UserFlagsApi.createUserFlags(i);return Ci(o)}catch(i){return m.handleError(i,"Failed to create user flag assignment."),[]}}async delete(t){try{const i=Ma(t);return v.UserFlagsApi.deleteUserFlag(i)}catch(i){return m.handleError(i,"Failed to delete user flag assignment.")}}}const Pe=new Ba;class La{constructor(){this.deleteAssignmentsAndFlags=async(t,i)=>{const o=[],n=[],a=[];try{return t.forEach(r=>{o.push(De.delete({id:r}))}),i.forEach(r=>{n.push(Pe.delete({id:r}))}),o.length>0&&a.push(o),n.length>0&&a.push(n),Ua(a)}catch(r){return m.handleError(r,"Failed to delete batch of role assignments and flags.")}},this.createAssignmentsAndFlags=async(t,i)=>{const o=[];try{if(t.length>0){const n=[De.create({roleAssignmentInput:t})];o.push(n)}if(i.length>0){const n=[Pe.create({userFlagAssignmentInput:i})];o.push(n)}return[...await we(o)]}catch(n){return m.handleError(n,"Failed to create batch of role assignments and flags."),[]}},this.upsertAssignmentAndFlags=async(t,i,o,n,a)=>{try{(t.length>0||i.length)&&await this.deleteAssignmentsAndFlags(t,i),(o.length>0||n.length)&&await this.createAssignmentsAndFlags(o.map(r=>({...r,isInternal:a})),n)}catch(r){m.handleError(r,"Failed to upsert role assignments and flags.")}},this.getAssignmentInventory=async(t,i,o,n)=>{const a=[],r=[];try{return o.forEach(c=>{r.push(Fe.getRoleInventory({id:t,accountNumber:i,roleId:c,location:"",isInternal:n,allChildren:!0}))}),a.push(r),[...(await we(a))[0]].flat()}catch(c){return m.handleError(c,"Failed to get inventory assignments."),[]}},this.getFlagInventory=async(t,i,o)=>{const n=[],a=[];try{return ae.forEach(r=>{a.push(Fe.getFlagInventory({id:t,flag:r.key,accountNumber:i,location:"",allChildren:!1,isInternal:o}))}),n.push(a),[...(await we(n))[0]].flat()}catch(r){return m.handleError(r,"Failed to get inventory flags."),[]}}}}const Ti=new La;async function Oa(e,t,i,o,n,a,r){const c={id:t,roleId:e,accountNumber:i,location:o,searchLocationText:n,allChildren:a,isInternal:r};return await Fe.getRoleInventory(c)}async function Ii(e,t,i,o){const n=await Ti.getAssignmentInventory(t,i,e,o),a={id:"root",label:"",children:[],customerKnownSpaceName:""},r=[];for(const c of n){const p=ue(c,structuredClone(a));r.push({role:c.roleId,rootNode:p,isOpen:!1})}return r}async function za(e,t,i){const o=await Ti.getFlagInventory(e,t,i),n={id:"root",label:"",children:[],customerKnownSpaceName:""},a=[];for(const r of o){const c=ue(r,structuredClone(n));a.push({label:ca(r.flag),rootNode:c,isOpen:!1})}return a}const _i=e=>{const t=[];return e?(e.forEach(i=>{const o=t.findIndex(r=>r.category===i.category),n={id:i.permissionId,name:i.permissionName,privilege:i.privilege,isNonLocation:i.isNonLocation};if(o===-1)return t.push({category:i.category||"Misc.",overallPrivilege:i.privilege,items:[n]});const a=r=>new Set(r.map(c=>c.privilege)).size===1?r[0].privilege:"MIXED";t[o].items.push(n),t[o].overallPrivilege=a(t[o].items)}),ea(t,"category",!0)):t},qa=async(e,t,i,o)=>{const n=await Ii(e,t,i,o),a=await za(t,i,o);return[n,a]},V={Default:"DEFAULT",Internal:"INTERNAL",Custom:"CUSTOM",GlobalAccess:"GLOBALACCESS"};Object.values(V);const Ha=e=>({permissionId:e.permission_id,isNonLocation:e.is_non_location,privilege:e.privilege}),xt=e=>{const t=[];return e.permissions.forEach(i=>t.push(Ha(i))),{name:e.name,accountNumber:e.account_number,roleType:e.role_type,permissions:t,removed:!1,id:e.id}},ki=e=>{const t=[];return e.forEach(i=>{t.push(xt(i))}),t},Va=e=>({permission_id:e.permissionId,privilege:e.privilege}),Ei=e=>{const t=[];return e.forEach(i=>{t.push(Va(i))}),t},ja=e=>({role_name:e.name,permissions:Ei(e.permissions)}),Ga=e=>{const t={name:e.name,role_type:e.roleType,permissions:Ei(e.permissions)};switch(e.roleType){case V.Internal:case V.Default:case V.GlobalAccess:return t;case V.Custom:{if(!e.accountNumber)throw new Error("Account number is required for custom roles.");return{...t,account_number:e.accountNumber}}default:throw new Error(`Unknown role type; ${e.roleType} provided`)}},Ka=e=>({roleType:e.roleType}),Ja=e=>({id:e.id}),Za=e=>({roleCreate:Ga(e.roleCreate)}),Wa=e=>({id:e.id,roleUpdate:ja(e.roleUpdate)}),Qa=e=>({id:e.id});class Ya{async get(t){try{let i;if(!(t!=null&&t.roleType)){const a=await v.RolesApi.getRoles();return i=ki(a),i}const o=Ka(t),n=await v.RolesApi.getRoles(o);return i=ki(n),i}catch(i){return m.handleError(i,"Failed to get roles."),[]}}async getById(t){try{const i=Ja(t),o=await v.RolesApi.getRole(i);return xt(o)}catch(i){return m.handleError(i,"Failed to get role."),{}}}async update(t){try{const i=Wa(t);return v.RolesApi.updateRole(i)}catch(i){return m.handleError(i,"Failed to update role.")}}async create(t){try{const i=Za(t),o=await v.RolesApi.createRole(i);return xt(o)}catch(i){return m.handleError(i,`Failed to create the role '${t.roleCreate.name}'.`),{}}}async delete(t){try{const i=Qa(t);return v.RolesApi.deleteRole(i)}catch(i){return m.handleError(i,"Failed to delete role.")}}}const wt=new Ya,At=e=>({id:e.id,accountNumber:e.account_number,accountName:e.account_name,displayName:e.account_friendly_name,status:e.status,updatedAt:e.updated_at,updatedBy:e.updated_by,userId:e.user_id}),Xa=e=>{const t=[];return e.forEach(i=>{t.push(At(i))}),t},es=e=>({user_id:e.contactId,account_number:e.accountNumber}),ts=e=>({accountNumber:e.accountNumber,userId:e.contactId,status:e.status}),is=e=>({accountAssociationInput:es(e.accountAssociationInput)}),os=e=>({id:e.id}),ns=e=>({id:e.id,accountAssociationStatusUpdate:e.accountAssociationStatusUpdate});class as{async create(t){try{const i=is(t),o=await v.AccountAssociationApi.createAccountAssociation(i);return At(o)}catch(i){return m.handleError(i,"Failed to create account association."),null}}async get(t){try{const i=ts(t),o=await v.AccountAssociationApi.getAccountAssociations(i);return Xa(o)}catch(i){return m.handleError(i,"Failed to get associated accounts."),[]}}async getById(t){try{const i=os(t),o=await v.AccountAssociationApi.getUserAccountAssociation(i);return At(o)}catch(i){return m.handleError(i,"Failed to get account association"),{}}}async update(t){try{const i=ns(t);await v.AccountAssociationApi.updateAccountAssociationStatus(i)}catch(i){m.handleError(i,"Failed to update account association status.")}}}const Ri=new as;class ss{constructor(){this.getRoles=async t=>{try{let i=[];return t?i=await wt.get({roleType:t}):i=await wt.get({}),[...new Map(i.map(o=>[o.id,o])).values()]}catch(i){return m.handleError(i,"Failed to get all roles."),[]}},this.getRolesAndPermissions=async t=>{const i=await Promise.allSettled([Ve.get(),this.getRoles(t)]);i.forEach(r=>{if(r.status==="rejected")throw new Error});const o=[i[0].value,i[1].value],[n,a]=o;try{return a.forEach(r=>{r.permissions.forEach(c=>{const p=n.find(g=>g.id===c.permissionId);p&&(c.permissionName=p.name,c.category=p.category)})}),a}catch(r){return m.handleError(r,"Failed to get roles with permissions."),[]}},this.getUserData=async(t,i)=>{const o=[];try{const n=[De.get({contactId:t}),Pe.get({contactId:t,accountNumber:i}),Ri.get({contactId:t,accountNumber:i})];return o.push(n),[...(await we(o))[0]]}catch(n){return m.handleError(n,"Failed to get user data."),[]}},this.getState=async()=>{const t=[];try{const i=[Ve.getMyPermissions({excludeParents:!1,excludeSiblings:!0}),Ve.get(),this.getRolesAndPermissions(),ai.get()];return t.push(i),[...(await we(t))[0]]}catch(i){return m.handleError(i,"Failed to get user state."),[]}},this.getAccountData=async t=>{const i=[],o=[];try{for(const n of t)o.push(Fe.getAccountInventory({accountNumber:n,allChildren:!0}));return i.push(o),[...(await we(i))[0]]}catch(n){return m.handleError(n,"Failed to get account data."),[]}}}}const Ct=new ss;class Ae{constructor(t){this._state=t,this._hydrating=!1,Zi(this)}get(){return this.state}set(t){this._state=t}update(t){this._state={...this.get(),...t}}clear(){this.isObject(this._state)&&(this._state={}),this.isArray(this._state)&&(this._state=[])}isHydrating(){return this.hydrating}requestHydration(){this._hydrating=!0}completeHydration(){this._hydrating=!1}get state(){return ke(this._state)}get hydrating(){return this._hydrating}isArray(t){return Array.isArray(t)}isObject(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}}s([Mt],Ae.prototype,"_state",void 0),s([Mt],Ae.prototype,"_hydrating",void 0);class rs extends Ae{async refresh(){this.requestHydration();const t=await Ct.getRolesAndPermissions();this.set(t),this.completeHydration()}}const pe=new rs([]);let Ce=class extends I{constructor(){super(...arguments),this.inPermissionsDialog=!1,this.permissionData=[]}updated(e){e.has("activeRoleId")&&this.hydratePermissions()}hydratePermissions(){const e=pe.get().find(t=>t.id===this.activeRoleId);e!=null&&e.permissions&&(this.permissionData=_i(e.permissions))}render(){const e=this.permissionData.filter(o=>o.category!=="Misc.").flatMap(o=>o.items).filter(o=>o.isNonLocation),t=structuredClone(this.permissionData).filter(o=>o.category!=="Misc.").filter(o=>o.items.some(n=>!n.isNonLocation)).map(o=>({...o,items:o.items.filter(n=>!n.isNonLocation)})),i=this.permissionData.filter(o=>!o.category||o.category==="Misc.").flatMap(o=>o.items);return l` <div data-testid="permissions-container" class="${this.inPermissionsDialog?"permissions-dialog-container":""}"> ${this.inPermissionsDialog?x:l`<h3 class="dlr-text-heading">Permissions</h3>`} ${st(e,o=>o.id,o=>l` <non-location-permission .permission="${o}"></non-location-permission> `)} ${st(t,o=>o.items,o=>l` <permission-group .permissionGroup="${o}"></permission-group> `)} ${st(i,o=>o.id,o=>l` <non-category-permission .permission="${o}"></non-category-permission> `)} </div> `}};Ce.styles=[Je,A],s([d()],Ce.prototype,"activeRoleId",void 0),s([d({type:Boolean})],Ce.prototype,"inPermissionsDialog",void 0),s([u()],Ce.prototype,"permissionData",void 0),Ce=s([b("user-details-permission")],Ce);const Ye=E`@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v145/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}.flex{display:flex}.flex-1{flex:1}.border-top-solid-gray{border-top:solid 1px #ddd}.red{background-color:#db0028}.blue{background-color:#1456e0}.white{background-color:#fff;color:#1456e0;border:solid 1px #1456e0}.right{float:right}.margin-top-20{margin-top:20px}.padding-2{padding:2px}.padding-20{padding:20px}.padding-right-10{padding:10px}`,Xe=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{--md-sys-color-on-surface-variant:rgba(9, 34, 65, 0.7);--md-primary-tab-hover-label-text-color:#1456e0}.remove{background-color:#fff;color:#db0028;border:1px solid #db0028}.remove-disabled{background-color:#fff;color:rgba(0,0,0,.26);border:1px solid rgba(0,0,0,.26)}.remove-role-container{padding:1rem 0 0 1rem}ix-textbox,md-textfield{--md-outlined-text-field-width:100%;--md-outlined-text-field-focus-width:100%;width:inherit}.option{display:block;width:100%}.option-disabled{display:block;width:100%;color:#ddd}.check_circle{color:#4caf50}.mail{color:#ff9800}.warning{color:#db0028}.delete_forever{color:#6d758c}.active-icon-section{display:flex;align-items:center;padding-right:16px}.panel-status{display:flex;-webkit-box-align:center;align-items:center;gap:4px;padding-right:8px}.panel-button-container{display:flex;flex-direction:row;column-gap:12px}.suspend-button{padding:8.5px 20px}.account-status-suspend{width:100px;padding-left:2px}.btn-disabled{color:rgba(0,0,0,.26);box-shadow:none;background-color:rgba(0,0,0,.12)}.confirmation-content{flex:1 1 auto;padding-right:24px;padding-bottom:20px;padding-left:24px;overflow:hidden;padding-top:8px!important}.role-add-icon{vertical-align:text-bottom;padding-right:5px}.role-add-text{vertical-align:text-top;text-transform:uppercase}.confirmation-content{max-width:550px}.add-roles-dialog-actions{display:flex;justify-content:flex-end;padding:24px 15px 8px 20px}.user-detail-navigation{border-top:1.5px solid #bec9c8;position:relative;top:-1px}.flag-text{text-align:right;margin-right:1.5rem}#flag-text-link{color:#1456e0}.mobile-options{display:none}.email{text-decoration:underline}@media only screen and (max-width:600px){.user-details-controls>ix-button{display:none}div>.user-details-controls{padding-right:0}.mobile-options{display:flex;align-items:center;color:var(--md-sys-color-primary,#1456e0);font-size:24px}ix-menu-item{min-width:200px}h1{margin-bottom:.75rem}.tree-view{overflow-x:auto;overflow-y:hidden;max-width:100%}.flag-text{text-align:center;margin-right:0}.user-details-panel{margin:0 -.5rem;overflow:hidden}}@media only screen and (min-width:601px) and (max-width:1200px){.tree-view{overflow-x:auto;overflow-y:hidden;max-width:100%}}@media only screen and (max-width:1200px){.flex.user-status{flex-direction:column;align-items:flex-start}.user-status-header{width:100%;justify-content:space-between;padding-bottom:12px}}`;class et{}et.BTN_CANCEL=e=>`changes-dialog-${e}-btn-cancel`,et.BTN_CONFIRM=e=>`changes-dialog-${e}-btn-confirm`;let oe=class extends I{constructor(){super(...arguments),this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.headerText="",this.bodyText="",this.cancelButtonText="Cancel",this.confirmationButtonText="Confirm",this.isOpen=!1,this.submitting=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding)}handleEscapeKey(e){return e.which===27&&this.handleCancelChanges(),null}handleConfirmChanges(){this.dispatchEvent(new CustomEvent("confirm"))}handleCancelChanges(){this.dispatchEvent(new CustomEvent("cancel"))}renderHeader(){return this.headerText.length?l`<div slot="headline"> <h1 class="dlr-text-heading">${this.headerText}</h1> </div>`:x}renderContent(){return this.bodyText?l`<div class="confirmation-content" slot="content" method="dialog"> <p>${this.bodyText}</p> </div>`:x}renderFooter(){return l` <div class="dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="${this.cancelButtonText}" ?disabled="${this.submitting}" @click="${()=>this.handleCancelChanges()}" data-testid="${et.BTN_CANCEL(this.id)}"> ${this.cancelButtonText} </ix-button> <ix-button id="add-account-button" form="confirm-updates" appearance="text" text="${this.confirmationButtonText}" ?submitting="${this.submitting}" @click="${()=>this.handleConfirmChanges()}" data-testid="${et.BTN_CONFIRM(this.id)}"> ${this.confirmationButtonText} </ix-button> </div> `}render(){return l`<ix-dialog class="z-50 relative" id="add-role-to-account" ?open="${this.isOpen}" @closed="${()=>this.handleCancelChanges()}"> ${this.renderHeader()} ${this.renderContent()} ${this.renderFooter()} </ix-dialog>`}};oe.styles=[Ye,Xe,A],s([d({type:String})],oe.prototype,"headerText",void 0),s([d({type:String})],oe.prototype,"bodyText",void 0),s([d({type:String})],oe.prototype,"cancelButtonText",void 0),s([d({type:String})],oe.prototype,"confirmationButtonText",void 0),s([d({type:Boolean,reflect:!0})],oe.prototype,"isOpen",void 0),s([d({type:Boolean})],oe.prototype,"submitting",void 0),oe=s([b("changes-confirmation")],oe);const ls=E`
|
|
1989
|
+
`;class kn{constructor(t){this.config=t,this.gqlClient=new no(this.config.url),this.config.accessToken&&this.gqlClient.setHeader("authorization",this.config.accessToken)}async GetRolesInventory(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(An,{...t})}async GetFlagsInventory(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(Cn,{...t})}async GetAccountInventory(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(Tn,{...t})}async SaveAccountRoleAssignments(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(In,{...t})}async SaveAccountFlagAssignments(t){var i;return(i=this.gqlClient)===null||i===void 0?void 0:i.request(_n,{...t})}}const En="http://localhost".replace(/\/+$/,"");class ni{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:En}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ai}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Rn=new ni;class rt{constructor(t=Rn){this.configuration=t,this.fetchApi=async(i,o)=>{let n={url:i,init:o};for(const r of this.middleware)r.pre&&(n=await r.pre({fetch:this.fetchApi,...n})||n);let a;try{a=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(r){for(const c of this.middleware)c.onError&&(a=await c.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:r,response:a?a.clone():void 0})||a);if(a===void 0)throw r instanceof Error?new Nn(r,"The request failed and the interceptors did not return an alternative response"):r}for(const r of this.middleware)r.post&&(a=await r.post({fetch:this.fetchApi,url:n.url,init:n.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(o=>({pre:o}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(o=>({post:o}));return this.withMiddleware(...i)}isJsonMime(t){return t?rt.jsonRegex.test(t):!1}async request(t,i){const{url:o,init:n}=await this.createFetchParams(t,i),a=await this.fetchApi(o,n);if(a&&a.status>=200&&a.status<300)return a;throw new Un(a,"Response returned an error code")}async createFetchParams(t,i){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(h=>n[h]===void 0?delete n[h]:{});const a=typeof i=="function"?i:async()=>i,r={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},c={...r,...await a({init:r,context:t})};let p;$n(c.body)||c.body instanceof URLSearchParams||Sn(c.body)?p=c.body:this.isJsonMime(n["Content-Type"])?p=JSON.stringify(c.body):p=c.body;const g={...c,body:p};return{url:o,init:g}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}rt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Sn(e){return typeof Blob<"u"&&e instanceof Blob}function $n(e){return typeof FormData<"u"&&e instanceof FormData}class Un extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Nn extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class Fn extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function ie(e,t){return e[t]!=null}function ai(e,t=""){return Object.keys(e).map(i=>si(i,e[i],t)).filter(i=>i.length>0).join("&")}function si(e,t,i=""){const o=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(a=>encodeURIComponent(String(a))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${n}`}if(t instanceof Set){const n=Array.from(t);return si(e,n,i)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ai(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}class ri{constructor(t,i=o=>o){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}function li(e){return Dn(e)}function Dn(e,t){return e==null?e:{firstName:ie(e,"firstName")?e.firstName:void 0,lastName:ie(e,"lastName")?e.lastName:void 0,contactPhoneNumber:ie(e,"contactPhoneNumber")?e.contactPhoneNumber:void 0,preferredLanguage:ie(e,"preferredLanguage")?e.preferredLanguage:void 0,preferredTimezone:ie(e,"preferredTimezone")?e.preferredTimezone:void 0,timezoneOverridden:ie(e,"timezoneOverridden")?e.timezoneOverridden:void 0,preferredDateFormat:ie(e,"preferredDateFormat")?e.preferredDateFormat:void 0,preferredTimeFormat:ie(e,"preferredTimeFormat")?e.preferredTimeFormat:void 0,email:ie(e,"email")?e.email:void 0}}function Pn(e){if(e!==void 0)return e===null?null:{firstName:e.firstName,lastName:e.lastName,contactPhoneNumber:e.contactPhoneNumber,preferredLanguage:e.preferredLanguage,preferredTimezone:e.preferredTimezone,timezoneOverridden:e.timezoneOverridden,preferredDateFormat:e.preferredDateFormat,preferredTimeFormat:e.preferredTimeFormat}}class Mn extends rt{async getUserSettingsRaw(t){const i={},o={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("bearerToken",[]);r&&(o.Authorization=`Bearer ${r}`)}const n=await this.request({path:"/user-profile",method:"GET",headers:o,query:i},t);return new ri(n,a=>li(a))}async getUserSettings(t){return await(await this.getUserSettingsRaw(t)).value()}async userProfilePatchRaw(t,i){if(t.profileSettingEditInput===null||t.profileSettingEditInput===void 0)throw new Fn("profileSettingEditInput","Required parameter requestParameters.profileSettingEditInput was null or undefined when calling userProfilePatch.");const o={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,c=await r("bearerToken",[]);c&&(n.Authorization=`Bearer ${c}`)}const a=await this.request({path:"/user-profile",method:"PATCH",headers:n,query:o,body:Pn(t.profileSettingEditInput)},i);return new ri(a,r=>li(r))}async userProfilePatch(t,i){return await(await this.userProfilePatchRaw(t,i)).value()}}class Bn{constructor(t){this.configuration=t}get InventoryApi(){return new kn({url:this.configuration.userManagementAggregationApiUrl,accessToken:this.getToken()})}get UsersApi(){return new xn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get AccountAssociationApi(){return new mn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get AccountsApi(){return new gn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get RolesApi(){return new yn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get PermissionsApi(){return new vn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get RoleAssignmentsApi(){return new fn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get UserFlagsApi(){return new bn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get VerificationApi(){return new wn(new te({basePath:this.configuration.userManagementApiUrl,accessToken:this.getToken()}))}get UserProfileSettingsApi(){var t;const i=((t=this.getToken())!==null&&t!==void 0?t:"").replace(/^Bearer\s+/i,""),o={};return new Mn(new ni({basePath:this.configuration.LoginAuthority,accessToken:i,headers:o}))}getToken(){return this.configuration.getTokenFn?this.configuration.getTokenFn():void 0}}class Ln extends ao{constructor(t,i){super({...t}),this.hashed_identifier="",this.email="",this.account_number="",this.hashed_identifier=i}get getEmail(){var t;return(t=this.email)!==null&&t!==void 0?t:this.profile.email}get getAccount(){var t;return(t=this.account_number)!==null&&t!==void 0?t:this.profile.account_number}}class Le{constructor({loginAuthority:t,clientId:i,scope:o,postLogoutRedirectUri:n,userStorageKey:a=D().UserManagement.UI.UserManagementUIStorageKey,xauthStorageKey:r=D().UserManagement.UI.UserManagementXAuthUIStorageKey,redirectUrlKey:c="redirect-url",authPaths:p={authenticate:"authenticate",authCallback:"auth-callback",logout:"logout"}}){this.configuration={loginAuthority:t,clientId:i,scope:o,postLogoutRedirectUri:n,userStorageKey:a,xauthStorageKey:r,redirectUrlKey:c,authPaths:p};const{location:g}=window,h=`${g.protocol}//${g.hostname}${g.port?`:${g.port}`:""}`,L={authority:this.configuration.loginAuthority,client_id:this.configuration.clientId,redirect_uri:`${h}/${this.configuration.authPaths.authCallback}`,response_type:"code",scope:this.configuration.scope,post_logout_redirect_uri:this.configuration.postLogoutRedirectUri,loadUserInfo:!0};this.userManager=new so(L)}isLoggedIn(){const t=this.getUser();if(t===null)return!1;if(!t.expires_at)return!0;const i=new Date,o=new Date(t.expires_at*1e3);return i<o}redirectToAuth(t=!1){const i=this.isAuthenticating();(t||!i)&&(i||localStorage.setItem(this.configuration.redirectUrlKey,window.location.href),window.location.href=`/${this.configuration.authPaths.authenticate}`)}isAuthenticating(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authenticate?(this.userManager.signinRedirect(),!0):!1}isHandlingAuthCallback(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authCallback?(this.userManager.signinRedirectCallback().then(Le.ensureValidUser).then(Le.addHashedIdToUserProfile).then(i=>this.saveUser(i)).then(()=>this.authSuccessRedirect()).catch(()=>this.redirectToAuth()),!0):!1}authSuccessRedirect(){let t="/";const i=localStorage.getItem(this.configuration.redirectUrlKey);i&&(localStorage.removeItem(this.configuration.redirectUrlKey),t=i),window.location.href=t}redirectToLogout(){this.isHandlingLogout()||(window.location.href=`/${this.configuration.authPaths.logout}`)}isHandlingLogout(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.logout?(this.clearUser(),window.localStorage.clear(),this.userManager.signoutRedirect({id_token_hint:this.getIdToken()}),!0):!1}isProcessing(){return this.isAuthenticating()||this.isHandlingAuthCallback()||this.isHandlingLogout()}saveUser(t){localStorage.setItem(this.configuration.userStorageKey,JSON.stringify(t))}clearUser(){localStorage.removeItem(this.configuration.userStorageKey)}getXAuthUser(){const t=localStorage.getItem(this.configuration.xauthStorageKey);if(t){const i=JSON.parse(t);if(i!=null&&i.email&&i!=null&&i.account_number)return i}}getTokenUser(){const t=localStorage.getItem(this.configuration.userStorageKey);if(t)return JSON.parse(t)}getUser(){const t=this.getTokenUser();return t?(t.profile.email||(t.profile.email=this.getXAuthUser().email),t!=null?t:null):null}getUserDetails(){const t={accountNumber:"",email:""},i=this.getUser();return i&&(t.accountNumber=i.profile.account_number,t.email=i.profile.email),t}getUserProfileSub(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.sub}getUserLocale(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.locale}getIdToken(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.id_token}getAccessToken(){var t;return`Bearer ${(t=this.getUser())===null||t===void 0?void 0:t.access_token}`}static async hashValue(t){const i=new TextEncoder().encode(t),o=await crypto.subtle.digest("SHA-256",i);return Array.from(new Uint8Array(o)).map(n=>n.toString(16).padStart(2,"0")).join("")}static async addHashedIdToUserProfile(t){const i=`${t.profile.sub}-${t.profile.customer_id}`,o=await Le.hashValue(i);return new Ln(t,o)}static ensureValidUser(t){if(!t.id_token)throw new Error("Missing property:id_token");return t}}const ve=D(),fe=new Le({loginAuthority:ve.LoginAuthority,clientId:ve.LoginService.UserManagementUIClientId,scope:ve.LoginService.UserManagementUIScopes}),v=new Bn({userManagementApiUrl:ve.UserManagement.UI.UserManagementApiUrl,userManagementAggregationApiUrl:ve.UserManagement.UI.UserManagementAggregationApiUrl,LoginAuthority:ve.LoginAuthority,getTokenFn:()=>fe.getAccessToken()});var On="Alerts",zn="Content",qn="DCIM",Hn="Invoices",Vn="Marketplace",jn="Release",Gn="Security",Kn={"Account Information":"Account Information",Alerts:On,"Cloud Connect":"Cloud Connect",Content:zn,"Cross Connect":"Cross Connect","Custom Role":"Custom Role","Custom Roles":"Custom Roles","Customer Equipment Connection (CEC)":"Customer Equipment Connection (CEC)","Customer Support":"Customer Care","Customer Support Team":"Customer Support Team",DCIM:qn,"DCIM-enabled location data":"DCIM-enabled location data","Default System Roles":"Default System Roles","EMEA MarketPlace":"EMEA MarketPlace","External User":"External User","Internal Roles":"Internal Roles","Internal User":"Internal User","Internet Exchange":"Internet Exchange","Intra-Customer Connectivity (ICC)":"Intra-Customer Connectivity (ICC)",Invoices:Hn,"IP Bandwidth":"IP Bandwidth",Marketplace:Vn,"OSP Access":"OSP Access","Permanent Badge":"Permanent Badge","Planned Site Maintenance":"Maintenance & Incident Notifications","PoP/POE Room Access":"PoP/POE Room Access",Release:jn,"Remote Hands":"Remote Hands","Remote Hands Package":"Remote Hands Package",Security:Gn,"Service Exchange Cloud Router":"Service Exchange Cloud Router","Service Exchange Port":"Service Exchange Port","Shipping & Receiving":"Deliveries & Removals","Space & Power":"Space & Power","Trouble Ticket":"Trouble Ticket","Visitor Access":"Visitor Access"};Ht.use(ro).init({resources:{en:{translation:{...Kn}}},interpolation:{escapeValue:!1},lng:"en",debug:!1});const ci=e=>Ht.t(e),Jn=e=>{const t=[];return e.forEach(i=>{t.push({id:i.id,name:ci(i.name),isNonLocation:i.is_non_location,category:i.category,privileges:i.privileges,internalPrivileges:i.internal_privileges,isInternal:i.is_internal})}),t},Zn=e=>{const t=[];return e.forEach(i=>{t.push({accountNumber:i.account_number,permissionName:ci(i.permission_name),privilege:i.privilege})}),t};class Wn{async get(){try{const t=await v.PermissionsApi.getPermissions();return Jn(t)}catch(t){return m.handleError(t,"Could not get permissions."),[]}}async getMyPermissions(t){try{const i=await v.PermissionsApi.getUserPermissions(t);return Zn(i)}catch(i){return m.handleError(i,"Could not retrieve current user's permissions."),[]}}}const Ve=new Wn,Qn=e=>{const t=[];return e.forEach(i=>{t.push({accountNumber:i.account_number,name:i.name,parentAccountNumber:i.parent_account_number,displayName:i.friendly_name})}),t};class Yn{async get(){try{const t=await v.AccountsApi.getAccounts();return Qn(t)}catch(t){return m.handleError(t,"Failed to get accounts."),[]}}}const di=new Yn;class Xn{constructor(){this.myPermissions=[]}isProfileOfLoggedInUser(t){var i;return((i=$==null?void 0:$.getEmail())===null||i===void 0?void 0:i.toLowerCase())===(t==null?void 0:t.toLowerCase())}hasUserRead(t){return this.hasPermission(C.user,y.read,t)}hasUserUpdate(t){return this.hasPermission(C.user,y.update,t)}hasExternalUserRead(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.read,t):this.hasPermission(C.externalUser,y.read,t)}hasExternalUserUpdate(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.update,t):this.hasPermission(C.externalUser,y.update,t)}hasExternalUserCreate(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.create,t):this.hasPermission(C.externalUser,y.create,t)}hasInternalUserRead(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.read,t):this.hasPermission(C.internalUser,y.read,t)}hasInternalUserUpdate(t){return D().UserManagement.InternalUserRetired?this.hasPermission(C.user,y.update,t):this.hasPermission(C.internalUser,y.update,t)}hasCustomRolesApprove(t){return this.hasPermission(C.customRoles,y.approve,t)}hasCustomRolesCreate(t){return this.hasPermission(C.customRoles,y.create,t)}hasCustomRolesUpdate(t){return this.hasPermission(C.customRoles,y.update,t)}hasCustomRolesRead(t){return this.hasPermission(C.customRoles,y.read,t)}hasInternalRolesCreate(t){return this.hasPermission(C.internalRoles,y.create,t)}hasInternalRolesUpdate(t){return this.hasPermission(C.internalRoles,y.update,t)}hasInternalRolesRead(t){return this.hasPermission(C.internalRoles,y.read,t)}hasDefaultSystemRolesCreate(t){return this.hasPermission(C.defaultRoles,y.create,t)}hasDefaultSystemRolesUpdate(t){return this.hasPermission(C.defaultRoles,y.update,t)}hasDefaultSystemRolesRead(t){return this.hasPermission(C.defaultRoles,y.read,t)}hasRoleManagementAccess(t){return this.hasPermission(C.defaultRoles,y.read,t)||this.hasPermission(C.customRoles,y.read,t)||this.hasPermission(C.internalRoles,y.read,t)||this.hasPermission(C.externalUser,y.read,t)}hasUserManagementAccess(){return D().UserManagement.InternalUserRetired?this.hasUserRead():this.hasExternalUserRead()||this.hasInternalUserRead()}hasAssignInternalRoleCreate(t){return this.hasPermission(C.assignInternalRole,y.create,t)}async refreshPermissions(){this.myPermissions=await Ve.getMyPermissions({excludeParents:!1,excludeSiblings:!0})}async refreshAccounts(){const t=await di.get();$.setAccounts(t)}hasPrivilegeLevel(t,i){const o=[y.approve,y.create,y.update,y.read],n=o.findIndex(r=>r===t.toLowerCase()),a=o.findIndex(r=>r===i.toLowerCase());return n>=a}hasPermission(t,i,o){let{myPermissions:n}=this,a=!1;return o&&(n=n.filter(r=>r.accountNumber===o)),n.length&&i&&(a=n.some(r=>r.permissionName===t&&this.hasPrivilegeLevel(i,r.privilege))),a}}const P=new Xn,ui="uppercase font-bold tracking-wider",pi={LocalStorage:{},SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges"}};let mt=class extends I{constructor(){super(...arguments),this.routeName=null}return(){window.sessionStorage.getItem(pi.SessionStorage.HasOutstandingChanges)!=="true"&&this.routeName&&Ge(this.routeName)}render(){return l` <ix-button appearance="text" has-icon @click="${this.return}" data-testid="um-back-button"> <md-icon slot="icon">arrow_back</md-icon> <span class="${ui}">Back</span> </ix-button>`}};s([d()],mt.prototype,"routeName",void 0),mt=s([b("um-back-button")],mt);const Se=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))};let hi=class extends I{dispatchCreateUserEvent(){Se(this,_.CreateUserClicked)}render(){return l` <ix-button @click="${this.dispatchCreateUserEvent}" has-icon> <md-icon slot="icon">add</md-icon> <span class="${ui}">Create User</span> </ix-button>`}};hi=s([b("um-create-user-button")],hi);const z={Home:"Home",UserManagement:"User Management",RoleManagement:"Role Management",UserManagementDetails:"User Management Details"},mi=[{name:z.Home,path:"(/?)",component:"home-view",action:()=>{import("./ui-user-management2.js")}},{name:z.UserManagement,path:"/user-management",component:"user-management-view",headerRight:l``,action:async()=>{P.hasUserManagementAccess()?import("./ui-user-management3.js"):he.go("/")}},{name:z.RoleManagement,path:"/role-management",component:"role-management-view",action:async()=>{P.hasRoleManagementAccess()?import("./ui-user-management4.js"):he.go("/")}},{name:z.UserManagementDetails,path:"/user-management-details",component:"user-management-details-view",hideAccountSwitcher:!0,headerLeft:l`<um-back-button routeName="${z.UserManagement}"></um-back-button>`,action:async()=>{P.hasUserManagementAccess()?import("./ui-user-management6.js"):he.go("/")}}];let Q=null;function gi(){const{pathname:e,search:t,hash:i}=window.location;he.go({pathname:e,search:t,hash:i})}function ea(e,t,i){const o=i.map(n=>({...n,path:`${t}${n.path}`,redirect:n.redirect?`${t}${n.redirect}`:null}));o.push({path:"(.*)",component:"no-elem"}),Q=new he(e),Q.setRoutes(o),window.addEventListener("shell-after-navigate",gi)}function ta(){return Q}function ia(){Q==null||Q.unsubscribe(),Q==null||Q.removeRoutes(),Q=null,window.removeEventListener("shell-after-navigate",gi)}function je(e,t){return Q&&Q.urlForName(e,t)}function Ge(e,t){const i=je(e);i&&he.go({pathname:i,hash:t})}const oa=e=>{var t,i,o,n,a,r;const c=mi.find(g=>g.name===e),p=(r=(a=(n=(o=(i=(t=window.document.querySelector("gp-bootstrap"))===null||t===void 0?void 0:t.shadowRoot)===null||i===void 0?void 0:i.querySelector("global-portal-app"))===null||o===void 0?void 0:o.shadowRoot)===null||n===void 0?void 0:n.querySelector("ui-user-management"))===null||a===void 0?void 0:a.getAttribute("baseurl"))!==null&&r!==void 0?r:"";return window.location.pathname===`${p}${c==null?void 0:c.path}`};let gt=class extends Ie{constructor(){super(...arguments),this.setNavigationItemsBinding=this.setNavigationItems.bind(this),this.navigationItems=[],this.compact=!1}static get styles(){return[ti,A]}connectedCallback(){super.connectedCallback(),window.addEventListener(_.RouteChanged,this.setNavigationItemsBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.RouteChanged,this.setNavigationItemsBinding)}setNavigationItems(){this.requestUpdate(),!this.navigationItems.length&&(this.navigationItems=[{href:je(z.UserManagement),title:"User Management",icon:l`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="white"> ${He.userManagementIcon} </svg>`},{href:je(z.RoleManagement),title:"Role Management",icon:l`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="white"> ${He.roleManagementIcon} </svg>`}])}toggleCompact(){Se(this,_.ToggleNavBar),setTimeout(()=>{window.dispatchEvent(new Event("resize"))},301)}renderNavigation(){return P.hasExternalUserRead()?l`${this.navigationItems.map(e=>l` <li class="relative m-1"> <div class="${e.href===window.location.pathname?"bg-white opacity-[.16] inset-0 rounded-md absolute":""}"></div> <a href="${e.href}" class="${e.href===window.location.pathname?"flex px-6 py-4 gap-4 rounded-md font-bold":"flex px-6 py-4 gap-4 rounded-md font-bold opacity-60"}"> <div class="w-6 shrink-0">${e.icon}</div> <div class="grow text-left"> <div class="${this.compact?"w-0":"w-full"} animate-width overflow-hidden"> ${e.title} </div> </div> </a> </li> `)}`:x}render(){return l` <ix-icon-button @click="${this.toggleCompact}" icon="chevron_right" class="drop-shadow-lg items-center expand-cta bg-white rounded-full text-slate-600 h-8 w-8 absolute z-20 lg:right-0 lg:top-[34px] hidden top-[27px] right-[-8px] sm:flex ${this.compact?"animate-spin-180-backwards":"animate-spin-180-forwards"}"> </ix-icon-button> <nav class="flex flex-col overflow-hidden min-h-full rounded-xl drop-shadow text-center nav-bar long text-white ${this.compact?"closed":""} whitespace-nowrap animate-width"> <div class="m-1 px-6 py-4 hidden sm:block"> <svg @click="${this.toggleCompact}" focusable="false" viewBox="0 0 178 27" fill="white" class="w-[200px]"> ${He.digitalRealtyLogoWithText} </svg> </div> <hr class="divider hidden sm:block"> <ul class="grow"> ${this.renderNavigation()} </ul> <dev-clear-storage-button class="white-icon self-start p-5"></dev-clear-storage-button> </nav> `}};s([d({type:Boolean})],gt.prototype,"compact",void 0),gt=s([b("navigation-bar")],gt);const na=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.header-container{display:flex;align-items:center;margin-bottom:16px}.header-container-back-btn{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.back{padding-left:12px}.arrow-back-icon{font-size:22px;align-items:center;padding-right:1px}.header-rhs-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.profile{background-color:#092241;height:35px;margin-right:30px;margin-left:30px;border-radius:10px;color:#fff;padding-left:20px;padding-right:20px;display:flex;align-items:center}.logout{height:35px;border-radius:10px;border:none;background-color:#1456e0;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;padding-left:15px;padding-right:15px}.logout svg{width:1em;height:1em;font-size:20px;margin-right:5px}.add-icon{font-size:20px;align-items:center}`;let ye=class extends Ie{constructor(){super(...arguments),this.updateLayoutBinding=this.updateLayout.bind(this),this.pageTitle="",this.showCreateUserButton=!1,this.showHeader=!0}connectedCallback(){super.connectedCallback(),window.addEventListener(_.RouteChanged,this.updateLayoutBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.RouteChanged,this.updateLayoutBinding)}updateLayout(e){switch(this.pageTitle=e.detail.location.route.name||"",this.pageTitle){case"User Management":this.showCreateUserButton=P.hasExternalUserCreate(),this.showHeader=!0;break;case"Role Management":this.showCreateUserButton=!1,this.showHeader=!0;break;case"User Management Details":this.showCreateUserButton=!1,this.showHeader=!1;break}}getRoute(){return this.pageTitle==="User Management Details"?z.UserManagement:z.Home}dispatchCreateUserEvent(){Se(this,_.CreateUser)}renderAppHeader(){return l` <div class="flex gap-2 items-center mt-4 mb-8 justify-between"> <div> ${this.showHeader?l`<h1 class="dlr-text-page-title">${this.pageTitle}</h1>`:l` <um-back-button .routeName="${this.getRoute()}"></um-back-button> `} </div> <div class="items-center flex gap-2 flex-wrap justify-end"> ${this.showCreateUserButton?l` <ix-button @click="${this.dispatchCreateUserEvent}" has-icon data-testid="create-user-button"> Create User <md-icon slot="icon">add</md-icon> </ix-button> `:x} </div> </div> `}render(){return l`${this.renderAppHeader()}`}};ye.styles=[A,na],s([d({type:String})],ye.prototype,"pageTitle",void 0),s([u()],ye.prototype,"showCreateUserButton",void 0),s([u()],ye.prototype,"showHeader",void 0),ye=s([b("app-header")],ye);const vi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{--md-outlined-text-field-label-text-color:black}.input-group{display:flex;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}.textfield{width:100%}ix-button{font-family:var(--root-secondary-font)}@media screen and (max-width:600px){.input-group{flex-direction:column}}`,q=e=>e?e.component.value:null,Ke=(e,t)=>{if(!e)return;const i=e.component;i.value=t},be=e=>{if(!e)return null;const{input:t}=e;return t.value},vt=(e,t)=>{if(!e)return;const{input:i}=e;i.value=t},aa=e=>e?e.component.checked:null,sa=(e,t)=>{if(!e)return;const i=e.component;i.checked=t};function fi(e){const t=JSON.stringify(e);return JSON.parse(t)}const ra=(e,t,i)=>e.sort((o,n)=>(o[t]<n[t]?-1:1)*(i?1:-1));function la(e){const t={};for(const[i,o]of Object.entries(e))for(const n of i.split(" "))t[n]=o;return uo(t)}const ca=e=>{try{const t=e.startsWith("+")?Vt(e):Vt(`+${e}`),i=`+${t.countryCallingCode} ${new lo(t.country||"US").input(t.nationalNumber)}`;return i.endsWith(")")||i.endsWith("(")?e:i}catch(t){return e}},da=()=>window.matchMedia("(min-width: 1024px)").matches,$e={phone:"^[+]?[(]?[0-9]{3}[)]?[-s.]?[0-9]{3}[-s.]?[0-9]{4,6}$",name:D().UserManagement.UI.ValidationRegexPatterns.name,alphabetOnly:"^[A-Za-z]+$"},Ue=(e,t)=>{const i=e;return"component"in i&&i.component.reportValidity(),t?(i.error=!1,i.errorText="",!0):(i.error=!0,i.errorText="This field is mandatory",!1)},yi=(e,t,i)=>{const o=e;return t!=null&&t.match(o.pattern)?(o.error=!1,o.errorText="",!0):(o.error=!0,o.errorText=i,!1)},bi=(e,t,i)=>{if(!t)return!1;const o=e;return po.isEmail(t)?(o.error=!1,o.errorText="",!0):(o.error=!0,o.errorText=i,!1)},ua=e=>e.error,pa=(e,t)=>{const i=t;return q(e)===i},ft=(e,t,i)=>{const o=q(e);return e.required&&!Ue(e,o)||e.pattern&&!yi(e,o,i)||e.type==="email"&&!bi(e,o,i)?!1:!(ua(e)||pa(e,t))},yt=(e,t)=>{const i=be(e),o=e;return co(i)?(o.error=!1,!0):(o.error=!0,o.errorText=t,!1)},ha=(e,t)=>{t.length>0&&t.forEach(i=>{const o=e.find(n=>n.id===i.field);o&&(o.error=!0,o.errorText=i.error,o.focus())})},w={CancelCreateUser:"cancel-create-user",CloseDrawer:"close-drawer",CreateContact:"create-contact",CreateNewContact:"create-new-contact",EvacAssistanceRequired:"evac-assistance-required",NextButtonToggle:"next-button-toggle",NextStep:"next-step",ResetSuccess:"reset-success",SetStep:"set-step",ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",ToggleDrawer:"toggle-drawer",UpdateAccounts:"update-accounts",UpdateContact:"update-contact",UpdateDFA:"update-dfa",UpdateFlags:"update-flags",ValidateStep:"validate-step"};let de=class extends I{constructor(){super(...arguments),this.validatingForm=!1,this._newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this._nextButtonEnabled=!1}firstUpdated(){this._newContact=this.newContact,this.validateStep(),this.dispatchValidateStepEvent()}get firstName(){return this.renderRoot.querySelector("#first-name")}get lastName(){return this.renderRoot.querySelector("#last-name")}get email(){return this.renderRoot.querySelector("#email")}get phone(){return this.renderRoot.querySelector("#phone-number")}validateStep(){this._nextButtonEnabled=!(this.isInvalid()||this.isEmpty())}validateInput(e,t){const i=q(e);if(this.updateContactDetails(),e.required&&!Ue(e,i)){this._nextButtonEnabled=!1;return}e.pattern&&!yi(e,i,t)&&(this._nextButtonEnabled=!1),this.validateStep(),this.dispatchNextButtonToggleEvent()}async validateEmailInput(e,t){this._nextButtonEnabled=!1;const i=q(e);if(this.updateContactDetails(),e.required&&!Ue(e,i)){this._nextButtonEnabled=!1;return}if(!bi(e,i,t)){this._nextButtonEnabled=!1;return}clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout(async()=>{const o={emailVerificationInput:{email_address:i!=null?i:""}};try{(await v.VerificationApi.verifyEmail(o)).is_verified?(e.error=!1,e.errorText="",this._nextButtonEnabled=!(this.isInvalid()||this.isEmpty())):(e.error=!0,e.errorText=`${t}`,this._nextButtonEnabled=!1)}catch(n){e.error=!0,e.errorText="An error occurred during email verification. Please try again later.",this._nextButtonEnabled=!1}},500),this.validateStep(),this.dispatchNextButtonToggleEvent()}validatePhoneInput(e,t){const i=be(e);if(vt(e,i),this.updateContactDetails(),e.required&&!Ue(e,i)){this._nextButtonEnabled=!1;return}if(!yt(e,t)){this._nextButtonEnabled=!1;return}this.validateStep(),this.dispatchNextButtonToggleEvent()}updateContactDetails(){var e,t,i,o;this._newContact={firstName:(e=q(this.firstName))!==null&&e!==void 0?e:"",lastName:(t=q(this.lastName))!==null&&t!==void 0?t:"",email:(i=q(this.email))!==null&&i!==void 0?i:"",phone:(o=be(this.phone))!==null&&o!==void 0?o:"",accounts:this._newContact.accounts,evacAssistance:this._newContact.evacAssistance},this.dispatchUpdateContactEvent()}clearTextFields(){this._newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},Ke(this.firstName,""),Ke(this.lastName,""),Ke(this.email,""),this.phone.reset(),vt(this.phone,"")}resetErrorStates(){this.firstName.error=!1,this.lastName.error=!1,this.email.error=!1,this.phone.error=!1}isInvalid(){return this.firstName.error||this.lastName.error||this.email.error||this.phone.error}isEmpty(){return!this._newContact.firstName||!this._newContact.lastName||!this._newContact.email||!this._newContact.phone}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchUpdateContactEvent(){const e=new CustomEvent(w.UpdateContact,{detail:{newContact:this._newContact},bubbles:!0,composed:!0});this.dispatchEvent(e)}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){return l` <div class="input-group"> <ix-textbox required id="first-name" label="First name" name="first-name" type="text" value="${this._newContact.firstName}" @input="${()=>this.validateInput(this.firstName,"Invalid first name")}" pattern="${$e.name}" maxLength="50" data-testid="step-one-first-name"></ix-textbox> <ix-textbox required id="last-name" label="Last name" name="last-name" type="text" value="${this._newContact.lastName}" @input="${()=>this.validateInput(this.lastName,"Invalid last name")}" pattern="${$e.name}" maxLength="50" data-testid="step-one-last-name"></ix-textbox> </div> <div class="input-group"> <ix-textbox required id="email" label="Email Address" name="email" type="email" value="${this._newContact.email}" @input="${()=>this.validateEmailInput(this.email,"Invalid email address")}" data-testid="step-one-email"></ix-textbox> <ix-phone-input required id="phone-number" label="Phone Number" name="phone" value="${this._newContact.phone}" @input="${()=>this.validatePhoneInput(this.phone,"Invalid phone number")}" @country-change="${()=>this.phone.value?this.validatePhoneInput(this.phone,"Invalid phone number"):null}" data-testid="step-one-phone-number"></ix-phone-input> </div> <div style="display:flex;justify-content:flex-end;padding-top:8px"> <ix-button type="submit" ?disabled="${!this._nextButtonEnabled||this.validatingForm}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-one-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> `}};de.styles=[vi,A],s([d({type:Object})],de.prototype,"newContact",void 0),s([d({type:Boolean})],de.prototype,"validatingForm",void 0),s([u()],de.prototype,"_newContact",void 0),s([u()],de.prototype,"_nextButtonEnabled",void 0),de=s([b("create-user-step-one")],de);function bt(e){var t;for(const i of e)if(i.checked||!((t=i.children)===null||t===void 0)&&t.length&&bt(i.children))return!0;return!1}function xi(e){return e.some(t=>t.subaccounts.length)?"nested":"flat"}function xt(e,t){var i,o;if(t==="flat")return e.filter(a=>a.checked);const n=[];for(const a of e){a.checked&&n.push(a);const r=(i=a.children)===null||i===void 0?void 0:i.every(c=>c.checked);if(!((o=a.children)===null||o===void 0)&&o.length&&(a.indeterminate||!r)){const c=xt(a.children,t);n.push(...c)}}return n}let ue=class extends I{constructor(){super(...arguments),this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._accountTree=this.accountTree,this.validateStep(),this.dispatchValidateStepEvent()}renderAccounts(){var e,t;if(!this._accountTree)return x;const i=(t=(e=this._accountTree)===null||e===void 0?void 0:e.children)===null||t===void 0?void 0:t.some(o=>{var n;return(n=o.children)===null||n===void 0?void 0:n.length});return l` <div class="overflow-auto pb-[2px]"> <ix-tree checkboxesEnabled .rootNode="${this._accountTree}" .rollup="${!1}" .disableEndNodePointer="${!0}" .selectNodeOnClick="${!0}" ?removeChevron="${!i}" @on-tree-node-checked="${()=>this.toggleAccountChecked()}" data-testid="step-two-account-tree"></ix-tree> </div> `}validateStep(){!this._accountTree||!this.ixTree||(this._nextButtonEnabled=bt([this._accountTree]))}async toggleAccountChecked(){!this._accountTree||!this.ixTree||(await this.ixTree.updateComplete,this._accountTree=this.ixTree.rootNode,this.dispatchUpdateAccountsEvent(),this.validateStep(),this.dispatchNextButtonToggleEvent())}dispatchUpdateAccountsEvent(){this.dispatchEvent(new CustomEvent(w.UpdateAccounts,{detail:{rootNode:this._accountTree},bubbles:!0,composed:!0}))}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){return l` <div class="flex flex-col overflow-hidden"> ${this.renderAccounts()} <div class="flex justify-end mt-6"> <ix-button type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-two-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};ue.styles=[A,ce],s([d({type:Object})],ue.prototype,"accountTree",void 0),s([u()],ue.prototype,"_accountTree",void 0),s([u()],ue.prototype,"_nextButtonEnabled",void 0),s([U("ix-tree")],ue.prototype,"ixTree",void 0),ue=s([b("create-user-step-two")],ue);const wi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{--ix-chip-container-color:var(--md-sys-color-primary);--md-input-chip-outline-color:var(--md-sys-color-primary);--md-input-chip-label-text-color:white;--md-outlined-field-leading-content-color:black;--md-outlined-field-label-text-color:black}.accounts-roles-container{display:flex;flex-direction:column;margin-bottom:10px;padding-left:2px}.accounts-roles-container>*{padding-bottom:15px}.accounts-roles-container>:not(:first-child){padding-top:20px}.account-roles-name{padding-bottom:10px}.account-roles{display:flex;flex-direction:column;gap:8px;height:100%}ix-button{font-family:var(--root-secondary-font)}`;function re(e,t,i=void 0){const o=ho[e.type]||(e.type==="Port"?"":"chevron_right"),n={id:e.id,label:e.label,children:[],secondaryLabel:e.secondaryLabel,parentId:e.parentId,childrenCount:e.childrenCount,disabled:e.isAssignable===!1,checkedChildrenCount:e.checkedChildrenCount,indeterminate:e.status==="INDETERMINATE",customerKnownSpaceName:e.customerKnownSpaceName,checked:i!=null?i:e.status==="CHECKED",originalCheckedStatus:i!=null?i:e.status==="CHECKED",inherited:e.inherited,icon:o};return t.children.push(n),e.inventoryItems&&e.inventoryItems.forEach(a=>{re(a,n,i?n.checked:void 0)}),t}function wt(e){var t;const i=o=>{o.checked=!1};return e.children&&!((t=e.children)===null||t===void 0)&&t.length&&e.children.forEach(o=>wt(o)),i(e)}const oe=[{key:"ACCOUNTING_CONTACT",text:"Accounting flag",desc:"Authorized to discuss billing issues with DLR Accounts Receivable Group."},{key:"OPERATIONS_CONTACT",text:"Operations flag",desc:"Receives Planned Maintenance, Corrective Maintenance and Project Work notifications. Point of contact for DLR operations team."},{key:"EMERGENCY_CONTACT",text:"Emergency flag",desc:"Receives Incident Notifications. Point of contact during unplanned, emergency maintenance."},{key:"INTERCONNECTION_NOTIFICATIONS",text:"Interconnection Notifications",desc:"Receives notifications about interconnectivity orders."}],At=e=>{var t;return(t=oe.find(i=>i.text===e))===null||t===void 0?void 0:t.key},ma=e=>{var t;return(t=oe.find(i=>i.key===e))===null||t===void 0?void 0:t.text};let K=class extends I{constructor(){super(...arguments),this.checkedAccounts=[],this.roles=[],this.dataForAccounts=[],this.treeData=[],this._dataForAccounts=[],this._treeData=[],this._nextButtonEnabled=!1,this.multiSelectOpen=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._treeData=this.treeData,this.validateStep(),this.dispatchValidateStepEvent()}getRoles(e){return this.roles.filter(t=>t.accountId===e)[0].roles}getRolesData(e){const t=this.roles.filter(o=>o.accountId===e)[0],i=[];return t.roles.forEach(o=>{var n;o.removed=!0;const a={id:"root",label:"",children:[],customerKnownSpaceName:""},r=(n=this._treeData.find(p=>p.accountNumber===e))===null||n===void 0?void 0:n.data;r&&r.length&&re(r[0],a);const c={accountId:e,role:o,locations:[],genericTreeView:a};i.push(c)}),i}getFlagsData(e){const t=[];return oe.forEach(i=>{const o={accountId:e,flag:i,locations:[],genericFlagsData:[]};t.push(o)}),t}renderMultiSelectRoles(){this._dataForAccounts.length===0&&(this._dataForAccounts=this.checkedAccounts.map(t=>({accountId:t.id,accountName:t.label,rolesData:this.getRolesData(t.id),flagsData:this.getFlagsData(t.id),flagData:[],active:!1})));const e={};return this._dataForAccounts.forEach(t=>{e[t.accountId]=t.rolesData.filter(i=>i.role.removed===!0).map(i=>i.role.name)}),this._dataForAccounts.map(t=>{const i=[...new Set(this.getRoles(t.accountId).map(o=>o.name))].map(o=>({label:o,selected:!e[t.accountId].includes(o)}));return l` <div> <div class="account-roles-name">${t.accountName}</div> <ix-multi-select data-testid="multi-select-roles-${t.accountId}" required id="${`${t.accountId}-multi-select`}" style="max-width:99%" class="multi-select" .menuPositioning="${"popover"}" .items="${i}" .label="${"Roles"}" @toggle-multi-select-item="${o=>this.handleMultiSelect(t.accountId,o.detail.label,o.detail.selected)}" @remove-multi-select-item="${o=>this.handleMultiSelect(t.accountId,o.detail,!1)}" @clear-multi-select="${()=>this.handleMultiSelectClear(t.accountId)}" @select-menu="${o=>this.handleSelectMenu(o)}"></ix-multi-select> </div> `})}handleSelectMenu(e){e.detail.value==="open"?this.multiSelectOpen=!0:this.multiSelectOpen=!1}handleMultiSelect(e,t,i){var o,n,a;const[r]=this._dataForAccounts.filter(h=>h.accountId===e),c=this.getRoles(r.accountId).find(h=>h.name===t);if(!c)return;const p=r.rolesData.findIndex(h=>h.role.id===c.id);if(c.permissions.every(h=>h.isNonLocation)){const h=(o=r.rolesData[p])===null||o===void 0?void 0:o.genericTreeView;if(!((n=h==null?void 0:h.children)===null||n===void 0)&&n.length){const L=h.children[0];L.checked=!0,me(L,h),r.rolesData[p].locations.push(L)}}const g=r.rolesData.findIndex(h=>h.role.id===(c==null?void 0:c.id));if(r.rolesData[g].role.removed=!(i&&g>=0),!i){const h={id:"root",label:"",children:[],customerKnownSpaceName:""},L=(a=this._treeData.find(Xi=>Xi.accountNumber===e))===null||a===void 0?void 0:a.data;L&&L.length&&re(L[0],h),r.rolesData[g].locations=[],r.rolesData[g].genericTreeView=h}this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}validateStep(){const e=this._dataForAccounts.every(i=>i.rolesData.filter(o=>o.role.removed===!1).length),t=this._dataForAccounts.length===this.checkedAccounts.length;this._nextButtonEnabled=e&&t}handleMultiSelectClear(e){const t=this._dataForAccounts.filter(i=>i.accountId===e)[0];this._dataForAccounts.find(i=>i.accountId===e).rolesData=this.getRolesData(t.accountId),this._nextButtonEnabled=!1,this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}dispatchUpdateDFAEvent(){const e=new CustomEvent(w.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(e)}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){const e=this.multiSelectOpen?"overflow-hidden":"overflow-auto";return l` <div class="wizard-step-content flex flex-col overflow-hidden"> <div class="p-1 dlr-text-default ${e}">${this.renderMultiSelectRoles()}</div> <div class="flex justify-end" style="padding-top:8px"> <ix-button class="pt-2" type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-three-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};K.styles=[wi,A,_e],s([d({type:Array})],K.prototype,"checkedAccounts",void 0),s([d({type:Array})],K.prototype,"roles",void 0),s([d({type:Array})],K.prototype,"dataForAccounts",void 0),s([d({type:Array})],K.prototype,"treeData",void 0),s([u()],K.prototype,"_dataForAccounts",void 0),s([u()],K.prototype,"_treeData",void 0),s([u()],K.prototype,"_nextButtonEnabled",void 0),s([u()],K.prototype,"multiSelectOpen",void 0),K=s([b("create-user-step-three")],K);const Je=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.permission-container{padding:1rem 1.5rem 0 1.5rem}ix-icon-button{--md-sys-color-on-surface-variant:black}.permission-dialog-container{padding:1rem 1rem 0 1rem;width:500px}.permission-container-row{display:block;padding:8px;margin-top:12px;margin-bottom:12px;box-shadow:#e1e4e8 0 0 0 1px inset;border-radius:8px}.permission-container-item{display:flex;flex-direction:row;width:100%}.permission-arrow{width:30px;cursor:pointer}.permission-name{line-height:24px;color:#092241}.permission-item{display:grid;grid-template-columns:1fr 20%;gap:16px;-webkit-box-align:center;align-items:center;-webkit-box-flex:1;flex-grow:1;padding-top:5px}.permission-item-privilege{margin:0;color:#333}.permission-container-row-create-user{display:flex;padding:12px;margin-top:10px;margin-bottom:10px;height:24px;width:475px;box-shadow:#e1e4e8 0 0 0 1px inset;border-radius:8px}.non-location{margin:10px 5px 5px 5px;background-color:#f5f7ff;padding:8px;border-radius:5px}.non-location-icon{padding-left:8px}.permissions-dialog-container{max-height:70vh;overflow-x:auto}`;class H{}H.ROW=e=>`permission-group-row-${e}`,H.CATEGORY=e=>`permission-group-category-${e}`,H.OVERALL_PERM=e=>`permission-group-overall-${e}`,H.BTN_EXPAND=e=>`permission-group-btn-expand-${e}`,H.PERM_NAME=e=>`permission-group-name-${e}`,H.PERM_PRIVILEGE=e=>`permission-group-privilege-${e}`;let Ne=class extends I{constructor(){super(...arguments),this.permissionGroup=void 0,this.isOpen=!1}onClick(){this.isOpen=!this.isOpen,this.requestUpdate()}renderPermissionItemRow(e,t){return l` <div class="flex justify-between pl-11 items-center permission-item"> <p data-testid="${H.PERM_NAME(e)}">${e}</p> <p class="capitalize permission-item-privilege pr-4" data-testid="${H.PERM_PRIVILEGE(e)}"> <small>${t}</small> </p> </div> `}renderPermissionItems(e){return this.isOpen?l`<div class="permission-items-container"> ${e.filter(t=>!t.isNonLocation).map(t=>this.renderPermissionItemRow(t.name,t.privilege))} </div>`:x}render(){var e,t,i,o,n,a,r,c,p,g,h,L;return l`<div class="permission-container-row" data-testid="${H.ROW((t=(e=this.permissionGroup)===null||e===void 0?void 0:e.category)!==null&&t!==void 0?t:"")}"> <div class="flex items-center justify-between"> <div class="flex items-center"> <ix-icon-button icon="${this.isOpen?"arrow_drop_down":"arrow_right"}" @click="${this.onClick}" data-testid="${H.BTN_EXPAND((o=(i=this.permissionGroup)===null||i===void 0?void 0:i.category)!==null&&o!==void 0?o:"")}"> </ix-icon-button> <p class="m-0 permission-name permission-item-name pl-1" id="permission-item-name" data-testid="${H.CATEGORY((a=(n=this.permissionGroup)===null||n===void 0?void 0:n.category)!==null&&a!==void 0?a:"")}"> ${(r=this.permissionGroup)===null||r===void 0?void 0:r.category} </p> </div> <p class="m-0 pl-4 capitalize permission-overall-privilege mr-4" data-testid="${H.OVERALL_PERM((p=(c=this.permissionGroup)===null||c===void 0?void 0:c.category)!==null&&p!==void 0?p:"")}"> <small>${(g=this.permissionGroup)===null||g===void 0?void 0:g.overallPrivilege}</small> </p> </div> ${this.renderPermissionItems((L=(h=this.permissionGroup)===null||h===void 0?void 0:h.items)!==null&&L!==void 0?L:[])} </div>`}};Ne.styles=[Je,A],s([d({type:Object,attribute:!1})],Ne.prototype,"permissionGroup",void 0),s([u()],Ne.prototype,"isOpen",void 0),Ne=s([b("permission-group")],Ne);class xe{}xe.ROW=e=>`non-location-permission-row-${e}`,xe.NAME=e=>`non-location-permission-item-${e}`,xe.PRIVILEGE=e=>`non-location-permission-privilege-${e}`;let Ze=class extends I{constructor(){super(...arguments),this.permission=void 0}render(){var e,t,i,o,n,a,r,c;return l`<div class="permission-container-row" data-testid="${xe.ROW((t=(e=this.permission)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"")}"> <div class="flex items-center justify-between"> <div class="flex items-center"> <p class="m-0 permission-name permission-item-name pl-1" data-testid="${xe.NAME((o=(i=this.permission)===null||i===void 0?void 0:i.name)!==null&&o!==void 0?o:"")}"> ${(n=this.permission)===null||n===void 0?void 0:n.name} </p> </div> <p class="m-0 pl-4 capitalize permission-overall-privilege mr-4" data-testid="${xe.PRIVILEGE((r=(a=this.permission)===null||a===void 0?void 0:a.name)!==null&&r!==void 0?r:"")}"> <small>${(c=this.permission)===null||c===void 0?void 0:c.privilege}</small> </p> </div> <div class="permission-items-container"> <div class="flex pl-13 items-center permission-item non-location"> <span class="non-location-icon"><md-icon slot="icon">info</md-icon></span> <p class="text-left dlr-text-caption"> You don't need to select location or assets for this permission </p> </div> </div> </div>`}};Ze.styles=[Je,A],s([d({type:Object,attribute:!1})],Ze.prototype,"permission",void 0),Ze=s([b("non-location-permission")],Ze);let We=class extends I{constructor(){super(...arguments),this.permission=void 0}render(){var e,t;return l` <div class="permission-container-row"> <div class="flex items-center justify-between"> <div class="flex items-center"> <p class="m-0 permission-name pl-1">${(e=this.permission)===null||e===void 0?void 0:e.name}</p> </div> <p class="m-0 pl-4 capitalize permission-overall-privilege mr-4"> <small>${(t=this.permission)===null||t===void 0?void 0:t.privilege}</small> </p> </div> </div> `}};We.styles=[Je,A],s([d({type:Object,attribute:!1})],We.prototype,"permission",void 0),We=s([b("non-category-permission")],We);const ga={AMER:"North America"},Ct={Global:0,Continent:1,Country:2,City:3,Site:4,Floor:5,Room:6,Cage:7,Row:8,Cabinet:9},Tt=e=>{var t,i;const o=Ct[e.type];return o===Ct.Continent&&e.label?(t=ga[e.label])!==null&&t!==void 0?t:e.label:e.label&&o>Ct.Site&&/^[0-9]{1,3}$/.test(e.label)?`${e.type} ${e.label}`:(i=e.label)!==null&&i!==void 0?i:void 0},va=e=>({id:e.id,accountNumber:e.accountNumber,roleId:e.roleId,parentId:e.parentInventoryId,customerKnownSpaceName:e.customerKnownSpaceName,type:e.type,label:Tt(e),isAssignable:e.isAssignable,secondaryLabel:e.secondaryLabel,childrenCount:e.childrenCount,inventoryItems:Qe(e.inventoryItems),selected:e.selected,searched:e.searched,status:e.permissionStatus,inherited:e.inherited}),Qe=e=>{const t=[];return e==null||e.forEach(i=>{t.push(va(i))}),t},fa=e=>{var t,i,o,n,a,r,c,p;return{contactId:e.id,accountId:e.accountNumber,roleId:e.roleId,isInternal:e.isInternal,startInventoryId:e.location,searchLocationText:(t=e.searchLocationText)!==null&&t!==void 0?t:"",level1:!0,level2:!0,level3:(i=e.allChildren)!==null&&i!==void 0?i:!1,level4:(o=e.allChildren)!==null&&o!==void 0?o:!1,level5:(n=e.allChildren)!==null&&n!==void 0?n:!1,level6:(a=e.allChildren)!==null&&a!==void 0?a:!1,level7:(r=e.allChildren)!==null&&r!==void 0?r:!1,level8:(c=e.allChildren)!==null&&c!==void 0?c:!1,level9:(p=e.allChildren)!==null&&p!==void 0?p:!1}},ya=e=>({contactId:e.id,accountId:e.accountNumber,flag:e.flag,isInternal:e.isInternal,startInventoryId:e.location,level1:!0,level2:!0,level3:!0,level4:!0,level5:!0,level6:!0,level7:!0,level8:!0,level9:!0}),ba=e=>{var t,i,o,n,a,r,c;return{accountId:e.accountNumber,isInternal:e.isInternal,level1:!0,level2:!0,level3:(t=e.allChildren)!==null&&t!==void 0?t:!1,level4:(i=e.allChildren)!==null&&i!==void 0?i:!1,level5:(o=e.allChildren)!==null&&o!==void 0?o:!1,level6:(n=e.allChildren)!==null&&n!==void 0?n:!1,level7:(a=e.allChildren)!==null&&a!==void 0?a:!1,level8:(r=e.allChildren)!==null&&r!==void 0?r:!1,level9:(c=e.allChildren)!==null&&c!==void 0?c:!1}},xa=e=>({id:e.id,accountNumber:e.accountNumber,flag:e.flag,parentId:e.parentInventoryId,customerKnownSpaceName:e.customerKnownSpaceName,type:e.type,isAssignable:e.isAssignable,label:Tt(e),secondaryLabel:e.secondaryLabel,childrenCount:e.childrenCount,checkedChildrenCount:e.checkedChildrenCount,inventoryItems:Ai(e.inventoryItems),selected:e.selected,searched:!1,status:e.permissionStatus,inherited:e.inherited}),Ai=e=>{const t=[];return e==null||e.forEach(i=>{t.push(xa(i))}),t},Ci=e=>{const t=[];return e==null||e.forEach(i=>{t.push(wa(i))}),t},wa=e=>({id:e.id,accountNumber:e.accountNumber,parentId:e.parentInventoryId,customerKnownSpaceName:e.customerKnownSpaceName,type:e.type,isAssignable:e.isAssignable,label:Tt(e),secondaryLabel:e.secondaryLabel,childrenCount:e.childrenCount,inventoryItems:Ci(e.inventoryItems)}),Ti=e=>{const t=[];return e==null||e.forEach(i=>{t.push({id:i.id,customerKnownName:i.customerKnownName,permissionStatus:i.permissionStatus})}),t},Aa=e=>({roleId:e.roleId,roleLocations:Ti(e.locations)}),Ca=e=>{const t=[];return e==null||e.forEach(i=>{t.push(Aa(i))}),t},Ta=e=>({contactId:e.contactId,accountNumber:e.accountNumber,locations:Ca(e.roleLocations),isInternal:e.isInternal}),Ia=e=>({flag:At(e.flag),flagLocations:Ti(e.locations)}),_a=e=>{const t=[];return e==null||e.forEach(i=>{t.push(Ia(i))}),t},ka=e=>({contactId:e.contactId,accountNumber:e.accountNumber,locations:_a(e.flagLocations),isInternal:e.isInternal});class Ea{async getRoleInventory(t){try{const i=fa(t),o=await v.InventoryApi.GetRolesInventory(i);return o!=null&&o.getRoleTree?Qe([o.getRoleTree]):[]}catch(i){return m.handleError(i,"Failed to load the portal access tree."),[]}}async getFlagInventory(t){try{const i=ya(t),o=await v.InventoryApi.GetFlagsInventory(i);return o!=null&&o.getFlagTree?Ai([o==null?void 0:o.getFlagTree]):[]}catch(i){return m.handleError(i,"Failed to load the portal access tree."),[]}}async getAccountInventory(t){try{const i=ba(t),o=await v.InventoryApi.GetAccountInventory(i);return o!=null&&o.getAccountTree?Ci([o==null?void 0:o.getAccountTree]):[]}catch(i){return m.handleError(i,"Failed to get account inventory."),[]}}async saveAccountRoleInventory(t){try{const i=Ta(t),o=await v.InventoryApi.SaveAccountRoleAssignments(i);return Qe(o==null?void 0:o.saveAccountRoleAssignments)}catch(i){return null}}async saveAccountFlagInventory(t){try{const i=ka(t),o=await v.InventoryApi.SaveAccountFlagAssignments(i);return Qe(o==null?void 0:o.saveAccountUserFlagAssignments)}catch(i){return null}}}const Fe=new Ea,Ra=e=>({role_id:e.roleId,user_id:e.contactId,account_number:e.accountNumber,location_id:e.location}),Ii=e=>({roleId:e.role_id,contactId:e.user_id,accountNumber:e.account_number,location:e.location_id,id:e.id,isActive:e.is_active}),Sa=e=>{const t=[];return e.forEach(i=>t.push(Ra(i))),t},_i=e=>{const t=[];return e.forEach(i=>t.push(Ii(i))),t},$a=e=>({userId:e.contactId,roleId:e.roleId,accountNumber:e.accountNumber,roleType:e.roleType}),Ua=e=>({id:e.id}),Na=e=>({createRoleAssignment:{RoleAssignmentInput:Sa(e.roleAssignmentInput)}}),Fa=e=>({id:e.id});class Da{async get(t){try{const i=$a(t),o=await v.RoleAssignmentsApi.getRoleAssignments(i);return _i(o)}catch(i){return m.handleError(i,"Failed to get role assignments."),[]}}async getById(t){try{const i=Ua(t),o=await v.RoleAssignmentsApi.getRoleAssignment(i);return Ii(o)}catch(i){return m.handleError(i,"Failed to get role assignment"),{}}}async create(t){try{const i=Na(t),o=await v.RoleAssignmentsApi.createRoleAssignments(i);return _i(o)}catch(i){return m.handleError(i,"Failed to create role assignment."),[]}}async delete(t){try{const i=Fa(t);return v.RoleAssignmentsApi.deleteRoleAssignment(i)}catch(i){return m.handleError(i,"Failed to delete role assignment.")}}}const De=new Da,Pa=async e=>{for(const t of e)await Promise.all(t.map(i=>i))},we=async e=>{const t=[];for(const i of e){const o=await Promise.all(i.map(n=>n));t.push(o)}return t},Ma=e=>({user_flag_type:e.userFlagType,user_id:e.contactId,account_number:e.accountNumber,location_id:e.location}),ki=e=>({userFlagType:e.user_flag_type,contactId:e.user_id,accountNumber:e.account_number,location:e.location_id,id:e.id}),Ba=e=>{const t=[];return e.forEach(i=>t.push(Ma(i))),t},Ei=e=>{const t=[];return e.forEach(i=>t.push(ki(i))),t},La=e=>({userId:e.contactId,accountNumber:e.accountNumber,userFlagType:e.userFlagType,locationId:e.location}),Oa=e=>({id:e.id}),za=e=>({createUserFlagAssignment:{UserFlagAssignmentInputs:Ba(e.userFlagAssignmentInput)}}),qa=e=>({id:e.id});class Ha{async get(t){try{const i=La(t),o=await v.UserFlagsApi.getUserFlags(i);return Ei(o)}catch(i){return m.handleError(i,"Failed to get assigned user flags."),[]}}async getById(t){try{const i=Oa(t),o=await v.UserFlagsApi.getUserFlag(i);return ki(o)}catch(i){return m.handleError(i,"Failed to get user flag assignment."),{}}}async create(t){try{const i=za(t),o=await v.UserFlagsApi.createUserFlags(i);return Ei(o)}catch(i){return m.handleError(i,"Failed to create user flag assignment."),[]}}async delete(t){try{const i=qa(t);return v.UserFlagsApi.deleteUserFlag(i)}catch(i){return m.handleError(i,"Failed to delete user flag assignment.")}}}const Pe=new Ha;class Va{constructor(){this.deleteAssignmentsAndFlags=async(t,i)=>{const o=[],n=[],a=[];try{return t.forEach(r=>{o.push(De.delete({id:r}))}),i.forEach(r=>{n.push(Pe.delete({id:r}))}),o.length>0&&a.push(o),n.length>0&&a.push(n),Pa(a)}catch(r){return m.handleError(r,"Failed to delete batch of role assignments and flags.")}},this.createAssignmentsAndFlags=async(t,i)=>{const o=[];try{if(t.length>0){const n=[De.create({roleAssignmentInput:t})];o.push(n)}if(i.length>0){const n=[Pe.create({userFlagAssignmentInput:i})];o.push(n)}return[...await we(o)]}catch(n){return m.handleError(n,"Failed to create batch of role assignments and flags."),[]}},this.upsertAssignmentAndFlags=async(t,i,o,n,a)=>{try{(t.length>0||i.length)&&await this.deleteAssignmentsAndFlags(t,i),(o.length>0||n.length)&&await this.createAssignmentsAndFlags(o.map(r=>({...r,isInternal:a})),n)}catch(r){m.handleError(r,"Failed to upsert role assignments and flags.")}},this.getAssignmentInventory=async(t,i,o,n)=>{const a=[],r=[];try{return o.forEach(c=>{r.push(Fe.getRoleInventory({id:t,accountNumber:i,roleId:c,location:"",isInternal:n,allChildren:!0}))}),a.push(r),[...(await we(a))[0]].flat()}catch(c){return m.handleError(c,"Failed to get inventory assignments."),[]}},this.getFlagInventory=async(t,i,o)=>{const n=[],a=[];try{return oe.forEach(r=>{a.push(Fe.getFlagInventory({id:t,flag:r.key,accountNumber:i,location:"",allChildren:!1,isInternal:o}))}),n.push(a),[...(await we(n))[0]].flat()}catch(r){return m.handleError(r,"Failed to get inventory flags."),[]}}}}const Ri=new Va;async function ja(e,t,i,o,n,a,r){const c={id:t,roleId:e,accountNumber:i,location:o,searchLocationText:n,allChildren:a,isInternal:r};return await Fe.getRoleInventory(c)}async function Si(e,t,i,o){const n=await Ri.getAssignmentInventory(t,i,e,o),a={id:"root",label:"",children:[],customerKnownSpaceName:""},r=[];for(const c of n){const p=re(c,structuredClone(a));r.push({role:c.roleId,rootNode:p,isOpen:!1})}return r}async function Ga(e,t,i){const o=await Ri.getFlagInventory(e,t,i),n={id:"root",label:"",children:[],customerKnownSpaceName:""},a=[];for(const r of o){const c=re(r,structuredClone(n));a.push({label:ma(r.flag),rootNode:c,isOpen:!1})}return a}const It=e=>{const t=[];return e?(e.forEach(i=>{const o=t.findIndex(r=>r.category===i.category),n={id:i.permissionId,name:i.permissionName,privilege:i.privilege,isNonLocation:i.isNonLocation};if(o===-1)return t.push({category:i.category||"Misc.",overallPrivilege:i.privilege,items:[n]});const a=r=>new Set(r.map(c=>c.privilege)).size===1?r[0].privilege:"MIXED";t[o].items.push(n),t[o].overallPrivilege=a(t[o].items)}),ra(t,"category",!0)):t},Ka=async(e,t,i,o)=>{const n=await Si(e,t,i,o),a=await Ga(t,i,o);return[n,a]},V={Default:"DEFAULT",Internal:"INTERNAL",Custom:"CUSTOM",GlobalAccess:"GLOBALACCESS"};Object.values(V);const Ja=e=>({permissionId:e.permission_id,isNonLocation:e.is_non_location,privilege:e.privilege}),_t=e=>{const t=[];return e.permissions.forEach(i=>t.push(Ja(i))),{name:e.name,accountNumber:e.account_number,roleType:e.role_type,permissions:t,removed:!1,id:e.id}},$i=e=>{const t=[];return e.forEach(i=>{t.push(_t(i))}),t},Za=e=>({permission_id:e.permissionId,privilege:e.privilege}),Ui=e=>{const t=[];return e.forEach(i=>{t.push(Za(i))}),t},Wa=e=>({role_name:e.name,permissions:Ui(e.permissions)}),Qa=e=>{const t={name:e.name,role_type:e.roleType,permissions:Ui(e.permissions)};switch(e.roleType){case V.Internal:case V.Default:case V.GlobalAccess:return t;case V.Custom:{if(!e.accountNumber)throw new Error("Account number is required for custom roles.");return{...t,account_number:e.accountNumber}}default:throw new Error(`Unknown role type; ${e.roleType} provided`)}},Ya=e=>({roleType:e.roleType}),Xa=e=>({id:e.id}),es=e=>({roleCreate:Qa(e.roleCreate)}),ts=e=>({id:e.id,roleUpdate:Wa(e.roleUpdate)}),is=e=>({id:e.id});class os{async get(t){try{let i;if(!(t!=null&&t.roleType)){const a=await v.RolesApi.getRoles();return i=$i(a),i}const o=Ya(t),n=await v.RolesApi.getRoles(o);return i=$i(n),i}catch(i){return m.handleError(i,"Failed to get roles."),[]}}async getById(t){try{const i=Xa(t),o=await v.RolesApi.getRole(i);return _t(o)}catch(i){return m.handleError(i,"Failed to get role."),{}}}async update(t){try{const i=ts(t);return v.RolesApi.updateRole(i)}catch(i){return m.handleError(i,"Failed to update role.")}}async create(t){try{const i=es(t),o=await v.RolesApi.createRole(i);return _t(o)}catch(i){return m.handleError(i,`Failed to create the role '${t.roleCreate.name}'.`),{}}}async delete(t){try{const i=is(t);return v.RolesApi.deleteRole(i)}catch(i){return m.handleError(i,"Failed to delete role.")}}}const kt=new os,Et=e=>({id:e.id,accountNumber:e.account_number,accountName:e.account_name,displayName:e.account_friendly_name,status:e.status,updatedAt:e.updated_at,updatedBy:e.updated_by,userId:e.user_id}),ns=e=>{const t=[];return e.forEach(i=>{t.push(Et(i))}),t},as=e=>({user_id:e.contactId,account_number:e.accountNumber}),ss=e=>({accountNumber:e.accountNumber,userId:e.contactId,status:e.status}),rs=e=>({accountAssociationInput:as(e.accountAssociationInput)}),ls=e=>({id:e.id}),cs=e=>({id:e.id,accountAssociationStatusUpdate:e.accountAssociationStatusUpdate});class ds{async create(t){try{const i=rs(t),o=await v.AccountAssociationApi.createAccountAssociation(i);return Et(o)}catch(i){return m.handleError(i,"Failed to create account association."),null}}async get(t){try{const i=ss(t),o=await v.AccountAssociationApi.getAccountAssociations(i);return ns(o)}catch(i){return m.handleError(i,"Failed to get associated accounts."),[]}}async getById(t){try{const i=ls(t),o=await v.AccountAssociationApi.getUserAccountAssociation(i);return Et(o)}catch(i){return m.handleError(i,"Failed to get account association"),{}}}async update(t){try{const i=cs(t);await v.AccountAssociationApi.updateAccountAssociationStatus(i)}catch(i){m.handleError(i,"Failed to update account association status.")}}}const Ni=new ds;class us{constructor(){this.getRoles=async t=>{try{let i=[];return t?i=await kt.get({roleType:t}):i=await kt.get({}),[...new Map(i.map(o=>[o.id,o])).values()]}catch(i){return m.handleError(i,"Failed to get all roles."),[]}},this.getRolesAndPermissions=async t=>{const i=await Promise.allSettled([Ve.get(),this.getRoles(t)]);i.forEach(r=>{if(r.status==="rejected")throw new Error});const o=[i[0].value,i[1].value],[n,a]=o;try{return a.forEach(r=>{r.permissions.forEach(c=>{const p=n.find(g=>g.id===c.permissionId);p&&(c.permissionName=p.name,c.category=p.category)})}),a}catch(r){return m.handleError(r,"Failed to get roles with permissions."),[]}},this.getUserData=async(t,i)=>{const o=[];try{const n=[De.get({contactId:t}),Pe.get({contactId:t,accountNumber:i}),Ni.get({contactId:t,accountNumber:i})];return o.push(n),[...(await we(o))[0]]}catch(n){return m.handleError(n,"Failed to get user data."),[]}},this.getState=async()=>{const t=[];try{const i=[Ve.getMyPermissions({excludeParents:!1,excludeSiblings:!0}),Ve.get(),this.getRolesAndPermissions(),di.get()];return t.push(i),[...(await we(t))[0]]}catch(i){return m.handleError(i,"Failed to get user state."),[]}},this.getAccountData=async t=>{const i=[],o=[];try{for(const n of t)o.push(Fe.getAccountInventory({accountNumber:n,allChildren:!0}));return i.push(o),[...(await we(i))[0]]}catch(n){return m.handleError(n,"Failed to get account data."),[]}}}}const Ye=new us;class Ae{constructor(t){this._state=t,this._hydrating=!1,oo(this)}get(){return this.state}set(t){this._state=t}update(t){this._state={...this.get(),...t}}clear(){this.isObject(this._state)&&(this._state={}),this.isArray(this._state)&&(this._state=[])}isHydrating(){return this.hydrating}requestHydration(){this._hydrating=!0}completeHydration(){this._hydrating=!1}get state(){return ke(this._state)}get hydrating(){return this._hydrating}isArray(t){return Array.isArray(t)}isObject(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}}s([qt],Ae.prototype,"_state",void 0),s([qt],Ae.prototype,"_hydrating",void 0);class ps extends Ae{async refresh(){this.requestHydration();const t=await Ye.getRolesAndPermissions();this.set(t),this.completeHydration()}}const pe=new ps([]);let Ce=class extends I{constructor(){super(...arguments),this.inPermissionsDialog=!1,this.permissionData=[]}updated(e){e.has("activeRoleId")&&this.hydratePermissions()}hydratePermissions(){const e=pe.get().find(t=>t.id===this.activeRoleId);e!=null&&e.permissions&&(this.permissionData=It(e.permissions))}render(){const e=this.permissionData.filter(o=>o.category!=="Misc.").flatMap(o=>o.items).filter(o=>o.isNonLocation),t=structuredClone(this.permissionData).filter(o=>o.category!=="Misc.").filter(o=>o.items.some(n=>!n.isNonLocation)).map(o=>({...o,items:o.items.filter(n=>!n.isNonLocation)})),i=this.permissionData.filter(o=>!o.category||o.category==="Misc.").flatMap(o=>o.items);return l` <div data-testid="permissions-container" class="${this.inPermissionsDialog?"permissions-dialog-container":""}"> ${this.inPermissionsDialog?x:l`<h3 class="dlr-text-heading">Permissions</h3>`} ${lt(e,o=>o.id,o=>l` <non-location-permission .permission="${o}"></non-location-permission> `)} ${lt(t,o=>o.items,o=>l` <permission-group .permissionGroup="${o}"></permission-group> `)} ${lt(i,o=>o.id,o=>l` <non-category-permission .permission="${o}"></non-category-permission> `)} </div> `}};Ce.styles=[Je,A],s([d()],Ce.prototype,"activeRoleId",void 0),s([d({type:Boolean})],Ce.prototype,"inPermissionsDialog",void 0),s([u()],Ce.prototype,"permissionData",void 0),Ce=s([b("user-details-permission")],Ce);const Xe=E`@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v145/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}.flex{display:flex}.flex-1{flex:1}.border-top-solid-gray{border-top:solid 1px #ddd}.red{background-color:#db0028}.blue{background-color:#1456e0}.white{background-color:#fff;color:#1456e0;border:solid 1px #1456e0}.right{float:right}.margin-top-20{margin-top:20px}.padding-2{padding:2px}.padding-20{padding:20px}.padding-right-10{padding:10px}`,et=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{--md-sys-color-on-surface-variant:rgba(9, 34, 65, 0.7);--md-primary-tab-hover-label-text-color:#1456e0}.remove{background-color:#fff;color:#db0028;border:1px solid #db0028}.remove-disabled{background-color:#fff;color:rgba(0,0,0,.26);border:1px solid rgba(0,0,0,.26)}.remove-role-container{padding:1rem 0 0 1rem}ix-textbox,md-textfield{--md-outlined-text-field-width:100%;--md-outlined-text-field-focus-width:100%;width:inherit}.option{display:block;width:100%}.option-disabled{display:block;width:100%;color:#ddd}.check_circle{color:#4caf50}.mail{color:#ff9800}.warning{color:#db0028}.delete_forever{color:#6d758c}.active-icon-section{display:flex;align-items:center;padding-right:16px}.panel-status{display:flex;-webkit-box-align:center;align-items:center;gap:4px;padding-right:8px}.panel-button-container{display:flex;flex-direction:row;column-gap:12px}.suspend-button{padding:8.5px 20px}.account-status-suspend{width:100px;padding-left:2px}.btn-disabled{color:rgba(0,0,0,.26);box-shadow:none;background-color:rgba(0,0,0,.12)}.confirmation-content{flex:1 1 auto;padding-right:24px;padding-bottom:20px;padding-left:24px;overflow:hidden;padding-top:8px!important}.role-add-icon{vertical-align:text-bottom;padding-right:5px}.role-add-text{vertical-align:text-top;text-transform:uppercase}.confirmation-content{max-width:550px}.add-roles-dialog-actions{display:flex;justify-content:flex-end;padding:24px 15px 8px 20px}.user-detail-navigation{border-top:1.5px solid #bec9c8;position:relative;top:-1px}.flag-text{text-align:right;margin-right:1.5rem}#flag-text-link{color:#1456e0}.mobile-options{display:none}.email{text-decoration:underline}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.user-details-controls>ix-button{display:none}div>.user-details-controls{padding-right:0}.mobile-options{display:flex;align-items:center;color:var(--md-sys-color-primary,#1456e0);font-size:24px}ix-menu-item{min-width:200px}h1{margin-bottom:.75rem}.tree-view{overflow-x:auto;overflow-y:hidden;max-width:100%}.flag-text{text-align:center;margin-right:0}.user-details-panel{margin:0 -.5rem;overflow:hidden}}@media only screen and (min-width:601px) and (max-width:1200px){.tree-view{overflow-x:auto;overflow-y:hidden;max-width:100%}}@media only screen and (max-width:1200px){.flex.user-status{flex-direction:column;align-items:flex-start}.user-status-header{width:100%;justify-content:space-between;padding-bottom:12px}}`;class tt{}tt.BTN_CANCEL=e=>`changes-dialog-${e}-btn-cancel`,tt.BTN_CONFIRM=e=>`changes-dialog-${e}-btn-confirm`;let ne=class extends I{constructor(){super(...arguments),this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.headerText="",this.bodyText="",this.cancelButtonText="Cancel",this.confirmationButtonText="Confirm",this.isOpen=!1,this.submitting=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding)}handleEscapeKey(e){return e.which===27&&this.handleCancelChanges(),null}handleConfirmChanges(){this.dispatchEvent(new CustomEvent("confirm"))}handleCancelChanges(){this.dispatchEvent(new CustomEvent("cancel"))}renderHeader(){return this.headerText.length?l`<div slot="headline"> <h1 class="dlr-text-heading">${this.headerText}</h1> </div>`:x}renderContent(){return this.bodyText?l`<div class="confirmation-content" slot="content" method="dialog"> <p>${this.bodyText}</p> </div>`:x}renderFooter(){return l` <div class="dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="${this.cancelButtonText}" ?disabled="${this.submitting}" @click="${()=>this.handleCancelChanges()}" data-testid="${tt.BTN_CANCEL(this.id)}"> ${this.cancelButtonText} </ix-button> <ix-button id="add-account-button" form="confirm-updates" appearance="text" text="${this.confirmationButtonText}" ?submitting="${this.submitting}" @click="${()=>this.handleConfirmChanges()}" data-testid="${tt.BTN_CONFIRM(this.id)}"> ${this.confirmationButtonText} </ix-button> </div> `}render(){return l`<ix-dialog class="z-50 relative" id="add-role-to-account" ?open="${this.isOpen}" @closed="${()=>this.handleCancelChanges()}"> ${this.renderHeader()} ${this.renderContent()} ${this.renderFooter()} </ix-dialog>`}};ne.styles=[Xe,et,A],s([d({type:String})],ne.prototype,"headerText",void 0),s([d({type:String})],ne.prototype,"bodyText",void 0),s([d({type:String})],ne.prototype,"cancelButtonText",void 0),s([d({type:String})],ne.prototype,"confirmationButtonText",void 0),s([d({type:Boolean,reflect:!0})],ne.prototype,"isOpen",void 0),s([d({type:Boolean})],ne.prototype,"submitting",void 0),ne=s([b("changes-confirmation")],ne);const hs=E`
|
|
1986
1990
|
.tab-container {
|
|
1987
1991
|
container-type: inline-size;
|
|
1988
1992
|
}
|
|
@@ -1998,4 +2002,4 @@ video {
|
|
|
1998
2002
|
width: 100%;
|
|
1999
2003
|
}
|
|
2000
2004
|
}
|
|
2001
|
-
`;class tt{}tt.BTN_ADD_ROLE="user-details-tab-roles-btn-add-role",tt.BTN_REMOVE_ROLE="user-details-tab-roles-btn-remove-role";const Tt={RoleSelect:"role-select",OpenRoleMenu:"open-role-menu",RemoveRoleMenu:"open-remove-role-menu"};let Q=class extends I{constructor(){super(...arguments),this.disableEscapeKeyBinding=this.disableEscapeKey.bind(this),this.assignedRoles=[],this.activeRoleId="",this.canAddRoles=!1,this.addRolesDisabled=!1,this.canRemoveRoles=!1,this.removeRolesDisabled=!1}connectedCallback(){super.connectedCallback(),this.tabs&&this.tabs.addEventListener("keydown",this.disableEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.tabs&&this.tabs.removeEventListener("keydown",this.disableEscapeKeyBinding)}disableEscapeKey(e){return e.which===27?!1:null}handleRoleClick(e,t){this.dispatchEvent(new CustomEvent(Tt.RoleSelect,{detail:{roleId:t},bubbles:!0,composed:!0})),e.target.scrollIntoView({inline:"center",behavior:"smooth",block:"nearest"})}dispatchOpenRoleMenu(){this.dispatchEvent(new CustomEvent(Tt.OpenRoleMenu,{bubbles:!0,composed:!0}))}dispatchOpenRemoveRoleMeu(){this.dispatchEvent(new CustomEvent(Tt.RemoveRoleMenu,{bubbles:!0,composed:!0}))}setActiveRole(e){this.tabs&&(this.tabs.activeTabIndex=this.assignedRoles.findIndex(t=>t.id===e))}renderAddRoleButton(){return this.canAddRoles?l` <ix-button data-testid="${tt.BTN_ADD_ROLE}" appearance="text" @click="${()=>this.dispatchOpenRoleMenu()}" class="primary" aria-label="Add Role" ?disabled="${this.addRolesDisabled}" has-icon> <md-icon slot="icon">add</md-icon> Add Role </ix-button> `:x}renderRemoveRoleButton(){return this.canRemoveRoles?l` <ix-button data-testid="${tt.BTN_REMOVE_ROLE}" appearance="outlined" .disabled="${this.removeRolesDisabled}" @click="${()=>this.dispatchOpenRemoveRoleMeu()}" class="cancel"> <span>REMOVE ROLE</span> </ix-button> `:x}renderRole(e){return e?l`<ix-primary-tab data-testid="ix-tab-role-${e.id}" @click="${t=>this.handleRoleClick(t,e.id)}" ?activeDisabled="${e.id===this.activeRoleId}"><span id="${`role-tab-${e.id}`}" class="font-bold flex items-center uppercase">${e.name}</span> </ix-primary-tab>`:x}render(){return l` <div class="tab-container"> <div class="flex gap-4 max-w-full overflow-hidden tab-outer-wrapper"> <div class="flex-1 overflow-auto tab-inner-wrapper"> <ix-tabs data-testid="ix-tabs-roles" id="roles-tabs" .scrollButtons="${this.assignedRoles.length>1}" hideScrollBar left-align="true"> ${this.assignedRoles.map(e=>this.renderRole(e))} </ix-tabs> </div> <div class="flex items-center gap-4 shrink-0 tab-inner-wrapper"> ${this.renderAddRoleButton()} ${this.renderRemoveRoleButton()} </div> </div> </div> `}};Q.styles=[Ye,Xe,A,le,ls],s([d({type:Array,attribute:!1})],Q.prototype,"assignedRoles",void 0),s([d({type:String,attribute:!1})],Q.prototype,"activeRoleId",void 0),s([d({type:Boolean})],Q.prototype,"canAddRoles",void 0),s([d({type:Boolean})],Q.prototype,"addRolesDisabled",void 0),s([d({type:Boolean})],Q.prototype,"canRemoveRoles",void 0),s([d({type:Boolean})],Q.prototype,"removeRolesDisabled",void 0),s([F("#roles-tabs")],Q.prototype,"tabs",void 0),Q=s([b("user-details-tab-roles")],Q);const cs=e=>U.getAccounts().find(t=>t.accountNumber===e),Si=(e,t)=>{const i=e.filter(o=>o.parentAccountNumber===t);return i.length?i.flatMap(o=>({id:o.accountNumber,name:o.name,displayName:o.displayName,subaccounts:Si(e,o.accountNumber)})):[]},It=e=>{try{const t=e.map(o=>o.accountNumber),i=e.filter(o=>!t.includes(o.parentAccountNumber||""));if(!i)throw new Error("Failed to get nested account structure");return i.map(o=>({id:o.accountNumber,name:o.name,displayName:o.displayName,subaccounts:Si(e,o.accountNumber)}))}catch(t){return console.error("Could not get nested account structure",t),[]}},_t=()=>U.getAccounts().sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),Ui=e=>pe.get().find(t=>t.id===e)||null,ds=e=>{const t=[],i=[...new Set(e.map(o=>o.roleId))];for(const o of i){const n=Ui(o);n&&t.push(n)}return t},$i=e=>{var t;return{label:(t=e.displayName)!==null&&t!==void 0?t:e.name,id:e.id,children:e.subaccounts.map(i=>$i(i))}},Ni=(e,t)=>{e.children&&e.children.length&&e.children.forEach(o=>Ni(o,t));const i=t.filter(o=>e.id===o.accountNumber).map(o=>({label:o.name,id:o.id,children:void 0}));e.children&&(e.children=i.concat(e.children))},us=e=>{const t=[],i=_t().filter(r=>P.hasCustomRolesRead(r.accountNumber)||P.hasCustomRolesCreate(r.accountNumber)||P.hasCustomRolesUpdate(r.accountNumber)||P.hasCustomRolesApprove(r.accountNumber)),o=It(i);o.forEach(r=>t.push($i(r)));const n=pe.get().filter(r=>r.roleType===V.Custom);t.forEach(r=>{Ni(r,n),r.expanded=e.includes(r.id)});const a=o.some(r=>!!r.subaccounts.length);return{tree:{label:"root",id:"root",children:t},isEndChild:!a&&i.length<=1}},kt=(e,t,i=!1)=>{let o=t.filter(n=>n.accountNumber===e||n.roleType===V.Default||n.roleType===V.Internal||n.roleType===V.GlobalAccess);return i||(o=o.filter(n=>n.roleType!==V.Internal&&n.roleType!==V.GlobalAccess)),o};class J{}J.HEADING="add-account-role-dialog-heading",J.ROLE_SELECTOR="add-account-role-dialog-role-selector",J.ROLE_OPTION=e=>`add-account-role-dialog-role-option-${e}`,J.BTN_CANCEL="add-account-role-dialog-cancel-button",J.BTN_ADD="add-account-role-dialog-add-role-button",J.SUCCESS_MESSAGE="add-account-role-dialog-success-message";function Me(e){return D().InternalUserDomainWhitelist.split(",").some(t=>e==null?void 0:e.includes(t))}let j=class extends I{constructor(){super(...arguments),this.roles=[],this.assignedRoles=[],this.isOpen=!1,this.loading=!1,this.roleId="",this.disabled=!0,this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.handleCancelChangesBinding=this.handleCancelChanges.bind(this)}get name(){var e,t;return`${(e=this.contact)===null||e===void 0?void 0:e.firstName} ${(t=this.contact)===null||t===void 0?void 0:t.lastName}`}get addableRoles(){var e,t,i;if(!(!((e=this.account)===null||e===void 0)&&e.accountNumber))return[];const o=Me((t=this.contact)===null||t===void 0?void 0:t.email)&&P.hasAssignInternalRoleCreate((i=this.account)===null||i===void 0?void 0:i.accountNumber);return kt(this.account.accountNumber,this.roles,o)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding),this.addEventListener("blur",this.handleCancelChangesBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding),this.removeEventListener("blur",this.handleCancelChangesBinding)}handleEscapeKey(e){return e.which===27&&(this.isOpen=!1),null}async handleOpenDialog(){this.isOpen=!0;const e=await this.rolesMenu;e==null||e.reset(),this.disabled=!0}async handleConfirmChanges(){this.dispatchEvent(new CustomEvent(_.AddRole,{detail:{roleId:this.roleId}}))}async handleCancelChanges(){this.isOpen=!1}handleRoleSelect(e){e&&(this.disabled=!1)}renderRoleOptions(){return l` ${this.addableRoles.map((e,t)=>l` <ix-select-option class="option" value="${t}" ?disabled="${this.assignedRoles.some(i=>i.id===e.id)}" @click="${()=>{this.roleId=this.addableRoles[t].id}}" data-testid="${J.ROLE_OPTION(e.name)}"> <div slot="headline">${e.name}</div> </ix-select-option>`)} `}renderHeader(){var e;return l` <div id="confirmation-header" slot="headline" style="max-width:560px" data-testid="${J.HEADING}"> <h1 class="dlr-text-heading break-words"> Add Role to ${this.name} for ${(e=this.account)===null||e===void 0?void 0:e.name} </h1> </div>`}renderContent(){return l` <div slot="content" method="dialog"> <form slot="content" style="padding-top:0" id="add-role-to-roles" method="dialog"> <ix-select quick menu-below class="thick" id="roles-menu" menu-positioning="fixed" @input="${e=>this.handleRoleSelect(e.target.value)}" data-testid="${J.ROLE_SELECTOR}"> ${this.renderRoleOptions()} </ix-select> </form> </div>`}renderFooter(){return l` <div class="add-roles-dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="Cancel" ?disabled="${this.loading}" @click="${()=>this.handleCancelChanges()}" data-testid="${J.BTN_CANCEL}"> Cancel </ix-button> <ix-button id="add-account-button" form="confirm-updates" appearance="text" text="Add Role" ?disabled="${this.disabled}" ?submitting="${this.loading}" @click="${this.handleConfirmChanges}" data-testid="${J.BTN_ADD}">Add Role </ix-button> </div> `}render(){return l` <ix-dialog class="z-50 relative" id="add-role-to-account" ?open="${this.isOpen}"> ${this.renderHeader()} ${this.renderContent()} ${this.renderFooter()} </ix-dialog>`}};j.styles=[Ye,Xe,A],s([d({type:Object})],j.prototype,"contact",void 0),s([d({type:Object})],j.prototype,"account",void 0),s([d({type:Array})],j.prototype,"roles",void 0),s([d({type:Array})],j.prototype,"assignedRoles",void 0),s([d({type:Boolean,reflect:!0})],j.prototype,"isOpen",void 0),s([u()],j.prototype,"loading",void 0),s([u()],j.prototype,"roleId",void 0),s([u()],j.prototype,"disabled",void 0),s([Gi("#roles-menu")],j.prototype,"rolesMenu",void 0),j=s([b("add-account-role")],j);const Fi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.cards-container{display:flex;flex-wrap:wrap}.cards-container>:first-child{padding:8px 8px 8px 0}.cards-container>:not(:first-child){padding:8px}.tree-role-locations-count{margin:0;color:rgba(9,34,65,.3);padding-right:20px;text-transform:uppercase;font-weight:700}.tree-role-locations-count-active{margin:0;padding-right:40px;text-transform:uppercase;font-weight:700}.remove{color:#db0028}.permissions-content{width:800px}.dismiss-btn{color:#1456e0}@media only screen and (max-width:600px){#next-button{display:inline-block}.next-control{text-align:center}.tree-view-container-footer{padding-bottom:1rem}.permissions-content{width:auto}.cards-container{display:flex;flex-wrap:nowrap;max-width:100%;overflow-x:auto}}@media only screen and (min-width:601px){.permissions-locations{display:flex;justify-content:space-between;align-items:center;width:100%}.controls{display:flex;justify-content:space-between;align-items:center}}@media only screen and (max-width:600px){.cards-container{flex-wrap:unset;overflow-x:auto}.tree-role-locations{margin-top:-3px!important}.tree-role-locations-count,.tree-role-locations-count-active{font-size:.875rem!important}}`,ps={ToggleActiveCard:"toggle-active-card"};let Te=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.isRoles=!1}dispatchToggleActiveCard(e){this.dispatchEvent(new CustomEvent(ps.ToggleActiveCard,{detail:{accountId:e},bubbles:!0,composed:!0}))}renderCards(){return this.dataForAccounts.map(e=>{if(this.isRoles){const i=e.rolesData.filter(o=>o.role.removed===!1).map(o=>o.role.name);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${i}" .type="${"roles"}" ?isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${o=>{this.dispatchToggleActiveCard(o.detail)}}"></ix-card> `}const t=ae.map(i=>i.text);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${t}" .type="${"flags"}" .isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${i=>{this.dispatchToggleActiveCard(i.detail)}}"></ix-card> `})}render(){return l`<div class="cards-container">${this.renderCards()}</div> `}};Te.styles=[Fi,A,_e,le],s([d({type:Array})],Te.prototype,"dataForAccounts",void 0),s([d({type:String})],Te.prototype,"selectedAccountId",void 0),s([d({type:Boolean})],Te.prototype,"isRoles",void 0),Te=s([b("account-tabbing-card")],Te);class it{constructor(){this.updates=[]}get nodeUpdates(){return this.updates}update(t){this.updates=[];let i=[];t&&(i=ao(t));for(const o of i)o.originalCheckedStatus!==o.checked&&this.updates.push(o)}}class Di{constructor(){this._nodeUpdates=[]}create(t){if(this._nodeUpdates.find(o=>o.key===t))return;const i=new it;this._nodeUpdates.push({key:t,item:i})}update(t,i){const o=this._nodeUpdates.find(n=>n.key===t);o==null||o.item.update(i)}get nodeUpdates(){return this._nodeUpdates}get isDirty(){let t=0;return this._nodeUpdates.forEach(i=>{t+=i.item.nodeUpdates.length}),t>0}get nodeChanges(){const t=[];return this._nodeUpdates.forEach(i=>{i.item.nodeUpdates.length>0&&i.item.nodeUpdates.forEach(o=>{const n=t.find(a=>a.key===i.key);n?n.items.push(o):t.push({key:i.key,items:[o]})})}),t}reset(){this._nodeUpdates=[]}remove(t){this._nodeUpdates=this._nodeUpdates.filter(i=>i.key!==t)}}function Et(e,t){var i,o;const n=[],a=t.toLowerCase().trim();if(a.length<2||((!((i=e.label)===null||i===void 0)&&i.toLowerCase().includes(a)||!((o=e.secondaryLabel)===null||o===void 0)&&o.toLowerCase().includes(a))&&n.push(e),!e.children))return n;for(const r of e.children){const c=Et(r,t);n.push(...c)}return n}function Pi(e,t,i){if(e==="previous"){const o=i.indexOf(t)-1,n=o<0?i.length-1:o;return i[n]}if(e==="next"){const o=i.indexOf(t)+1,n=o>=i.length?0:o;return i[n]}}function Mi(e,t){const i=[];for(const o of t){i.push(o.id),o.selected=!0;let n=ze(e,o.id);for(;n!=null&&n.parentId;)n=ze(e,n.parentId),n&&(n.expanded=!0)}return i}function Rt(e){e.selected=!1,e.children&&e.children.forEach(t=>{Rt(t)})}class hs{constructor(){this._dataCollection=new Map}capture(t){var i;let o;const n=this._dataCollection.get(t);return n&&(o=ui(n.data),!((i=n.options)===null||i===void 0)&&i.consume&&this._dataCollection.delete(t)),o}emit(t,i){i.options={lock:!1,consume:!0,...i.options},this._store(t,i)}lock(t){const i=this._dataCollection.get(t);i&&(i.options.lock=!0)}remove(t){this._dataCollection.delete(t)}_store(t,i){var o;const n=this._dataCollection.get(t);return n&&!((o=n.options)===null||o===void 0)&&o.lock?!1:(this._dataCollection.set(t,ui(i)),!0)}}const ot=new hs;class ms extends Ae{}const St=new ms({});let $=class extends I{constructor(){super(...arguments),this.searching=!1,this.disableTree=!1,this.readonly=!1,this.activeRoleId="",this.searchResultCount=0,this.searchResultIndex=0,this.selectedIds=[],this.loadingNodes=!1,this.assignmentUpdateManagers=[],this.searchText="",this.onSearchTextChange=Vt(async e=>{var t;this.searchText=e.detail.searchText;const i=(t=this.assignment)===null||t===void 0?void 0:t.rootNode;Rt(i);const o=Et(i,this.searchText);o.length&&qe(i),this.searchResultCount=o.length;const n=Mi(i,o);[this.selectedId]=n,this.selectedIds=[...n],this.searchResultIndex=n.indexOf(this.selectedId)+1,this.requestUpdate()},500)}updated(e){super.updated(e),e.has("activeRoleId")&&this.handleNonLocationTrees()}disconnectedCallback(){super.disconnectedCallback(),this.emitUpdates()}emitUpdates(){var e,t;const i=St.get(),o=(e=this.assignmentUpdateManagers.find(c=>c.accountId===i.accountNumber))===null||e===void 0?void 0:e.nodeManager,n=o==null?void 0:o.nodeUpdates.flatMap(c=>c.item.nodeUpdates);if(!(i!=null&&i.accountNumber)&&!o)return;const a={data:n||[],options:{consume:!1}},r=`${i.accountNumber}:${(t=this.contact)===null||t===void 0?void 0:t.id}`;ot.emit(r,a)}dispatchCheckToggleEvent(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{updates:structuredClone(e)}}}))}handleNonLocationTrees(){const e=pe.get().find(n=>{var a;return n.id===((a=this.assignment)===null||a===void 0?void 0:a.role)});if(!e||!this.assignment)return;if(!e.permissions.every(n=>n.isNonLocation)){this.disableTree=!1;return}const t=this.assignment.rootNode.children[0];t.checked=!0,this.disableTree=!0,me(t,this.assignment.rootNode);const i=this.getOrCreateNodeManager();if(!i)return;const o=i.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});o&&(o.item.update(this.assignment.rootNode),this.dispatchCheckToggleEvent(i.nodeChanges))}onTreeCheckToggle(e){var t;try{const i=this.getOrCreateNodeManager();if(!i)throw new Error("Node manager is missing.");const o=i.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});o&&o.item.update(e.detail.message.rootNode),!((t=this.assignment)===null||t===void 0)&&t.rootNode&&(this.assignment.rootNode=structuredClone(e.detail.message.rootNode)),this.dispatchCheckToggleEvent(i.nodeChanges)}catch(i){m.handleError(i,"Failed to toggle tree check.")}}async onTreeExpandToggle(e){var t,i;try{const o=e.detail.message.update,n=e.detail.message.node;if(n.children&&n.children.length)return;if(!this.contact.id||!this.accountNumber)throw new Error("Contact ID or Account Number is missing.");n.loading=!0;const a=await Oa((t=this.assignment)===null||t===void 0?void 0:t.role,this.contact.id,this.accountNumber,n.id,void 0,!0,Me((i=this.contact)===null||i===void 0?void 0:i.email));n.loading=!1,a[0].inventoryItems&&a[0].inventoryItems.length&&(a[0].inventoryItems.forEach(r=>{ue(r,n),n.originalCheckedStatus!==n.checked&&me(n,n)}),o())}catch(o){m.handleError(o,"Failed to expand tree node.")}}destroyRoleManager(){const e=this.assignmentUpdateManagers.find(t=>t.accountId===this.accountNumber);e&&(e.nodeManager.reset(),this.assignmentUpdateManagers=this.assignmentUpdateManagers.filter(t=>t.accountId!==this.accountNumber))}getOrCreateNodeManager(){var e;let t;try{if(!this.accountNumber)throw new Error("Account number is missing.");t=(e=this.assignmentUpdateManagers.find(i=>i.accountId===this.accountNumber))===null||e===void 0?void 0:e.nodeManager,t||(this.assignmentUpdateManagers.push({accountId:this.accountNumber,nodeManager:new Di}),t=this.assignmentUpdateManagers.find(i=>i.accountId===this.accountNumber).nodeManager)}catch(i){m.handleError(i,"Failed to get or create node manager.")}return t}disableCheckboxes(){return this.readonly?!0:this.disableTree}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=Pi(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;const t=this.getOrCreateNodeManager();return t&&this.assignment&&t.create(this.assignment.role),l` <div class="flex items-center py-[0.75rem]"> <h1 class="dlr-text-heading">Portal Access</h1> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <ix-generic-tree data-testid="location-treeview" .rootNode="${(e=this.assignment)===null||e===void 0?void 0:e.rootNode}" .searchText="${this.searchText}" .selectedId="${this.selectedId}" .showCheckboxes="${!0}" .disableCheckboxes="${this.disableCheckboxes()}" @search-text-change="${this.onSearchTextChange}" @search-navigation="${i=>this.onSearchNavigation(i)}" @check-toggle="${i=>this.onTreeCheckToggle(i)}" @expand-toggle="${i=>this.onTreeExpandToggle(i)}" searchEnabled .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};$.styles=[A,E`:host{--md-circular-progress-size:28px}`],s([d({type:Object,attribute:!1})],$.prototype,"assignment",void 0),s([d({type:Object})],$.prototype,"contact",void 0),s([d({type:String})],$.prototype,"accountNumber",void 0),s([d({type:String})],$.prototype,"selectedId",void 0),s([d({type:Boolean})],$.prototype,"searching",void 0),s([d({type:Boolean})],$.prototype,"disableTree",void 0),s([d({type:Boolean})],$.prototype,"readonly",void 0),s([d({type:String})],$.prototype,"activeRoleId",void 0),s([u()],$.prototype,"searchResultCount",void 0),s([u()],$.prototype,"searchResultIndex",void 0),s([u()],$.prototype,"selectedIds",void 0),s([u()],$.prototype,"loadingNodes",void 0),s([u()],$.prototype,"assignmentUpdateManagers",void 0),s([u()],$.prototype,"searchText",void 0),$=s([b("user-details-assignments")],$);let N=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.permissions=[],this._dataForAccounts=[],this.showPermissionsDialog=!1,this.removeRoleDialogOpen=!1,this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId,this._selectedRoleId=this.selectedRoleId,this.validateStep(),this.dispatchValidateStepEvent(),this.setInitialRole()}get noOfLocations(){var e;return Ot((e=this.selectedRoleData)===null||e===void 0?void 0:e.genericTreeView)}get canAddRolesDisabled(){return this.unAvailableRoles&&this.unAvailableRoles.length<=0}get availableRoles(){const e=this._dataForAccounts.find(i=>i.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(i=>i.role.removed===!1);return t==null?void 0:t.flatMap(i=>i.role)}get unAvailableRoles(){const e=this._dataForAccounts.find(i=>i.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(i=>i.role.removed===!0);return t==null?void 0:t.flatMap(i=>i.role)}get roles(){const e=this._dataForAccounts.find(t=>t.accountId===this._selectedAccountId);return e==null?void 0:e.rolesData.flatMap(t=>t.role)}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}get selectedRole(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId).role}get selectedRolePermissions(){var e,t;return(t=(e=this._dataForAccounts.find(i=>i.accountId===this._selectedAccountId))===null||e===void 0?void 0:e.rolesData.find(i=>i.role.id===this._selectedRoleId))===null||t===void 0?void 0:t.role.permissions}get selectedRoleData(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId)}toggleActiveCard(e){var t;this._selectedAccountId=e,this._selectedRoleId=(t=this._dataForAccounts.find(i=>i.accountId===e))===null||t===void 0?void 0:t.rolesData[0].role.id,this._dataForAccounts.forEach(i=>{i.accountId!==e?i.active=!1:i.active=!0}),this.roleTabComponent.setActiveRole(this._selectedRoleId),this.setInitialRole(),this.requestUpdate()}setInitialRole(){this.availableRoles&&this.availableRoles.length>0&&(this._selectedRoleId=this.availableRoles[0].id)}dispatchOpenAddAccountRole(){this.addRoleDialog.handleOpenDialog()}dispatchTabControl(e){this._selectedRoleId=this.roles[e].id,this.roleTabComponent.setActiveRole(this._selectedRoleId)}addRole(e){var t;const i=this.selectedAccount.rolesData.findIndex(o=>o.role.id===e);if(this.selectedAccount.rolesData[i].role.permissions.every(o=>o.isNonLocation)){const o=this.selectedAccount.rolesData[i].genericTreeView;if(!(!((t=o==null?void 0:o.children)===null||t===void 0)&&t.length))return;const n=o.children[0];n.checked=!0,me(n,o),this.selectedAccount.rolesData[i].locations.push(n)}else this.selectedAccount.rolesData[i].locations=[];this.selectedAccount.rolesData[i].role.removed=!1,this.requestUpdate(),this.dispatchTabControl(i),this.addRoleDialog.handleCancelChanges()}dispatchRemoveRoleEvent(){const e=this.roles.findIndex(i=>i.id===this._selectedRoleId);this.roles[e].removed=!0;const t=this.selectedAccount.rolesData.findIndex(i=>i.role.id===this._selectedRoleId);this.selectedAccount.rolesData[t].locations=[],this.selectedAccount.rolesData[t].role.removed=!0,this.selectedAccount.rolesData[t].genericTreeView&&vi(this.selectedAccount.rolesData[t].genericTreeView),this.validateStep(),this.setInitialRole(),this.requestUpdate()}renderTree(){const e=this._dataForAccounts.find(n=>n.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.find(n=>n.role.id===this._selectedRoleId);if(!t)return x;const i={role:t.role.id,rootNode:t.genericTreeView},o=n=>{this.requestUpdate();const{updates:a}=n.detail.message,r=a.find(c=>c.key===t.role.id);r!=null&&r.items?t.locations=r.items.filter(c=>c.checked):t.locations=[],this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()};if(i&&i.rootNode){const n=t==null?void 0:t.role.permissions.every(a=>a.isNonLocation);return l`<user-details-assignments .assignment="${i}" .contact="${this.contact}" .accountNumber="${e==null?void 0:e.accountId}" @check-toggle="${o}" ?disableTree="${n}"></user-details-assignments>`}return x}validateStep(){let e=!0;for(const t of this._dataForAccounts)if(!t.rolesData.filter(i=>i.role.removed===!1).every(i=>i.locations.length)){e=!1;break}this._nextButtonEnabled=e}renderRoles(){var e,t;return l` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.availableRoles}" .activeRoleId="${(e=this._selectedRoleId)!==null&&e!==void 0?e:""}" .canRemoveRoles="${!0}" .removeRolesDisabled="${((t=this.availableRoles)===null||t===void 0?void 0:t.length)<=1}" .canAddRoles="${!0}" .addRolesDisabled="${this.canAddRolesDisabled}" @role-select="${i=>this._selectedRoleId=i.detail.roleId}" @open-role-menu="${()=>this.dispatchOpenAddAccountRole()}" @open-remove-role-menu="${()=>this.removeRoleDialogOpen=!0}"></user-details-tab-roles> `}renderAddAccountRoleConfirmation(){var e;return l`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${cs((e=this.selectedAccount)===null||e===void 0?void 0:e.accountId)||""}" .assignedRoles="${this.availableRoles}" .roles="${this.roles}" @add-role="${t=>this.addRole(t.detail.roleId)}"> </add-account-role>`}renderRemoveRoleConfirmation(){return l`<changes-confirmation id="remove-role-dialog" ?isOpen="${this.removeRoleDialogOpen}" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" @confirm="${()=>{this.dispatchRemoveRoleEvent(),this.validateStep(),this.removeRoleDialogOpen=!1}}" @cancel="${()=>this.removeRoleDialogOpen=!1}"> </changes-confirmation>`}renderControls(){return l` <div class="controls"> <div class="flex justify-between py-2 items-center permissions-locations"> ${this.renderViewPermissionsButton()} <div class="flex items-center">${this.renderLocationsCount()}</div> </div> <div class="next-control"> <ix-button id="next-button" type="submit" has-icon trailing-icon ?disabled="${!this._nextButtonEnabled}" @click="${()=>{this.dispatchNextStepEvent()}}" data-testid="step-four-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderPermissionsDialog(){var e,t;return l` <ix-dialog ?open="${this.showPermissionsDialog}" @close="${()=>this.showPermissionsDialog=!1}"> <div class="dlr-text-heading" slot="headline">${this.selectedRole.name}</div> <div class="permissions-content" slot="content"> <user-details-permission inPermissionsDialog .permissionData="${(t=_i((e=this.selectedRolePermissions)!==null&&e!==void 0?e:[]))!==null&&t!==void 0?t:[]}"> </user-details-permission> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.togglePermissionsDialog}" slot="secondary"><span class="dismiss-btn">Dismiss</span></ix-button> </div> </ix-dialog> `}togglePermissionsDialog(){this.showPermissionsDialog=!this.showPermissionsDialog}renderViewPermissionsButton(){return l` <div class="tree-view-permissions"> <ix-button class="temp-button view-permissions" appearance="text" @click="${this.togglePermissionsDialog}"> View Permissions </ix-button> </div> `}renderLocationsCount(){const e=`dlr-text-default font-bold uppercase ${this.noOfLocations?"tree-role-locations-count-active":"tree-role-locations-count"}`;return l`<div class="tree-role-locations"> <span class="${e}"> ${this.noOfLocations?l`${this.noOfLocations} locations`:l`Select Locations`} </span> </div>`}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchUpdateDFAEvent(){const e=new CustomEvent(w.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(e)}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-four-account-cards" isRoles .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}render(){return l` <div class="wizard-step-content overflow-y-auto h-full max-h-screen md:p-1"> ${this.renderAccountTabbingCard()} <div class="tree-view-container-content">${this.renderRoles()}</div> <div class="controls-container">${this.renderControls()}</div> <div class="tree-view-container-footer">${this.renderTree()}</div> </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderPermissionsDialog()} `}};N.styles=[Fi,A,le],s([d({type:Array})],N.prototype,"dataForAccounts",void 0),s([d({type:Array})],N.prototype,"permissions",void 0),s([d({type:String})],N.prototype,"selectedAccountId",void 0),s([d({type:String})],N.prototype,"selectedRoleId",void 0),s([d({type:Object})],N.prototype,"contact",void 0),s([u()],N.prototype,"_dataForAccounts",void 0),s([u()],N.prototype,"_selectedAccountId",void 0),s([u()],N.prototype,"_selectedRoleId",void 0),s([u()],N.prototype,"showPermissionsDialog",void 0),s([u()],N.prototype,"removeRoleDialogOpen",void 0),s([u()],N.prototype,"_nextButtonEnabled",void 0),s([F("#add-role-dialog")],N.prototype,"addRoleDialog",void 0),s([F("#role-data-element")],N.prototype,"roleTabComponent",void 0),s([F("user-details-assignments")],N.prototype,"assignmentTreeComponent",void 0),N=s([b("create-user-step-four")],N);const Bi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-icon-button{--md-sys-color-on-surface-variant:black}`;class ne{}ne.ACCORDION=e=>`user-flags-accordion-${e}`,ne.COMPONENT=e=>`user-flags-${e}`,ne.TREE=e=>`user-flags-tree-${e}`,ne.ASSIGNMENT_COUNT=e=>`user-flags-assignment-count-${e}`,ne.SEARCH_BOX=()=>"search-box";let M=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.searchText="",this.selectedIds=[],this.searchResultCount=0,this.searchResultIndex=0,this.onSearchTextChange=Vt(async e=>{Rt(this.flagTree.rootNode),this.searchText=e.detail.searchText;const t=Et(this.flagTree.rootNode,e.detail.searchText);t.length&&qe(this.flagTree.rootNode),this.searchResultCount=t.length;const i=Mi(this.flagTree.rootNode,t);[this.selectedId]=i,this.selectedIds=[...i],this.searchResultIndex=i.indexOf(this.selectedId)+1,this.requestUpdate()},500)}onTreeCheckToggle(e){var t;this.flagTree.updateService&&this.flagTree.updateService.update(e.detail.message.rootNode);const i=this.flagUpdateManager.nodeUpdates.find(o=>o.key===this.flagTree.label);i&&i.item.update(e.detail.message.rootNode),this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:this.flagTree.label,updates:this.flagUpdateManager.nodeChanges,rootNode:(t=this.flagTree.updateService)===null||t===void 0?void 0:t.nodeUpdates[0]}}})),this.flagTree.rootNode=structuredClone(e.detail.message.rootNode),this.requestUpdate("flagTree")}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=Pi(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;return l` <ix-generic-tree data-testid="${ne.TREE(this.flagTree.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" .rootNode="${this.flagTree.rootNode}" .selectedId="${this.selectedId}" .searchText="${this.searchText}" @check-toggle="${t=>this.onTreeCheckToggle(t)}" @search-text-change="${t=>this.onSearchTextChange(t)}" @search-navigation="${t=>this.onSearchNavigation(t)}" ?searchEnabled="${this.searchEnabled&&(((e=this.flagTree.rootNode.children)===null||e===void 0?void 0:e.length)||0)>0}" .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};M.styles=[Bi,A],s([d({type:Object,attribute:!1})],M.prototype,"flagTree",void 0),s([d({type:Boolean})],M.prototype,"searchEnabled",void 0),s([d({type:Boolean})],M.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],M.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],M.prototype,"filledIcons",void 0),s([d({type:Boolean})],M.prototype,"searching",void 0),s([d({type:String})],M.prototype,"selectedId",void 0),s([d({type:Object})],M.prototype,"flagUpdateManager",void 0),s([u()],M.prototype,"searchText",void 0),s([u()],M.prototype,"selectedIds",void 0),s([u()],M.prototype,"searchResultCount",void 0),s([u()],M.prototype,"searchResultIndex",void 0),M=s([b("user-flag")],M);let G=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.flags=[],this.flagUpdateManager=new Di,this._defaultUpdates=[]}reset(){this._defaultUpdates=[],this.flagUpdateManager.reset()}onAccordionToggle(e){!e.detail.isOpen||!this.flags.length||(this.flags.forEach(t=>{t.label!==e.detail.accordionId?t.isOpen=!1:t.isOpen=!0}),this.requestUpdate())}connectedCallback(){var e;if(super.connectedCallback(),this._defaultUpdates=[],!this.contact)return;const t=St.get();if(!(!((e=this._defaultUpdates)===null||e===void 0)&&e.length)&&t!=null&&t.accountNumber){const i=`${t.accountNumber}:${this.contact.id}`,o=ot.capture(i);o&&ot.lock(i),this._defaultUpdates=o}}disconnectedCallback(){this.reset()}onTreeCheckToggle(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:e.detail.message.flagLabel,updates:e.detail.message.updates,rootNode:e.detail.message.rootNode}}}))}getUserFlagAssignmentCount(e){var t;const i=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);i&&(i.checkedChildrenCount=Ot(i),this.renderAssignmentCount(e))}renderAssignmentCount(e){var t;const i=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);return i!=null&&i.checkedChildrenCount?l` <span style="color:#53657a;margin-left:8px" data-testid="${ne.ASSIGNMENT_COUNT(e.label)}">${i.checkedChildrenCount}</span> `:x}renderUserFlag(e){var t,i;this.flagUpdateManager.create(e.label);const o=this.flagUpdateManager.nodeUpdates.find(n=>n.key===e.label);return!((t=this._defaultUpdates)===null||t===void 0)&&t.length&&!e.defaultsApplied&&(this._defaultUpdates.forEach(n=>{const a=ze(e.rootNode,n.id);a&&(a.checked=!0,me(a,e.rootNode),o==null||o.item.update(e.rootNode))}),e.defaultsApplied=!0),this.getUserFlagAssignmentCount(e),l` <div class="mb-2"> <ix-accordion ?isOpen="${e.isOpen}" .accordionId="${e.label}" @toggle="${this.onAccordionToggle}" data-testid="${ne.ACCORDION(e.label)}"> <p slot="title" class="m-0 pl-1"> ${e.label} ${this.renderAssignmentCount(e)} </p> <div style="padding-left:30px"> <div class="flex items-center"> <p class="dlr-text-small"> ${((i=ae.find(n=>n.text===e.label))===null||i===void 0?void 0:i.desc)||""} </p> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <user-flag data-testid="${ne.COMPONENT(e.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" ?searchEnabled="${this.searchEnabled}" .flagTree="${e}" .flagUpdateManager="${this.flagUpdateManager}" @check-toggle="${n=>this.onTreeCheckToggle(n)}"></user-flag> </div> </ix-accordion> </div> `}render(){return l` ${this.flags.map(e=>this.renderUserFlag(e))}`}};G.styles=[Bi,A],s([d({type:Boolean})],G.prototype,"searchEnabled",void 0),s([d({type:Boolean})],G.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"filledIcons",void 0),s([d({type:Boolean})],G.prototype,"searching",void 0),s([d({type:Array,attribute:!1})],G.prototype,"flags",void 0),s([d({type:Object})],G.prototype,"contact",void 0),s([u()],G.prototype,"flagUpdateManager",void 0),s([u()],G.prototype,"_defaultUpdates",void 0),G=s([b("user-flags")],G);const Li=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header-text{margin-bottom:10px}.user-details-row{display:grid;grid-template-columns:1fr 1fr}.row-label{color:rgba(9,34,65,.7);word-break:break-word;width:192px}.row-value{color:#092241;overflow-wrap:anywhere}.user-details-body{display:flex;gap:10px;flex-direction:column}.arrow-forward-icon{padding-left:6px}.access-summary-header,.user-details-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}ix-divider{margin-top:30px;margin-bottom:30px}.user-flag-information{margin-left:5px}.user-flag-learn-text{padding-bottom:20px}.user-flag-learn-text-link{color:#1456e0}.user-flag-evacuation{vertical-align:top;line-height:18px}.evacuation-label{padding-left:8px;vertical-align:top}.evacuation-text{text-align:justify;padding-left:5px;padding-top:10px;padding-bottom:30px;color:#5d6d82;margin-right:40px}.flags-description ix-button{margin-top:.5rem;width:112px}@media only screen and (max-width:600px){.flags-description{flex-direction:column-reverse;text-align:center}.flags-description p{text-align:left}.evacuation-text{margin-right:0}.flags-description ix-button{display:block}.subheading-container{flex-direction:column;align-items:start;gap:.75rem}.submit-btn{width:100%}.user-details-row{grid-template-columns:1fr}.step-five-next-container{display:flex;justify-content:center}}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;let Y=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.evacAssistanceRequired=!1,this._dataForAccounts=[]}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId}setSelectedFlag(e){this._selectedFlagId=e}setInitialFlag(){this._selectedFlagId=ae[0].key}toggleActiveCard(e){this._selectedAccountId=e;const t=this._dataForAccounts.find(i=>i.accountId===e);t&&t.genericFlagsData&&(this._selectedFlagId=ft(t.genericFlagsData[0].label)),this.setSelectedFlag(this._selectedFlagId),this.setInitialFlag(),this.requestUpdate()}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-five-account-cards" .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}renderElevatedNextButton(){return l` <div class="flex justify-between flags-description"> <p style="max-width:550px" class="dlr-text-caption evacuation-text"> The locations chosen for this account's Portal access will automatically default selections for the user flags listed below. You have the flexibility to modify these selections by deselecting specific locations and choosing others as needed. </p> <div class="step-five-next-container"> <ix-button type="submit" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-five-next-button"> <span class="uppercase font-bold tracking-wider">Next</span> <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderUserFlags(){var e,t;const i=o=>{var n;const a=(n=structuredClone(o.detail.message.updates))!==null&&n!==void 0?n:[];this.selectedAccount&&a.forEach(r=>{const c=this.selectedAccount.flagData.findIndex(p=>p.key===r.key);c>-1?this.selectedAccount.flagData[c]=structuredClone(r):this.selectedAccount.flagData.push(r)}),this.dispatchEvent(new CustomEvent(w.UpdateFlags,{bubbles:!0}))};return l` <user-flags class="grid grid-cols-1 gap-3" showCheckboxes filledIcons searchEnabled .flags="${(t=(e=this.selectedAccount)===null||e===void 0?void 0:e.genericFlagsData)!==null&&t!==void 0?t:[]}" @check-toggle="${i}" data-testid="step-five-user-flags"></user-flags> `}render(){return l` <div class="wizard-step-content"> ${this.renderAccountTabbingCard()} ${this.renderElevatedNextButton()} ${this.renderUserFlags()} </div> `}};Y.styles=[Li,A,le],s([d({type:Object})],Y.prototype,"newContact",void 0),s([d({type:Array})],Y.prototype,"dataForAccounts",void 0),s([d({type:String})],Y.prototype,"selectedAccountId",void 0),s([d({type:Boolean,reflect:!0})],Y.prototype,"evacAssistanceRequired",void 0),s([u()],Y.prototype,"_dataForAccounts",void 0),s([u()],Y.prototype,"_selectedAccountId",void 0),s([u()],Y.prototype,"_selectedFlagId",void 0),Y=s([b("create-user-step-five")],Y);class k{}k.SUCCESS_CREATED="create-user-success",k.SUCCESS_ICON="create-user-success-icon",k.USER_DETAILS="create-user-success-details",k.SUCCESS_MESSAGE="create-user-success-message",k.VIEW_USER="view-user-button",k.BACK_TO_USERS="back-to-users-button",k.S6={DETAILS_HEADER:"s6-details-header",DETAILS_BODY:"s6-details-body",DETAILS_FIRST_NAME:"s6-details-first-name",DETAILS_LAST_NAME:"s6-details-last-name",DETAILS_EMAIL:"s6-details-email",DETAILS_PHONE:"s6-details-phone",PORTAL_TREE:"s6-portal-tree",FLAG_TREE:"s6-flag-tree",TAB_PORTAL:"s6-tab-portal",TAB_FLAGS:"s6-tab-flags"};let X=class extends I{constructor(){super(...arguments),this.newContact={},this.dataForAccounts=[],this.submitting=!1,this._readonlyTreeViews=[],this._readonlyUserFlags=[],this._selectedTab="roles-and-portal-access",this._isFirstLoad=!0}connectedCallback(){super.connectedCallback(),this._readonlyTreeViews=this.generateReadOnlyTreeViews(),this._readonlyUserFlags=this.generateReadOnlyUserFlags()}isTabActive(e){return this._isFirstLoad?x:this._selectedTab===e}generateReadOnlyTreeViews(){const e=[];return this.dataForAccounts.forEach(t=>{let i=[];t.rolesData.forEach(o=>{if(!o.role.removed){const n=zt(o.genericTreeView),a=qt(structuredClone(n));Ht(a),i.push({role:o.role.name,tree:a})}}),e.push({accountName:t.accountName,roleTrees:i}),i=[]}),e}generateReadOnlyUserFlags(){const e=[];return this.dataForAccounts.forEach(t=>{let i=[];t.genericFlagsData&&(t.genericFlagsData.forEach(o=>{const n=zt(o.rootNode),a=qt(structuredClone(n));Ht(a),i.push({label:o.label,rootNode:a,isOpen:!1})}),e.push({accountName:t.accountName,flagTrees:i}),i=[])}),e}renderUserDetails(){return l` <div class="user-details"> <div class="user-details-header" data-testid="${k.S6.DETAILS_HEADER}"> <div class="user-details-header-text">User Details</div> <ix-icon-button class="icon-btn_primary" filledIcon icon="edit" ?disabled="${this.submitting}" @click="${()=>this.dispatchSetStepEvent(1)}"></ix-icon-button> </div> <div class="user-details-body" data-testid="${k.S6.DETAILS_BODY}"> <div class="user-details-row"> <div class="dlr-text-default row-label">First Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_FIRST_NAME}"> ${this.newContact.firstName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Last Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_LAST_NAME}"> ${this.newContact.lastName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Email Address</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_EMAIL}"> ${this.newContact.email} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Phone</div> <ix-phone-number data-testid="${k.S6.DETAILS_PHONE}" .number="${this.newContact.phone}"></ix-phone-number> </div> </div> </div> `}renderTabs(){return l` <ix-tabs> <ix-primary-tab @click="${()=>{this._selectedTab="roles-and-portal-access",this._isFirstLoad=!1}}" ?active="${this.isTabActive("roles-and-portal-access")}" data-testid="${k.S6.TAB_PORTAL}"> <span style="${this._selectedTab==="roles-and-portal-access"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide"> Roles and Portal Access </span> </ix-primary-tab> <ix-primary-tab @click="${()=>{this._selectedTab="user-flags",this._isFirstLoad=!1}}" ?active="${this.isTabActive("user-flags")}" data-testid="${k.S6.TAB_FLAGS}"> <span style="${this._selectedTab==="user-flags"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide">User Flags</span></ix-primary-tab> </ix-tabs> `}renderRolesAndPortalAccessSummary(){return this._selectedTab!=="roles-and-portal-access"?x:l` <div class="py-4"> ${this._readonlyTreeViews.map(e=>l` <div> <h4 style="color:#092241;opacity:60%" class="pt-1 pb-3">${e.accountName}</h4> ${e.roleTrees.map(t=>l` <div class="pb-2"> <div class="pb-1">${t.role}</div> <ix-generic-tree filledIcons .rootNode="${t.tree}" data-testid="${k.S6.PORTAL_TREE}"></ix-generic-tree> </div> `)} </div>`)} </div> `}renderUserFlagsSummary(){return this._selectedTab!=="user-flags"?x:l`<div> ${this._readonlyUserFlags.map(e=>l` <div class="py-2"> <h4 class="font-bold pb-2">${e.accountName}</h4> <user-flags filledIcons disableCheckboxes .flags="${e.flagTrees}" data-testid="${k.S6.FLAG_TREE}"></user-flags> </div>`)} </div>`}renderLearnMoreText(){return this._selectedTab==="user-flags"?l` <div style="padding-top:15px"> Learn more about user flags <a class="user-flag-learn-text-link" href="#">here.</a> </div> `:l` <div style="padding-top:15px" class="text-black roles-and-portal-access-text"> Learn more about roles and portal access <a class="user-flag-learn-text-link" href="#">here.</a> </div> `}dispatchSetStepEvent(e){this.dispatchEvent(new CustomEvent(w.SetStep,{detail:{step:e},bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-step-content overflow-y-auto overflow-x-hidden md:p-1"> ${this.renderUserDetails()} <ix-divider></ix-divider> ${this.renderTabs()} ${this.renderLearnMoreText()} ${this.renderRolesAndPortalAccessSummary()} ${this.renderUserFlagsSummary()} </div> `}};X.styles=[Li,A,le],s([d({type:Object})],X.prototype,"newContact",void 0),s([d({type:Array})],X.prototype,"dataForAccounts",void 0),s([d({type:Boolean})],X.prototype,"submitting",void 0),s([u()],X.prototype,"_readonlyTreeViews",void 0),s([u()],X.prototype,"_readonlyUserFlags",void 0),s([u()],X.prototype,"_selectedTab",void 0),s([u()],X.prototype,"_isFirstLoad",void 0),X=s([b("create-user-step-six")],X);const gs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.hover-layer-active{width:24px;height:24px;border-radius:9999px;float:right}.hover-layer-active:hover{transition:.15s;background-color:#d3d3d3}.hover-layer-disabled{width:24px;height:24px;border-radius:9999px;float:right}.drawer-container{z-index:100;display:flex;flex-direction:row;position:fixed;width:100%;height:100%;top:var(--intraportal-nav-height,0);right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeIn;animation-timing-function:ease-out}.drawer-container-hide{z-index:100;display:flex;flex-direction:row;flex:0 0 auto;position:fixed;width:100vw;height:100vh;top:0;right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeOut;animation-timing-function:ease-out}.drawer-filler{flex:1}aside{padding:32px 40px 40px;border-radius:1rem 0 0 1rem}.drawer-slide-in{width:100vw;max-width:816px;height:calc(100% - var(--intraportal-nav-height,0px));float:right;display:flex;flex-direction:column;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideInFromRight}.drawer-slide-out{width:100vw;max-width:810px;height:100vh;float:right;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideOutToRight}@media screen and (min-width:1024px){.drawer{width:45%}}.drawer-header{display:flex;justify-content:space-between;align-items:center}.drawer-body{flex-grow:1;overflow:hidden}.drawer-header__hide-btn{flex:1}.drawer-header__title{flex:1;text-align:center;flex-grow:1;flex-shrink:0}.drawer-header__close-btn{flex:1}.hide-text{cursor:pointer;user-select:none}.hide-icon{font-weight:700}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideOutToRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@media screen and (max-width:600px){aside{border-radius:0;padding:1rem}}`,nt={ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",CloseSuccess:"close-success",BlurDrawer:"blur-drawer"};let se=class extends I{constructor(){super(...arguments),this.isVisible=!1,this.summaryScreen=!1,this.submitting=!1,this.showMinimiseButton=!1}static get styles(){return[gs,A]}dispatchDialogToggleEvent(){this.submitting||this.dispatchEvent(new CustomEvent(nt.ToggleDialog,{composed:!0,bubbles:!0}))}dispatchDraftToggleEvent(){var e,t;(e=this.drawer)===null||e===void 0||e.setAttribute("class","drawer-slide-out"),(t=this.drawerContainer)===null||t===void 0||t.setAttribute("class","drawer-container-hide"),setTimeout(()=>{this.dispatchEvent(new CustomEvent(nt.ToggleDraft,{bubbles:!0,composed:!0}))},250)}dispatchBlurEvent(){this.dispatchEvent(new CustomEvent(nt.BlurDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(nt.CloseSuccess,{bubbles:!0,composed:!0}))}render(){const e=this.isVisible?"slide-in":"slide-out",t=this.submitting?"hover-layer-disabled":"hover-layer-active";return this.isVisible?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",l` <div class="drawer-container" data-testid="ui-um-drawer-container"> <div class="drawer-filler" @click="${this.dispatchBlurEvent}" @keypress="${this.dispatchBlurEvent}"></div> <aside class="drawer-${e}"> <div class="drawer-header"> <div class="drawer-header__hide-btn"> ${!this.summaryScreen&&this.showMinimiseButton?l` <ix-button class="flex w-24" appearance="text" has-icon @click="${this.dispatchDraftToggleEvent}" ?disabled="${this.submitting}" data-testid="hide-drawer-button"> <md-icon class="hide-icon" slot="icon">fullscreen_exit</md-icon> <p class="dlr-text-small hide-text font-bold uppercase">Hide</p> </ix-button> `:x} </div> <div> <slot name="centre-top"></slot> </div> <div class="drawer-header__close-btn"> <div class="${t}"> <md-icon class="font-extralight" @click="${this.summaryScreen?this.dispatchDrawerCloseEvent:this.dispatchDialogToggleEvent}" data-testid="close-drawer-icon">Close</md-icon> </div> </div> </div> <div class="drawer-body"> <slot name="content"></slot> </div> </aside> </div> `):(document.body.style.overflow="auto",document.documentElement.style.overflow="initial",x)}};s([d({type:Boolean})],se.prototype,"isVisible",void 0),s([d({type:Boolean})],se.prototype,"summaryScreen",void 0),s([d({type:Boolean})],se.prototype,"submitting",void 0),s([d({type:Boolean})],se.prototype,"showMinimiseButton",void 0),s([F("aside")],se.prototype,"drawer",void 0),s([F(".drawer-container")],se.prototype,"drawerContainer",void 0),se=s([b("ui-um-drawer")],se);const vs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-body{overflow:hidden;height:100%}.wizard-footer{float:right}.form{height:100%}`,Ut={UpdateForm:"update-form",NextStepWizard:"next-step-wizard",PrevStep:"prev-step-wizard",ButtonToggle:"button-toggle"};let $t=class extends I{constructor(){super(...arguments),this.updateFormBinding=this.updateForm.bind(this),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.wizardForm=new FormData}static get styles(){return[vs,A]}connectedCallback(){super.connectedCallback(),window.addEventListener(Ut.UpdateForm,this.updateFormBinding)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener(Ut.UpdateForm,this.updateFormBinding);const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding)}updateForm(e){e.detail.forEach((t,i)=>this.wizardForm.set(i,t))}handleSlotChange(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.assignedElements().forEach(i=>{i.wizardForm=this.wizardForm})}dispatchButtonToggleEvent(e){this.dispatchEvent(new CustomEvent(Ut.ButtonToggle,{detail:e,bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-body"> <form class="form"> <slot name="wizard-content"></slot> </form> </div> `}};s([d({type:Object})],$t.prototype,"wizardForm",void 0),$t=s([b("ui-um-wizard")],$t);const fs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-step-form{display:flex;flex-direction:column;height:100%}.step{overflow:auto}.wizard-step__btn-group{padding:20px 0;float:right}.input-group{display:flex;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}.textfield{width:100%}.subheading-container{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:36px;margin-top:24px}.submit-btn{width:167.44px}.submit-btn-content{display:flex;align-items:center;flex-direction:row;justify-content:space-between}@media screen and (max-width:600px){.input-group{display:block;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}}`;let re=class extends I{constructor(){super(...arguments),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.stepTitle="",this.stepSubTitle="",this.isRequired=!1,this.isLastStep=!1,this.submitting=!1}static get styles(){return[fs,_e,A]}disconnectedCallback(){var e;super.disconnectedCallback();const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding)}handleSlotChange(){var e,t;const i=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");for(const o of i.assignedNodes())(t=this.form)===null||t===void 0||t.insertBefore(o,i)}dispatchSubmitEvent(e){e.preventDefault(),this.dispatchEvent(new CustomEvent(w.CreateContact,{bubbles:!0,composed:!0}))}render(){return l` <form class="wizard-step-form"> <div class="wizard-step-heading pt-6"> <span class="dlr-text-page-title" data-testid="dlr-text-page-title">${this.stepTitle}</span> <div class="subheading-container"> <span class="dlr-text-heading" data-testid="dlr-text-heading">${this.stepSubTitle}</span> ${this.isRequired?l` <span class="dlr-text-small italic required-field">*denotes required field</span> `:x} ${this.isLastStep?l` <ix-button class="submit-btn" has-icon ?submitting="${this.submitting}" @click="${e=>this.dispatchSubmitEvent(e)}" data-testid="wizard-submit-button"> <div class="submit-btn-content"> Yes, Submit <md-icon class="arrow-forward-icon" slot="icon">arrow_forward</md-icon> </div> </ix-button> `:x} </div> </div> <slot></slot> </form> `}};s([d({type:String})],re.prototype,"stepTitle",void 0),s([d({type:String})],re.prototype,"stepSubTitle",void 0),s([d({type:Boolean})],re.prototype,"isRequired",void 0),s([d({type:Boolean})],re.prototype,"isLastStep",void 0),s([d({type:Boolean})],re.prototype,"submitting",void 0),s([F("form")],re.prototype,"form",void 0),re=s([b("ui-um-wizard-step")],re);const ys=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-dialog{position:absolute;z-index:101}.create-user-wizard{height:100%;display:flex;flex-direction:column}.dlr-text-small.step-progress{letter-spacing:1.25px}@media only screen and (max-width:600px){.success-actions{flex-direction:column;width:100%}.success-actions ix-button{display:block;width:100%}}`;function bs(e,t){const i={id:"root",label:"",children:[],customerKnownSpaceName:""},o=new it,n=structuredClone(e.rolesData.filter(g=>g.locations.length>0).filter(g=>!g.role.removed).flatMap(g=>g.locations)),a=t.data;a&&a.length&&ue(a[0],i),n.forEach(g=>{const h=ze(i,g.id);h&&(h.checked=!0,me(h,i),o.update(i))});const r={label:"",isOpen:!1,rootNode:i},c=[],p=ae.map(g=>{const h=structuredClone(r);return h.updateService=new it,h.updateService.updates=structuredClone(o.nodeUpdates),h.label=g.text,c.push({key:g.text,items:[]}),h});e.genericFlagsData=[...p],e.flagData=c}const xs=e=>({id:e.id,name:e.account_name,status:e.status,accountNumber:e.account_number,displayName:e.account_friendly_name,statusUpdateAt:e.updated_at,statusUpdateBy:e.updated_by}),Nt=e=>{var t;const i=[];return(t=e.account_associations)===null||t===void 0||t.forEach(o=>{i.push(xs(o))}),{id:e.id,firstName:e.first_name,lastName:e.last_name,email:e.email,phone:e.phone,evacAssistance:e.evacuation_assistance_required,accounts:i,status:"Active"}},ws=e=>{var t;const i=[];return(t=e.accounts)===null||t===void 0||t.forEach(o=>{i.includes(o.accountNumber)||i.push(o.accountNumber)}),{first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,account_numbers:i,evacuation_assistance_required:e.evacAssistance}},As=e=>({id:e.id,first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacAssistance}),Cs=e=>({accountNumber:e.accountNumber,includeChildAccounts:!0,page:e.page,size:e.size,firstName:e.firstName,lastName:e.lastName,email:e.email,sort:e.sort,order:e.order}),Ts=e=>{var t,i;const o=[];return(t=e.content)===null||t===void 0||t.forEach(n=>{o.push(Nt(n))}),{contacts:o,recordCount:(i=e.pageable)===null||i===void 0?void 0:i.total_elements}},Is=e=>({id:e.id}),_s=e=>({id:e.id,userProfile:As(e.contactInput)}),ks=e=>({userInput:ws(e.contactInput)});class Es{async update(t){try{const i=_s(t);return v.UsersApi.updateUser(i)}catch(i){return m.handleError("Failed to update user.")}}async create(t){try{const i=ks(t),o=await v.UsersApi.createUser(i);return Nt(o)}catch(i){return m.handleError(i,`Failed to create user for ${t.contactInput.email}`),{}}}async search(t){try{const i=Cs(t),o=await v.UsersApi.getUsers(i);return Ts(o)}catch(i){return m.handleError(i,"Failed to get users."),{}}}async get(t){try{const i=Is(t),o=await v.UsersApi.getUser(i);return Nt(o)}catch(i){return m.handleError(i,"Failed to get user."),{}}}}const Ft=new Es,Oi=(e,t)=>{var i;const o={expanded:!1,id:e.id,label:(i=e.displayName)!==null&&i!==void 0?i:e.name,parentId:t.id};return e.subaccounts&&(o.children=e.subaccounts.map(n=>Oi(n,o))),o},Rs=e=>{const t={expanded:!1,id:"root",label:"",parentId:"",children:[],disabled:!1};return t.children=e.map(i=>Oi(i,t)),t};function zi(e,t){var i;const o={id:e.id,label:(i=e.displayName)!==null&&i!==void 0?i:e.name,parentId:t.id,expanded:!1,checked:!1,indeterminate:!1,children:[]};return e.subaccounts&&(o.children=e.subaccounts.map(n=>zi(n,o))),o}function Ss(e){const t={id:"root",parentId:"",label:"",expanded:!1,checked:!1,children:[]};return e.forEach(i=>t.children.push(zi(i,t))),t}const Us=e=>{const t=It(e);return Rs(t)};let T=class extends I{constructor(){super(...arguments),this.showDrawer=!1,this.success=!1,this.submitting=!1,this.newUserId="",this.permissions=[],this.roles=[],this.treeData=[],this.loading=!1,this.selectedAccountId="",this.selectedRoleId="",this.step=1,this.validatingStepOne=!1,this.newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.dataForAccounts=[],this.showManageUserDialog=!1,this.userId="",this.stepTitle="Add New User",this.isNextButtonEnabled=!1,this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1}connectedCallback(){super.connectedCallback(),this.setupAccountSelector()}get stepOne(){var e,t;return(t=(e=this.renderRoot.querySelector("#step-1"))===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector("create-user-step-one")}setupAccountSelector(){const e=_t().filter(t=>P.hasExternalUserCreate(t.accountNumber));this.accounts=It(e),this.accountTree=Ss(this.accounts),this.permissions=U.getPermissions()}resetStep(){this.handleDialogReset("close")}setStep(e){this.step=e,this.canQuickNavigateSteps={1:!0,2:!0,3:!0,4:!0,5:!0}}resetSteps(e){Object.keys(this.canQuickNavigateSteps).forEach(t=>{e.includes(t)||(this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[t]:!1})})}onNextButtonToggle(e){this.isNextButtonEnabled=e.detail,this.step===1?this.canQuickNavigateSteps={...this.canQuickNavigateSteps,1:!1}:this.step===2?this.resetSteps(["1"]):this.step===3?this.resetSteps(["1","2"]):this.step===4?this.resetSteps(["1","2","3"]):this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[this.step]:!1},this.maxQuickStep=this.step}onPrevStep(){this.step!==1&&(this.step===3&&this.collapseAccountTree(),(this.step===5||this.step===6)&&this.collapseLocationTrees(),this.step===6&&(this.isNextButtonEnabled=!0),this.canQuickNavigateSteps[(this.step-1).toString()]=!0,this.maxQuickStep=Math.max(this.maxQuickStep,this.step),this.step-=1)}onQuickNextStep(){this.canQuickNavigateSteps[this.step]&&this.onNextStep()}async onNextStep(){var e;if(this.isNextButtonEnabled){if(this.loading=!0,this.step===1){if(this.collapseAccountTree(),!this.canQuickNavigateSteps[1]){this.validatingStepOne=!0;const t=await this.validateEmail();if(this.validatingStepOne=!1,!t){this.loading=!1;return}}}else if(this.step===2&&!this.canQuickNavigateSteps[2]){if(!this.accountTree)return;const t=((e=this.checkedAccounts)===null||e===void 0?void 0:e.map(a=>a.id))||[],i=await Ct.getAccountData(t),o=pe.get(),n=Me(this.newContact.email)&&P.hasAssignInternalRoleCreate(U.getAccountNumber());this.roles=[],this.treeData=[];for(let a=0;a<t.length;a+=1){const r=kt(t[a],o,n),c=t[a];this.roles.push({accountId:c,roles:structuredClone(r)}),this.treeData.push({contactId:"",accountNumber:c,roleId:"",data:i[a]})}}else if(this.step===3)this.selectedAccountId=this.dataForAccounts[0].accountId,this.selectedRoleId=this.dataForAccounts[0].rolesData[0].role.id;else if(this.step===4){for(const t of this.dataForAccounts){const i=this.treeData.find(o=>o.accountNumber===t.accountId);i&&bs(t,i)}this.collapseLocationTrees()}else this.step===5&&this.collapseLocationTrees();this.step!==4&&(this.isNextButtonEnabled=!1),this.step+1===this.maxQuickStep&&(this.canQuickNavigateSteps[this.step]=!1),this.loading=!1,this.step+=1}}collapseAccountTree(){this.accountTree&&(this.accountTree.expanded=!1,this.accountTree.children&&this.accountTree.children.forEach(e=>{e.expanded=!1,e.children&&e.children.forEach(t=>{t.expanded=!1})}))}collapseLocationTrees(){this.dataForAccounts.forEach(e=>{var t;e.rolesData.forEach(i=>{qe(i.genericTreeView)}),(t=e.genericFlagsData)===null||t===void 0||t.forEach(i=>{qe(i.rootNode)})})}async validateEmail(){const e=await Ft.search({email:this.newContact.email.split("@")[0]});return e.contacts.find(t=>t.email===this.newContact.email)?(this.userId=e.contacts[0].id,this.toggleManageUserDialog(),!1):!0}handleDialogReset(e){this.step=1,this.newContact={id:"",firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.setupAccountSelector(),this.stepOne&&(this.stepOne.clearTextFields(),this.stepOne.resetErrorStates(),this.stepOne._nextButtonEnabled=!1),this.dataForAccounts=[],this.selectedAccountId="",this.selectedRoleId="",this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1,this.isNextButtonEnabled=!1,this.dispatchResetSuccessEvent(),e==="toggle"?this.dispatchToggleDrawerEvent():this.dispatchDrawerCloseEvent()}updateAccounts(e){var t;this.accountTree=e.detail.rootNode,!((t=this.accountTree)===null||t===void 0)&&t.children&&(this.checkedAccounts=gi(this.accountTree.children,ra(this.accounts||[])),this.dataForAccounts=[])}onUpdateContact(e){const t=e.detail.newContact;this.newContact.email!==t.email&&this.newContact.email!==""&&(this.resetSteps(["1"]),this.dataForAccounts=[]),this.newContact=t}renderWizardStep(){switch(this.step){case 1:return l` <ui-um-wizard-step id="step-1" slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Information"}" data-testid="create-user-step-one"> <create-user-step-one .newContact="${this.newContact}" .validatingForm="${this.validatingStepOne}" @update-contact="${e=>this.onUpdateContact(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-one> </ui-um-wizard-step> `;case 2:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Accounts*"}" data-testid="create-user-step-two"> <create-user-step-two class="flex flex-col overflow-auto grow" .accountTree="${this.accountTree}" @update-accounts="${e=>this.updateAccounts(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-two> </ui-um-wizard-step> `;case 3:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Roles"}" data-testid="create-user-step-three"> <create-user-step-three class="flex flex-col overflow-auto grow" .checkedAccounts="${this.checkedAccounts||[]}" .roles="${this.roles}" .dataForAccounts="${this.dataForAccounts}" .treeData="${this.treeData}" @update-dfa="${e=>{this.dataForAccounts=e.detail.dataForAccounts}}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-three> </ui-um-wizard-step> `;case 4:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Portal Access"}" data-testid="create-user-step-four"> <create-user-step-four class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .selectedRoleId="${this.selectedRoleId}" .permissions="${this.permissions}" .contact="${this.newContact}" @update-dfa="${e=>this.dataForAccounts=e.detail.dataForAccounts}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-four> </ui-um-wizard-step> `;case 5:return l` <ui-um-wizard-step slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Flags"}" data-testid="create-user-step-five"> <create-user-step-five class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .evacAssistanceRequired="${this.newContact.evacAssistance}" @evac-assistance-required="${e=>this.newContact.evacAssistance=e.detail}" @update-flags="${()=>this.canQuickNavigateSteps={...this.canQuickNavigateSteps,5:!1}}" @next-step="${this.onNextStep}"> </create-user-step-five> </ui-um-wizard-step> `;case 6:return l` <ui-um-wizard-step isLastStep slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"Are these details correct?"}" ?submitting="${this.submitting}" @create-contact="${this.dispatchCreateNewContactEvent}" data-testid="create-user-step-six"> <create-user-step-six class="step" .dataForAccounts="${this.dataForAccounts}" .newContact="${this.newContact}" ?submitting="${this.submitting}" @set-step="${e=>this.setStep(e.detail.step)}"></create-user-step-six> </ui-um-wizard-step> `}return x}renderProgress(){return l`<ix-progress slot="wizard-content" indeterminate></ix-progress>`}renderSuccessMessage(){return l` <div data-testid="${k.SUCCESS_CREATED}" slot="content" class="flex flex-col justify-between items-center pt-40 h-96"> <ix-icon data-testid="${k.SUCCESS_ICON}" style="color:#4caf50;font-size:75px;font-weight:700">check_circle</ix-icon> <span data-testid="${k.USER_DETAILS}" class="text-2xl font-bold pb-5">${this.newContact.firstName} ${this.newContact.lastName} Created</span> <div data-testid="${k.SUCCESS_MESSAGE}" class="pb-5"> ${this.newContact.firstName} ${this.newContact.lastName} has been successfully created. </div> <div class="flex justify-between w-400 success-actions"> <ix-button data-testid="${k.VIEW_USER}" appearance="outlined" @click="${this.handleViewUserRedirect}" class="p-1"><span class="font-bold text-sm tracking-wider uppercase">View user</span></ix-button> <ix-button data-testid="${k.BACK_TO_USERS}" appearance="filled" class="p-1" @click="${()=>this.handleDialogReset("close")}"><span class="font-bold uppercase text-sm tracking-wider">Back to users</span></ix-button> </div> </div> `}handleViewUserRedirect(){this.handleDialogReset("close"),Ge(z.UserManagementDetails,`?id=${this.newUserId}`),this.newUserId=""}renderManageUserDialog(){return l` <ix-dialog ?open="${this.showManageUserDialog}"> <div class="dlr-text-heading" slot="headline"> This user already exists for your Master Account </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.handleManageUserDialogClose}" slot="secondary"> Cancel </ix-button> <ix-button appearance="text" @click="${this.handleManageUserRedirect}" slot="primary"> Manage User </ix-button> </div> </ix-dialog> `}toggleManageUserDialog(){this.showManageUserDialog=!this.showManageUserDialog}handleManageUserDialogClose(){this.toggleManageUserDialog(),this.handleDialogReset("close")}handleManageUserRedirect(){this.toggleManageUserDialog(),this.handleDialogReset("close"),Ge(z.UserManagementDetails,`?id=${this.userId}`),this.userId=""}dispatchToggleDrawerEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(w.CloseDrawer,{bubbles:!0,composed:!0}))}dispatchResetSuccessEvent(){this.dispatchEvent(new CustomEvent(w.ResetSuccess,{bubbles:!0,composed:!0}))}dispatchCreateNewContactEvent(){this.dispatchEvent(new CustomEvent(w.CreateNewContact,{detail:{newContact:this.newContact,dataForAccounts:this.dataForAccounts},bubbles:!0,composed:!0}))}renderDrawerControls(){return l` <div slot="centre-top"> <div class="flex"> ${this.success?x:l` <ix-icon-button class="icon-btn_primary" ?disabled="${this.step===1||this.loading}" @click="${()=>this.onPrevStep()}" icon="chevron_left" data-testid="prev-step-icon"> </ix-icon-button> <span class="dlr-text-small uppercase font-bold pt-[10px] px-2 step-progress" data-testid="step-progress"> ${this.step} of 6 </span> <ix-icon-button style="${this.step===6?"visibility: hidden":""}" class="icon-btn_primary ${this.step===6||!this.isNextButtonEnabled||this.loading?"disabled":""}" ?disabled="${!this.canQuickNavigateSteps[this.step]||this.loading}" @click="${()=>this.onQuickNextStep()}" icon="chevron_right" data-testid="next-step-icon"> </ix-icon-button> `} </div> </div> `}render(){return l` <ui-um-drawer ?isVisible="${this.showDrawer}" ?summaryScreen="${this.success}" ?submitting="${this.submitting}" @close-success="${()=>this.handleDialogReset("close")}" data-testid="ui-um-drawer"> ${this.renderDrawerControls()} ${this.success?this.renderSuccessMessage():l` <ui-um-wizard class="create-user-wizard" slot="content" data-testid="create-user-wizard"> ${this.loading?this.renderProgress():this.renderWizardStep()} </ui-um-wizard> `} </ui-um-drawer> ${this.renderManageUserDialog()} `}};T.styles=[ys,A,_e],s([d({type:Boolean})],T.prototype,"showDrawer",void 0),s([d({type:Boolean})],T.prototype,"success",void 0),s([d({type:Boolean})],T.prototype,"submitting",void 0),s([d({type:String})],T.prototype,"newUserId",void 0),s([u()],T.prototype,"accounts",void 0),s([u()],T.prototype,"accountTree",void 0),s([u()],T.prototype,"permissions",void 0),s([u()],T.prototype,"roles",void 0),s([u()],T.prototype,"treeData",void 0),s([u()],T.prototype,"loading",void 0),s([u()],T.prototype,"selectedAccountId",void 0),s([u()],T.prototype,"selectedRoleId",void 0),s([u()],T.prototype,"step",void 0),s([u()],T.prototype,"validatingStepOne",void 0),s([u()],T.prototype,"newContact",void 0),s([u()],T.prototype,"dataForAccounts",void 0),s([u()],T.prototype,"showManageUserDialog",void 0),s([u()],T.prototype,"userId",void 0),s([u()],T.prototype,"stepTitle",void 0),s([u()],T.prototype,"isNextButtonEnabled",void 0),s([u()],T.prototype,"canQuickNavigateSteps",void 0),s([u()],T.prototype,"maxQuickStep",void 0),s([u()],T.prototype,"checkedAccounts",void 0),T=s([b("create-user")],T);const $s=E`.draft-container{display:flex;flex-direction:row;justify-content:space-between;bottom:24px;position:fixed;right:24px;z-index:1200;gap:8px;background-color:#fff;border-radius:16px;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset;align-items:center;padding:16px 24px;width:250px}`;let Be=class extends I{constructor(){super(...arguments),this.header="",this.subText="",this.isVisible=!1}static get styles(){return[$s]}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDraft,{bubbles:!0,composed:!0}))}dispatchDialogToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDialog,{composed:!0}))}render(){return this.isVisible?(document.body.style.overflow="hidden",l` <div class="draft-container"> <div class="draft-text"> <p class="dlr-text-caption text-on-surface-variant">${this.header}</p> <p class="dlr-text-small font-bold">${this.subText}</p> </div> <div class="draft-buttons"> <ix-icon-button filledIcon @click="${this.dispatchDialogToggleEvent}"> <ix-icon filled slot="default" style="color:red">delete</ix-icon> </ix-icon-button> <ix-icon-button appearance="filled" @click="${this.dispatchDraftToggleEvent}"> <ix-icon slot="default">fullscreen</ix-icon> </ix-icon-button> </div> </div> `):(document.body.style.overflow="auto",x)}};s([d({type:String})],Be.prototype,"header",void 0),s([d({type:String})],Be.prototype,"subText",void 0),s([d({type:Boolean})],Be.prototype,"isVisible",void 0),Be=s([b("ix-draft")],Be);const Ns=E`ix-dialog .dialog-content{max-width:560px}`;let ee=class extends Ie{constructor(){super(...arguments),this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.success=!1,this.newUserId="",this.submittingNewUser=!1,this.cancellingCreateUser=!1}static get styles(){return[Ns,le,A]}async createNewContact(e){this.submittingNewUser=!0;const t=e.detail.newContact,i=e.detail.dataForAccounts;i.forEach(({accountId:o})=>{t.accounts.some(({accountNumber:n})=>n===o)||t.accounts.push({accountNumber:o})});try{this.newUserId=await this.createContact(t);const o=[this.createRoleAssignments(i,t.email),this.createUserFlags(i)];(await Promise.allSettled(o)).forEach(n=>{if(n.status==="rejected")throw new Error(n.reason)}),this.dispatchTableRefreshEvent(),this.success=!0}catch(o){this.success=!1}finally{this.submittingNewUser=!1}}async createContact(e){const t=await Ft.create({contactInput:e});if(!(t!=null&&t.id))throw new Error("Failed to create the new user.");return t.id}async createRoleAssignments(e,t){const i=[],o=Me(t);if(e.forEach(({rolesData:n})=>{n.filter(a=>a.role.removed===!1).forEach(a=>{a.locations.forEach(r=>{i.push({roleId:a.role.id,location:r.customerKnownSpaceName,accountNumber:a.accountId,contactId:this.newUserId,isInternal:o})})})}),i.length&&!(await De.create({roleAssignmentInput:i})).length)throw new Error("Failed to assign role(s) to the new user.")}async createUserFlags(e){var t;const i=[];for(const o of e)o.flagData&&((t=o.genericFlagsData)===null||t===void 0||t.forEach(n=>{n.updateService&&n.updateService.updates.forEach(a=>{const r={accountNumber:o.accountId,contactId:this.newUserId,userFlagType:ft(n.label),location:a.customerKnownSpaceName||""};i.push(r)})}));if(i.length&&!(await Pe.create({userFlagAssignmentInput:i})).length)throw new Error("We could not assign the selected flags to the new user.")}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDraft,{composed:!0})),this.dispatchDrawerToggleEvent()}dispatchDrawerToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{composed:!0}))}dispatchTableRefreshEvent(){document.dispatchEvent(new CustomEvent(_.RefreshTable,{composed:!0}))}toggleDialog(){this.dispatchEvent(new CustomEvent(w.ToggleDialog,{composed:!0,bubbles:!0}))}toggleSuccess(){this.success=!this.success}resetSuccess(){this.success=!1}cancelCreateUser(){this.cancellingCreateUser=!0,setTimeout(()=>{var e;(e=this.createUser)===null||e===void 0||e.resetStep(),this.dispatchEvent(new CustomEvent(w.CancelCreateUser,{composed:!0})),this.cancellingCreateUser=!1},50)}renderCancelDialog(){return l` <ix-dialog ?open="${this.showCancelDialog}" @cancel="${this.toggleDialog}" data-testid="dialog-cancel-add-user"> <div class="dlr-text-heading md:w-[560px]" slot="headline"> Are you sure you want to cancel? </div> <div class="dialog-content" slot="content"> <p>All the details provided will be lost.</p> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" ?disabled="${this.cancellingCreateUser}" @click="${this.toggleDialog}" slot="secondary" data-testid="dismiss-close-create-user-button"> Dismiss </ix-button> <ix-button appearance="text" ?submitting="${this.cancellingCreateUser}" @click="${this.cancelCreateUser}" slot="primary" data-testid="cancel-create-user-button"> Cancel adding user </ix-button> </div> </ix-dialog> `}render(){return l` <create-user .newUserId="${this.newUserId}" ?showDrawer="${this.showDrawer}" ?submitting="${this.submittingNewUser}" ?success="${this.success}" @toggle-drawer="${this.dispatchDrawerToggleEvent}" @create-new-contact="${e=>this.createNewContact(e)}" @toggle-success="${this.toggleSuccess}" @reset-success="${this.resetSuccess}" data-testid="um-create-user"></create-user> <ix-draft header="Draft" subText="Add New User" ?isVisible="${this.showDraft}" @toggle-dialog="${this.toggleDialog}"></ix-draft> ${this.renderCancelDialog()} `}};s([d({type:Boolean})],ee.prototype,"showDrawer",void 0),s([d({type:Boolean})],ee.prototype,"showDraft",void 0),s([d({type:Boolean})],ee.prototype,"showCancelDialog",void 0),s([u()],ee.prototype,"success",void 0),s([u()],ee.prototype,"newUserId",void 0),s([u()],ee.prototype,"submittingNewUser",void 0),s([u()],ee.prototype,"cancellingCreateUser",void 0),s([F("create-user")],ee.prototype,"createUser",void 0),ee=s([b("create-user-container")],ee);const qi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}.edit-icon{font-size:22px;align-items:center;padding-right:1px}.email,.first-name,.last-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#edit-profile-id{display:flex;flex-direction:column}.single-row-textbox{width:100%}#edit-profile-id>*{margin:5px 0}ix-textbox,md-textfield{--md-outlined-text-field-width:100%;--md-outlined-text-field-focus-width:100%;width:inherit}.user-profile-name-input-group{display:flex;justify-content:space-between;gap:10px}.user-profile-input{padding-bottom:10px;width:100%}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;class Fs{async getUserProfile(){try{return await v.UserProfileSettingsApi.getUserSettings()}catch(t){m.handleError(t,"Failed to get user profile.");return}}async updateUserProfile(t){try{return await v.UserProfileSettingsApi.userProfilePatch(t)}catch(i){m.handleError(i,"Failed to update user profile.");return}}}const Hi=new Fs;class Ds{constructor(t){(this._host=t).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}getUserProfile(){return Hi.getUserProfile()}updateUserProfile(t){return Hi.updateUserProfile(t)}}var Ps=[{key:"Etc/GMT+12",value:"(UTC-12:00) International Date Line West"},{key:"Etc/GMT+11",value:"(UTC-11:00) Coordinated Universal Time-11"},{key:"America/Adak",value:"(UTC-10:00) Aleutian Islands"},{key:"Pacific/Honolulu",value:"(UTC-10:00) Hawaii"},{key:"Pacific/Marquesas",value:"(UTC-09:30) Marquesas Islands"},{key:"America/Anchorage",value:"(UTC-09:00) Alaska"},{key:"Etc/GMT+9",value:"(UTC-09:00) Coordinated Universal Time-09"},{key:"America/Tijuana",value:"(UTC-08:00) Baja California"},{key:"Etc/GMT+8",value:"(UTC-08:00) Coordinated Universal Time-08"},{key:"America/Los_Angeles",value:"(UTC-08:00) Pacific Time (US, Canada)"},{key:"America/Phoenix",value:"(UTC-07:00) Arizona"},{key:"America/Chihuahua",value:"(UTC-07:00) Chihuahua, La Paz, Mazatlan"},{key:"America/Denver",value:"(UTC-07:00) Mountain Time (US, Canada)"},{key:"America/Whitehorse",value:"(UTC-07:00) Yukon"},{key:"America/Guatemala",value:"(UTC-06:00) Central America"},{key:"America/Chicago",value:"(UTC-06:00) Central Time (US, Canada)"},{key:"Pacific/Easter",value:"(UTC-06:00) Easter Island"},{key:"America/Mexico_City",value:"(UTC-06:00) Guadalajara, Mexico City, Monterrey"},{key:"America/Regina",value:"(UTC-06:00) Saskatchewan"},{key:"America/Bogota",value:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco"},{key:"America/Cancun",value:"(UTC-05:00) Chetumal"},{key:"America/New_York",value:"(UTC-05:00) Eastern Time (US, Canada)"},{key:"America/Port-au-Prince",value:"(UTC-05:00) Haiti"},{key:"America/Havana",value:"(UTC-05:00) Havana"},{key:"America/Indiana/Indianapolis",value:"(UTC-05:00) Indiana (East)"},{key:"America/Grand_Turk",value:"(UTC-05:00) Turks and Caicos"},{key:"America/Asuncion",value:"(UTC-04:00) Asuncion"},{key:"America/Halifax",value:"(UTC-04:00) Atlantic Time (Canada)"},{key:"America/Caracas",value:"(UTC-04:00) Caracas"},{key:"America/Cuiaba",value:"(UTC-04:00) Cuiaba"},{key:"America/La_Paz",value:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan"},{key:"America/Santiago",value:"(UTC-04:00) Santiago"},{key:"America/St_Johns",value:"(UTC-03:30) Newfoundland"},{key:"America/Araguaina",value:"(UTC-03:00) Araguaina"},{key:"America/Sao_Paulo",value:"(UTC-03:00) Brasilia"},{key:"America/Cayenne",value:"(UTC-03:00) Cayenne, Fortaleza"},{key:"America/Argentina/Buenos_Aires",value:"(UTC-03:00) City of Buenos Aires"},{key:"America/Nuuk",value:"(UTC-03:00) Greenland"},{key:"America/Montevideo",value:"(UTC-03:00) Montevideo"},{key:"America/Punta_Arenas",value:"(UTC-03:00) Punta Arenas"},{key:"America/Miquelon",value:"(UTC-03:00) Saint Pierre and Miquelon"},{key:"America/Bahia",value:"(UTC-03:00) Salvador"},{key:"Etc/GMT+2",value:"(UTC-02:00) Coordinated Universal Time-02"},{key:"Atlantic/Azores",value:"(UTC-01:00) Azores"},{key:"Atlantic/Cape_Verde",value:"(UTC-01:00) Cabo Verde Is."},{key:"Etc/UTC",value:"(UTC) Coordinated Universal Time"},{key:"Europe/London",value:"(UTC+00:00) Dublin, Edinburgh, Lisbon, London"},{key:"Atlantic/Reykjavik",value:"(UTC+00:00) Monrovia, Reykjavik"},{key:"Africa/Sao_Tome",value:"(UTC+00:00) Sao Tome"},{key:"Africa/Casablanca",value:"(UTC+01:00) Casablanca"},{key:"Europe/Berlin",value:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"},{key:"Europe/Budapest",value:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"},{key:"Europe/Paris",value:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris"},{key:"Europe/Warsaw",value:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb"},{key:"Africa/Lagos",value:"(UTC+01:00) West Central Africa"},{key:"Asia/Amman",value:"(UTC+02:00) Amman"},{key:"Europe/Bucharest",value:"(UTC+02:00) Athens, Bucharest"},{key:"Asia/Beirut",value:"(UTC+02:00) Beirut"},{key:"Africa/Cairo",value:"(UTC+02:00) Cairo"},{key:"Europe/Chisinau",value:"(UTC+02:00) Chisinau"},{key:"Asia/Damascus",value:"(UTC+02:00) Damascus"},{key:"Asia/Hebron",value:"(UTC+02:00) Gaza, Hebron"},{key:"Africa/Johannesburg",value:"(UTC+02:00) Harare, Pretoria"},{key:"Europe/Kiev",value:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"},{key:"Asia/Jerusalem",value:"(UTC+02:00) Jerusalem"},{key:"Africa/Juba",value:"(UTC+02:00) Juba"},{key:"Europe/Kaliningrad",value:"(UTC+02:00) Kaliningrad"},{key:"Africa/Khartoum",value:"(UTC+02:00) Khartoum"},{key:"Africa/Tripoli",value:"(UTC+02:00) Tripoli"},{key:"Africa/Windhoek",value:"(UTC+02:00) Windhoek"},{key:"Asia/Baghdad",value:"(UTC+03:00) Baghdad"},{key:"Europe/Istanbul",value:"(UTC+03:00) Istanbul"},{key:"Asia/Riyadh",value:"(UTC+03:00) Kuwait, Riyadh"},{key:"Europe/Minsk",value:"(UTC+03:00) Minsk"},{key:"Europe/Moscow",value:"(UTC+03:00) Moscow, St. Petersburg"},{key:"Africa/Nairobi",value:"(UTC+03:00) Nairobi"},{key:"Europe/Volgograd",value:"(UTC+04:00) Volgograd"},{key:"Asia/Tehran",value:"(UTC+03:30) Tehran"},{key:"Asia/Dubai",value:"(UTC+04:00) Abu Dhabi, Muscat"},{key:"Europe/Astrakhan",value:"(UTC+04:00) Astrakhan, Ulyanovsk"},{key:"Asia/Baku",value:"(UTC+04:00) Baku"},{key:"Europe/Samara",value:"(UTC+04:00) Izhevsk, Samara"},{key:"Indian/Mauritius",value:"(UTC+04:00) Port Louis"},{key:"Europe/Saratov",value:"(UTC+04:00) Saratov"},{key:"Asia/Tbilisi",value:"(UTC+04:00) Tbilisi"},{key:"Asia/Yerevan",value:"(UTC+04:00) Yerevan"},{key:"Asia/Kabul",value:"(UTC+04:30) Kabul"},{key:"Asia/Tashkent",value:"(UTC+05:00) Ashgabat, Tashkent"},{key:"Asia/Yekaterinburg",value:"(UTC+05:00) Ekaterinburg"},{key:"Asia/Karachi",value:"(UTC+05:00) Islamabad, Karachi"},{key:"Asia/Qyzylorda",value:"(UTC+05:00) Qyzylorda"},{key:"Asia/Kolkata",value:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"},{key:"Asia/Colombo",value:"(UTC+05:30) Sri Jayawardenepura"},{key:"Asia/Kathmandu",value:"(UTC+05:45) Kathmandu"},{key:"Asia/Almaty",value:"(UTC+06:00) Astana"},{key:"Asia/Dhaka",value:"(UTC+06:00) Dhaka"},{key:"Asia/Omsk",value:"(UTC+06:00) Omsk"},{key:"Asia/Yangon",value:"(UTC+06:30) Yangon (Rangoon)"},{key:"Asia/Bangkok",value:"(UTC+07:00) Bangkok, Hanoi, Jakarta"},{key:"Asia/Barnaul",value:"(UTC+07:00) Barnaul, Gorno-Altaysk"},{key:"Asia/Hovd",value:"(UTC+07:00) Hovd"},{key:"Asia/Krasnoyarsk",value:"(UTC+07:00) Krasnoyarsk"},{key:"Asia/Novosibirsk",value:"(UTC+07:00) Novosibirsk"},{key:"Asia/Tomsk",value:"(UTC+07:00) Tomsk"},{key:"Asia/Shanghai",value:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi"},{key:"Asia/Irkutsk",value:"(UTC+08:00) Irkutsk"},{key:"Asia/Singapore",value:"(UTC+08:00) Kuala Lumpur, Singapore"},{key:"Australia/Perth",value:"(UTC+08:00) Perth"},{key:"Asia/Taipei",value:"(UTC+08:00) Taipei"},{key:"Asia/Ulaanbaatar",value:"(UTC+08:00) Ulaanbaatar"},{key:"Australia/Eucla",value:"(UTC+08:45) Eucla"},{key:"Asia/Chita",value:"(UTC+09:00) Chita"},{key:"Asia/Tokyo",value:"(UTC+09:00) Osaka, Sapporo, Tokyo"},{key:"Asia/Pyongyang",value:"(UTC+09:00) Pyongyang"},{key:"Asia/Seoul",value:"(UTC+09:00) Seoul"},{key:"Asia/Yakutsk",value:"(UTC+09:00) Yakutsk"},{key:"Australia/Adelaide",value:"(UTC+09:30) Adelaide"},{key:"Australia/Darwin",value:"(UTC+09:30) Darwin"},{key:"Australia/Brisbane",value:"(UTC+10:00) Brisbane"},{key:"Australia/Sydney",value:"(UTC+10:00) Canberra, Melbourne, Sydney"},{key:"Pacific/Port_Moresby",value:"(UTC+10:00) Guam, Port Moresby"},{key:"Australia/Hobart",value:"(UTC+10:00) Hobart"},{key:"Asia/Vladivostok",value:"(UTC+10:00) Vladivostok"},{key:"Australia/Lord_Howe",value:"(UTC+10:30) Lord Howe Island"},{key:"Pacific/Bougainville",value:"(UTC+11:00) Bougainville Island"},{key:"Asia/Srednekolymsk",value:"(UTC+11:00) Chokurdakh"},{key:"Asia/Magadan",value:"(UTC+11:00) Magadan"},{key:"Pacific/Norfolk",value:"(UTC+11:00) Norfolk Island"},{key:"Asia/Sakhalin",value:"(UTC+11:00) Sakhalin"},{key:"Pacific/Guadalcanal",value:"(UTC+11:00) Solomon Is., New Caledonia"},{key:"Asia/Kamchatka",value:"(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky"},{key:"Pacific/Auckland",value:"(UTC+12:00) Auckland, Wellington"},{key:"Etc/GMT-12",value:"(UTC+12:00) Coordinated Universal Time+12"},{key:"Pacific/Fiji",value:"(UTC+12:00) Fiji"},{key:"Pacific/Chatham",value:"(UTC+12:45) Chatham Islands"},{key:"Etc/GMT-13",value:"(UTC+13:00) Coordinated Universal Time+13"},{key:"Pacific/Tongatapu",value:"(UTC+13:00) Nuku'alofa"},{key:"Pacific/Apia",value:"(UTC+13:00) Samoa"},{key:"Pacific/Kiritimati",value:"(UTC+14:00) Kiritimati Island"}];const Ms=()=>Ps.map(({key:e,value:t})=>({timeZone:e,displayName:t}));let B=class extends Ie{constructor(){super(...arguments),this.userProfileController=new Ds(this),this.supportedDateFormat={"MM/dd/yyyy":"mm/dd/yyyy (e.g.: 04/24/2023)","dd/MM/yyyy":"dd/mm/yyyy (e.g.: 24/04/2023)","yyyy/MM/dd":"yyyy/mm/dd (e.g.: 2023/04/24)"},this.supportedTimeFormat={"h:mm a":"12-hour clock (e.g. 1:00 PM)","HH:mm":"24-hour clock (e.g. 13:00)"},this.isDialogVisible=!1,this.allowSave=!0,this.isLoading=!1,this.timezones=Ms()}async firstUpdated(){await this.retrieveUserProfile(),this.shouldDisableSaveButton()}async retrieveUserProfile(){this.isLoading=!0,this.userProfile=await this.userProfileController.getUserProfile(),this.isLoading=!1}closeDialog(){this.isDialogVisible=!1,this.dispatchEvent(new CustomEvent("closeEditProfileDialog",{bubbles:!0,composed:!0}))}async saveUserProfileChanges(){var e,t,i,o;const n={profileSettingEditInput:{firstName:(e=q(this.firstName))!==null&&e!==void 0?e:this.firstName.value,lastName:(t=q(this.lastName))!==null&&t!==void 0?t:this.lastName.value,contactPhoneNumber:(i=be(this.phoneNumber))!==null&&i!==void 0?i:this.phoneNumber.value,preferredTimezone:this.preferredTimezone.value,preferredDateFormat:this.preferredDateFormat.value,preferredTimeFormat:this.preferredTimeFormat.value}};((o=this.userProfile)===null||o===void 0?void 0:o.preferredTimezone)!==n.profileSettingEditInput.preferredTimezone&&(n.profileSettingEditInput.timezoneOverridden=!0),this.isLoading=!0,await this.userProfileController.updateUserProfile(n).then(()=>{Jt("Your profile info has been successfully updated",3e3,"center")}),this.saveDateTimeFormatToLocalStorage(n),this.isLoading=!1,this.closeDialog()}validatePhoneInput(e,t){const i=be(e);if(i==="000-000-0000"){e.error=!1,e.errorText="",this.shouldDisableSaveButton();return}if(this.userProfile.contactPhoneNumber=i!=null?i:"",e.required&&!$e(e,i)){this.allowSave=!1;return}if(!vt(e,t)){this.allowSave=!1;return}e.error=!1,e.errorText="",this.shouldDisableSaveButton()}saveDateTimeFormatToLocalStorage(e){localStorage.setItem("date-format",JSON.stringify({preferredDateFormat:e.profileSettingEditInput.preferredDateFormat,preferredTimeFormat:e.profileSettingEditInput.preferredTimeFormat,preferredTimezone:e.profileSettingEditInput.preferredTimezone})),this.dispatchEvent(new CustomEvent("dateFormatChanged",{bubbles:!0,composed:!0}))}shouldDisableSaveButton(){this.allowSave=!(this.isInvalid()||this.isEmpty())}isInvalid(){return this.firstName.error||this.lastName.error||this.phoneNumber.error}isEmpty(){var e,t,i;return!(!((e=this.userProfile)===null||e===void 0)&&e.firstName)||!(!((t=this.userProfile)===null||t===void 0)&&t.lastName)||!(!((i=this.userProfile)===null||i===void 0)&&i.contactPhoneNumber)}render(){var e,t,i,o,n,a,r,c;return l`<ix-dialog class="dialog z-50 relative" ?open="${this.isDialogVisible}" @close="${()=>this.closeDialog()}"> ${this.isLoading?l`<ix-progress indeterminate slot="content"></ix-progress>`:""} <div class="dlr-text-heading flex p-6" slot="headline"> <span>Edit Profile</span> </div> <form class="dialog-form min-w-0 max-w-full max-[640px]:w-screen px-6 pb-5 pt-[0px]" slot="content" id="edit-profile-id" method="dialog"> <div class="user-profile-name-input-group grid grid-cols-1 sm:grid-cols-2 gap-3"> <div class="user-profile-input"> <ix-textbox required id="first-name" class="textbox" type="text" pattern="${Ue.name}" label="First Name" placeholder="i.e. First Name" value="${(t=(e=this.userProfile)===null||e===void 0?void 0:e.firstName)!==null&&t!==void 0?t:""}" @input="${()=>{var p;this.allowSave=gt(this.firstName,this.firstName.value,"Invalid first name"),this.userProfile.firstName=(p=q(this.firstName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> <div class="user-profile-input"> <ix-textbox required id="last-name" class="textbox" type="text" pattern="${Ue.name}" label="Last Name" placeholder="i.e. Last Name" value="${(o=(i=this.userProfile)===null||i===void 0?void 0:i.lastName)!==null&&o!==void 0?o:""}" @input="${()=>{var p;this.allowSave=gt(this.lastName,this.lastName.value,"Invalid last name"),this.userProfile.lastName=(p=q(this.lastName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> </div> <div class="user-profile-input mb-4"> <ix-phone-input required id="phone-number" class="single-row-textbox w-full" label="Phone Number" value="${(a=(n=this.userProfile)===null||n===void 0?void 0:n.contactPhoneNumber)!==null&&a!==void 0?a:""}" @input="${()=>{this.validatePhoneInput(this.phoneNumber,"Invalid phone number")}}"></ix-phone-input> </div> <div class="user-profile-input"> <ix-textbox id="email" class="single-row-textbox" type="email" label="Email Address" readOnly="true" disabled="true" value="${(c=(r=this.userProfile)===null||r===void 0?void 0:r.email)!==null&&c!==void 0?c:""}"></ix-textbox> </div> <div class="user-profile-input"> <ix-select appearance="outlined" id="preferredTimezone" label="Time Zone" menu-positioning="fixed"> ${this.timezones.map(p=>{var g;return l` <ix-select-option value="${p.timeZone}" ?selected="${p.timeZone===((g=this.userProfile)===null||g===void 0?void 0:g.preferredTimezone)}"> <div slot="headline">${p.displayName}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredDateFormat" label="Date format"> ${Object.entries(this.supportedDateFormat).map(([p,g])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredDateFormat)}"> <div slot="headline">${g}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredTimeFormat" label="Time Format"> ${Object.entries(this.supportedTimeFormat).map(([p,g])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredTimeFormat)}"> <div slot="headline">${g}</div> </ix-select-option> `})} </ix-select> </div> </form> <div class="dialog-actions p-2" slot="actions"> <ix-button form="edit-profile-id" appearance="text" text="Cancel" @click="${()=>this.closeDialog()}"> Cancel </ix-button> <ix-button id="save-user-button" appearance="text" text="Save Changes" ?disabled="${!this.allowSave||this.isLoading}" @click="${()=>{this.saveUserProfileChanges()}}"> Save Changes </ix-button> </div> </ix-dialog>`}};B.styles=[qi,A],s([d({type:Boolean})],B.prototype,"isDialogVisible",void 0),s([u()],B.prototype,"allowSave",void 0),s([u()],B.prototype,"userProfile",void 0),s([u()],B.prototype,"isLoading",void 0),s([u()],B.prototype,"timezones",void 0),s([F("#first-name")],B.prototype,"firstName",void 0),s([F("#last-name")],B.prototype,"lastName",void 0),s([F("#phone-number")],B.prototype,"phoneNumber",void 0),s([F("#preferredTimezone")],B.prototype,"preferredTimezone",void 0),s([F("#preferredDateFormat")],B.prototype,"preferredDateFormat",void 0),s([F("#preferredTimeFormat")],B.prototype,"preferredTimeFormat",void 0),B=s([b("ui-um-user-profile")],B);class Bs{async getAuthorisation(){const t=await Ct.getState(),[i,o,n,a]=t;return[i,o,n,a]}}const Ls=new Bs;class Os extends Ae{constructor(){super(...arguments),this.expandedNodes=[]}toggleNodeExpanded(t){this.expandedNodes.includes(t)?this.expandedNodes=this.expandedNodes.filter(i=>i!==t):this.expandedNodes.push(t)}async refresh(){this.requestHydration(),this.set(us(this.expandedNodes)),this.completeHydration()}}const Vi=new Os({});let O=class extends Ie{constructor(){super(),this.errorService=m,this.routes=[],this.baseUrl="",this.isStandalone=!1,this.disableAuthentication=!1,this.compact=localStorage.getItem("compact")==="true",this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.isEditUserProfileDialogOpen=!1,this.handleDrawerEventBinding=this.handleDrawerEvent.bind(this),this.handleCloseEditProfileDialogBinding=this.handleCloseEditProfileDialog.bind(this),this.handleAccountSwitchBinding=this.handleAccountSwitch.bind(this),this.handleEditProfileEventBinding=this.handleEditProfileEvent.bind(this),U.setLoading=!0}connectedCallback(){super.connectedCallback(),window.addEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.addEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.addEventListener(_.EditProfile,this.handleEditProfileEventBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.removeEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.removeEventListener(_.EditProfile,this.handleEditProfileEventBinding),Jn(),m.destroyErrorHandler()}async handleAccountSwitch(e){const t=e.detail;U.setAccountNumber(t),await this.fetchData();const i=window.location.href.split("?")[0];window.history.replaceState({},document.title,i)}handleDrawerEvent(){this.toggleDrawer()}async firstUpdated(){await this.configureAuthentication(),await this.fetchData(),this.init(),U.setLoading=!1}updated(e){e.has("routes")&&this.routes.length&&Kn().setRoutes(this.routes)}async fetchData(){const e=fe.getUserDetails(),{email:t}=e;return Ls.getAuthorisation().then(i=>{const[o,n,a,r]=i;return U.setMyPermissions(o),P.myPermissions=U.getMyPermissions(),U.setEmail(t),U.setPermissions(n),U.setAccounts(r),pe.set(a),Vi.refresh(),i})}async configureAuthentication(){this.disableAuthentication||D().UserManagement.UI.DisableUserManagementUIAuth||!this.isStandalone?await this.configureAuthorisation():fe.isProcessing()||(fe.isLoggedIn()?await this.configureAuthorisation():fe.redirectToAuth())}async configureAuthorisation(){const e=fe.getUserDetails(),{accountNumber:t}=e;U.setAccountNumber(t)}init(){setTimeout(()=>{this.mainApp&&(Gn(this.mainApp,this.baseUrl,ci),Se(window,_.AuthenticationComplete,{accountNumber:U.getAccountNumber()}))})}toggleDrawer(){this.showDraft&&(this.showDraft=!this.showDraft),this.showDrawer=!this.showDrawer}closeDrawer(){this.showDrawer=!1}toggleCompact(){this.compact=!this.compact,localStorage.setItem("compact",`${this.compact}`)}toggleDraft(){this.showDrawer=!this.showDrawer,this.showDraft=!this.showDraft}cancelCreateUser(){this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1}toggleCancelDialog(){this.showCancelDialog=!this.showCancelDialog}renderCreateUser(){return P.hasExternalUserCreate()?l` <create-user-container ?showDrawer="${this.showDrawer}" ?showDraft="${this.showDraft}" ?showCancelDialog="${this.showCancelDialog}" @blur-drawer="${this.toggleCancelDialog}" @toggle-drawer="${this.toggleDrawer}" @toggle-draft="${this.toggleDraft}" @toggle-dialog="${this.toggleCancelDialog}" @close-drawer="${this.closeDrawer}" @cancel-create-user="${this.cancelCreateUser}"></create-user-container> `:x}renderLoading(){return U.getLoading?l` <main> <error-dialog></error-dialog> <ix-progress id="application-loading-bar" aria-label="Application loading bar" indeterminate></ix-progress> </main> `:x}handleEditProfileEvent(){this.isEditUserProfileDialogOpen=!0}handleCloseEditProfileDialog(){this.isEditUserProfileDialogOpen=!1}renderEditProfileForm(){return l` <ui-um-user-profile ?isDialogVisible="${this.isEditUserProfileDialogOpen}" @closeEditProfileDialog="${this.handleCloseEditProfileDialogBinding}"></ui-um-user-profile>`}render(){return l` ${this.renderCreateUser()} <div class="flex flex-col"> <div class="animate-width absolute inset-0 bg-black opacity-50 z-20 ${this.compact?"hidden":"block"} lg:hidden" @click="${this.toggleCompact}" @keypress="${this.toggleCompact}"></div> ${this.isStandalone?l` <nav class="nav-bar wide p-4 m-2 rounded-xl flex items-center relative z-1 md:hidden"> <div class="flex-1"> <ix-icon-button @click="${this.toggleCompact}" icon="menu" class="white-icon"></ix-icon-button> </div> <div class="w-[178px]"> <svg focusable="false" viewBox="0 0 178 27" fill="white" class="w-full"> ${He.digitalRealtyLogoWithText} </svg> </div> <div class="flex-1"></div> </nav> `:x} <div class="w-full h-full flex relative ${this.showDrawer?"drawer-visible":""}"> ${this.isStandalone?l` <div class="${this.compact?"left-[-200px]":"left-0"} min-w-[96px] absolute z-1 md:relative lg:min-w-fit md:left-0 animate-width h-screen"> <navigation-bar @toggle-menu="${this.toggleCompact}" ?compact="${this.compact}" class="h-full p-2 block absolute drop-shadow-lg overflow-auto sm:overflow-visible lg:static lg:p-4"></navigation-bar> </div> `:x} <div class="grow w-full h-full"> <div class="flex flex-col grow h-full ${this.isStandalone?"p-2 lg:p-4":""}"> ${this.isStandalone?l`<app-header @create-user="${this.toggleDrawer}"></app-header>`:x} <main class="h-full">${this.renderLoading()}</main> </div> </div> </div> </div> ${this.renderEditProfileForm()}`}};O.styles=[Wt,_e,A],s([d({type:Array})],O.prototype,"routes",void 0),s([d({type:String})],O.prototype,"baseUrl",void 0),s([d({type:Boolean})],O.prototype,"isStandalone",void 0),s([d({type:Boolean,attribute:!0})],O.prototype,"disableAuthentication",void 0),s([d({type:Boolean,attribute:!1})],O.prototype,"compact",void 0),s([u()],O.prototype,"showDrawer",void 0),s([u()],O.prototype,"showDraft",void 0),s([u()],O.prototype,"showCancelDialog",void 0),s([u()],O.prototype,"isEditUserProfileDialogOpen",void 0),s([F("main")],O.prototype,"mainApp",void 0),O=s([b("ui-user-management")],O);export{_ as A,Ae as B,Pe as C,St as D,ot as E,ds as F,it as G,kt as H,Me as I,qa as J,Ui as K,Ii as L,qi as M,mt as N,Xn as O,gt as P,vt as Q,z as R,be as S,A as T,Xe as U,Yn as V,sa as W,Ue as X,ia as Y,Zn as a,V as b,pe as c,Ft as d,Zt as e,Vi as f,je as g,U as h,oa as i,q as j,m as k,_t as l,ta as m,Ge as n,Us as o,wt as p,Jt as q,Se as r,Ke as s,De as t,P as u,ri as v,D as w,Ye as x,Ri as y,Fe as z};
|
|
2005
|
+
`;class it{}it.BTN_ADD_ROLE="user-details-tab-roles-btn-add-role",it.BTN_REMOVE_ROLE="user-details-tab-roles-btn-remove-role";const Rt={RoleSelect:"role-select",OpenRoleMenu:"open-role-menu",RemoveRoleMenu:"open-remove-role-menu"};let Y=class extends I{constructor(){super(...arguments),this.disableEscapeKeyBinding=this.disableEscapeKey.bind(this),this.assignedRoles=[],this.activeRoleId="",this.canAddRoles=!1,this.addRolesDisabled=!1,this.canRemoveRoles=!1,this.removeRolesDisabled=!1}connectedCallback(){super.connectedCallback(),this.tabs&&this.tabs.addEventListener("keydown",this.disableEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.tabs&&this.tabs.removeEventListener("keydown",this.disableEscapeKeyBinding)}disableEscapeKey(e){return e.which===27?!1:null}handleRoleClick(e,t){this.dispatchEvent(new CustomEvent(Rt.RoleSelect,{detail:{roleId:t},bubbles:!0,composed:!0})),e.target.scrollIntoView({inline:"center",behavior:"smooth",block:"nearest"})}dispatchOpenRoleMenu(){this.dispatchEvent(new CustomEvent(Rt.OpenRoleMenu,{bubbles:!0,composed:!0}))}dispatchOpenRemoveRoleMeu(){this.dispatchEvent(new CustomEvent(Rt.RemoveRoleMenu,{bubbles:!0,composed:!0}))}setActiveRole(e){this.tabs&&(this.tabs.activeTabIndex=this.assignedRoles.findIndex(t=>t.id===e))}renderAddRoleButton(){return this.canAddRoles?l` <ix-button data-testid="${it.BTN_ADD_ROLE}" appearance="text" @click="${()=>this.dispatchOpenRoleMenu()}" class="primary" aria-label="Add Role" ?disabled="${this.addRolesDisabled}" has-icon> <md-icon slot="icon">add</md-icon> Add Role </ix-button> `:x}renderRemoveRoleButton(){return this.canRemoveRoles?l` <ix-button data-testid="${it.BTN_REMOVE_ROLE}" appearance="outlined" .disabled="${this.removeRolesDisabled}" @click="${()=>this.dispatchOpenRemoveRoleMeu()}" class="cancel"> <span>REMOVE ROLE</span> </ix-button> `:x}renderRole(e){return e?l`<ix-primary-tab data-testid="ix-tab-role-${e.id}" @click="${t=>this.handleRoleClick(t,e.id)}" ?activeDisabled="${e.id===this.activeRoleId}"><span id="${`role-tab-${e.id}`}" class="font-bold flex items-center uppercase">${e.name}</span> </ix-primary-tab>`:x}render(){return l` <div class="tab-container"> <div class="flex gap-4 max-w-full overflow-hidden tab-outer-wrapper"> <div class="flex-1 overflow-auto tab-inner-wrapper"> <ix-tabs data-testid="ix-tabs-roles" id="roles-tabs" .scrollButtons="${this.assignedRoles.length>1}" hideScrollBar left-align="true"> ${this.assignedRoles.map(e=>this.renderRole(e))} </ix-tabs> </div> <div class="flex items-center gap-4 shrink-0 tab-inner-wrapper"> ${this.renderAddRoleButton()} ${this.renderRemoveRoleButton()} </div> </div> </div> `}};Y.styles=[Xe,et,A,ce,hs],s([d({type:Array,attribute:!1})],Y.prototype,"assignedRoles",void 0),s([d({type:String,attribute:!1})],Y.prototype,"activeRoleId",void 0),s([d({type:Boolean})],Y.prototype,"canAddRoles",void 0),s([d({type:Boolean})],Y.prototype,"addRolesDisabled",void 0),s([d({type:Boolean})],Y.prototype,"canRemoveRoles",void 0),s([d({type:Boolean})],Y.prototype,"removeRolesDisabled",void 0),s([U("#roles-tabs")],Y.prototype,"tabs",void 0),Y=s([b("user-details-tab-roles")],Y);const Fi=e=>$.getAccounts().find(t=>t.accountNumber===e),Di=(e,t)=>{const i=e.filter(o=>o.parentAccountNumber===t);return i.length?i.flatMap(o=>({id:o.accountNumber,name:o.name,displayName:o.displayName,subaccounts:Di(e,o.accountNumber)})):[]},ot=e=>{try{const t=e.map(o=>o.accountNumber),i=e.filter(o=>!t.includes(o.parentAccountNumber||""));if(!i)throw new Error("Failed to get nested account structure");return i.map(o=>({id:o.accountNumber,name:o.name,displayName:o.displayName,subaccounts:Di(e,o.accountNumber)}))}catch(t){return console.error("Could not get nested account structure",t),[]}},St=()=>$.getAccounts().sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),Pi=e=>pe.get().find(t=>t.id===e)||null,ms=e=>{const t=[],i=[...new Set(e.map(o=>o.roleId))];for(const o of i){const n=Pi(o);n&&t.push(n)}return t},Mi=e=>{var t;return{label:(t=e.displayName)!==null&&t!==void 0?t:e.name,id:e.id,children:e.subaccounts.map(i=>Mi(i))}},Bi=(e,t)=>{e.children&&e.children.length&&e.children.forEach(o=>Bi(o,t));const i=t.filter(o=>e.id===o.accountNumber).map(o=>({label:o.name,id:o.id,children:void 0}));e.children&&(e.children=i.concat(e.children))},gs=e=>{const t=[],i=St().filter(r=>P.hasCustomRolesRead(r.accountNumber)||P.hasCustomRolesCreate(r.accountNumber)||P.hasCustomRolesUpdate(r.accountNumber)||P.hasCustomRolesApprove(r.accountNumber)),o=ot(i);o.forEach(r=>t.push(Mi(r)));const n=pe.get().filter(r=>r.roleType===V.Custom);t.forEach(r=>{Bi(r,n),r.expanded=e.includes(r.id)});const a=o.some(r=>!!r.subaccounts.length);return{tree:{label:"root",id:"root",children:t},isEndChild:!a&&i.length<=1}},$t=(e,t,i=!1)=>{let o=t.filter(n=>n.accountNumber===e||n.roleType===V.Default||n.roleType===V.Internal||n.roleType===V.GlobalAccess);return i||(o=o.filter(n=>n.roleType!==V.Internal&&n.roleType!==V.GlobalAccess)),o};class J{}J.HEADING="add-account-role-dialog-heading",J.ROLE_SELECTOR="add-account-role-dialog-role-selector",J.ROLE_OPTION=e=>`add-account-role-dialog-role-option-${e}`,J.BTN_CANCEL="add-account-role-dialog-cancel-button",J.BTN_ADD="add-account-role-dialog-add-role-button",J.SUCCESS_MESSAGE="add-account-role-dialog-success-message";function Me(e){return D().InternalUserDomainWhitelist.split(",").some(t=>e==null?void 0:e.includes(t))}let j=class extends I{constructor(){super(...arguments),this.roles=[],this.assignedRoles=[],this.isOpen=!1,this.loading=!1,this.roleId="",this.disabled=!0,this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.handleCancelChangesBinding=this.handleCancelChanges.bind(this)}get name(){var e,t;return`${(e=this.contact)===null||e===void 0?void 0:e.firstName} ${(t=this.contact)===null||t===void 0?void 0:t.lastName}`}get addableRoles(){var e,t,i;if(!(!((e=this.account)===null||e===void 0)&&e.accountNumber))return[];const o=Me((t=this.contact)===null||t===void 0?void 0:t.email)&&P.hasAssignInternalRoleCreate((i=this.account)===null||i===void 0?void 0:i.accountNumber);return $t(this.account.accountNumber,this.roles,o)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding),this.addEventListener("blur",this.handleCancelChangesBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding),this.removeEventListener("blur",this.handleCancelChangesBinding)}handleEscapeKey(e){return e.which===27&&(this.isOpen=!1),null}async handleOpenDialog(){this.isOpen=!0;const e=await this.rolesMenu;e==null||e.reset(),this.disabled=!0}async handleConfirmChanges(){this.dispatchEvent(new CustomEvent(_.AddRole,{detail:{roleId:this.roleId}}))}async handleCancelChanges(){this.isOpen=!1}handleRoleSelect(e){e&&(this.disabled=!1)}renderRoleOptions(){return l` ${this.addableRoles.map((e,t)=>l` <ix-select-option class="option" value="${t}" ?disabled="${this.assignedRoles.some(i=>i.id===e.id)}" @click="${()=>{this.roleId=this.addableRoles[t].id}}" data-testid="${J.ROLE_OPTION(e.name)}"> <div slot="headline">${e.name}</div> </ix-select-option>`)} `}renderHeader(){var e;return l` <div id="confirmation-header" slot="headline" style="max-width:560px" data-testid="${J.HEADING}"> <h1 class="dlr-text-heading break-words"> Add Role to ${this.name} for ${(e=this.account)===null||e===void 0?void 0:e.name} </h1> </div>`}renderContent(){return l` <div slot="content" method="dialog"> <form slot="content" style="padding-top:0" id="add-role-to-roles" method="dialog"> <ix-select quick menu-below class="thick" id="roles-menu" menu-positioning="fixed" @input="${e=>this.handleRoleSelect(e.target.value)}" data-testid="${J.ROLE_SELECTOR}"> ${this.renderRoleOptions()} </ix-select> </form> </div>`}renderFooter(){return l` <div class="add-roles-dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="Cancel" ?disabled="${this.loading}" @click="${()=>this.handleCancelChanges()}" data-testid="${J.BTN_CANCEL}"> Cancel </ix-button> <ix-button id="add-account-button" form="confirm-updates" appearance="text" text="Add Role" ?disabled="${this.disabled}" ?submitting="${this.loading}" @click="${this.handleConfirmChanges}" data-testid="${J.BTN_ADD}">Add Role </ix-button> </div> `}render(){return l` <ix-dialog class="z-50 relative" id="add-role-to-account" ?open="${this.isOpen}"> ${this.renderHeader()} ${this.renderContent()} ${this.renderFooter()} </ix-dialog>`}};j.styles=[Xe,et,A],s([d({type:Object})],j.prototype,"contact",void 0),s([d({type:Object})],j.prototype,"account",void 0),s([d({type:Array})],j.prototype,"roles",void 0),s([d({type:Array})],j.prototype,"assignedRoles",void 0),s([d({type:Boolean,reflect:!0})],j.prototype,"isOpen",void 0),s([u()],j.prototype,"loading",void 0),s([u()],j.prototype,"roleId",void 0),s([u()],j.prototype,"disabled",void 0),s([eo("#roles-menu")],j.prototype,"rolesMenu",void 0),j=s([b("add-account-role")],j);const Ut=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.cards-container{display:flex;flex-wrap:wrap}.cards-container>:first-child{padding:8px 8px 8px 0}.cards-container>:not(:first-child){padding:8px}.tree-role-locations-count{margin:0;color:rgba(9,34,65,.3);padding-right:20px;text-transform:uppercase;font-weight:700}.tree-role-locations-count-active{margin:0;padding-right:40px;text-transform:uppercase;font-weight:700;font-size:.875rem;font-family:var(--root-secondary-font)}.assign-portal-access-text{font-family:Open Sans;font-weight:400;font-size:12px;line-height:16px;letter-spacing:.4px;color:#092241B2;margin-top:.25rem;margin-bottom:1rem}ix-button{font-family:var(--root-secondary-font)}.remove{color:#db0028}.permissions-content{width:800px}.dismiss-btn{color:#1456e0}@media only screen and (max-width:600px){#next-button{display:inline-block}.next-control{text-align:center}.tree-view-container-footer{padding-bottom:1rem}.permissions-content{width:auto}.cards-container{display:flex;flex-wrap:nowrap;max-width:100%;overflow-x:auto}}@media only screen and (min-width:601px){.permissions-locations{display:flex;justify-content:space-between;align-items:center;width:100%}.controls{display:flex;justify-content:space-between;align-items:center}}@media only screen and (max-width:600px){.cards-container{flex-wrap:unset;overflow-x:auto}.tree-role-locations{margin-top:-3px!important}.tree-role-locations-count,.tree-role-locations-count-active{font-size:.875rem!important}}`,vs={ToggleActiveCard:"toggle-active-card"};let Te=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.isRoles=!1}dispatchToggleActiveCard(e){this.dispatchEvent(new CustomEvent(vs.ToggleActiveCard,{detail:{accountId:e},bubbles:!0,composed:!0}))}renderCards(){return this.dataForAccounts.map(e=>{if(this.isRoles){const i=e.rolesData.filter(o=>o.role.removed===!1).map(o=>o.role.name);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${i}" .type="${"roles"}" ?isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${o=>{this.dispatchToggleActiveCard(o.detail)}}"></ix-card> `}const t=oe.map(i=>i.text);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${t}" .type="${"flags"}" .isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${i=>{this.dispatchToggleActiveCard(i.detail)}}"></ix-card> `})}render(){return l`<div class="cards-container">${this.renderCards()}</div> `}};Te.styles=[Ut,A,_e,ce],s([d({type:Array})],Te.prototype,"dataForAccounts",void 0),s([d({type:String})],Te.prototype,"selectedAccountId",void 0),s([d({type:Boolean})],Te.prototype,"isRoles",void 0),Te=s([b("account-tabbing-card")],Te);class nt{constructor(){this.updates=[]}get nodeUpdates(){return this.updates}update(t){this.updates=[];let i=[];t&&(i=mo(t));for(const o of i)o.originalCheckedStatus!==o.checked&&this.updates.push(o)}}class Li{constructor(){this._nodeUpdates=[]}create(t){if(this._nodeUpdates.find(o=>o.key===t))return;const i=new nt;this._nodeUpdates.push({key:t,item:i})}update(t,i){const o=this._nodeUpdates.find(n=>n.key===t);o==null||o.item.update(i)}get nodeUpdates(){return this._nodeUpdates}get isDirty(){let t=0;return this._nodeUpdates.forEach(i=>{t+=i.item.nodeUpdates.length}),t>0}get nodeChanges(){const t=[];return this._nodeUpdates.forEach(i=>{i.item.nodeUpdates.length>0&&i.item.nodeUpdates.forEach(o=>{const n=t.find(a=>a.key===i.key);n?n.items.push(o):t.push({key:i.key,items:[o]})})}),t}reset(){this._nodeUpdates=[]}remove(t){this._nodeUpdates=this._nodeUpdates.filter(i=>i.key!==t)}}function Nt(e,t){var i,o;const n=[],a=t.toLowerCase().trim();if(a.length<2||((!((i=e.label)===null||i===void 0)&&i.toLowerCase().includes(a)||!((o=e.secondaryLabel)===null||o===void 0)&&o.toLowerCase().includes(a))&&n.push(e),!e.children))return n;for(const r of e.children){const c=Nt(r,t);n.push(...c)}return n}function Oi(e,t,i){if(e==="previous"){const o=i.indexOf(t)-1,n=o<0?i.length-1:o;return i[n]}if(e==="next"){const o=i.indexOf(t)+1,n=o>=i.length?0:o;return i[n]}}function zi(e,t){const i=[];for(const o of t){i.push(o.id),o.selected=!0;let n=ze(e,o.id);for(;n!=null&&n.parentId;)n=ze(e,n.parentId),n&&(n.expanded=!0)}return i}function Ft(e){e.selected=!1,e.children&&e.children.forEach(t=>{Ft(t)})}class fs{constructor(){this._dataCollection=new Map}capture(t){var i;let o;const n=this._dataCollection.get(t);return n&&(o=fi(n.data),!((i=n.options)===null||i===void 0)&&i.consume&&this._dataCollection.delete(t)),o}emit(t,i){i.options={lock:!1,consume:!0,...i.options},this._store(t,i)}lock(t){const i=this._dataCollection.get(t);i&&(i.options.lock=!0)}remove(t){this._dataCollection.delete(t)}_store(t,i){var o;const n=this._dataCollection.get(t);return n&&!((o=n.options)===null||o===void 0)&&o.lock?!1:(this._dataCollection.set(t,fi(i)),!0)}}const at=new fs;class ys extends Ae{}const Dt=new ys({});let N=class extends I{constructor(){super(...arguments),this.searching=!1,this.disableTree=!1,this.readonly=!1,this.activeRoleId="",this.searchResultCount=0,this.searchResultIndex=0,this.selectedIds=[],this.loadingNodes=!1,this.assignmentUpdateManagers=[],this.searchText="",this.onSearchTextChange=Zt(async e=>{var t;this.searchText=e.detail.searchText;const i=(t=this.assignment)===null||t===void 0?void 0:t.rootNode;Ft(i);const o=Nt(i,this.searchText);o.length&&qe(i),this.searchResultCount=o.length;const n=zi(i,o);[this.selectedId]=n,this.selectedIds=[...n],this.searchResultIndex=n.indexOf(this.selectedId)+1,this.requestUpdate()},500)}updated(e){super.updated(e),e.has("activeRoleId")&&this.handleNonLocationTrees()}disconnectedCallback(){super.disconnectedCallback(),this.emitUpdates()}emitUpdates(){var e,t;const i=Dt.get(),o=(e=this.assignmentUpdateManagers.find(c=>c.accountId===i.accountNumber))===null||e===void 0?void 0:e.nodeManager,n=o==null?void 0:o.nodeUpdates.flatMap(c=>c.item.nodeUpdates);if(!(i!=null&&i.accountNumber)&&!o)return;const a={data:n||[],options:{consume:!1}},r=`${i.accountNumber}:${(t=this.contact)===null||t===void 0?void 0:t.id}`;at.emit(r,a)}dispatchCheckToggleEvent(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{updates:structuredClone(e)}}}))}handleNonLocationTrees(){const e=pe.get().find(n=>{var a;return n.id===((a=this.assignment)===null||a===void 0?void 0:a.role)});if(!e||!this.assignment)return;if(!e.permissions.every(n=>n.isNonLocation)){this.disableTree=!1;return}const t=this.assignment.rootNode.children[0];t.checked=!0,this.disableTree=!0,me(t,this.assignment.rootNode);const i=this.getOrCreateNodeManager();if(!i)return;const o=i.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});o&&(o.item.update(this.assignment.rootNode),this.dispatchCheckToggleEvent(i.nodeChanges))}onTreeCheckToggle(e){var t;try{const i=this.getOrCreateNodeManager();if(!i)throw new Error("Node manager is missing.");const o=i.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});o&&o.item.update(e.detail.message.rootNode),!((t=this.assignment)===null||t===void 0)&&t.rootNode&&(this.assignment.rootNode=structuredClone(e.detail.message.rootNode)),this.dispatchCheckToggleEvent(i.nodeChanges)}catch(i){m.handleError(i,"Failed to toggle tree check.")}}async onTreeExpandToggle(e){var t,i;try{const o=e.detail.message.update,n=e.detail.message.node;if(n.children&&n.children.length)return;if(!this.contact.id||!this.accountNumber)throw new Error("Contact ID or Account Number is missing.");n.loading=!0;const a=await ja((t=this.assignment)===null||t===void 0?void 0:t.role,this.contact.id,this.accountNumber,n.id,void 0,!0,Me((i=this.contact)===null||i===void 0?void 0:i.email));n.loading=!1,a[0].inventoryItems&&a[0].inventoryItems.length&&(a[0].inventoryItems.forEach(r=>{re(r,n),n.originalCheckedStatus!==n.checked&&me(n,n)}),o())}catch(o){m.handleError(o,"Failed to expand tree node.")}}destroyRoleManager(){const e=this.assignmentUpdateManagers.find(t=>t.accountId===this.accountNumber);e&&(e.nodeManager.reset(),this.assignmentUpdateManagers=this.assignmentUpdateManagers.filter(t=>t.accountId!==this.accountNumber))}getOrCreateNodeManager(){var e;let t;try{if(!this.accountNumber)throw new Error("Account number is missing.");t=(e=this.assignmentUpdateManagers.find(i=>i.accountId===this.accountNumber))===null||e===void 0?void 0:e.nodeManager,t||(this.assignmentUpdateManagers.push({accountId:this.accountNumber,nodeManager:new Li}),t=this.assignmentUpdateManagers.find(i=>i.accountId===this.accountNumber).nodeManager)}catch(i){m.handleError(i,"Failed to get or create node manager.")}return t}disableCheckboxes(){return this.readonly?!0:this.disableTree}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=Oi(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;const t=this.getOrCreateNodeManager();return t&&this.assignment&&t.create(this.assignment.role),l` <div class="flex items-center py-[0.75rem]"> <h1 class="dlr-text-heading">Portal Access</h1> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <ix-generic-tree data-testid="location-treeview" .rootNode="${(e=this.assignment)===null||e===void 0?void 0:e.rootNode}" .searchText="${this.searchText}" .selectedId="${this.selectedId}" .showCheckboxes="${!0}" .disableCheckboxes="${this.disableCheckboxes()}" @search-text-change="${this.onSearchTextChange}" @search-navigation="${i=>this.onSearchNavigation(i)}" @check-toggle="${i=>this.onTreeCheckToggle(i)}" @expand-toggle="${i=>this.onTreeExpandToggle(i)}" searchEnabled .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};N.styles=[A,E`:host{--md-circular-progress-size:28px}`],s([d({type:Object,attribute:!1})],N.prototype,"assignment",void 0),s([d({type:Object})],N.prototype,"contact",void 0),s([d({type:String})],N.prototype,"accountNumber",void 0),s([d({type:String})],N.prototype,"selectedId",void 0),s([d({type:Boolean})],N.prototype,"searching",void 0),s([d({type:Boolean})],N.prototype,"disableTree",void 0),s([d({type:Boolean})],N.prototype,"readonly",void 0),s([d({type:String})],N.prototype,"activeRoleId",void 0),s([u()],N.prototype,"searchResultCount",void 0),s([u()],N.prototype,"searchResultIndex",void 0),s([u()],N.prototype,"selectedIds",void 0),s([u()],N.prototype,"loadingNodes",void 0),s([u()],N.prototype,"assignmentUpdateManagers",void 0),s([u()],N.prototype,"searchText",void 0),N=s([b("user-details-assignments")],N);let F=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.permissions=[],this._dataForAccounts=[],this.showPermissionsDialog=!1,this.removeRoleDialogOpen=!1,this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId,this._selectedRoleId=this.selectedRoleId,this.validateStep(),this.dispatchValidateStepEvent(),this.setInitialRole()}get noOfLocations(){var e;return jt((e=this.selectedRoleData)===null||e===void 0?void 0:e.genericTreeView)}get canAddRolesDisabled(){return this.unAvailableRoles&&this.unAvailableRoles.length<=0}get availableRoles(){const e=this._dataForAccounts.find(i=>i.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(i=>i.role.removed===!1);return t==null?void 0:t.flatMap(i=>i.role)}get unAvailableRoles(){const e=this._dataForAccounts.find(i=>i.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(i=>i.role.removed===!0);return t==null?void 0:t.flatMap(i=>i.role)}get roles(){const e=this._dataForAccounts.find(t=>t.accountId===this._selectedAccountId);return e==null?void 0:e.rolesData.flatMap(t=>t.role)}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}get selectedRole(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId).role}get selectedRolePermissions(){var e,t;return(t=(e=this._dataForAccounts.find(i=>i.accountId===this._selectedAccountId))===null||e===void 0?void 0:e.rolesData.find(i=>i.role.id===this._selectedRoleId))===null||t===void 0?void 0:t.role.permissions}get selectedRoleData(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId)}toggleActiveCard(e){var t;this._selectedAccountId=e,this._selectedRoleId=(t=this._dataForAccounts.find(i=>i.accountId===e))===null||t===void 0?void 0:t.rolesData[0].role.id,this._dataForAccounts.forEach(i=>{i.accountId!==e?i.active=!1:i.active=!0}),this.roleTabComponent.setActiveRole(this._selectedRoleId),this.setInitialRole(),this.requestUpdate()}setInitialRole(){this.availableRoles&&this.availableRoles.length>0&&(this._selectedRoleId=this.availableRoles[0].id)}dispatchOpenAddAccountRole(){this.addRoleDialog.handleOpenDialog()}dispatchTabControl(e){this._selectedRoleId=this.roles[e].id,this.roleTabComponent.setActiveRole(this._selectedRoleId)}addRole(e){var t;const i=this.selectedAccount.rolesData.findIndex(o=>o.role.id===e);if(this.selectedAccount.rolesData[i].role.permissions.every(o=>o.isNonLocation)){const o=this.selectedAccount.rolesData[i].genericTreeView;if(!(!((t=o==null?void 0:o.children)===null||t===void 0)&&t.length))return;const n=o.children[0];n.checked=!0,me(n,o),this.selectedAccount.rolesData[i].locations.push(n)}else this.selectedAccount.rolesData[i].locations=[];this.selectedAccount.rolesData[i].role.removed=!1,this.requestUpdate(),this.dispatchTabControl(i),this.addRoleDialog.handleCancelChanges()}dispatchRemoveRoleEvent(){const e=this.roles.findIndex(i=>i.id===this._selectedRoleId);this.roles[e].removed=!0;const t=this.selectedAccount.rolesData.findIndex(i=>i.role.id===this._selectedRoleId);this.selectedAccount.rolesData[t].locations=[],this.selectedAccount.rolesData[t].role.removed=!0,this.selectedAccount.rolesData[t].genericTreeView&&wt(this.selectedAccount.rolesData[t].genericTreeView),this.validateStep(),this.setInitialRole(),this.requestUpdate()}renderTree(){const e=this._dataForAccounts.find(n=>n.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.find(n=>n.role.id===this._selectedRoleId);if(!t)return x;const i={role:t.role.id,rootNode:t.genericTreeView},o=n=>{this.requestUpdate();const{updates:a}=n.detail.message,r=a.find(c=>c.key===t.role.id);r!=null&&r.items?t.locations=r.items.filter(c=>c.checked):t.locations=[],this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()};if(i&&i.rootNode){const n=t==null?void 0:t.role.permissions.every(a=>a.isNonLocation);return l`<user-details-assignments .assignment="${i}" .contact="${this.contact}" .accountNumber="${e==null?void 0:e.accountId}" @check-toggle="${o}" ?disableTree="${n}"></user-details-assignments>`}return x}validateStep(){let e=!0;for(const t of this._dataForAccounts)if(!t.rolesData.filter(i=>i.role.removed===!1).every(i=>i.locations.length)){e=!1;break}this._nextButtonEnabled=e}renderRoles(){var e,t;return l` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.availableRoles}" .activeRoleId="${(e=this._selectedRoleId)!==null&&e!==void 0?e:""}" .canRemoveRoles="${!0}" .removeRolesDisabled="${((t=this.availableRoles)===null||t===void 0?void 0:t.length)<=1}" .canAddRoles="${!0}" .addRolesDisabled="${this.canAddRolesDisabled}" @role-select="${i=>this._selectedRoleId=i.detail.roleId}" @open-role-menu="${()=>this.dispatchOpenAddAccountRole()}" @open-remove-role-menu="${()=>this.removeRoleDialogOpen=!0}"></user-details-tab-roles> `}renderAddAccountRoleConfirmation(){var e;return l`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${Fi((e=this.selectedAccount)===null||e===void 0?void 0:e.accountId)||""}" .assignedRoles="${this.availableRoles}" .roles="${this.roles}" @add-role="${t=>this.addRole(t.detail.roleId)}"> </add-account-role>`}renderRemoveRoleConfirmation(){return l`<changes-confirmation id="remove-role-dialog" ?isOpen="${this.removeRoleDialogOpen}" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" @confirm="${()=>{this.dispatchRemoveRoleEvent(),this.validateStep(),this.removeRoleDialogOpen=!1}}" @cancel="${()=>this.removeRoleDialogOpen=!1}"> </changes-confirmation>`}renderControls(){return l` <div class="controls"> <div class="flex justify-between py-2 items-center permissions-locations"> ${this.renderViewPermissionsButton()} <div class="flex items-center">${this.renderLocationsCount()}</div> </div> <div class="next-control"> <ix-button id="next-button" type="submit" has-icon trailing-icon ?disabled="${!this._nextButtonEnabled}" @click="${()=>{this.dispatchNextStepEvent()}}" data-testid="step-four-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderPermissionsDialog(){var e,t;return l` <ix-dialog ?open="${this.showPermissionsDialog}" @close="${()=>this.showPermissionsDialog=!1}"> <div class="dlr-text-heading" slot="headline">${this.selectedRole.name}</div> <div class="permissions-content" slot="content"> <user-details-permission inPermissionsDialog .permissionData="${(t=It((e=this.selectedRolePermissions)!==null&&e!==void 0?e:[]))!==null&&t!==void 0?t:[]}"> </user-details-permission> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.togglePermissionsDialog}" slot="secondary"><span class="dismiss-btn">Dismiss</span></ix-button> </div> </ix-dialog> `}togglePermissionsDialog(){this.showPermissionsDialog=!this.showPermissionsDialog}renderViewPermissionsButton(){return l` <div class="tree-view-permissions"> <ix-button class="temp-button view-permissions" appearance="text" @click="${this.togglePermissionsDialog}"> View Permissions </ix-button> </div> `}renderLocationsCount(){const e=`dlr-text-default font-bold uppercase ${this.noOfLocations?"tree-role-locations-count-active":"tree-role-locations-count"}`;return l`<div class="tree-role-locations"> <span class="${e}"> ${this.noOfLocations?l`${this.noOfLocations} locations`:l`Select Locations`} </span> </div>`}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchUpdateDFAEvent(){const e=new CustomEvent(w.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(e)}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-four-account-cards" isRoles .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}render(){return l` <div class="wizard-step-content overflow-y-auto h-full max-h-screen md:p-1"> ${this.renderAccountTabbingCard()} <div class="tree-view-container-content">${this.renderRoles()}</div> <div class="controls-container">${this.renderControls()}</div> <div class="tree-view-container-footer">${this.renderTree()}</div> </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderPermissionsDialog()} `}};F.styles=[Ut,A,ce],s([d({type:Array})],F.prototype,"dataForAccounts",void 0),s([d({type:Array})],F.prototype,"permissions",void 0),s([d({type:String})],F.prototype,"selectedAccountId",void 0),s([d({type:String})],F.prototype,"selectedRoleId",void 0),s([d({type:Object})],F.prototype,"contact",void 0),s([u()],F.prototype,"_dataForAccounts",void 0),s([u()],F.prototype,"_selectedAccountId",void 0),s([u()],F.prototype,"_selectedRoleId",void 0),s([u()],F.prototype,"showPermissionsDialog",void 0),s([u()],F.prototype,"removeRoleDialogOpen",void 0),s([u()],F.prototype,"_nextButtonEnabled",void 0),s([U("#add-role-dialog")],F.prototype,"addRoleDialog",void 0),s([U("#role-data-element")],F.prototype,"roleTabComponent",void 0),s([U("user-details-assignments")],F.prototype,"assignmentTreeComponent",void 0),F=s([b("create-user-step-four")],F);const qi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-icon-button{--md-sys-color-on-surface-variant:black}`;class ae{}ae.ACCORDION=e=>`user-flags-accordion-${e}`,ae.COMPONENT=e=>`user-flags-${e}`,ae.TREE=e=>`user-flags-tree-${e}`,ae.ASSIGNMENT_COUNT=e=>`user-flags-assignment-count-${e}`,ae.SEARCH_BOX=()=>"search-box";let M=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.searchText="",this.selectedIds=[],this.searchResultCount=0,this.searchResultIndex=0,this.onSearchTextChange=Zt(async e=>{Ft(this.flagTree.rootNode),this.searchText=e.detail.searchText;const t=Nt(this.flagTree.rootNode,e.detail.searchText);t.length&&qe(this.flagTree.rootNode),this.searchResultCount=t.length;const i=zi(this.flagTree.rootNode,t);[this.selectedId]=i,this.selectedIds=[...i],this.searchResultIndex=i.indexOf(this.selectedId)+1,this.requestUpdate()},500)}onTreeCheckToggle(e){var t;this.flagTree.updateService&&this.flagTree.updateService.update(e.detail.message.rootNode);const i=this.flagUpdateManager.nodeUpdates.find(o=>o.key===this.flagTree.label);i&&i.item.update(e.detail.message.rootNode),this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:this.flagTree.label,updates:this.flagUpdateManager.nodeChanges,rootNode:(t=this.flagTree.updateService)===null||t===void 0?void 0:t.nodeUpdates[0]}}})),this.flagTree.rootNode=structuredClone(e.detail.message.rootNode),this.requestUpdate("flagTree")}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=Oi(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;return l` <ix-generic-tree data-testid="${ae.TREE(this.flagTree.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" .rootNode="${this.flagTree.rootNode}" .selectedId="${this.selectedId}" .searchText="${this.searchText}" @check-toggle="${t=>this.onTreeCheckToggle(t)}" @search-text-change="${t=>this.onSearchTextChange(t)}" @search-navigation="${t=>this.onSearchNavigation(t)}" ?searchEnabled="${this.searchEnabled&&(((e=this.flagTree.rootNode.children)===null||e===void 0?void 0:e.length)||0)>0}" .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};M.styles=[qi,A],s([d({type:Object,attribute:!1})],M.prototype,"flagTree",void 0),s([d({type:Boolean})],M.prototype,"searchEnabled",void 0),s([d({type:Boolean})],M.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],M.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],M.prototype,"filledIcons",void 0),s([d({type:Boolean})],M.prototype,"searching",void 0),s([d({type:String})],M.prototype,"selectedId",void 0),s([d({type:Object})],M.prototype,"flagUpdateManager",void 0),s([u()],M.prototype,"searchText",void 0),s([u()],M.prototype,"selectedIds",void 0),s([u()],M.prototype,"searchResultCount",void 0),s([u()],M.prototype,"searchResultIndex",void 0),M=s([b("user-flag")],M);let G=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.flags=[],this.flagUpdateManager=new Li,this._defaultUpdates=[]}reset(){this._defaultUpdates=[],this.flagUpdateManager.reset()}onAccordionToggle(e){!e.detail.isOpen||!this.flags.length||(this.flags.forEach(t=>{t.label!==e.detail.accordionId?t.isOpen=!1:t.isOpen=!0}),this.requestUpdate())}connectedCallback(){var e;if(super.connectedCallback(),this._defaultUpdates=[],!this.contact)return;const t=Dt.get();if(!(!((e=this._defaultUpdates)===null||e===void 0)&&e.length)&&t!=null&&t.accountNumber){const i=`${t.accountNumber}:${this.contact.id}`,o=at.capture(i);o&&at.lock(i),this._defaultUpdates=o}}disconnectedCallback(){this.reset()}onTreeCheckToggle(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:e.detail.message.flagLabel,updates:e.detail.message.updates,rootNode:e.detail.message.rootNode}}}))}getUserFlagAssignmentCount(e){var t;const i=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);i&&(i.checkedChildrenCount=jt(i),this.renderAssignmentCount(e))}renderAssignmentCount(e){var t;const i=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);return i!=null&&i.checkedChildrenCount?l` <span style="color:#53657a;margin-left:8px" data-testid="${ae.ASSIGNMENT_COUNT(e.label)}">${i.checkedChildrenCount}</span> `:x}renderUserFlag(e){var t,i;this.flagUpdateManager.create(e.label);const o=this.flagUpdateManager.nodeUpdates.find(n=>n.key===e.label);return!((t=this._defaultUpdates)===null||t===void 0)&&t.length&&!e.defaultsApplied&&(this._defaultUpdates.forEach(n=>{const a=ze(e.rootNode,n.id);a&&(a.checked=!0,me(a,e.rootNode),o==null||o.item.update(e.rootNode))}),e.defaultsApplied=!0),this.getUserFlagAssignmentCount(e),l` <div class="mb-2"> <ix-accordion ?isOpen="${e.isOpen}" .accordionId="${e.label}" @toggle="${this.onAccordionToggle}" data-testid="${ae.ACCORDION(e.label)}"> <p slot="title" class="m-0 pl-1"> ${e.label} ${this.renderAssignmentCount(e)} </p> <div style="padding-left:30px"> <div class="flex items-center"> <p class="dlr-text-small"> ${((i=oe.find(n=>n.text===e.label))===null||i===void 0?void 0:i.desc)||""} </p> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <user-flag data-testid="${ae.COMPONENT(e.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" ?searchEnabled="${this.searchEnabled}" .flagTree="${e}" .flagUpdateManager="${this.flagUpdateManager}" @check-toggle="${n=>this.onTreeCheckToggle(n)}"></user-flag> </div> </ix-accordion> </div> `}render(){return l` ${this.flags.map(e=>this.renderUserFlag(e))}`}};G.styles=[qi,A],s([d({type:Boolean})],G.prototype,"searchEnabled",void 0),s([d({type:Boolean})],G.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"filledIcons",void 0),s([d({type:Boolean})],G.prototype,"searching",void 0),s([d({type:Array,attribute:!1})],G.prototype,"flags",void 0),s([d({type:Object})],G.prototype,"contact",void 0),s([u()],G.prototype,"flagUpdateManager",void 0),s([u()],G.prototype,"_defaultUpdates",void 0),G=s([b("user-flags")],G);const Hi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header-text{margin-bottom:10px}.user-details-row{display:grid;grid-template-columns:1fr 1fr}.row-label{color:rgba(9,34,65,.7);word-break:break-word;width:192px}.row-value{color:#092241;overflow-wrap:anywhere}.user-details-body{display:flex;gap:10px;flex-direction:column}.arrow-forward-icon{padding-left:6px}.access-summary-header,.user-details-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}ix-divider{margin-top:30px;margin-bottom:30px}.user-flag-information{margin-left:5px}.user-flag-learn-text{padding-bottom:20px}.user-flag-learn-text-link{color:#1456e0}.user-flag-evacuation{vertical-align:top;line-height:18px}.evacuation-label{padding-left:8px;vertical-align:top}.evacuation-text{text-align:justify;padding-left:5px;padding-top:10px;padding-bottom:30px;color:#092241;margin-right:40px}.flags-description ix-button{margin-top:.5rem;width:112px}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.flags-description{flex-direction:column-reverse;text-align:center}.flags-description p{text-align:left}.evacuation-text{margin-right:0}.flags-description ix-button{display:block}.subheading-container{flex-direction:column;align-items:start;gap:.75rem}.submit-btn{width:100%}.user-details-row{grid-template-columns:1fr}.step-five-next-container{display:flex;justify-content:center}}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;let X=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.evacAssistanceRequired=!1,this._dataForAccounts=[]}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId}setSelectedFlag(e){this._selectedFlagId=e}setInitialFlag(){this._selectedFlagId=oe[0].key}toggleActiveCard(e){this._selectedAccountId=e;const t=this._dataForAccounts.find(i=>i.accountId===e);t&&t.genericFlagsData&&(this._selectedFlagId=At(t.genericFlagsData[0].label)),this.setSelectedFlag(this._selectedFlagId),this.setInitialFlag(),this.requestUpdate()}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-five-account-cards" .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}renderElevatedNextButton(){return l` <div class="flex justify-between flags-description"> <p style="max-width:550px" class="dlr-text-caption evacuation-text"> The locations chosen for this account's Portal access will automatically default selections for the user flags listed below. You have the flexibility to modify these selections by deselecting specific locations and choosing others as needed. </p> <div class="step-five-next-container"> <ix-button type="submit" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-five-next-button"> <span class="uppercase font-bold tracking-wider">Next</span> <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderUserFlags(){var e,t;const i=o=>{var n;const a=(n=structuredClone(o.detail.message.updates))!==null&&n!==void 0?n:[];this.selectedAccount&&a.forEach(r=>{const c=this.selectedAccount.flagData.findIndex(p=>p.key===r.key);c>-1?this.selectedAccount.flagData[c]=structuredClone(r):this.selectedAccount.flagData.push(r)}),this.dispatchEvent(new CustomEvent(w.UpdateFlags,{bubbles:!0}))};return l` <user-flags class="grid grid-cols-1 gap-3" showCheckboxes filledIcons searchEnabled .flags="${(t=(e=this.selectedAccount)===null||e===void 0?void 0:e.genericFlagsData)!==null&&t!==void 0?t:[]}" @check-toggle="${i}" data-testid="step-five-user-flags"></user-flags> `}render(){return l` <div class="wizard-step-content"> ${this.renderAccountTabbingCard()} ${this.renderElevatedNextButton()} ${this.renderUserFlags()} </div> `}};X.styles=[Hi,A,ce],s([d({type:Object})],X.prototype,"newContact",void 0),s([d({type:Array})],X.prototype,"dataForAccounts",void 0),s([d({type:String})],X.prototype,"selectedAccountId",void 0),s([d({type:Boolean,reflect:!0})],X.prototype,"evacAssistanceRequired",void 0),s([u()],X.prototype,"_dataForAccounts",void 0),s([u()],X.prototype,"_selectedAccountId",void 0),s([u()],X.prototype,"_selectedFlagId",void 0),X=s([b("create-user-step-five")],X);class k{}k.SUCCESS_CREATED="create-user-success",k.SUCCESS_ICON="create-user-success-icon",k.USER_DETAILS="create-user-success-details",k.SUCCESS_MESSAGE="create-user-success-message",k.VIEW_USER="view-user-button",k.BACK_TO_USERS="back-to-users-button",k.S6={DETAILS_HEADER:"s6-details-header",DETAILS_BODY:"s6-details-body",DETAILS_FIRST_NAME:"s6-details-first-name",DETAILS_LAST_NAME:"s6-details-last-name",DETAILS_EMAIL:"s6-details-email",DETAILS_PHONE:"s6-details-phone",PORTAL_TREE:"s6-portal-tree",FLAG_TREE:"s6-flag-tree",TAB_PORTAL:"s6-tab-portal",TAB_FLAGS:"s6-tab-flags"};let Z=class extends I{constructor(){super(...arguments),this.newContact={},this.dataForAccounts=[],this.submitting=!1,this.hideContactDetails=!1,this._readonlyTreeViews=[],this._readonlyUserFlags=[],this._selectedTab="roles-and-portal-access",this._isFirstLoad=!0}connectedCallback(){super.connectedCallback(),this._readonlyTreeViews=this.generateReadOnlyTreeViews(),this._readonlyUserFlags=this.generateReadOnlyUserFlags()}isTabActive(e){return this._isFirstLoad?x:this._selectedTab===e}generateReadOnlyTreeViews(){const e=[];return this.dataForAccounts.forEach(t=>{let i=[];t.rolesData.forEach(o=>{if(!o.role.removed){const n=Gt(o.genericTreeView),a=Kt(structuredClone(n));Jt(a),i.push({role:o.role.name,tree:a})}}),e.push({accountName:t.accountName,roleTrees:i}),i=[]}),e}generateReadOnlyUserFlags(){const e=[];return this.dataForAccounts.forEach(t=>{let i=[];t.genericFlagsData&&(t.genericFlagsData.forEach(o=>{const n=Gt(o.rootNode),a=Kt(structuredClone(n));Jt(a),i.push({label:o.label,rootNode:a,isOpen:!1})}),e.push({accountName:t.accountName,flagTrees:i}),i=[])}),e}renderUserDetails(){return l` <div class="user-details"> <div class="user-details-header" data-testid="${k.S6.DETAILS_HEADER}"> <div class="user-details-header-text">User Details</div> <ix-icon-button class="icon-btn_primary" filledIcon icon="edit" ?disabled="${this.submitting}" @click="${()=>this.dispatchSetStepEvent(1)}"></ix-icon-button> </div> <div class="user-details-body" data-testid="${k.S6.DETAILS_BODY}"> <div class="user-details-row"> <div class="dlr-text-default row-label">First Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_FIRST_NAME}"> ${this.newContact.firstName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Last Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_LAST_NAME}"> ${this.newContact.lastName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Email Address</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_EMAIL}"> ${this.newContact.email} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Phone</div> <ix-phone-number data-testid="${k.S6.DETAILS_PHONE}" .number="${this.newContact.phone}"></ix-phone-number> </div> </div> </div> `}renderTabs(){return l` <ix-tabs> <ix-primary-tab @click="${()=>{this._selectedTab="roles-and-portal-access",this._isFirstLoad=!1}}" ?active="${this.isTabActive("roles-and-portal-access")}" data-testid="${k.S6.TAB_PORTAL}"> <span style="${this._selectedTab==="roles-and-portal-access"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide"> Roles and Portal Access </span> </ix-primary-tab> <ix-primary-tab @click="${()=>{this._selectedTab="user-flags",this._isFirstLoad=!1}}" ?active="${this.isTabActive("user-flags")}" data-testid="${k.S6.TAB_FLAGS}"> <span style="${this._selectedTab==="user-flags"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide">User Flags</span></ix-primary-tab> </ix-tabs> `}renderRolesAndPortalAccessSummary(){return this._selectedTab!=="roles-and-portal-access"?x:l` <div class="py-4"> ${this._readonlyTreeViews.map(e=>l` <div> <h4 style="color:#092241;opacity:60%" class="pt-1 pb-3">${e.accountName}</h4> ${e.roleTrees.map(t=>l` <div class="pb-2"> <div class="pb-1">${t.role}</div> <ix-generic-tree filledIcons .rootNode="${t.tree}" data-testid="${k.S6.PORTAL_TREE}"></ix-generic-tree> </div> `)} </div>`)} </div> `}renderUserFlagsSummary(){return this._selectedTab!=="user-flags"?x:l`<div> ${this._readonlyUserFlags.map(e=>l` <div class="py-2"> <h4 class="font-bold pb-2">${e.accountName}</h4> <user-flags filledIcons disableCheckboxes .flags="${e.flagTrees}" data-testid="${k.S6.FLAG_TREE}"></user-flags> </div>`)} </div>`}renderLearnMoreText(){return this._selectedTab==="user-flags"?l` <div style="padding-top:15px"> Learn more about user flags <a class="user-flag-learn-text-link" href="#">here.</a> </div> `:l` <div style="padding-top:15px" class="text-black roles-and-portal-access-text"> Learn more about roles and portal access <a class="user-flag-learn-text-link" href="#">here.</a> </div> `}dispatchSetStepEvent(e){this.dispatchEvent(new CustomEvent(w.SetStep,{detail:{step:e},bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-step-content overflow-y-auto overflow-x-hidden md:p-1"> ${this.hideContactDetails?x:l`${this.renderUserDetails()}<ix-divider></ix-divider>`} ${this.renderTabs()} ${this.renderLearnMoreText()} ${this.renderRolesAndPortalAccessSummary()} ${this.renderUserFlagsSummary()} </div> `}};Z.styles=[Hi,A,ce],s([d({type:Object})],Z.prototype,"newContact",void 0),s([d({type:Array})],Z.prototype,"dataForAccounts",void 0),s([d({type:Boolean})],Z.prototype,"submitting",void 0),s([d({type:Boolean})],Z.prototype,"hideContactDetails",void 0),s([u()],Z.prototype,"_readonlyTreeViews",void 0),s([u()],Z.prototype,"_readonlyUserFlags",void 0),s([u()],Z.prototype,"_selectedTab",void 0),s([u()],Z.prototype,"_isFirstLoad",void 0),Z=s([b("create-user-step-six")],Z);const bs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.drawer-container{z-index:100;display:flex;flex-direction:row;position:fixed;width:100%;height:100%;top:var(--intraportal-nav-height,0);right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeIn;animation-timing-function:ease-out}.drawer-container-hide{z-index:100;display:flex;flex-direction:row;flex:0 0 auto;position:fixed;width:100vw;height:100vh;top:0;right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeOut;animation-timing-function:ease-out}.drawer-filler{flex:1}aside{padding:32px 40px 40px;border-radius:1rem 0 0 1rem}.drawer-slide-in{width:100vw;max-width:816px;height:calc(100% - var(--intraportal-nav-height,0px));float:right;display:flex;flex-direction:column;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideInFromRight}.drawer-slide-out{width:100vw;max-width:810px;height:100vh;float:right;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideOutToRight}@media screen and (min-width:1024px){.drawer{width:45%}}.drawer-header{display:flex;justify-content:space-between;align-items:center}.drawer-body{flex-grow:1;overflow:hidden}.drawer-header__hide-btn{flex:1}.drawer-header__title{flex:1;text-align:center;flex-grow:1;flex-shrink:0}.drawer-header__close-btn{flex:1}.hide-text{cursor:pointer;user-select:none}.hide-icon{font-weight:700}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideOutToRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@media screen and (max-width:600px){aside{border-radius:0;padding:1rem}}`,st={ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",CloseSuccess:"close-success",BlurDrawer:"blur-drawer"};let le=class extends I{constructor(){super(...arguments),this.isVisible=!1,this.summaryScreen=!1,this.submitting=!1,this.showMinimiseButton=!1}static get styles(){return[bs,A]}dispatchDialogToggleEvent(){this.submitting||this.dispatchEvent(new CustomEvent(st.ToggleDialog,{composed:!0,bubbles:!0}))}dispatchDraftToggleEvent(){var e,t;(e=this.drawer)===null||e===void 0||e.setAttribute("class","drawer-slide-out"),(t=this.drawerContainer)===null||t===void 0||t.setAttribute("class","drawer-container-hide"),setTimeout(()=>{this.dispatchEvent(new CustomEvent(st.ToggleDraft,{bubbles:!0,composed:!0}))},250)}dispatchBlurEvent(){this.dispatchEvent(new CustomEvent(st.BlurDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(st.CloseSuccess,{bubbles:!0,composed:!0}))}render(){const e=this.isVisible?"slide-in":"slide-out";return this.isVisible?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",l` <div class="drawer-container" data-testid="ui-um-drawer-container"> <div class="drawer-filler" @click="${this.dispatchBlurEvent}" @keypress="${this.dispatchBlurEvent}"></div> <aside class="drawer-${e}"> <div class="drawer-header"> <div class="drawer-header__hide-btn"> ${!this.summaryScreen&&this.showMinimiseButton?l` <ix-button class="flex w-24" appearance="text" has-icon @click="${this.dispatchDraftToggleEvent}" ?disabled="${this.submitting}" data-testid="hide-drawer-button"> <md-icon class="hide-icon" slot="icon">fullscreen_exit</md-icon> <p class="dlr-text-small hide-text font-bold uppercase">Hide</p> </ix-button> `:x} </div> <div> <slot name="centre-top"></slot> </div> <div class="drawer-header__close-btn"> <div class="float-right"> <ix-icon-button aria-label="Close" icon="close" @click="${this.summaryScreen?this.dispatchDrawerCloseEvent:this.dispatchDialogToggleEvent}" data-testid="close-drawer-icon"></ix-icon-button> </div> </div> </div> <div class="drawer-body"> <slot name="content"></slot> </div> </aside> </div> `):(document.body.style.overflow="auto",document.documentElement.style.overflow="initial",x)}};s([d({type:Boolean})],le.prototype,"isVisible",void 0),s([d({type:Boolean})],le.prototype,"summaryScreen",void 0),s([d({type:Boolean})],le.prototype,"submitting",void 0),s([d({type:Boolean})],le.prototype,"showMinimiseButton",void 0),s([U("aside")],le.prototype,"drawer",void 0),s([U(".drawer-container")],le.prototype,"drawerContainer",void 0),le=s([b("ui-um-drawer")],le);const xs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-body{overflow:hidden;height:100%}.wizard-footer{float:right}.form{height:100%}`,Pt={UpdateForm:"update-form",NextStepWizard:"next-step-wizard",PrevStep:"prev-step-wizard",ButtonToggle:"button-toggle"};let Mt=class extends I{constructor(){super(...arguments),this.updateFormBinding=this.updateForm.bind(this),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.wizardForm=new FormData}static get styles(){return[xs,A]}connectedCallback(){super.connectedCallback(),window.addEventListener(Pt.UpdateForm,this.updateFormBinding)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener(Pt.UpdateForm,this.updateFormBinding);const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding)}updateForm(e){e.detail.forEach((t,i)=>this.wizardForm.set(i,t))}handleSlotChange(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.assignedElements().forEach(i=>{i.wizardForm=this.wizardForm})}dispatchButtonToggleEvent(e){this.dispatchEvent(new CustomEvent(Pt.ButtonToggle,{detail:e,bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-body"> <form class="form"> <slot name="wizard-content"></slot> </form> </div> `}};s([d({type:Object})],Mt.prototype,"wizardForm",void 0),Mt=s([b("ui-um-wizard")],Mt);const ws=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-step-form{display:flex;flex-direction:column;height:100%}.step{overflow:auto}.wizard-step__btn-group{padding:20px 0;float:right}.input-group{display:flex;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}.textfield{width:100%}.subheading-container{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:36px;margin-top:24px}.submit-btn{width:167.44px}.submit-btn-content{display:flex;align-items:center;flex-direction:row;justify-content:space-between}@media screen and (max-width:600px){.input-group{display:block;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}}`;let se=class extends I{constructor(){super(...arguments),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.stepTitle="",this.stepSubTitle="",this.isRequired=!1,this.isLastStep=!1,this.submitting=!1}static get styles(){return[ws,_e,A]}disconnectedCallback(){var e;super.disconnectedCallback();const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding),this.firstFocusableElement.focus()}handleSlotChange(){var e,t;const i=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");for(const o of i.assignedNodes())(t=this.form)===null||t===void 0||t.insertBefore(o,i)}dispatchSubmitEvent(e){e.preventDefault(),this.dispatchEvent(new CustomEvent(w.CreateContact,{bubbles:!0,composed:!0}))}render(){return l` <form class="wizard-step-form" @keydown="${e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:this.firstFocusableElement},bubbles:!0,composed:!0})))}}"> <div class="wizard-step-heading pt-6"> <h2 class="dlr-text-page-title" data-testid="dlr-text-page-title" tabindex="-1"> ${this.stepTitle} </h2> <div class="subheading-container"> <h3 class="dlr-text-heading" data-testid="dlr-text-heading">${this.stepSubTitle}</h3> ${this.isRequired?l` <span class="dlr-text-small italic required-field">*denotes required field</span> `:x} ${this.isLastStep?l` <ix-button class="submit-btn" has-icon ?submitting="${this.submitting}" @click="${e=>this.dispatchSubmitEvent(e)}" data-testid="wizard-submit-button"> <div class="submit-btn-content"> Yes, Submit <md-icon class="arrow-forward-icon" slot="icon">arrow_forward</md-icon> </div> </ix-button> `:x} </div> </div> <slot></slot> </form> <div tabindex="-1" @focus="${()=>{this.firstFocusableElement.focus()}}"></div> `}};s([U('[tabindex="-1"]')],se.prototype,"firstFocusableElement",void 0),s([d({type:String})],se.prototype,"stepTitle",void 0),s([d({type:String})],se.prototype,"stepSubTitle",void 0),s([d({type:Boolean})],se.prototype,"isRequired",void 0),s([d({type:Boolean})],se.prototype,"isLastStep",void 0),s([d({type:Boolean})],se.prototype,"submitting",void 0),s([U("form")],se.prototype,"form",void 0),se=s([b("ui-um-wizard-step")],se);const Vi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-dialog{position:absolute;z-index:101}.create-user-wizard{height:100%;display:flex;flex-direction:column}.dlr-text-small.step-progress{letter-spacing:1.25px}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.success-actions{flex-direction:column;width:100%}.success-actions ix-button{display:block;width:100%}}`;function ji(e,t){const i={id:"root",label:"",children:[],customerKnownSpaceName:""},o=new nt,n=structuredClone(e.rolesData.filter(g=>g.locations.length>0).filter(g=>!g.role.removed).flatMap(g=>g.locations)),a=t.data;a&&a.length&&re(a[0],i),n.forEach(g=>{const h=ze(i,g.id);h&&(h.checked=!0,me(h,i),o.update(i))});const r={label:"",isOpen:!1,rootNode:i},c=[],p=oe.map(g=>{const h=structuredClone(r);return h.updateService=new nt,h.updateService.updates=structuredClone(o.nodeUpdates),h.label=g.text,c.push({key:g.text,items:[]}),h});e.genericFlagsData=[...p],e.flagData=c}const As=e=>({id:e.id,name:e.account_name,status:e.status,accountNumber:e.account_number,displayName:e.account_friendly_name,statusUpdateAt:e.updated_at,statusUpdateBy:e.updated_by}),Bt=e=>{var t;const i=[];return(t=e.account_associations)===null||t===void 0||t.forEach(o=>{i.push(As(o))}),{id:e.id,firstName:e.first_name,lastName:e.last_name,email:e.email,phone:e.phone,evacAssistance:e.evacuation_assistance_required,accounts:i,status:"Active"}},Cs=e=>{var t;const i=[];return(t=e.accounts)===null||t===void 0||t.forEach(o=>{i.includes(o.accountNumber)||i.push(o.accountNumber)}),{first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,account_numbers:i,evacuation_assistance_required:e.evacAssistance}},Ts=e=>({id:e.id,first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacAssistance}),Is=e=>({accountNumber:e.accountNumber,includeChildAccounts:!0,page:e.page,size:e.size,firstName:e.firstName,lastName:e.lastName,email:e.email,sort:e.sort,order:e.order}),_s=e=>{var t,i;const o=[];return(t=e.content)===null||t===void 0||t.forEach(n=>{o.push(Bt(n))}),{contacts:o,recordCount:(i=e.pageable)===null||i===void 0?void 0:i.total_elements}},ks=e=>({id:e.id}),Es=e=>({id:e.id,userProfile:Ts(e.contactInput)}),Rs=e=>({userInput:Cs(e.contactInput)});class Ss{async update(t){try{const i=Es(t);return v.UsersApi.updateUser(i)}catch(i){return m.handleError("Failed to update user.")}}async create(t){try{const i=Rs(t),o=await v.UsersApi.createUser(i);return Bt(o)}catch(i){return m.handleError(i,`Failed to create user for ${t.contactInput.email}`),{}}}async search(t){try{const i=Is(t),o=await v.UsersApi.getUsers(i);return _s(o)}catch(i){return m.handleError(i,"Failed to get users."),{}}}async get(t){try{const i=ks(t),o=await v.UsersApi.getUser(i);return Bt(o)}catch(i){return m.handleError(i,"Failed to get user."),{}}}}const Lt=new Ss,Gi=(e,t)=>{var i;const o={expanded:!1,id:e.id,label:(i=e.displayName)!==null&&i!==void 0?i:e.name,parentId:t.id};return e.subaccounts&&(o.children=e.subaccounts.map(n=>Gi(n,o))),o},$s=e=>{const t={expanded:!1,id:"root",label:"",parentId:"",children:[],disabled:!1};return t.children=e.map(i=>Gi(i,t)),t};function Ki(e,t){var i;const o={id:e.id,label:(i=e.displayName)!==null&&i!==void 0?i:e.name,parentId:t.id,expanded:!1,checked:!1,indeterminate:!1,children:[]};return e.subaccounts&&(o.children=e.subaccounts.map(n=>Ki(n,o))),o}function Ji(e){const t={id:"root",parentId:"",label:"",expanded:!1,checked:!1,children:[]};return e.forEach(i=>t.children.push(Ki(i,t))),t}const Us=e=>{const t=ot(e);return $s(t)};let T=class extends I{constructor(){super(...arguments),this.showDrawer=!1,this.success=!1,this.submitting=!1,this.newUserId="",this.permissions=[],this.roles=[],this.treeData=[],this.loading=!1,this.selectedAccountId="",this.selectedRoleId="",this.step=1,this.validatingStepOne=!1,this.newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.dataForAccounts=[],this.showManageUserDialog=!1,this.userId="",this.stepTitle="Add New User",this.isNextButtonEnabled=!1,this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1}connectedCallback(){super.connectedCallback(),this.setupAccountSelector()}get stepOne(){var e,t;return(t=(e=this.renderRoot.querySelector("#step-1"))===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector("create-user-step-one")}setupAccountSelector(){const e=St().filter(t=>P.hasExternalUserCreate(t.accountNumber));this.accounts=ot(e),this.accountTree=Ji(this.accounts),this.permissions=$.getPermissions()}resetStep(){this.handleDialogReset("close")}setStep(e){this.step=e,this.canQuickNavigateSteps={1:!0,2:!0,3:!0,4:!0,5:!0}}resetSteps(e){Object.keys(this.canQuickNavigateSteps).forEach(t=>{e.includes(t)||(this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[t]:!1})})}onNextButtonToggle(e){this.isNextButtonEnabled=e.detail,this.step===1?this.canQuickNavigateSteps={...this.canQuickNavigateSteps,1:!1}:this.step===2?this.resetSteps(["1"]):this.step===3?this.resetSteps(["1","2"]):this.step===4?this.resetSteps(["1","2","3"]):this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[this.step]:!1},this.maxQuickStep=this.step}onPrevStep(){this.step!==1&&(this.step===3&&this.collapseAccountTree(),(this.step===5||this.step===6)&&this.collapseLocationTrees(),this.step===6&&(this.isNextButtonEnabled=!0),this.canQuickNavigateSteps[(this.step-1).toString()]=!0,this.maxQuickStep=Math.max(this.maxQuickStep,this.step),this.step-=1)}onQuickNextStep(){this.canQuickNavigateSteps[this.step]&&this.onNextStep()}async onNextStep(){var e;if(this.isNextButtonEnabled){if(this.loading=!0,this.step===1){if(this.collapseAccountTree(),!this.canQuickNavigateSteps[1]){this.validatingStepOne=!0;const t=await this.validateEmail();if(this.validatingStepOne=!1,!t){this.loading=!1;return}}}else if(this.step===2&&!this.canQuickNavigateSteps[2]){if(!this.accountTree)return;const t=((e=this.checkedAccounts)===null||e===void 0?void 0:e.map(a=>a.id))||[],i=await Ye.getAccountData(t),o=pe.get(),n=Me(this.newContact.email)&&P.hasAssignInternalRoleCreate($.getAccountNumber());this.roles=[],this.treeData=[];for(let a=0;a<t.length;a+=1){const r=$t(t[a],o,n),c=t[a];this.roles.push({accountId:c,roles:structuredClone(r)}),this.treeData.push({contactId:"",accountNumber:c,roleId:"",data:i[a]})}}else if(this.step===3)this.selectedAccountId=this.dataForAccounts[0].accountId,this.selectedRoleId=this.dataForAccounts[0].rolesData[0].role.id;else if(this.step===4){for(const t of this.dataForAccounts){const i=this.treeData.find(o=>o.accountNumber===t.accountId);i&&ji(t,i)}this.collapseLocationTrees()}else this.step===5&&this.collapseLocationTrees();this.step!==4&&(this.isNextButtonEnabled=!1),this.step+1===this.maxQuickStep&&(this.canQuickNavigateSteps[this.step]=!1),this.loading=!1,this.step+=1}}collapseAccountTree(){this.accountTree&&(this.accountTree.expanded=!1,this.accountTree.children&&this.accountTree.children.forEach(e=>{e.expanded=!1,e.children&&e.children.forEach(t=>{t.expanded=!1})}))}collapseLocationTrees(){this.dataForAccounts.forEach(e=>{var t;e.rolesData.forEach(i=>{qe(i.genericTreeView)}),(t=e.genericFlagsData)===null||t===void 0||t.forEach(i=>{qe(i.rootNode)})})}async validateEmail(){const e=await Lt.search({email:this.newContact.email.split("@")[0]});return e.contacts.find(t=>t.email===this.newContact.email)?(this.userId=e.contacts[0].id,this.toggleManageUserDialog(),!1):!0}handleDialogReset(e){this.step=1,this.newContact={id:"",firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.setupAccountSelector(),this.stepOne&&(this.stepOne.clearTextFields(),this.stepOne.resetErrorStates(),this.stepOne._nextButtonEnabled=!1),this.dataForAccounts=[],this.selectedAccountId="",this.selectedRoleId="",this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1,this.isNextButtonEnabled=!1,this.dispatchResetSuccessEvent(),e==="toggle"?this.dispatchToggleDrawerEvent():this.dispatchDrawerCloseEvent()}updateAccounts(e){var t;this.accountTree=e.detail.rootNode,!((t=this.accountTree)===null||t===void 0)&&t.children&&(this.checkedAccounts=xt(this.accountTree.children,xi(this.accounts||[])),this.dataForAccounts=[])}onUpdateContact(e){const t=e.detail.newContact;this.newContact.email!==t.email&&this.newContact.email!==""&&(this.resetSteps(["1"]),this.dataForAccounts=[]),this.newContact=t}renderWizardStep(){switch(this.step){case 1:return l` <ui-um-wizard-step id="step-1" slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Information"}" data-testid="create-user-step-one"> <create-user-step-one .newContact="${this.newContact}" .validatingForm="${this.validatingStepOne}" @update-contact="${e=>this.onUpdateContact(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-one> </ui-um-wizard-step> `;case 2:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Accounts*"}" data-testid="create-user-step-two"> <create-user-step-two class="flex flex-col overflow-auto grow" .accountTree="${this.accountTree}" @update-accounts="${e=>this.updateAccounts(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-two> </ui-um-wizard-step> `;case 3:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Roles"}" data-testid="create-user-step-three"> <create-user-step-three class="flex flex-col overflow-auto grow" .checkedAccounts="${this.checkedAccounts||[]}" .roles="${this.roles}" .dataForAccounts="${this.dataForAccounts}" .treeData="${this.treeData}" @update-dfa="${e=>{this.dataForAccounts=e.detail.dataForAccounts}}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-three> </ui-um-wizard-step> `;case 4:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Portal Access"}" data-testid="create-user-step-four"> <create-user-step-four class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .selectedRoleId="${this.selectedRoleId}" .permissions="${this.permissions}" .contact="${this.newContact}" @update-dfa="${e=>this.dataForAccounts=e.detail.dataForAccounts}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-four> </ui-um-wizard-step> `;case 5:return l` <ui-um-wizard-step slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Flags"}" data-testid="create-user-step-five"> <create-user-step-five class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .evacAssistanceRequired="${this.newContact.evacAssistance}" @evac-assistance-required="${e=>this.newContact.evacAssistance=e.detail}" @update-flags="${()=>this.canQuickNavigateSteps={...this.canQuickNavigateSteps,5:!1}}" @next-step="${this.onNextStep}"> </create-user-step-five> </ui-um-wizard-step> `;case 6:return l` <ui-um-wizard-step isLastStep slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"Are these details correct?"}" ?submitting="${this.submitting}" @create-contact="${this.dispatchCreateNewContactEvent}" data-testid="create-user-step-six"> <create-user-step-six class="step" .dataForAccounts="${this.dataForAccounts}" .newContact="${this.newContact}" ?submitting="${this.submitting}" @set-step="${e=>this.setStep(e.detail.step)}"></create-user-step-six> </ui-um-wizard-step> `}return x}renderProgress(){return l`<ix-progress slot="wizard-content" indeterminate></ix-progress>`}renderSuccessMessage(){return l` <div data-testid="${k.SUCCESS_CREATED}" slot="content" class="flex flex-col justify-between items-center pt-40 h-96"> <ix-icon data-testid="${k.SUCCESS_ICON}" style="color:#4caf50;font-size:75px;font-weight:700">check_circle</ix-icon> <span data-testid="${k.USER_DETAILS}" class="text-2xl font-bold pb-5">${this.newContact.firstName} ${this.newContact.lastName} Created</span> <div data-testid="${k.SUCCESS_MESSAGE}" class="pb-5"> ${this.newContact.firstName} ${this.newContact.lastName} has been successfully created. </div> <div class="flex justify-between w-400 success-actions"> <ix-button data-testid="${k.VIEW_USER}" appearance="outlined" @click="${this.handleViewUserRedirect}" class="p-1"><span class="font-bold text-sm tracking-wider uppercase">View user</span></ix-button> <ix-button data-testid="${k.BACK_TO_USERS}" appearance="filled" class="p-1" @click="${()=>this.handleDialogReset("close")}"><span class="font-bold uppercase text-sm tracking-wider">Back to users</span></ix-button> </div> </div> `}handleViewUserRedirect(){this.handleDialogReset("close"),Ge(z.UserManagementDetails,`?id=${this.newUserId}`),this.newUserId=""}renderManageUserDialog(){return l` <ix-dialog ?open="${this.showManageUserDialog}"> <div class="dlr-text-heading" slot="headline"> This user already exists for your Master Account </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.handleManageUserDialogClose}" slot="secondary"> Cancel </ix-button> <ix-button appearance="text" @click="${this.handleManageUserRedirect}" slot="primary"> Manage User </ix-button> </div> </ix-dialog> `}toggleManageUserDialog(){this.showManageUserDialog=!this.showManageUserDialog}handleManageUserDialogClose(){this.toggleManageUserDialog(),this.handleDialogReset("close")}handleManageUserRedirect(){this.toggleManageUserDialog(),this.handleDialogReset("close"),Ge(z.UserManagementDetails,`?id=${this.userId}`),this.userId=""}dispatchToggleDrawerEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(w.CloseDrawer,{bubbles:!0,composed:!0}))}dispatchResetSuccessEvent(){this.dispatchEvent(new CustomEvent(w.ResetSuccess,{bubbles:!0,composed:!0}))}dispatchCreateNewContactEvent(){this.dispatchEvent(new CustomEvent(w.CreateNewContact,{detail:{newContact:this.newContact,dataForAccounts:this.dataForAccounts},bubbles:!0,composed:!0}))}renderDrawerControls(){return l` <div slot="centre-top"> <div class="flex"> ${this.success?x:l` <ix-icon-button class="icon-btn_primary" ?disabled="${this.step===1||this.loading}" @click="${()=>this.onPrevStep()}" icon="chevron_left" data-testid="prev-step-icon"> </ix-icon-button> <span class="dlr-text-small uppercase font-bold pt-[10px] px-2 step-progress" data-testid="step-progress"> ${this.step} of 6 </span> <ix-icon-button style="${this.step===6?"visibility: hidden":""}" class="icon-btn_primary ${this.step===6||!this.isNextButtonEnabled||this.loading?"disabled":""}" ?disabled="${!this.canQuickNavigateSteps[this.step]||this.loading}" @click="${()=>this.onQuickNextStep()}" icon="chevron_right" data-testid="next-step-icon"> </ix-icon-button> `} </div> </div> `}render(){return l` <ui-um-drawer ?isVisible="${this.showDrawer}" ?summaryScreen="${this.success}" ?submitting="${this.submitting}" @close-success="${()=>this.handleDialogReset("close")}" data-testid="ui-um-drawer"> ${this.renderDrawerControls()} ${this.success?this.renderSuccessMessage():l` <ui-um-wizard class="create-user-wizard" slot="content" data-testid="create-user-wizard"> ${this.loading?this.renderProgress():this.renderWizardStep()} </ui-um-wizard> `} </ui-um-drawer> ${this.renderManageUserDialog()} `}};T.styles=[Vi,A,_e],s([d({type:Boolean})],T.prototype,"showDrawer",void 0),s([d({type:Boolean})],T.prototype,"success",void 0),s([d({type:Boolean})],T.prototype,"submitting",void 0),s([d({type:String})],T.prototype,"newUserId",void 0),s([u()],T.prototype,"accounts",void 0),s([u()],T.prototype,"accountTree",void 0),s([u()],T.prototype,"permissions",void 0),s([u()],T.prototype,"roles",void 0),s([u()],T.prototype,"treeData",void 0),s([u()],T.prototype,"loading",void 0),s([u()],T.prototype,"selectedAccountId",void 0),s([u()],T.prototype,"selectedRoleId",void 0),s([u()],T.prototype,"step",void 0),s([u()],T.prototype,"validatingStepOne",void 0),s([u()],T.prototype,"newContact",void 0),s([u()],T.prototype,"dataForAccounts",void 0),s([u()],T.prototype,"showManageUserDialog",void 0),s([u()],T.prototype,"userId",void 0),s([u()],T.prototype,"stepTitle",void 0),s([u()],T.prototype,"isNextButtonEnabled",void 0),s([u()],T.prototype,"canQuickNavigateSteps",void 0),s([u()],T.prototype,"maxQuickStep",void 0),s([u()],T.prototype,"checkedAccounts",void 0),T=s([b("create-user")],T);const Ns=E`.draft-container{display:flex;flex-direction:row;justify-content:space-between;bottom:24px;position:fixed;right:24px;z-index:1200;gap:8px;background-color:#fff;border-radius:16px;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset;align-items:center;padding:16px 24px;width:250px}`;let Be=class extends I{constructor(){super(...arguments),this.header="",this.subText="",this.isVisible=!1}static get styles(){return[Ns]}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDraft,{bubbles:!0,composed:!0}))}dispatchDialogToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDialog,{composed:!0}))}render(){return this.isVisible?(document.body.style.overflow="hidden",l` <div class="draft-container"> <div class="draft-text"> <p class="dlr-text-caption text-on-surface-variant">${this.header}</p> <p class="dlr-text-small font-bold">${this.subText}</p> </div> <div class="draft-buttons"> <ix-icon-button filledIcon @click="${this.dispatchDialogToggleEvent}"> <ix-icon filled slot="default" style="color:red">delete</ix-icon> </ix-icon-button> <ix-icon-button appearance="filled" @click="${this.dispatchDraftToggleEvent}"> <ix-icon slot="default">fullscreen</ix-icon> </ix-icon-button> </div> </div> `):(document.body.style.overflow="auto",x)}};s([d({type:String})],Be.prototype,"header",void 0),s([d({type:String})],Be.prototype,"subText",void 0),s([d({type:Boolean})],Be.prototype,"isVisible",void 0),Be=s([b("ix-draft")],Be);const Zi=E`ix-dialog .dialog-content{max-width:560px}`;let ee=class extends Ie{constructor(){super(...arguments),this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.success=!1,this.newUserId="",this.submittingNewUser=!1,this.cancellingCreateUser=!1}static get styles(){return[Zi,ce,A]}async createNewContact(e){this.submittingNewUser=!0;const t=e.detail.newContact,i=e.detail.dataForAccounts;i.forEach(({accountId:o})=>{t.accounts.some(({accountNumber:n})=>n===o)||t.accounts.push({accountNumber:o})});try{this.newUserId=await this.createContact(t);const o=[this.createRoleAssignments(i,t.email),this.createUserFlags(i)];(await Promise.allSettled(o)).forEach(n=>{if(n.status==="rejected")throw new Error(n.reason)}),this.dispatchTableRefreshEvent(),this.success=!0}catch(o){this.success=!1}finally{this.submittingNewUser=!1}}async createContact(e){const t=await Lt.create({contactInput:e});if(!(t!=null&&t.id))throw new Error("Failed to create the new user.");return t.id}async createRoleAssignments(e,t){const i=[],o=Me(t);if(e.forEach(({rolesData:n})=>{n.filter(a=>a.role.removed===!1).forEach(a=>{a.locations.forEach(r=>{i.push({roleId:a.role.id,location:r.customerKnownSpaceName,accountNumber:a.accountId,contactId:this.newUserId,isInternal:o})})})}),i.length&&!(await De.create({roleAssignmentInput:i})).length)throw new Error("Failed to assign role(s) to the new user.")}async createUserFlags(e){var t;const i=[];for(const o of e)o.flagData&&((t=o.genericFlagsData)===null||t===void 0||t.forEach(n=>{n.updateService&&n.updateService.updates.forEach(a=>{const r={accountNumber:o.accountId,contactId:this.newUserId,userFlagType:At(n.label),location:a.customerKnownSpaceName||""};i.push(r)})}));if(i.length&&!(await Pe.create({userFlagAssignmentInput:i})).length)throw new Error("We could not assign the selected flags to the new user.")}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDraft,{composed:!0})),this.dispatchDrawerToggleEvent()}dispatchDrawerToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{composed:!0}))}dispatchTableRefreshEvent(){document.dispatchEvent(new CustomEvent(_.RefreshTable,{composed:!0}))}toggleDialog(){this.dispatchEvent(new CustomEvent(w.ToggleDialog,{composed:!0,bubbles:!0}))}toggleSuccess(){this.success=!this.success}resetSuccess(){this.success=!1}cancelCreateUser(){this.cancellingCreateUser=!0,setTimeout(()=>{var e;(e=this.createUser)===null||e===void 0||e.resetStep(),this.dispatchEvent(new CustomEvent(w.CancelCreateUser,{composed:!0})),this.cancellingCreateUser=!1},50)}renderCancelDialog(){return l` <ix-dialog ?open="${this.showCancelDialog}" @cancel="${this.toggleDialog}" data-testid="dialog-cancel-add-user"> <div class="dlr-text-heading md:w-[560px]" slot="headline"> Are you sure you want to cancel? </div> <div class="dialog-content" slot="content"> <p>All the details provided will be lost.</p> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" ?disabled="${this.cancellingCreateUser}" @click="${this.toggleDialog}" slot="secondary" data-testid="dismiss-close-create-user-button"> Dismiss </ix-button> <ix-button appearance="text" ?submitting="${this.cancellingCreateUser}" @click="${this.cancelCreateUser}" slot="primary" data-testid="cancel-create-user-button"> Cancel adding user </ix-button> </div> </ix-dialog> `}render(){return l` <create-user .newUserId="${this.newUserId}" ?showDrawer="${this.showDrawer}" ?submitting="${this.submittingNewUser}" ?success="${this.success}" @toggle-drawer="${this.dispatchDrawerToggleEvent}" @create-new-contact="${e=>this.createNewContact(e)}" @toggle-success="${this.toggleSuccess}" @reset-success="${this.resetSuccess}" data-testid="um-create-user"></create-user> <ix-draft header="Draft" subText="Add New User" ?isVisible="${this.showDraft}" @toggle-dialog="${this.toggleDialog}"></ix-draft> ${this.renderCancelDialog()} `}};s([d({type:Boolean})],ee.prototype,"showDrawer",void 0),s([d({type:Boolean})],ee.prototype,"showDraft",void 0),s([d({type:Boolean})],ee.prototype,"showCancelDialog",void 0),s([u()],ee.prototype,"success",void 0),s([u()],ee.prototype,"newUserId",void 0),s([u()],ee.prototype,"submittingNewUser",void 0),s([u()],ee.prototype,"cancellingCreateUser",void 0),s([U("create-user")],ee.prototype,"createUser",void 0),ee=s([b("create-user-container")],ee);const Wi=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}.edit-icon{font-size:22px;align-items:center;padding-right:1px}.email,.first-name,.last-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#edit-profile-id{display:flex;flex-direction:column}.single-row-textbox{width:100%}#edit-profile-id>*{margin:5px 0}ix-textbox,md-textfield{--md-outlined-text-field-width:100%;--md-outlined-text-field-focus-width:100%;width:inherit}.user-profile-name-input-group{display:flex;justify-content:space-between;gap:10px}.user-profile-input{padding-bottom:10px;width:100%}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;class Fs{async getUserProfile(){try{return await v.UserProfileSettingsApi.getUserSettings()}catch(t){m.handleError(t,"Failed to get user profile.");return}}async updateUserProfile(t){try{return await v.UserProfileSettingsApi.userProfilePatch(t)}catch(i){m.handleError(i,"Failed to update user profile.");return}}}const Qi=new Fs;class Ds{constructor(t){(this._host=t).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}getUserProfile(){return Qi.getUserProfile()}updateUserProfile(t){return Qi.updateUserProfile(t)}}var Ps=[{key:"Etc/GMT+12",value:"(UTC-12:00) International Date Line West"},{key:"Etc/GMT+11",value:"(UTC-11:00) Coordinated Universal Time-11"},{key:"America/Adak",value:"(UTC-10:00) Aleutian Islands"},{key:"Pacific/Honolulu",value:"(UTC-10:00) Hawaii"},{key:"Pacific/Marquesas",value:"(UTC-09:30) Marquesas Islands"},{key:"America/Anchorage",value:"(UTC-09:00) Alaska"},{key:"Etc/GMT+9",value:"(UTC-09:00) Coordinated Universal Time-09"},{key:"America/Tijuana",value:"(UTC-08:00) Baja California"},{key:"Etc/GMT+8",value:"(UTC-08:00) Coordinated Universal Time-08"},{key:"America/Los_Angeles",value:"(UTC-08:00) Pacific Time (US, Canada)"},{key:"America/Phoenix",value:"(UTC-07:00) Arizona"},{key:"America/Chihuahua",value:"(UTC-07:00) Chihuahua, La Paz, Mazatlan"},{key:"America/Denver",value:"(UTC-07:00) Mountain Time (US, Canada)"},{key:"America/Whitehorse",value:"(UTC-07:00) Yukon"},{key:"America/Guatemala",value:"(UTC-06:00) Central America"},{key:"America/Chicago",value:"(UTC-06:00) Central Time (US, Canada)"},{key:"Pacific/Easter",value:"(UTC-06:00) Easter Island"},{key:"America/Mexico_City",value:"(UTC-06:00) Guadalajara, Mexico City, Monterrey"},{key:"America/Regina",value:"(UTC-06:00) Saskatchewan"},{key:"America/Bogota",value:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco"},{key:"America/Cancun",value:"(UTC-05:00) Chetumal"},{key:"America/New_York",value:"(UTC-05:00) Eastern Time (US, Canada)"},{key:"America/Port-au-Prince",value:"(UTC-05:00) Haiti"},{key:"America/Havana",value:"(UTC-05:00) Havana"},{key:"America/Indiana/Indianapolis",value:"(UTC-05:00) Indiana (East)"},{key:"America/Grand_Turk",value:"(UTC-05:00) Turks and Caicos"},{key:"America/Asuncion",value:"(UTC-04:00) Asuncion"},{key:"America/Halifax",value:"(UTC-04:00) Atlantic Time (Canada)"},{key:"America/Caracas",value:"(UTC-04:00) Caracas"},{key:"America/Cuiaba",value:"(UTC-04:00) Cuiaba"},{key:"America/La_Paz",value:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan"},{key:"America/Santiago",value:"(UTC-04:00) Santiago"},{key:"America/St_Johns",value:"(UTC-03:30) Newfoundland"},{key:"America/Araguaina",value:"(UTC-03:00) Araguaina"},{key:"America/Sao_Paulo",value:"(UTC-03:00) Brasilia"},{key:"America/Cayenne",value:"(UTC-03:00) Cayenne, Fortaleza"},{key:"America/Argentina/Buenos_Aires",value:"(UTC-03:00) City of Buenos Aires"},{key:"America/Nuuk",value:"(UTC-03:00) Greenland"},{key:"America/Montevideo",value:"(UTC-03:00) Montevideo"},{key:"America/Punta_Arenas",value:"(UTC-03:00) Punta Arenas"},{key:"America/Miquelon",value:"(UTC-03:00) Saint Pierre and Miquelon"},{key:"America/Bahia",value:"(UTC-03:00) Salvador"},{key:"Etc/GMT+2",value:"(UTC-02:00) Coordinated Universal Time-02"},{key:"Atlantic/Azores",value:"(UTC-01:00) Azores"},{key:"Atlantic/Cape_Verde",value:"(UTC-01:00) Cabo Verde Is."},{key:"Etc/UTC",value:"(UTC) Coordinated Universal Time"},{key:"Europe/London",value:"(UTC+00:00) Dublin, Edinburgh, Lisbon, London"},{key:"Atlantic/Reykjavik",value:"(UTC+00:00) Monrovia, Reykjavik"},{key:"Africa/Sao_Tome",value:"(UTC+00:00) Sao Tome"},{key:"Africa/Casablanca",value:"(UTC+01:00) Casablanca"},{key:"Europe/Berlin",value:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"},{key:"Europe/Budapest",value:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"},{key:"Europe/Paris",value:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris"},{key:"Europe/Warsaw",value:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb"},{key:"Africa/Lagos",value:"(UTC+01:00) West Central Africa"},{key:"Asia/Amman",value:"(UTC+02:00) Amman"},{key:"Europe/Bucharest",value:"(UTC+02:00) Athens, Bucharest"},{key:"Asia/Beirut",value:"(UTC+02:00) Beirut"},{key:"Africa/Cairo",value:"(UTC+02:00) Cairo"},{key:"Europe/Chisinau",value:"(UTC+02:00) Chisinau"},{key:"Asia/Damascus",value:"(UTC+02:00) Damascus"},{key:"Asia/Hebron",value:"(UTC+02:00) Gaza, Hebron"},{key:"Africa/Johannesburg",value:"(UTC+02:00) Harare, Pretoria"},{key:"Europe/Kiev",value:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"},{key:"Asia/Jerusalem",value:"(UTC+02:00) Jerusalem"},{key:"Africa/Juba",value:"(UTC+02:00) Juba"},{key:"Europe/Kaliningrad",value:"(UTC+02:00) Kaliningrad"},{key:"Africa/Khartoum",value:"(UTC+02:00) Khartoum"},{key:"Africa/Tripoli",value:"(UTC+02:00) Tripoli"},{key:"Africa/Windhoek",value:"(UTC+02:00) Windhoek"},{key:"Asia/Baghdad",value:"(UTC+03:00) Baghdad"},{key:"Europe/Istanbul",value:"(UTC+03:00) Istanbul"},{key:"Asia/Riyadh",value:"(UTC+03:00) Kuwait, Riyadh"},{key:"Europe/Minsk",value:"(UTC+03:00) Minsk"},{key:"Europe/Moscow",value:"(UTC+03:00) Moscow, St. Petersburg"},{key:"Africa/Nairobi",value:"(UTC+03:00) Nairobi"},{key:"Europe/Volgograd",value:"(UTC+04:00) Volgograd"},{key:"Asia/Tehran",value:"(UTC+03:30) Tehran"},{key:"Asia/Dubai",value:"(UTC+04:00) Abu Dhabi, Muscat"},{key:"Europe/Astrakhan",value:"(UTC+04:00) Astrakhan, Ulyanovsk"},{key:"Asia/Baku",value:"(UTC+04:00) Baku"},{key:"Europe/Samara",value:"(UTC+04:00) Izhevsk, Samara"},{key:"Indian/Mauritius",value:"(UTC+04:00) Port Louis"},{key:"Europe/Saratov",value:"(UTC+04:00) Saratov"},{key:"Asia/Tbilisi",value:"(UTC+04:00) Tbilisi"},{key:"Asia/Yerevan",value:"(UTC+04:00) Yerevan"},{key:"Asia/Kabul",value:"(UTC+04:30) Kabul"},{key:"Asia/Tashkent",value:"(UTC+05:00) Ashgabat, Tashkent"},{key:"Asia/Yekaterinburg",value:"(UTC+05:00) Ekaterinburg"},{key:"Asia/Karachi",value:"(UTC+05:00) Islamabad, Karachi"},{key:"Asia/Qyzylorda",value:"(UTC+05:00) Qyzylorda"},{key:"Asia/Kolkata",value:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"},{key:"Asia/Colombo",value:"(UTC+05:30) Sri Jayawardenepura"},{key:"Asia/Kathmandu",value:"(UTC+05:45) Kathmandu"},{key:"Asia/Almaty",value:"(UTC+06:00) Astana"},{key:"Asia/Dhaka",value:"(UTC+06:00) Dhaka"},{key:"Asia/Omsk",value:"(UTC+06:00) Omsk"},{key:"Asia/Yangon",value:"(UTC+06:30) Yangon (Rangoon)"},{key:"Asia/Bangkok",value:"(UTC+07:00) Bangkok, Hanoi, Jakarta"},{key:"Asia/Barnaul",value:"(UTC+07:00) Barnaul, Gorno-Altaysk"},{key:"Asia/Hovd",value:"(UTC+07:00) Hovd"},{key:"Asia/Krasnoyarsk",value:"(UTC+07:00) Krasnoyarsk"},{key:"Asia/Novosibirsk",value:"(UTC+07:00) Novosibirsk"},{key:"Asia/Tomsk",value:"(UTC+07:00) Tomsk"},{key:"Asia/Shanghai",value:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi"},{key:"Asia/Irkutsk",value:"(UTC+08:00) Irkutsk"},{key:"Asia/Singapore",value:"(UTC+08:00) Kuala Lumpur, Singapore"},{key:"Australia/Perth",value:"(UTC+08:00) Perth"},{key:"Asia/Taipei",value:"(UTC+08:00) Taipei"},{key:"Asia/Ulaanbaatar",value:"(UTC+08:00) Ulaanbaatar"},{key:"Australia/Eucla",value:"(UTC+08:45) Eucla"},{key:"Asia/Chita",value:"(UTC+09:00) Chita"},{key:"Asia/Tokyo",value:"(UTC+09:00) Osaka, Sapporo, Tokyo"},{key:"Asia/Pyongyang",value:"(UTC+09:00) Pyongyang"},{key:"Asia/Seoul",value:"(UTC+09:00) Seoul"},{key:"Asia/Yakutsk",value:"(UTC+09:00) Yakutsk"},{key:"Australia/Adelaide",value:"(UTC+09:30) Adelaide"},{key:"Australia/Darwin",value:"(UTC+09:30) Darwin"},{key:"Australia/Brisbane",value:"(UTC+10:00) Brisbane"},{key:"Australia/Sydney",value:"(UTC+10:00) Canberra, Melbourne, Sydney"},{key:"Pacific/Port_Moresby",value:"(UTC+10:00) Guam, Port Moresby"},{key:"Australia/Hobart",value:"(UTC+10:00) Hobart"},{key:"Asia/Vladivostok",value:"(UTC+10:00) Vladivostok"},{key:"Australia/Lord_Howe",value:"(UTC+10:30) Lord Howe Island"},{key:"Pacific/Bougainville",value:"(UTC+11:00) Bougainville Island"},{key:"Asia/Srednekolymsk",value:"(UTC+11:00) Chokurdakh"},{key:"Asia/Magadan",value:"(UTC+11:00) Magadan"},{key:"Pacific/Norfolk",value:"(UTC+11:00) Norfolk Island"},{key:"Asia/Sakhalin",value:"(UTC+11:00) Sakhalin"},{key:"Pacific/Guadalcanal",value:"(UTC+11:00) Solomon Is., New Caledonia"},{key:"Asia/Kamchatka",value:"(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky"},{key:"Pacific/Auckland",value:"(UTC+12:00) Auckland, Wellington"},{key:"Etc/GMT-12",value:"(UTC+12:00) Coordinated Universal Time+12"},{key:"Pacific/Fiji",value:"(UTC+12:00) Fiji"},{key:"Pacific/Chatham",value:"(UTC+12:45) Chatham Islands"},{key:"Etc/GMT-13",value:"(UTC+13:00) Coordinated Universal Time+13"},{key:"Pacific/Tongatapu",value:"(UTC+13:00) Nuku'alofa"},{key:"Pacific/Apia",value:"(UTC+13:00) Samoa"},{key:"Pacific/Kiritimati",value:"(UTC+14:00) Kiritimati Island"}];const Ms=()=>Ps.map(({key:e,value:t})=>({timeZone:e,displayName:t}));let B=class extends Ie{constructor(){super(...arguments),this.userProfileController=new Ds(this),this.supportedDateFormat={"MM/dd/yyyy":"mm/dd/yyyy (e.g.: 04/24/2023)","dd/MM/yyyy":"dd/mm/yyyy (e.g.: 24/04/2023)","yyyy/MM/dd":"yyyy/mm/dd (e.g.: 2023/04/24)"},this.supportedTimeFormat={"h:mm a":"12-hour clock (e.g. 1:00 PM)","HH:mm":"24-hour clock (e.g. 13:00)"},this.isDialogVisible=!1,this.allowSave=!0,this.isLoading=!1,this.timezones=Ms()}async firstUpdated(){await this.retrieveUserProfile(),this.shouldDisableSaveButton()}async retrieveUserProfile(){this.isLoading=!0,this.userProfile=await this.userProfileController.getUserProfile(),this.isLoading=!1}closeDialog(){this.isDialogVisible=!1,this.dispatchEvent(new CustomEvent("closeEditProfileDialog",{bubbles:!0,composed:!0}))}async saveUserProfileChanges(){var e,t,i,o;const n={profileSettingEditInput:{firstName:(e=q(this.firstName))!==null&&e!==void 0?e:this.firstName.value,lastName:(t=q(this.lastName))!==null&&t!==void 0?t:this.lastName.value,contactPhoneNumber:(i=be(this.phoneNumber))!==null&&i!==void 0?i:this.phoneNumber.value,preferredTimezone:this.preferredTimezone.value,preferredDateFormat:this.preferredDateFormat.value,preferredTimeFormat:this.preferredTimeFormat.value}};((o=this.userProfile)===null||o===void 0?void 0:o.preferredTimezone)!==n.profileSettingEditInput.preferredTimezone&&(n.profileSettingEditInput.timezoneOverridden=!0),this.isLoading=!0,await this.userProfileController.updateUserProfile(n).then(()=>{Xt("Your profile info has been successfully updated",3e3,"center")}),this.saveDateTimeFormatToLocalStorage(n),this.isLoading=!1,this.closeDialog()}validatePhoneInput(e,t){const i=be(e);if(i==="000-000-0000"){e.error=!1,e.errorText="",this.shouldDisableSaveButton();return}if(this.userProfile.contactPhoneNumber=i!=null?i:"",e.required&&!Ue(e,i)){this.allowSave=!1;return}if(!yt(e,t)){this.allowSave=!1;return}e.error=!1,e.errorText="",this.shouldDisableSaveButton()}saveDateTimeFormatToLocalStorage(e){localStorage.setItem("date-format",JSON.stringify({preferredDateFormat:e.profileSettingEditInput.preferredDateFormat,preferredTimeFormat:e.profileSettingEditInput.preferredTimeFormat,preferredTimezone:e.profileSettingEditInput.preferredTimezone})),this.dispatchEvent(new CustomEvent("dateFormatChanged",{bubbles:!0,composed:!0}))}shouldDisableSaveButton(){this.allowSave=!(this.isInvalid()||this.isEmpty())}isInvalid(){return this.firstName.error||this.lastName.error||this.phoneNumber.error}isEmpty(){var e,t,i;return!(!((e=this.userProfile)===null||e===void 0)&&e.firstName)||!(!((t=this.userProfile)===null||t===void 0)&&t.lastName)||!(!((i=this.userProfile)===null||i===void 0)&&i.contactPhoneNumber)}render(){var e,t,i,o,n,a,r,c;return l`<ix-dialog class="dialog z-50 relative" ?open="${this.isDialogVisible}" @close="${()=>this.closeDialog()}"> ${this.isLoading?l`<ix-progress indeterminate slot="content"></ix-progress>`:""} <div class="dlr-text-heading flex p-6" slot="headline"> <span>Edit Profile</span> </div> <form class="dialog-form min-w-0 max-w-full max-[640px]:w-screen px-6 pb-5 pt-[0px]" slot="content" id="edit-profile-id" method="dialog"> <div class="user-profile-name-input-group grid grid-cols-1 sm:grid-cols-2 gap-3"> <div class="user-profile-input"> <ix-textbox required id="first-name" class="textbox" type="text" pattern="${$e.name}" label="First Name" placeholder="i.e. First Name" value="${(t=(e=this.userProfile)===null||e===void 0?void 0:e.firstName)!==null&&t!==void 0?t:""}" @input="${()=>{var p;this.allowSave=ft(this.firstName,this.firstName.value,"Invalid first name"),this.userProfile.firstName=(p=q(this.firstName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> <div class="user-profile-input"> <ix-textbox required id="last-name" class="textbox" type="text" pattern="${$e.name}" label="Last Name" placeholder="i.e. Last Name" value="${(o=(i=this.userProfile)===null||i===void 0?void 0:i.lastName)!==null&&o!==void 0?o:""}" @input="${()=>{var p;this.allowSave=ft(this.lastName,this.lastName.value,"Invalid last name"),this.userProfile.lastName=(p=q(this.lastName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> </div> <div class="user-profile-input mb-4"> <ix-phone-input required id="phone-number" class="single-row-textbox w-full" label="Phone Number" value="${(a=(n=this.userProfile)===null||n===void 0?void 0:n.contactPhoneNumber)!==null&&a!==void 0?a:""}" @input="${()=>{this.validatePhoneInput(this.phoneNumber,"Invalid phone number")}}"></ix-phone-input> </div> <div class="user-profile-input"> <ix-textbox id="email" class="single-row-textbox" type="email" label="Email Address" readOnly="true" disabled="true" value="${(c=(r=this.userProfile)===null||r===void 0?void 0:r.email)!==null&&c!==void 0?c:""}"></ix-textbox> </div> <div class="user-profile-input"> <ix-select appearance="outlined" id="preferredTimezone" label="Time Zone" menu-positioning="fixed"> ${this.timezones.map(p=>{var g;return l` <ix-select-option value="${p.timeZone}" ?selected="${p.timeZone===((g=this.userProfile)===null||g===void 0?void 0:g.preferredTimezone)}"> <div slot="headline">${p.displayName}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredDateFormat" label="Date format"> ${Object.entries(this.supportedDateFormat).map(([p,g])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredDateFormat)}"> <div slot="headline">${g}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredTimeFormat" label="Time Format"> ${Object.entries(this.supportedTimeFormat).map(([p,g])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredTimeFormat)}"> <div slot="headline">${g}</div> </ix-select-option> `})} </ix-select> </div> </form> <div class="dialog-actions p-2" slot="actions"> <ix-button form="edit-profile-id" appearance="text" text="Cancel" @click="${()=>this.closeDialog()}"> Cancel </ix-button> <ix-button id="save-user-button" appearance="text" text="Save Changes" ?disabled="${!this.allowSave||this.isLoading}" @click="${()=>{this.saveUserProfileChanges()}}"> Save Changes </ix-button> </div> </ix-dialog>`}};B.styles=[Wi,A],s([d({type:Boolean})],B.prototype,"isDialogVisible",void 0),s([u()],B.prototype,"allowSave",void 0),s([u()],B.prototype,"userProfile",void 0),s([u()],B.prototype,"isLoading",void 0),s([u()],B.prototype,"timezones",void 0),s([U("#first-name")],B.prototype,"firstName",void 0),s([U("#last-name")],B.prototype,"lastName",void 0),s([U("#phone-number")],B.prototype,"phoneNumber",void 0),s([U("#preferredTimezone")],B.prototype,"preferredTimezone",void 0),s([U("#preferredDateFormat")],B.prototype,"preferredDateFormat",void 0),s([U("#preferredTimeFormat")],B.prototype,"preferredTimeFormat",void 0),B=s([b("ui-um-user-profile")],B);class Bs{async getAuthorisation(){const t=await Ye.getState(),[i,o,n,a]=t;return[i,o,n,a]}}const Ls=new Bs;class Os extends Ae{constructor(){super(...arguments),this.expandedNodes=[]}toggleNodeExpanded(t){this.expandedNodes.includes(t)?this.expandedNodes=this.expandedNodes.filter(i=>i!==t):this.expandedNodes.push(t)}async refresh(){this.requestHydration(),this.set(gs(this.expandedNodes)),this.completeHydration()}}const Yi=new Os({});let O=class extends Ie{constructor(){super(),this.errorService=m,this.routes=[],this.baseUrl="",this.isStandalone=!1,this.disableAuthentication=!1,this.compact=localStorage.getItem("compact")==="true",this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.isEditUserProfileDialogOpen=!1,this.handleDrawerEventBinding=this.handleDrawerEvent.bind(this),this.handleCloseEditProfileDialogBinding=this.handleCloseEditProfileDialog.bind(this),this.handleAccountSwitchBinding=this.handleAccountSwitch.bind(this),this.handleEditProfileEventBinding=this.handleEditProfileEvent.bind(this),$.setLoading=!0}connectedCallback(){super.connectedCallback(),window.addEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.addEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.addEventListener(_.EditProfile,this.handleEditProfileEventBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.removeEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.removeEventListener(_.EditProfile,this.handleEditProfileEventBinding),ia(),m.destroyErrorHandler()}async handleAccountSwitch(e){const t=e.detail;$.setAccountNumber(t),await this.fetchData();const i=window.location.href.split("?")[0];window.history.replaceState({},document.title,i)}handleDrawerEvent(){this.toggleDrawer()}async firstUpdated(){await this.configureAuthentication(),await this.fetchData(),this.init(),$.setLoading=!1}updated(e){e.has("routes")&&this.routes.length&&ta().setRoutes(this.routes)}async fetchData(){const e=fe.getUserDetails(),{email:t}=e;return Ls.getAuthorisation().then(i=>{const[o,n,a,r]=i;return $.setMyPermissions(o),P.myPermissions=$.getMyPermissions(),$.setEmail(t),$.setPermissions(n),$.setAccounts(r),pe.set(a),Yi.refresh(),i})}async configureAuthentication(){this.disableAuthentication||D().UserManagement.UI.DisableUserManagementUIAuth||!this.isStandalone?await this.configureAuthorisation():fe.isProcessing()||(fe.isLoggedIn()?await this.configureAuthorisation():fe.redirectToAuth())}async configureAuthorisation(){const e=fe.getUserDetails(),{accountNumber:t}=e;$.setAccountNumber(t)}init(){setTimeout(()=>{this.mainApp&&(ea(this.mainApp,this.baseUrl,mi),Se(window,_.AuthenticationComplete,{accountNumber:$.getAccountNumber()}))})}toggleDrawer(){this.showDraft&&(this.showDraft=!this.showDraft),this.showDrawer=!this.showDrawer}closeDrawer(){this.showDrawer=!1}toggleCompact(){this.compact=!this.compact,localStorage.setItem("compact",`${this.compact}`)}toggleDraft(){this.showDrawer=!this.showDrawer,this.showDraft=!this.showDraft}cancelCreateUser(){this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1}toggleCancelDialog(){this.showCancelDialog=!this.showCancelDialog}renderCreateUser(){return P.hasExternalUserCreate()?l` <create-user-container ?showDrawer="${this.showDrawer}" ?showDraft="${this.showDraft}" ?showCancelDialog="${this.showCancelDialog}" @blur-drawer="${this.toggleCancelDialog}" @toggle-drawer="${this.toggleDrawer}" @toggle-draft="${this.toggleDraft}" @toggle-dialog="${this.toggleCancelDialog}" @close-drawer="${this.closeDrawer}" @cancel-create-user="${this.cancelCreateUser}"></create-user-container> `:x}renderLoading(){return $.getLoading?l` <main> <error-dialog></error-dialog> <ix-progress id="application-loading-bar" aria-label="Application loading bar" indeterminate></ix-progress> </main> `:x}handleEditProfileEvent(){this.isEditUserProfileDialogOpen=!0}handleCloseEditProfileDialog(){this.isEditUserProfileDialogOpen=!1}renderEditProfileForm(){return l` <ui-um-user-profile ?isDialogVisible="${this.isEditUserProfileDialogOpen}" @closeEditProfileDialog="${this.handleCloseEditProfileDialogBinding}"></ui-um-user-profile>`}render(){return l` ${this.renderCreateUser()} <div class="flex flex-col"> <div class="animate-width absolute inset-0 bg-black opacity-50 z-20 ${this.compact?"hidden":"block"} lg:hidden" @click="${this.toggleCompact}" @keypress="${this.toggleCompact}"></div> ${this.isStandalone?l` <nav class="nav-bar wide p-4 m-2 rounded-xl flex items-center relative z-1 md:hidden"> <div class="flex-1"> <ix-icon-button @click="${this.toggleCompact}" icon="menu" class="white-icon"></ix-icon-button> </div> <div class="w-[178px]"> <svg focusable="false" viewBox="0 0 178 27" fill="white" class="w-full"> ${He.digitalRealtyLogoWithText} </svg> </div> <div class="flex-1"></div> </nav> `:x} <div class="w-full h-full flex relative ${this.showDrawer?"drawer-visible":""}"> ${this.isStandalone?l` <div class="${this.compact?"left-[-200px]":"left-0"} min-w-[96px] absolute z-1 md:relative lg:min-w-fit md:left-0 animate-width h-screen"> <navigation-bar @toggle-menu="${this.toggleCompact}" ?compact="${this.compact}" class="h-full p-2 block absolute drop-shadow-lg overflow-auto sm:overflow-visible lg:static lg:p-4"></navigation-bar> </div> `:x} <div class="grow w-full h-full"> <div class="flex flex-col grow h-full ${this.isStandalone?"p-2 lg:p-4":""}"> ${this.isStandalone?l`<app-header @create-user="${this.toggleDrawer}"></app-header>`:x} <main class="h-full">${this.renderLoading()}</main> </div> </div> </div> </div> ${this.renderEditProfileForm()}`}};O.styles=[ti,_e,A],s([d({type:Array})],O.prototype,"routes",void 0),s([d({type:String})],O.prototype,"baseUrl",void 0),s([d({type:Boolean})],O.prototype,"isStandalone",void 0),s([d({type:Boolean,attribute:!0})],O.prototype,"disableAuthentication",void 0),s([d({type:Boolean,attribute:!1})],O.prototype,"compact",void 0),s([u()],O.prototype,"showDrawer",void 0),s([u()],O.prototype,"showDraft",void 0),s([u()],O.prototype,"showCancelDialog",void 0),s([u()],O.prototype,"isEditUserProfileDialogOpen",void 0),s([U("main")],O.prototype,"mainApp",void 0),O=s([b("ui-user-management")],O);export{w as $,_ as A,Ae as B,Pe as C,Dt as D,at as E,ms as F,nt as G,$t as H,Me as I,Ka as J,Pi as K,Si as L,Wi as M,vt as N,sa as O,ft as P,yt as Q,z as R,be as S,A as T,et as U,aa as V,ha as W,$e as X,ca as Y,vi as Z,bt as _,oa as a,wi as a0,re as a1,oe as a2,Ut as a3,wt as a4,Fi as a5,It as a6,k as a7,Vi as a8,ot as a9,Ji as aa,Ye as ab,ji as ac,xt as ad,xi as ae,Zi as af,V as b,pe as c,Lt as d,ei as e,Yi as f,je as g,$ as h,da as i,q as j,m as k,St as l,la as m,Ge as n,Us as o,kt as p,Xt as q,Se as r,Ke as s,De as t,P as u,pi as v,D as w,Xe as x,Ni as y,Fe as z};
|