import{n as St}from"./chunk-3VKXXPZB.js";import{A as Ui,F as $i}from"./chunk-6M5IHSHH.js";import{a as We,b as ji,c as zi,d as le,f as Gi,g as yt,j as qe,k as Ke,l as Ye,m as bt,n as Hi}from"./chunk-VUA2UFJT.js";import{c as we}from"./chunk-TKCG4RR3.js";import{D as vi,E as ht,F as xi,Fa as Ei,G as Si,Ja as Li,K as yi,L as bi,Ob as Pi,P as ge,Q as Ti,R as Ce,S as B,T as Ee,U as J,Ua as xt,Va as wi,Xa as Di,Ya as Ri,aa as He,ba as ft,bb as Fi,c as de,ca as Le,da as Ii,e as oe,ea as vt,eb as Mi,f as _e,fb as ki,g as Ie,ga as Qe,gb as Bi,hb as Oi,ib as Ni,j as gi,jb as Vi,k as Ci,ka as Ai,l as hi,m as fi,n as Ae,q as Ct,r as je,u as ze,z as Ge}from"./chunk-W2ZDDUN5.js";import{$b as z,Ba as C,Bc as Jt,Bf as $e,C as Ut,Ca as h,Ce as oi,D as w,Ef as pi,Ff as be,Hb as l,Hf as di,Ib as u,Ie as si,J as nt,Jb as S,K as ue,Ka as rt,Kb as I,Lb as A,Lf as pe,M as Be,Mb as st,N as k,Nb as y,Nc as at,Of as pt,Pc as Ve,Pd as Pe,Qc as Y,Qd as ne,Qe as mt,R as fe,Rd as Z,Sb as f,Sd as Xt,Tb as p,Td as ei,Tf as X,Tg as gt,Ue as ai,Uf as dt,V as $t,Vc as Zt,W as jt,Wb as R,Wc as ie,Wd as ct,We as ci,Xa as Gt,Xd as ti,Yd as lt,Za as Ht,Zd as ii,Zf as _t,_a as r,_b as j,a as Q,ac as G,bc as D,ca as zt,cc as _,d as W,dc as E,dd as ye,ec as v,fb as x,fc as Wt,gh as P,ha as ve,hb as O,he as re,hh as _i,i as Vt,ib as Se,ic as qt,jc as Kt,kb as ot,kc as Yt,la as $,n as ae,nb as d,ne as F,oc as ee,oh as Te,pc as te,pe as Ue,pf as ut,r as M,ra as q,rf as li,s as ce,sa as xe,sf as mi,ta as Oe,tb as b,te as ni,ua as L,ub as m,uc as a,ue as ri,v as it,va as K,vc as c,wb as N,wc as Ne,wf as ui,y as Pt,yb as Qt,yc as V}from"./chunk-5LB5MWMX.js";import{a as H,b as ke}from"./chunk-QWWW7GFA.js";var Tt=class{},De=(()=>{class t{constructor(e){this.asmAdapter=e}customerSearch(e){return this.asmAdapter.customerSearch(e)}customerLists(){return this.asmAdapter.customerLists()}bindCart(e){return this.asmAdapter.bindCart(e)}createCustomer(e){return this.asmAdapter.createCustomer(e)}static{this.\u0275fac=function(i){return new(i||t)(L(Tt))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Ys=new Oe("CustomerSearchPageNormalizer"),Js=new Oe("CustomerListsNormalizer"),Qi=(()=>{class t{constructor(e,i,n){this.commandService=e,this.asmConnector=i,this.userAccountFacade=n,this.bindCartCommand$=this.commandService.create(o=>this.userAccountFacade.get().pipe(M(g=>{if(g?.uid)return g.uid;throw new Error("No identifier for authenticated user found.")}),k(1),ue(g=>this.asmConnector.bindCart({cartId:o,customerId:g}))))}bindCart(e){return this.bindCartCommand$.execute(e)}static{this.\u0275fac=function(i){return new(i||t)(L(mt),L(De),L(we))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac})}}return t})(),Wi=(()=>{class t{constructor(e,i){this.asmConnector=e,this.command=i,this.createCustomerCommand=this.command.create(({user:n})=>this.asmConnector.createCustomer(n))}createCustomer(e){return this.createCustomerCommand.execute({user:e})}static{this.\u0275fac=function(i){return new(i||t)(L(De),L(mt))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac})}}return t})(),Ki="[Asm] UI Update",Je=class{constructor(s){this.payload=s,this.type=Ki}},Yi="asm",Re="[asm] Customer search data",Fe="[asm] Customer list customers search data",Ji="[Asm] Customer Search",Zi="[Asm] Customer Search Fail",_n="[Asm] Customer Search Success",gn="[Asm] Customer Search Reset",Xi="[Asm] Customer List Customers Search",Cn="[Asm] Customer List Customers Search Fail",hn="[Asm] Customer List Customers Search Success",fn="[Asm] Customer List Customers Search Reset",It=class extends F.LoaderLoadAction{constructor(s){super(Re),this.payload=s,this.type=Ji}},At=class extends F.LoaderFailAction{constructor(s){super(Re,s),this.payload=s,this.type=Zi}},Ze=class extends F.LoaderSuccessAction{constructor(s){super(Re),this.payload=s,this.type=_n}},Et=class extends F.LoaderResetAction{constructor(){super(Re),this.type=gn}},Lt=class extends F.LoaderLoadAction{constructor(s){super(Fe),this.payload=s,this.type=Xi}},wt=class extends F.LoaderFailAction{constructor(s){super(Fe,s),this.payload=s,this.type=Cn}},Dt=class extends F.LoaderSuccessAction{constructor(s){super(Fe),this.payload=s,this.type=hn}},Rt=class extends F.LoaderResetAction{constructor(){super(Fe),this.type=fn}},vn="[Auth] Logout Customer Support Agent";var xn=(()=>{class t{constructor(e,i){this.actions$=e,this.asmConnector=i,this.logger=K(oi),this.customerSearch$=ct(()=>this.actions$.pipe(lt(Ji),M(n=>n.payload),ve(n=>this.asmConnector.customerSearch(n).pipe(M(o=>new Ze(o)),nt(o=>o.status===400&&o.details?.[0]?.message?.indexOf("Wrong orderId")>-1?ae(new Ze({entries:[]})):ae(new At(ut(o,this.logger)))))))),this.customerListCustomersSearch$=ct(()=>this.actions$.pipe(lt(Xi),M(n=>n.payload),ve(n=>this.asmConnector.customerSearch(n).pipe(M(o=>new Dt(o)),nt(o=>ae(new wt(ut(o,this.logger))))))))}static{this.\u0275fac=function(i){return new(i||t)(L(ti),L(De))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac})}}return t})(),Sn=[xn],yn={collapsed:!1};function bn(t=yn,s){switch(s.type){case Ki:return H(H({},t),s.payload);case Zi:return H(H({},t),s.payload);default:return t}}function Tn(){return{customerSearchResult:F.loaderReducer(Re),customerListCustomersSearchResult:F.loaderReducer(Fe),asmUi:bn}}var en=new Oe("AsmReducers"),In={provide:en,useFactory:Tn};function An(t){return function(s,e){return e.type===vn&&(s=ke(H({},s),{customerSearchResult:{}})),t(s,e)}}var En=[An],Ft=Xt(Yi),tn=Z(Ft,t=>t.asmUi),nn=Z(Ft,t=>t.customerSearchResult),Ln=Z(nn,t=>F.loaderValueSelector(t)),wn=Z(nn,t=>F.loaderLoadingSelector(t)),Mt=Z(Ft,t=>t.customerListCustomersSearchResult),Dn=Z(Mt,t=>F.loaderValueSelector(t)),Rn=Z(Mt,t=>F.loaderLoadingSelector(t)),Fn=Z(Mt,t=>F.loaderErrorSelector(t));var qi=(()=>{class t{constructor(e,i,n){this.queryService=e,this.asmConnector=i,this.store=n,this.customerListQuery$=this.queryService.create(()=>this.asmConnector.customerLists(),{reloadOn:void 0,resetOn:void 0})}getCustomerLists(){return this.customerListQuery$.get()}getCustomerListsState(){return this.customerListQuery$.getState()}customerListCustomersSearch(e){this.store.dispatch(new Lt(e))}getCustomerListCustomersSearchResults(){return this.store.pipe(ne(Dn))}getCustomerListCustomersSearchResultsLoading(){return this.store.pipe(ne(Rn))}customerListCustomersSearchReset(){this.store.dispatch(new Rt)}getCustomerListCustomersSearchResultsError(){return this.store.pipe(ne(Fn))}static{this.\u0275fac=function(i){return new(i||t)(L(ai),L(De),L(Pe))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac})}}return t})(),Mn=[qi,{provide:Ye,useExisting:qi},Qi,{provide:qe,useExisting:Qi},Wi,{provide:Ke,useExisting:Wi}],kn=(()=>{class t{constructor(e,i,n){this.statePersistenceService=e,this.store=i,this.authStorageService=n,this.subscription=new Q,this.key="asm"}initSync(){this.subscription.add(this.statePersistenceService.syncWithStorage({key:this.key,state$:this.getAsmState(),onRead:e=>this.onRead(e)}))}getAsmState(){return ce([this.store.pipe(w(e=>!!e.asm),ne(tn)),ae(this.authStorageService.getEmulatedUserToken()),this.authStorageService.getTokenTarget()]).pipe(M(([e,i,n])=>{let o=i;return o&&(o=H({},i),delete o.refresh_token),{ui:e,emulatedUserToken:o,tokenTarget:n}}))}onRead(e){e&&(e.ui&&this.store.dispatch(new Je(e.ui)),e.emulatedUserToken&&this.authStorageService.setEmulatedUserToken(e.emulatedUserToken),e.tokenTarget&&this.authStorageService.setTokenTarget(e.tokenTarget))}ngOnDestroy(){this.subscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)(L(li),L(Pe),L(Gi))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Bn=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=Se({type:t})}static{this.\u0275inj=xe({providers:[In],imports:[ye,ui,ei.forFeature(Yi,en,{metaReducers:En}),ii.forFeature(Sn)]})}}return t})();function On(t){return()=>t.initSync()}var Zs=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=Se({type:t})}static{this.\u0275inj=xe({providers:[De,{provide:ci,useFactory:On,deps:[kn],multi:!0},...Mn],imports:[ye,Bn]})}}return t})(),Xe=(()=>{class t{constructor(e){this.store=e}customerSearch(e){this.store.dispatch(new It(e))}customerSearchReset(){this.store.dispatch(new Et)}getCustomerSearchResults(){return this.store.pipe(ne(Ln))}getCustomerSearchResultsLoading(){return this.store.pipe(ne(wn))}updateAsmUiState(e){this.store.dispatch(new Je(e))}getAsmUiState(){return this.store.pipe(ne(tn))}static{this.\u0275fac=function(i){return new(i||t)(L(Pe))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var U=function(t){return t[t.ASC=1]="ASC",t[t.DESC=-1]="DESC",t}(U||{});function Nn(t=U.ASC){return(s,e)=>s===e?0:(s===!0?-1:1)*t}var Xs=Nn(U.ASC);function Vn(t=U.ASC){return(s,e)=>s===e?0:(s<e?-1:1)*t}var ea=Vn(U.ASC);function rn(t=U.ASC){return(s,e)=>{let i=s==null,n=e==null;return i===n?0:(i?-1:1)*t}}var ta=rn(U.ASC),ia=rn(U.DESC);function on(t=U.ASC){return(s,e)=>s===e?0:(s-e<0?-1:1)*t}var na=on(U.ASC),ra=on(U.DESC);function Pn(t=U.ASC,s,e){return(i,n)=>(i??"").localeCompare(n??"",s,e)*t}var oa=Pn(U.ASC);var kt=function(t){return t.NAVIGATE="NAVIGATE",t}(kt||{});B.ASM_CUSTOMER_360="ASM_CUSTOMER_360";function $n(t,s){if(t&1){let e=y();l(0,"cx-message",17),a(1,"cxTranslate"),f("closeMessage",function(){C(e);let n=p(2);return h(n.closeDialogAlert())}),u()}if(t&2){let e=p(2);m("text",c(1,2,"asm.saveCart.dialog.saveInfo"))("type",e.globalMessageType.MSG_TYPE_INFO)}}function jn(t,s){if(t&1&&(I(0),l(1,"div",15),d(2,$n,2,4,"cx-message",16),a(3,"async"),u(),A()),t&2){let e=p();r(2),m("ngIf",c(3,1,e.showDialogAlert$))}}function zn(t,s){if(t&1){let e=y();l(0,"cx-message",17),a(1,"cxTranslate"),f("closeMessage",function(){C(e);let n=p(2);return h(n.closeDialogAlert())}),u()}if(t&2){let e=p(2);m("text",c(1,2,"asm.saveCart.dialog.disableInfo"))("type",e.globalMessageType.MSG_TYPE_WARNING)}}function Gn(t,s){if(t&1&&(l(0,"div",15),d(1,zn,2,4,"cx-message",16),a(2,"async"),u()),t&2){let e=p();r(),m("ngIf",c(2,1,e.showDialogAlert$))}}function Hn(t,s){t&1&&(l(0,"div",9),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.saveCart.dialog.row.qtyFull")," "))}function Qn(t,s){t&1&&(l(0,"div",9),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.saveCart.dialog.row.qty")," "))}var Wn=["bindToCart"],qn=["saveInactiveCart"];function Kn(t,s){if(t&1){let e=y();l(0,"button",8,1),a(2,"async"),a(3,"async"),a(4,"async"),f("click",function(){C(e);let n=p();return h(n.bindCartToCustomer())}),l(5,"span"),a(6,"async"),_(7),a(8,"cxTranslate"),u(),S(9,"cx-dot-spinner"),a(10,"async"),a(11,"cxTranslate"),u()}if(t&2){let e=p();N("cx-asm-active",c(2,9,e.valid$))("cx-bind-loading",c(3,11,e.loading$)),m("disabled",!c(4,13,e.valid$)),r(5),b("aria-hidden",c(6,15,e.loading$)),r(2),v(" ",c(8,17,"asm.bindCart.bindCartToCustomer")," "),r(2),b("aria-hidden",!c(10,19,e.loading$))("aria-label",c(11,21,"common.loading"))}}function Yn(t,s){if(t&1){let e=y();l(0,"button",9,2),a(2,"async"),f("click",function(){C(e);let n=p();return h(n.onSaveInactiveCart())}),l(3,"span"),a(4,"async"),_(5),a(6,"cxTranslate"),u(),S(7,"cx-dot-spinner"),a(8,"async"),a(9,"cxTranslate"),u()}if(t&2){let e=p();N("cx-bind-loading",c(2,6,e.loading$)),r(3),b("aria-hidden",c(4,8,e.loading$)),r(2),v(" ",c(6,10,"asm.saveCart.saveCartBtn")," "),r(2),b("aria-hidden",!c(8,12,e.loading$))("aria-label",c(9,14,"common.loading"))}}function Jn(t,s){if(t&1){let e=y();l(0,"cx-message",14),a(1,"cxTranslate"),f("closeMessage",function(){C(e);let n=p();return h(n.closeDialogInfoAlert())}),u()}if(t&2){let e=p();m("text",c(1,2,"asm.createCustomerForm.createAccountAlert"))("type",e.globalMessageType.MSG_TYPE_INFO)}}function Zn(t,s){if(t&1){let e=y();l(0,"cx-message",14),f("closeMessage",function(){C(e);let n=p().index,o=p();return h(o.closeDialogBackendErroAlert(n))}),u()}if(t&2){let e=p().$implicit,i=p();m("text",e)("type",i.globalMessageType.MSG_TYPE_ERROR)}}function Xn(t,s){if(t&1&&(I(0),d(1,Zn,1,2,"cx-message",8),A()),t&2){let e=s.index,i=p();r(),m("ngIf",i.showDialogBackendErrorAlerts[e])}}function er(t,s){if(t&1&&(l(0,"div")(1,"div",15)(2,"label")(3,"span",16),_(4),a(5,"cxTranslate"),u(),S(6,"input",17),a(7,"cxTranslate"),S(8,"cx-form-errors",18),u()(),l(9,"div",15)(10,"label")(11,"span",16),_(12),a(13,"cxTranslate"),u(),S(14,"input",19),a(15,"cxTranslate"),S(16,"cx-form-errors",20),u()(),l(17,"div",15)(18,"label")(19,"span",16),_(20),a(21,"cxTranslate"),u(),S(22,"input",21),a(23,"cxTranslate"),S(24,"cx-form-errors",22),u()()()),t&2){let e,i,n,o=p();r(4),E(c(5,15,"asm.createCustomerForm.firstName.label")),r(2),R("placeholder",c(7,17,"asm.createCustomerForm.firstName.placeholder")),b("aria-invalid",((e=o.registerForm.get("firstName"))==null?null:e.touched)&&((e=o.registerForm.get("firstName"))==null?null:e.invalid))("aria-errormessage","firstNameError"),r(2),m("control",o.registerForm.get("firstName")),r(4),E(c(13,19,"asm.createCustomerForm.lastName.label")),r(2),R("placeholder",c(15,21,"asm.createCustomerForm.lastName.placeholder")),b("aria-invalid",((i=o.registerForm.get("lastName"))==null?null:i.touched)&&((i=o.registerForm.get("lastName"))==null?null:i.invalid))("aria-errormessage","lastNameError"),r(2),m("control",o.registerForm.get("lastName")),r(4),E(c(21,23,"asm.createCustomerForm.emailAddress.label")),r(2),R("placeholder",c(23,25,"asm.createCustomerForm.emailAddress.placeholder")),b("aria-invalid",((n=o.registerForm.get("email"))==null?null:n.touched)&&((n=o.registerForm.get("email"))==null?null:n.invalid))("aria-errormessage","emailError"),r(2),m("control",o.registerForm.get("email"))}}function tr(t,s){t&1&&(l(0,"div",23),S(1,"cx-spinner"),u())}var sn=t=>({label:t});function ir(t,s){if(t&1){let e=y();l(0,"form",2),f("ngSubmit",function(){C(e);let n=p();return h(n.onSubmit())}),l(1,"span",3),_(2),a(3,"cxTranslate"),u(),l(4,"label"),S(5,"input",4),a(6,"cxTranslate"),S(7,"cx-form-errors",5),a(8,"cxTranslate"),u(),l(9,"span",3),_(10),a(11,"cxTranslate"),u(),l(12,"label"),S(13,"input",6),a(14,"cxTranslate"),S(15,"cx-form-errors",7),a(16,"cxTranslate"),u(),l(17,"button",8),_(18),a(19,"cxTranslate"),u()()}if(t&2){let e,i,n=p();m("formGroup",n.csAgentLoginForm),r(2),v(" ",c(3,14,"asm.loginForm.userId.label")," "),r(3),b("aria-label",c(6,16,"asm.loginForm.userId.label"))("aria-invalid",((e=n.csAgentLoginForm.get("userId"))==null?null:e.touched)&&((e=n.csAgentLoginForm.get("userId"))==null?null:e.invalid))("aria-errormessage","userIdError"),r(2),m("translationParams",ee(28,sn,c(8,18,"asm.loginForm.userId.label")))("control",n.csAgentLoginForm.get("userId")),r(3),v(" ",c(11,20,"asm.loginForm.password.label")," "),r(3),b("aria-label",c(14,22,"asm.loginForm.password.label"))("aria-invalid",((i=n.csAgentLoginForm.get("password"))==null?null:i.touched)&&((i=n.csAgentLoginForm.get("password"))==null?null:i.invalid))("aria-errormessage","passwordError"),r(2),m("translationParams",ee(30,sn,c(16,24,"asm.loginForm.password.label")))("control",n.csAgentLoginForm.get("password")),r(3),v(" ",c(19,26,"asm.loginForm.submit")," ")}}function nr(t,s){t&1&&(S(0,"cx-dot-spinner",9),a(1,"cxTranslate")),t&2&&b("aria-label",c(1,1,"common.loading"))}var rr=["resultList"],or=["searchTerm"],sr=["searchOrder"],ar=["createCustomerLink"],cr=["searchResultItem"];function lr(t,s){if(t&1){let e=y();l(0,"div",13)(1,"div",14)(2,"div",15)(3,"span",16),S(4,"cx-icon",17),u(),l(5,"span",18),_(6),a(7,"cxTranslate"),u(),l(8,"span",19,3),f("click",function(){C(e);let n=p(2);return h(n.createCustomer())}),_(10),a(11,"cxTranslate"),u()()()()}t&2&&(r(6),v("",c(7,2,"asm.customerSearch.noCustomerMatchResult")," "),r(4),v(" ",c(11,4,"asm.customerSearch.createCustomer")," "))}function mr(t,s){if(t&1){let e=y();l(0,"button",22,4),f("keydown.arrowup",function(n){C(e);let o=p(3);return h(o.focusPreviousChild(n))})("keydown.arrowdown",function(n){C(e);let o=p(3);return h(o.focusNextChild(n))})("keydown.arrowright",function(n){C(e);let o=p(3);return h(o.focusInputText(n))})("keydown.arrowleft",function(n){C(e);let o=p(3);return h(o.focusInputText(n))})("keydown.enter",function(n){let o=C(e).$implicit,g=p(3);return h(g.selectCustomerFromList(n,o))})("keydown.escape",function(n){C(e);let o=p(3);return h(o.closeResults(n))})("keydown.home",function(n){C(e);let o=p(3);return h(o.focusInputText(n))})("keydown.end",function(n){C(e);let o=p(3);return h(o.focusInputText(n))})("click",function(n){let o=C(e).$implicit,g=p(3);return h(g.selectCustomerFromList(n,o))}),l(2,"div",23),_(3),u(),l(4,"div",24)(5,"span"),_(6),u()()()}if(t&2){let e=s.$implicit,i=s.index,n=p(3);N("active",n.activeFocusedButtonIndex===i),m("tabindex",n.activeFocusedButtonIndex===i?0:-1),b("aria-selected",n.activeFocusedButtonIndex===i),r(3),E(e.name),r(3),E(e.uid)}}function ur(t,s){if(t&1&&(l(0,"div",20),d(1,mr,7,6,"button",21),u()),t&2){let e=p().ngIf;r(),m("ngForOf",e.entries)}}function pr(t,s){if(t&1&&(l(0,"div",null,2),d(2,lr,12,6,"div",12)(3,ur,2,1,"div",9),u()),t&2){let e=s.ngIf,i=p(),n=D(6);r(2),m("ngIf",i.isNoResultMessageInfoVisible(e,i.searchByCustomer,n)),r(),m("ngIf",i.isSearchResultsVisible(e,i.searchByCustomer))}}function dr(t,s){t&1&&(l(0,"div",20),S(1,"cx-dot-spinner",25),a(2,"cxTranslate"),u()),t&2&&(r(),b("aria-label",c(2,1,"common.loading")))}function _r(t,s){t&1&&(l(0,"div",13)(1,"div",14)(2,"div",15)(3,"span",16),S(4,"cx-icon",17),u(),l(5,"span",18),_(6),a(7,"cxTranslate"),u()()()()),t&2&&(r(6),v(" ",c(7,1,"asm.customerSearch.noOrderMatchResult")," "))}function gr(t,s){if(t&1){let e=y();l(0,"button",22,4),f("keydown.arrowup",function(n){C(e);let o=p(3);return h(o.focusPreviousChild(n))})("keydown.arrowdown",function(n){C(e);let o=p(3);return h(o.focusNextChild(n))})("keydown.arrowright",function(n){C(e);let o=p(3);return h(o.focusOrderSearchInputText(n))})("keydown.arrowleft",function(n){C(e);let o=p(3);return h(o.focusOrderSearchInputText(n))})("keydown.enter",function(n){let o=C(e).$implicit,g=p(3);return h(g.selectCustomerFromList(n,o))})("keydown.escape",function(n){C(e);let o=p(3);return h(o.closeOrderSearchResults(n))})("keydown.home",function(n){C(e);let o=p(3);return h(o.focusOrderSearchInputText(n))})("keydown.end",function(n){C(e);let o=p(3);return h(o.focusOrderSearchInputText(n))})("click",function(n){let o=C(e).$implicit,g=p(3);return h(g.selectCustomerFromList(n,o))}),l(2,"div",23),_(3),u(),l(4,"div",24)(5,"span"),_(6),u()()()}if(t&2){let e=s.$implicit,i=s.index,n=p(3),o=D(17);N("active",n.activeFocusedButtonIndex===i),m("tabindex",n.activeFocusedButtonIndex===i?0:-1),b("aria-selected",n.activeFocusedButtonIndex===i),r(3),E(o.value),r(3),E(e.name)}}function Cr(t,s){if(t&1&&(l(0,"div",20),d(1,gr,7,6,"button",21),u()),t&2){let e=p().ngIf;r(),m("ngForOf",e.entries)}}function hr(t,s){if(t&1&&(l(0,"div",null,2),d(2,_r,8,3,"div",12)(3,Cr,2,1,"div",9),u()),t&2){let e=s.ngIf,i=p(),n=D(17);r(2),m("ngIf",i.isNoResultMessageInfoVisible(e,i.searchByOrder,n)),r(),m("ngIf",i.isSearchResultsVisible(e,i.searchByOrder))}}function fr(t,s){t&1&&(l(0,"div",20),S(1,"cx-dot-spinner",25),a(2,"cxTranslate"),u()),t&2&&(r(),b("aria-label",c(2,1,"common.loading")))}var vr=["asmCustomer360Launcher"];function xr(t,s){if(t&1){let e=y();l(0,"button",7,0),f("click",function(){C(e);let n=p(2);return h(n.openAsmCustomer360())}),_(2),a(3,"cxTranslate"),u()}t&2&&(r(2),v(" ",c(3,1,"asm.asmCustomer360ViewButton")," "))}function Sr(t,s){if(t&1){let e=y();I(0),l(1,"div",2)(2,"label",3),_(3),u(),l(4,"label",4),_(5),u()(),S(6,"cx-asm-bind-cart"),d(7,xr,4,3,"button",5),l(8,"button",6),f("click",function(){C(e);let n=p();return h(n.logoutCustomer())}),_(9),a(10,"cxTranslate"),u(),A()}if(t&2){let e=p();r(3),E(e.customer==null?null:e.customer.name),r(2),E(e.customer==null?null:e.customer.uid),r(2),m("ngIf",e.isAsmCustomer360Configured&&e.customer),r(2),v(" ",c(10,4,"asm.endSession")," ")}}function yr(t,s){t&1&&(l(0,"span",3),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.toggleUi.collapse")," "))}function br(t,s){t&1&&(l(0,"span",3),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.toggleUi.expand")," "))}var Tr=["customerListLink"],an=["addNewCustomerLink"];function Ir(t,s){if(t&1){let e=y();l(0,"div",16)(1,"a",17,0),f("click",function(){C(e);let n=p();return h(n.showCustomList())}),S(3,"cx-icon",10),l(4,"span"),_(5),a(6,"cxTranslate"),u()()()}if(t&2){let e=p();r(3),m("type",e.iconTypes.USER_FRIENDS),r(2),E(c(6,2,"asm.customers"))}}function Ar(t,s){t&1&&S(0,"cx-asm-toggle-ui")}function Er(t,s){if(t&1&&(I(0),d(1,Ar,1,0,"cx-asm-toggle-ui",13),a(2,"async"),A()),t&2){let e=p();r(),m("ngIf",c(2,1,e.customerSupportAgentLoggedIn$))}}function Lr(t,s){t&1&&S(0,"cx-asm-session-timer")}function wr(t,s){if(t&1){let e=y();l(0,"div",16)(1,"a",18),f("click",function(){C(e);let n=p(2);return h(n.loginCustomerSupportAgentWithAuthorizationCodeFlow())}),_(2),a(3,"cxTranslate"),u()()}t&2&&(r(2),E(c(3,1,"asm.asmSignIn")))}function Dr(t,s){if(t&1&&(I(0),d(1,wr,4,3,"div",11),a(2,"async"),A()),t&2){let e=p();r(),m("ngIf",!c(2,1,e.customerSupportAgentLoggedIn$))}}function Rr(t,s){if(t&1){let e=y();l(0,"button",19),a(1,"cxTranslate"),f("click",function(){C(e);let n=p();return h(n.hideUi())}),u()}t&2&&R("title",c(1,1,"asm.hideUi"))}function Fr(t,s){if(t&1){let e=y();l(0,"button",20),a(1,"cxTranslate"),f("click",function(){C(e);let n=p();return h(n.logout())}),u()}t&2&&R("title",c(1,1,"asm.logout"))}function Mr(t,s){t&1&&S(0,"cx-customer-emulation")}function kr(t,s){if(t&1){let e=y();l(0,"cx-message",23),a(1,"cxTranslate"),f("closeMessage",function(){C(e);let n=p(4);return h(n.closeDialogConfirmationAlert())}),u()}if(t&2){let e=p(4);m("text",c(1,2,"asm.createCustomerSuccessfullyAlert"))("type",e.globalMessageType.MSG_TYPE_CONFIRMATION)}}function Br(t,s){if(t&1){let e=y();l(0,"cx-message",23),a(1,"cxTranslate"),f("closeMessage",function(){C(e);let n=p(4);return h(n.closeDeeplinkCartInfoAlert())}),u()}if(t&2){let e=p(4);m("text",c(1,2,e.deeplinkCartAlertKey))("type",e.globalMessageType.MSG_TYPE_INFO)}}function Or(t,s){if(t&1){let e=y();l(0,"cx-message",23),a(1,"cxTranslate"),f("closeMessage",function(){C(e);let n=p(4);return h(n.closeCustomerEmulationInfoAlert())}),u()}if(t&2){let e=p(4);m("text",c(1,2,"asm.startCustomerEmulationAlertInfo"))("type",e.globalMessageType.MSG_TYPE_INFO)}}function Nr(t,s){if(t&1&&(I(0),d(1,Mr,1,0,"cx-customer-emulation",13)(2,kr,2,4,"cx-message",22)(3,Br,2,4,"cx-message",22),a(4,"async"),d(5,Or,2,4,"cx-message",22),A()),t&2){let e=p(2).ngIf,i=p();r(),m("ngIf",e),r(),m("ngIf",e&&i.showCreateCustomerSuccessfullyAlert),r(),m("ngIf",c(4,4,i.showDeeplinkCartInfoAlert$)),r(2),m("ngIf",e&&i.showCustomerEmulationInfoAlert)}}function Vr(t,s){if(t&1){let e=y();l(0,"cx-customer-selection",25),f("submitEvent",function(n){C(e);let o=p(4);return h(o.startCustomerEmulationSession(n,n.parameters))}),u()}}function Pr(t,s){if(t&1&&d(0,Vr,1,0,"cx-customer-selection",24),t&2){let e=p(2).ngIf;m("ngIf",e)}}function Ur(t,s){if(t&1&&(I(0),d(1,Nr,6,6,"ng-container",21),a(2,"async"),d(3,Pr,1,1,"ng-template",null,2,V),A()),t&2){let e=D(4),i=p(2);r(),m("ngIf",c(2,2,i.customer$))("ngIfElse",e)}}function $r(t,s){if(t&1){let e=y();l(0,"cx-csagent-login-form",27),a(1,"async"),f("submitEvent",function(n){C(e);let o=p(4);return h(o.loginCustomerSupportAgent(n))}),u()}if(t&2){let e=p(4);m("csAgentTokenLoading",c(1,1,e.csAgentTokenLoading$))}}function jr(t,s){if(t&1&&(I(0),d(1,$r,2,3,"cx-csagent-login-form",26),A()),t&2){let e=p(2).ngIf;r(),m("ngIf",e)}}function zr(t,s){t&1&&d(0,jr,2,1,"ng-container",12),t&2&&m("cxFeature","!authorizationCodeFlowByDefault")}function Gr(t,s){if(t&1&&(I(0),d(1,Ur,5,4,"ng-container",21),a(2,"async"),d(3,zr,1,1,"ng-template",null,1,V),A()),t&2){let e=D(4),i=p();r(),m("ngIf",c(2,2,i.customerSupportAgentLoggedIn$))("ngIfElse",e)}}var Hr=(t,s)=>({customerA:t,customerB:s}),Qr=t=>({customerListsPage:t}),Wr=t=>({customerSearchPage:t}),qr=(t,s)=>({customerEntry:t,column:s,showHeader:!1}),Ot=(t,s)=>({customerEntry:t,column:s,showHeader:!0}),cn=(t,s)=>({column:t,customerEntry:s}),ln=t=>({count:t}),Kr=t=>({ariaLabel:t,ariaControls:"asm-cusomer-list-table"});function Yr(t,s){}function Jr(t,s){t&1&&d(0,Yr,0,0,"ng-template")}function Zr(t,s){}function Xr(t,s){t&1&&d(0,Zr,0,0,"ng-template")}function eo(t,s){}function to(t,s){t&1&&d(0,eo,0,0,"ng-template")}function io(t,s){}function no(t,s){t&1&&d(0,io,0,0,"ng-template")}function ro(t,s){}function oo(t,s){t&1&&d(0,ro,0,0,"ng-template")}function so(t,s){if(t&1&&(l(0,"div",24),a(1,"async"),l(2,"div",25),a(3,"async"),d(4,Xr,1,0,null,26)(5,to,1,0,null,26),a(6,"async"),u(),l(7,"div",27),a(8,"async"),d(9,no,1,0,null,14)(10,oo,1,0,null,14),u()()),t&2){let e=s.ngIf,i=p(),n=D(35),o=D(37),g=D(39),T=D(43);N("tablet-mobile",c(1,12,i.breakpoint$)!==i.BREAKPOINT.md),r(2),N("mobile",c(3,14,i.breakpoint$)===i.BREAKPOINT.xs),r(2),m("ngTemplateOutlet",T)("ngTemplateOutletContext",ee(20,Qr,e)),r(),m("ngTemplateOutlet",o)("ngTemplateOutletContext",ee(22,Wr,c(6,16,i.customerSearchPage$))),r(2),N("mobile",c(8,18,i.breakpoint$)===i.BREAKPOINT.xs),r(2),m("ngTemplateOutlet",g),r(),m("ngTemplateOutlet",n)}}function ao(t,s){t&1&&(l(0,"div",28),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.customerList.noLists")," "))}function co(t,s){t&1&&(l(0,"div",28),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.customerList.listsError")," "))}function lo(t,s){t&1&&(l(0,"div",28),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"generalErrors.pageFailure")," "))}function mo(t,s){t&1&&S(0,"cx-spinner")}function uo(t,s){t&1&&(I(0),_(1),a(2,"cxTranslate"),A()),t&2&&(r(),v(" ",c(2,1,"asm.customerList.tableHeader.customerName")," "))}function po(t,s){t&1&&(I(0),_(1),a(2,"cxTranslate"),A()),t&2&&(r(),v(" ",c(2,1,"asm.customerList.tableHeader.emailId")," "))}function _o(t,s){if(t&1&&(I(0),_(1),a(2,"cxTranslate"),A()),t&2){let e=p(2).$implicit;r(),v(" ",c(2,1,e.headerLocalizationKey)," ")}}function go(t,s){if(t&1&&(l(0,"span"),d(1,uo,3,3,"ng-container",20)(2,po,3,3,"ng-container",20)(3,_o,3,3,"ng-container",20),u()),t&2){let e=p().$implicit;r(),m("ngIf",e.headerLocalizationKey==="asm.customerList.tableHeader.customer"),r(),m("ngIf",e.headerLocalizationKey==="asm.customerList.tableHeader.email"),r(),m("ngIf",e.headerLocalizationKey!=="asm.customerList.tableHeader.customer"&&e.headerLocalizationKey!=="asm.customerList.tableHeader.email")}}function Co(t,s){if(t&1&&(l(0,"th",36),d(1,go,4,3,"span",20),u()),t&2){let e=s.$implicit;r(),m("ngIf",e.headerLocalizationKey&&e.headerLocalizationKey!=="hideHeaders")}}function ho(t,s){if(t&1&&(l(0,"thead")(1,"tr",34),d(2,Co,2,1,"th",35),u()()),t&2){let e=p(3);r(2),m("ngForOf",e.customerListConfig==null?null:e.customerListConfig.columns)}}function fo(t,s){}function vo(t,s){t&1&&d(0,fo,0,0,"ng-template")}function xo(t,s){if(t&1&&(l(0,"td",39),d(1,vo,1,0,null,26),u()),t&2){let e=s.$implicit,i=p(2).$implicit;p(3);let n=D(31);r(),m("ngTemplateOutlet",n)("ngTemplateOutletContext",te(2,qr,i,e))}}function So(t,s){if(t&1&&(I(0),d(1,xo,2,5,"td",38),A()),t&2){let e=p(4);r(),m("ngForOf",e.customerListConfig==null?null:e.customerListConfig.columns)}}function yo(t,s){}function bo(t,s){t&1&&d(0,yo,0,0,"ng-template")}function To(t,s){if(t&1&&(I(0),d(1,bo,1,0,null,26),A()),t&2){let e=p().$implicit,i=p(2).$implicit;p(3);let n=D(31);r(),m("ngTemplateOutlet",n)("ngTemplateOutletContext",te(2,Ot,i,e))}}function Io(t,s){if(t&1&&(I(0),d(1,To,2,5,"ng-container",20),A()),t&2){let e=s.even;r(),m("ngIf",e)}}function Ao(t,s){}function Eo(t,s){t&1&&d(0,Ao,0,0,"ng-template")}function Lo(t,s){if(t&1&&(I(0),d(1,Eo,1,0,null,26),A()),t&2){let e=p().$implicit,i=p(2).$implicit;p(3);let n=D(31);r(),m("ngTemplateOutlet",n)("ngTemplateOutletContext",te(2,Ot,i,e))}}function wo(t,s){if(t&1&&(I(0),d(1,Lo,2,5,"ng-container",20),A()),t&2){let e=s.odd;r(),m("ngIf",e)}}function Do(t,s){if(t&1&&(I(0),l(1,"td",40),d(2,Io,2,1,"ng-container",41),u(),l(3,"td",40),d(4,wo,2,1,"ng-container",41),u(),A()),t&2){let e=p(4);r(2),m("ngForOf",e.customerListConfig==null?null:e.customerListConfig.columns),r(2),m("ngForOf",e.customerListConfig==null?null:e.customerListConfig.columns)}}function Ro(t,s){}function Fo(t,s){t&1&&d(0,Ro,0,0,"ng-template")}function Mo(t,s){if(t&1&&(I(0),d(1,Fo,1,0,null,26),A()),t&2){let e=s.$implicit,i=p(2).$implicit;p(3);let n=D(31);r(),m("ngTemplateOutlet",n)("ngTemplateOutletContext",te(2,Ot,i,e))}}function ko(t,s){if(t&1&&(l(0,"td",40),d(1,Mo,2,5,"ng-container",41),u()),t&2){let e=p(4);r(),m("ngForOf",e.customerListConfig==null?null:e.customerListConfig.columns)}}function Bo(t,s){if(t&1&&(l(0,"tr",34),d(1,So,2,1,"ng-container",20),a(2,"async"),d(3,Do,5,2,"ng-container",20),a(4,"async"),d(5,ko,2,1,"td",37),a(6,"async"),u()),t&2){let e=p(3);r(),m("ngIf",c(2,3,e.breakpoint$)===e.BREAKPOINT.md),r(2),m("ngIf",c(4,5,e.breakpoint$)===e.BREAKPOINT.sm),r(2),m("ngIf",c(6,7,e.breakpoint$)===e.BREAKPOINT.xs)}}function Oo(t,s){if(t&1&&(l(0,"table",31)(1,"caption",32),_(2),a(3,"cxTranslate"),u(),d(4,ho,3,1,"thead",20),a(5,"async"),l(6,"tbody"),d(7,Bo,7,9,"tr",33),u()()),t&2){let e=p().ngIf,i=p();r(2),v(" ",c(3,3,"asm.customerList.title")," "),r(2),m("ngIf",c(5,5,i.breakpoint$)===i.BREAKPOINT.md),r(3),m("ngForOf",e==null?null:e.entries)}}function No(t,s){t&1&&(l(0,"div",42),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),v(" ",c(2,1,"asm.customerList.noCustomers")," "))}function Vo(t,s){if(t&1&&(l(0,"div"),d(1,Oo,8,7,"table",29)(2,No,3,3,"div",30),u()),t&2){let e=s.ngIf,i=p();r(),m("ngIf",i.loaded),r(),m("ngIf",!(e!=null&&e.entries.length))}}function Po(t,s){if(t&1){let e=y();l(0,"div")(1,"cx-pagination",44),f("viewPageEvent",function(n){C(e);let o=p(2);return h(o.changePage(n))}),u()()}if(t&2){let e=s.ngIf;r(),m("pagination",e.pagination)}}function Uo(t,s){if(t&1&&(l(0,"div",43),a(1,"async"),l(2,"div",27),a(3,"async"),d(4,Po,2,1,"div",20),a(5,"async"),u()()),t&2){let e=p();N("asm-mobile-pagination",c(1,5,e.breakpoint$)!==e.BREAKPOINT.md),r(2),N("mobile",c(3,7,e.breakpoint$)===e.BREAKPOINT.xs),r(2),m("ngIf",c(5,9,e.customerSearchPage$))}}function $o(t,s){if(t&1&&(l(0,"span",50),_(1),a(2,"cxTranslate"),u()),t&2){let e=p(2).column;r(),v(" ",c(2,1,e.headerLocalizationKey)," ")}}function jo(t,s){t&1&&st(0)}function zo(t,s){if(t&1&&(I(0),d(1,jo,1,0,"ng-container",26),A()),t&2){let e=p(2),i=e.customerEntry,n=e.column;p();let o=D(33);r(),m("ngTemplateOutlet",o)("ngTemplateOutletContext",te(2,cn,n,i))}}function Go(t,s){if(t&1&&(S(0,"img",54),a(1,"cxTranslate"),a(2,"cxTranslate")),t&2){let e=p(3).customerEntry,i=p();R("alt",c(1,3,"asm.mainLogoLabel")),R("title",c(2,5,"asm.mainLogoLabel")),b("src",(i.occConfig==null||i.occConfig.backend==null||i.occConfig.backend.occ==null?null:i.occConfig.backend.occ.baseUrl)+(e==null||e.userAvatar==null?null:e.userAvatar.url),Gt)}}function Ho(t,s){if(t&1&&(l(0,"div",55),_(1),u()),t&2){let e=p(3).customerEntry,i=p();r(),v(" ",i.getBadgeText(e)," ")}}function Qo(t,s){if(t&1&&(l(0,"div",51),d(1,Go,3,7,"img",52)(2,Ho,2,1,"div",53),u()),t&2){let e=p(2).customerEntry;r(),m("ngIf",e==null||e.userAvatar==null?null:e.userAvatar.url),r(),m("ngIf",!(!(e==null||e.userAvatar==null)&&e.userAvatar.url))}}function Wo(t,s){t&1&&st(0)}function qo(t,s){if(t&1){let e=y();l(0,"button",56),a(1,"cxTranslate"),a(2,"cxTranslate"),f("click",function(){C(e);let n=p(2),o=n.customerEntry,g=n.column,T=p();return h(T.startColumnAction(o,g.actionType))}),d(3,Wo,1,0,"ng-container",26),u()}if(t&2){let e,i,n=p(2),o=n.customerEntry,g=n.column,T=p(),se=D(33);Qt((g.actionType==="ACTIVE_CART"?"cx-cart ":"")+(g.actionType!=="START_SESSION"?"cx-action-disable":"")),m("disabled",T.isRequired(o,g.actionType)),b("title",g.icon?c(1,7,(e=g.icon.captionLocalizationKey)!==null&&e!==void 0?e:g.headerLocalizationKey):void 0)("aria-label",g.icon?c(2,9,(i=g.icon.captionLocalizationKey)!==null&&i!==void 0?i:g.headerLocalizationKey):void 0),r(3),m("ngTemplateOutlet",se)("ngTemplateOutletContext",te(11,cn,g,o))}}function Ko(t,s){if(t&1&&(l(0,"div",46),d(1,$o,3,3,"span",47)(2,zo,2,5,"ng-container",20)(3,Qo,3,2,"div",48)(4,qo,4,14,"button",49),u()),t&2){let e=p(),i=e.column,n=e.showHeader,o=p();r(),m("ngIf",n),r(),m("ngIf",!i.actionType),r(),m("ngIf",(o.customerListConfig==null?null:o.customerListConfig.showAvatar)&&(i==null?null:i.actionType)===(o.customerListColumnActionType==null?null:o.customerListColumnActionType.START_SESSION)),r(),m("ngIf",i.actionType)}}function Yo(t,s){if(t&1&&d(0,Ko,5,4,"div",45),t&2){let e=s.column;m("ngIf",e.headerLocalizationKey!=="hideHeaders")}}function Jo(t,s){if(t&1&&(l(0,"span"),_(1),u()),t&2){let e=p(),i=e.customerEntry,n=e.column;r(),E((n.renderer==null?null:n.renderer(i))||"")}}function Zo(t,s){if(t&1&&(S(0,"cx-icon",58),a(1,"cxTranslate"),a(2,"cxTranslate")),t&2){let e,i,n=p(),o=n.customerEntry,g=n.column,T=p();N("cx-action-color",g.actionType&&!T.isRequired(o,g.actionType)),m("type",g.icon.symbol),b("title",g.actionType?void 0:c(1,5,(e=g.icon.captionLocalizationKey)!==null&&e!==void 0?e:g.headerLocalizationKey))("aria-label",g.actionType?void 0:c(2,7,(i=g.icon.captionLocalizationKey)!==null&&i!==void 0?i:g.headerLocalizationKey))}}function Xo(t,s){if(t&1&&(l(0,"div"),d(1,Jo,2,1,"span",20)(2,Zo,3,9,"cx-icon",57),u()),t&2){let e=s.column;r(),m("ngIf",!e.icon),r(),m("ngIf",e.icon)}}function es(t,s){if(t&1){let e=y();l(0,"div",59)(1,"input",60),a(2,"cxTranslate"),a(3,"cxTranslate"),f("keyup",function(n){C(e);let o=p();return h(o.onKey(n))}),u(),l(4,"cx-icon",61),a(5,"cxTranslate"),a(6,"cxTranslate"),f("click",function(){C(e);let n=p();return h(n.searchCustomers())}),u()()}if(t&2){let e=p();r(),R("placeholder",c(2,6,"asm.customerList.searchBox")),m("formControl",e.searchBox),b("aria-label",c(3,8,"asm.customerList.enterSearchBox")),r(3),m("type",e.iconTypes.SEARCH)("title",c(5,10,"storeFinder.searchNearestStores")),b("aria-label",c(6,12,"storeFinder.searchNearestStores"))}}function ts(t,s){if(t&1&&(I(0),_(1),a(2,"cxTranslate"),A()),t&2){let e=p(2).customerSearchPage;r(),v(" ",Ne(2,1,"asm.customerList.noOfCustomers",ee(4,ln,e==null||e.pagination==null?null:e.pagination.totalResults))," ")}}function is(t,s){t&1&&(I(0),_(1),a(2,"cxTranslate"),A()),t&2&&(r(),v(" ",c(2,1,"asm.customerList.oneCustomer")," "))}function ns(t,s){if(t&1&&(l(0,"span",63),d(1,ts,3,6,"ng-container",20)(2,is,3,3,"ng-container",20),u()),t&2){let e=p().customerSearchPage;r(),m("ngIf",(e==null||e.pagination==null?null:e.pagination.totalResults)>1),r(),m("ngIf",(e==null||e.pagination==null?null:e.pagination.totalResults)===1)}}function rs(t,s){if(t&1&&d(0,ns,3,2,"span",62),t&2){let e=s.customerSearchPage;m("ngIf",e==null||e.pagination==null?null:e.pagination.totalResults)}}function os(t,s){t&1&&(l(0,"span",67),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),E(c(2,1,"asm.customerList.tableSort.sortBy")))}function ss(t,s){t&1&&(l(0,"span",32),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),E(c(2,1,"asm.customerList.tableSort.sortBy")))}function as(t,s){if(t&1){let e=y();l(0,"label"),d(1,os,3,3,"span",64)(2,ss,3,3,"span",65),l(3,"cx-sorting",66),a(4,"cxTranslate"),a(5,"async"),f("sortListEvent",function(n){C(e);let o=p();return h(o.changeSortCode(n))}),u()()}if(t&2){let e=p();r(),m("cxFeature","a11yShowLabelOfSelect"),r(),m("cxFeature","!a11yShowLabelOfSelect"),r(),R("placeholder",c(4,7,"asm.customerList.tableSort.sortBy")),m("sortOptions",e.sorts)("sortLabels",c(5,9,e.getSortLabels()))("selectedOption",e.sortCode)("ariaLabel",e.sortCode)}}function cs(t,s){if(t&1){let e=y();l(0,"button",71),f("click",function(){C(e);let n=p(2);return h(n.goToPreviousPage())}),S(1,"cx-icon",72),l(2,"span"),_(3),a(4,"cxTranslate"),u()()}if(t&2){let e=p(2);m("disabled",e.currentPage===0||!e.loaded),r(),m("type",e.iconTypes.CARET_LEFT),r(2),E(c(4,3,"asm.customerList.page.previous"))}}function ls(t,s){if(t&1){let e=y();l(0,"button",73),f("click",function(){C(e);let n=p(2);return h(n.goToNextPage())}),l(1,"span"),_(2),a(3,"cxTranslate"),u(),S(4,"cx-icon",74),u()}if(t&2){let e=p(2);m("disabled",e.currentPage===e.maxPage||!e.loaded),r(2),E(c(3,3,"asm.customerList.page.next")),r(2),m("type",e.iconTypes.CARET_RIGHT)}}function ms(t,s){if(t&1&&(l(0,"div",68)(1,"div"),_(2),a(3,"cxTranslate"),u(),d(4,cs,5,5,"button",69)(5,ls,5,5,"button",70),u()),t&2){let e=p();r(2),v(" ",Ne(3,3,"asm.customerList.page.page",ee(6,ln,e.currentPage+1))," "),r(2),m("ngIf",e.maxPage>0),r(),m("ngIf",e.maxPage>0)}}function us(t,s){t&1&&(l(0,"span",67),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),E(c(2,1,"asm.customerList.title")))}function ps(t,s){t&1&&(l(0,"span",32),_(1),a(2,"cxTranslate"),u()),t&2&&(r(),E(c(2,1,"asm.customerList.title")))}function ds(t,s){if(t&1){let e=y();l(0,"label"),d(1,us,3,3,"span",64)(2,ps,3,3,"span",65),l(3,"ng-select",75),f("change",function(){C(e);let n=p();return h(n.onChangeCustomerGroup())}),Yt("ngModelChange",function(n){C(e);let o=p();return Kt(o.selectedUserGroupId,n)||(o.selectedUserGroupId=n),h(n)}),u()()}if(t&2){let e=s.customerListsPage,i=p();r(),m("cxFeature","a11yShowLabelOfSelect"),r(),m("cxFeature","!a11yShowLabelOfSelect"),r(),m("searchable",!1)("clearable",!1)("tabIndex",0),qt("ngModel",i.selectedUserGroupId),m("items",e==null?null:e.userGroups)("cxNgSelectA11y",ee(8,Kr,i.getGroupName(e,i.selectedUserGroupId)))}}function _s(t,s){if(t&1){let e=y();l(0,"button",76),a(1,"cxTranslate"),a(2,"cxTranslate"),f("click",function(){C(e);let n=p();return h(n.closeModal("Cross click"))}),l(3,"span",77),S(4,"cx-icon",58),u()()}if(t&2){let e=p();R("title",c(1,3,"common.close")),b("aria-label",c(2,5,"common.close")),r(4),m("type",e.iconTypes.CLOSE)}}function gs(t,s){if(t&1){let e=y();l(0,"button",78),f("click",function(){C(e);let n=p();return h(n.createCustomer())}),S(1,"cx-icon",58),l(2,"span"),_(3),a(4,"cxTranslate"),u()()}if(t&2){let e=p();r(),m("type",e.iconTypes.USER_PLUS),r(2),E(c(4,2,"asm.customerList.createCustomer"))}}var et=function(t){return t.CANCEL="CANCEL",t.REPLACE="REPLACE",t}(et||{}),Cs=(()=>{class t{constructor(e){this.launchDialogService=e,this.BIND_CART_ACTION=et,this.focusConfig={trap:!0,block:!0,autofocus:!0,focusOnEscape:!0}}closeModal(e){this.launchDialogService.closeDialog(e)}static{this.\u0275fac=function(i){return new(i||t)(x(J))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-bind-cart-dialog"]],standalone:!1,decls:20,vars:19,consts:[["role","dialog","aria-labelledby","asm-bind-cart-dialog-title",1,"cx-asm-bind-cart-dialog","cx-modal-container","cx-asm-dialog",3,"esc","cxFocus"],[1,"cx-modal-content"],[1,"cx-dialog-header","modal-header"],["id","asm-bind-cart-dialog-title",1,"title","modal-title"],[1,"cx-dialog-body","modal-body"],[1,"cx-dialog-row"],[1,"cx-dialog-item"],[1,"cx-dialog-footer","modal-footer"],["type","button",1,"btn","btn-primary",3,"click"],["type","button",1,"btn","btn-secondary",3,"click"]],template:function(i,n){i&1&&(l(0,"div",0),f("esc",function(){return n.closeModal(n.BIND_CART_ACTION.CANCEL)}),l(1,"div",1)(2,"div",2)(3,"h2",3),_(4),a(5,"cxTranslate"),u()(),l(6,"div",4)(7,"div",5)(8,"div",6),_(9),a(10,"cxTranslate"),u()()(),l(11,"div",7)(12,"button",8),a(13,"cxTranslate"),f("click",function(){return n.closeModal(n.BIND_CART_ACTION.REPLACE)}),_(14),a(15,"cxTranslate"),u(),l(16,"button",9),a(17,"cxTranslate"),f("click",function(){return n.closeModal(n.BIND_CART_ACTION.CANCEL)}),_(18),a(19,"cxTranslate"),u()()()()),i&2&&(m("cxFocus",n.focusConfig),r(4),v(" ",c(5,7,"asm.bindCart.dialog.title")," "),r(5),v(" ",c(10,9,"asm.bindCart.dialog.body")," "),r(3),b("aria-label",c(13,11,"asm.bindCart.dialog.actions.replace")),r(2),v(" ",c(15,13,"asm.bindCart.dialog.actions.replace")," "),r(2),b("aria-label",c(17,15,"common.cancel")),r(2),v(" ",c(19,17,"common.cancel")," "))},dependencies:[ge,P],encapsulation:2})}}return t})(),tt=function(t){return t.CANCEL="CANCEL",t.SAVE="SAVE",t}(tt||{}),hs=(()=>{class t{constructor(e,i){this.launchDialogService=e,this.savedCartFacade=i,this.BIND_CART_ACTION=tt,this.showDialogAlert$=new W(!0),this.globalMessageType=X,this.focusConfig={trap:!0,block:!0,autofocus:!0,focusOnEscape:!0},be("a11yQTY2Quantity")}ngOnInit(){this.launchDialogService.data$.pipe(k(1)).subscribe(e=>{this.cart=e,this.setCartTotalQty()})}setCartTotalQty(){let e=0;if(this.cart.entries)for(let i of this.cart.entries)e+=i.quantity?i.quantity:0;this.cartQty=e}closeDialogAlert(){this.showDialogAlert$.next(!1)}closeModal(e){e===tt.SAVE&&this.saveCart(),this.launchDialogService.closeDialog(e)}saveCart(){this.savedCartFacade.saveCart({cartId:this.cart.code,saveCartName:this.cart.code,saveCartDescription:"-"})}static{this.\u0275fac=function(i){return new(i||t)(x(J),x(St))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-save-cart-dialog"]],standalone:!1,decls:37,vars:30,consts:[["showSaveCartWarning",""],["role","dialog","aria-labelledby","asm-save-cart-dialog-title",1,"cx-asm-save-cart-dialog","cx-modal-container","cx-asm-dialog",3,"esc","cxFocus"],[1,"cx-modal-content"],[1,"cx-dialog-header","modal-header"],["id","asm-save-cart-dialog-title",1,"title","modal-title"],[1,"cx-dialog-body","modal-body"],[4,"ngIf","ngIfElse"],[1,"cx-dialog-content"],[1,"cx-dialog-row","row"],[1,"cx-dialog-item","col-sm-6","col-md-6","text-right","item-left-text"],[1,"cx-dialog-item","col-sm-6","col-md-6","text-left","item-right-text"],["class","cx-dialog-item col-sm-6 col-md-6 text-right item-left-text",4,"cxFeature"],[1,"cx-dialog-footer","modal-footer"],["id","asm-save-cart-dialog-btn","type","button",1,"btn","btn-primary",3,"click","disabled"],["type","button",1,"btn","btn-secondary",3,"click"],[1,"message-container"],[3,"text","type","closeMessage",4,"ngIf"],[3,"closeMessage","text","type"]],template:function(i,n){if(i&1){let o=y();l(0,"div",1),f("esc",function(){return C(o),h(n.closeModal(n.BIND_CART_ACTION.CANCEL))}),l(1,"div",2)(2,"div",3)(3,"h2",4),_(4),a(5,"cxTranslate"),u()(),l(6,"div",5),d(7,jn,4,3,"ng-container",6)(8,Gn,3,3,"ng-template",null,0,V),l(10,"div",7)(11,"div",8)(12,"div",9),_(13),a(14,"cxTranslate"),u(),l(15,"div",10),_(16),u()(),l(17,"div",8),d(18,Hn,3,3,"div",11)(19,Qn,3,3,"div",11),l(20,"div",10),_(21),u()(),l(22,"div",8)(23,"div",9),_(24),a(25,"cxTranslate"),u(),l(26,"div",10),_(27),u()()()(),l(28,"div",12)(29,"button",13),a(30,"cxTranslate"),f("click",function(){return C(o),h(n.closeModal(n.BIND_CART_ACTION.SAVE))}),_(31),a(32,"cxTranslate"),u(),l(33,"button",14),a(34,"cxTranslate"),f("click",function(){return C(o),h(n.closeModal(n.BIND_CART_ACTION.CANCEL))}),_(35),a(36,"cxTranslate"),u()()()()}if(i&2){let o=D(9);m("cxFocus",n.focusConfig),r(4),v(" ",c(5,16,"asm.saveCart.dialog.title")," "),r(3),m("ngIf",n.cartQty>0)("ngIfElse",o),r(6),v(" ",c(14,18,"asm.saveCart.dialog.row.id")," "),r(3),v(" ",n.cart.code," "),r(2),m("cxFeature","a11yQTY2Quantity"),r(),m("cxFeature","!a11yQTY2Quantity"),r(2),v(" ",n.cartQty," "),r(3),v(" ",c(25,20,"asm.saveCart.dialog.row.total")," "),r(3),v(" ",n.cart.totalPriceWithTax==null?null:n.cart.totalPriceWithTax.formattedValue," "),r(2),m("disabled",n.cartQty===0),b("aria-label",c(30,22,"asm.saveCart.dialog.actions.save")),r(2),v(" ",c(32,24,"asm.saveCart.dialog.actions.save")," "),r(2),b("aria-label",c(34,26,"common.cancel")),r(2),v(" ",c(36,28,"common.cancel")," ")}},dependencies:[Y,ge,Qe,$e,ie,P],encapsulation:2})}}return t})(),Me=(()=>{class t{constructor(e,i,n,o,g){this.authService=e,this.csAgentAuthService=i,this.winRef=n,this.asmEnablerService=o,this.asmDeepLinkService=g,this.isEmulatedByDeepLink$=new W(!1),this.showDeeplinkCartInfoAlert$=new W(!1),this.routingService=K(pe)}getSearchParameter(e){return this.asmDeepLinkService?.getSearchParameter(e)}isEmulatedByDeepLink(){return this.isEmulatedByDeepLink$}setEmulatedByDeepLink(e){this.isEmulatedByDeepLink$.next(e)}setShowDeeplinkCartInfoAlert(e){this.showDeeplinkCartInfoAlert$.next(e)}shouldShowDeeplinkCartInfoAlert(){return this.showDeeplinkCartInfoAlert$}logoutCustomerSupportAgentAndCustomer(){this.csAgentAuthService.logoutCustomerSupportAgent()}logoutCustomer(){this.authService.logout()}isCustomerEmulationSessionInProgress(){return this.csAgentAuthService.isCustomerEmulated()}unload(){this.winRef.localStorage&&this.winRef.localStorage.removeItem(ji)}isEmulateInURL(){return this.asmDeepLinkService?.isEmulateInURL()||!1}getDeepLinkUrlParams(){return this.asmDeepLinkService?.getParamsInUrl()}handleDeepLinkNavigation(e=this.getDeepLinkUrlParams()){this.asmDeepLinkService?.handleNavigation(e)}handleAsmDialogAction(e){typeof e=="object"&&e.actionType===kt.NAVIGATE&&this.routingService.go(e.route)}static{this.\u0275fac=function(i){return new(i||t)(L(pt),L(yt),L(ri),L(zi),L(Hi))}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Nt=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["cx-dot-spinner"]],standalone:!1,decls:3,vars:0,template:function(i,n){i&1&&S(0,"div")(1,"div")(2,"div")},encapsulation:2,changeDetection:0})}}return t})(),fs=(()=>{class t{constructor(e,i,n,o,g,T,se,he){this.globalMessageService=e,this.activeCartFacade=i,this.multiCartFacade=n,this.asmBindCartFacade=o,this.launchDialogService=g,this.savedCartFacade=T,this.asmComponentService=se,this.routing=he,this.activeCartValidator=me=>me.value===this.activeCartId?{activeCartError:!0}:(this.deepLinkCartId&&me.value!==this.deepLinkCartId&&this.resetDeeplinkCart(),null),this.cartId=new Ci("",[oe.required,oe.minLength(1),this.activeCartValidator]),this.loading$=new W(!1),this.valid$=this.cartId.statusChanges.pipe(M(me=>me==="VALID"),zt(1)),this.activeCartId="",this.deepLinkCartId="",this.displayBindCartBtn$=new W(!0),this.displaySaveCartBtn$=new W(!1),this.subscription=new Q,this.featureConfig=K(Ue)}ngOnInit(){this.subscribeForDeeplinkCart(),this.subscription.add(this.activeCartFacade.getActiveCartId().subscribe(e=>{this.activeCartId=e??""}))}bindCartToCustomer(){let e=this.cartId.value,i=ce([this.loading$.asObservable(),this.valid$]).pipe(k(1),w(([n,o])=>!n&&o),$(()=>this.loading$.next(!0)),ue(()=>this.activeCartFacade.getActive().pipe(M(n=>n.deliveryItemsQuantity??0),k(1))),ue(n=>Pt(()=>!!(this.activeCartId&&n),this.openDialog(this.activeCartId,e),this.simpleBindCart(e))),$t(()=>this.loading$.next(!1))).subscribe({next:()=>{this.globalMessageService.add({key:"asm.bindCart.success"},X.MSG_TYPE_CONFIRMATION)},error:n=>{this.globalMessageService.add(n.details?.[0].message??"",X.MSG_TYPE_ERROR)}});this.subscription.add(i)}onSaveInactiveCart(){this.asmComponentService?.setShowDeeplinkCartInfoAlert(!1);let e=this.asmComponentService?.getSearchParameter("customerId");this.multiCartFacade.loadCart({cartId:this.deepLinkCartId,userId:e}),this.multiCartFacade.getCartEntity(this.deepLinkCartId).pipe(w(i=>i.loading===!1&&i.success===!0),k(1),M(i=>i.value),w(i=>!!i)).subscribe(i=>{this.openASMSaveCartDialog(i)}),this.afterCloseASMSaveCartDialog()}clearText(){this.cartId.setValue(""),this.resetDeeplinkCart()}resetDeeplinkCart(){this.deepLinkCartId="",this.displayBindCartBtn$.next(!0),this.displaySaveCartBtn$.next(!1),this.asmComponentService?.setShowDeeplinkCartInfoAlert(!1)}ngOnDestroy(){this.subscription.unsubscribe()}simpleBindCart(e){return it(()=>this.asmBindCartFacade.bindCart(e)).pipe($(()=>this.multiCartFacade.reloadCart(ni)))}openDialog(e,i){return it(()=>(this.launchDialogService.openDialogAndSubscribe(B.ASM_BIND_CART,this.bindToCartElemRef),this.launchDialogService.dialogClose.pipe(w(n=>!!n),k(1)))).pipe(w(n=>!!n),ue(n=>this.selectBindAction(e,i,n)))}selectBindAction(e,i,n){switch(n){case et.REPLACE:return this.replaceCart(e,i);case et.CANCEL:default:return Vt}}replaceCart(e,i){return this.simpleBindCart(i).pipe($(()=>{this.savedCartFacade.saveCart({cartId:e,saveCartName:e,saveCartDescription:"-"})}))}subscribeForDeeplinkCart(){this.subscription.add(this.asmComponentService?.isEmulatedByDeepLink().pipe(w(e=>e&&!!this.asmComponentService?.getSearchParameter("cartId"))).subscribe(()=>{let e=this.asmComponentService?.getSearchParameter("cartType");(e==="inactive"||e==="active")&&(this.displayBindCartBtn$.next(!1),this.displaySaveCartBtn$.next(e==="inactive"),this.deepLinkCartId=this.asmComponentService?.getSearchParameter("cartId"),e==="inactive"&&this.cartId.setValue(this.deepLinkCartId),this.asmComponentService?.setShowDeeplinkCartInfoAlert(!0),this.asmComponentService?.handleDeepLinkNavigation())}))}openASMSaveCartDialog(e){this.launchDialogService.openDialogAndSubscribe(B.ASM_SAVE_CART,this.saveInactiveCartElemRef,e)}afterCloseASMSaveCartDialog(){this.launchDialogService.dialogClose.pipe(w(e=>e===tt.SAVE),k(1),$(()=>this.loading$.next(!0))).subscribe(),this.savedCartFacade.getSaveCartProcessSuccess().pipe(w(e=>e),k(1),$(()=>this.loading$.next(!1))).subscribe(()=>{this.goToSavedCartDetails(this.deepLinkCartId),this.displaySaveCartBtn$.next(!1)}),this.savedCartFacade.getSaveCartProcessError().pipe(w(e=>e),k(1),$(()=>this.loading$.next(!1))).subscribe()}goToSavedCartDetails(e){this.routing?.go({cxRoute:"savedCartsDetails",params:{savedCartId:e}})}static{this.\u0275fac=function(i){return new(i||t)(x(dt),x($i),x(Ui),x(qe),x(J),x(St),x(Me),x(pe))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-bind-cart"]],viewQuery:function(i,n){if(i&1&&(j(Wn,5),j(qn,5)),i&2){let o;z(o=G())&&(n.bindToCartElemRef=o.first),z(o=G())&&(n.saveInactiveCartElemRef=o.first)}},standalone:!1,decls:14,vars:21,consts:[["cartIdElement",""],["bindToCart",""],["saveInactiveCart",""],["for","cartNumber"],["role","search",3,"click","ngClass"],["autocomplete","off","formcontrolname","cartNumber",3,"keydown.enter","formControl"],["class","cx-asm-bindCartToCustomer","type","submit",3,"disabled","cx-asm-active","cx-bind-loading","click",4,"ngIf"],["id","asm-save-inactive-cart-btn","class","cx-asm-bindCartToCustomer cx-asm-active","type","submit",3,"cx-bind-loading","click",4,"ngIf"],["type","submit",1,"cx-asm-bindCartToCustomer",3,"click","disabled"],["id","asm-save-inactive-cart-btn","type","submit",1,"cx-asm-bindCartToCustomer","cx-asm-active",3,"click"]],template:function(i,n){if(i&1){let o=y();l(0,"form")(1,"label",3),_(2),a(3,"cxTranslate"),u(),l(4,"div",4),a(5,"async"),a(6,"cxTranslate"),f("click",function(){C(o);let T=D(8);return h(T.focus())}),l(7,"input",5,0),a(9,"cxTranslate"),f("keydown.enter",function(){return C(o),h(n.bindCartToCustomer())}),u()(),d(10,Kn,12,23,"button",6),a(11,"async"),d(12,Yn,10,16,"button",7),a(13,"async"),u()}i&2&&(r(2),v("",c(3,9,"asm.bindCart.cartNumber")," "),r(2),N("active",c(5,11,n.valid$)),m("ngClass","cx-asm-assignCart-input-show-no-button"),b("aria-label",c(6,13,"asm.bindCart.assignCartId")),r(3),m("formControl",n.cartId),b("aria-label",c(9,15,"asm.bindCart.enterCartId")),r(3),m("ngIf",c(11,17,n.displayBindCartBtn$)),r(2),m("ngIf",c(13,19,n.displaySaveCartBtn$)))},dependencies:[at,Y,Ae,de,_e,Ie,Ct,gi,Nt,ie,P],encapsulation:2,changeDetection:0})}}return t})(),vs=(()=>{class t{constructor(e,i,n,o){this.launchDialogService=e,this.fb=i,this.asmCreateCustomerFacade=n,this.translationService=o,this.iconTypes=He,this.isLoading$=new W(!1),this.showDialogInfoAlert=!0,this.globalMessageType=X,this.focusConfig={trap:!0,block:!0,autofocus:!0,focusOnEscape:!0},this.registerForm=this.fb.group({firstName:["",oe.required],lastName:["",oe.required],email:["",[oe.required,Pi.emailValidator]]})}submitForm(){this.registerForm.valid?this.registerUser():this.registerForm.markAllAsTouched()}registerUser(){this.isLoading$.next(!0);let{firstName:e,lastName:i,email:n}=this.registerForm.value;this.createdCustomer={firstName:e??"",lastName:i??"",email:n??""};let o=this.asmCreateCustomerFacade.createCustomer(this.collectDataFromRegisterForm());o.subscribe({next:g=>this.onRegisterUserSuccess(g),error:g=>this.onRegisterUserFail(g)}),o.subscribe({complete:()=>this.isLoading$.next(!1)})}collectDataFromRegisterForm(){return{firstName:this.createdCustomer.firstName,lastName:this.createdCustomer.lastName,emailAddress:this.createdCustomer.email}}closeModal(e){this.launchDialogService.closeDialog(e)}closeDialogInfoAlert(){this.showDialogInfoAlert=!1}closeDialogBackendErroAlert(e){this.showDialogBackendErrorAlerts[e]=!1}onRegisterUserSuccess(e){this.launchDialogService.closeDialog(e)}onRegisterUserFail(e){this.isLoading$.next(!1),this.backendErrorMessages=[],this.showDialogBackendErrorAlerts=[];let i="httpHandlers.unknownError",n=e.details??[];n.length===0&&this.addErrorMessage(i),n.forEach(o=>{switch(o.type||""){case"ValidationError":this.addErrorMessage(`asm.createCustomerForm.validationErrors.${o.subject}`);break;case"AssistedServiceDuplicatedUidError":this.addErrorMessage("asm.createCustomerForm.badRequestDuplicatedEmail",{emailAddress:this.createdCustomer.email});break;default:this.addErrorMessage(i)}})}addErrorMessage(e,i){this.translationService.translate(e,i).pipe(jt()).subscribe(n=>{this.backendErrorMessages.push(n),this.showDialogBackendErrorAlerts.push(!0)})}static{this.\u0275fac=function(i){return new(i||t)(x(J),x(vi),x(Ke),x(gt))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-create-customer-form"]],standalone:!1,decls:23,vars:17,consts:[["loading",""],["role","dialog","aria-labelledby","asm-create-customer-form-title",1,"cx-modal-container","cx-asm-dialog",3,"esc","cxFocus"],[1,"cx-modal-content"],[3,"ngSubmit","formGroup"],[1,"cx-dialog-header","modal-header"],["id","asm-create-customer-form-title",1,"title","modal-title"],[1,"cx-dialog-body","modal-body"],[1,"message-container"],[3,"text","type","closeMessage",4,"ngIf"],[4,"ngFor","ngForOf"],[4,"ngIf","ngIfElse"],[1,"modal-footer"],["type","submit",1,"btn","cx-asm-create-customer-btn","cx-asm-create-customer-btn-create"],["type","button",1,"btn","cx-asm-create-customer-btn","cx-asm-create-customer-btn-cancel",3,"click"],[3,"closeMessage","text","type"],[1,"form-group"],[1,"label-content"],["required","true","formControlName","firstName","name","text",1,"form-control",3,"placeholder"],["id","firstNameError",3,"control"],["required","true","name","text","formControlName","lastName",1,"form-control",3,"placeholder"],["id","lastNameError",3,"control"],["required","true","name","email","formControlName","email",1,"form-control",3,"placeholder"],["id","emailError",3,"control"],[1,"cx-spinner"]],template:function(i,n){if(i&1){let o=y();l(0,"div",1),f("esc",function(){return C(o),h(n.closeModal("Escape clicked"))}),l(1,"div",2),I(2),l(3,"form",3),f("ngSubmit",function(){return C(o),h(n.submitForm())}),l(4,"div",4)(5,"h2",5),_(6),a(7,"cxTranslate"),u()(),l(8,"div",6)(9,"div",7),d(10,Jn,2,4,"cx-message",8)(11,Xn,2,1,"ng-container",9),u(),d(12,er,25,27,"div",10),a(13,"async"),u(),l(14,"div",11)(15,"button",12),_(16),a(17,"cxTranslate"),u(),l(18,"button",13),f("click",function(){return C(o),h(n.closeModal("Cancel click"))}),_(19),a(20,"cxTranslate"),u()()(),A(),u()(),d(21,tr,2,0,"ng-template",null,0,V)}if(i&2){let o=D(22);m("cxFocus",n.focusConfig),r(3),m("formGroup",n.registerForm),r(3),v(" ",c(7,9,"asm.createCustomerForm.title")," "),r(4),m("ngIf",n.showDialogInfoAlert),r(),m("ngForOf",n.backendErrorMessages),r(),m("ngIf",!c(13,11,n.isLoading$))("ngIfElse",o),r(4),v(" ",c(17,13,"asm.createCustomerForm.createAccount")," "),r(3),v(" ",c(20,15,"asm.createCustomerForm.cancel")," ")}},dependencies:[Ve,Y,Ae,de,_e,Ie,Ge,je,ze,xt,vt,ge,Qe,ie,P],encapsulation:2})}}return t})(),xs={launch:{ASM_CREATE_CUSTOMER_FORM:{inlineRoot:!0,component:vs,dialogType:Ce.DIALOG}}},Ss=(()=>{class t{constructor(e){this.fb=e,this.csAgentTokenLoading=!1,this.submitEvent=new rt,be("a11yPasswordVisibliltyBtnValueOverflow"),be("a11yTextSpacingAdjustments")}ngOnInit(){this.csAgentLoginForm=this.fb.group({userId:["",[oe.required]],password:["",[oe.required]]})}onSubmit(){this.csAgentLoginForm.valid?this.submitEvent.emit({userId:this.csAgentLoginForm.get("userId")?.value,password:this.csAgentLoginForm.get("password")?.value}):this.csAgentLoginForm.markAllAsTouched()}static{this.\u0275fac=function(i){return new(i||t)(x(ht))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-csagent-login-form"]],hostAttrs:["ngSkipHydration","true"],inputs:{csAgentTokenLoading:"csAgentTokenLoading"},outputs:{submitEvent:"submitEvent"},standalone:!1,decls:2,vars:2,consts:[[3,"formGroup","ngSubmit",4,"ngIf"],["aria-hidden","false",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"label-content"],["required","true","type","text","formControlName","userId"],["id","userIdError",3,"translationParams","control"],["required","true","type","password","formControlName","password","cxPasswordVisibilitySwitch",""],["id","passwordError",3,"translationParams","control"],["type","submit"],["aria-hidden","false"]],template:function(i,n){i&1&&d(0,ir,20,32,"form",0)(1,nr,2,3,"cx-dot-spinner",1),i&2&&(m("ngIf",!n.csAgentTokenLoading),r(),m("ngIf",n.csAgentTokenLoading))},dependencies:[Y,Ae,de,_e,Ie,Ge,je,ze,xt,Di,Nt,P],encapsulation:2})}}return t})(),ys=(()=>{class t{constructor(e,i,n,o,g){this.fb=e,this.asmService=i,this.config=n,this.directionService=o,this.launchDialogService=g,this.subscription=new Q,this.searchByCustomer=!1,this.searchByOrder=!1,this.isLoading=!1,this.activeFocusedButtonIndex=-1,this.featureConfig=K(Ue),this.submitEvent=new rt}ngOnInit(){this.customerSelectionForm=this.fb.group({searchTerm:"",searchOrder:""}),this.subscription.add(this.customerSelectionForm.controls.searchOrder.valueChanges.pipe(Be(300)).subscribe(e=>{this.searchByCustomer=!1,this.searchByOrder=!0,this.handleSearchByOrder(e)})),this.asmService.customerSearchReset(),this.searchResultsLoading$=this.asmService.getCustomerSearchResultsLoading(),this.searchResults=this.asmService.getCustomerSearchResults(),this.subscription.add(this.customerSelectionForm.controls.searchTerm.valueChanges.pipe(Be(300)).subscribe(e=>{this.searchByCustomer=!0,this.searchByOrder=!1,this.handleSearchByCustomer(e)})),this.subscription.add(this.searchResultsLoading$.subscribe(e=>{this.isLoading=e}))}handleSearchTerm(e){this.selectedCustomer&&e!==this.selectedCustomer.name&&(this.selectedCustomer=void 0),!this.selectedCustomer&&(this.asmService.customerSearchReset(),this.activeFocusedButtonIndex=-1,e.trim().length>=3&&this.asmService.customerSearch({query:e,pageSize:this.config.asm?.customerSearch?.maxResults}))}handleSearchByCustomer(e){this.selectedCustomer&&(this.selectedCustomer=void 0),this.customerSelectionForm.controls.searchOrder.value&&this.customerSelectionForm.controls.searchOrder.setValue(void 0,{emitEvent:!1}),this.asmService.customerSearchReset(),this.activeFocusedButtonIndex=-1,e.trim().length>=3&&this.asmService.customerSearch({query:e,pageSize:this.config.asm?.customerSearch?.maxResults})}handleSearchByOrder(e){this.selectedCustomer&&(this.selectedCustomer=void 0),this.customerSelectionForm.controls.searchTerm.value&&this.customerSelectionForm.controls.searchTerm.setValue(void 0,{emitEvent:!1}),this.asmService.customerSearchReset(),this.activeFocusedButtonIndex=-1,e.trim().length>=3&&this.asmService.customerSearch({orderId:e,pageSize:this.config.asm?.customerSearch?.maxResults})}isNoResultMessageInfoVisible(e,i,n){let o=n.value.length>=3,g=!!e.entries&&e.entries.length>0;return!this.isLoading&&o&&i&&!g}isSearchResultsVisible(e,i){return!!e.entries&&i&&e.entries.length>0}selectCustomerFromList(e,i){this.selectedCustomer=i,this.customerSelectionForm.controls.searchTerm.setValue(this.selectedCustomer.name,{emitEvent:!1}),this.asmService.customerSearchReset(),e.preventDefault(),e.stopPropagation()}onSubmit(){this.selectedCustomer?this.submitEvent.emit({customerId:this.selectedCustomer.customerId,parameters:{orderId:this.customerSelectionForm.controls.searchOrder.value}}):this.customerSelectionForm.markAllAsTouched()}onDocumentClick(e){if(this.resultList){if(this.resultList.nativeElement.contains(e.target)||this.searchTerm.nativeElement.contains(e.target))return;this.asmService.customerSearchReset()}}closeResults(e){this.asmService.customerSearchReset(),this.searchTerm.nativeElement.focus(),e.preventDefault(),e.stopPropagation()}closeOrderSearchResults(e){this.asmService.customerSearchReset(),this.searchOrder.nativeElement.focus(),e.preventDefault(),e.stopPropagation()}ngOnDestroy(){this.subscription.unsubscribe(),this.asmService.customerSearchReset()}focusFirstItem(e){e.preventDefault(),this.activeFocusedButtonIndex=0,this.updateItemIndex(this.activeFocusedButtonIndex)}setSelectionEnd(e){if(e.preventDefault(),this.searchTerm.nativeElement.value?.length){let i=this.searchTerm.nativeElement.value.length;this.searchTerm.nativeElement.selectionStart=i,this.searchTerm.nativeElement.selectionEnd=i}}setOrderSearchSelectionEnd(e){if(e.preventDefault(),this.searchOrder.nativeElement.value?.length){let i=this.searchOrder.nativeElement.value.length;this.searchOrder.nativeElement.selectionStart=i,this.searchOrder.nativeElement.selectionEnd=i}}focusPreviousChild(e){e.preventDefault(),this.activeFocusedButtonIndex--,this.activeFocusedButtonIndex<0&&(this.activeFocusedButtonIndex=this.searchResultItems.length-1),this.updateItemIndex(this.activeFocusedButtonIndex)}focusNextChild(e){e.preventDefault(),this.activeFocusedButtonIndex++,this.activeFocusedButtonIndex>this.searchResultItems.length-1&&(this.activeFocusedButtonIndex=0),this.updateItemIndex(this.activeFocusedButtonIndex)}focusInputText(e){if(e.preventDefault(),this.activeFocusedButtonIndex=-1,this.searchTerm.nativeElement.focus(),this.searchTerm.nativeElement.value?.length){let i=this.searchTerm.nativeElement.selectionEnd,n=this.searchTerm.nativeElement.value.length;this.isBackNavigation(e)?i=i<=0?0:i-1:this.isForwardsNavigation(e)?i=i>=n?n:i+1:e.code==="Home"?i=0:e.code==="End"&&(i=n),this.searchTerm.nativeElement.selectionStart=i,this.searchTerm.nativeElement.selectionEnd=i}}focusOrderSearchInputText(e){if(e.preventDefault(),this.activeFocusedButtonIndex=-1,this.searchOrder.nativeElement.focus(),this.searchOrder.nativeElement.value?.length){let i=this.searchOrder.nativeElement.selectionEnd,n=this.searchOrder.nativeElement.value.length;this.isBackNavigation(e)?i=i<=0?0:i-1:this.isForwardsNavigation(e)?i=i>=n?n:i+1:e.code==="Home"?i=0:e.code==="End"&&(i=n),this.searchOrder.nativeElement.selectionStart=i,this.searchOrder.nativeElement.selectionEnd=i}}updateItemIndex(e){this.searchResultItems.toArray()?.[e]?.nativeElement.focus()}createCustomer(){this.asmService.customerSearchReset(),this.launchDialogService.openDialogAndSubscribe(B.ASM_CREATE_CUSTOMER_FORM,this.createCustomerLink),setTimeout(()=>{this.searchTerm.nativeElement.blur()})}isForwardsNavigation(e){return e.code==="ArrowRight"&&this.isLTRDirection()||e.code==="ArrowLeft"&&this.isRTLDirection()}isBackNavigation(e){return e.code==="ArrowLeft"&&this.isLTRDirection()||e.code==="ArrowRight"&&this.isRTLDirection()}isLTRDirection(){return this.directionService.getDirection()===ft.LTR}isRTLDirection(){return this.directionService.getDirection()===ft.RTL}static{this.\u0275fac=function(i){return new(i||t)(x(ht),x(Xe),x(We),x(Fi),x(J))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-customer-selection"]],viewQuery:function(i,n){if(i&1&&(j(rr,5),j(or,5),j(sr,5),j(ar,5),j(cr,5)),i&2){let o;z(o=G())&&(n.resultList=o.first),z(o=G())&&(n.searchTerm=o.first),z(o=G())&&(n.searchOrder=o.first),z(o=G())&&(n.createCustomerLink=o.first),z(o=G())&&(n.searchResultItems=o)}},hostBindings:function(i,n){i&1&&f("click",function(g){return n.onDocumentClick(g)},!1,Ht)},outputs:{submitEvent:"submitEvent"},standalone:!1,decls:26,vars:33,consts:[["searchTerm",""],["searchOrder",""],["resultList",""],["createCustomerLink",""],["searchResultItem",""],[3,"ngSubmit","formGroup"],[1,"searchLabel"],["required","true","type","text","formControlName","searchTerm",3,"keydown.arrowdown","keydown.end","placeholder"],[4,"ngIf"],["class","asm-results",4,"ngIf"],["required","true","type","text","formControlName","searchOrder",3,"keydown.arrowdown","keydown.end","placeholder"],["type","submit",3,"disabled"],["class","cx-message cx-message-info selection-message-info",4,"ngIf"],[1,"cx-message","cx-message-info","selection-message-info"],[1,"cx-message-content"],[1,"cx-message-header"],[1,"cx-message-icon"],["ng-reflect-type","INFO",1,"cx-icon","fas","fa-info-circle"],[1,"cx-message-text"],[1,"linkStyleLabel",3,"click"],[1,"asm-results"],[3,"tabindex","active","keydown.arrowup","keydown.arrowdown","keydown.arrowright","keydown.arrowleft","keydown.enter","keydown.escape","keydown.home","keydown.end","click",4,"ngFor","ngForOf"],[3,"keydown.arrowup","keydown.arrowdown","keydown.arrowright","keydown.arrowleft","keydown.enter","keydown.escape","keydown.home","keydown.end","click","tabindex"],[1,"result-name"],[1,"result-id"],["aria-hidden","false"]],template:function(i,n){if(i&1){let o=y();l(0,"form",5),f("ngSubmit",function(){return C(o),h(n.onSubmit())}),l(1,"span",6),_(2),a(3,"cxTranslate"),u(),l(4,"label")(5,"input",7,0),a(7,"cxTranslate"),a(8,"cxTranslate"),f("keydown.arrowdown",function(T){return C(o),h(n.focusFirstItem(T))})("keydown.end",function(T){return C(o),h(n.setSelectionEnd(T))}),u(),d(9,pr,4,2,"div",8),a(10,"async"),d(11,dr,3,3,"div",9),u(),l(12,"span",6),_(13),a(14,"cxTranslate"),u(),l(15,"label")(16,"input",10,1),a(18,"cxTranslate"),a(19,"cxTranslate"),f("keydown.arrowdown",function(T){return C(o),h(n.focusFirstItem(T))})("keydown.end",function(T){return C(o),h(n.setOrderSearchSelectionEnd(T))}),u(),d(20,hr,4,2,"div",8),a(21,"async"),d(22,fr,3,3,"div",9),u(),l(23,"button",11),_(24),a(25,"cxTranslate"),u()()}i&2&&(m("formGroup",n.customerSelectionForm),r(2),E(c(3,15,"asm.customerSearch.customer")),r(3),R("placeholder",c(7,17,"asm.customerSearch.searchCustomer.label")),b("aria-label",c(8,19,"asm.customerSearch.searchCustomer.label")),r(4),m("ngIf",c(10,21,n.searchResults)),r(2),m("ngIf",n.isLoading&&n.searchByCustomer),r(2),E(c(14,23,"asm.customerSearch.orderID")),r(3),R("placeholder",c(18,25,"asm.customerSearch.searchOrder.label")),b("aria-label",c(19,27,"asm.customerSearch.searchOrder.label")),r(4),m("ngIf",c(21,29,n.searchResults)),r(2),m("ngIf",n.isLoading&&n.searchByOrder),r(),N("active",n.selectedCustomer),m("disabled",!n.selectedCustomer),r(),v(" ",c(25,31,"asm.customerSearch.submit")," "))},dependencies:[Ve,Y,Ae,de,_e,Ie,Ge,je,ze,Le,Nt,ie,P],encapsulation:2})}}return t})(),bs=(()=>{class t{transform(e){e<0&&(e=0);let i=Math.floor(e/60),n=e%60,o;i<10?o=("00"+i).slice(-2):o=i+"";let g=("00"+n).slice(-2);return`${o}:${g}`}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275pipe=ot({name:"formatTimer",type:t,pure:!0,standalone:!1})}}return t})(),Ts=(()=>{class t{constructor(e,i,n,o,g){this.config=e,this.asmComponentService=i,this.routingService=n,this.changeDetectorRef=o,this.userIdService=g,this.subscriptions=new Q,this.maxStartDelayInSeconds=6e4}ngOnInit(){this.initTimer(),this.interval=setInterval(()=>{let e=new Date().getTime()/1e3;this.timeLeft=Math.floor(this.expiredTime-e),this.timeLeft<=0&&(clearInterval(this.interval),this.asmComponentService.logoutCustomerSupportAgentAndCustomer()),this.changeDetectorRef.markForCheck()},1e3),this.resetOnNavigate(),this.resetOnCustomerSessionChange()}resetOnNavigate(){this.subscriptions.add(this.routingService.isNavigating().subscribe(e=>{e&&this.resetTimer()}))}resetOnCustomerSessionChange(){this.subscriptions.add(this.userIdService.getUserId().pipe(fe()).subscribe(()=>this.resetTimer()))}initTimer(){let e=this.getTimerStartDelayInSeconds(),i=new Date().getTime()/1e3;this.timeLeft=e,this.expiredTime=i+this.timeLeft}resetTimer(){this.timeLeft>0&&this.initTimer()}getTimerStartDelayInSeconds(){return this.config.asm?.agentSessionTimer?.startingDelayInSeconds===void 0?600:this.config.asm.agentSessionTimer.startingDelayInSeconds>this.maxStartDelayInSeconds?this.maxStartDelayInSeconds:this.config.asm.agentSessionTimer.startingDelayInSeconds}ngOnDestroy(){this.subscriptions.unsubscribe(),this.interval&&clearInterval(this.interval)}static{this.\u0275fac=function(i){return new(i||t)(x(We),x(Me),x(pe),x(Jt),x(mi))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-session-timer"]],standalone:!1,decls:9,vars:12,consts:[[1,"label"],[1,"time"],[1,"reset",3,"click","title"]],template:function(i,n){i&1&&(l(0,"span",0),_(1),a(2,"cxTranslate"),u(),l(3,"span",1),_(4),a(5,"formatTimer"),a(6,"cxTranslate"),u(),l(7,"button",2),a(8,"cxTranslate"),f("click",function(){return n.resetTimer()}),u()),i&2&&(r(),v("",c(2,4,"asm.agentSessionTimer.label"),":"),r(3),Wt("",c(5,6,n.timeLeft)," ",c(6,8,"asm.agentSessionTimer.minutes"),""),r(3),R("title",c(8,10,"asm.agentSessionTimer.reset")))},dependencies:[P,bs],encapsulation:2})}}return t})(),Is=(()=>{class t{constructor(e,i,n,o){this.asmComponentService=e,this.userAccountFacade=i,this.launchDialogService=n,this.featureModules=o,this.isAsmCustomer360Configured=!1,this.isAsmCustomer360Loaded$=new W(!1),this.subscription=new Q,this.featureConfig=K(Ue)}ngOnInit(){this.isAsmCustomer360Configured=this.featureModules?.isConfigured("asmCustomer360"),this.isAsmCustomer360Configured&&this.featureModules?.resolveFeature("asmCustomer360").subscribe(()=>{this.isAsmCustomer360Loaded$.next(!0)}),this.subscription.add(this.userAccountFacade.get().subscribe(e=>{e&&(this.customer=e)})),this.isCustomerEmulationSessionInProgress$=this.asmComponentService.isCustomerEmulationSessionInProgress()}logoutCustomer(){this.asmComponentService.logoutCustomer()}openAsmCustomer360(){this.subscription.add(this.isAsmCustomer360Loaded$.pipe(w(e=>!!e)).subscribe(()=>{let e={customer:this.customer};this.launchDialogService?.openDialogAndSubscribe(B.ASM_CUSTOMER_360,this.asmCustomer360LauncherElement,e),this.subscription.add(this.launchDialogService?.dialogClose.pipe(w(i=>!!i)).subscribe(i=>{this.asmComponentService.handleAsmDialogAction(i)}))}))}ngOnDestroy(){this.subscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)(x(Me),x(we),x(J),x(Te))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-customer-emulation"]],viewQuery:function(i,n){if(i&1&&j(vr,5),i&2){let o;z(o=G())&&(n.asmCustomer360LauncherElement=o.first)}},standalone:!1,decls:2,vars:3,consts:[["asmCustomer360Launcher",""],[4,"ngIf"],[1,"cx-asm-customerInfo"],[1,"cx-asm-name"],[1,"cx-asm-uid"],["class","cx-360-button",3,"click",4,"ngIf"],["formcontrolname","logoutCustomer",3,"click"],[1,"cx-360-button",3,"click"]],template:function(i,n){i&1&&(d(0,Sr,11,6,"ng-container",1),a(1,"async")),i&2&&m("ngIf",c(1,1,n.isCustomerEmulationSessionInProgress$))},dependencies:[Y,fs,ie,P],encapsulation:2})}}return t})(),As=(()=>{class t{constructor(e){this.asmService=e,this.subscription=new Q}ngOnInit(){this.subscription.add(this.asmService.getAsmUiState().subscribe(e=>{this.isCollapsed=e.collapsed===void 0?!1:e.collapsed}))}toggleUi(){this.asmService.updateAsmUiState({collapsed:!this.isCollapsed})}ngOnDestroy(){this.subscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)(x(Xe))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-toggle-ui"]],standalone:!1,decls:4,vars:3,consts:[["tabindex","0","role","button",1,"toggleUi",3,"click"],[3,"ngClass"],["class","label",4,"ngIf"],[1,"label"]],template:function(i,n){i&1&&(l(0,"a",0),f("click",function(){return n.toggleUi()}),S(1,"span",1),d(2,yr,3,3,"span",2)(3,br,3,3,"span",2),u()),i&2&&(r(),m("ngClass",n.isCollapsed?"expandIcon":"collapseIcon"),r(),m("ngIf",!n.isCollapsed),r(),m("ngIf",n.isCollapsed))},dependencies:[at,Y,P],encapsulation:2})}}return t})(),Es={active:"asm.activeCartAlertInfo",inactive:"asm.saveInactiveCartAlertInfo"},Ls=(()=>{class t{constructor(e,i,n,o,g,T,se,he){this.authService=e,this.csAgentAuthService=i,this.asmComponentService=n,this.globalMessageService=o,this.routingService=g,this.asmService=T,this.userAccountFacade=se,this.launchDialogService=he,this.iconTypes=He,this.forbiddenResponseStatus=_t.FORBIDDEN,this.showDeeplinkCartInfoAlert$=this.asmComponentService.shouldShowDeeplinkCartInfoAlert(),this.deeplinkCartAlertKey="",this.showCreateCustomerSuccessfullyAlert=!1,this.globalMessageType=X,this.disabled=!1,this.startingCustomerSession=!1,this.showCustomerEmulationInfoAlert=!0,this.subscription=new Q,this.isAsmCustomer360Configured=!1,this.isAsmCustomer360Loaded$=new W(!1),this.featureModules=K(Te),this.oAuthLibWrapperService=K(di)}ngOnInit(){this.isAsmCustomer360Configured=this.featureModules.isConfigured("asmCustomer360"),this.isAsmCustomer360Configured&&this.featureModules.resolveFeature("asmCustomer360").subscribe(()=>{this.isAsmCustomer360Loaded$.next(!0)}),this.customerSupportAgentLoggedIn$=this.csAgentAuthService.isCustomerSupportAgentLoggedIn().pipe(fe(),$(e=>{e||this.closeModal()})),this.csAgentTokenLoading$=this.csAgentAuthService.getCustomerSupportAgentTokenLoading(),this.customer$=this.authService.isUserLoggedIn().pipe(ve(e=>e?(this.handleCustomerSessionStartRedirection(),this.userAccountFacade.get()):ae(void 0))),this.isCollapsed$=this.asmService.getAsmUiState().pipe(M(e=>e.collapsed===void 0?!1:e.collapsed)),this.asmService.getAsmUiState().subscribe(e=>{e.status===this.forbiddenResponseStatus&&(this.logout(),this.hideUi(),this.asmService.updateAsmUiState({status:void 0}))}),this.subscription.add(this.launchDialogService.dialogClose.pipe(w(e=>!!e)).subscribe(e=>{typeof e!="string"&&("selectedUser"in e?(this.startCustomerEmulationSession(e.selectedUser),e.actionType===le.ORDER_HISTORY&&this.routingService.go({cxRoute:"orders"})):"customerId"in e&&(this.startCustomerEmulationSession({customerId:e.customerId}),this.showCreateCustomerSuccessfullyAlert=!0,this.routingService.go("/")),"actionType"in e&&e.actionType===le.ACTIVE_CART?this.routingService.go({cxRoute:"cart"}):"actionType"in e&&e.actionType===le.CUSTOMER_360&&this.customer$.pipe(w(i=>!!i),k(1)).subscribe(i=>{this.showC360Dialog(i)})),e===bt.FORBIDDEN&&(this.logout(),this.hideUi())})),this.subscription.add(ce([this.customerSupportAgentLoggedIn$,this.asmComponentService.isCustomerEmulationSessionInProgress()]).pipe(Be(500),fe(),w(([e])=>!!e)).subscribe(()=>{this.asmService.customerSearch({query:"autoSearchToAvoidUnauthorizedLogin",pageSize:1})})),this.subscribeForDeeplink()}showC360Dialog(e){this.isAsmCustomer360Loaded$.pipe(w(i=>!!i)).subscribe(()=>{let i={customer:e};this.launchDialogService.openDialogAndSubscribe(B.ASM_CUSTOMER_360,this.element,i)}),this.subscription.add(this.launchDialogService.dialogClose.pipe(w(i=>!!i)).subscribe(i=>{this.asmComponentService.handleAsmDialogAction(i)}))}subscribeForDeeplink(){this.asmComponentService.isEmulateInURL()&&this.routingService.go("/");let e=this.asmComponentService.getDeepLinkUrlParams()??{customerId:this.asmComponentService.getSearchParameter("customerId"),orderId:this.asmComponentService.getSearchParameter("orderId"),ticketId:this.asmComponentService.getSearchParameter("ticketId"),cartId:this.asmComponentService.getSearchParameter("cartId"),cartType:this.asmComponentService.getSearchParameter("cartType"),emulated:!1};this.deeplinkCartAlertKey=Es[e.cartType||""],this.subscription.add(ce([this.customerSupportAgentLoggedIn$,this.authService.isUserLoggedIn(),this.asmComponentService.isEmulatedByDeepLink()]).subscribe(([i,n,o])=>{i&&e.customerId&&(!o&&n?this.confirmSwitchCustomer(e.customerId):setTimeout(()=>this.startSessionWithParameters(ke(H({},e),{emulated:o}))))}))}confirmSwitchCustomer(e){this.customer$.pipe(w(i=>!!i),k(1)).subscribe(i=>{i?.customerId!==e?this.userAccountFacade.getById(e).subscribe({next:n=>{this.launchDialogService.openDialogAndSubscribe(B.ASM_SWITCH_CUSTOMER,this.element,{curCustomer:i,switchCustomer:n})},error:n=>{this.globalMessageService.add(n.details?.[0].message??"",X.MSG_TYPE_ERROR)}}):this.asmComponentService.setEmulatedByDeepLink(!0)})}startSessionWithParameters(e){e.emulated||(this.asmComponentService.setEmulatedByDeepLink(!0),this.startCustomerEmulationSession({customerId:e.customerId},e))}handleCustomerSessionStartRedirection(){this.asmComponentService.isCustomerEmulationSessionInProgress().pipe(k(1)).subscribe(e=>{this.startingCustomerSession&&e&&(this.startingCustomerSession=!1,this.globalMessageService.remove(X.MSG_TYPE_ERROR),this.routingService.go("/"))})}loginCustomerSupportAgent({userId:e,password:i}){this.csAgentAuthService.authorizeCustomerSupportAgent(e,i)}loginCustomerSupportAgentWithAuthorizationCodeFlow(){this.csAgentAuthService.authorizeCustomerSupportAgentWhenUseCodeFlow()}logout(){this.asmComponentService.logoutCustomerSupportAgentAndCustomer()}startCustomerEmulationSession({customerId:e},i){e?(this.csAgentAuthService.startCustomerEmulationSession(e),this.startingCustomerSession=!0,this.showCustomerEmulationInfoAlert=!0,this.showCreateCustomerSuccessfullyAlert=!1,i&&this.asmComponentService.handleDeepLinkNavigation(H({customerId:e},i))):this.globalMessageService.add({key:"asm.error.noCustomerId"},X.MSG_TYPE_ERROR)}hideUi(){this.disabled=!0,this.asmComponentService.unload(),this.oAuthLibWrapperService.refreshAuthConfig()}showCustomList(){this.launchDialogService.openDialogAndSubscribe(B.ASM_CUSTOMER_LIST,this.element)}closeModal(){this.launchDialogService.closeDialog("logout")}createCustomer(){this.launchDialogService?.openDialogAndSubscribe(B.ASM_CREATE_CUSTOMER_FORM,this.addNewCustomerLink)}closeDialogConfirmationAlert(){this.showCreateCustomerSuccessfullyAlert=!1}closeDeeplinkCartInfoAlert(){this.asmComponentService.setShowDeeplinkCartInfoAlert(!1)}closeCustomerEmulationInfoAlert(){this.showCustomerEmulationInfoAlert=!1}ngOnDestroy(){this.subscription?.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)(x(pt),x(yt),x(Me),x(dt),x(pe),x(Xe),x(we),x(J))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-main-ui"]],viewQuery:function(i,n){if(i&1&&(j(Tr,5),j(an,5)),i&2){let o;z(o=G())&&(n.element=o.first),z(o=G())&&(n.addNewCustomerLink=o.first)}},hostVars:2,hostBindings:function(i,n){i&2&&N("hidden",n.disabled)},standalone:!1,decls:28,vars:32,consts:[["customerListLink",""],["showLoginForm",""],["showCustomerSelection",""],[1,"asm-bar"],[1,"asm-bar-branding"],["src","data:image/png;base64,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","width","48","height","24",1,"logo",3,"alt","title"],[1,"asm-title"],[1,"asm-bar-actions"],[1,"cx-asm-help-portal"],["href","https://help.sap.com/docs/SAP_COMMERCE_COMPOSABLE_STOREFRONT/d1ca9a1517f847a5b57b4e08400807c1/2367ff04ccb649ac82a3795ecf72a804.html?locale=en-US","target","_blank","rel","noopener noreferrer","role","button"],[3,"type"],["class","cx-asm-customer-list",4,"ngIf"],[4,"cxFeature"],[4,"ngIf"],["class","close",3,"title","click",4,"ngIf"],["class","logout",3,"title","click",4,"ngIf"],[1,"cx-asm-customer-list"],["tabindex","0","role","button",1,"cx-asm-customer-list-link",3,"click"],["role","link",1,"cx-asm-customer-list-link",3,"click"],[1,"close",3,"click","title"],[1,"logout",3,"click","title"],[4,"ngIf","ngIfElse"],[3,"text","type","closeMessage",4,"ngIf"],[3,"closeMessage","text","type"],[3,"submitEvent",4,"ngIf"],[3,"submitEvent"],[3,"csAgentTokenLoading","submitEvent",4,"ngIf"],[3,"submitEvent","csAgentTokenLoading"]],template:function(i,n){i&1&&(l(0,"div",3)(1,"div",4),S(2,"img",5),a(3,"cxTranslate"),a(4,"cxTranslate"),l(5,"div",6),_(6),a(7,"cxTranslate"),u()(),l(8,"div",7)(9,"div",8)(10,"a",9),S(11,"cx-icon",10),l(12,"span"),_(13),a(14,"cxTranslate"),u()()(),d(15,Ir,7,4,"div",11),a(16,"async"),d(17,Er,3,3,"ng-container",12)(18,Lr,1,0,"cx-asm-session-timer",13),a(19,"async"),d(20,Dr,3,3,"ng-container",12)(21,Rr,2,3,"button",14),a(22,"async"),a(23,"async"),d(24,Fr,2,3,"button",15),a(25,"async"),u()(),d(26,Gr,5,4,"ng-container",13),a(27,"async")),i&2&&(r(2),R("alt",c(3,12,"asm.mainLogoLabel")),R("title",c(4,14,"asm.mainLogoLabel")),r(4),v(" ",c(7,16,"asm.mainTitle")," "),r(5),m("type",n.iconTypes.HELP),r(2),E(c(14,18,"asm.helpPortalUrl")),r(2),m("ngIf",c(16,20,n.customerSupportAgentLoggedIn$)),r(2),m("cxFeature","!authorizationCodeFlowByDefault"),r(),m("ngIf",c(19,22,n.customerSupportAgentLoggedIn$)),r(2),m("cxFeature","authorizationCodeFlowByDefault"),r(),m("ngIf",!c(22,24,n.customerSupportAgentLoggedIn$)&&!c(23,26,n.csAgentTokenLoading$)),r(3),m("ngIf",c(25,28,n.customerSupportAgentLoggedIn$)),r(2),m("ngIf",!c(27,30,n.isCollapsed$)))},dependencies:[Y,Le,Qe,$e,Ss,ys,Ts,Is,As,ie,P],encapsulation:2})}}return t})(),Bt=function(t){return t.CANCEL="CANCEL",t.SWITCH="SWITCH",t}(Bt||{}),ws=(()=>{class t{constructor(e,i){this.launchDialogService=e,this.asmComponentService=i,this.SWITCH_CUSTOMER_DIALOG_ACTION=Bt,this.focusConfig={trap:!0,block:!0,autofocus:!0,focusOnEscape:!0}}ngOnInit(){this.launchDialogService.data$.pipe(k(1)).subscribe(e=>{this.curCustomerName=e.curCustomer.name||"",this.switchCustomerName=e.switchCustomer.name||""})}closeModal(e){e===Bt.SWITCH&&this.asmComponentService.logoutCustomer(),this.launchDialogService.closeDialog(e)}static{this.\u0275fac=function(i){return new(i||t)(x(J),x(Me))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-asm-switch-customer-dialog"]],standalone:!1,decls:23,vars:23,consts:[["role","dialog","aria-labelledby","asm-switch-customer-dialog-title",1,"cx-asm-switch-customer-dialog","cx-modal-container","cx-asm-dialog",3,"esc","cxFocus"],[1,"cx-modal-content"],[1,"cx-dialog-header","modal-header"],["type","WARNING"],["id","asm-switch-customer-dialog-title",1,"title","modal-title"],[1,"cx-dialog-body","modal-body"],[1,"cx-dialog-row","switch-customer-content"],[1,"cx-dialog-item"],[1,"cx-dialog-footer","modal-footer"],["type","button",1,"btn","btn-primary",3,"click"],["type","button",1,"btn","btn-secondary",3,"click"]],template:function(i,n){i&1&&(l(0,"div",0),f("esc",function(){return n.closeModal(n.SWITCH_CUSTOMER_DIALOG_ACTION.CANCEL)}),l(1,"div",1)(2,"div",2)(3,"div")(4,"span"),S(5,"cx-icon",3),u(),l(6,"span",4),_(7),a(8,"cxTranslate"),u()()(),l(9,"div",5)(10,"div",6)(11,"div",7),_(12),a(13,"cxTranslate"),u()()(),l(14,"div",8)(15,"button",9),a(16,"cxTranslate"),f("click",function(){return n.closeModal(n.SWITCH_CUSTOMER_DIALOG_ACTION.SWITCH)}),_(17),a(18,"cxTranslate"),u(),l(19,"button",10),a(20,"cxTranslate"),f("click",function(){return n.closeModal(n.SWITCH_CUSTOMER_DIALOG_ACTION.CANCEL)}),_(21),a(22,"cxTranslate"),u()()()()),i&2&&(m("cxFocus",n.focusConfig),r(7),v(" ",c(8,7,"asm.switchCustomer.dialog.title")," "),r(5),v(" ",Ne(13,9,"asm.switchCustomer.dialog.body",te(20,Hr,n.curCustomerName,n.switchCustomerName))," "),r(3),b("aria-label",c(16,12,"asm.switchCustomer.dialog.actions.switch")),r(2),v(" ",c(18,14,"asm.switchCustomer.dialog.actions.switch")," "),r(2),b("aria-label",c(20,16,"common.cancel")),r(2),v(" ",c(22,18,"common.cancel")," "))},dependencies:[Le,ge,P],encapsulation:2})}}return t})(),Ds=(()=>{class t{constructor(e,i,n,o,g,T){this.launchDialogService=e,this.breakpointService=i,this.asmConfig=n,this.translation=o,this.asmCustomerListFacade=g,this.occConfig=T,this.DEFAULT_PAGE_SIZE=5,this.focusConfig={trap:!0,block:!0,autofocus:"customer-list-selector",focusOnEscape:!0},this.iconTypes=He,this.BREAKPOINT=Ee,this.currentPage=0,this.maxPage=0,this.loaded=!1,this.listsError=!1,this.listsEmpty=!1,this.enableAsmB2bCustomerList=!1,this.customerListColumnActionType=le,this.searchBox=new hi,this.forbiddenResponseStatus=_t.FORBIDDEN,this.teardown=new Q,this.isAsmCustomer360Configured=!1,this.featureModules=K(Te),be("a11yShowLabelOfSelect"),this.breakpoint$=this.getBreakpoint()}ngOnInit(){this.isAsmCustomer360Configured=this.featureModules.isConfigured("asmCustomer360"),this.pageSize=this.asmConfig.asm?.customerList?.pageSize??this.DEFAULT_PAGE_SIZE,this.customerListConfig=this.asmConfig?.asm?.customerList,this.customerListsPage$=this.asmCustomerListFacade.getCustomerListsState().pipe($(e=>this.listsError=!!e.error),M(e=>{if(e.error&&typeof e.error=="object"&&"status"in e.error&&e.error.status===this.forbiddenResponseStatus&&this.launchDialogService.closeDialog(bt.FORBIDDEN),e?.data?.userGroups?.length===0){this.listsEmpty=!0;return}else return e.data}),fe(),$(e=>{this.selectedUserGroupId||(this.selectedUserGroupId=e?.userGroups?.[0]?.uid,this.sorts=null,this.fetchCustomers())}))??Ut,this.customerSearchLoading$=this.asmCustomerListFacade.getCustomerListCustomersSearchResultsLoading().pipe($(e=>this.loaded=!e)),this.teardown.add(this.customerSearchLoading$.subscribe()),this.teardown.add(()=>this.asmCustomerListFacade.customerListCustomersSearchReset()),this.customerSearchError$=this.asmCustomerListFacade.getCustomerListCustomersSearchResultsError(),this.customerSearchPage$=this.asmCustomerListFacade.getCustomerListCustomersSearchResults().pipe($(e=>{e?.sorts&&(this.sorts=e.sorts,this.sortCode=e.pagination?.sort),e?.entries.length<this.pageSize?this.maxPage=e.pagination?.currentPage??0:this.maxPage=this.currentPage+1}))}ngOnDestroy(){this.teardown.unsubscribe()}changePage(e){let i={customerListId:this.selectedUserGroupId,pageSize:this.pageSize,page:e,sort:this.sortCode};this.searchBox?.value&&(i.query=this.searchBox.value),this.asmCustomerListFacade.customerListCustomersSearch(i)}fetchCustomers(){if(this.enableAsmB2bCustomerList=this.selectedUserGroupId==="b2bCustomerList",this.selectedUserGroupId){let e={customerListId:this.selectedUserGroupId,pageSize:this.pageSize,page:this.currentPage};this.sortCode&&(e.sort=this.sortCode),this.searchBox?.value&&(e.query=this.searchBox.value),this.asmCustomerListFacade.customerListCustomersSearchReset(),this.asmCustomerListFacade.customerListCustomersSearch(e)}this.updateCustomerListColumns()}updateCustomerListColumns(){let e=this.customerListConfig?.columns||[];for(let i of e)(i.headerLocalizationKey==="asm.customerList.tableHeader.account"||i.headerLocalizationKey==="hideHeaders")&&(i.headerLocalizationKey=this.enableAsmB2bCustomerList?"asm.customerList.tableHeader.account":"hideHeaders"),!this.isAsmCustomer360Configured&&i.headerLocalizationKey==="asm.customerList.tableHeader.customer360"&&(i.headerLocalizationKey="hideHeaders")}onChangeCustomerGroup(){this.currentPage=0,this.sorts=null,this.sortCode="",this.fetchCustomers()}getGroupName(e,i){return e?.userGroups?.find(n=>n.uid===i)?.name??""}getBadgeText(e){return(e.firstName?.charAt(0)??"")+(e.lastName?.charAt(0)??"")}startColumnAction(e,i){this.selectedCustomer=e;let n={actionType:i,selectedUser:e};this.closeModal(n)}onKey(e){e.key==="Enter"&&this.searchCustomers()}searchCustomers(){this.currentPage=0,this.fetchCustomers()}isRequired(e,i){return i===le.ACTIVE_CART&&!e.lastCartId||i===le.ORDER_HISTORY&&e.hasOrder!==!0}changeSortCode(e){this.sortCode=e,this.fetchCustomers()}goToNextPage(){this.currentPage>=this.maxPage?this.currentPage=this.maxPage:this.loaded&&(this.currentPage++,this.fetchCustomers())}goToPreviousPage(){this.currentPage<=0?this.currentPage=0:this.loaded&&(this.currentPage--,this.fetchCustomers())}closeModal(e){this.launchDialogService.closeDialog(e)}getSortLabels(){return ce([this.translation.translate("asm.customerList.tableSort.byName"),this.translation.translate("asm.customerList.tableSort.byNameAsc"),this.translation.translate("asm.customerList.tableSort.byNameDesc"),this.translation.translate("asm.customerList.tableSort.byDateAsc"),this.translation.translate("asm.customerList.tableSort.byDateDesc"),this.translation.translate("asm.customerList.tableSort.byOrderDateAsc"),this.translation.translate("asm.customerList.tableSort.byOrderDateDesc"),this.translation.translate("asm.customerList.tableSort.byUnit"),this.translation.translate("asm.customerList.tableSort.byUnitDesc")]).pipe(M(([e,i,n,o,g,T,se,he,me])=>({byName:e,byNameAsc:i,byNameDesc:n,byOrderDateAsc:T,byOrderDateDesc:se,byDateAsc:o,byDateDesc:g,byUnit:he,byUnitDesc:me})))}createCustomer(){this.launchDialogService.closeDialog("Create customer click"),this.launchDialogService?.openDialogAndSubscribe(B.ASM_CREATE_CUSTOMER_FORM,this.addNewCustomerLink)}getBreakpoint(){return this.breakpointService.breakpoint$.pipe(M(e=>((e===Ee.lg||e===Ee.xl)&&(e=Ee.md),e)))}static{this.\u0275fac=function(i){return new(i||t)(x(J),x(Ai),x(We),x(gt),x(Ye),x(si))}}static{this.\u0275cmp=O({type:t,selectors:[["cx-customer-list"]],viewQuery:function(i,n){if(i&1&&j(an,5),i&2){let o;z(o=G())&&(n.addNewCustomerLink=o.first)}},standalone:!1,decls:48,vars:28,consts:[["cell",""],["cellContent",""],["search",""],["total",""],["sort",""],["pagination",""],["groupSelector",""],["closeButton",""],["createCustomerButton",""],["role","dialog","aria-labelledby","asm-customer-list-title",1,"cx-asm-customer-list","cx-modal-container","cx-asm-dialog",3,"esc","cxFocus"],[1,"cx-modal-content"],[1,"cx-dialog-header","modal-header"],["id","asm-customer-list-title",1,"title","modal-title"],["id","asm-customer-list-desc",1,"cx-visually-hidden"],[4,"ngTemplateOutlet"],["class","cx-dialog-sub-header modal-header",3,"tablet-mobile",4,"ngIf"],[1,"cx-dialog-body","modal-body"],[1,"cx-dialog-row"],[1,"cx-dialog-item"],["class","cx-error-state",4,"ngIf"],[4,"ngIf"],["class","cx-dialog-sub-header modal-header cx-dialog-foot",3,"asm-mobile-pagination",4,"ngIf"],[1,"cx-dialog-footer","modal-footer"],["type","button",1,"btn","cx-asm-customer-list-btn-cancel",3,"click"],[1,"cx-dialog-sub-header","modal-header"],[1,"cx-header-select"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"cx-header-actions"],[1,"cx-error-state"],["id","asm-cusomer-list-table","role","table","class","table",4,"ngIf"],["class","cx-empty-state",4,"ngIf"],["id","asm-cusomer-list-table","role","table",1,"table"],[1,"cx-visually-hidden"],["role","row",4,"ngFor","ngForOf"],["role","row"],["role","columnheader",4,"ngFor","ngForOf"],["role","columnheader"],["role","cell","class","cx-multi-cell",4,"ngIf"],["role","cell",4,"ngFor","ngForOf"],["role","cell"],["role","cell",1,"cx-multi-cell"],[4,"ngFor","ngForOf"],[1,"cx-empty-state"],[1,"cx-dialog-sub-header","modal-header","cx-dialog-foot"],[3,"viewPageEvent","pagination"],["class","cx-cell-container",4,"ngIf"],[1,"cx-cell-container"],["class","cx-header-text",4,"ngIf"],["class","cx-avatar",4,"ngIf"],["class","btn btn-link cx-action-link cx-btn-cell",3,"class","disabled","click",4,"ngIf"],[1,"cx-header-text"],[1,"cx-avatar"],[3,"alt","title",4,"ngIf"],["class","cx-avatar-text",4,"ngIf"],[3,"alt","title"],[1,"cx-avatar-text"],[1,"btn","btn-link","cx-action-link","cx-btn-cell",3,"click","disabled"],[3,"cx-action-color","type",4,"ngIf"],[3,"type"],[1,"form-group","search-wrapper"],["type","text",1,"form-control",3,"keyup","formControl","placeholder"],["role","button",1,"search",3,"click","type","title"],["class","cx-total",4,"ngIf"],[1,"cx-total"],["class","label-content",4,"cxFeature"],["class","cx-visually-hidden",4,"cxFeature"],["ariaControls","asm-cusomer-list-table",1,"sort-selector",3,"sortListEvent","sortOptions","sortLabels","selectedOption","placeholder","ariaLabel"],[1,"label-content"],[1,"cx-pagination-buttons"],["class","btn btn-link cx-action-link cx-btn-previous",3,"disabled","click",4,"ngIf"],["class","btn btn-link cx-action-link cx-btn-next",3,"disabled","click",4,"ngIf"],[1,"btn","btn-link","cx-action-link","cx-btn-previous",3,"click","disabled"],[1,"previous",3,"type"],[1,"btn","btn-link","cx-action-link","cx-btn-next",3,"click","disabled"],[1,"next",3,"type"],["bindLabel","name","bindValue","uid",1,"customer-list-selector",3,"change","ngModelChange","searchable","clearable","tabIndex","ngModel","items","cxNgSelectA11y"],["type","button",1,"close",3,"click","title"],["aria-hidden","true"],["type","button",1,"btn","cx-asm-create-customer-btn",3,"click"]],template:function(i,n){if(i&1){let o=y();l(0,"div",9),f("esc",function(){return C(o),h(n.closeModal("Escape clicked"))}),l(1,"div",10),I(2),l(3,"div",11)(4,"h2",12),_(5),a(6,"cxTranslate"),u(),l(7,"div",13),_(8),a(9,"cxTranslate"),u(),d(10,Jr,1,0,null,14),u(),d(11,so,11,24,"div",15),a(12,"async"),l(13,"div",16)(14,"div",17)(15,"div",18),d(16,ao,3,3,"div",19)(17,co,3,3,"div",19)(18,lo,3,3,"div",19),a(19,"async"),d(20,mo,1,0,"cx-spinner",20),a(21,"async"),d(22,Vo,3,2,"div",20),a(23,"async"),u()()(),d(24,Uo,6,11,"div",21),a(25,"async"),l(26,"div",22)(27,"button",23),f("click",function(){return C(o),h(n.closeModal("Cancel click"))}),_(28),a(29,"cxTranslate"),u()(),A(),u()(),d(30,Yo,1,1,"ng-template",null,0,V)(32,Xo,3,2,"ng-template",null,1,V)(34,es,7,14,"ng-template",null,2,V)(36,rs,1,1,"ng-template",null,3,V)(38,as,6,11,"ng-template",null,4,V)(40,ms,6,8,"ng-template",null,5,V)(42,ds,4,10,"ng-template",null,6,V)(44,_s,5,7,"ng-template",null,7,V)(46,gs,5,4,"ng-template",null,8,V)}if(i&2){let o=D(47);m("cxFocus",n.focusConfig),r(5),v(" ",c(6,12,"asm.customerList.title")," "),r(3),v(" ",c(9,14,"asm.customerList.description")," "),r(2),m("ngTemplateOutlet",o),r(),m("ngIf",c(12,16,n.customerListsPage$)),r(5),m("ngIf",n.listsEmpty),r(),m("ngIf",n.listsError),r(),m("ngIf",c(19,18,n.customerSearchError$)),r(2),m("ngIf",c(21,20,n.customerSearchLoading$)),r(2),m("ngIf",c(23,22,n.customerSearchPage$)),r(2),m("ngIf",c(25,24,n.customerListsPage$)),r(4),v(" ",c(29,26,"asm.createCustomerForm.cancel")," ")}},dependencies:[Ve,Y,Zt,de,_e,Ct,Le,yi,fi,vt,ge,Mi,ki,Ni,$e,ie,P],encapsulation:2})}}return t})(),Rs={launch:{ASM_CUSTOMER_LIST:{inlineRoot:!0,component:Ds,dialogType:Ce.DIALOG}}},Fs={launch:{ASM:{outlet:"cx-storefront",component:Ls}}},Ms={pagination:{rangeCount:2,addPrevious:!0,addNext:!0,addStart:!1,addEnd:!1,addFirst:!0,addLast:!0,addDots:!0,substituteDotsForSingularPage:!0,dotsLabel:"\xB7\xB7\xB7"}},ks={launch:{[B.ASM_BIND_CART]:{inlineRoot:!0,component:Cs,dialogType:Ce.DIALOG}}},Bs={launch:{[B.ASM_SAVE_CART]:{inlineRoot:!0,component:hs,dialogType:Ce.DIALOG}}},Os={launch:{[B.ASM_SWITCH_CUSTOMER]:{inlineRoot:!0,component:ws,dialogType:Ce.DIALOG}}},Oa=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=Se({type:t})}static{this.\u0275inj=xe({providers:[re(Fs),re(ks),re(Bs),re(Os),re(Rs),re(Ms),re(xs)],imports:[ye,Si,_i,wi,Ii,bi,xi,Ei,Ri,Ti,Bi,Oi,Vi,Li,pi]})}}return t})();export{Tt as a,Ys as b,Js as c,Zs as d,Xe as e,Me as f,Oa as g};