import{A as u,B as D,D as n,e as f,f as y,g as S,s as v,v as l,x as L}from"./chunk-QYQ7WNYU.js";import{La as g,O as h,Qa as x,Z as p,a as s,b as o}from"./chunk-HC2G7LSI.js";var F=t=>t&&t.firstName?t.firstName:void 0,d=t=>!!(t&&t.ssoId);var B=t=>!!t&&d(t)&&!!t.canImpersonate,k=t=>t.status===n.success,w=t=>!!t&&!!t.impersonatedBySsoid,A=t=>!!(t&&t.userType==="tkr");var a=y({source:"Identity",events:{getIdentity:S(),getIdentitySuccess:f(),getIdentityError:f()}});var U={status:n.initial,me:null,error:null},R=(t,e)=>t?.ssoId===e?.ssoId&&t?.msisdn===e?.ssoId,I=L({name:"identity",reducer:D(U,u(a.getIdentity,t=>o(s({},t),{status:n.loading})),u(a.getIdentitySuccess,(t,{identity:e})=>o(s({},t),{status:n.success,me:R(t.me,e)?t.me:e,error:null})),u(a.getIdentityError,(t,{error:e})=>o(s({},t),{status:n.error,me:null,error:e})))});var C=l(I.selectMe,d),b=t=>({selector:I.selectIdentityState,action:()=>a.getIdentity(),shouldDispatch(e){return(t||!e.me)&&e.status===n.initial||!1}}),c=t=>o(s({},b(t)),{filter:e=>e.status===n.success||e.status===n.error}),Y=t=>o(s({},c(t)),{map:e=>e.me}),Z=o(s({},c(!1)),{map:({me:t})=>w(t)}),M=o(s({},c(!1)),{map:({me:t})=>B(t)}),_=o(s({},c(!1)),{map:({me:t})=>t&&t.channel||"B2C"}),tt=o(s({},c(!1)),{map:({me:t})=>d(t)}),et=o(s({},c(!1)),{map:({me:t})=>F(t)}),rt=o(s({},c(!1)),{map:({me:t})=>A(t)});function dt(t){return o(s({},t),{selector:l(t.selector,C,(e,N)=>o(s({},e),{loggedIn:N})),shouldDispatch:e=>e.loggedIn&&t.shouldDispatch&&t.shouldDispatch(e)||!1})}var mt=(()=>{let e=class e{constructor(r){this.store=r}getWithSelector(r){if(!r)throw new Error("store.selectData was called without a selector");let i=this.store.select(r.selector);return r.action&&r.shouldDispatch&&(i=i.pipe(p(m=>r.shouldDispatch&&r.shouldDispatch(m)?(r.shouldDispatchAsync?setTimeout(()=>{this.store.dispatch(r.action(m))}):this.store.dispatch(r.action(m)),!1):!0))),r.filter&&(i=i.pipe(p(r.filter))),r.map?i.pipe(h(r.map)):i}};e.\u0275fac=function(i){return new(i||e)(x(v))},e.\u0275prov=g({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();export{a,d as b,B as c,k as d,U as e,I as f,C as g,c as h,Y as i,Z as j,M as k,tt as l,dt as m,mt as n};