import{a as mt,b as ht,c as _t,d as Ae,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 Le}from"./chunk-PA7GCALF.js";import{a as Nt}from"./chunk-TH6RAJ5T.js";import{d as rt}from"./chunk-UGMPSDL2.js";import{a as yt}from"./chunk-QLGGKSF5.js";import{b as Vt}from"./chunk-2UNZCRGI.js";import{b as Dt}from"./chunk-KS7OJN3O.js";import{c as nt,d as st,e as at}from"./chunk-PHTMXYHJ.js";import{c as dt,e as lt,g as ct,n as pt}from"./chunk-XI2EB733.js";import{Cb as ye,E as xe,Eb as F,I as He,Pb as Ye,Rb as Ze,Vb as Je,Xa as re,h as U,ib as Se,jb as ve,nb as Xe,tb as Ke,u as qe,ub as je}from"./chunk-73GUXIT2.js";import{E as Pt,F as Et,c as Lt,e as C,h as Ot,i as bt,j as It,l as k,n as Ft,r as Tt,t as wt}from"./chunk-XWZ7QAQL.js";import{a as et}from"./chunk-VAUNVSZV.js";import{a as Qe}from"./chunk-6NIC2JUZ.js";import{V as ot}from"./chunk-C2EV7IAO.js";import{c as ut,d as K}from"./chunk-GXS7C5SQ.js";import{g as fe,i as ge,k as ze,m as Ce,o as ne}from"./chunk-JJTPXY4D.js";import{h as X,k as se,n as tt,q as it}from"./chunk-767ZUJWF.js";import{D as L,d,e as c,s as Ge,v as m,w as We}from"./chunk-ALDBR463.js";import{c as Ue}from"./chunk-2G3AB74T.js";import{h as oe}from"./chunk-VWCGOHBE.js";import{v as $e}from"./chunk-E2GGCCQI.js";import{a as At}from"./chunk-FRKPVHGJ.js";import{Ac as ee,Ba as Ee,Bc as te,Cc as g,Dc as h,Ec as Me,F as G,Ia as J,Ic as ie,K as S,L as W,Na as V,Ob as Ne,Oc as N,Qb as y,Qc as O,Rb as D,T as we,U as ue,V as T,Va as Ve,Z as Pe,a as u,ad as _,b as f,ba as B,bc as me,cc as ke,cd as he,da as z,dd as _e,eb as R,fb as $,ha as E,jd as Be,kc as A,nd as Re,o as pe,ob as De,p as b,q as Te,qc as H,rd as w,sd as P,ua as q,xc as I,ya as Y,za as Z,zc as Q}from"./chunk-V6BPA3D7.js";var Li=d("[Locations] Search Fixed Locations",c()),Oi=d("[Locations] Search Fixed Locations [Success]",c()),bi=d("[Locations] Search Fixed Locations [Error]",c()),Ii=d("[Locations] Get Fixed Location",c()),Fi=d("[Locations] Get Fixed Location [Success]",c()),Ti=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()),Mi=d("[Locations] Get Localities Error",c()),Bi=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()),Oe=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 Mt(t){let r=u({},t);return delete r.__typename,delete r.allowsDropOff,delete r.supportedPaymentType,delete r.schedule,delete r.restrictions,delete r.isFavorite,tt(r)?null:r}var x=We("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===L.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,fe,(t,r)=>[t,r]),action:()=>Oe(),map:([t])=>t.favoriteOrLastUsedLocation,shouldDispatch:([t,r])=>r&&t.favoriteOrLastUsedLocation.status===L.initial}),Co=()=>({selector:m(x,fe,(t,r)=>[t,r]),action:()=>Oe(),map:([t])=>t.favoriteOrLastUsedLocation?.data,shouldDispatch:([t,r])=>r&&t.favoriteOrLastUsedLocation.status===L.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:Mt(t.favoriteOrLastUsedLocation?.data)),Ao=m(x,t=>t.selectedLocation||void 0),Lo=m(x,t=>t.countyInput),Oo=m(x,t=>t.localityInput);var Eo=f(u({},F),{map(t){return t.cart?.__typename==="PendingCartResource"&&t?.cart?.actions?.includes(U.SetBilling)}}),be=f(u({},F),{map(t){return t.cart?.__typename==="PendingCartResource"&&t?.cart?.actions?.includes(U.SetBilling)}}),Bt=f(u({},F),{map(t){return t.cart?.__typename==="PendingCartResource"&&(t?.cart?.actions?.includes(U.SetBilling)||t?.cart?.actions?.includes(U.SetBillingParty))}}),Vo=f(u({},F),{map(t){return t.cart?.__typename==="PendingCartResource"&&t?.cart?.actions?.includes(U.SetShipping)}}),ae=f(u({},F),{map:t=>t.cart?.__typename==="PendingCartResource"?Le.fromCartBillingAddressToAddressRelation(t.cart?.billing):void 0}),de=f(u({},F),{map:t=>t.cart?.__typename==="PendingCartResource"&&t.cart?.shipping?Le.fromCartShippingAddressToAddressRelation(t.cart.shipping):void 0,filter:t=>t.status===L.success||t.status===L.error}),Do=f(u({},F),{map:t=>t.cart?.__typename==="PendingCartResource"&&t.cart.shipping?.shippingType?t.cart.shipping.shippingType:void 0}),Rt=f(u({},F),{map:t=>t.newClientAcquisition.generateNewAddressOTP}),j=f(u({},F),{map:t=>t.newClientAcquisition.verifyNewAddressOTP}),No=f(u({},F),{map:t=>!!(t.cart?.__typename==="PendingCartResource"&&t.cart.isEligibleForLockers)}),ko=m(ye,t=>!(t.cart?.__typename==="PendingCartResource"&&t.cart.shipping?.shippingType.fixedLocation)),Mo=m(ye,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||{}),Fe=function(t){return t.validationErrors="validationErrors",t.maxOtpCodesGenerationAttempts="maxOtpCodesGenerationAttempts",t.invalidOtpCode="invalidOtpCode",t}(Fe||{});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(q(1))),this.cache$}checkIfIsDev(){return G(this.isDev)}static{this.\u0275fac=function(i){return new(i||t)(V(oe))}}static{this.\u0275prov=J({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(),he(" ",r,". "))}function Zt(t,r){t&1&&Me(0,"oro-skeleton-loader-line",16)}function Jt(t,r){if(t&1){let e=ie();g(0,"input",17),N("keyup",function(o){let s=R(e).$implicit,n=O(2);return $(n.switchInput(o,s))}),h()}if(t&2){let e=r.$implicit;H("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=O(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&&he(" \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=O(2).$implicit;_e(" ",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=O(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=O(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&&ee(0,li,4,1,null,null,Q),t&2&&te(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=O(2).$implicit;_e(" ",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=O(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=O(3);I(0,(e=i.extensions.errorCode)===o.validationNumberTypeErrors.validationErrors?0:e===o.validationNumberTypeErrors.maxOtpCodesVerificationAttempts?1:2)}}function gi(t,r){t&1&&ee(0,fi,3,1,null,null,Q),t&2&&te(r.errors)}function Ci(t,r){if(t&1){let e=ie();g(0,"button",19),N("click",function(){R(e);let o=O(2);return $(o.forceCheckSMSCode(!0))}),_(1," For\u021Beaz\u0103 validarea "),h()}}function xi(t,r){if(t&1){let e=ie();g(0,"div",0)(1,"div",1)(2,"h3",2),_(3,"Cod PIN"),h(),g(4,"button",3),N("click",function(){R(e);let o=O();return $(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),ee(14,Jt,1,2,"input",8,Q),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(){R(e);let o=O();return $(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(){R(e);let o=O();return $(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=O();y(10),I(10,(e=P(11,9,a.notificationMsisdn$))?10:12,e),y(3),H("formGroup",a.form),y(),te(a.otpFields),y(2),I(16,a.inputOne!=null&&a.inputOne.touched?16:-1),y(4),H("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),H("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 Qe{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=L,this.validationNumberTypeErrors=Ie,this.generateNewClientAcquisitionOTPTypeErrors=Fe,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(ze)}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(j),this.cartStatus$=this.storeSelector.getWithSelector(Je),this.isDev$=this.trafficService.checkIfIsDev(),this.notificationMsisdn$=this.generateNewAddressOTP$.pipe(S(e=>e.msisdn)),this.checkIfNeedToDisableButtons(),this.verifyNewAddressOTP$.pipe(Z(this.destroyed$)).subscribe(e=>{e&&e.verified===!0&&(this.data.isCompleteOrder||(this.data.address?this.cartDeliveryAddressService.handleEditDeliveryAddress(this.data.address):this.cartDeliveryAddressService.handleAddDeliveryAddress()),this.dialogRef.close(this.data.isCompleteOrder))}),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(Z(this.destroyed$)).subscribe(e=>{e.errors?e.errors.forEach(i=>{this.disableResendButton=i.extensions.errorCode===this.generateNewClientAcquisitionOTPTypeErrors.maxOtpCodesGenerationAttempts}):this.disableResendButton=!1}),this.verifyNewAddressOTP$.pipe(Z(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:dt.MIKRO_USER_CLICK,event_action:lt.CHECKOUT_DELIVERY_OPTIONS,event_category:ct.CHECKOUT,event_label:e,event_value:pt.ZERO};yt.analyticsPush(i)}startCountdown(){this.countdownCompleted=!1;let e=60;this.countdown$=we(1e3).pipe(B(e+1),S(i=>e-i),S(i=>(this.countdownCompleted=i===0,i)))}static{this.\u0275fac=function(i){return new(i||t)(D(nt),D(ne),D(Ut),D(zt),D(De),D(st))}}static{this.\u0275cmp=Ve({type:t,selectors:[["oro-otp-address-validation"]],hostBindings:function(i,o){i&1&&N("click",function(n){return o.onClick(n)},!1,Ne)},standalone:!0,features:[ke,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=Re(7,jt,P(1,1,o.cartStatus$),P(2,3,o.generateNewAddressOTP$),P(3,5,o.verifyNewAddressOTP$)))?0:-1,s)}},dependencies:[Pt,Ft,Lt,Ot,bt,Et,Tt,wt,Dt,Vt,$e,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 it((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 Te,this._preferredNotificationChannelSource=new b(!1),this.preferredNotificationChannel$=this._preferredNotificationChannelSource.asObservable(),this._isBillingAddressEditForm=new b(!1),this.isBillingAddressEditForm$=this._isBillingAddressEditForm.asObservable(),this.deliveryAddressOpenContext=me(void 0),this.editModeSubject=new b(null),this.editMode$=this.editModeSubject.asObservable(),this.notificationChannelLoading=me(!0)}getSelectedShippingAddress(){return W([this.getShippingAddressList().pipe(E()),this.storeSelector.getWithSelector(de).pipe(E()),this.storeSelector.getWithSelector(Ce).pipe(E()),this.storeSelector.getWithSelector(Ye()).pipe(E()),this.storeSelector.getWithSelector(Ze).pipe(E()),this.storeSelector.getWithSelector(F).pipe(E())]).pipe(T(([e,i,o,s,n,a])=>a.status!==L.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&&X(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===He.Customer)&&this.store.dispatch(Se({address:l})),l}})).pipe(T(e=>!!e?.party?.type||!e)).pipe(q(1))}getSelectedBillingAddress(){return W([this.getBillingAddressList(),this.storeSelector.getWithSelector(ae),this.storeSelector.getWithSelector(Ce)]).pipe(S(([e,i,o])=>{if(i?.address?.addressId){let s=e.find(n=>i.address?.addressId===n.address?.addressId&&X(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(Se({address:s})),s}})).pipe(T(e=>!!e?.party?.type||!e))}getShippingAddressList(){return this.storeSelector.getWithSelector(ge()).pipe(T(e=>e.status===L.success),S(e=>e.me?.ssoId),E(),S(e=>!!e),Y(e=>e?this.getLoggedInUserDeliveryAddresses():this.getGuestUserDeliveryAddresses()))}getBillingAddressList(){return this.storeSelector.getWithSelector(ge()).pipe(T(e=>e.status===L.success)).pipe(S(e=>!!e.me?.ssoId)).pipe(Y(e=>e?W([this.storeSelector.getWithSelector(ot),this.storeSelector.getWithSelector(Bt),this.storeSelector.getWithSelector(be),this.storeSelector.getWithSelector(ae),this.storeSelector.getWithSelector(be).pipe(Y(i=>i?this.storeSelector.getWithSelector(je()).pipe(T(({status:o})=>o!==L.loading)).pipe(S(({list:o})=>o)):G([])))]).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(M=>M.address?.addressId===n.address?.addressId&&X(n.party,M.party));if(!p&&(p=l.find(M=>M.address?.addressId===n.address?.addressId),p)){let M=l.indexOf(p);l[M]=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(ae).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(K(Ct)).pipe(z(!0)),this.actions$.pipe(K(xt)).pipe(z(!1)))}deleteBillingAddressFromCart(){return this._billingAddressFormIsVisibleSource.next(!1),this._billingAddressDataSource.next({}),this.store.dispatch(mt({billing:null})),ue(this.actions$.pipe(K(_t)).pipe(z(!0)),this.actions$.pipe(K(ht)).pipe(z(!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===re.BILLING&&this.store.dispatch(Xe({selection:xe.Customer})),!e.party?.type||!e.party?.name?e.type===re.BILLING?this.handleEditBillingAddress(e,{autoDirty:!0}):(this.selectorCartItemIsOfyOrLoy||this.hasAtLeastOneLoyaltyProduct)&&e&&!e.otpValidated&&this.isLoggedIn?this.storeSelector.getWithSelector(j).pipe(B(1)).subscribe(i=>{i.verified?this.handleEditDeliveryAddress(e,{autoDirty:!0,emailValueSet:!1}):this.handleGenerateNewAddressOTP(!1,e)}):this.handleEditDeliveryAddress(e,{autoDirty:!0,emailValueSet:!1}):e?.type===re.BILLING&&e.party?.type!==qe.Person?this.handleEditBillingAddressForCompany(e,{autoDirty:!0}):(this.selectorCartItemIsOfyOrLoy||this.hasAtLeastOneLoyaltyProduct)&&e&&!e.otpValidated&&this.isLoggedIn?this.storeSelector.getWithSelector(j).pipe(B(1)).subscribe(i=>{i.verified?(this.store.dispatch(Ae({addressType:null})),this.store.dispatch(ve({address:e}))):this.handleGenerateNewAddressOTP()}):(this.store.dispatch(Ae({addressType:null})),this.store.dispatch(ve({address:e})))}mapAddressToCommonObject(e,i){return i&&e.address&&(e.address=se("zipCode",e.address),e.address.locality=se("zipCode",e.address.locality),e.address.street=se("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:xe.FixedLocation}))}getNotificationChannelByOCN(){return this.notificationChannelLoading.set(!0),this.http.get(`${Ue.getCartV2ApiUrl()}/consent/notification-channel`,f(u({},vi),{responseType:"text"})).pipe(Ee(()=>this.notificationChannelLoading.set(!1)),Pe(e=>(this.notificationChannelLoading.set(!1),G(void 0))),T(et),q({bufferSize:1,refCount:!0}))}getPreferredNotificationChannel(){return this.preferredNotificationChannel$}setPreferredNotificationChannel(e){return this._preferredNotificationChannelSource.next(e)}selectPreferredNotificationChannel(e){this.storeSelector.getWithSelector(Nt()).pipe(B(1)).subscribe(i=>{let{insuranceTermsAgreed:o,isAbove16:s,hasPaymentCommitment:n,keepIdCard:a,gdprConsents:l}=i;this.store.dispatch(rt({insuranceTermsAgreed:o,isAbove16:s,hasPaymentCommitment:n,keepIdCard:a,gdprConsents:l,notificationChannel:e}))})}generateNewAddressOTP(){this.store.dispatch(St())}handleGenerateNewAddressOTP(e,i){return this.generateNewAddressOTP(),this.dialogRef=this.matDialog.open(Wt,{maxWidth:"500px",data:{isCompleteOrder:e}}),this.dialogRef.afterClosed()}handleVerifyNewAddressOTP(e,i){this.store.dispatch(vt({code:e,forced:i}))}setEditMode(e){this.editModeSubject.next(e)}getLoggedInUserDeliveryAddresses(){return W([this.storeSelector.getWithSelector(de),this.storeSelector.getWithSelector(Ke()).pipe(T(e=>e.status===L.success),S(e=>e.list||[]))]).pipe(S(([e,i])=>this.mergeDeliveryAddresses(i,e)))}getGuestUserDeliveryAddresses(){return this.storeSelector.getWithSelector(de).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&&X(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)}static{this.\u0275fac=function(i){return new(i||t)(V(ne),V(Ge),V(ut),V(oe),V(at))}}static{this.\u0275prov=J({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();export{Li as a,Oi as b,bi as c,Ii as d,Fi as e,Ti 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,Mi as o,Bi as p,Ri as q,$i as r,Ui as s,Gi as t,Wi as u,zi as v,qi as w,Oe as x,Hi as y,Xi as z,Ki as A,ji as B,Yi as C,Mt 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,Lo as T,Oo as U,Eo as V,be as W,Bt as X,Vo as Y,ae as Z,de as _,Do as $,j as aa,No as ba,ko as ca,Mo as da,Ut as ea,le as fa,ce as ga,$o as ha,zt as ia};