import{a as rr}from"./chunk-RSTAQ2TC.js";import{a as lr}from"./chunk-7E6JK24L.js";import{g as xt,j as wt,m as Ft,p as Dt,s as ir,v as pr,y as dr}from"./chunk-ANFSVGOT.js";import{$ as Wt,A as $t,B as Tt,C as Ot,F as bt,Ga as ar,I as Mt,L as Rt,N as Nt,Na as cr,O as Ut,P as re,Q as Qt,R as k,T as O,U as Ht,V as E,W as zt,X as ie,Y as oe,Z as Kt,_ as se,a as _e,aa as ae,b as et,ba as ne,c as tt,ca as Xt,d as rt,da as ce,e as it,f as ot,g as st,h as at,i as nt,j as ct,k as pt,l as dt,m as lt,n as ut,o as mt,p as ft,q as ht,r as St,s as yt,sa as or,t as gt,u as Ct,v as Pt,w as Lt,x as At,y as vt,z as It}from"./chunk-V4H5I74E.js";import{b as q,c as sr}from"./chunk-XPGU7UGG.js";import{m as Et}from"./chunk-OMIG3YP7.js";import{A as nr,h as ue}from"./chunk-JRMHPUBR.js";import{p as Ze}from"./chunk-PMCW5TFV.js";import{f as Je}from"./chunk-46MHTHNE.js";import{U as jt,_ as Vt,ba as Gt,i as Bt,q as kt,y as qt}from"./chunk-RZLGZNKN.js";import{d as pe,i as Yt,k as Jt,n as Zt,p as _t,q as er,r as de,s as le,t as tr,u as I,w as x}from"./chunk-5TZLGKCI.js";import{B as Oe,Ba as De,C as Ee,D as A,Da as be,E as T,Ga as Me,I as xe,Qb as Ke,Sa as Re,Ta as Ne,Yb as We,a as b,b as Ce,c as Pe,cb as te,d as M,e as z,f as Le,fb as Ue,g as Ae,gb as Be,h as K,hb as ke,i as ve,ib as qe,j as W,ja as v,k as X,l as Ie,la as we,n as l,o as R,ob as je,p as N,pb as Ve,q as U,qb as Ge,s as Y,t as J,tb as Qe,u as $e,v as Z,wa as Fe,x as _,y as Te,yb as He,z as ee}from"./chunk-U45OJP77.js";import{b as a,c as B,d as n}from"./chunk-VN6PXZL4.js";import{b as Xe,s as Ye}from"./chunk-HMS3LRP2.js";import{n as ze}from"./chunk-MGYJOL7Z.js";import{A as s,B as ge,D as d,E as L,s as D}from"./chunk-QYQ7WNYU.js";import{k as ye}from"./chunk-GW55Q7ZA.js";import{Ba as p,Ea as C,Ga as Se,J as S,La as F,O as u,Qa as f,V as fe,Z as he,a as i,b as o,ba as m,ha as H}from"./chunk-HC2G7LSI.js";var fr={searchedFixedLocations:L(),fixedLocation:L(),counties:L(),localities:L(),favoriteOrLastUsedLocation:L(),filterInput:"",countyInput:null,localityInput:null,locationMarker:null,selectedLocation:null,showSkeletons:!1},Nr=ge(fr,s(_e,(e,{fixedLocationSearchRequestInput:t})=>o(i({},e),{searchedFixedLocations:o(i({},e.searchedFixedLocations),{status:d.loading,request:t})})),s(et,(e,{searchedFixedLocations:t})=>o(i({},e),{searchedFixedLocations:o(i({},e.searchedFixedLocations),{status:d.success,data:t}),filterInput:""})),s(tt,(e,{error:t})=>o(i({},e),{searchedFixedLocations:o(i({},e.searchedFixedLocations),{status:d.error,error:t})})),s(rt,(e,{id:t})=>o(i({},e),{fixedLocation:o(i({},e.fixedLocation),{status:d.loading,request:t})})),s(it,(e,{fixedLocation:t})=>o(i({},e),{fixedLocation:o(i({},e.fixedLocation),{status:d.success,data:t})})),s(ot,(e,{error:t})=>o(i({},e),{fixedLocation:o(i({},e.fixedLocation),{status:d.error,error:t})})),s(st,e=>o(i({},e),{searchedFixedLocations:o(i({},e.searchedFixedLocations),{status:d.initial,request:void 0,data:void 0})})),s(at,(e,{filter:t})=>o(i({},e),{filterInput:t})),s(nt,e=>o(i({},e),{filterInput:""})),s(ct,(e,{countryCode:t})=>o(i({},e),{counties:o(i({},e.counties),{status:d.loading,request:t})})),s(pt,(e,{counties:t})=>o(i({},e),{counties:o(i({},e.counties),{status:d.success,data:t})})),s(dt,(e,{error:t})=>o(i({},e),{counties:o(i({},e.counties),{status:d.error,error:t})})),s(lt,(e,{countyId:t})=>o(i({},e),{localities:o(i({},e.localities),{status:d.loading,request:t})})),s(ut,(e,{localities:t})=>o(i({},e),{localities:o(i({},e.localities),{status:d.success,data:t})})),s(mt,(e,{error:t})=>o(i({},e),{localities:o(i({},e.localities),{status:d.error,error:t})})),s(ft,e=>o(i({},e),{localities:o(i({},e.localities),{status:d.initial,data:void 0,request:void 0})})),s(ht,(e,{locationMarker:t})=>o(i({},e),{locationMarker:t})),s(St,yt,(e,{location:t})=>o(i({},e),{selectedLocation:t})),s(gt,(e,{showSkeletons:t})=>o(i({},e),{showSkeletons:t})),s(Ct,(e,{fixedLocation:t})=>o(i({},e),{favoriteOrLastUsedLocation:o(i({},e.favoriteOrLastUsedLocation),{status:d.loading,request:t})})),s(vt,(e,{fixedLocation:t})=>o(i({},e),{favoriteOrLastUsedLocation:o(i({},e.favoriteOrLastUsedLocation),{status:d.success,data:t})})),s(Pt,(e,{fixedLocation:t})=>o(i({},e),{favoriteOrLastUsedLocation:o(i({},e.favoriteOrLastUsedLocation),{status:d.success,data:o(i(i({},e.favoriteOrLastUsedLocation.data),t),{isFavorite:!0})})})),s(Lt,It,(e,{error:t})=>o(i({},e),{favoriteOrLastUsedLocation:o(i({},e.favoriteOrLastUsedLocation),{status:d.error,error:t})})),s(At,e=>o(i({},e),{favoriteOrLastUsedLocation:o(i({},e.favoriteOrLastUsedLocation),{status:d.loading,request:null})})),s($t,(e,{countyInput:t})=>o(i({},e),{countyInput:t})),s(Tt,(e,{localityInput:t})=>o(i({},e),{localityInput:t})),s(Ot,e=>o(i({},e),{countyInput:null,localityInput:null})),s(Ke,e=>i({},e)));var Cr=()=>e=>e.data&&e.data.clearCart&&!e.errors?[Le()]:e.errors?[z({errors:e.errors})]:[z({errors:[new Error("handleClearCartResponse communication error")]}),l({failedAction:M.type})],Pr=e=>e.data&&!e.errors?W():e.errors?ve({errors:e.errors}):l({failedAction:K.type}),Lr=e=>{if(e?.errors?.length)return S(Ce({errors:e.errors}));if(e?.data?.cartV2){let t=[Pe({cart:e.data.cartV2}),Jt({quantity:xe(e?.data?.cartV2)})];return S(...t)}return S(l({failedAction:b.type}))},Ar=e=>e.data&&e.data.setTelewebInfo&&!e.errors?ee():e.errors?Te({errors:e.errors}):l({failedAction:_.type}),vr=e=>t=>t.data&&t.data.setOtyConsumption&&!t.errors?U({oty:e}):t.errors?N({errors:t.errors}):l({failedAction:R.type}),Ir=e=>e.data&&e.data.setPayment&&!e.errors?Z():e.errors?$e({errors:e.errors}):l({failedAction:J.type}),h=e=>t=>S(l({failedAction:e.type,error:t})),$r=()=>e=>e.data&&e.data.generateNewAddressOTP&&!e.errors?ae({data:e.data}):e.data&&e.errors?Wt({errors:e.errors}):l({failedAction:se.type}),Tr=()=>e=>e.data&&e.data.verifyNewAddressOTP&&!e.errors?ce({data:e.data}):e.data&&e.errors?Xt({errors:e.errors}):l({failedAction:ne.type}),Or=e=>t=>t.data&&t.data.updatePpy2PpdMsisdn&&!t.errors?I.updatePpy2PpdMsisdnSuccess({msisdn:e}):t.data&&t.errors?I.updatePpy2PpdMsisdnError({errors:t.errors}):l({failedAction:I.updatePpy2PpdMsisdn.type}),Er=e=>t=>t.data&&t.data.updatePpy2PpdMsisdn&&!t.errors?x.updatePpyPrepayMsisdnSuccess({msisdn:e}):t.data&&t.errors?x.updatePpyPrepayMsisdnError({errors:t.errors}):l({failedAction:x.updatePpyPrepayMsisdn.type}),pi=(()=>{let t=class t{constructor($,y,j,V,G){this.actions$=$,this.cartApolloClient=y,this.router=j,this.store=V,this.snackBar=G,this.dismissNotification$=a(()=>this.actions$.pipe(n(K)).pipe(p(r=>this.cartApolloClient.mutate({mutation:De,variables:{notifications:[{notificationId:r.notification.id,cartItemId:r.notification.itemRef&&r.notification.itemRef.itemId}]}}).pipe(u(Pr))))),this.eShopCartChange$=a(()=>fe(window,"message").pipe(he(r=>r.data==="eShopCartChange")).pipe(H(X()))),this.getCart$=a(()=>this.actions$.pipe(n(b),p(r=>this.cartApolloClient.query({query:be}).pipe(p(Lr)).pipe(m(h(r)))))),this.logCommunicationError$=a(()=>this.actions$.pipe(n(l),C(console.error)),{dispatch:!1}),this.reloadCart$=a(()=>this.actions$.pipe(n(pe,Ze,bt,pr,dr,Rt,ir,Mt,W,X,Yt,k,E,Zt,U,Z,Ut,ee,Ye,er,kt,jt,Bt,xt,wt,Ft,Dt,ae,ce,A.updateInstallmentPeriodSuccess,A.updateInstallmentPeriodError,de.updateSimOptionSuccess,de.updateSimOptionError,le.updatePrepayProductTypeSuccess,le.updatePrepayProductTypeError,tr.updateSubscriptionTypeSuccess,I.updatePpy2PpdMsisdnSuccess,Vt,Gt,qt),p(r=>r.type===pe.type&&r.triggerGetCart===!1?[T.getItemIds()]:[b(),Et()]))),this.reloadCartFromLocalStore$=a(()=>this.actions$.pipe(n(N,Nt,_t),u(()=>Ie()))),this.reloadCartOnProfileChange$=a(()=>this.actions$.pipe(n(Xe)).pipe(H(Ae()))),this.resetCart$=a(()=>this.actions$.pipe(n(M)).pipe(p(()=>this.cartApolloClient.mutate({mutation:Fe}))).pipe(p(Cr())).pipe(m(()=>S(l({failedAction:M.type}))))),this.setCartImpersonation$=a(()=>this.actions$.pipe(n(_),p(r=>this.cartApolloClient.mutate({mutation:Ge,variables:{teleweb:{callType:r.callType,userType:r.userType}}}).pipe(u(Ar)).pipe(m(h(r)))))),this.updateInstallmentPeriod$=a(()=>this.actions$.pipe(n(A.updateInstallmentPeriod),p(r=>this.cartApolloClient.mutate({mutation:Qe,variables:{term:r.period}}).pipe(u(c=>c.data?A.updateInstallmentPeriodSuccess():A.updateInstallmentPeriodError()),m(h(r)))))),this.setOtyConsumption$=a(()=>this.actions$.pipe(n(R),p(r=>this.cartApolloClient.mutate({mutation:ke,variables:{value:r.oty,unit:we.Fix}}).pipe(u(vr(r.oty))).pipe(m(h(r)))))),this.setOtyConsumptionError$=a(()=>this.actions$.pipe(n(N),u(r=>r.errors.find(c=>c.message.toLowerCase().trim()==="Value provided for oty consumption thresholds:1 exceeds maximum allowed oty points: 0".toLowerCase().trim())?R({oty:0}):rr()))),this.setOtyConsumptionSuccess$=a(()=>this.actions$.pipe(n(U),C(r=>{r?.oty>=1&&this.store.dispatch(Y())})),{dispatch:!1}),this.openShowUseOtyMessageNotification$=a(()=>this.actions$.pipe(n(Y),C(()=>{this.snackBar.open("Valoarea punctelor a fost sc\u0103zut\u0103 din totalul de plat\u0103.","x",{horizontalPosition:"center",verticalPosition:"top",duration:5e3})})),{dispatch:!1}),this.setPayment$=a(()=>this.actions$.pipe(n(J),p(r=>this.cartApolloClient.mutate({mutation:qe,variables:{method:r.method,parameters:r.parameters||[]}}).pipe(u(Ir)).pipe(m(h(r)))))),this.setTab$=a(()=>this.actions$.pipe(n(Oe,Ee),p(r=>S(O({shippingTypeSelection:r.shippingTypeSelection}))))),this.generateNewAddressOTP$=a(()=>this.actions$.pipe(n(se),p(r=>this.cartApolloClient.mutate({mutation:Re}).pipe(u($r())).pipe(m(h(r)))))),this.verifyNewAddressOTP$=a(()=>this.actions$.pipe(n(ne),p(r=>{let c={code:r.code};return r.forced&&(c.forced=r.forced),this.cartApolloClient.mutate({mutation:Ne,variables:c}).pipe(u(Tr())).pipe(m(h(r)))}))),this.updatePpy2PpdNotLoggedMsisdn$=a(()=>this.actions$.pipe(n(I.updatePpy2PpdMsisdn),p(r=>this.cartApolloClient.mutate({mutation:te,variables:{msisdn:r.msisdn}}).pipe(u(Or(r.msisdn))).pipe(m(h(r)))))),this.updatePpyPrepayMsisdn$=a(()=>this.actions$.pipe(n(x.updatePpyPrepayMsisdn),p(r=>this.cartApolloClient.mutate({mutation:te,variables:{msisdn:r.msisdn}}).pipe(u(Er(r.msisdn))).pipe(m(h(r)))))),this.getUnofferedCartItemIds$=a(()=>this.actions$.pipe(n(T.getItemIds,ue),p(r=>r.type===ue.type&&r.recommendationsRequest.type!==nr.BoughtTogether?S():this.cartApolloClient.query({query:Me}).pipe(u(c=>c.data&&c.data.unofferedCart&&c.data.unofferedCart.__typename!=="EmptyCartResource"?T.getItemIdsSuccess({ids:c.data.unofferedCart.items.filter(P=>!!P?.product?.id).map(P=>P?.product?.id)}):T.getItemIdsError())))))}};t.\u0275fac=function(y){return new(y||t)(f(B),f(q),f(ye),f(D),f(Je))},t.\u0275prov=F({token:t,factory:t.\u0275fac});let e=t;return e})();var xr=e=>e.data&&!e.errors?k():e.errors?Qt({errors:e.errors}):l({failedAction:re.type}),wr=e=>e.data&&!e.errors?E():e.errors?Ht({errors:e.errors}):l({failedAction:O.type}),Fr=e=>e.data&&!e.errors?oe():e.errors?Kt({errors:e.errors}):l({failedAction:ie.type}),Mi=(()=>{let t=class t{constructor($,y,j,V,G,r){this.actions$=$,this.cartApolloClient=y,this.store=j,this.storeSelector=V,this.cartDeliveryAddressService=G,this.portInDeliveryAddressService=r,this.setBilling$=a(()=>this.actions$.pipe(n(re),p(c=>this.cartApolloClient.mutate({mutation:c.billing!==null?Be:Ue,variables:{billing:c.billing}}).pipe(u(xr)).pipe(m(h(c)))))),this.setShipping$=a(()=>this.actions$.pipe(n(O),Se(this.store.select(or),this.storeSelector.getWithSelector(We(He.DELIVERY)),this.cartDeliveryAddressService.fixedLocationContactPerson$,this.store.select(ar)),p(([c,P,g,me,ur])=>{let Q=null,w=null;if(g&&(g.address&&(Q=sr.toAddressResource(g)),g.party&&(w={name:g.party?.name,phone:g.party?.phone,email:g.party?.email})),Q===null&&c.shippingTypeSelection===v.Customer||P===null&&c.shippingTypeSelection===v.FixedLocation)return S(zt());c.shippingTypeSelection===v.FixedLocation&&(w=Object.keys(me).length?me:null);let mr={address:Q,contactPerson:w,shippingType:{fixedLocation:P,selection:c.shippingTypeSelection},isKeepBillingDataToggled:ur};return c.shippingTypeSelection===v.FixedLocation&&!w&&this.cartDeliveryAddressService.setEditMode(!1),c.shippingTypeSelection===v.Customer&&this.cartDeliveryAddressService.setEditMode(!1),this.cartApolloClient.mutate({mutation:Ve,variables:{shipping:mr}}).pipe(u(wr),m(h(c)))}))),this.deleteShipping$=a(()=>this.actions$.pipe(n(ie),p(c=>this.cartApolloClient.mutate({mutation:je}).pipe(u(Fr),m(h(c)))))),this.setBillingOnSetShippingSuccess$=a(()=>this.actions$.pipe(n(E),C(()=>{this.cartDeliveryAddressService.setDeliveryAddressSuccess$.next("emit")})),{dispatch:!1}),this.deleteShippingSuccess$=a(()=>this.actions$.pipe(n(oe),C(()=>{this.portInDeliveryAddressService.setShowAddressToggle(!0)})),{dispatch:!1})}};t.\u0275fac=function(y){return new(y||t)(f(B),f(q),f(D),f(ze),f(cr),f(lr))},t.\u0275prov=F({token:t,factory:t.\u0275fac});let e=t;return e})();export{Nr as a,h as b,pi as c,wr as d,Mi as e};