import{e as ct}from"./chunk-CCS5SBW7.js";import{g as P,n as it,r as a}from"./chunk-XI2EB733.js";import{Cb as tt,h as l,j as _,r as K,s as Z,t as J}from"./chunk-73GUXIT2.js";import{m as z}from"./chunk-HRYIRC5N.js";import{a as ot}from"./chunk-CJD5DXIU.js";import{a as et}from"./chunk-6HEORLLJ.js";import{d as rt,e as A,f as nt}from"./chunk-ALYOQCV7.js";import{l as at}from"./chunk-KVR7YCW2.js";import{a as W}from"./chunk-IC7MXKVY.js";import{b as X,c as v,d as Y,i as y,j as $,m as Q,o as p}from"./chunk-JJTPXY4D.js";import{D as B,s as T}from"./chunk-ALDBR463.js";import{c as N}from"./chunk-2G3AB74T.js";import{a as q,b as d,k as f}from"./chunk-FRH63NMA.js";import{Ba as F,F as S,Ia as c,K as h,L as w,Na as s,Oa as m,Rd as H,Td as G,V as I,Z as U,ba as g,bb as L,bc as j,g as x,ya as V}from"./chunk-V6BPA3D7.js";var b=x(W());var st=(()=>{class t{constructor(){this.config={cookieName:"insurance_feature_enabled",defaultValue:!1,expirationDays:30},this._isEnabled=j(this.getFeatureState()),this.isEnabled=this._isEnabled.asReadonly(),this.isDisable=H(()=>!this.isEnabled()),G(()=>{let e=this._isEnabled();this.setCookie(this.config.cookieName,e.toString(),this.config.expirationDays)})}shouldBlockInsuranceRoute(e){return!this.isEnabled()&&this.isInsuranceRoute(e)}isInsuranceRoute(e){return e.startsWith(`/${a.Insurance}`)}getFeatureState(){return!0}getCookie(e){return b.default.get(e)||null}setCookie(e,o,r){let u=new Date;u.setTime(u.getTime()+r*24*60*60*1e3),b.default.set(e,o,{expires:u})}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var _t=[l.SetShipping,l.SetBilling,l.SetPayment];function C(t,i){return t.find(e=>e?.code===i)}function bt(t){return L(t,()=>{let i=m(p),e=!1;return i.getWithSelector(ct()).pipe(g(1)).subscribe(o=>{e=o}),e})}function Dt(t){let i=t.items.some(o=>o?.product?.__typename==="SubscriptionOfferingSubResource"&&o.product.acq==="ACQUISITION_PORT_IN"&&o.product.portInDetails?.needOtpValidation),e=t.items.some(o=>o?.items?.some(r=>r?.product&&r.product.__typename==="SubscriptionOfferingSubResource"&&r.product.acq==="ACQUISITION_PORT_IN"&&r.product.portInDetails?.needOtpValidation));return i||e}function Et(t){let i=t.items.some(o=>o?.product?.__typename==="SubscriptionOfferingSubResource"&&o?.product?.acq==="ACQUISITION_PORT_IN"&&o.product.portInDetails?.hasUploadedInvoiceOrSimDoc===!1),e=t.items.some(o=>o?.items?.some(r=>r?.product&&r.product.__typename==="SubscriptionOfferingSubResource"&&r.product.acq==="ACQUISITION_PORT_IN"&&r.product.portInDetails?.hasUploadedInvoiceOrSimDoc===!1));return i||e}function Bt(t){let i=[];return t?.__typename==="PendingCartResource"&&(t?.actions?.some(e=>e&&_t.includes(e))||i.push(n.canNotPerformAtLeastOneShippingAction),t?.items?.length||i.push(n.emptyCart),t?.items.some(e=>e?.notifications?.length)&&t?.items.some(e=>e?.notifications?.find(o=>o&&o.duration!==K.Temporary))&&i.push(n.cartItemNotification),t?.items.some(e=>e?.items?e?.items.some(o=>o?.notifications?.find(r=>r&&r.code===pt.portInNotEligible)):!1)&&i.push(n.cartItemNotification),t?.notifications?.some(e=>e.level===Z.Error&&!kt.includes(e?.code||"")&&e?.page!==J.Shipping)&&i.push(n.cartNotification)),i}function Xt(t,i,e){let o=[];return t?.__typename==="PendingCartResource"&&(!i?.hasPaymentCommitment&&t.actions.includes(l.HasPaymentCommitment)&&o.push(n.paymentCommitmentHasError),t.actions?.includes(l.CanPlaceOrder)||o.push(n.impersonatedUserCanPlaceOrder),t?.billing||o.push(n.billing),t?.payment||o.push(n.payment),!t?.shipping&&!t.actions.includes(l.IsFastOrder)&&!t.actions.includes(l.IsESimPrePayFlow)&&o.push(n.shipping),!t?.telewebInfo&&t.actions.includes(l.CanImpersonate)&&o.push(n.impersonation),C(t?.notifications,"MAX_VALUE_EXCEEDED")&&o.push(n.maxValueExceeded),C(t.notifications,"MISSING_CONTACT_PERSON_PHONE_NUMBER_FROM_SHIPPING")&&o.push(n.missingPhoneNumberFromDeliveryContactPerson),C(t?.notifications,"MISSING_UNIQUE_ID_PERSON")&&o.push(n.billingMissingUniqueId),C(t?.notifications,"CARD_PAYMENT_NOT_AVAILABLE_FOR_LOCKER")&&o.push(n.cardPaymentNotAvailableForLocker),t.newCustomerDetails?.isNCAFlow&&!t.newCustomerDetails.userDetails&&o.push(n.newCustomerDetailsIsNull),Dt(t)&&o.push(n.portInOtpNeedValidate),Et(t)&&o.push(n.portInNeedUploadDoc),e&&bt(e)&&o.push(n.ppy2ppdOtpNeedValidate)),o}function Yt(t){let i=[];return t?.__typename==="PendingCartResource"&&C(t?.notifications,_.ContactEmailNotValidated)&&i.push(n.contactEmailNotValidated),i}var kt=["INSTALLMENT_LIMIT_REACHED","MAX_VALUE_EXCEEDED",_.ContactEmailNotValidated,"PORT_IN_OFI_ARIADNEXT_CNP_NOT_MATCHING"],pt=function(t){return t.portInNotEligible="PORTIN_NOT_ELIGIBLE",t}(pt||{}),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||{}),mt=t=>!!t&&/^\/adaugat-la-cos(\?.*)?$/.test(t),lt=t=>!!t&&/^\/adaugat-la-cos\/numar-telefon.*/.test(t);var ut=t=>!!t&&/^\/adaugat-la-cos\/scanare.*/.test(t),dt=t=>!!t&&/^\/adaugat-la-cos\/transport-si-plata.*/.test(t);var $t=t=>!!t&&/^\/adaugat-la-cos\/plaseaza-comanda/.test(t),ft=t=>!!t&&/^\/adaugat-la-cos\/(comanda-scanare-validare|confirma-comanda|comanda-confirmata(\/[\d-]+)?(\/[\da-z-]+)?)(\?.*)?$/.test(t);var gt=(()=>{class t{constructor(e,o){this.storeSelector=e,this.router=o}resolve(e){return this.storeSelector.getWithSelector(y()).pipe(I(o=>!!o.me||!!o.error)).pipe(F(o=>{X(o.me)&&!v(o.me)&&o.me?.channel!==N.getChannel()&&this.router.navigate(["/canal-incorect"])})).pipe(g(1))}static{this.\u0275fac=function(o){return new(o||t)(s(p),s(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Nt=(()=>{class t{constructor(e){this.storeSelector=e}canActivate(e,{url:o}){return this.storeSelector.getWithSelector(y()).pipe(I(Y)).pipe(h(({me:r})=>{if(!v(r))throw Error("user has no impersonation rights");return!0})).pipe(g(1)).pipe(U(()=>(ot(),S(!1))))}static{this.\u0275fac=function(o){return new(o||t)(s(p))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var yt=(()=>{class t{constructor(e,o){this.router=e,this.storeSelector=o}canActivate(){return this.storeSelector.getWithSelector($()).pipe(h(e=>!e.ssoId||e.channel===N.getChannel()?(this.router.navigate(["/"]),!1):!0))}static{this.\u0275fac=function(o){return new(o||t)(s(f),s(p))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})();var Pt=Object.entries(rt).map(([t,i])=>({pathMatch:"full",path:`${i}-cat-${t}`,redirectTo:nt(parseInt(t,10),i).replace(/^\//,""),queryParamsHandling:"preserve"}));var St=x(W());var At=(()=>{class t{constructor(){this.store=m(T),this.storeSelector=m(p),this.identityApiService=m(et)}canActivate(e,{url:o}){let r=e.queryParams.fromStatic?e.queryParams.fromStatic:null;return w([this.store.select(tt),this.storeSelector.getWithSelector(y()).pipe(I(u=>u.status===B.success)),this.storeSelector.getWithSelector(Q),this.identityApiService.getAuthUrlToCurrentPage()]).pipe(V(([u,k,M,vt])=>!u.wasAskedToSignIn&&!k.me?.ssoId&&!M&&r==="true"?(St.default.set("redirect_cookie",o),window.open(`${vt}`,"_self"),S(!1)):(!u.wasAskedToSignIn&&k.me?.ssoId&&M&&this.store.dispatch(z()),S(!0))))}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ot=(t,i)=>Rt(i.url),Ct=(t,i)=>Rt(i.url);function Rt(t){let i=m(st),e=m(f);return i.shouldBlockInsuranceRoute(t)?e.createUrlTree(["/"]):!0}function D(t){if(t.length){let e=t[0].path.match(/^(.+)-pd-(\d+)\b/);if(e)return{consumed:[t[0]],posParams:{productSlug:new d(e[1],{}),productId:new d(e[2],{})}}}return null}function Tt(t){if(t.length){let i=t[0].path,e=A[i];if(e)return{consumed:[t[0]],posParams:{categorySlug:new d(i,{}),categoryId:new d(e.toString(),{})}}}return null}function Mt(t){if(t.length){let i=t[0].path,e=A[i],o=t[1]?.path;if(e)return{consumed:[...t],posParams:{categorySlug:new d(i,{}),categoryId:new d(e.toString(),{}),brandFilter:new d(o,{})}}}return null}var xt=[{path:a.Root,loadChildren:()=>import("./chunk-GU55GH2Q.js"),data:{revalidate:60}},{path:a.Impersonation,loadComponent:()=>import("./chunk-UV52BZUE.js"),canActivate:[Nt]},{path:a.Comparator,loadChildren:()=>import("./chunk-6ZTJYE5H.js")},{path:a.OrderHistory,loadChildren:()=>import("./chunk-NDFVG66Z.js")},{path:a.Reviews,loadChildren:()=>import("./chunk-5VIRELTI.js")},{path:a.Favorites,data:{name:"favorite"},loadComponent:()=>import("./chunk-R3ZXLV5S.js")},{path:"cos",redirectTo:a.Cart},{path:a.Cart,loadChildren:()=>import("./chunk-VZ3KOM6C.js"),data:{pageType:"cart"}},{matcher:D,canActivate:[At],loadChildren:()=>import("./chunk-SGPIFE4O.js")},{path:a.Subscription,loadChildren:()=>import("./chunk-BTV5QPR7.js")},...Pt,{matcher:Mt,loadChildren:()=>import("./chunk-CYZXRMA4.js")},{path:a.MobileScanConfirmed,loadComponent:()=>import("./chunk-QXFY6ACV.js")},{path:a.Insurance,canActivate:[Ot],canActivateChild:[Ct],loadChildren:()=>import("./chunk-LMRA4HOW.js")}],Ge=[{path:a.IncorrectChannel,canActivate:[yt],loadComponent:()=>import("./chunk-3CQ6ENPG.js").then(t=>t)},{path:a.Root,resolve:{identity:gt},children:xt},{path:"**",loadComponent:()=>import("./chunk-PD2JB3QQ.js").then(t=>t)}];var E=window;E.dataLayer=E.dataLayer||[];var R=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}(R||{}),Je=(()=>{class t{constructor(e,o){this.router=e,this.store=o}locate(){let o=this.router.parseUrl(this.router.url).root.children[q],r="home";return this.router.url!=="/"&&o&&(r=this.identifyPage(o.segments)),r}track(e,o="Menu Tabs"){e==="Show"&&this.locate()==="checkout"&&(o="Checkout Delivery",e="Select Number"),this.locate()==="product"&&(e="Product Detail Top"),E.dataLayer.push({event:"mikroUserClick",event_action:o,event_category:"User Profile",event_label:e,event_value:it.ZERO})}identifyPage(e){return Tt(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(at).pipe(h(({params:e,url:o})=>A[e.categorySlug]||o.startsWith("/abonamente")?P.LISTING:o.match(/^(.+)-pd-(\d+)\b/)?P.PRODUCT_DETAIL:o.startsWith("/comenzile-mele")?P.ORDERS_HISTORY:o==="/"?P.HOME:P.HOME))}identifyCartStep(){if(mt(this.router.url)||lt(this.router.url))return R.DETAILS;if(ft(this.router.url))return R.CONFIRMATION;if(ut(this.router.url))return R.SCAN;if(dt(this.router.url))return R.TRANSPORT_AND_PAYMENT}static{this.\u0275fac=function(o){return new(o||t)(s(f),s(T))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();export{st as a,Bt as b,Xt as c,Yt as d,n as e,mt as f,dt as g,$t as h,ft as i,Ge as j,R as k,Je as l};