import{c as ot}from"./chunk-SYND4CUK.js";import{a,i as y,p as Z}from"./chunk-5LCR2OJC.js";import{$ as Q,P as m,R as b,Z as Y,_ as B,dc as $,m as X}from"./chunk-E4K4ZCHX.js";import{a as K}from"./chunk-R57SMZTB.js";import{a as z}from"./chunk-4WKMN6X6.js";import{l as et}from"./chunk-36OPBAM5.js";import{d as J,e as S,f as tt}from"./chunk-QFGRHAA2.js";import{a as Pt}from"./chunk-CFEZXT2N.js";import{b as H,c as v,d as q,h as N,i as W,l as G,n as p}from"./chunk-4HPWFASO.js";import{D as j,s as R}from"./chunk-DILC4ULZ.js";import{b as T}from"./chunk-3SH7XDCZ.js";import{a as F,b as l,k as g}from"./chunk-EMIKX57Y.js";import{Ba as k,Ea as L,J as P,La as s,O as u,P as w,Qa as c,Ra as I,Z as f,ba as x,eb as V,fa as h,g as yt}from"./chunk-WNE7PXNE.js";var St=[m.SetShipping,m.SetBilling,m.SetPayment];function O(t,o){return t.find(r=>r?.code===o)}function Ot(t){return V(t,()=>{let o=I(p),r=!1;return o.getWithSelector(ot()).pipe(h(1)).subscribe(e=>{r=e}),r})}function At(t){let o=t.items.some(e=>e?.product?.__typename==="SubscriptionOfferingSubResource"&&e.product.acq==="ACQUISITION_PORT_IN"&&e.product.portInDetails?.needOtpValidation),r=t.items.some(e=>e?.items?.some(i=>i?.product&&i.product.__typename==="SubscriptionOfferingSubResource"&&i.product.acq==="ACQUISITION_PORT_IN"&&i.product.portInDetails?.needOtpValidation));return o||r}function Ct(t){let o=t.items.some(e=>e?.product?.__typename==="SubscriptionOfferingSubResource"&&e?.product?.acq==="ACQUISITION_PORT_IN"&&e.product.portInDetails?.hasUploadedInvoiceOrSimDoc===!1),r=t.items.some(e=>e?.items?.some(i=>i?.product&&i.product.__typename==="SubscriptionOfferingSubResource"&&i.product.acq==="ACQUISITION_PORT_IN"&&i.product.portInDetails?.hasUploadedInvoiceOrSimDoc===!1));return o||r}function Ut(t){let o=[];return t?.__typename==="PendingCartResource"&&(t?.actions?.some(r=>r&&St.includes(r))||o.push(n.canNotPerformAtLeastOneShippingAction),t?.items?.length||o.push(n.emptyCart),t?.items.some(r=>r?.notifications?.length)&&t?.items.some(r=>r?.notifications?.find(e=>e&&e.duration!==Y.Temporary))&&o.push(n.cartItemNotification),t?.items.some(r=>r?.items?r?.items.some(e=>e?.notifications?.find(i=>i&&i.code===it.portInNotEligible)):!1)&&o.push(n.cartItemNotification),t?.notifications?.some(r=>r.level===B.Error&&!Tt.includes(r?.code||"")&&r?.page!==Q.Shipping)&&o.push(n.cartNotification)),o}function wt(t,o,r){let e=[];return t?.__typename==="PendingCartResource"&&(!o?.hasPaymentCommitment&&t.actions.includes(m.HasPaymentCommitment)&&e.push(n.paymentCommitmentHasError),t.actions?.includes(m.CanPlaceOrder)||e.push(n.impersonatedUserCanPlaceOrder),t?.billing||e.push(n.billing),t?.payment||e.push(n.payment),!t?.shipping&&!t.actions.includes(m.IsFastOrder)&&!t.actions.includes(m.IsESimPrePayFlow)&&e.push(n.shipping),!t?.telewebInfo&&t.actions.includes(m.CanImpersonate)&&e.push(n.impersonation),O(t?.notifications,"MAX_VALUE_EXCEEDED")&&e.push(n.maxValueExceeded),O(t.notifications,"MISSING_CONTACT_PERSON_PHONE_NUMBER_FROM_SHIPPING")&&e.push(n.missingPhoneNumberFromDeliveryContactPerson),O(t?.notifications,"MISSING_UNIQUE_ID_PERSON")&&e.push(n.billingMissingUniqueId),O(t?.notifications,"CARD_PAYMENT_NOT_AVAILABLE_FOR_LOCKER")&&e.push(n.cardPaymentNotAvailableForLocker),t.newCustomerDetails?.isNCAFlow&&!t.newCustomerDetails.userDetails&&e.push(n.newCustomerDetailsIsNull),At(t)&&e.push(n.portInOtpNeedValidate),Ct(t)&&e.push(n.portInNeedUploadDoc),r&&Ot(r)&&e.push(n.ppy2ppdOtpNeedValidate)),e}function xt(t){let o=[];return t?.__typename==="PendingCartResource"&&O(t?.notifications,b.ContactEmailNotValidated)&&o.push(n.contactEmailNotValidated),o}var Tt=["INSTALLMENT_LIMIT_REACHED","MAX_VALUE_EXCEEDED",b.ContactEmailNotValidated,"PORT_IN_OFI_ARIADNEXT_CNP_NOT_MATCHING"],it=function(t){return t.portInNotEligible="PORTIN_NOT_ELIGIBLE",t}(it||{}),n=function(t){return t.billing="billing",t.billingStreet="billingStreet",t.billingMissingUniqueId="billingMissingUniqueId",t.canNotPerformAtLeastOneShippingAction="canNotPerformAtLeastOneShippingAction",t.cartItemNotification="cartItemNotification",t.cartNotification="cartNotification",t.dontAcceptValidation="dontAcceptValidation",t.dontHaveOCRConsent="dontHaveOCRConsent",t.emptyCart="emptyCart",t.impersonatedUserCanPlaceOrder="impersonatedUserCanPlaceOrder",t.impersonation="impersonation",t.maxValueExceeded="maxValueExceeded",t.contactEmailNotValidated="CONTACT_EMAIL_NOT_VALIDATED",t.missingPhoneNumberFromDeliveryContactPerson="missingPhoneNumberFromDeliveryContactPerson",t.newCustomerDetailsIsNull="newCustomerDetailsIsNull",t.portInOtpNeedValidate="portInOtpNeedValidate",t.portInNeedUploadDoc="portInNeedUploadDoc",t.orderDetailsNotCompleted="orderDetailsNotCompleted",t.payment="payment",t.paymentCommitmentHasError="paymentCommitmentHasError",t.shipping="shipping",t.shippingStreet="shippingStreet",t.technicalErrors="technicalErrors",t.transportAndPaymentNotCompleted="transportAndPaymentNotCompleted",t.emailConfirmationNotCompleted="emailConfirmationNotCompleted",t.ppy2ppdOtpNeedValidate="ppy2ppdOtpNeedValidate",t.cardPaymentNotAvailableForLocker="cardPaymentNotAvailableForLocker",t}(n||{}),rt=t=>!!t&&/^\/adaugat-la-cos(\?.*)?$/.test(t),nt=t=>!!t&&/^\/adaugat-la-cos\/numar-telefon.*/.test(t);var at=t=>!!t&&/^\/adaugat-la-cos\/scanare.*/.test(t),ct=t=>!!t&&/^\/adaugat-la-cos\/transport-si-plata.*/.test(t);var kt=t=>!!t&&/^\/adaugat-la-cos\/plaseaza-comanda/.test(t),st=t=>!!t&&/^\/adaugat-la-cos\/(comanda-scanare-validare|confirma-comanda|comanda-confirmata(\/[\d-]+)?(\/[\da-z-]+)?)(\?.*)?$/.test(t);var lt=(()=>{let o=class o{constructor(e,i){this.storeSelector=e,this.router=i}resolve(e){return this.storeSelector.getWithSelector(N()).pipe(f(i=>!!i.me||!!i.error)).pipe(L(i=>{H(i.me)&&!v(i.me)&&i.me?.channel!==T.getChannel()&&this.router.navigate(["/canal-incorect"])})).pipe(h(1))}};o.\u0275fac=function(i){return new(i||o)(c(p),c(g))},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();var dt=(()=>{let o=class o{constructor(e){this.storeSelector=e}canActivate(e,{url:i}){return this.storeSelector.getWithSelector(N()).pipe(f(q)).pipe(u(({me:d})=>{if(!v(d))throw Error("user has no impersonation rights");return!0})).pipe(h(1)).pipe(x(()=>(K(),P(!1))))}};o.\u0275fac=function(i){return new(i||o)(c(p))},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();var ut=(()=>{let o=class o{constructor(e,i){this.router=e,this.storeSelector=i}canActivate(){return this.storeSelector.getWithSelector(W()).pipe(u(e=>!e.ssoId||e.channel===T.getChannel()?(this.router.navigate(["/"]),!1):!0))}};o.\u0275fac=function(i){return new(i||o)(c(g),c(p))},o.\u0275prov=s({token:o,factory:o.\u0275fac});let t=o;return t})();var ft=Object.entries(J).map(([t,o])=>({pathMatch:"full",path:`${o}-cat-${t}`,redirectTo:tt(parseInt(t,10),o).replace(/^\//,""),queryParamsHandling:"preserve"}));var ht=yt(Pt());var It=(()=>{let o=class o{constructor(){this.store=I(R),this.storeSelector=I(p),this.identityApiService=I(z)}canActivate(e,{url:i}){let d=e.queryParams.fromStatic?e.queryParams.fromStatic:null;return w([this.store.select($),this.storeSelector.getWithSelector(N()).pipe(f(C=>C.status===j.success)),this.storeSelector.getWithSelector(G),this.identityApiService.getAuthUrlToCurrentPage()]).pipe(k(([C,M,U,Nt])=>!C.wasAskedToSignIn&&!M.me?.ssoId&&!U&&d==="true"?(ht.default.set("redirect_cookie",i),window.open(`${Nt}`,"_self"),P(!1)):(!C.wasAskedToSignIn&&M.me?.ssoId&&U&&this.store.dispatch(X()),P(!0))))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();function D(t){if(t.length){let r=t[0].path.match(/^(.+)-pd-(\d+)\b/);if(r)return{consumed:[t[0]],posParams:{productSlug:new l(r[1],{}),productId:new l(r[2],{})}}}return null}function gt(t){if(t.length){let o=t[0].path,r=S[o];if(r)return{consumed:[t[0]],posParams:{categorySlug:new l(o,{}),categoryId:new l(r.toString(),{})}}}return null}function Rt(t){if(t.length){let o=t[0].path,r=S[o],e=t[1]?.path;if(r)return{consumed:[...t],posParams:{categorySlug:new l(o,{}),categoryId:new l(r.toString(),{}),brandFilter:new l(e,{})}}}return null}var vt=[{path:a.Root,loadChildren:()=>import("./chunk-ADRO4ESY.js"),data:{revalidate:60}},{path:a.Impersonation,loadComponent:()=>import("./chunk-ZDTPT3EZ.js"),canActivate:[dt]},{path:a.Comparator,loadChildren:()=>import("./chunk-THS3LKLL.js")},{path:a.OrderHistory,loadChildren:()=>import("./chunk-NER6RIFU.js")},{path:a.Reviews,loadChildren:()=>import("./chunk-G5PPBELH.js")},{path:a.Favorites,data:{name:"favorite"},loadComponent:()=>import("./chunk-VJGPVIIC.js")},{path:"cos",redirectTo:a.Cart},{path:a.Cart,loadChildren:()=>import("./chunk-I7PFQH23.js"),data:{pageType:"cart"}},{matcher:D,canActivate:[It],loadChildren:()=>import("./chunk-5LUE4Y2D.js")},{path:a.Subscription,loadChildren:()=>import("./chunk-R2BLWHN5.js")},...ft,{matcher:Rt,loadChildren:()=>import("./chunk-6P2BPPHB.js")},{path:a.MobileScanConfirmed,loadComponent:()=>import("./chunk-TJRRF3HN.js")}],Te=[{path:a.IncorrectChannel,canActivate:[ut],loadComponent:()=>import("./chunk-VYMMSRRL.js").then(t=>t)},{path:a.Root,resolve:{identity:lt},children:vt},{path:"**",loadComponent:()=>import("./chunk-6XSIPHZJ.js").then(t=>t)}];var E=window;E.dataLayer=E.dataLayer||[];var A=function(t){return t[t.DETAILS=0]="DETAILS",t[t.SCAN=1]="SCAN",t[t.TRANSPORT_AND_PAYMENT=2]="TRANSPORT_AND_PAYMENT",t[t.CONFIRMATION=3]="CONFIRMATION",t}(A||{}),ke=(()=>{let o=class o{constructor(e,i){this.router=e,this.store=i}locate(){let i=this.router.parseUrl(this.router.url).root.children[F],d="home";return this.router.url!=="/"&&i&&(d=this.identifyPage(i.segments)),d}track(e,i="Menu Tabs"){e==="Show"&&this.locate()==="checkout"&&(i="Checkout Delivery",e="Select Number"),this.locate()==="product"&&(e="Product Detail Top"),E.dataLayer.push({event:"mikroUserClick",event_action:i,event_category:"User Profile",event_label:e,event_value:Z.ZERO})}identifyPage(e){return gt(e)||e[0]&&e[0].path==="abonamente"?"listing":D(e)?"product":e[1]&&e[1].path==="transport-si-plata"?"checkout":this.router.url.substring(1)}identifyEventCategory(){return this.store.select(et).pipe(u(({params:e,url:i})=>S[e.categorySlug]||i.startsWith("/abonamente")?y.LISTING:i.match(/^(.+)-pd-(\d+)\b/)?y.PRODUCT_DETAIL:i.startsWith("/comenzile-mele")?y.ORDERS_HISTORY:i==="/"?y.HOME:y.HOME))}identifyCartStep(){if(rt(this.router.url)||nt(this.router.url))return A.DETAILS;if(st(this.router.url))return A.CONFIRMATION;if(at(this.router.url))return A.SCAN;if(ct(this.router.url))return A.TRANSPORT_AND_PAYMENT}};o.\u0275fac=function(i){return new(i||o)(c(g),c(R))},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();export{Ut as a,wt as b,xt as c,n as d,rt as e,ct as f,kt as g,st as h,Te as i,A as j,ke as k};