import{a as ut,b as mt,c as ht,d as _t,g as ft,k as gt,l as Ct,m as xt,n as St,q as vt}from"./chunk-VIRBXNP6.js";import{a as Oe}from"./chunk-HQAMRA3A.js";import{a as Nt}from"./chunk-KYDP4WXO.js";import{d as ot}from"./chunk-THQR457X.js";import{a as yt}from"./chunk-NE3LWCDA.js";import{b as Vt}from"./chunk-2UNZCRGI.js";import{b as Dt}from"./chunk-KS7OJN3O.js";import{c as rt,d as nt,e as st}from"./chunk-PHTMXYHJ.js";import{c as at,e as dt,g as lt,n as ct}from"./chunk-XI2EB733.js";import{Cb as Ae,E as ze,Eb as T,I as qe,Pb as je,Rb as Ye,Vb as Ze,Xa as oe,Ya as He,h as W,ib as ve,jb as ye,tb as Xe,u as Se,ub as Ke}from"./chunk-Y3XMNJA5.js";import{E as Pt,F as Et,c as Ot,e as C,h as Lt,i as bt,j as It,l as k,n as Tt,r as Ft,t as wt}from"./chunk-XWZ7QAQL.js";import{a as Qe}from"./chunk-VAUNVSZV.js";import{a as Je}from"./chunk-6NIC2JUZ.js";import{V as it}from"./chunk-C2EV7IAO.js";import{c as pt,d as j}from"./chunk-GXS7C5SQ.js";import{g as ge,i as Ce,k as We,m as xe,o as re}from"./chunk-JJTPXY4D.js";import{h as K,k as ne,n as et,q as tt}from"./chunk-767ZUJWF.js";import{D as O,d,e as c,s as Ue,v as m,w as Ge}from"./chunk-ALDBR463.js";import{c as $e}from"./chunk-2G3AB74T.js";import{h as ie}from"./chunk-VWCGOHBE.js";import{v as Re}from"./chunk-E2GGCCQI.js";import{a as At}from"./chunk-FRKPVHGJ.js";import{Ac as Q,Ba as me,Bc as ee,Cc as g,Dc as h,Ec as ke,F as M,Ia as Z,Ic as te,K as S,L as z,Na as V,Ob as De,Oc as N,Qb as y,Qc as L,Rb as D,T as we,U as ue,V as F,Va as Ee,Z as Pe,a as u,ad as _,b as f,ba as R,bc as he,cc as Ne,cd as _e,da as q,dd as fe,eb as U,fb as G,ha as E,jd as Be,kc as A,nd as Me,o as pe,ob as Ve,p as b,q as Fe,qc as X,rd as w,sd as P,ua as $,xc as I,ya as H,za as Y,zc as J}from"./chunk-V6BPA3D7.js";var Oi=d("[Locations] Search Fixed Locations",c()),Li=d("[Locations] Search Fixed Locations [Success]",c()),bi=d("[Locations] Search Fixed Locations [Error]",c()),Ii=d("[Locations] Get Fixed Location",c()),Ti=d("[Locations] Get Fixed Location [Success]",c()),Fi=d("[Locations] Get Fixed Location [Error]",c()),wi=d("[Location] Remove Search Fixed Locations"),Pi=d("[Location] Update Filter Input",c()),Ei=d("[Location] Clear Filter Input"),kt=d("[Locations] Get Counties",c()),Vi=d("[Locations] Get Counties Success",c()),Di=d("[Locations] Get Counties Error",c()),Ni=d("[Locations] Get Localities",c()),ki=d("[Locations] Get Localities Success",c()),Bi=d("[Locations] Get Localities Error",c()),Mi=d("[Locations] Remove localities"),Ri=d("[Locations] Set Location Marker",c()),$i=d("[Locations] Set Location from map",c()),Ui=d("[Locations] Set Location from cart",c()),Gi=d("[Location] Set Location skeletons",c()),Wi=d("[Location] Set favorite Location",c()),zi=d("[Location] Set favorite Location Success",c()),qi=d("[Location] Set favorite Location Error",c()),Le=d("[Location] Get favorite or last used Location"),Hi=d("[Location] Get favorite or last used Location Success",c()),Xi=d("[Location] Get favorite or last used Location Error",c()),Ki=d("[Location] Set County input",c()),ji=d("[Location] Set Locality input",c()),Yi=d("[Location] Clear Address inputs");function Bt(t){let r=u({},t);return delete r.__typename,delete r.allowsDropOff,delete r.supportedPaymentType,delete r.schedule,delete r.restrictions,delete r.isFavorite,et(r)?null:r}var x=Ge("locations"),so=m(x,t=>t.searchedFixedLocations?.data),ao=m(x,t=>t.searchedFixedLocations.status),lo=m(x,t=>t.searchedFixedLocations?.request),co=m(x,t=>t.fixedLocation?.data),po=m(x,t=>t.filterInput),uo=t=>({selector:x,action:()=>kt({countryCode:t}),map:r=>r.counties?.data,shouldDispatch:r=>r.counties.status===O.initial}),mo=m(x,t=>t.localities?.data),ho=m(x,t=>t.locationMarker),_o=m(x,t=>t?.selectedLocation),fo=m(x,t=>t.showSkeletons),go=()=>({selector:m(x,ge,(t,r)=>[t,r]),action:()=>Le(),map:([t])=>t.favoriteOrLastUsedLocation,shouldDispatch:([t,r])=>r&&t.favoriteOrLastUsedLocation.status===O.initial}),Co=()=>({selector:m(x,ge,(t,r)=>[t,r]),action:()=>Le(),map:([t])=>t.favoriteOrLastUsedLocation?.data,shouldDispatch:([t,r])=>r&&t.favoriteOrLastUsedLocation.status===O.initial}),xo=m(x,t=>t.favoriteOrLastUsedLocation.status),So=m(x,t=>t.favoriteOrLastUsedLocation?.data),vo=m(x,t=>!!(t.favoriteOrLastUsedLocation?.data||t.selectedLocation)),yo=m(x,t=>t.selectedLocation?t.selectedLocation:Bt(t.favoriteOrLastUsedLocation?.data)),Ao=m(x,t=>t.selectedLocation||void 0),Oo=m(x,t=>t.countyInput),Lo=m(x,t=>t.localityInput);var Eo=f(u({},T),{map(t){return t.cart?.__typename==="PendingCartResource"&&t?.cart?.actions?.includes(W.SetBilling)}}),be=f(u({},T),{map(t){return t.cart?.__typename==="PendingCartResource"&&t?.cart?.actions?.includes(W.SetBilling)}}),Mt=f(u({},T),{map(t){return t.cart?.__typename==="PendingCartResource"&&(t?.cart?.actions?.includes(W.SetBilling)||t?.cart?.actions?.includes(W.SetBillingParty))}}),Vo=f(u({},T),{map(t){return t.cart?.__typename==="PendingCartResource"&&t?.cart?.actions?.includes(W.SetShipping)}}),se=f(u({},T),{map:t=>t.cart?.__typename==="PendingCartResource"?Oe.fromCartBillingAddressToAddressRelation(t.cart?.billing):void 0}),ae=f(u({},T),{map:t=>t.cart?.__typename==="PendingCartResource"&&t.cart?.shipping?Oe.fromCartShippingAddressToAddressRelation(t.cart.shipping):void 0,filter:t=>t.status===O.success||t.status===O.error}),Do=f(u({},T),{map:t=>t.cart?.__typename==="PendingCartResource"&&t.cart.shipping?.shippingType?t.cart.shipping.shippingType:void 0}),Rt=f(u({},T),{map:t=>t.newClientAcquisition.generateNewAddressOTP}),de=f(u({},T),{map:t=>t.newClientAcquisition.verifyNewAddressOTP}),No=f(u({},T),{map:t=>!!(t.cart?.__typename==="PendingCartResource"&&t.cart.isEligibleForLockers)}),ko=m(Ae,t=>!(t.cart?.__typename==="PendingCartResource"&&t.cart.shipping?.shippingType.fixedLocation)),Bo=m(Ae,t=>{if(t.cart?.__typename==="PendingCartResource")return t.shippingAddressSource});var le=function(t){return t[t.CUSTOMER=0]="CUSTOMER",t[t.FIXED_LOCATION=1]="FIXED_LOCATION",t[t.PICKUP_IN_STORE=2]="PICKUP_IN_STORE",t}(le||{}),ce=function(t){return t.CUSTOMER="customer",t.FIXED_LOCATION="fixed-location",t.PICKUP_IN_STORE="pickup-in-store",t}(ce||{}),$o={[ce.CUSTOMER]:le.CUSTOMER,[ce.FIXED_LOCATION]:le.FIXED_LOCATION,[ce.PICKUP_IN_STORE]:le.PICKUP_IN_STORE},Ie=function(t){return t.validationErrors="validationErrors",t.maxOtpCodesVerificationAttempts="maxOtpCodesVerificationAttempts",t}(Ie||{}),Te=function(t){return t.validationErrors="validationErrors",t.maxOtpCodesGenerationAttempts="maxOtpCodesGenerationAttempts",t.invalidOtpCode="invalidOtpCode",t}(Te||{});var Ut=(()=>{class t{constructor(e){this.httpClient=e,this.isDev=document.location.href.indexOf("localhost")>-1||document.location.href.indexOf("dev")>-1||document.location.href.indexOf("dev3")>-1,this.toggleUrl=this.isDev?"https://www-dev.orange.ro/webshopportlets/api/trafic-to-eshop":"https://www.orange.ro/webshopportlets/api/trafic-to-eshop"}isTrafficToNewShop(){return this.cache$||(this.cache$=this.httpClient.get(this.toggleUrl).pipe($(1))),this.cache$}checkIfIsDev(){return M(this.isDev)}static{this.\u0275fac=function(i){return new(i||t)(V(ie))}}static{this.\u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var jt=(t,r,e)=>({cartStatus:t,generateNewAddressOTP:r,verifyNewAddressOTP:e});function Yt(t,r){t&1&&(g(0,"strong"),_(1),h()),t&2&&(y(),_e(" ",r,". "))}function Zt(t,r){t&1&&ke(0,"oro-skeleton-loader-line",16)}function Jt(t,r){if(t&1){let e=te();g(0,"input",17),N("keyup",function(o){let s=U(e).$implicit,n=L(2);return G(n.switchInput(o,s))}),h()}if(t&2){let e=r.$implicit;X("formControlName",e)("id",e)}}function Qt(t,r){t&1&&_(0," Codul este necesar. ")}function ei(t,r){t&1&&_(0," Num\u0103r de caractere invalid. ")}function ti(t,r){if(t&1&&(g(0,"p",9),A(1,Qt,1,0)(2,ei,1,0),h()),t&2){let e=L(2);y(),I(1,!(e.inputOne==null||e.inputOne.errors==null)&&e.inputOne.errors.required?1:!(e.inputOne==null||e.inputOne.errors==null)&&e.inputOne.errors.minlength||!(e.inputOne==null||e.inputOne.errors==null)&&e.inputOne.errors.maxlength?2:-1)}}function ii(t,r){t&1&&_(0),t&2&&_e(" \xEEn [",r,"] secunde ")}function oi(t,r){t&1&&(g(0,"oro-alert",18),_(1," A intervenit o problem\u0103 \xEEn generarea codului OTP. Te rug\u0103m \xEEncearc\u0103 mai t\xE2rziu. "),h())}function ri(t,r){t&1&&(g(0,"oro-alert",18),_(1," Ai atins num\u0103rul maxim de coduri generate. "),h())}function ni(t,r){t&1&&(g(0,"oro-alert",18),_(1," Codul introdus este invalid. "),h())}function si(t,r){if(t&1&&_(0),t&2){let e=L(2).$implicit;fe(" ",e.message,". Error code: ",e.extensions.errorCode," ")}}function ai(t,r){t&1&&_(0," A intervenit o eroare. ")}function di(t,r){if(t&1&&(g(0,"oro-alert",18),A(1,si,1,2),w(2,"async"),A(3,ai,1,0),h()),t&2){let e=L(4);y(),I(1,P(2,1,e.isDev$)?1:3)}}function li(t,r){if(t&1&&A(0,oi,2,0)(1,ri,2,0)(2,ni,2,0)(3,di,4,3),t&2){let e,i=r.$implicit,o=L(3);I(0,(e=i.extensions.errorCode)===o.generateNewClientAcquisitionOTPTypeErrors.validationErrors?0:e===o.generateNewClientAcquisitionOTPTypeErrors.maxOtpCodesGenerationAttempts?1:e===o.generateNewClientAcquisitionOTPTypeErrors.invalidOtpCode?2:3)}}function ci(t,r){t&1&&Q(0,li,4,1,null,null,J),t&2&&ee(r.errors)}function pi(t,r){t&1&&(g(0,"oro-alert",18),_(1," Codul introdus nu coincide cu cel primit prin sms. Te rog s\u0103 reintroduci codul. "),h())}function ui(t,r){t&1&&(g(0,"oro-alert",18),_(1," Ai atins num\u0103rul maxim de coduri pentru ast\u0103zi. Te rug\u0103m s\u0103 \xEEncerci peste 24h. "),h())}function mi(t,r){if(t&1&&_(0),t&2){let e=L(2).$implicit;fe(" ",e.message,". Error code: ",e.extensions.errorCode," ")}}function hi(t,r){t&1&&_(0," A intervenit o eroare. ")}function _i(t,r){if(t&1&&(g(0,"oro-alert",18),A(1,mi,1,2),w(2,"async"),A(3,hi,1,0),h()),t&2){let e=L(4);y(),I(1,P(2,1,e.isDev$)?1:3)}}function fi(t,r){if(t&1&&A(0,pi,2,0)(1,ui,2,0)(2,_i,4,3),t&2){let e,i=r.$implicit,o=L(3);I(0,(e=i.extensions.errorCode)===o.validationNumberTypeErrors.validationErrors?0:e===o.validationNumberTypeErrors.maxOtpCodesVerificationAttempts?1:2)}}function gi(t,r){t&1&&Q(0,fi,3,1,null,null,J),t&2&&ee(r.errors)}function Ci(t,r){if(t&1){let e=te();g(0,"button",19),N("click",function(){U(e);let o=L(2);return G(o.forceCheckSMSCode(!0))}),_(1," For\u021Beaz\u0103 validarea "),h()}}function xi(t,r){if(t&1){let e=te();g(0,"div",0)(1,"div",1)(2,"h3",2),_(3,"Cod PIN"),h(),g(4,"button",3),N("click",function(){U(e);let o=L();return G(o.cancel())}),g(5,"span",4),_(6,"\xD7"),h()()(),g(7,"div",5)(8,"p",6),_(9," Pentru a continua procesul, introdu codul de validare primit prin SMS la num\u0103rul "),A(10,Yt,2,1,"strong"),w(11,"async"),A(12,Zt,1,0),h(),g(13,"form",7),Q(14,Jt,1,2,"input",8,J),h(),A(16,ti,3,1,"p",9),g(17,"div",10)(18,"p",11),_(19,"Nu ai primit codul PIN?"),h(),g(20,"button",12),N("click",function(){U(e);let o=L();return G(o.sendCodeAgain())}),_(21," Retrimite cod "),A(22,ii,1,1),w(23,"async"),h()(),A(24,ci,2,0)(25,gi,2,0),h(),g(26,"div",13)(27,"button",14),N("click",function(){U(e);let o=L();return G(o.checkSMSCode())}),_(28," Valideaz\u0103 "),h(),A(29,Ci,2,0,"button",15),w(30,"async"),h()()}if(t&2){let e,i,o,s,n=r,a=L();y(10),I(10,(e=P(11,9,a.notificationMsisdn$))?10:12,e),y(3),X("formGroup",a.form),y(),ee(a.otpFields),y(2),I(16,a.inputOne!=null&&a.inputOne.touched?16:-1),y(4),X("disabled",n.cartStatus===a.XhrStatus.loading||a.disableResendButton||!a.countdownCompleted||a.disableValidationButton),y(2),I(22,(i=!a.countdownCompleted&&P(23,11,a.countdown$))?22:-1,i),y(2),I(24,(o=n.generateNewAddressOTP)?24:-1,o),y(),I(25,(s=n.verifyNewAddressOTP)?25:-1,s),y(2),X("disabled",a.form.invalid||n.cartStatus===a.XhrStatus.loading||a.disableValidationButton),y(2),I(29,P(30,13,a.isImpersonating$)?29:-1)}}var Gt=window;Gt.dataLayer=Gt.dataLayer||[];var Wt=(()=>{class t extends Je{constructor(e,i,o,s,n,a){super(),this.dialogRef=e,this.storeSelector=i,this.trafficService=o,this.cartDeliveryAddressService=s,this.elementRef=n,this.data=a,this.otpFields=["one","two","three","four","five","six"],this.XhrStatus=O,this.validationNumberTypeErrors=Ie,this.generateNewClientAcquisitionOTPTypeErrors=Te,this.countdownCompleted=!0,this.form=new It({one:new k("",[C.required,C.minLength(1),C.maxLength(1)]),two:new k("",[C.required,C.minLength(1),C.maxLength(1)]),three:new k("",[C.required,C.minLength(1),C.maxLength(1)]),four:new k("",[C.required,C.minLength(1),C.maxLength(1)]),five:new k("",[C.required,C.minLength(1),C.maxLength(1)]),six:new k("",[C.required,C.minLength(1),C.maxLength(1)])}),this.isImpersonating$=this.storeSelector.getWithSelector(We)}get inputOne(){return this.form.get("one")}get inputTwo(){return this.form.get("two")}get inputThree(){return this.form.get("three")}get inputFour(){return this.form.get("four")}get inputFive(){return this.form.get("five")}get inputSix(){return this.form.get("six")}onClick(e){this.elementRef.nativeElement.contains(e.target)||this.closeAddressForm()}ngOnInit(){this.generateNewAddressOTP$=this.storeSelector.getWithSelector(Rt),this.verifyNewAddressOTP$=this.storeSelector.getWithSelector(de),this.cartStatus$=this.storeSelector.getWithSelector(Ze),this.isDev$=this.trafficService.checkIfIsDev(),this.notificationMsisdn$=this.generateNewAddressOTP$.pipe(S(e=>e.msisdn)),this.checkIfNeedToDisableButtons(),this.verifyNewAddressOTP$.pipe(Y(this.destroyed$)).subscribe(e=>{e&&e.verified===!0&&this.dialogRef.close({isCompleteOrder:this.data.isCompleteOrder,verified:!0})}),this.startCountdown()}checkSMSCode(){if(this.form.valid&&this.inputOne?.value){let e=this.inputOne?.value+this.inputTwo?.value+this.inputThree?.value+this.inputFour?.value+this.inputFive?.value+this.inputSix?.value;this.cartDeliveryAddressService.handleVerifyNewAddressOTP(e),this.track("Add Address - Validate PIN")}}forceCheckSMSCode(e){e&&(this.cartDeliveryAddressService.handleVerifyNewAddressOTP("",e),this.track("Add Address - Validate PIN"))}sendCodeAgain(){this.startCountdown(),this.cartDeliveryAddressService.generateNewAddressOTP(),this.track("Add Address - Resend PIN")}switchInput(e,i){let o=document.getElementById("one"),s=document.getElementById("two"),n=document.getElementById("three"),a=document.getElementById("four"),l=document.getElementById("five"),v=document.getElementById("six");if(o.value.length===6){let p=o.value;o.value="",this.inputOne?.setValue(p[0]),o.value=p[0],this.inputTwo?.setValue(p[1]),s.value=p[1],this.inputThree?.setValue(p[2]),n.value=p[2],this.inputFour?.setValue(p[3]),a.value=p[3],this.inputFive?.setValue(p[4]),l.value=p[4],this.inputSix?.setValue(p[5]),v.value=p[5],v.focus();return}if(o.value&&o.value.length>1){o.value="";return}if(s.value&&s.value.length>1){s.value="";return}if(n.value&&n.value.length>1){n.value="";return}if(a.value&&a.value.length>1){a.value="";return}if(l.value&&l.value.length>1){l.value="";return}if(v.value&&v.value.length>1){v.value="";return}if(i==="one"&&o.value.length===1){s?.focus();return}if(i==="two"&&s.value.length===1){n?.focus();return}if(i==="three"&&n.value.length===1){a?.focus();return}if(i==="four"&&a.value.length===1){l?.focus();return}i==="five"&&l.value.length===1&&v?.focus(),e.key==="Backspace"&&(i==="six"&&(v.value="",l.focus()),i==="five"&&(l.value="",a.focus()),i==="four"&&(a.value="",n.focus()),i==="three"&&(n.value="",s.focus()),i==="two"&&(s.value="",o.focus()),i==="one"&&(o.value=""))}checkIfNeedToDisableButtons(){this.generateNewAddressOTP$.pipe(Y(this.destroyed$)).subscribe(e=>{e.errors?e.errors.forEach(i=>{this.disableResendButton=i.extensions.errorCode===this.generateNewClientAcquisitionOTPTypeErrors.maxOtpCodesGenerationAttempts}):this.disableResendButton=!1}),this.verifyNewAddressOTP$.pipe(Y(this.destroyed$)).subscribe(e=>{e.errors?e.errors.forEach(i=>{this.disableValidationButton=i.extensions.errorCode===this.validationNumberTypeErrors.maxOtpCodesVerificationAttempts}):this.disableValidationButton=!1})}cancel(){this.dialogRef.close(),this.closeAddressForm()}closeAddressForm(){this.cartDeliveryAddressService._newCustomerDeliveryAddress.next({}),this.cartDeliveryAddressService.handleCloseDeliveryAddressForm(),this.track("Cancel Add Address")}track(e){let i={event:at.MIKRO_USER_CLICK,event_action:dt.CHECKOUT_DELIVERY_OPTIONS,event_category:lt.CHECKOUT,event_label:e,event_value:ct.ZERO};yt.analyticsPush(i)}startCountdown(){this.countdownCompleted=!1;let e=60;this.countdown$=we(1e3).pipe(R(e+1),S(i=>e-i),S(i=>(this.countdownCompleted=i===0,i)))}static{this.\u0275fac=function(i){return new(i||t)(D(rt),D(re),D(Ut),D(zt),D(Ve),D(nt))}}static{this.\u0275cmp=Ee({type:t,selectors:[["oro-otp-address-validation"]],hostBindings:function(i,o){i&1&&N("click",function(n){return o.onClick(n)},!1,De)},standalone:!0,features:[Ne,Be],decls:4,vars:11,consts:[[1,"otp-modal"],[1,"otp-modal__header"],[1,"otp-modal__tile"],["aria-label","Close",1,"otp-modal__close-button",3,"click"],["aria-hidden","true"],[1,"otp-modal__body"],[1,"otp-modal__description"],[1,"otp-modal__form",3,"formGroup"],["matInput","","type","text",1,"otp-modal__input",3,"formControlName","id"],[1,"otp-modal__error"],[1,"otp-modal__retry"],[1,"otp-modal__retry-text"],[1,"otp-modal__retry-button",3,"click","disabled"],[1,"otp-modal__footer"],[1,"btn","btn-primary",3,"click","disabled"],[1,"btn","btn-danger"],["height","15px","width","99px",2,"display","inline-block"],["matInput","","type","text",1,"otp-modal__input",3,"keyup","formControlName","id"],["type","error",1,"otp-modal__alert"],[1,"btn","btn-danger",3,"click"]],template:function(i,o){if(i&1&&(A(0,xi,31,15,"div",0),w(1,"async"),w(2,"async"),w(3,"async")),i&2){let s;I(0,(s=Me(7,jt,P(1,1,o.cartStatus$),P(2,3,o.generateNewAddressOTP$),P(3,5,o.verifyNewAddressOTP$)))?0:-1,s)}},dependencies:[Pt,Tt,Ot,Lt,bt,Et,Ft,wt,Dt,Vt,Re,At],styles:[".mat-mdc-dialog-container{border-radius:4px!important;padding:0;margin:1rem} .mat-mdc-dialog-container .mat-mdc-dialog-surface{padding:0} body.modal-open{height:100vh;overflow-y:hidden}.otp-modal__header[_ngcontent-%COMP%]{position:relative;display:flex;align-items:flex-start;justify-content:space-between;padding:16px 40px;border-bottom:1px solid #DDDDDD;border-top-left-radius:0;border-top-right-radius:0}.otp-modal__title[_ngcontent-%COMP%]{font-size:21px;line-height:26px;margin-bottom:0}.otp-modal__close-button[_ngcontent-%COMP%]{position:absolute;right:2.3rem;top:2.3rem;padding:15px;margin:-2rem -2rem -2rem auto;background:none;border:none;font-size:calc(1.275rem + .3vw);cursor:pointer;font-weight:bolder}.otp-modal__body[_ngcontent-%COMP%]{padding:20px 1rem}.otp-modal__description[_ngcontent-%COMP%]{margin-bottom:16px;font-size:1rem;line-height:24px}.otp-modal__form[_ngcontent-%COMP%]{display:flex;flex-direction:row;column-gap:6px}.otp-modal__input[_ngcontent-%COMP%]{width:45px;height:48px;border-radius:6px;outline:none;font-size:40px;line-height:40px;font-weight:700;text-align:center;border:2px solid #979797;caret-color:#ff7900;padding-inline:2px!important}.otp-modal__input[_ngcontent-%COMP%]::-webkit-inner-spin-button, .otp-modal__input[_ngcontent-%COMP%]::-webkit-outer-spin-button{display:none}.otp-modal__error[_ngcontent-%COMP%]{display:block;font-size:14px;line-height:18px;color:#cd3c14;margin:0;margin-top:1rem}.otp-modal__retry[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;margin-top:16px}.otp-modal__retry-text[_ngcontent-%COMP%]{font-size:12px;line-height:14px;color:#666;margin-bottom:0;margin-right:1rem}.otp-modal__retry-button[_ngcontent-%COMP%]{display:inline-block;border:none;font-size:12px;line-height:14px;box-shadow:none;background:transparent;padding:0;margin:0;color:#ff7900;cursor:pointer}.otp-modal__retry-button[_ngcontent-%COMP%]:disabled{color:#ccc!important;cursor:not-allowed}.otp-modal__alert[_ngcontent-%COMP%]{margin:1rem 0}.otp-modal__footer[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:1.75rem;border-top:1px solid #DDDDDD}.otp-modal__footer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{max-width:277px;width:100%;height:44px;margin:auto;font-size:1rem;font-weight:700;cursor:pointer;border:none}.otp-modal__footer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{cursor:not-allowed}.otp-modal__footer[_ngcontent-%COMP%] button.btn-danger[_ngcontent-%COMP%]{margin-top:1rem}@media screen and (min-width: 768px){.otp-modal__header[_ngcontent-%COMP%]{padding:16px 40px}.otp-modal__body[_ngcontent-%COMP%]{padding:20px 40px}.otp-modal__description[_ngcontent-%COMP%]{font-size:17px;margin-bottom:36px}.otp-modal__input[_ngcontent-%COMP%]{width:60px;height:63px;font-size:51px;line-height:31px}.otp-modal__retry-text[_ngcontent-%COMP%], .otp-modal__retry-button[_ngcontent-%COMP%]{font-size:14px;line-height:18px}.otp-modal__footer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{max-width:277px;width:100%;height:44px;margin:auto}}"]})}}return t})();var vi={withCredentials:!0};function yi(t){return tt((r,e)=>r.address?.addressId===e.address?.addressId,t)}var zt=(()=>{class t{constructor(e,i,o,s,n){this.storeSelector=e,this.store=i,this.actions$=o,this.http=s,this.matDialog=n,this._newCustomerDeliveryAddress=new b({}),this.setDeliveryAddressSuccess$=new pe,this.deliveryAddressChanged$=new pe,this._fixedLocationContactPersonSource=new b({}),this.fixedLocationContactPerson$=this._fixedLocationContactPersonSource.asObservable(),this._selectedDeliveryAddressErrorSource=new b(!1),this.selectedDeliveryAddressError$=this._selectedDeliveryAddressErrorSource.asObservable(),this._deliveryAddressDataSource=new b({}),this.deliveryAddressData$=this._deliveryAddressDataSource.asObservable(),this._deliveryAddressFormIsVisibleSource=new b(!1),this.deliveryAddressFormIsVisible$=this._deliveryAddressFormIsVisibleSource.asObservable(),this._billingAddressDataSource=new b({}),this.billingAddressData$=this._billingAddressDataSource.asObservable(),this._billingAddressFormIsVisibleSource=new b(!1),this.billingAddressFormIsVisible$=this._billingAddressFormIsVisibleSource.asObservable(),this._addressFormIsVisibleSource=new b(!1),this.addressFormVisible$=this._addressFormIsVisibleSource.asObservable(),this._addressToggleAriadNextSource=new b(!1),this.addressToggleAriadNext$=this._addressToggleAriadNextSource.asObservable(),this.deliveryFormCompleted$=new Fe,this._preferredNotificationChannelSource=new b(!1),this.preferredNotificationChannel$=this._preferredNotificationChannelSource.asObservable(),this._isBillingAddressEditForm=new b(!1),this.isBillingAddressEditForm$=this._isBillingAddressEditForm.asObservable(),this.deliveryAddressOpenContext=he(void 0),this.editModeSubject=new b(null),this.editMode$=this.editModeSubject.asObservable(),this.notificationChannelLoading=he(!0)}getSelectedShippingAddress(){return z([this.getShippingAddressList().pipe(E()),this.storeSelector.getWithSelector(ae).pipe(E()),this.storeSelector.getWithSelector(xe).pipe(E()),this.storeSelector.getWithSelector(je()).pipe(E()),this.storeSelector.getWithSelector(Ye).pipe(E()),this.storeSelector.getWithSelector(T).pipe(E())]).pipe(F(([e,i,o,s,n,a])=>a.status!==O.loading&&a.cart?.__typename==="PendingCartResource"),S(([e,i,o,s,n,a])=>{if(this.isLoggedIn=o,this.selectorCartItemIsOfyOrLoy=s,this.hasAtLeastOneLoyaltyProduct=n,i?.address?.addressId){let l=e.find(v=>i.address.addressId===v.address?.addressId&&K(v.party,i.party));if(l)return this.checkShippingAddressIsComplete(l),l}else if(o){let l=e.find(({isSelected:p})=>p)||e[0],v=a.cart.shipping?.shippingType.selection;return this.checkShippingAddressIsComplete(l),l&&(!v||v===qe.Customer)&&this.store.dispatch(ve({address:l})),l}})).pipe(F(e=>!!e?.party?.type||!e)).pipe($({bufferSize:1,refCount:!0}))}getSelectedBillingAddress(){return z([this.getBillingAddressList(),this.storeSelector.getWithSelector(se),this.storeSelector.getWithSelector(xe)]).pipe(S(([e,i,o])=>{if(i?.address?.addressId){let s=e.find(n=>i.address?.addressId===n.address?.addressId&&K(n.party,i.party));if(s)return s}else if(o){let s=e.find(({isSelected:n})=>n)||e[0];return s&&this.store.dispatch(ve({address:s})),s}})).pipe(F(e=>!!e?.party?.type||!e)).pipe($({bufferSize:1,refCount:!0}))}getShippingAddressList(){return this.storeSelector.getWithSelector(Ce()).pipe(F(e=>e.status===O.success),S(e=>e.me?.ssoId),E(),S(e=>!!e),H(e=>e?this.getLoggedInUserDeliveryAddresses():this.getGuestUserDeliveryAddresses()))}getBillingAddressList(){return this.storeSelector.getWithSelector(Ce()).pipe(F(e=>e.status===O.success)).pipe(S(e=>!!e.me?.ssoId)).pipe(H(e=>e?z([this.storeSelector.getWithSelector(it),this.storeSelector.getWithSelector(Mt),this.storeSelector.getWithSelector(be),this.storeSelector.getWithSelector(se),this.storeSelector.getWithSelector(be).pipe(H(i=>i?this.storeSelector.getWithSelector(Ke()).pipe(F(({status:o})=>o!==O.loading)).pipe(S(({list:o})=>o)):M([])))]).pipe(S(([i,o,s,n,a])=>{if(!s&&n)return[f(u({},n),{isEditable:!1,isSelected:!0})];if(s&&n&&a?.length===0)return[f(u({},n),{isEditable:!0,isSelected:!0})];let l=a?Array.from(a):[];if(n&&n.address?.addressId){let p=l.find(B=>B.address?.addressId===n.address?.addressId&&K(n.party,B.party));if(!p&&(p=l.find(B=>B.address?.addressId===n.address?.addressId),p)){let B=l.indexOf(p);l[B]=f(u({},p),{party:n.party})}}if(o||!n?.party)return l;let v=l?.map(p=>f(u({},p),{party:n.party}));return yi(v)})):this.storeSelector.getWithSelector(se).pipe(S(i=>i?[f(u({},i),{isEditable:!0})]:[]))))}getSelectedDeliveryAddressError(){return this.selectedDeliveryAddressError$}deleteShippingAddressFromCart(){return this._deliveryAddressFormIsVisibleSource.next(!1),this._deliveryAddressDataSource.next({}),this.store.dispatch(gt()),this._addressFormIsVisibleSource.next(!1),this._addressToggleAriadNextSource.next(!1),ue(this.actions$.pipe(j(Ct)).pipe(q(!0)),this.actions$.pipe(j(xt)).pipe(q(!1)))}deleteBillingAddressFromCart(){return this._billingAddressFormIsVisibleSource.next(!1),this._billingAddressDataSource.next({}),this.store.dispatch(ut({billing:null})),ue(this.actions$.pipe(j(ht)).pipe(q(!0)),this.actions$.pipe(j(mt)).pipe(q(!1)))}checkIfAddressIsCorrect(e){e.address&&!e.address.county.name||e.address&&!e.address.locality.name||e.address&&!e.address.street?.name&&!e.address.streetName||e.party&&!e.party.name?this._selectedDeliveryAddressErrorSource.next(!0):this._selectedDeliveryAddressErrorSource.next(!1)}getDeliveryAddressData(){return this.deliveryAddressData$}getIsDeliveryFormCompleted(){return this.deliveryFormCompleted$}setIsDeliveryFormCompleted(e){return this.deliveryFormCompleted$.next(e)}getDeliveryAddressFormIsVisible(){return this.deliveryAddressFormIsVisible$}handleCloseDeliveryAddressForm(){this._deliveryAddressFormIsVisibleSource.next(!1),this._deliveryAddressDataSource.next({}),this._addressFormIsVisibleSource.next(!1),this._addressToggleAriadNextSource.next(!1)}handleAddDeliveryAddress(){this._deliveryAddressFormIsVisibleSource.next(!0),this._addressFormIsVisibleSource.next(!0),this.deliveryAddressOpenContext.set("Add"),this.handleCloseBillingAddressForm()}handleEditDeliveryAddress(e,i){this._deliveryAddressDataSource.next({deliveryAddress:e,options:i}),this._deliveryAddressFormIsVisibleSource.next(!0),this._addressFormIsVisibleSource.next(!0),this.deliveryAddressOpenContext.set("Edit"),this.handleCloseBillingAddressForm()}getBillingAddressData(){return this.billingAddressData$}getBillingAddressFormIsVisible(){return this.billingAddressFormIsVisible$}handleCloseBillingAddressForm(){this._billingAddressFormIsVisibleSource.next(!1),this._billingAddressDataSource.next({})}handleAddBillingAddress(){this._isBillingAddressEditForm.next(!1),this._billingAddressFormIsVisibleSource.next(!0),this.handleCloseDeliveryAddressForm()}handleActivateEditForCompany(){this._isBillingAddressEditForm.next(!0)}handleEditBillingAddress(e,i){this._isBillingAddressEditForm.next(!0),this._billingAddressDataSource.next({billingAddress:e,options:i}),this._billingAddressFormIsVisibleSource.next(!0),this.handleCloseDeliveryAddressForm()}handleEditBillingAddressForCompany(e,i){this._isBillingAddressEditForm.next(!1),this._billingAddressDataSource.next({billingAddress:e,options:i}),this._billingAddressFormIsVisibleSource.next(!0)}handleSelectAddress(e){e.type===oe.DELIVERY?this.handleSelectShippingAddress(e):e.type===oe.BILLING&&this.handleSelectBillingAddress(e)}handleSelectShippingAddress(e){!e.party?.type||!e.party?.name?this.editShippingAddress(e):this.selectShippingAddress(e)}handleSelectBillingAddress(e){!e.party?.type||!e.party?.name?this.handleEditBillingAddress(e,{autoDirty:!0}):e.party?.type!==Se.Person?this.handleEditBillingAddressForCompany(e,{autoDirty:!0}):this.store.dispatch(ye({address:e}))}checkOTP(e){return this.storeSelector.getWithSelector(de).pipe(R(1),H(i=>i.verified?M({verified:!0}):this.handleGenerateNewAddressOTP(e?.generateNewAddressOTPPayload)),me(i=>{!i?.verified&&e?.closeOTPDialogCallback&&e.closeOTPDialogCallback()}),F(i=>!!i?.verified),R(1))}selectShippingAddress(e){let i=()=>{this.store.dispatch(_t({addressType:null})),this.store.dispatch(ye({address:e}))};this.handleAddressActionBasedOnOTP({callback:i,extraCheck:void 0,address:e})}editShippingAddress(e){let i=()=>{this.handleEditDeliveryAddress(e,{autoDirty:!0,emailValueSet:!1})};this.handleAddressActionBasedOnOTP({callback:i,extraCheck:void 0,address:e,checkOTOPayload:{generateNewAddressOTPPayload:{address:e,isCompleteOrder:!1}}})}handleAddressActionBasedOnOTP({callback:e,address:i,extraCheck:o,checkOTOPayload:s}){typeof o=="boolean"&&!o&&e(),this.requiresOTPValidation(i)?this.checkOTP(s).subscribe(()=>{e()}):e()}requiresOTPValidation(e){return(this.selectorCartItemIsOfyOrLoy||this.hasAtLeastOneLoyaltyProduct)&&(e&&!e.otpValidated||!e)&&this.isLoggedIn}mapAddressToCommonObject(e,i){return i&&e.address&&(e.address=ne("zipCode",e.address),e.address.locality=ne("zipCode",e.address.locality),e.address.street=ne("zipCode",e.address.street)),e.address=e.address,e.address.apartment=e.address?.apartment?e.address.apartment:"",e.address.building=e.address?.building?e.address.building:"",e.address.streetNo=e.address?.streetNo?e.address.streetNo:"",e.address.staircase=e.address?.staircase?e.address.staircase:"",e}getAddressFormIsVisible(){return this.addressFormVisible$}setAddressToggleAriadNext(e){return this._addressToggleAriadNextSource.next(e)}getAddressToggleAriadNext(){return this.addressToggleAriadNext$}setFixedLocationContactPerson(e,i=!0){this._fixedLocationContactPersonSource.next(e),i&&this.store.dispatch(ft({shippingTypeSelection:ze.FixedLocation}))}getNotificationChannelByOCN(){return this.notificationChannelLoading.set(!0),this.http.get(`${$e.getCartV2ApiUrl()}/consent/notification-channel`,f(u({},vi),{responseType:"text"})).pipe(me(()=>this.notificationChannelLoading.set(!1)),Pe(e=>(this.notificationChannelLoading.set(!1),M(void 0))),F(Qe),$({bufferSize:1,refCount:!0}))}getPreferredNotificationChannel(){return this.preferredNotificationChannel$}setPreferredNotificationChannel(e){return this._preferredNotificationChannelSource.next(e)}selectPreferredNotificationChannel(e){this.storeSelector.getWithSelector(Nt()).pipe(R(1)).subscribe(i=>{let{insuranceTermsAgreed:o,isAbove16:s,hasPaymentCommitment:n,keepIdCard:a,gdprConsents:l}=i;this.store.dispatch(ot({insuranceTermsAgreed:o,isAbove16:s,hasPaymentCommitment:n,keepIdCard:a,gdprConsents:l,notificationChannel:e}))})}generateNewAddressOTP(){this.store.dispatch(St())}handleGenerateNewAddressOTP(e){return this.generateNewAddressOTP(),this.dialogRef=this.matDialog.open(Wt,{maxWidth:"500px",data:{isCompleteOrder:e?.isCompleteOrder}}),this.dialogRef.afterClosed()}handleVerifyNewAddressOTP(e,i){this.store.dispatch(vt({code:e,forced:i}))}setEditMode(e){this.editModeSubject.next(e)}getLoggedInUserDeliveryAddresses(){return z([this.storeSelector.getWithSelector(ae),this.storeSelector.getWithSelector(Xe()).pipe(F(e=>e.status===O.success),S(e=>e.list||[]))]).pipe(S(([e,i])=>this.mergeDeliveryAddresses(i,e)))}getGuestUserDeliveryAddresses(){return this.storeSelector.getWithSelector(ae).pipe(S(e=>e?[f(u({},e),{isEditable:!0,shippingAddressSourceSubResource:e.shippingAddressSourceSubResource})]:[]))}mergeDeliveryAddresses(e,i){if(!i?.address?.addressId)return e;let o=Array.from(e),s=this.findDeliveryAddressInList(i,o);if(s){let n=o.indexOf(s);o[n]=f(u({},s),{party:i.party})}return o}findDeliveryAddressInList(e,i){return i.find(o=>o.address?.addressId===e.address?.addressId&&K(e.party,o.party))||i.find(o=>o.address?.addressId===e.address?.addressId)}checkShippingAddressIsComplete(e){e?.address&&(!e?.party||!e?.party?.name||!e?.party?.email||!e?.party?.phone)&&this.handleEditDeliveryAddress(e)}mapBillingAddressRelationToDeliveryAddressRelation(e){return{address:e.address,party:{type:He.Person,name:e.party?.type===Se.Person?e.party.name:"",email:"",phone:""},type:oe.DELIVERY,id:void 0,isEditable:!0,otpValidated:e.otpValidated}}static{this.\u0275fac=function(i){return new(i||t)(V(re),V(Ue),V(pt),V(ie),V(st))}}static{this.\u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();export{Oi as a,Li as b,bi as c,Ii as d,Ti as e,Fi as f,wi as g,Pi as h,Ei as i,kt as j,Vi as k,Di as l,Ni as m,ki as n,Bi as o,Mi as p,Ri as q,$i as r,Ui as s,Gi as t,Wi as u,zi as v,qi as w,Le as x,Hi as y,Xi as z,Ki as A,ji as B,Yi as C,Bt as D,so as E,ao as F,lo as G,po as H,uo as I,mo as J,ho as K,_o as L,fo as M,go as N,Co as O,xo as P,vo as Q,yo as R,Ao as S,Oo as T,Lo as U,Eo as V,be as W,Mt as X,Vo as Y,se as Z,ae as _,Do as $,de as aa,No as ba,ko as ca,Bo as da,Ut as ea,le as fa,ce as ga,$o as ha,zt as ia};